You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
'use strict';
|
|
const moment = require('moment-timezone');
|
|
require('moment-timezone/data/packed/latest.json'); // 导入所有时区数据
|
|
const mcpHandler = require('../app/mcpServer/mcpServer.js');
|
|
|
|
// 防止框架内未捕获的 Promise 拒绝(如 xiapazi.site 统计上报超时)导致进程崩溃
|
|
process.on('unhandledRejection', (reason) => {
|
|
console.warn('[unhandledRejection]', reason?.message || reason);
|
|
});
|
|
|
|
module.exports = async (app, router, conf) => {
|
|
// 在此处应用中间件等 启动时最后调用此处
|
|
mcpHandler(app, router);
|
|
|
|
if (conf.moment) {
|
|
moment.locale(conf.moment.locale);
|
|
moment.tz.setDefault(conf.moment.timezone);
|
|
}
|
|
|
|
require('./controllers/novaCloud').setupVoiceStream(app);
|
|
|
|
if (conf?.fsAttachment) {
|
|
const fsAttachment = require('@fs/attachment')
|
|
fsAttachment.entry(app, router, conf?.fsAttachment)
|
|
}
|
|
// .eg 跨平台数据请求
|
|
if (conf.env == 'development') {
|
|
try {
|
|
app.fs.xiaReq.get('/ftavg', {
|
|
query: {
|
|
action: 'start'
|
|
}
|
|
}).then((res, err) => {
|
|
console.info(`平均启动时间:${res?.avg} ms`);
|
|
}, err => { })
|
|
} catch (e) {
|
|
console.error(e)
|
|
}
|
|
}
|
|
}
|
|
|