Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Library/Sucrose.Manager/Manage/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using SHS = Skylark.Helper.Skymath;
using SMMCE = Sucrose.Memory.Manage.Constant.Engine;
using SMMI = Sucrose.Manager.Manage.Internal;
using SSDEPT = Sucrose.Shared.Dependency.Enum.ProxyType;

namespace Sucrose.Manager.Manage
{
Expand Down Expand Up @@ -58,5 +59,17 @@ public static class Engine
public static bool StoreStart => SMMI.EngineSettingManager.GetSetting(SMMCE.StoreStart, true);

public static bool StayAwake => SMMI.EngineSettingManager.GetSetting(SMMCE.StayAwake, false);

public static bool ProxyEnabled => SMMI.EngineSettingManager.GetSetting(SMMCE.ProxyEnabled, false);

public static SSDEPT ProxyType => SMMI.EngineSettingManager.GetSetting(SMMCE.ProxyType, SSDEPT.None);

public static string ProxyServer => SMMI.EngineSettingManager.GetSetting(SMMCE.ProxyServer, string.Empty);

public static int ProxyPort => SHS.Clamp(SMMI.EngineSettingManager.GetSettingStable(SMMCE.ProxyPort, 0), 0, 65535);

public static string ProxyUsername => SMMI.EngineSettingManager.GetSetting(SMMCE.ProxyUsername, string.Empty);

public static string ProxyPassword => SMMI.EngineSettingManager.GetSetting(SMMCE.ProxyPassword, string.Empty);
}
}
12 changes: 12 additions & 0 deletions src/Library/Sucrose.Memory/Manage/Constant/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,17 @@ public static class Engine
public const string HardwareAcceleration = "HardwareAcceleration";

public const string VolumeSilentSensitivity = "VolumeSilentSensitivity";

public const string ProxyEnabled = "ProxyEnabled";

public const string ProxyType = "ProxyType";

public const string ProxyServer = "ProxyServer";

public const string ProxyPort = "ProxyPort";

public const string ProxyUsername = "ProxyUsername";

public const string ProxyPassword = "ProxyPassword";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="Portal.Area.Log">Log</system:String>
<system:String x:Key="Portal.Area.Data">Data</system:String>
<system:String x:Key="Portal.Area.Network">Network</system:String>
<system:String x:Key="Portal.Area.Hook">Hook</system:String>
<system:String x:Key="Portal.Area.Cache">Cache</system:String>
<system:String x:Key="Portal.Area.Reset">Resetting</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
<system:String x:Key="Portal.Enum.InputType.OnlyKeyboard">Keyboard Only</system:String>
<system:String x:Key="Portal.Enum.InputType.MouseKeyboard">Mouse &amp; Keyboard</system:String>

<system:String x:Key="Portal.Enum.ProxyType.None">None</system:String>
<system:String x:Key="Portal.Enum.ProxyType.HTTP">HTTP</system:String>
<system:String x:Key="Portal.Enum.ProxyType.HTTPS">HTTPS</system:String>
<system:String x:Key="Portal.Enum.ProxyType.SOCKS5">SOCKS5</system:String>

<system:String x:Key="Portal.Enum.StretchType.Fill">Fill</system:String>
<system:String x:Key="Portal.Enum.StretchType.None">None</system:String>
<system:String x:Key="Portal.Enum.StretchType.Uniform">Uniform</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
<system:String x:Key="Portal.OtherSettingPage.StatisticsData">Share Usage Statistics</system:String>
<system:String x:Key="Portal.OtherSettingPage.StatisticsData.Description">Sucrose enables the collection of your usage statistics to contribute to the development of the application.</system:String>

<system:String x:Key="Portal.OtherSettingPage.Proxy">Proxy Configuration</system:String>
<system:String x:Key="Portal.OtherSettingPage.Proxy.Description">Configure proxy settings to access video content through a proxy server (SOCKS5, HTTP, HTTPS).</system:String>

