Skip to content

Conversation

Garulf
Copy link
Member

@Garulf Garulf commented Nov 18, 2021

image

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

@Garulf Garulf marked this pull request as ready for review November 18, 2021 18:09
@Garulf Garulf requested review from jjw24 and taooceros November 18, 2021 18:09
var plugin = new UserPlugin
{
ID = "",
Name = fileName.Split(".").First(),
Copy link
Member

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.

@jjw24
Copy link
Member

jjw24 commented Nov 18, 2021

this will potentially allow for downloading duplicate plugins right?

@taooceros
Copy link
Member

taooceros commented Nov 18, 2021

this will potentially allow for downloading duplicate plugins right?

not really. ID check will remove old as updating process.

@onesounds onesounds added the enhancement New feature or request label Nov 19, 2021
@jjw24
Copy link
Member

jjw24 commented Nov 20, 2021

@Garulf pushing up a couple changes, brace for impact...

@Garulf
Copy link
Member Author

Garulf commented Nov 20, 2021

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.

@jjw24
Copy link
Member

jjw24 commented Nov 21, 2021

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

@jjw24
Copy link
Member

jjw24 commented Nov 21, 2021

@Garulf @taooceros all done, please test and review.

@Garulf
Copy link
Member Author

Garulf commented Nov 21, 2021

@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?

@jjw24
Copy link
Member

jjw24 commented Nov 21, 2021

Hm, which notification should we remove?

@Garulf
Copy link
Member Author

Garulf commented Nov 22, 2021

this will potentially allow for downloading duplicate plugins right?

I think success/fail should be sufficient.

}

internal static (List<PluginMetadata>, List<PluginMetadata>) GetUniqueLatestPluginMetadata(List<PluginMetadata> allPluginMetadata)
{
Copy link
Member

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?

Copy link
Member

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

Copy link
Member

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.

@jjw24
Copy link
Member

jjw24 commented Nov 22, 2021

@Garulf try now

@Garulf
Copy link
Member Author

Garulf commented Nov 24, 2021

@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.

EDIT: windows-startup plugin keeps saying there's a higher version. Still investigating whats casuing this one plugin not to install.

EDIT2: Fixed 2edc345

@jjw24
Copy link
Member

jjw24 commented Nov 25, 2021

We should probably skip the install dialog if unknown source dialog is shown.

nah because that unknown source warning can be turned off

@jjw24
Copy link
Member

jjw24 commented Nov 25, 2021

if it's good to go @taooceros @Garulf let me know i will merge

@Garulf
Copy link
Member Author

Garulf commented Nov 26, 2021

As far as my testing goes everything works with no bugs 🤞

}

internal static (List<PluginMetadata>, List<PluginMetadata>) GetUniqueLatestPluginMetadata(List<PluginMetadata> allPluginMetadata)
{
Copy link
Member

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.

Comment on lines +361 to +367
{
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));
}
Copy link
Member

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

Copy link
Member

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)
Copy link
Member

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?

Copy link
Member

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

@jjw24 jjw24 enabled auto-merge November 28, 2021 19:19
@jjw24 jjw24 merged commit 4f5eb2b into Flow-Launcher:dev Nov 28, 2021
@jjw24 jjw24 added this to the 1.9.0 milestone Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants