Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: plugin system (currently just sprites) #95

Merged
merged 45 commits into from
Jan 2, 2025
Merged

Conversation

andrewbenington
Copy link
Owner

@andrewbenington andrewbenington commented Dec 25, 2024

Description

Added a plugin system, currently allowing new sprite packs to be used but to be expanded to PKM and SAV types in the future. Allowed plugins are listed at OpenHome-Plugins/plugins.json, which can be updated as needed.

To Do

  • Download plugins asynchronously (so app doesn't hang)
  • Investigate ways to make code loading more secure
    (After some investigation, securing plugin code from accessing web resources like Tauri code is not possible without severely restricting what plugins can do. It will be important to vet the plugins allowed to be installed)
    • Restrict plugins from calling Tauri code
  • Save enabled/disabled status of plugins in settings
  • Allow plugins to consume PokemonData from OpenHome instead of needing to package the library themselves
  • Plugin descriptions
  • Plugin versions/update option
  • Delete plugins
  • Separate tabs (browse vs installed)

Issues
Fixes #89

Copy link
Collaborator

@evanwporter evanwporter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than adding the added plugins to a list I think it would be cool to make the installed plugins have a green background and the uninstalled plugins have a red background.

@andrewbenington
Copy link
Owner Author

Rather than adding the added plugins to a list I think it would be cool to make the installed plugins have a green background and the uninstalled plugins have a red background.

red should be a "danger" color and only used when we want to alert the user of a destructive action. plus, I want plugins to be able to have full backgrounds. The current images are only placeholders.

I like the idea of browsing available plugins without having to go past the list of installed ones. I'll move the installed plugin list to its own tab in case the user wants to see those.

@evanwporter
Copy link
Collaborator

red should be a "danger" color and only used when we want to alert the user of a destructive action.

Okay.

The current images are only placeholders.

Oh they are temporary? I really like them... But we should replace the BW sprite pack with Kyurem since that seems more neutral

Also a delete button would be good.

@andrewbenington
Copy link
Owner Author

andrewbenington commented Dec 30, 2024

Oh they are temporary? I really like them... But we should replace the BW sprite pack with Kyurem since that seems more neutral

Actually I like them too. I still think icons should be allowed to take up the whole card in the future, so I'll stick to the bottom right 'installed' chip. And I picked Reshiram because I like its design the most :) same with Xerneas

Also a delete button would be good.

Yeah that's a task in the PR description. I want to finish those before merging

@evanwporter
Copy link
Collaborator

evanwporter commented Dec 31, 2024

@andrewbenington

Instead of a delete + disable/enable dropdown. What about adding the delete to the bottom left and the disable/enable togglable by clicking the card.

image

Edit: next commit makes these changes but it can be reversed.

@evanwporter
Copy link
Collaborator

@andrewbenington

I added a delete button. Currently there is a delay from when the trash can is clicked and when the card is removed. This is due to the backend having to delete all the files then removing the card.

Also I can't get the title styling right, so maybe you could look at it.

@andrewbenington
Copy link
Owner Author

andrewbenington commented Dec 31, 2024

@andrewbenington

I added a delete button. Currently there is a delay from when the trash can is clicked and when the card is removed. This is due to the backend having to delete all the files then removing the card.

Also I can't get the title styling right, so maybe you could look at it.

I like it. I started making a dropdown because I want the option to expand and view plugin details, but I'm thinking clicking the main body of the card will expand to show details, and click the enabled chip to toggle enabled/disabled

And yeah the delete button should probably hide the plugin immediately, even if the files haven't finished deleting. I'll hopefully get to it tomorrow

@andrewbenington andrewbenington marked this pull request as ready for review January 1, 2025 23:18
@andrewbenington
Copy link
Owner Author

@evanwporter I think this is ready to merge into main. If you have a chance can you look at it?

I made a couple styling changes, plus a backend change that will require you to redownload any plugins on the Available Plugins page. Let me know if you run into any issues, I'm going to do some testing on Windows and Linux to make sure

@evanwporter
Copy link
Collaborator

evanwporter commented Jan 2, 2025

The just added sprite packs don't see to be working. But I haven't done any in depth investigation @andrewbenington

@evanwporter
Copy link
Collaborator

evanwporter commented Jan 2, 2025

@andrewbenington

image

image

@andrewbenington
Copy link
Owner Author

@evanwporter
The Sword/Shield plugin sprites were sourced from Bulbapedia, and some of them are missing there (including Dragonite). It's more common for Crown Tundra introduced mons

@evanwporter
Copy link
Collaborator

@andrewbenington Ah okay then it looks good.

@andrewbenington andrewbenington merged commit 434f2a5 into main Jan 2, 2025
3 checks passed
@andrewbenington andrewbenington deleted the plugin-system branch January 2, 2025 04:11
andrewbenington added a commit that referenced this pull request Jan 3, 2025
* Resource pack backend

* simplified `download_images_from_github_folder`

* Added to `tauriInvoker`

* Added button to `Settings` to download gen1 sprite pack.

* ran linter

* initial plugin downloading/management

* plugin card styling

* fix for missing plugin folder

* async plugin download

* keep home mounted

* housekeeping

* move gen 7 sprites to plugin

* start persisting enabled plugins

* plugin enabled status persists correctly

* move gen 6 sprites to plugin

* newline

* bump version

* standardize icon.png and assets dir

* image url update

* Created delete plugin command

* Set up debugging in VSCode (#97)

* Update launch.json

* Update tasks.json

* Fixed it

* renamed `ui` to `frontend`

* Got rid of problem matcher

* Fixed vscode settings

* fix last opened (recent saves) (#99)

* plugin page tabs

* installed plugin dropdown menu

* fix unused var

* added `deletePlugin` to tauri invoker

* Added `deletePLugin` to backend

* made changes

* implmented deletion of plugin

* ran linter

* Moved code w/i `delete_plugin` to generic `util::delete_folder`.

This is so it can be reused in the future

* Fixed display

* Fixed plugin icon covering chips

* added `deletePlugin` to dummy backend

* delete icon styling

* update plugin metadata fields

* log plugin sprite error instead of displaying

* cleanup plugin state on delete

* coalesce plugin actions

* include version and api_version in downloaded metadata

---------

Co-authored-by: evanwporter <[email protected]>
Co-authored-by: Evan <[email protected]>
andrewbenington added a commit that referenced this pull request Jan 4, 2025
* move modal into pokemon details component

* feat: plugin system (currently just sprites) (#95)

* Resource pack backend

* simplified `download_images_from_github_folder`

* Added to `tauriInvoker`

* Added button to `Settings` to download gen1 sprite pack.

* ran linter

* initial plugin downloading/management

* plugin card styling

* fix for missing plugin folder

* async plugin download

* keep home mounted

* housekeeping

* move gen 7 sprites to plugin

* start persisting enabled plugins

* plugin enabled status persists correctly

* move gen 6 sprites to plugin

* newline

* bump version

* standardize icon.png and assets dir

* image url update

* Created delete plugin command

* Set up debugging in VSCode (#97)

* Update launch.json

* Update tasks.json

* Fixed it

* renamed `ui` to `frontend`

* Got rid of problem matcher

* Fixed vscode settings

* fix last opened (recent saves) (#99)

* plugin page tabs

* installed plugin dropdown menu

* fix unused var

* added `deletePlugin` to tauri invoker

* Added `deletePLugin` to backend

* made changes

* implmented deletion of plugin

* ran linter

* Moved code w/i `delete_plugin` to generic `util::delete_folder`.

This is so it can be reused in the future

* Fixed display

* Fixed plugin icon covering chips

* added `deletePlugin` to dummy backend

* delete icon styling

* update plugin metadata fields

* log plugin sprite error instead of displaying

* cleanup plugin state on delete

* coalesce plugin actions

* include version and api_version in downloaded metadata

---------

Co-authored-by: evanwporter <[email protected]>
Co-authored-by: Evan <[email protected]>

* chore: make rust functions more eloquent (#105)

* make rust functions more eloquent

* with_icon_bytes consumes self

* navigation works

* WIP box position display

* box indicator is temporary and sizes better

* cargo lock changes

---------

Co-authored-by: evanwporter <[email protected]>
Co-authored-by: Evan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Low quality pokemon sprites on windows
2 participants