<system:String x:Key="Portal.OtherSettingPage.Proxy.ProxyType">Proxy Type:</system:String>
<system:String x:Key="Portal.OtherSettingPage.Proxy.ProxyServer">Proxy Server:</system:String>
<system:String x:Key="Portal.OtherSettingPage.Proxy.ProxyPort">Proxy Port:</system:String>
<system:String x:Key="Portal.OtherSettingPage.Proxy.ProxyUsername">Username:</system:String>
<system:String x:Key="Portal.OtherSettingPage.Proxy.ProxyPassword">Password:</system:String>
<system:String x:Key="Portal.OtherSettingPage.Proxy.Optional">(Optional)</system:String>

<system:String x:Key="Portal.OtherSettingPage.DiscordHook">Discord</system:String>
<system:String x:Key="Portal.OtherSettingPage.DiscordHook.Description">Sucrose facilitates communication with Discord.</system:String>

Expand Down
22 changes: 22 additions & 0 deletions src/Live/Sucrose.Live.CefSharp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
using SRHR = Sucrose.Resources.Helper.Resources;
using SSDEDT = Sucrose.Shared.Dependency.Enum.DialogType;
using SSDEPT = Sucrose.Shared.Dependency.Enum.PropertiesType;
using SSDEPROXYT = Sucrose.Shared.Dependency.Enum.ProxyType;
using SSDEWT = Sucrose.Shared.Dependency.Enum.WallpaperType;
using SSDHG = Sucrose.Shared.Dependency.Helper.Graphic;
using SSDHR = Sucrose.Shared.Dependency.Helper.Runtime;
Expand Down Expand Up @@ -340,6 +341,27 @@ protected async void Configure()
LogFile = Path.Combine(SMMRP.ApplicationData, SMMRG.AppName, SMMRF.Log, string.Format("CefSharpNative-{0}-{1}.log", SMMVL.FileNameDate, Guid.NewGuid()))
};

if (SMME.ProxyEnabled && !string.IsNullOrEmpty(SMME.ProxyServer) && SMME.ProxyPort > 0)
{
string proxyScheme = SMME.ProxyType switch
{
SSDEPROXYT.HTTP => "http",
SSDEPROXYT.HTTPS => "https",
SSDEPROXYT.SOCKS5 => "socks5",
_ => "http"
};

string proxyUrl = $"{proxyScheme}://{SMME.ProxyServer}:{SMME.ProxyPort}";

Settings.CefCommandLineArgs.Add("proxy-server", proxyUrl);

if (!string.IsNullOrEmpty(SMME.ProxyUsername))
{
// CefSharp doesn't support proxy authentication directly via command line
// Authentication would need to be handled via IRequestHandler
}
}

SSEMI.BrowserSettings.CefSharp = SMME.CefArguments;

if (!SSEMI.BrowserSettings.CefSharp.Any())
Expand Down
19 changes: 19 additions & 0 deletions src/Live/Sucrose.Live.WebView/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
using SRHR = Sucrose.Resources.Helper.Resources;
using SSDEDT = Sucrose.Shared.Dependency.Enum.DialogType;
using SSDEPT = Sucrose.Shared.Dependency.Enum.PropertiesType;
using SSDEPROXYT = Sucrose.Shared.Dependency.Enum.ProxyType;
using SSDEWT = Sucrose.Shared.Dependency.Enum.WallpaperType;
using SSDHG = Sucrose.Shared.Dependency.Helper.Graphic;
using SSDHR = Sucrose.Shared.Dependency.Helper.Runtime;
Expand Down Expand Up @@ -361,6 +362,24 @@ protected void Configure()
}
}

if (SMME.ProxyEnabled && !string.IsNullOrEmpty(SMME.ProxyServer) && SMME.ProxyPort > 0)
{
string proxyScheme = SMME.ProxyType switch
{
SSDEPROXYT.HTTP => "http",
SSDEPROXYT.HTTPS => "https",
SSDEPROXYT.SOCKS5 => "socks5",
_ => "http"
};

string proxyUrl = $"{proxyScheme}://{SMME.ProxyServer}:{SMME.ProxyPort}";

if (!Options.AdditionalBrowserArguments.Contains("--proxy-server"))
{
Options.AdditionalBrowserArguments += $" --proxy-server=\"{proxyUrl}\"";
}
}

Task<CoreWebView2Environment> Environment = CoreWebView2Environment.CreateAsync(null, SSEWVMI.WebPath, Options);

SSEWVMI.WebEngine = new()
Expand Down
Loading