mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Auto escalate privileges
This commit is contained in:
@@ -149,6 +149,9 @@
|
||||
<Content Include="WebContent\crissXcross.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="WebContent\favicon.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="WebContent\handlebars-v3.0.1.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@@ -3,6 +3,7 @@ using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -71,5 +72,12 @@ namespace Jackett
|
||||
Application.Run(new Main());
|
||||
|
||||
}
|
||||
|
||||
static public void RestartAsAdmin()
|
||||
{
|
||||
var startInfo = new ProcessStartInfo(Application.ExecutablePath.ToString()) { Verb = "runas" };
|
||||
Process.Start(startInfo);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -56,11 +56,23 @@ namespace Jackett
|
||||
Process.Start("http://127.0.0.1:" + Port);
|
||||
}
|
||||
catch (HttpListenerException ex)
|
||||
{
|
||||
var dialogResult = MessageBox.Show(
|
||||
"App must be ran as Admin for permission to use port " + Port + Environment.NewLine + "Restart app with admin privileges?",
|
||||
"Failed to open port",
|
||||
MessageBoxButtons.YesNo
|
||||
);
|
||||
if (dialogResult == DialogResult.No)
|
||||
{
|
||||
Program.LoggerInstance.FatalException("App must be ran as Admin for permission to use port " + Port, ex);
|
||||
Application.Exit();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.RestartAsAdmin();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Program.LoggerInstance.ErrorException("Error: " + ex.Message, ex);
|
||||
|
BIN
src/Jackett/WebContent/favicon.ico
Normal file
BIN
src/Jackett/WebContent/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
@@ -4,6 +4,8 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
|
||||
|
||||
<script src="jquery-2.1.3.min.js"></script>
|
||||
<script src="handlebars-v3.0.1.js"></script>
|
||||
<script src="bootstrap/bootstrap.min.js"></script>
|
||||
|
Reference in New Issue
Block a user