mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: #736
This commit is contained in:
@@ -98,7 +98,7 @@ export type NetworkConfigKey = keyof OneBotConfig['network'];
|
|||||||
|
|
||||||
|
|
||||||
export function loadConfig(config: Partial<OneBotConfig>): OneBotConfig {
|
export function loadConfig(config: Partial<OneBotConfig>): OneBotConfig {
|
||||||
const ajv = new Ajv({ useDefaults: true });
|
const ajv = new Ajv({ useDefaults: true, coerceTypes: true });
|
||||||
const validate = ajv.compile(OneBotConfigSchema);
|
const validate = ajv.compile(OneBotConfigSchema);
|
||||||
const valid = validate(config);
|
const valid = validate(config);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
|
@@ -53,6 +53,7 @@ export const OB11SetConfigHandler: RequestHandler = async (req, res) => {
|
|||||||
await WebUiDataRuntime.setOB11Config(JSON.parse(req.body.config));
|
await WebUiDataRuntime.setOB11Config(JSON.parse(req.body.config));
|
||||||
return sendSuccess(res, null);
|
return sendSuccess(res, null);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return sendError(res, 'Config Set Error');
|
console.log(e);
|
||||||
|
return sendError(res, 'Error: ' + e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user