mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
641 B
TypeScript
38 lines
641 B
TypeScript
import {
|
|
TcService,
|
|
TcDbService,
|
|
TcPureContext,
|
|
config,
|
|
} from 'tailchat-server-sdk';
|
|
|
|
/**
|
|
* 配置服务器
|
|
*/
|
|
class ConfigService extends TcService {
|
|
get serviceName(): string {
|
|
return 'config';
|
|
}
|
|
|
|
onInit(): void {
|
|
/**
|
|
* 全局配置
|
|
*
|
|
* 用于提供给前端使用
|
|
*/
|
|
this.registerAction('global', this.globalConfig);
|
|
|
|
this.registerAuthWhitelist(['/config/global']);
|
|
}
|
|
|
|
/**
|
|
* 更新用户在会话中已读的最后一条消息
|
|
*/
|
|
async globalConfig(ctx: TcPureContext) {
|
|
return {
|
|
uploadFileLimit: config.storage.limit,
|
|
};
|
|
}
|
|
}
|
|
|
|
export default ConfigService;
|