perf: 优化用户体验,首次访问时弹出邮箱账号绑定用以初始化账号

This commit is contained in:
xiaojunnuo
2026-07-05 01:14:48 +08:00
parent 396670dc8f
commit 608cc2a81f
10 changed files with 319 additions and 144 deletions
@@ -1,33 +1,33 @@
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
/**
*/
@Entity('sys_settings')
@Entity("sys_settings")
export class SysSettingsEntity {
@PrimaryGeneratedColumn()
id: number;
@Column({ comment: 'key', length: 100 })
@Column({ comment: "key", length: 100 })
key: string;
@Column({ comment: '名称', length: 100 })
@Column({ comment: "名称", length: 100 })
title: string;
@Column({ name: 'setting', comment: '设置', length: 1024, nullable: true })
@Column({ name: "setting", comment: "设置", length: 1024, nullable: true })
setting: string;
// public 公开读,私有写, private 私有读,私有写
@Column({ name: 'access', comment: '访问权限' })
@Column({ name: "access", comment: "访问权限" })
access: string;
@Column({
name: 'create_time',
comment: '创建时间',
default: () => 'CURRENT_TIMESTAMP',
name: "create_time",
comment: "创建时间",
default: () => "CURRENT_TIMESTAMP",
})
createTime: Date;
@Column({
name: 'update_time',
comment: '修改时间',
default: () => 'CURRENT_TIMESTAMP',
name: "update_time",
comment: "修改时间",
default: () => "CURRENT_TIMESTAMP",
})
updateTime: Date;
}
@@ -1,19 +1,19 @@
import { cloneDeep } from 'lodash-es';
import { cloneDeep } from "lodash-es";
export class BaseSettings {
static __key__: string;
static __title__: string;
static __access__ = 'private';
static __access__ = "private";
static getCacheKey() {
return 'settings.' + this.__key__;
return "settings." + this.__key__;
}
}
export class SysPublicSettings extends BaseSettings {
static __key__ = 'sys.public';
static __title__ = '系统公共设置';
static __access__ = 'public';
static __key__ = "sys.public";
static __title__ = "系统公共设置";
static __access__ = "public";
registerEnabled = false;
userValidTimeEnabled?: boolean = false;
@@ -34,19 +34,15 @@ export class SysPublicSettings extends BaseSettings {
aiChatEnabled = true;
homePageEnabled = true;
//验证码是否开启
captchaEnabled = false;
//验证码类型
captchaType?: string;
captchaAddonId?: number;
//流水线是否启用有效期
pipelineValidTimeEnabled?: boolean = false;
//证书域名添加到监控
certDomainAddToMonitorEnabled?: boolean = false;
@@ -60,12 +56,15 @@ export class SysPublicSettings extends BaseSettings {
// 第三方OAuth配置
oauthEnabled?: boolean = false;
oauthProviders: Record<string, {
type: string;
title: string;
addonId: number;
icon?: string;
}> = {};
oauthProviders: Record<
string,
{
type: string;
title: string;
addonId: number;
icon?: string;
}
> = {};
notice?: string;
@@ -73,40 +72,37 @@ export class SysPublicSettings extends BaseSettings {
}
export class SysPrivateSettings extends BaseSettings {
static __title__ = '系统私有设置';
static __access__ = 'private';
static __key__ = 'sys.private';
static __title__ = "系统私有设置";
static __access__ = "private";
static __key__ = "sys.private";
jwtKey?: string;
encryptSecret?: string;
httpsProxy? = '';
httpProxy? = '';
noProxy? = '';
commonHeaders?: string = '';
httpsProxy? = "";
httpProxy? = "";
noProxy? = "";
commonHeaders?: string = "";
reverseProxies?: Record<string, string> = {};
dnsResultOrder? = '';
dnsResultOrder? = "";
commonCnameEnabled?: boolean = true;
httpRequestTimeout?: number = 30;
pipelineMaxRunningCount?: number;
environmentVars?: string = '';
environmentVars?: string = "";
acmeWalkFromAuthoritative?: boolean = true;
sms?: {
type?: string;
config?: any;
} = {
type: 'aliyun',
config: {},
};
type: "aliyun",
config: {},
};
removeSecret() {
const clone = cloneDeep(this);
@@ -117,9 +113,9 @@ export class SysPrivateSettings extends BaseSettings {
}
export class SysInstallInfo extends BaseSettings {
static __title__ = '系统安装信息';
static __key__ = 'sys.install';
static __access__ = 'private';
static __title__ = "系统安装信息";
static __key__ = "sys.install";
static __access__ = "private";
installTime?: number;
siteId?: string;
bindUserId?: number;
@@ -130,21 +126,20 @@ export class SysInstallInfo extends BaseSettings {
}
export class SysLicenseInfo extends BaseSettings {
static __title__ = '授权许可信息';
static __key__ = 'sys.license';
static __access__ = 'private';
static __title__ = "授权许可信息";
static __key__ = "sys.license";
static __access__ = "private";
license?: string;
}
export type EmailTemplate = {
addonId?: number;
}
};
export class SysEmailConf extends BaseSettings {
static __title__ = '邮箱配置';
static __key__ = 'sys.email';
static __access__ = 'private';
static __title__ = "邮箱配置";
static __key__ = "sys.email";
static __access__ = "private";
host: string;
port: number;
@@ -160,18 +155,18 @@ export class SysEmailConf extends BaseSettings {
sender: string;
usePlus?: boolean;
templates:{
registerCode?: EmailTemplate,
forgotPassword?: EmailTemplate,
pipelineResult?: EmailTemplate,
common?: EmailTemplate,
}
templates: {
registerCode?: EmailTemplate;
forgotPassword?: EmailTemplate;
pipelineResult?: EmailTemplate;
common?: EmailTemplate;
};
}
export class SysSiteInfo extends BaseSettings {
static __title__ = '站点信息';
static __key__ = 'sys.site';
static __access__ = 'public';
static __title__ = "站点信息";
static __key__ = "sys.site";
static __access__ = "public";
title?: string;
slogan?: string;
logo?: string;
@@ -179,9 +174,9 @@ export class SysSiteInfo extends BaseSettings {
}
export class SysSecretBackup extends BaseSettings {
static __title__ = '密钥信息备份';
static __key__ = 'sys.secret.backup';
static __access__ = 'private';
static __title__ = "密钥信息备份";
static __key__ = "sys.secret.backup";
static __access__ = "private";
siteId?: string;
encryptSecret?: string;
}
@@ -190,9 +185,9 @@ export class SysSecretBackup extends BaseSettings {
* 不要修改
*/
export class SysSecret extends BaseSettings {
static __title__ = '密钥信息';
static __key__ = 'sys.secret';
static __access__ = 'private';
static __title__ = "密钥信息";
static __key__ = "sys.secret";
static __access__ = "private";
siteId?: string;
encryptSecret?: string;
}
@@ -215,9 +210,9 @@ export type MenuItem = {
children?: MenuItem[];
};
export class SysHeaderMenus extends BaseSettings {
static __title__ = '顶部菜单';
static __key__ = 'sys.header.menus';
static __access__ = 'public';
static __title__ = "顶部菜单";
static __key__ = "sys.header.menus";
static __access__ = "public";
menus: MenuItem[];
}
@@ -228,9 +223,9 @@ export type PaymentItem = {
};
export class SysPaymentSetting extends BaseSettings {
static __title__ = '支付设置';
static __key__ = 'sys.payment';
static __access__ = 'private';
static __title__ = "支付设置";
static __key__ = "sys.payment";
static __access__ = "private";
yizhifu?: PaymentItem = { enabled: false };
@@ -240,9 +235,9 @@ export class SysPaymentSetting extends BaseSettings {
}
export class SysSuiteSetting extends BaseSettings {
static __title__ = '套餐设置';
static __key__ = 'sys.suite';
static __access__ = 'private';
static __title__ = "套餐设置";
static __key__ = "sys.suite";
static __access__ = "private";
enabled: boolean = false;
@@ -257,26 +252,25 @@ export class SysSuiteSetting extends BaseSettings {
}
export class SysAutoFixSetting extends BaseSettings {
static __title__ = '自动修复记录';
static __key__ = 'sys.auto.fix';
static __access__ = 'private';
static __title__ = "自动修复记录";
static __key__ = "sys.auto.fix";
static __access__ = "private";
fixed: Record<string, boolean> = {};
}
export type SiteHidden = {
enabled: boolean;
openPath?: string;
//md5 hash 两次后保存
openPassword?: string;
autoHiddenTimes?: number;
hiddenOpenApi?: boolean
hiddenOpenApi?: boolean;
};
export class SysSafeSetting extends BaseSettings {
static __title__ = '站点安全设置';
static __key__ = 'sys.safe';
static __access__ = 'private';
static __title__ = "站点安全设置";
static __key__ = "sys.safe";
static __access__ = "private";
// 站点隐藏
hidden: SiteHidden = {