2024-10-15 12:59:40 +08:00
|
|
|
import { cloneDeep } from 'lodash-es';
|
|
|
|
|
|
2024-07-15 00:30:33 +08:00
|
|
|
export class BaseSettings {
|
|
|
|
|
static __key__: string;
|
|
|
|
|
static __title__: string;
|
|
|
|
|
static __access__ = 'private';
|
|
|
|
|
|
|
|
|
|
static getCacheKey() {
|
|
|
|
|
return 'settings.' + this.__key__;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-03 22:03:49 +08:00
|
|
|
|
2024-07-15 00:30:33 +08:00
|
|
|
export class SysPublicSettings extends BaseSettings {
|
|
|
|
|
static __key__ = 'sys.public';
|
|
|
|
|
static __title__ = '系统公共设置';
|
|
|
|
|
static __access__ = 'public';
|
2024-11-28 17:36:45 +08:00
|
|
|
|
2024-07-15 00:30:33 +08:00
|
|
|
registerEnabled = false;
|
2024-11-28 17:36:45 +08:00
|
|
|
passwordLoginEnabled = true;
|
2024-12-01 03:02:59 +08:00
|
|
|
usernameRegisterEnabled = true;
|
2024-11-28 17:36:45 +08:00
|
|
|
mobileRegisterEnabled = false;
|
|
|
|
|
smsLoginEnabled = false;
|
|
|
|
|
emailRegisterEnabled = false;
|
|
|
|
|
|
2024-10-26 23:54:49 +08:00
|
|
|
limitUserPipelineCount = 0;
|
2024-08-05 12:49:44 +08:00
|
|
|
managerOtherUserPipeline = false;
|
2024-10-03 23:11:50 +08:00
|
|
|
icpNo?: string;
|
2024-07-15 00:30:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class SysPrivateSettings extends BaseSettings {
|
|
|
|
|
static __title__ = '系统私有设置';
|
|
|
|
|
static __access__ = 'private';
|
|
|
|
|
static __key__ = 'sys.private';
|
2024-08-27 13:46:19 +08:00
|
|
|
jwtKey?: string;
|
|
|
|
|
encryptSecret?: string;
|
2024-10-12 16:49:49 +08:00
|
|
|
|
|
|
|
|
httpsProxy? = '';
|
|
|
|
|
httpProxy? = '';
|
2024-11-13 23:37:35 +08:00
|
|
|
dnsResultOrder? = '';
|
2024-11-14 18:31:17 +08:00
|
|
|
commonCnameEnabled?: boolean = true;
|
2024-10-12 16:49:49 +08:00
|
|
|
|
2024-11-28 17:36:45 +08:00
|
|
|
sms?: {
|
|
|
|
|
type?: string;
|
|
|
|
|
config?: any;
|
|
|
|
|
} = {
|
|
|
|
|
type: 'aliyun',
|
|
|
|
|
config: {},
|
|
|
|
|
};
|
|
|
|
|
|
2024-10-12 16:49:49 +08:00
|
|
|
removeSecret() {
|
2024-10-15 12:59:40 +08:00
|
|
|
const clone = cloneDeep(this);
|
|
|
|
|
delete clone.jwtKey;
|
|
|
|
|
delete clone.encryptSecret;
|
|
|
|
|
return clone;
|
2024-10-12 16:49:49 +08:00
|
|
|
}
|
2024-07-15 00:30:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class SysInstallInfo extends BaseSettings {
|
|
|
|
|
static __title__ = '系统安装信息';
|
|
|
|
|
static __key__ = 'sys.install';
|
|
|
|
|
static __access__ = 'private';
|
2024-10-12 16:49:49 +08:00
|
|
|
installTime?: number;
|
2024-07-15 00:30:33 +08:00
|
|
|
siteId?: string;
|
2024-09-23 13:33:46 +08:00
|
|
|
bindUserId?: number;
|
|
|
|
|
bindUrl?: string;
|
2024-09-24 02:42:08 +08:00
|
|
|
accountServerBaseUrl?: string;
|
|
|
|
|
appKey?: string;
|
2024-07-15 00:30:33 +08:00
|
|
|
}
|
2024-08-02 22:58:29 +08:00
|
|
|
|
|
|
|
|
export class SysLicenseInfo extends BaseSettings {
|
|
|
|
|
static __title__ = '授权许可信息';
|
|
|
|
|
static __key__ = 'sys.license';
|
|
|
|
|
static __access__ = 'private';
|
2024-08-03 23:32:50 +08:00
|
|
|
license?: string;
|
2024-08-02 22:58:29 +08:00
|
|
|
}
|
2024-09-23 11:27:53 +08:00
|
|
|
|
2024-10-11 02:54:42 +08:00
|
|
|
export class SysEmailConf extends BaseSettings {
|
|
|
|
|
static __title__ = '邮箱配置';
|
|
|
|
|
static __key__ = 'sys.email';
|
|
|
|
|
static __access__ = 'private';
|
|
|
|
|
|
|
|
|
|
host: string;
|
|
|
|
|
port: number;
|
|
|
|
|
auth: {
|
|
|
|
|
user: string;
|
|
|
|
|
pass: string;
|
|
|
|
|
};
|
|
|
|
|
secure: boolean; // use TLS
|
|
|
|
|
tls: {
|
|
|
|
|
// do not fail on invalid certs
|
|
|
|
|
rejectUnauthorized: boolean;
|
|
|
|
|
};
|
|
|
|
|
sender: string;
|
|
|
|
|
usePlus?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-23 11:27:53 +08:00
|
|
|
export class SysSiteInfo extends BaseSettings {
|
|
|
|
|
static __title__ = '站点信息';
|
|
|
|
|
static __key__ = 'sys.site';
|
|
|
|
|
static __access__ = 'public';
|
2024-10-03 23:11:50 +08:00
|
|
|
title?: string;
|
|
|
|
|
slogan?: string;
|
|
|
|
|
logo?: string;
|
2024-10-05 01:46:25 +08:00
|
|
|
loginLogo?: string;
|
2024-09-23 11:27:53 +08:00
|
|
|
}
|
2024-10-10 18:38:22 +08:00
|
|
|
|
2024-10-15 12:59:40 +08:00
|
|
|
export class SysSecretBackup extends BaseSettings {
|
|
|
|
|
static __title__ = '密钥信息备份';
|
2024-10-15 13:01:00 +08:00
|
|
|
static __key__ = 'sys.secret.backup';
|
2024-10-15 12:59:40 +08:00
|
|
|
static __access__ = 'private';
|
|
|
|
|
siteId?: string;
|
|
|
|
|
encryptSecret?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-10 18:38:22 +08:00
|
|
|
export class SysSiteEnv {
|
|
|
|
|
agent?: {
|
|
|
|
|
enabled?: boolean;
|
|
|
|
|
contactText?: string;
|
|
|
|
|
contactLink?: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
2024-10-25 23:56:24 +08:00
|
|
|
|
|
|
|
|
export type MenuItem = {
|
|
|
|
|
id: string;
|
|
|
|
|
title: string;
|
|
|
|
|
icon: string;
|
|
|
|
|
link: string;
|
|
|
|
|
auth: boolean;
|
|
|
|
|
permission?: string;
|
|
|
|
|
children?: MenuItem[];
|
|
|
|
|
};
|
|
|
|
|
export class SysHeaderMenus extends BaseSettings {
|
|
|
|
|
static __title__ = '顶部菜单';
|
|
|
|
|
static __key__ = 'sys.header.menus';
|
|
|
|
|
static __access__ = 'public';
|
|
|
|
|
|
|
|
|
|
menus: MenuItem[];
|
|
|
|
|
}
|