mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-01 21:38:27 +01:00
fix artist editor
This commit is contained in:
@@ -20,7 +20,9 @@ netsh advfirewall firewall add rule name="Port %3" dir=in action=allow protocol=
|
||||
|
||||
if [%4]==[] GOTO DONE
|
||||
|
||||
netsh advfirewall firewall delete rule name="mediabrowser.serverapplication.exe"
|
||||
netsh advfirewall firewall delete rule name="Emby Server"
|
||||
|
||||
netsh advfirewall firewall add rule name="Emby Server" dir=in action=allow protocol=TCP program=%4 enable=yes
|
||||
netsh advfirewall firewall add rule name="Emby Server" dir=in action=allow protocol=UDP program=%4 enable=yes
|
||||
|
||||
|
||||
@@ -208,5 +208,60 @@ namespace MediaBrowser.ServerApplication.Native
|
||||
{
|
||||
LoopUtil.Run(appName);
|
||||
}
|
||||
|
||||
public bool PortsRequireAuthorization(string applicationPath)
|
||||
{
|
||||
var appNameSrch = Path.GetFileName(applicationPath);
|
||||
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "netsh",
|
||||
|
||||
Arguments = "advfirewall firewall show rule \"" + appNameSrch + "\"",
|
||||
|
||||
CreateNoWindow = true,
|
||||
UseShellExecute = false,
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
ErrorDialog = false,
|
||||
RedirectStandardOutput = true
|
||||
};
|
||||
|
||||
using (var process = Process.Start(startInfo))
|
||||
{
|
||||
process.Start();
|
||||
|
||||
try
|
||||
{
|
||||
var data = process.StandardOutput.ReadToEnd() ?? string.Empty;
|
||||
|
||||
//_logger.Debug("Found windows firewall rule: " + data);
|
||||
if (data.IndexOf("Block", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//var parts = data.Split('\n');
|
||||
|
||||
//return parts.Length > 4;
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error querying windows firewall", ex);
|
||||
|
||||
// Hate having to do this
|
||||
try
|
||||
{
|
||||
process.Kill();
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
_logger.ErrorException("Error killing process", ex1);
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user