diff --git a/src/main.ts b/src/main.ts index 90de2ac..54c00ea 100755 --- a/src/main.ts +++ b/src/main.ts @@ -79,7 +79,7 @@ class Service { for await (const _ of this.rules.receive_rule_update()) { await this.update_all_users_roles(); } - })(); + }); } async update_all_users_roles() { diff --git a/src/rules.ts b/src/rules.ts index efffdd6..2240762 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -1,6 +1,5 @@ import { z } from "https://deno.land/x/zod@v3.22.4/mod.ts"; -import { channel, log_from } from "./utils.ts"; -const log = log_from(import.meta.url); +import { channel } from "./utils.ts"; export type TargetRole = { guild_id: string; role_id: string }; @@ -26,7 +25,6 @@ export class RuleSet { const file_content = await Deno.readTextFile(path); const parsed = parse_rules(file_content); for (const { group_id, target_role } of parsed) await result.append_rule(group_id, target_role); - result.update_channel = channel(); return result; } @@ -78,11 +76,7 @@ export class RuleSet { } public async *receive_rule_update() { - while (true) { - const update = await this.update_channel.receive(); - log(`Received an update for roles`, update); - yield update; - } + while (true) yield await this.update_channel.receive(); } private async save() { diff --git a/src/verifier.ts b/src/verifier.ts index 2ce92d4..55069cb 100644 --- a/src/verifier.ts +++ b/src/verifier.ts @@ -48,7 +48,7 @@ export class WebVerifier { } public url() { - return `${this.conf.url_prefix}`; + return `http://${this.conf.url_prefix}`; } private serve(request: Request): Response { @@ -76,14 +76,18 @@ export class WebVerifier { return response_success(); } + private async serve_result_page() { + // + } + private create_verif_link() { const uid = uuid.generate() as string; - const link = `${this.conf.url_prefix}/verify/${uid}`; + const link = `http://${this.conf.url_prefix}/verify/${uid}`; return { uid, link }; } private create_confirm_link(uid: string) { - return `${this.conf.url_prefix}/confirm/${uid}`; + return `http://${this.conf.url_prefix}/confirm/${uid}`; } private async start_peremption(uid: string) {