-
-
Notifications
You must be signed in to change notification settings - Fork 446
Detect URL and install using Plugin Manager #823
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
Conversation
var plugin = new UserPlugin | ||
{ | ||
ID = "", | ||
Name = fileName.Split(".").First(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to simply trim the last part (.zip). Also, it is possible that the link doesn't contain file name. Though, I think this won't be a large issue since this feature is mainly for debugging.
this will potentially allow for downloading duplicate plugins right? |
not really. ID check will remove old as updating process. |
@Garulf pushing up a couple changes, brace for impact... |
Very cool! We should probably have the Uninstall method uninstall all manual installed plugins at once. I see you added a method that returns duplicates. But due to my inexperience im not sure how to reuse. |
fixed search terms to show with out to lower
I added that the user will be prompted if the downloaded plugin zip contains a plugin that already exists and is of same or lesser version, so we dont have to deal with duplicate plugins from this install method. Also added a check to warn user if the source is not from github and the author is not found from the currently installed plugin list |
@Garulf @taooceros all done, please test and review. |
Incredibly comprehensive! This seems to handle all the niche situations that can happen with the old system. 👌 The windows notifications might be a little overwhelming? |
Hm, which notification should we remove? |
I think success/fail should be sufficient. |
} | ||
|
||
internal static (List<PluginMetadata>, List<PluginMetadata>) GetUniqueLatestPluginMetadata(List<PluginMetadata> allPluginMetadata) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @taooceros can you see a better way of doing this loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I will take a try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm I think it is good enough. The plugin count will be relatively small, so no need to preoptimize it until we reach a bottleneck for that.
@Garulf try now |
Much better! Windows toast has a slight delay so it got a bit confusing. We should probably skip the install dialog if unknown source dialog is shown.
EDIT2: Fixed 2edc345 |
nah because that unknown source warning can be turned off |
if it's good to go @taooceros @Garulf let me know i will merge |
As far as my testing goes everything works with no bugs 🤞 |
} | ||
|
||
internal static (List<PluginMetadata>, List<PluginMetadata>) GetUniqueLatestPluginMetadata(List<PluginMetadata> allPluginMetadata) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm I think it is good enough. The plugin count will be relatively small, so no need to preoptimize it until we reach a bottleneck for that.
{ | ||
var author = url.Split('/')[3]; | ||
var acceptedSource = "https://github.com"; | ||
var contructedUrlPart = string.Format("{0}/{1}/", acceptedSource, author); | ||
|
||
return url.StartsWith(acceptedSource) && Context.API.GetAllPlugins().Any(x => x.Metadata.Website.StartsWith(contructedUrlPart)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github is known source🧐🤔
Probably it will be better to treat all url download as unknown source
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github is only a known source if the author of the plugin is found in the pluginsmanifest, otherwise it's still treated as unknown source
var searchNameWithoutKeyword = searchName.Replace(Settings.HotKeyInstall, string.Empty).Trim(); | ||
var searchNameWithoutKeyword = searchName.Replace(Settings.HotKeyInstall, string.Empty, StringComparison.OrdinalIgnoreCase).Trim(); | ||
|
||
if (Uri.IsWellFormedUriString(searchNameWithoutKeyword, UriKind.Absolute) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the url doesn't end with zip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then no option to download, we support zip currently
pm install <URL>
will allow a user to install a plugin directly from an URL bypassing the plugin store.Should be useful for debugging and sharing a plugin that may not be ready or appropriate for the plugin store.
Option only appears when a formatted URL is detected.
User will be prompted if the downloaded plugin zip contains a plugin that already exists and is of same or lesser version
Added an option to warn user when installing from a source not in github and not by an author from the plugin store.
Also added logic to load only unique latest version plugins