Compare commits

..

2 commits

Author SHA1 Message Date
bfb53d5c64 improve logging api 2024-02-05 01:33:10 +01:00
ebc9230743 fix typo 2024-02-02 23:58:25 +01:00
6 changed files with 9 additions and 9 deletions

View file

@ -10,7 +10,7 @@ import {
SlashCommandStringOption, SlashCommandStringOption,
} from "npm:discord.js@14.14.1"; } from "npm:discord.js@14.14.1";
import { channel, log_from, SimpleResult, split_promise } from "./utils.ts"; import { channel, log_from, SimpleResult, split_promise } from "./utils.ts";
const log = (...args: unknown[]) => log_from(import.meta.url, ...args); const log = log_from(import.meta.url);
/** /**
* Wraps a discord bot and implements required actions. * Wraps a discord bot and implements required actions.

View file

@ -1,6 +1,6 @@
import { z } from "https://deno.land/x/zod@v3.22.4/mod.ts"; import { z } from "https://deno.land/x/zod@v3.22.4/mod.ts";
import { log_from } from "./utils.ts"; import { log_from } from "./utils.ts";
const log = (...args: unknown[]) => log_from(import.meta.url, ...args); const log = log_from(import.meta.url);
/** /**
* Wraps the CRI API. * Wraps the CRI API.

View file

@ -1,6 +1,6 @@
import { ClientOptions, SMTPClient } from "https://deno.land/x/denomailer@1.6.0/mod.ts"; import { ClientOptions, SMTPClient } from "https://deno.land/x/denomailer@1.6.0/mod.ts";
import { log_from } from "./utils.ts"; import { log_from } from "./utils.ts";
const log = (...args: unknown[]) => log_from(import.meta.url, ...args); const log = log_from(import.meta.url);
export type EmailerConfig = { export type EmailerConfig = {
hostname: string; hostname: string;
@ -46,7 +46,7 @@ export class Emailer {
} }
} }
const CONFIRMATION_EMAIL_SUBJECT = "Confirmation d'association à un compte discord"; const CONFIRMATION_EMAIL_SUBJECT = "[epiTLS] Confirmation d'association à un compte discord.";
function confirmation_email_body(discord_username: string, link: string) { function confirmation_email_body(discord_username: string, link: string) {
return `<!DOCTYPE html> return `<!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -65,7 +65,7 @@ Si vous n'êtes pas à l'origine de cette demande, veuillez ignorer ce message.
--- ---
Je suis un robot et cette action à é effectuée automatiquement. Je suis un robot et cette action à é effectuée automatiquement.
Vous pouvez contacter le développeur de se service à l'email matthieu at imagevo dot fr. Vous pouvez contacter le développeur de ce service à l'email matthieu at imagevo dot fr.
</pre> </pre>
</body> </body>
</html> </html>

View file

@ -7,7 +7,7 @@ import { EpitlsBot } from "./bot.ts";
import { CriApi } from "./cri.ts"; import { CriApi } from "./cri.ts";
import { Emailer } from "./email.ts"; import { Emailer } from "./email.ts";
import { WebVerifier } from "./verifier.ts"; import { WebVerifier } from "./verifier.ts";
const log = (...args: unknown[]) => log_from(import.meta.url, ...args); const log = log_from(import.meta.url);
async function main() { async function main() {
const conf = await read_conf(root_path() + "/conf.json"); const conf = await read_conf(root_path() + "/conf.json");

View file

@ -51,10 +51,10 @@ export type Resolver<T> = (item: T) => void;
/** /**
* Logging function factory. * Logging function factory.
*/ */
export function log_from(url: string, ...args: unknown[]) { export function log_from(url: string) {
const date = new Date().toLocaleString("fr-FR"); const date = new Date().toLocaleString("fr-FR");
const file = path.basename(new URL(url).pathname); const file = path.basename(new URL(url).pathname);
console.log(`[${date}][epitls][${file}]`, ...args); return (...args: unknown[]) => console.log(`[${date}][epitls][${file}]`, ...args);
} }
export type Conf = Awaited<ReturnType<typeof read_conf>>; export type Conf = Awaited<ReturnType<typeof read_conf>>;

View file

@ -1,6 +1,6 @@
import { v1 as uuid } from "https://deno.land/std@0.213.0/uuid/mod.ts"; import { v1 as uuid } from "https://deno.land/std@0.213.0/uuid/mod.ts";
import { channel, log_from, Resolver, SimpleResult, split_promise, wait } from "./utils.ts"; import { channel, log_from, Resolver, SimpleResult, split_promise, wait } from "./utils.ts";
const log = (...args: unknown[]) => log_from(import.meta.url, ...args); const log = log_from(import.meta.url);
export type WebVerifierConf = { export type WebVerifierConf = {
port: number; port: number;