Compare commits

..
9 Commits
Author SHA1 Message Date
kislovdm ec80bea024 maxconn
.NET Core Desktop / build (Debug) (push) Has been cancelled
2026-04-27 01:14:42 +03:00
kislovdm b88006f02d maxconn
.NET Core Desktop / build (Debug) (push) Has been cancelled
2026-04-27 01:11:03 +03:00
kislovdm c5ac1681f2 maxconn
.NET Core Desktop / build (Debug) (push) Has been cancelled
2026-04-27 01:04:30 +03:00
kislovdm 06f2ebb1ac maxconn
.NET Core Desktop / build (Debug) (push) Has been cancelled
2026-04-27 01:02:02 +03:00
kislovdm 9912ca8ba4 maxconn
.NET Core Desktop / build (Debug) (push) Has been cancelled
2026-04-27 00:57:20 +03:00
kislovdm 427f16cde0 maxconn
.NET Core Desktop / build (Debug) (push) Has been cancelled
2026-04-27 00:53:56 +03:00
kislovdm fe8abb589f maxconn
.NET Core Desktop / build (Debug) (push) Has been cancelled
2026-04-27 00:49:24 +03:00
kislovdm ae787373dc releases
.NET Core Desktop / build (Debug) (push) Has been cancelled
2026-04-27 00:48:17 +03:00
kislovdm 4f2fe7b292 releases
.NET Core Desktop / build (Debug) (push) Has been cancelled
2026-04-27 00:47:40 +03:00
8 changed files with 45 additions and 24 deletions
-5
View File
@@ -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
View File
@@ -1 +1 @@
1.0.7 1.0.16
+3
View File
@@ -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}"
}; };
+4 -4
View File
@@ -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.16</AssemblyVersion>
<Version>1.0.7</Version> <Version>1.0.16</Version>
<FileVersion>1.0.7</FileVersion> <FileVersion>1.0.16</FileVersion>
<InformationalVersion>1.0.7</InformationalVersion> <InformationalVersion>1.0.16</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()
@@ -63,8 +66,8 @@ namespace MonsterMonitor.Services
return; return;
} }
var tempRoot = Path.Combine(Path.GetTempPath(), "MonsterMonitorUpdate"); var appDir = AppDomain.CurrentDomain.BaseDirectory;
var packageDir = Path.Combine(tempRoot, latestVersion.ToString()); var packageDir = Path.Combine(appDir, "update", latestVersion.ToString());
var packageZip = Path.Combine(packageDir, "update.zip"); var packageZip = Path.Combine(packageDir, "update.zip");
var extractDir = Path.Combine(packageDir, "extracted"); var extractDir = Path.Combine(packageDir, "extracted");
Directory.CreateDirectory(packageDir); Directory.CreateDirectory(packageDir);
@@ -80,7 +83,6 @@ namespace MonsterMonitor.Services
ZipFile.ExtractToDirectory(packageZip, extractDir); ZipFile.ExtractToDirectory(packageZip, extractDir);
_log.Info("Архив обновления распакован."); _log.Info("Архив обновления распакован.");
var appDir = AppDomain.CurrentDomain.BaseDirectory;
var exePath = Application.ExecutablePath; var exePath = Application.ExecutablePath;
var updaterBat = Path.Combine(packageDir, "apply_update.bat"); var updaterBat = Path.Combine(packageDir, "apply_update.bat");
File.WriteAllText(updaterBat, BuildUpdaterScript(appDir, extractDir, exePath), Encoding.ASCII); File.WriteAllText(updaterBat, BuildUpdaterScript(appDir, extractDir, exePath), Encoding.ASCII);
@@ -266,7 +268,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 +279,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();
+1 -1
View File
@@ -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);
+11 -7
View File
@@ -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();