mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 16:08:15 +08:00
赞助用户标识
This commit is contained in:
@@ -139,10 +139,10 @@
|
||||
<StackPanel IsVisible="{ReflectionBinding Path=User,Mode=OneWay,Source={x:Static service:UserService.Current},Converter={StaticResource IsNullConverter},ConverterParameter=invert}">
|
||||
<controls:ScrollingTextBlock Text="{ReflectionBinding Path=User.NickName,Mode=OneWay,Source={x:Static service:UserService.Current}}"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"
|
||||
Classes="h7"
|
||||
Classes="h5"
|
||||
VerticalAlignment="Center"/>
|
||||
<Border IsVisible="{ReflectionBinding Path=User.IsSponsorUser,Mode=OneWay,Source={x:Static service:UserService.Current}}">
|
||||
<TextBlock Text="{ReflectionBinding Path=Res.User_Sponsor,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
<TextBlock Text="{ReflectionBinding Path=Res.User_Sponsor,Mode=OneWay,Source={x:Static resx:R.Current},StringFormat={}💖 {0}}"
|
||||
Classes="h8"/>
|
||||
</Border>
|
||||
<!--<TextBlock Text="{ReflectionBinding Path=User.LevelStr,Mode=OneWay,Source={x:Static service:UserService.Current}}"
|
||||
|
||||
@@ -17,6 +17,8 @@ public partial interface IReverseProxyConfig
|
||||
|
||||
IReadOnlyCollection<AccelerateProjectDTO>? ProxyDomains { get; set; }
|
||||
|
||||
IReadOnlyCollection<ScriptDTO>? ProxyScripts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否匹配指定的域名
|
||||
/// </summary>
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace System.Application.Models;
|
||||
sealed class ReverseProxyConfig : IReverseProxyConfig
|
||||
{
|
||||
readonly SortedDictionary<DomainPattern, IDomainConfig> domainConfigs;
|
||||
readonly SortedDictionary<DomainPattern, IDomainConfig> scriptConfigs;
|
||||
readonly ConcurrentDictionary<string, IDomainConfig?> domainConfigCache;
|
||||
readonly YarpReverseProxyServiceImpl reverseProxyService;
|
||||
|
||||
@@ -17,7 +18,8 @@ sealed class ReverseProxyConfig : IReverseProxyConfig
|
||||
{
|
||||
this.reverseProxyService = reverseProxyService;
|
||||
domainConfigs = new();
|
||||
AddDomainConfigs(domainConfigs, reverseProxyService.ProxyDomains);
|
||||
scriptConfigs = new();
|
||||
AddDomainConfigs(domainConfigs, reverseProxyService.ProxyDomains, reverseProxyService.Scripts);
|
||||
domainConfigCache = new();
|
||||
}
|
||||
|
||||
@@ -35,11 +37,18 @@ sealed class ReverseProxyConfig : IReverseProxyConfig
|
||||
set => reverseProxyService.ProxyDomains = value;
|
||||
}
|
||||
|
||||
static void AddDomainConfigs(IDictionary<DomainPattern, IDomainConfig> dict, IEnumerable<AccelerateProjectDTO>? domainConfigs)
|
||||
public IReadOnlyCollection<ScriptDTO>? ProxyScripts
|
||||
{
|
||||
if (domainConfigs != null)
|
||||
get => reverseProxyService.Scripts;
|
||||
set => reverseProxyService.Scripts = value;
|
||||
}
|
||||
|
||||
static void AddDomainConfigs(IDictionary<DomainPattern, IDomainConfig> dict,
|
||||
IEnumerable<AccelerateProjectDTO>? accelerates, IEnumerable<ScriptDTO>? scripts)
|
||||
{
|
||||
if (accelerates != null)
|
||||
{
|
||||
foreach (var item in domainConfigs)
|
||||
foreach (var item in accelerates)
|
||||
{
|
||||
foreach (var domainName in item.DomainNamesArray)
|
||||
{
|
||||
@@ -47,6 +56,17 @@ sealed class ReverseProxyConfig : IReverseProxyConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scripts != null)
|
||||
{
|
||||
foreach (var item in scripts)
|
||||
{
|
||||
foreach (var domainName in item.MatchDomainNamesArray)
|
||||
{
|
||||
dict.Add(new DomainPattern(domainName) { Sort = item.Order }, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//static void AddDomainConfigs(IDictionary<DomainPattern, IDomainConfig> dict, IReadOnlyDictionary<string, DomainConfig>? domainConfigs)
|
||||
|
||||
@@ -670,7 +670,7 @@ namespace System.Application.Services
|
||||
//}
|
||||
ProxyScripts.AddRange(scriptList);
|
||||
|
||||
CheckUpdate();
|
||||
CheckScriptUpdate();
|
||||
}
|
||||
|
||||
public async void DownloadScript(ScriptDTO model)
|
||||
@@ -716,7 +716,7 @@ namespace System.Application.Services
|
||||
model.IsLoading = false;
|
||||
}
|
||||
|
||||
public async void CheckUpdate()
|
||||
public async void CheckScriptUpdate()
|
||||
{
|
||||
var items = ProxyScripts.Items.Where(x => x.Id.HasValue).Select(x => x.Id!.Value).ToList();
|
||||
var client = ICloudServiceClient.Instance.Script;
|
||||
|
||||
+1
-1
@@ -6241,7 +6241,7 @@ namespace System.Application.UI.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 捐助用户 的本地化字符串。
|
||||
/// 查找类似 赞助用户 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string User_Sponsor {
|
||||
get {
|
||||
|
||||
@@ -2113,7 +2113,7 @@ AAAAA-BBBBB-CCCC3</value>
|
||||
<value>积分</value>
|
||||
</data>
|
||||
<data name="User_Sponsor" xml:space="preserve">
|
||||
<value>捐助用户</value>
|
||||
<value>赞助用户</value>
|
||||
</data>
|
||||
<data name="Account_SignIn_Ok" xml:space="preserve">
|
||||
<value>签到成功</value>
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace System.Application.UI.ViewModels
|
||||
{
|
||||
if (IsFirstActivation)
|
||||
if (ProxySettings.IsAutoCheckScriptUpdate)
|
||||
ProxyService.Current.CheckUpdate();
|
||||
ProxyService.Current.CheckScriptUpdate();
|
||||
base.Activation();
|
||||
}
|
||||
|
||||
|
||||
@@ -152,5 +152,26 @@ partial class AccelerateProjectDTO : IDomainConfig
|
||||
|
||||
string? IDomainConfig.UserAgent => UserAgent;
|
||||
|
||||
IResponseConfig? IDomainConfig.Response => null; // or null
|
||||
}
|
||||
|
||||
partial class ScriptDTO : IDomainConfig
|
||||
{
|
||||
bool IDomainConfig.TlsSni => true;
|
||||
|
||||
string? IDomainConfig.TlsSniPattern => null;
|
||||
|
||||
bool IDomainConfig.TlsIgnoreNameMismatch => true;
|
||||
|
||||
IPAddress? IDomainConfig.IPAddress => null;
|
||||
|
||||
string? IDomainConfig.ForwardDestination => null;
|
||||
|
||||
TimeSpan? IDomainConfig.Timeout => null;
|
||||
|
||||
Uri? IDomainConfig.Destination => null;
|
||||
|
||||
string? IDomainConfig.UserAgent => null;
|
||||
|
||||
IResponseConfig? IDomainConfig.Response => null; // or null
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace System.Application.Models
|
||||
/// 脚本
|
||||
/// </summary>
|
||||
[MPObj]
|
||||
public class ScriptDTO
|
||||
public partial class ScriptDTO
|
||||
#if MVVM_VM
|
||||
: ReactiveObject
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user