Enable hyperlinks.
Sanitize hyperlinks.
This commit is contained in:
@@ -275,7 +275,7 @@
|
||||
<Compile Include="Views\ModListControl.xaml.cs">
|
||||
<DependentUpon>ModListControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\PluginBrowser.xaml.cs">
|
||||
<Compile Include="Views\PluginBrowser\PluginBrowser.xaml.cs">
|
||||
<DependentUpon>PluginBrowser.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ThemeControl.xaml.cs">
|
||||
@@ -442,7 +442,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\PluginBrowser.xaml">
|
||||
<Page Include="Views\PluginBrowser\PluginBrowser.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
|
@@ -48,14 +48,36 @@ namespace Torch.Server.Views
|
||||
public PluginBrowser()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var res = await PluginQuery.Instance.QueryAll();
|
||||
if (res == null)
|
||||
return;
|
||||
foreach(var item in res.Plugins)
|
||||
foreach (var item in res.Plugins)
|
||||
Plugins.Add(item);
|
||||
PluginsList.Dispatcher.Invoke(() => PluginsList.SelectedIndex = 0);
|
||||
});
|
||||
|
||||
MarkdownFlow.CommandBindings.Add(new CommandBinding(NavigationCommands.GoToPage, (sender, e) => OpenUri((string)e.Parameter)));
|
||||
}
|
||||
|
||||
public static bool IsValidUri(string uri)
|
||||
{
|
||||
if (!Uri.IsWellFormedUriString(uri, UriKind.Absolute))
|
||||
return false;
|
||||
Uri tmp;
|
||||
if (!Uri.TryCreate(uri, UriKind.Absolute, out tmp))
|
||||
return false;
|
||||
return tmp.Scheme == Uri.UriSchemeHttp || tmp.Scheme == Uri.UriSchemeHttps;
|
||||
}
|
||||
|
||||
public static bool OpenUri(string uri)
|
||||
{
|
||||
if (!IsValidUri(uri))
|
||||
return false;
|
||||
System.Diagnostics.Process.Start(uri);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void PluginsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
|
Reference in New Issue
Block a user