add Push-based monitoring (#279)

This commit is contained in:
LouisLam
2021-10-01 00:09:43 +08:00
parent 9e95d568c2
commit 1ed4ac9494
13 changed files with 292 additions and 30 deletions

View File

@@ -113,3 +113,13 @@ export function getRandomInt(min: number, max: number) {
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
export function genSecret(length = 64) {
let secret = "";
let chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let charsLength = chars.length;
for ( let i = 0; i < length; i++ ) {
secret += chars.charAt(Math.floor(Math.random() * charsLength));
}
return secret;
}