mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-06 05:38:44 +08:00
35 lines
937 B
TypeScript
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);
|