From 84d001c066ed2acb0a7101ea4b54ced12db3ad06 Mon Sep 17 00:00:00 2001 From: jusax23 Date: Wed, 8 Mar 2023 10:50:28 +0100 Subject: [PATCH] save wait --- src/main.ts | 4 +++- src/sys/tools.ts | 12 +++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index 7a57dbb..a61cd15 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,6 +17,7 @@ import { addGetMethods } from "./api/get.js"; import { activatePost, addPostMethods } from "./api/post.js"; import { activateWS, wsOnConnection } from "./api/ws.js"; import { startUpdateCert } from "./server/serverCerts.js"; +import { wait } from "./sys/tools.js"; const config = { @@ -98,8 +99,9 @@ async function startServer() { async function complete_loaded() { startUpdateCert(); + await wait(500); let succ = await generateTag(); - if(!succ) error("Outbag", "Could not resolve own Server Tag. Remote-Auth will not work! Check if the Server is reachable and the config ist correct!"); + if(!succ) error("Outbag", "Could not check own Server Tag. Remote-Auth will not work! Check if the Server is reachable and the config ist correct!"); activatePost(); activateWS(); log("Server", 'Listening...'); diff --git a/src/sys/tools.ts b/src/sys/tools.ts index c4f3f93..ad67bcd 100644 --- a/src/sys/tools.ts +++ b/src/sys/tools.ts @@ -1,7 +1,7 @@ import crypto from "crypto"; -export const uts = ()=>{ - return Math.floor(new Date().getTime()/1000); +export const uts = () => { + return Math.floor(new Date().getTime() / 1000); } const key64 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"; @@ -14,4 +14,10 @@ export const get64 = (l: number) => { out += key64[val[i] % key64.length]; } return out; -}; \ No newline at end of file +}; + +export const wait = (ms: number) => { + return new Promise((res)=>{ + setTimeout(res,ms); + }) +} \ No newline at end of file