✨ Add self-updating service
This commit is contained in:
@@ -471,6 +471,84 @@ export class GeneralConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GiteaConfig Gitea配置
|
||||
*/
|
||||
export class GiteaConfig {
|
||||
/**
|
||||
* Gitea服务器URL
|
||||
*/
|
||||
"baseURL": string;
|
||||
|
||||
/**
|
||||
* 仓库所有者
|
||||
*/
|
||||
"owner": string;
|
||||
|
||||
/**
|
||||
* 仓库名称
|
||||
*/
|
||||
"repo": string;
|
||||
|
||||
/** Creates a new GiteaConfig instance. */
|
||||
constructor($$source: Partial<GiteaConfig> = {}) {
|
||||
if (!("baseURL" in $$source)) {
|
||||
this["baseURL"] = "";
|
||||
}
|
||||
if (!("owner" in $$source)) {
|
||||
this["owner"] = "";
|
||||
}
|
||||
if (!("repo" in $$source)) {
|
||||
this["repo"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new GiteaConfig instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): GiteaConfig {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new GiteaConfig($$parsedSource as Partial<GiteaConfig>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GithubConfig GitHub配置
|
||||
*/
|
||||
export class GithubConfig {
|
||||
/**
|
||||
* 仓库所有者
|
||||
*/
|
||||
"owner": string;
|
||||
|
||||
/**
|
||||
* 仓库名称
|
||||
*/
|
||||
"repo": string;
|
||||
|
||||
/** Creates a new GithubConfig instance. */
|
||||
constructor($$source: Partial<GithubConfig> = {}) {
|
||||
if (!("owner" in $$source)) {
|
||||
this["owner"] = "";
|
||||
}
|
||||
if (!("repo" in $$source)) {
|
||||
this["repo"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new GithubConfig instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): GithubConfig {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new GithubConfig($$parsedSource as Partial<GithubConfig>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HotkeyCombo 热键组合定义
|
||||
*/
|
||||
@@ -1023,6 +1101,26 @@ export enum TabType {
|
||||
TabTypeTab = "tab",
|
||||
};
|
||||
|
||||
/**
|
||||
* UpdateSourceType 更新源类型
|
||||
*/
|
||||
export enum UpdateSourceType {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
/**
|
||||
* UpdateSourceGithub GitHub更新源
|
||||
*/
|
||||
UpdateSourceGithub = "github",
|
||||
|
||||
/**
|
||||
* UpdateSourceGitea Gitea更新源
|
||||
*/
|
||||
UpdateSourceGitea = "gitea",
|
||||
};
|
||||
|
||||
/**
|
||||
* UpdatesConfig 更新设置配置
|
||||
*/
|
||||
@@ -1037,6 +1135,36 @@ export class UpdatesConfig {
|
||||
*/
|
||||
"autoUpdate": boolean;
|
||||
|
||||
/**
|
||||
* 主要更新源
|
||||
*/
|
||||
"primarySource": UpdateSourceType;
|
||||
|
||||
/**
|
||||
* 备用更新源
|
||||
*/
|
||||
"backupSource": UpdateSourceType;
|
||||
|
||||
/**
|
||||
* 更新前是否备份
|
||||
*/
|
||||
"backupBeforeUpdate": boolean;
|
||||
|
||||
/**
|
||||
* 更新超时时间(秒)
|
||||
*/
|
||||
"updateTimeout": number;
|
||||
|
||||
/**
|
||||
* GitHub配置
|
||||
*/
|
||||
"github": GithubConfig;
|
||||
|
||||
/**
|
||||
* Gitea配置
|
||||
*/
|
||||
"gitea": GiteaConfig;
|
||||
|
||||
/** Creates a new UpdatesConfig instance. */
|
||||
constructor($$source: Partial<UpdatesConfig> = {}) {
|
||||
if (!("version" in $$source)) {
|
||||
@@ -1045,6 +1173,24 @@ export class UpdatesConfig {
|
||||
if (!("autoUpdate" in $$source)) {
|
||||
this["autoUpdate"] = false;
|
||||
}
|
||||
if (!("primarySource" in $$source)) {
|
||||
this["primarySource"] = ("" as UpdateSourceType);
|
||||
}
|
||||
if (!("backupSource" in $$source)) {
|
||||
this["backupSource"] = ("" as UpdateSourceType);
|
||||
}
|
||||
if (!("backupBeforeUpdate" in $$source)) {
|
||||
this["backupBeforeUpdate"] = false;
|
||||
}
|
||||
if (!("updateTimeout" in $$source)) {
|
||||
this["updateTimeout"] = 0;
|
||||
}
|
||||
if (!("github" in $$source)) {
|
||||
this["github"] = (new GithubConfig());
|
||||
}
|
||||
if (!("gitea" in $$source)) {
|
||||
this["gitea"] = (new GiteaConfig());
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
@@ -1053,7 +1199,15 @@ export class UpdatesConfig {
|
||||
* Creates a new UpdatesConfig instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): UpdatesConfig {
|
||||
const $$createField6_0 = $$createType11;
|
||||
const $$createField7_0 = $$createType12;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("github" in $$parsedSource) {
|
||||
$$parsedSource["github"] = $$createField6_0($$parsedSource["github"]);
|
||||
}
|
||||
if ("gitea" in $$parsedSource) {
|
||||
$$parsedSource["gitea"] = $$createField7_0($$parsedSource["gitea"]);
|
||||
}
|
||||
return new UpdatesConfig($$parsedSource as Partial<UpdatesConfig>);
|
||||
}
|
||||
}
|
||||
@@ -1075,3 +1229,5 @@ const $$createType7 = HotkeyCombo.createFrom;
|
||||
const $$createType8 = KeyBinding.createFrom;
|
||||
const $$createType9 = $Create.Array($$createType8);
|
||||
const $$createType10 = KeyBindingMetadata.createFrom;
|
||||
const $$createType11 = GithubConfig.createFrom;
|
||||
const $$createType12 = GiteaConfig.createFrom;
|
||||
|
||||
Reference in New Issue
Block a user