mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 07:27:36 +08:00
fix key
This commit is contained in:
@@ -158,6 +158,9 @@
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Update,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="20" Height="20" Data="{StaticResource DownloadDrawing}" />
|
||||
</Button>-->
|
||||
<controls:ProgressRing IsIndeterminate="True"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_ImportLoading,Mode=OneWay,Source={x:Static resx:R.Current}}" HorizontalAlignment="Stretch" Height="30" Width="30"
|
||||
IsVisible="{Binding IsLoading}" />
|
||||
<Button Classes="Hyperlink"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
|
||||
@@ -111,7 +111,9 @@
|
||||
Width="16"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Installed,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Margin="8 0" IsVisible="{Binding IsExist}"/>
|
||||
<!--<Button IsVisible="{Binding IsUpdate}" Background="Transparent" Cursor="Hand"
|
||||
<controls:ProgressRing IsIndeterminate="True" ToolTip.Tip="{ReflectionBinding Path=Res.Script_ImportLoading,Mode=OneWay,Source={x:Static resx:R.Current}}" HorizontalAlignment="Stretch" Height="30" Width="30" IsVisible="{Binding DownloadLoading}"/>
|
||||
|
||||
<!--<Button IsVisible="{Binding IsUpdate}" Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Update,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
@@ -134,6 +136,7 @@
|
||||
VerticalAlignment="Center"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Update,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
IsVisible="{Binding IsUpdate}">
|
||||
<controls:ProgressRing IsIndeterminate="True" ToolTip.Tip="{ReflectionBinding Path=Res.Script_ImportLoading,Mode=OneWay,Source={x:Static resx:R.Current}}" HorizontalAlignment="Stretch" Height="30" Width="30" IsVisible="{Binding IsLoading}"/>
|
||||
<Button Classes="Hyperlink"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
|
||||
@@ -16,15 +16,15 @@ using System.IO;
|
||||
|
||||
namespace System.Application.Services
|
||||
{
|
||||
public class ProxyService : ReactiveObject
|
||||
{
|
||||
public static ProxyService Current { get; } = new ProxyService();
|
||||
readonly IHttpProxyService httpProxyService = DI.Get<IHttpProxyService>();
|
||||
public class ProxyService : ReactiveObject
|
||||
{
|
||||
public static ProxyService Current { get; } = new ProxyService();
|
||||
readonly IHttpProxyService httpProxyService = DI.Get<IHttpProxyService>();
|
||||
|
||||
public ProxyService()
|
||||
{
|
||||
ProxyScripts = new SourceList<ScriptDTO>();
|
||||
}
|
||||
public ProxyService()
|
||||
{
|
||||
ProxyScripts = new SourceList<ScriptDTO>();
|
||||
}
|
||||
|
||||
private ObservableCollection<AccelerateProjectGroupDTO>? _ProxyDomains;
|
||||
public ObservableCollection<AccelerateProjectGroupDTO>? ProxyDomains
|
||||
@@ -54,20 +54,20 @@ namespace System.Application.Services
|
||||
set => this.RaiseAndSetIfChanged(ref _SelectGroup, value);
|
||||
}
|
||||
|
||||
public SourceList<ScriptDTO> ProxyScripts { get; }
|
||||
public SourceList<ScriptDTO> ProxyScripts { get; }
|
||||
|
||||
public IReadOnlyCollection<AccelerateProjectDTO>? EnableProxyDomains
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ProxyDomains.Any_Nullable())
|
||||
return null;
|
||||
return ProxyDomains.SelectMany(s =>
|
||||
{
|
||||
return s.Items.Where(w => w.Enable);
|
||||
}).ToArray();
|
||||
}
|
||||
}
|
||||
public IReadOnlyCollection<AccelerateProjectDTO>? EnableProxyDomains
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ProxyDomains.Any_Nullable())
|
||||
return null;
|
||||
return ProxyDomains.SelectMany(s =>
|
||||
{
|
||||
return s.Items.Where(w => w.Enable);
|
||||
}).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyCollection<ScriptDTO>? EnableProxyScripts
|
||||
{
|
||||
@@ -79,45 +79,45 @@ namespace System.Application.Services
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime _AccelerateTime = new();
|
||||
public DateTime AccelerateTime
|
||||
{
|
||||
get => _AccelerateTime;
|
||||
set
|
||||
{
|
||||
if (_AccelerateTime != value)
|
||||
{
|
||||
_AccelerateTime = value;
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
private DateTime _AccelerateTime = new();
|
||||
public DateTime AccelerateTime
|
||||
{
|
||||
get => _AccelerateTime;
|
||||
set
|
||||
{
|
||||
if (_AccelerateTime != value)
|
||||
{
|
||||
_AccelerateTime = value;
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEnableScript
|
||||
{
|
||||
get => ProxySettings.IsEnableScript.Value;
|
||||
set
|
||||
{
|
||||
ProxySettings.IsEnableScript.Value = value;
|
||||
httpProxyService.IsEnableScript = value;
|
||||
this.RaisePropertyChanged();
|
||||
this.RaisePropertyChanged(nameof(EnableProxyScripts));
|
||||
}
|
||||
}
|
||||
public bool IsEnableScript
|
||||
{
|
||||
get => ProxySettings.IsEnableScript.Value;
|
||||
set
|
||||
{
|
||||
ProxySettings.IsEnableScript.Value = value;
|
||||
httpProxyService.IsEnableScript = value;
|
||||
this.RaisePropertyChanged();
|
||||
this.RaisePropertyChanged(nameof(EnableProxyScripts));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsOnlyWorkSteamBrowser
|
||||
{
|
||||
get => ProxySettings.IsOnlyWorkSteamBrowser.Value;
|
||||
set
|
||||
{
|
||||
if (ProxySettings.IsOnlyWorkSteamBrowser.Value != value)
|
||||
{
|
||||
ProxySettings.IsOnlyWorkSteamBrowser.Value = value;
|
||||
httpProxyService.IsOnlyWorkSteamBrowser = value;
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool IsOnlyWorkSteamBrowser
|
||||
{
|
||||
get => ProxySettings.IsOnlyWorkSteamBrowser.Value;
|
||||
set
|
||||
{
|
||||
if (ProxySettings.IsOnlyWorkSteamBrowser.Value != value)
|
||||
{
|
||||
ProxySettings.IsOnlyWorkSteamBrowser.Value = value;
|
||||
httpProxyService.IsOnlyWorkSteamBrowser = value;
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 代理状态启动退出
|
||||
public bool ProxyStatus
|
||||
@@ -139,20 +139,20 @@ namespace System.Application.Services
|
||||
this.RaisePropertyChanged(nameof(EnableProxyDomains));
|
||||
this.RaisePropertyChanged(nameof(EnableProxyScripts));
|
||||
|
||||
var hosts = httpProxyService.ProxyDomains.SelectMany(s =>
|
||||
{
|
||||
return s?.HostsArray.Select(host =>
|
||||
{
|
||||
if (host.Contains(" "))
|
||||
{
|
||||
var h = host.Split(' ');
|
||||
return (h[0], h[1]);
|
||||
}
|
||||
return (IPAddress.Loopback.ToString(), host);
|
||||
});
|
||||
}).Where(w => !string.IsNullOrEmpty(w.Item1));
|
||||
var hosts = httpProxyService.ProxyDomains.SelectMany(s =>
|
||||
{
|
||||
return s?.HostsArray.Select(host =>
|
||||
{
|
||||
if (host.Contains(" "))
|
||||
{
|
||||
var h = host.Split(' ');
|
||||
return (h[0], h[1]);
|
||||
}
|
||||
return (IPAddress.Loopback.ToString(), host);
|
||||
});
|
||||
}).Where(w => !string.IsNullOrEmpty(w.Item1));
|
||||
|
||||
var isRun = httpProxyService.StartProxy(ProxySettings.EnableWindowsProxy.Value, ProxySettings.IsProxyGOG.Value);
|
||||
var isRun = httpProxyService.StartProxy(ProxySettings.EnableWindowsProxy.Value, ProxySettings.IsProxyGOG.Value);
|
||||
|
||||
if (isRun)
|
||||
{
|
||||
@@ -186,64 +186,64 @@ namespace System.Application.Services
|
||||
{
|
||||
ProxyDomains = new ObservableCollection<AccelerateProjectGroupDTO>(result.Content);
|
||||
|
||||
foreach (var item in ProxyDomains)
|
||||
{
|
||||
item.ImageStream = IHttpService.Instance.GetImageAsync(ImageUrlHelper.GetImageApiUrlById(item.ImageId), ImageChannelType.AccelerateGroup);
|
||||
}
|
||||
foreach (var item in ProxyDomains)
|
||||
{
|
||||
item.ImageStream = IHttpService.Instance.GetImageAsync(ImageUrlHelper.GetImageApiUrlById(item.ImageId), ImageChannelType.AccelerateGroup);
|
||||
}
|
||||
|
||||
SelectGroup = ProxyDomains.FirstOrDefault();
|
||||
SelectGroup = ProxyDomains.FirstOrDefault();
|
||||
|
||||
if (ProxySettings.SupportProxyServicesStatus.Value.Any_Nullable() && ProxyDomains.Any_Nullable())
|
||||
{
|
||||
var items = ProxyDomains.SelectMany(s => s.Items);
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (ProxySettings.SupportProxyServicesStatus.Value.Contains(item.Id.ToString()))
|
||||
{
|
||||
item.Enable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ProxySettings.SupportProxyServicesStatus.Value.Any_Nullable() && ProxyDomains.Any_Nullable())
|
||||
{
|
||||
var items = ProxyDomains.SelectMany(s => s.Items);
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (ProxySettings.SupportProxyServicesStatus.Value.Contains(item.Id.ToString()))
|
||||
{
|
||||
item.Enable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.WhenAnyValue(v => v.ProxyDomains)
|
||||
.Subscribe(domain => domain?
|
||||
.ToObservableChangeSet()
|
||||
.AutoRefresh(x => x.ObservableItems)
|
||||
.TransformMany(t => t.ObservableItems ?? new ObservableCollection<AccelerateProjectDTO>())
|
||||
.AutoRefresh(x => x.Enable)
|
||||
.WhenPropertyChanged(x => x.Enable, false)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
if (EnableProxyDomains != null)
|
||||
{
|
||||
ProxySettings.SupportProxyServicesStatus.Value = EnableProxyDomains.Where(w => w?.Id != null).Select(k => k.Id.ToString()).ToList();
|
||||
}
|
||||
}));
|
||||
#endregion
|
||||
this.WhenAnyValue(v => v.ProxyDomains)
|
||||
.Subscribe(domain => domain?
|
||||
.ToObservableChangeSet()
|
||||
.AutoRefresh(x => x.ObservableItems)
|
||||
.TransformMany(t => t.ObservableItems ?? new ObservableCollection<AccelerateProjectDTO>())
|
||||
.AutoRefresh(x => x.Enable)
|
||||
.WhenPropertyChanged(x => x.Enable, false)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
if (EnableProxyDomains != null)
|
||||
{
|
||||
ProxySettings.SupportProxyServicesStatus.Value = EnableProxyDomains.Where(w => w?.Id != null).Select(k => k.Id.ToString()).ToList();
|
||||
}
|
||||
}));
|
||||
#endregion
|
||||
|
||||
#region 加载脚本数据
|
||||
|
||||
//var response =// await client.Scripts();
|
||||
//if (!response.IsSuccess)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//new ObservableCollection<ScriptDTO>(response.Content);
|
||||
var scriptList = await DI.Get<IScriptManagerService>().GetAllScript();
|
||||
ProxyScripts.AddRange(scriptList);
|
||||
BasicsInfo();
|
||||
httpProxyService.IsEnableScript = IsEnableScript;
|
||||
if (ProxySettings.ScriptsStatus.Value.Any_Nullable() && ProxyScripts.Items.Any())
|
||||
{
|
||||
foreach (var item in ProxyScripts.Items)
|
||||
{
|
||||
if (item.LocalId > 0 && ProxySettings.ScriptsStatus.Value.Contains(item.LocalId))
|
||||
{
|
||||
item.Enable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//var response =// await client.Scripts();
|
||||
//if (!response.IsSuccess)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//new ObservableCollection<ScriptDTO>(response.Content);
|
||||
var scriptList = await DI.Get<IScriptManagerService>().GetAllScript();
|
||||
ProxyScripts.AddRange(scriptList);
|
||||
BasicsInfo();
|
||||
httpProxyService.IsEnableScript = IsEnableScript;
|
||||
if (ProxySettings.ScriptsStatus.Value.Any_Nullable() && ProxyScripts.Items.Any())
|
||||
{
|
||||
foreach (var item in ProxyScripts.Items)
|
||||
{
|
||||
if (item.LocalId > 0 && ProxySettings.ScriptsStatus.Value.Contains(item.LocalId))
|
||||
{
|
||||
item.Enable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.WhenAnyValue(v => v.ProxyScripts)
|
||||
.Subscribe(script => script?
|
||||
@@ -320,11 +320,11 @@ namespace System.Application.Services
|
||||
});
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
IHostsFileService.OnExitRestoreHosts();
|
||||
httpProxyService.Dispose();
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
IHostsFileService.OnExitRestoreHosts();
|
||||
httpProxyService.Dispose();
|
||||
}
|
||||
|
||||
public async Task AddNewScript(string filename)
|
||||
{
|
||||
@@ -359,7 +359,7 @@ namespace System.Application.Services
|
||||
}
|
||||
public async void DownloadScript(ScriptDTO model)
|
||||
{
|
||||
|
||||
model.IsLoading = true;
|
||||
var jspath = await DI.Get<IScriptManagerService>().DownloadScript(model.UpdateLink);
|
||||
if (jspath.state)
|
||||
{
|
||||
@@ -391,6 +391,7 @@ namespace System.Application.Services
|
||||
}
|
||||
else
|
||||
Toast.Show(AppResources.Download_ScriptError);
|
||||
model.IsLoading = false;
|
||||
}
|
||||
public async void CheckUpdate()
|
||||
{
|
||||
@@ -410,8 +411,8 @@ namespace System.Application.Services
|
||||
Current.ProxyScripts.Replace(item, item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,142 +46,144 @@ namespace System.Application.Services.Implementation
|
||||
{
|
||||
ScriptDTO.TryParse(filePath, out ScriptDTO? info);
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (info.Content != null)
|
||||
{
|
||||
var md5 = Hashs.String.MD5(info.Content);
|
||||
var sha512 = Hashs.String.SHA512(info.Content);
|
||||
if (await scriptRepository.ExistsScript(md5, sha512))
|
||||
{
|
||||
return (false, null, SR.Script_FileRepeat);
|
||||
}
|
||||
var url = Path.Combine(TAG, $"{md5}.js");
|
||||
var savePath = Path.Combine(IOPath.AppDataDirectory, url);
|
||||
var saveInfo = new FileInfo(savePath);
|
||||
if (!saveInfo.Directory.Exists)
|
||||
{
|
||||
saveInfo.Directory.Create();
|
||||
}
|
||||
if (saveInfo.Exists)
|
||||
saveInfo.Delete();
|
||||
fileInfo.CopyTo(savePath);
|
||||
if (oldInfo != null && oldInfo.LocalId > 0)
|
||||
{
|
||||
info.LocalId = oldInfo.LocalId;
|
||||
info.Id = oldInfo.Id;
|
||||
var state = await DeleteScriptAsync(oldInfo, false);
|
||||
if (!state.state)
|
||||
if (info != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (info.Content != null)
|
||||
{
|
||||
var md5 = Hashs.String.MD5(info.Content);
|
||||
var sha512 = Hashs.String.SHA512(info.Content);
|
||||
if (await scriptRepository.ExistsScript(md5, sha512))
|
||||
{
|
||||
return (false, null, SR.Script_FileRepeat);
|
||||
}
|
||||
var url = Path.Combine(TAG, $"{md5}.js");
|
||||
var savePath = Path.Combine(IOPath.AppDataDirectory, url);
|
||||
var saveInfo = new FileInfo(savePath);
|
||||
if (!saveInfo.Directory.Exists)
|
||||
{
|
||||
saveInfo.Directory.Create();
|
||||
}
|
||||
if (saveInfo.Exists)
|
||||
saveInfo.Delete();
|
||||
fileInfo.CopyTo(savePath);
|
||||
if (oldInfo != null && oldInfo.LocalId > 0)
|
||||
{
|
||||
info.LocalId = oldInfo.LocalId;
|
||||
info.Id = oldInfo.Id;
|
||||
info.Order = oldInfo.Order;
|
||||
var state = await DeleteScriptAsync(oldInfo, false);
|
||||
if (!state.state)
|
||||
return (false, null, SR.Script_FileDeleteError.Format(oldInfo.FilePath));
|
||||
}
|
||||
if (pid.HasValue)
|
||||
info.Id = pid.Value;
|
||||
var cachePath = Path.Combine(IOPath.CacheDirectory, url);
|
||||
info.FilePath = url;
|
||||
info.CachePath = url;
|
||||
if (await BuildScriptAsync(info, build))
|
||||
{
|
||||
var db = mapper.Map<Script>(info);
|
||||
db.MD5 = md5;
|
||||
db.SHA512 = sha512;
|
||||
if (order.HasValue)
|
||||
db.Order = order.Value;
|
||||
else
|
||||
db.Order = 10;
|
||||
try
|
||||
{
|
||||
if (deleteFile)
|
||||
fileInfo.Delete();
|
||||
}
|
||||
catch (Exception e) { logger.LogError(e.ToString()); }
|
||||
var state = (await scriptRepository.InsertOrUpdateAsync(db)).rowCount > 0;
|
||||
return (state, info, state ? SR.Script_SaveDbSuccess : SR.Script_SaveDBError);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pid.HasValue)
|
||||
info.Id = pid.Value;
|
||||
var cachePath = Path.Combine(IOPath.CacheDirectory, url);
|
||||
info.FilePath = url;
|
||||
info.CachePath = url;
|
||||
if (await BuildScriptAsync(info, build))
|
||||
{
|
||||
var db = mapper.Map<Script>(info);
|
||||
db.MD5 = md5;
|
||||
db.SHA512 = sha512;
|
||||
if (order.HasValue)
|
||||
db.Order = order.Value;
|
||||
else if(db.Order==0)
|
||||
db.Order = 10;
|
||||
try
|
||||
{
|
||||
if (deleteFile)
|
||||
fileInfo.Delete();
|
||||
}
|
||||
catch (Exception e) { logger.LogError(e.ToString()); }
|
||||
var state = (await scriptRepository.InsertOrUpdateAsync(db)).rowCount > 0;
|
||||
info.LocalId = db.Id;
|
||||
return (state, info, state ? SR.Script_SaveDbSuccess : SR.Script_SaveDBError);
|
||||
}
|
||||
else
|
||||
{
|
||||
var msg = SR.Script_BuildError.Format(filePath);
|
||||
logger.LogError(msg);
|
||||
toast.Show(msg);
|
||||
return (false, null, msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
toast.Show(msg);
|
||||
return (false, null, msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var msg = SR.Script_ReadFileError.Format(filePath);
|
||||
logger.LogError(msg);
|
||||
toast.Show(msg);
|
||||
return (false, null, msg);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
toast.Show(msg);
|
||||
return (false, null, msg);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
var msg = SR.Script_ReadFileError.Format(e.GetAllMessage());
|
||||
logger.LogError(e, msg);
|
||||
return (false, null, msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var msg = SR.Script_ReadFileError.Format(filePath); //$"文件解析失败,请检查格式:{filePath}";
|
||||
logger.LogError(msg);
|
||||
return (false, null, msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (false, null, msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var msg = string.Format(SR.Script_ReadFileError, filePath); //$"文件解析失败,请检查格式:{filePath}";
|
||||
logger.LogError(msg);
|
||||
return (false, null, msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var msg = SR.Script_NoFile.Format(filePath);// $"文件不存在:{filePath}";
|
||||
logger.LogError(msg);
|
||||
return (false, null, msg);
|
||||
}
|
||||
}
|
||||
public async Task<bool> BuildScriptAsync(ScriptDTO model, bool build = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (model.RequiredJsArray != null)
|
||||
{
|
||||
var scriptContent = new StringBuilder();
|
||||
if (build)
|
||||
{
|
||||
scriptContent.AppendLine("(function() {");
|
||||
foreach (var item in model.RequiredJsArray)
|
||||
{
|
||||
try
|
||||
{
|
||||
var scriptInfo = await httpService.GetAsync<string>(item);
|
||||
scriptContent.AppendLine(scriptInfo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return (false, null, msg);
|
||||
}
|
||||
}
|
||||
public async Task<bool> BuildScriptAsync(ScriptDTO model, bool build = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (model.RequiredJsArray != null)
|
||||
{
|
||||
var scriptContent = new StringBuilder();
|
||||
if (build)
|
||||
{
|
||||
scriptContent.AppendLine("(function() {");
|
||||
foreach (var item in model.RequiredJsArray)
|
||||
{
|
||||
try
|
||||
{
|
||||
var scriptInfo = await httpService.GetAsync<string>(item);
|
||||
scriptContent.AppendLine(scriptInfo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
var errorMsg = SR.Script_BuildDownloadError.Format(model.Name, item);
|
||||
logger.LogError(e, errorMsg);
|
||||
toast.Show(errorMsg);
|
||||
}
|
||||
}
|
||||
scriptContent.AppendLine(model.Content);
|
||||
scriptContent.AppendLine("})( )");
|
||||
}
|
||||
else
|
||||
{
|
||||
scriptContent.Append(model.Content);
|
||||
}
|
||||
var cachePath = Path.Combine(IOPath.CacheDirectory, model.CachePath);
|
||||
var fileInfo = new FileInfo(cachePath);
|
||||
if (!fileInfo.Directory.Exists)
|
||||
{
|
||||
fileInfo.Directory.Create();
|
||||
}
|
||||
if (fileInfo.Exists)
|
||||
fileInfo.Delete();
|
||||
using (var stream = fileInfo.CreateText())
|
||||
{
|
||||
stream.Write(scriptContent);
|
||||
await stream.FlushAsync();
|
||||
await stream.DisposeAsync();
|
||||
//stream
|
||||
}
|
||||
toast.Show(errorMsg);
|
||||
}
|
||||
}
|
||||
scriptContent.AppendLine(model.Content);
|
||||
scriptContent.AppendLine("})( )");
|
||||
}
|
||||
else
|
||||
{
|
||||
scriptContent.Append(model.Content);
|
||||
}
|
||||
var cachePath = Path.Combine(IOPath.CacheDirectory, model.CachePath);
|
||||
var fileInfo = new FileInfo(cachePath);
|
||||
if (!fileInfo.Directory.Exists)
|
||||
{
|
||||
fileInfo.Directory.Create();
|
||||
}
|
||||
if (fileInfo.Exists)
|
||||
fileInfo.Delete();
|
||||
using (var stream = fileInfo.CreateText())
|
||||
{
|
||||
stream.Write(scriptContent);
|
||||
await stream.FlushAsync();
|
||||
await stream.DisposeAsync();
|
||||
//stream
|
||||
}
|
||||
|
||||
return true;
|
||||
//var scriptRequired = new string[model.RequiredJsArray.Length];
|
||||
|
||||
@@ -17,289 +17,328 @@ using S_JsonProperty = System.Text.Json.Serialization.JsonPropertyNameAttribute;
|
||||
|
||||
namespace System.Application.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 脚本
|
||||
/// </summary>
|
||||
[MPObj]
|
||||
public class ScriptDTO
|
||||
/// <summary>
|
||||
/// 脚本
|
||||
/// </summary>
|
||||
[MPObj]
|
||||
public class ScriptDTO
|
||||
#if MVVM_VM
|
||||
: ReactiveObject
|
||||
: ReactiveObject
|
||||
#endif
|
||||
{
|
||||
{
|
||||
#if MVVM_VM
|
||||
const string HomepageURL = "HomepageURL";
|
||||
const string DownloadURL = "DownloadURL";
|
||||
const string UpdateURL = "UpdateURL";
|
||||
const string Exclude = "Exclude";
|
||||
const string Grant = "Grant";
|
||||
const string Require = "Require";
|
||||
const string Include = "Include";
|
||||
const string DescRegex = @"(?<={0})[\s\S]*?(?=\n)";
|
||||
const string HomepageURL = "HomepageURL";
|
||||
const string DownloadURL = "DownloadURL";
|
||||
const string UpdateURL = "UpdateURL";
|
||||
const string Exclude = "Exclude";
|
||||
const string Grant = "Grant";
|
||||
const string Require = "Require";
|
||||
const string Include = "Include";
|
||||
const string DescRegex = @"(?<={0})[\s\S]*?(?=\n)";
|
||||
|
||||
public ScriptDTO()
|
||||
{
|
||||
public ScriptDTO()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static bool TryParse(string path, [NotNullWhen(true)] out ScriptDTO? proxyScript)
|
||||
{
|
||||
var content = File.ReadAllText(path);
|
||||
if (!string.IsNullOrEmpty(content))
|
||||
{
|
||||
var userScript = content.Substring("==UserScript==", "==/UserScript==");
|
||||
if (!string.IsNullOrEmpty(userScript))
|
||||
{
|
||||
var script = new ScriptDTO
|
||||
{
|
||||
FilePath = path,
|
||||
Content = content.Replace("</script>", "<\\/script>"),
|
||||
//Content = content.Replace("</script>", "<\\/script>").Replace(" ", "").Replace("\r", "").Replace("\n", "").Replace("\t", ""),
|
||||
Name = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(Name)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
//NameSpace = Regex.Matches(userScript, string.Format(DescRegex, $"@{nameof(NameSpace)}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true).ToArray(),
|
||||
Version = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(Version)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
Description = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(Description)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
Author = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(Author)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
SourceLink = Regex.Match(userScript, string.Format(DescRegex, $"@{HomepageURL}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
//SupportURL = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(SupportURL)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
DownloadLink = Regex.Match(userScript, string.Format(DescRegex, $"@{DownloadURL}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
UpdateLink = Regex.Match(userScript, string.Format(DescRegex, $"@{UpdateURL}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
ExcludeDomainNames = string.Join(GeneralSeparator, Regex.Matches(userScript, string.Format(DescRegex, $"@{Exclude}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true)),
|
||||
DependentGreasyForkFunction = Regex.Matches(userScript, string.Format(DescRegex, $"@{Grant}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true).Any_Nullable(),
|
||||
RequiredJs = string.Join(GeneralSeparator, Regex.Matches(userScript, string.Format(DescRegex, $"@{Require}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true)),
|
||||
};
|
||||
var matchs = string.Join(GeneralSeparator, Regex.Matches(userScript, string.Format(DescRegex, $"@{nameof(Match)}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true));
|
||||
var Includes = string.Join(GeneralSeparator, Regex.Matches(userScript, string.Format(DescRegex, $"@{Include}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true));
|
||||
script.MatchDomainNames = string.IsNullOrEmpty(matchs) ? Includes : matchs;
|
||||
var enable = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(Enable)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true);
|
||||
public static bool TryParse(string path, [NotNullWhen(true)] out ScriptDTO? proxyScript)
|
||||
{
|
||||
var content = File.ReadAllText(path);
|
||||
if (!string.IsNullOrEmpty(content))
|
||||
{
|
||||
var userScript = content.Substring("==UserScript==", "==/UserScript==");
|
||||
if (!string.IsNullOrEmpty(userScript))
|
||||
{
|
||||
var script = new ScriptDTO
|
||||
{
|
||||
FilePath = path,
|
||||
Content = content.Replace("</script>", "<\\/script>"),
|
||||
//Content = content.Replace("</script>", "<\\/script>").Replace(" ", "").Replace("\r", "").Replace("\n", "").Replace("\t", ""),
|
||||
Name = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(Name)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
//NameSpace = Regex.Matches(userScript, string.Format(DescRegex, $"@{nameof(NameSpace)}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true).ToArray(),
|
||||
Version = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(Version)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
Description = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(Description)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
Author = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(Author)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
SourceLink = Regex.Match(userScript, string.Format(DescRegex, $"@{HomepageURL}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
//SupportURL = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(SupportURL)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
DownloadLink = Regex.Match(userScript, string.Format(DescRegex, $"@{DownloadURL}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
UpdateLink = Regex.Match(userScript, string.Format(DescRegex, $"@{UpdateURL}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true),
|
||||
ExcludeDomainNames = string.Join(GeneralSeparator, Regex.Matches(userScript, string.Format(DescRegex, $"@{Exclude}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true)),
|
||||
DependentGreasyForkFunction = Regex.Matches(userScript, string.Format(DescRegex, $"@{Grant}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true).Any_Nullable(),
|
||||
RequiredJs = string.Join(GeneralSeparator, Regex.Matches(userScript, string.Format(DescRegex, $"@{Require}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true)),
|
||||
};
|
||||
var matchs = string.Join(GeneralSeparator, Regex.Matches(userScript, string.Format(DescRegex, $"@{nameof(Match)}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true));
|
||||
var Includes = string.Join(GeneralSeparator, Regex.Matches(userScript, string.Format(DescRegex, $"@{Include}"), RegexOptions.IgnoreCase).GetValues(s => s.Success == true));
|
||||
script.MatchDomainNames = string.IsNullOrEmpty(matchs) ? Includes : matchs;
|
||||
var enable = Regex.Match(userScript, string.Format(DescRegex, $"@{nameof(Enable)}"), RegexOptions.IgnoreCase).GetValue(s => s.Success == true);
|
||||
|
||||
script.Enable = bool.TryParse(enable, out var e) && e;
|
||||
proxyScript = script;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
proxyScript = null;
|
||||
return false;
|
||||
}
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public int LocalId { get; set; }
|
||||
script.Enable = bool.TryParse(enable, out var e) && e;
|
||||
proxyScript = script;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
proxyScript = null;
|
||||
return false;
|
||||
}
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public int LocalId { get; set; }
|
||||
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? FilePath { get; set; } = string.Empty;
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? FilePath { get; set; } = string.Empty;
|
||||
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? CachePath { get; set; } = string.Empty;
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? CachePath { get; set; } = string.Empty;
|
||||
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? FileName => FilePath ?? Path.GetFileName(FilePath);
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? FileName => FilePath ?? Path.GetFileName(FilePath);
|
||||
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? Content { get; set; } = string.Empty;
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? Content { get; set; } = string.Empty;
|
||||
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? JsPathUrl { get; set; }
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public bool IsUpdate { get; set; } = false;
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public bool IsExist { get; set; } = false;
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? NewVersion { get; set; }
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public DateTimeOffset? UpdateTime { get; set; }
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? JsPathUrl { get; set; }
|
||||
|
||||
private bool _IsUpdate = false;
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public bool IsUpdate
|
||||
{
|
||||
get => _IsUpdate;
|
||||
set => this.RaiseAndSetIfChanged(ref _IsUpdate, value);
|
||||
}
|
||||
private bool _IsExist = false;
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public bool IsExist
|
||||
{
|
||||
get => _IsExist;
|
||||
set => this.RaiseAndSetIfChanged(ref _IsExist, value);
|
||||
}
|
||||
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public bool DownloadLoading => !IsUpdate && IsLoading;
|
||||
private bool _IsLoading = false;
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public bool IsLoading
|
||||
{
|
||||
get => _IsLoading;
|
||||
set => this.RaiseAndSetIfChanged(ref _IsLoading, value);
|
||||
}
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string? NewVersion { get; set; }
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public DateTimeOffset? UpdateTime { get; set; }
|
||||
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// 显示名称
|
||||
/// </summary>
|
||||
[MPKey(0)]
|
||||
[N_JsonProperty("0")]
|
||||
[S_JsonProperty("0")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? Name { get; set; } = string.Empty;
|
||||
private string? _Name;
|
||||
/// <summary>
|
||||
/// 显示名称
|
||||
/// </summary>
|
||||
[MPKey(0)]
|
||||
[N_JsonProperty("0")]
|
||||
[S_JsonProperty("0")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? Name
|
||||
{
|
||||
get => _Name;
|
||||
set => this.RaiseAndSetIfChanged(ref _Name, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 脚本作者
|
||||
/// </summary>
|
||||
[MPKey(1)]
|
||||
[N_JsonProperty("1")]
|
||||
[S_JsonProperty("1")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? Author { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 脚本作者
|
||||
/// </summary>
|
||||
[MPKey(1)]
|
||||
[N_JsonProperty("1")]
|
||||
[S_JsonProperty("1")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? Author { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
/// </summary>
|
||||
[MPKey(2)]
|
||||
[N_JsonProperty("2")]
|
||||
[S_JsonProperty("2")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? Version { get; set; } = string.Empty;
|
||||
private string _Version;
|
||||
|
||||
/// <summary>
|
||||
/// 来源地址
|
||||
/// </summary>
|
||||
[MPKey(3)]
|
||||
[N_JsonProperty("3")]
|
||||
[S_JsonProperty("3")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? SourceLink { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
/// </summary>
|
||||
[MPKey(2)]
|
||||
[N_JsonProperty("2")]
|
||||
[S_JsonProperty("2")]
|
||||
public string Version
|
||||
{
|
||||
get => _Version;
|
||||
set => this.RaiseAndSetIfChanged(ref _Version, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载地址
|
||||
/// </summary>
|
||||
[MPKey(4)]
|
||||
[N_JsonProperty("4")]
|
||||
[S_JsonProperty("4")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? DownloadLink { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 来源地址
|
||||
/// </summary>
|
||||
[MPKey(3)]
|
||||
[N_JsonProperty("3")]
|
||||
[S_JsonProperty("3")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? SourceLink { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 更新地址
|
||||
/// </summary>
|
||||
[MPKey(5)]
|
||||
[N_JsonProperty("5")]
|
||||
[S_JsonProperty("5")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? UpdateLink { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 下载地址
|
||||
/// </summary>
|
||||
[MPKey(4)]
|
||||
[N_JsonProperty("4")]
|
||||
[S_JsonProperty("4")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? DownloadLink { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 说明
|
||||
/// </summary>
|
||||
[MPKey(6)]
|
||||
[N_JsonProperty("6")]
|
||||
[S_JsonProperty("6")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
private string? _UpdateLink;
|
||||
/// <summary>
|
||||
/// 更新地址
|
||||
/// </summary>
|
||||
[MPKey(5)]
|
||||
[N_JsonProperty("5")]
|
||||
[S_JsonProperty("5")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? UpdateLink
|
||||
{
|
||||
get => _UpdateLink;
|
||||
set => this.RaiseAndSetIfChanged(ref _UpdateLink, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 脚本匹配域名,分号分割多个
|
||||
/// </summary>
|
||||
[MPKey(7)]
|
||||
[N_JsonProperty("7")]
|
||||
[S_JsonProperty("7")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? MatchDomainNames { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 说明
|
||||
/// </summary>
|
||||
[MPKey(6)]
|
||||
[N_JsonProperty("6")]
|
||||
[S_JsonProperty("6")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 是否默认启用
|
||||
/// </summary>
|
||||
[MPKey(8)]
|
||||
[N_JsonProperty("8")]
|
||||
[S_JsonProperty("8")]
|
||||
public bool Enable
|
||||
/// <summary>
|
||||
/// 脚本匹配域名,分号分割多个
|
||||
/// </summary>
|
||||
[MPKey(7)]
|
||||
[N_JsonProperty("7")]
|
||||
[S_JsonProperty("7")]
|
||||
[NotNull, DisallowNull] // C# 8 not null
|
||||
public string? MatchDomainNames { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 是否默认启用
|
||||
/// </summary>
|
||||
[MPKey(8)]
|
||||
[N_JsonProperty("8")]
|
||||
[S_JsonProperty("8")]
|
||||
public bool Enable
|
||||
#if MVVM_VM
|
||||
{
|
||||
get => mEnable;
|
||||
set => this.RaiseAndSetIfChanged(ref mEnable, value);
|
||||
}
|
||||
bool mEnable;
|
||||
{
|
||||
get => mEnable;
|
||||
set => this.RaiseAndSetIfChanged(ref mEnable, value);
|
||||
}
|
||||
bool mEnable;
|
||||
#else
|
||||
{ get; set; }
|
||||
#endif
|
||||
string? mMatchDomainNames;
|
||||
string[]? mMatchDomainNamesArray;
|
||||
readonly object mMatchDomainNamesArrayLock = new();
|
||||
|
||||
string? mMatchDomainNames;
|
||||
string[]? mMatchDomainNamesArray;
|
||||
readonly object mMatchDomainNamesArrayLock = new();
|
||||
/// <inheritdoc cref="MatchDomainNames"/>
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string[] MatchDomainNamesArray
|
||||
=> GetSplitValues(mMatchDomainNamesArrayLock, MatchDomainNames, ref mMatchDomainNames, ref mMatchDomainNamesArray);
|
||||
|
||||
/// <inheritdoc cref="MatchDomainNames"/>
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string[] MatchDomainNamesArray
|
||||
=> GetSplitValues(mMatchDomainNamesArrayLock, MatchDomainNames, ref mMatchDomainNames, ref mMatchDomainNamesArray);
|
||||
/// <summary>
|
||||
/// 脚本显示图标
|
||||
/// </summary>
|
||||
[MPKey(9)]
|
||||
[N_JsonProperty("9")]
|
||||
[S_JsonProperty("9")]
|
||||
public string? Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 脚本显示图标
|
||||
/// </summary>
|
||||
[MPKey(9)]
|
||||
[N_JsonProperty("9")]
|
||||
[S_JsonProperty("9")]
|
||||
public string? Icon { get; set; }
|
||||
/// <summary>
|
||||
/// 是否依赖油猴函数
|
||||
/// </summary>
|
||||
[MPKey(10)]
|
||||
[N_JsonProperty("10")]
|
||||
[S_JsonProperty("10")]
|
||||
public bool DependentGreasyForkFunction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否依赖油猴函数
|
||||
/// </summary>
|
||||
[MPKey(10)]
|
||||
[N_JsonProperty("10")]
|
||||
[S_JsonProperty("10")]
|
||||
public bool DependentGreasyForkFunction { get; set; }
|
||||
/// <summary>
|
||||
/// 脚本排除域名,分号分割多个
|
||||
/// </summary>
|
||||
[MPKey(11)]
|
||||
[N_JsonProperty("11")]
|
||||
[S_JsonProperty("11")]
|
||||
public string? ExcludeDomainNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 脚本排除域名,分号分割多个
|
||||
/// </summary>
|
||||
[MPKey(11)]
|
||||
[N_JsonProperty("11")]
|
||||
[S_JsonProperty("11")]
|
||||
public string? ExcludeDomainNames { get; set; }
|
||||
string? mExcludeDomainNames;
|
||||
string[]? mExcludeDomainNamesArray;
|
||||
readonly object mExcludeDomainNamesArrayLock = new();
|
||||
|
||||
string? mExcludeDomainNames;
|
||||
string[]? mExcludeDomainNamesArray;
|
||||
readonly object mExcludeDomainNamesArrayLock = new();
|
||||
/// <inheritdoc cref="ExcludeDomainNames"/>
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string[]? ExcludeDomainNamesArray
|
||||
=> ExcludeDomainNames == null ? null : GetSplitValues(mExcludeDomainNamesArrayLock, ExcludeDomainNames, ref mExcludeDomainNames, ref mExcludeDomainNamesArray);
|
||||
|
||||
/// <inheritdoc cref="ExcludeDomainNames"/>
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string[]? ExcludeDomainNamesArray
|
||||
=> ExcludeDomainNames == null ? null : GetSplitValues(mExcludeDomainNamesArrayLock, ExcludeDomainNames, ref mExcludeDomainNames, ref mExcludeDomainNamesArray);
|
||||
[MPKey(12)]
|
||||
[N_JsonProperty("12")]
|
||||
[S_JsonProperty("12")]
|
||||
public List<Guid>? AccelerateProjects { get; set; }
|
||||
|
||||
[MPKey(12)]
|
||||
[N_JsonProperty("12")]
|
||||
[S_JsonProperty("12")]
|
||||
public List<Guid>? AccelerateProjects { get; set; }
|
||||
/// <summary>
|
||||
/// 依赖外部JS,分号分割多个
|
||||
/// </summary>
|
||||
[MPKey(13)]
|
||||
[N_JsonProperty("13")]
|
||||
[S_JsonProperty("13")]
|
||||
public string? RequiredJs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 依赖外部JS,分号分割多个
|
||||
/// </summary>
|
||||
[MPKey(13)]
|
||||
[N_JsonProperty("13")]
|
||||
[S_JsonProperty("13")]
|
||||
public string? RequiredJs { get; set; }
|
||||
string? mRequiredJs;
|
||||
string[]? mRequiredJsArray;
|
||||
readonly object mRequiredJsArrayLock = new();
|
||||
|
||||
string? mRequiredJs;
|
||||
string[]? mRequiredJsArray;
|
||||
readonly object mRequiredJsArrayLock = new();
|
||||
/// <inheritdoc cref="RequiredJs"/>
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string[]? RequiredJsArray
|
||||
=> RequiredJs == null ? null : GetSplitValues(mRequiredJsArrayLock, RequiredJs, ref mRequiredJs, ref mRequiredJsArray);
|
||||
|
||||
/// <inheritdoc cref="RequiredJs"/>
|
||||
[MPIgnore]
|
||||
[N_JsonIgnore]
|
||||
[S_JsonIgnore]
|
||||
public string[]? RequiredJsArray
|
||||
=> RequiredJs == null ? null : GetSplitValues(mRequiredJsArrayLock, RequiredJs, ref mRequiredJs, ref mRequiredJsArray);
|
||||
[MPKey(14)]
|
||||
[N_JsonProperty("14")]
|
||||
[S_JsonProperty("14")]
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
[MPKey(14)]
|
||||
[N_JsonProperty("14")]
|
||||
[S_JsonProperty("14")]
|
||||
public Guid? Id { get; set; }
|
||||
[MPKey(15)]
|
||||
[N_JsonProperty("15")]
|
||||
[S_JsonProperty("15")]
|
||||
public int Order { get; set; }
|
||||
|
||||
[MPKey(15)]
|
||||
[N_JsonProperty("15")]
|
||||
[S_JsonProperty("15")]
|
||||
public int Order { get; set; }
|
||||
|
||||
[MPKey(16)]
|
||||
[N_JsonProperty("16")]
|
||||
[S_JsonProperty("16")]
|
||||
public bool IsBuild { get; set; } = true;
|
||||
}
|
||||
[MPKey(16)]
|
||||
[N_JsonProperty("16")]
|
||||
[S_JsonProperty("16")]
|
||||
public bool IsBuild { get; set; } = true;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -48,7 +48,7 @@ namespace System.Application.Services.Implementation._21VianetBlueCloud
|
||||
const string SignKey = "sig";
|
||||
const string KeyNameKey = "skn";
|
||||
const string ExpiryKey = "se";
|
||||
const string _endpoint = "https://bluecloudccs.21vbluecloud.com:443/services/sms/messages?api-version=2018-10-01";
|
||||
const string _endpoint = "https://bluecloudccs.21vbluecloud.com/services/sms/messages?api-version=2018-10-01";
|
||||
|
||||
/// <summary>
|
||||
/// create token
|
||||
|
||||
Reference in New Issue
Block a user