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

[Bug+FR]: Source repo for unlisted plugin does not change if removed and reinstalled from community plugins #11

Open
anonhostpi opened this issue Jun 22, 2024 · 9 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@anonhostpi
Copy link
Contributor

Describe the bug

I recently forked the teleprompter plugin, and published my own release files for it. To add it into Obsidian I removed the original and added mine as an "unlisted" plugin. After getting my changes implemented on the upstream repo, I removed the unlisted plugin and reinstalled the official one.

However, VARE is still pulling releases from my repo despite reinstalling the plugin.

I recommend setting an option to change/update (and reset if applicable) the source repo in VARE's options

I also recommend showing a hint text that shows the currently selected source repository in addition to these:

image

How to Reproduce

Fork a plugin. Add the fork as an unlisted repo. Uninstall the plugin. Reinstall the official plugin.

Expected behavior

Update the source repo on reinstallation

OS of your device

Win10

Obsidian Version

v1.6.3

Plugin Version

0.1.1

Additional context

This is a dual bug report + feature request.

I'd like to be able to change the source repo as well.

@anonhostpi anonhostpi added the bug Something isn't working label Jun 22, 2024
@anonhostpi
Copy link
Contributor Author

This is also a feature request to get a button or text field to update/change the source repo

@anonhostpi
Copy link
Contributor Author

Current work around to reset the repo.

Change the repo value in .obsidian\plugins\vare\data.json, save, then reload obsidian

@4Source 4Source added the enhancement New feature or request label Jun 22, 2024
@4Source
Copy link
Owner

4Source commented Jun 22, 2024

BUG:
I will check the Bug but you need to wait about a month then I finished my exams and I have time to work on this.

FEAT:
I think about add an edit button to the plugins BUT I mean I had this thoughts while dev and decided not to include it because any repo could be added and this could result in difficult to resolve problems. Example:
Other Plugin URL is entered and a version for this is selected the plugin get installed to the old folder but from the manifest it gets a new name. Than the folder name and plugin name doesn't match.

I recently forked the teleprompter plugin, and published my own release files for it. To add it into Obsidian I removed the original and added mine as an "unlisted" plugin.

I had roughly the same idea that you can also install releases from forks. See #9. Maybe this is anything you need?

@anonhostpi
Copy link
Contributor Author

anonhostpi commented Jun 22, 2024

You use app.plugins.installPlugin() under the hood to install the plugin. That method installs the plugin to .obsidian/plugins/{manifest.id}, so at installation time, it is impossible for the folder and the plugin id to be 2 different values.

The problematic behavior that this does cause is that if the manifest.id does not match the plugin listed in VARE, it will install the plugin as an additional plugin (or overwrite a secondary one).

To implement the edit button safely, I would enforce that the upstream manifest.id must be equal to the manifest.id of the associated plugin. If the ids mismatch, throw an error message and tell the user to use the add (+) button instead.

With that said, I would also specifically enforce that the edit and add buttons be separate:

  • If the add button trys to pull a plugin with an id that's already installed, it should throw an error and tell the user to use the edit button
  • If the edit button trys to pull an update that has a mismatched id, it should throw an error tell the user to use the add button

@anonhostpi
Copy link
Contributor Author

The manifest.dir that you use in your plugin is populated and overwritten at runtime by app.plugins.loadManifests() and app.plugins.loadManifest()

@anonhostpi
Copy link
Contributor Author

anonhostpi commented Jun 22, 2024

Also how are themes intended to be installed? I don't see any calls to app.customCss.installLegacyTheme( manifest ) or app.customCss.installTheme( manifest, true /*set to true so that manifest.repo can be used for install*/)?

@4Source
Copy link
Owner

4Source commented Jun 22, 2024

The manifest.dir that you use in your plugin is populated and overwritten at runtime by app.plugins.loadManifests() and app.plugins.loadManifest()

What do you mean? This?

Also how are themes intended to be installed? I don't see any calls to app.customCss.installLegacyTheme( manifest ) or app.customCss.installTheme( manifest, true /*set to true so that manifest.repo can be used for install*/)?

Templates is currently not implemented

@anonhostpi
Copy link
Contributor Author

anonhostpi commented Jun 22, 2024

Yup. When Obsidian loads the manifests for either apps.customCss or apps.plugins, it overwrites that JSON property using the manifest.id (plugins) or manifest.name (customCss)

I think I see how you are using it though.

At first, I thought you were trying to override it by saving it to manifest.json, but it seems you are doing it to emulate Obsidian's functionality.

@4Source
Copy link
Owner

4Source commented Jun 22, 2024

It's been a while but with the brief look it seems like I exactly did this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants