This commit is contained in:
lincube
2026-03-29 15:34:17 +08:00
parent 372b5b7adc
commit bd2313fe7e
23 changed files with 2986 additions and 22 deletions

View File

@@ -73,6 +73,17 @@ public sealed class ComponentSettingsSnapshot
public List<string>? OfficeRecentDocumentsEnabledSources { get; set; }
// 智教Hub组件配置
public string ZhiJiaoHubSource { get; set; } = ZhiJiaoHubSources.ClassIsland;
public string ZhiJiaoHubMirrorSource { get; set; } = ZhiJiaoHubMirrorSources.Direct;
public bool ZhiJiaoHubAutoRefreshEnabled { get; set; } = true;
public int ZhiJiaoHubAutoRefreshIntervalMinutes { get; set; } = 30;
public int ZhiJiaoHubCurrentImageIndex { get; set; } = 0;
public ComponentSettingsSnapshot Clone()
{
var clone = (ComponentSettingsSnapshot)MemberwiseClone();
@@ -107,3 +118,56 @@ public sealed class ComponentSettingsSnapshot
return clone;
}
}
// 智教Hub数据源常量
public static class ZhiJiaoHubSources
{
public const string ClassIsland = "classisland";
public const string Sectl = "sectl";
public static string Normalize(string? value)
{
return value?.ToLowerInvariant() switch
{
"sectl" => Sectl,
_ => ClassIsland
};
}
}
// 智教Hub镜像加速源常量
public static class ZhiJiaoHubMirrorSources
{
public const string Direct = "direct";
public const string GhProxy = "gh-proxy";
public const string GhProxyBaseUrl = "https://gh-proxy.com/";
public static string Normalize(string? value)
{
return string.Equals(value, GhProxy, StringComparison.OrdinalIgnoreCase)
? GhProxy
: Direct;
}
public static string ApplyMirror(string url, string? mirrorSource)
{
if (string.IsNullOrWhiteSpace(url))
{
return url;
}
if (!string.Equals(Normalize(mirrorSource), GhProxy, StringComparison.OrdinalIgnoreCase))
{
return url;
}
if (url.StartsWith("https://raw.githubusercontent.com/", StringComparison.OrdinalIgnoreCase) ||
url.StartsWith("https://github.com/", StringComparison.OrdinalIgnoreCase))
{
return GhProxyBaseUrl.TrimEnd('/') + "/" + url;
}
return url;
}
}