Compare commits

..

No commits in common. "fb141abd0506944dbb5c1f6ffb3135e1dabcd6aa" and "83b7b0934a1932676c480383aa2505177f788bde" have entirely different histories.

3 changed files with 10 additions and 12 deletions

View file

@ -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() {

View file

@ -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() {

View file

@ -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) {