save wait

This commit is contained in:
jusax23 2023-03-08 10:50:28 +01:00
parent 55d0215d02
commit 84d001c066
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41
2 changed files with 12 additions and 4 deletions

View file

@ -17,6 +17,7 @@ import { addGetMethods } from "./api/get.js";
import { activatePost, addPostMethods } from "./api/post.js"; import { activatePost, addPostMethods } from "./api/post.js";
import { activateWS, wsOnConnection } from "./api/ws.js"; import { activateWS, wsOnConnection } from "./api/ws.js";
import { startUpdateCert } from "./server/serverCerts.js"; import { startUpdateCert } from "./server/serverCerts.js";
import { wait } from "./sys/tools.js";
const config = { const config = {
@ -98,8 +99,9 @@ async function startServer() {
async function complete_loaded() { async function complete_loaded() {
startUpdateCert(); startUpdateCert();
await wait(500);
let succ = await generateTag(); 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(); activatePost();
activateWS(); activateWS();
log("Server", 'Listening...'); log("Server", 'Listening...');

View file

@ -1,7 +1,7 @@
import crypto from "crypto"; import crypto from "crypto";
export const uts = ()=>{ export const uts = () => {
return Math.floor(new Date().getTime()/1000); return Math.floor(new Date().getTime() / 1000);
} }
const key64 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"; const key64 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-";
@ -15,3 +15,9 @@ export const get64 = (l: number) => {
} }
return out; return out;
}; };
export const wait = (ms: number) => {
return new Promise((res)=>{
setTimeout(res,ms);
})
}