v0.3.18: 消息模版API + global-config端点
This commit is contained in:
@@ -9,7 +9,7 @@ import { dailyCheckIn, skipCheckin, getCheckinSummary, getDrivesForCheckin } fro
|
||||
import { getAllCloudTypes } from '../cloud/cloud-types.service';
|
||||
import { login, authMiddleware, verifyToken, changePassword } from '../admin/auth.service';
|
||||
import { getAllPushUsers, upsertPushUser, updatePushUser, deletePushUser } from '../cloud/push-user.service';
|
||||
import { getAllNotifierParams, testChannel, saveConfigNotifySettings, getConfigNotifySettingsJSON } from '../cloud/notification.service';
|
||||
import { getAllNotifierParams, testChannel, saveConfigNotifySettings, getConfigNotifySettingsJSON, getGlobalNotifyConfig } from '../cloud/notification.service';
|
||||
import { getStats } from '../admin/stats.service';
|
||||
import { getAllSystemConfigs, updateSystemConfig, updateSystemConfigs, getSystemConfig } from '../admin/system-config.service';
|
||||
import { getDb } from '../database/database';
|
||||
@@ -718,6 +718,31 @@ router.get('/admin/notify/providers', (_req: Request, res: Response) => {
|
||||
}
|
||||
});
|
||||
|
||||
/** GET /api/admin/notify/global-config */
|
||||
router.get('/admin/notify/global-config', (_req, res) => {
|
||||
try {
|
||||
const cfg = getGlobalNotifyConfig();
|
||||
res.json(cfg);
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ error: err.message || 'Failed to get global config' });
|
||||
}
|
||||
});
|
||||
|
||||
/** PUT /api/admin/notify/global-config */
|
||||
router.put('/admin/notify/global-config', (req, res) => {
|
||||
try {
|
||||
const cfg = req.body;
|
||||
if (!cfg || typeof cfg !== 'object') {
|
||||
res.status(400).json({ error: 'Invalid config object' });
|
||||
return;
|
||||
}
|
||||
updateSystemConfig('global_notify_config', JSON.stringify(cfg));
|
||||
res.json({ success: true });
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ error: err.message || 'Failed to save global config' });
|
||||
}
|
||||
});
|
||||
|
||||
/** GET /api/admin/push-users */
|
||||
router.get('/admin/push-users', (_req: Request, res: Response) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user