MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / exportRules

Function exportRules

shift/shift.ts:1193–1204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1191}
1192
1193async function importRules(jsonData: string, merge = false): Promise<void> {
1194 // 兼容历史错误导出:若解析结果为字符串,则再次解析
1195 let parsed: any = JSON.parse(jsonData);
1196 if (typeof parsed === "string") {
1197 try {
1198 parsed = JSON.parse(parsed);
1199 } catch {}
1200 }
1201 const newRules = parsed as { [key: string]: ShiftRule };
1202
1203 if (useLowdb && lowdb) {
1204 if (merge) {
1205 Object.assign(lowdb.data.rules, newRules);
1206 } else {
1207 lowdb.data.rules = newRules;

Callers 1

ShiftPluginClass · 0.85

Calls 1

getAllShiftRulesFunction · 0.85

Tested by

no test coverage detected