Files
eh-downloader/scripts/gen_meili_server_key.ts
lifegpc 0a6dc6ad2b Add meiliserach server support
Fix GalleryMetadata contains escaped html data
2023-06-14 11:07:25 +08:00

35 lines
937 B
TypeScript

import { MeiliSearch } from "meilisearch";
async function gen_key(host: string, master_key: string) {
const client = new MeiliSearch({ host, apiKey: master_key });
const key = await client.createKey({
name: "eh_downloader_update_key",
description: "EH Downloader Update Key",
actions: ["*"],
indexes: ["gmeta"],
expiresAt: null,
});
console.log("Update Key: ", key.key);
const skey = await client.createKey({
name: "eh_downloader_search_key",
description: "EH Downloader Search Key",
actions: ["search"],
indexes: ["gmeta"],
expiresAt: null,
});
console.log("Search Key: ", skey.key);
}
function show_help() {
console.log("gen_meili_server_key <HOST> <MASTER_KEY>");
}
if (Deno.args.length < 2) {
show_help();
Deno.exit(0);
}
const host = Deno.args[0];
const master_key = Deno.args[1];
gen_key(host, master_key);