- 新增模块抽象与 manifest/版本范围、安装/启用/停用/回滚\n- 模块管理页面:上传 .tpm/.zip、状态与冲突提示\n- 任务中心/新建任务改为基于模块贡献动态展示(system 不出现在新建列表)\n- API 管理改为基于模块贡献动态创建与通用配置编辑\n- 支持模块扩展任务执行器与扩展页面入口 /ext/{moduleId}/{pageKey}\n\n内置模块:builtin.kick-api、builtin.tasks
59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace TelegramPanel.Modules;
|
|
|
|
public sealed class ModuleManifest
|
|
{
|
|
[JsonPropertyName("id")]
|
|
public string Id { get; set; } = "";
|
|
|
|
[JsonPropertyName("name")]
|
|
public string Name { get; set; } = "";
|
|
|
|
[JsonPropertyName("version")]
|
|
public string Version { get; set; } = "0.0.0";
|
|
|
|
[JsonPropertyName("host")]
|
|
public HostCompatibility Host { get; set; } = new();
|
|
|
|
[JsonPropertyName("dependencies")]
|
|
public List<ModuleDependency> Dependencies { get; set; } = new();
|
|
|
|
[JsonPropertyName("entry")]
|
|
public ModuleEntryPoint Entry { get; set; } = new();
|
|
}
|
|
|
|
public sealed class HostCompatibility
|
|
{
|
|
[JsonPropertyName("min")]
|
|
public string? Min { get; set; }
|
|
|
|
[JsonPropertyName("max")]
|
|
public string? Max { get; set; }
|
|
}
|
|
|
|
public sealed class ModuleDependency
|
|
{
|
|
[JsonPropertyName("id")]
|
|
public string Id { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// 版本范围表达式,支持:
|
|
/// - 1.2.3(等于)
|
|
/// - >=1.2.3
|
|
/// - >=1.2.3 <2.0.0(空格分隔多个条件)
|
|
/// </summary>
|
|
[JsonPropertyName("range")]
|
|
public string Range { get; set; } = "";
|
|
}
|
|
|
|
public sealed class ModuleEntryPoint
|
|
{
|
|
[JsonPropertyName("assembly")]
|
|
public string Assembly { get; set; } = "";
|
|
|
|
[JsonPropertyName("type")]
|
|
public string Type { get; set; } = "";
|
|
}
|
|
|