Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ internal async ValueTask<List<Result>> RequestUpdateAsync(string search, Cancell
pluginFromLocalPath = Utilities.GetPluginInfoFromZip(search);
pluginFromLocalPath.LocalInstallPath = search;
updateFromLocalPath = true;
}
}

var updateSource = !updateFromLocalPath
? PluginsManifest.UserPlugins
: new List<UserPlugin> { pluginFromLocalPath };
? PluginsManifest.UserPlugins
: new List<UserPlugin> { pluginFromLocalPath };

var resultsForUpdate = (
from existingPlugin in Context.API.GetAllPlugins()
Expand Down Expand Up @@ -291,7 +291,7 @@ await Http.DownloadAsync(x.PluginNewUserPlugin.UrlDownload, downloadToFilePath)
{
downloadToFilePath = x.PluginNewUserPlugin.LocalInstallPath;
}


PluginManager.UpdatePlugin(x.PluginExistingMetadata, x.PluginNewUserPlugin,
downloadToFilePath);
Expand Down Expand Up @@ -327,7 +327,6 @@ await Http.DownloadAsync(x.PluginNewUserPlugin.UrlDownload, downloadToFilePath)
}, TaskContinuationOptions.OnlyOnFaulted);

return true;

},
ContextData =
new UserPlugin
Expand Down Expand Up @@ -513,7 +512,8 @@ internal List<Result> InstallFromLocalPath(string localPath)
{
if (!InstallSourceKnown(plugin.Website)
&& MessageBox.Show(string.Format(
Context.API.GetTranslation("plugin_pluginsmanager_install_unknown_source_warning"),
Context.API.GetTranslation(
"plugin_pluginsmanager_install_unknown_source_warning"),
Environment.NewLine),
Context.API.GetTranslation(
"plugin_pluginsmanager_install_unknown_source_warning_title"),
Expand All @@ -532,7 +532,12 @@ internal List<Result> InstallFromLocalPath(string localPath)

private bool InstallSourceKnown(string url)
{
var author = url.Split('/')[3];
var pieces = url.Split('/');

if (pieces.Length < 4)
return false;

var author = pieces[3];
var acceptedSource = "https://github.com";
var constructedUrlPart = string.Format("{0}/{1}/", acceptedSource, author);

Expand Down Expand Up @@ -589,7 +594,7 @@ private void Install(UserPlugin plugin, string downloadedFilePath)
try
{
PluginManager.InstallPlugin(plugin, downloadedFilePath);

if (!plugin.IsFromLocalInstallPath)
File.Delete(downloadedFilePath);
}
Expand Down
Loading