PUT /api/filemeta support JSON array

This commit is contained in:
2023-08-27 21:22:52 +08:00
parent 8ecb00c562
commit dc476190e2

View File

@@ -103,6 +103,19 @@ export const handler: Handlers = {
}
return return_data({});
} else return return_error(3, "Invalid parameters.");
} else if (Array.isArray(b)) {
const m = get_task_manager();
for (const d of b) {
if (typeof d.token === "string") {
if (
typeof d.is_nsfw === "boolean" &&
typeof d.is_ad === "boolean"
) {
m.db.add_filemeta(d);
}
}
}
return return_data({});
}
return return_error(5, "Unknown JSON format.");
} else if (