Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b88006f02d | ||
|
|
c5ac1681f2 | ||
|
|
06f2ebb1ac | ||
|
|
9912ca8ba4 | ||
|
|
427f16cde0 | ||
|
|
fe8abb589f | ||
|
|
ae787373dc | ||
|
|
4f2fe7b292 |
@@ -1,5 +1,4 @@
|
|||||||
name: .NET Core Desktop
|
name: .NET Core Desktop
|
||||||
permissions: write-all
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -43,8 +42,6 @@ jobs:
|
|||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
@@ -56,8 +53,6 @@ jobs:
|
|||||||
- name: Upload Release Asset
|
- name: Upload Release Asset
|
||||||
id: upload-release-asset
|
id: upload-release-asset
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.0.7
|
1.0.15
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace MonsterMonitor.Models
|
|||||||
public int LocalPort { get; set; } = 7829;
|
public int LocalPort { get; set; } = 7829;
|
||||||
public int MaxPingFailures { get; set; } = 3;
|
public int MaxPingFailures { get; set; } = 3;
|
||||||
public int ReconnectTimeoutSec { get; set; } = 45;
|
public int ReconnectTimeoutSec { get; set; } = 45;
|
||||||
|
public string Proxy { get; set; } = string.Empty;
|
||||||
public string SsProcessPath { get; set; } = Path.Combine("App_Data", "ss", "ss.exe");
|
public string SsProcessPath { get; set; } = Path.Combine("App_Data", "ss", "ss.exe");
|
||||||
public string SsArguments { get; set; } = string.Empty;
|
public string SsArguments { get; set; } = string.Empty;
|
||||||
|
|
||||||
@@ -163,6 +164,7 @@ namespace MonsterMonitor.Models
|
|||||||
result.LocalPort = GetInt(map, nameof(LocalPort), result.LocalPort);
|
result.LocalPort = GetInt(map, nameof(LocalPort), result.LocalPort);
|
||||||
result.MaxPingFailures = GetInt(map, nameof(MaxPingFailures), result.MaxPingFailures);
|
result.MaxPingFailures = GetInt(map, nameof(MaxPingFailures), result.MaxPingFailures);
|
||||||
result.ReconnectTimeoutSec = GetInt(map, nameof(ReconnectTimeoutSec), result.ReconnectTimeoutSec);
|
result.ReconnectTimeoutSec = GetInt(map, nameof(ReconnectTimeoutSec), result.ReconnectTimeoutSec);
|
||||||
|
result.Proxy = Get(map, nameof(Proxy), result.Proxy);
|
||||||
result.SsProcessPath = Get(map, nameof(SsProcessPath), result.SsProcessPath);
|
result.SsProcessPath = Get(map, nameof(SsProcessPath), result.SsProcessPath);
|
||||||
result.SsArguments = Get(map, nameof(SsArguments), result.SsArguments);
|
result.SsArguments = Get(map, nameof(SsArguments), result.SsArguments);
|
||||||
|
|
||||||
@@ -191,6 +193,7 @@ namespace MonsterMonitor.Models
|
|||||||
$"{nameof(LocalPort)}={LocalPort}",
|
$"{nameof(LocalPort)}={LocalPort}",
|
||||||
$"{nameof(MaxPingFailures)}={MaxPingFailures}",
|
$"{nameof(MaxPingFailures)}={MaxPingFailures}",
|
||||||
$"{nameof(ReconnectTimeoutSec)}={ReconnectTimeoutSec}",
|
$"{nameof(ReconnectTimeoutSec)}={ReconnectTimeoutSec}",
|
||||||
|
$"{nameof(Proxy)}={Proxy}",
|
||||||
$"{nameof(SsProcessPath)}={SsProcessPath}",
|
$"{nameof(SsProcessPath)}={SsProcessPath}",
|
||||||
$"{nameof(SsArguments)}={SsArguments}"
|
$"{nameof(SsArguments)}={SsArguments}"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<RootNamespace>MonsterMonitor</RootNamespace>
|
<RootNamespace>MonsterMonitor</RootNamespace>
|
||||||
<AssemblyName>MonsterMonitor</AssemblyName>
|
<AssemblyName>MonsterMonitor</AssemblyName>
|
||||||
<AssemblyVersion>1.0.7</AssemblyVersion>
|
<AssemblyVersion>1.0.15</AssemblyVersion>
|
||||||
<Version>1.0.7</Version>
|
<Version>1.0.15</Version>
|
||||||
<FileVersion>1.0.7</FileVersion>
|
<FileVersion>1.0.15</FileVersion>
|
||||||
<InformationalVersion>1.0.7</InformationalVersion>
|
<InformationalVersion>1.0.15</InformationalVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Costura.Fody" Version="6.0.0">
|
<PackageReference Include="Costura.Fody" Version="6.0.0">
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using System.Runtime.Serialization.Json;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using MonsterMonitor.Models;
|
||||||
|
|
||||||
namespace MonsterMonitor.Services
|
namespace MonsterMonitor.Services
|
||||||
{
|
{
|
||||||
@@ -20,10 +21,12 @@ namespace MonsterMonitor.Services
|
|||||||
private const string GithubToken = "";
|
private const string GithubToken = "";
|
||||||
|
|
||||||
private readonly LogService _log;
|
private readonly LogService _log;
|
||||||
|
private readonly AppSettings _settings;
|
||||||
|
|
||||||
public GitHubUpdateService(LogService log)
|
public GitHubUpdateService(LogService log, AppSettings settings)
|
||||||
{
|
{
|
||||||
_log = log;
|
_log = log;
|
||||||
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CheckAndPrepareUpdateAsync()
|
public async Task CheckAndPrepareUpdateAsync()
|
||||||
@@ -159,7 +162,7 @@ namespace MonsterMonitor.Services
|
|||||||
{
|
{
|
||||||
var request = CreateGithubRequest(url, "application/vnd.github+json");
|
var request = CreateGithubRequest(url, "application/vnd.github+json");
|
||||||
using (var response = (HttpWebResponse)await request.GetResponseAsync())
|
using (var response = (HttpWebResponse)await request.GetResponseAsync())
|
||||||
using (var stream = response.GetResponseStream())
|
using (var stream = response.GetResponseStream())
|
||||||
{
|
{
|
||||||
if (stream == null)
|
if (stream == null)
|
||||||
{
|
{
|
||||||
@@ -266,7 +269,7 @@ namespace MonsterMonitor.Services
|
|||||||
return asset.DownloadUrl ?? string.Empty;
|
return asset.DownloadUrl ?? string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HttpWebRequest CreateGithubRequest(string url, string accept)
|
private HttpWebRequest CreateGithubRequest(string url, string accept)
|
||||||
{
|
{
|
||||||
var request = (HttpWebRequest)WebRequest.Create(url);
|
var request = (HttpWebRequest)WebRequest.Create(url);
|
||||||
request.Method = "GET";
|
request.Method = "GET";
|
||||||
@@ -277,10 +280,26 @@ namespace MonsterMonitor.Services
|
|||||||
{
|
{
|
||||||
request.Headers.Add("Authorization", "Bearer " + GithubToken);
|
request.Headers.Add("Authorization", "Bearer " + GithubToken);
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(_settings.Proxy))
|
||||||
|
{
|
||||||
|
request.Proxy = GetProxy(_settings.Proxy);
|
||||||
|
}
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private WebProxy GetProxy(string proxyUri)
|
||||||
|
{
|
||||||
|
var proxy = new WebProxy(new Uri(proxyUri), false);
|
||||||
|
var cc = new CredentialCache();
|
||||||
|
cc.Add(
|
||||||
|
new Uri(proxyUri),
|
||||||
|
"Negotiate", // if we don't set it to "Kerberos" we get error 407 with ---> the function requested is not supported.
|
||||||
|
CredentialCache.DefaultNetworkCredentials);
|
||||||
|
proxy.Credentials = cc;
|
||||||
|
return proxy;
|
||||||
|
}
|
||||||
|
|
||||||
private static string BuildUpdaterScript(string appDir, string extractDir, string exePath)
|
private static string BuildUpdaterScript(string appDir, string extractDir, string exePath)
|
||||||
{
|
{
|
||||||
return "@echo off" + Environment.NewLine +
|
return "@echo off" + Environment.NewLine +
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace MonsterMonitor.Services
|
|||||||
|
|
||||||
var config = "users admin:CL:" + password + "\r\n" +
|
var config = "users admin:CL:" + password + "\r\n" +
|
||||||
"auth strong\r\n" +
|
"auth strong\r\n" +
|
||||||
|
"maxconn 2000\r\n" +
|
||||||
$"socks -i127.0.0.1 -p{port}";
|
$"socks -i127.0.0.1 -p{port}";
|
||||||
|
|
||||||
var configPath = GetConfigPath();
|
var configPath = GetConfigPath();
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace MonsterMonitor.UI
|
|||||||
|
|
||||||
_settings = AppSettings.Load();
|
_settings = AppSettings.Load();
|
||||||
_controller = new AppController(_log, _power);
|
_controller = new AppController(_log, _power);
|
||||||
_updateService = new GitHubUpdateService(_log);
|
_updateService = new GitHubUpdateService(_log, _settings);
|
||||||
RestartServices();
|
RestartServices();
|
||||||
ConfigureUpdateTimer();
|
ConfigureUpdateTimer();
|
||||||
_ = RunUpdateCheckAsync(true);
|
_ = RunUpdateCheckAsync(true);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace MonsterMonitor.UI
|
|||||||
private readonly NumericUpDown _numLocalPort = new NumericUpDown();
|
private readonly NumericUpDown _numLocalPort = new NumericUpDown();
|
||||||
private readonly NumericUpDown _numMaxFailures = new NumericUpDown();
|
private readonly NumericUpDown _numMaxFailures = new NumericUpDown();
|
||||||
private readonly NumericUpDown _numReconnectTimeout = new NumericUpDown();
|
private readonly NumericUpDown _numReconnectTimeout = new NumericUpDown();
|
||||||
|
private readonly TextBox _txtProxy = new TextBox();
|
||||||
private readonly TextBox _txtSsPath = new TextBox();
|
private readonly TextBox _txtSsPath = new TextBox();
|
||||||
private readonly TextBox _txtSsArgs = new TextBox();
|
private readonly TextBox _txtSsArgs = new TextBox();
|
||||||
private readonly TextBox _txtSystemPassword = new TextBox();
|
private readonly TextBox _txtSystemPassword = new TextBox();
|
||||||
@@ -30,7 +31,7 @@ namespace MonsterMonitor.UI
|
|||||||
_settings = settings;
|
_settings = settings;
|
||||||
Text = "Настройки";
|
Text = "Настройки";
|
||||||
Width = 560;
|
Width = 560;
|
||||||
Height = 520;
|
Height = 560;
|
||||||
FormBorderStyle = FormBorderStyle.FixedDialog;
|
FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||||
MaximizeBox = false;
|
MaximizeBox = false;
|
||||||
MinimizeBox = false;
|
MinimizeBox = false;
|
||||||
@@ -47,7 +48,7 @@ namespace MonsterMonitor.UI
|
|||||||
Dock = DockStyle.Fill,
|
Dock = DockStyle.Fill,
|
||||||
Padding = new Padding(10),
|
Padding = new Padding(10),
|
||||||
ColumnCount = 2,
|
ColumnCount = 2,
|
||||||
RowCount = 14
|
RowCount = 15
|
||||||
};
|
};
|
||||||
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 44f));
|
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 44f));
|
||||||
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 56f));
|
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 56f));
|
||||||
@@ -65,10 +66,11 @@ namespace MonsterMonitor.UI
|
|||||||
AddRow(panel, "Локальный порт:", _numLocalPort, 6);
|
AddRow(panel, "Локальный порт:", _numLocalPort, 6);
|
||||||
AddRow(panel, "Макс. потерь:", _numMaxFailures, 7);
|
AddRow(panel, "Макс. потерь:", _numMaxFailures, 7);
|
||||||
AddRow(panel, "Таймаут reconnect (сек):", _numReconnectTimeout, 8);
|
AddRow(panel, "Таймаут reconnect (сек):", _numReconnectTimeout, 8);
|
||||||
AddRow(panel, "Путь к ss:", _txtSsPath, 9);
|
AddRow(panel, "Прокси (http://host:port):", _txtProxy, 9);
|
||||||
AddRow(panel, "Аргументы ss:", _txtSsArgs, 10);
|
AddRow(panel, "Путь к ss:", _txtSsPath, 10);
|
||||||
BuildSystemPasswordRow(panel, 11);
|
AddRow(panel, "Аргументы ss:", _txtSsArgs, 11);
|
||||||
BuildThreeProxyPasswordRow(panel, 12);
|
BuildSystemPasswordRow(panel, 12);
|
||||||
|
BuildThreeProxyPasswordRow(panel, 13);
|
||||||
|
|
||||||
foreach (var num in new[] { _numSshPort, _numRemotePort, _numLocalPort })
|
foreach (var num in new[] { _numSshPort, _numRemotePort, _numLocalPort })
|
||||||
{
|
{
|
||||||
@@ -93,7 +95,7 @@ namespace MonsterMonitor.UI
|
|||||||
|
|
||||||
buttonsPanel.Controls.Add(btnSave);
|
buttonsPanel.Controls.Add(btnSave);
|
||||||
buttonsPanel.Controls.Add(btnCancel);
|
buttonsPanel.Controls.Add(btnCancel);
|
||||||
panel.Controls.Add(buttonsPanel, 0, 13);
|
panel.Controls.Add(buttonsPanel, 0, 14);
|
||||||
panel.SetColumnSpan(buttonsPanel, 2);
|
panel.SetColumnSpan(buttonsPanel, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,6 +202,7 @@ namespace MonsterMonitor.UI
|
|||||||
_numLocalPort.Value = _settings.LocalPort;
|
_numLocalPort.Value = _settings.LocalPort;
|
||||||
_numMaxFailures.Value = _settings.MaxPingFailures;
|
_numMaxFailures.Value = _settings.MaxPingFailures;
|
||||||
_numReconnectTimeout.Value = _settings.ReconnectTimeoutSec;
|
_numReconnectTimeout.Value = _settings.ReconnectTimeoutSec;
|
||||||
|
_txtProxy.Text = _settings.Proxy;
|
||||||
_txtSsPath.Text = _settings.SsProcessPath;
|
_txtSsPath.Text = _settings.SsProcessPath;
|
||||||
_txtSsArgs.Text = _settings.SsArguments;
|
_txtSsArgs.Text = _settings.SsArguments;
|
||||||
_txtSystemPassword.Text = _settings.GetSystemPassword();
|
_txtSystemPassword.Text = _settings.GetSystemPassword();
|
||||||
@@ -223,6 +226,7 @@ namespace MonsterMonitor.UI
|
|||||||
_settings.LocalPort = (int)_numLocalPort.Value;
|
_settings.LocalPort = (int)_numLocalPort.Value;
|
||||||
_settings.MaxPingFailures = (int)_numMaxFailures.Value;
|
_settings.MaxPingFailures = (int)_numMaxFailures.Value;
|
||||||
_settings.ReconnectTimeoutSec = (int)_numReconnectTimeout.Value;
|
_settings.ReconnectTimeoutSec = (int)_numReconnectTimeout.Value;
|
||||||
|
_settings.Proxy = _txtProxy.Text.Trim();
|
||||||
_settings.SsProcessPath = string.IsNullOrWhiteSpace(_txtSsPath.Text)
|
_settings.SsProcessPath = string.IsNullOrWhiteSpace(_txtSsPath.Text)
|
||||||
? System.IO.Path.Combine("App_Data", "ss", "ss.exe")
|
? System.IO.Path.Combine("App_Data", "ss", "ss.exe")
|
||||||
: _txtSsPath.Text.Trim();
|
: _txtSsPath.Text.Trim();
|
||||||
|
|||||||
Reference in New Issue
Block a user