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">
|
<Content Include="WebContent\crissXcross.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="WebContent\favicon.ico">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="WebContent\handlebars-v3.0.1.js">
|
<Content Include="WebContent\handlebars-v3.0.1.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@@ -3,6 +3,7 @@ using NLog.Config;
|
|||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -71,5 +72,12 @@ namespace Jackett
|
|||||||
Application.Run(new Main());
|
Application.Run(new Main());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public void RestartAsAdmin()
|
||||||
|
{
|
||||||
|
var startInfo = new ProcessStartInfo(Application.ExecutablePath.ToString()) { Verb = "runas" };
|
||||||
|
Process.Start(startInfo);
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -57,9 +57,21 @@ namespace Jackett
|
|||||||
}
|
}
|
||||||
catch (HttpListenerException ex)
|
catch (HttpListenerException ex)
|
||||||
{
|
{
|
||||||
Program.LoggerInstance.FatalException("App must be ran as Admin for permission to use port " + Port, ex);
|
var dialogResult = MessageBox.Show(
|
||||||
Application.Exit();
|
"App must be ran as Admin for permission to use port " + Port + Environment.NewLine + "Restart app with admin privileges?",
|
||||||
return;
|
"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)
|
catch (Exception 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>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<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="jquery-2.1.3.min.js"></script>
|
||||||
<script src="handlebars-v3.0.1.js"></script>
|
<script src="handlebars-v3.0.1.js"></script>
|
||||||
<script src="bootstrap/bootstrap.min.js"></script>
|
<script src="bootstrap/bootstrap.min.js"></script>
|
||||||
|
Reference in New Issue
Block a user