Compare commits
2 commits
6bf78c98f6
...
31301a068b
Author | SHA1 | Date | |
---|---|---|---|
31301a068b | |||
085bfc78c9 |
1 changed files with 9 additions and 3 deletions
12
index.js
12
index.js
|
@ -3,7 +3,7 @@ import express from "express";
|
|||
import { unlink } from "fs/promises";
|
||||
import { randomUUID } from "crypto";
|
||||
const app = express();
|
||||
const valid_regex = new RegExp("^[A-Za-z0-9_\-.]{3,64}$");
|
||||
const valid_regex = /^[A-Za-z0-9_\-\.]{3,64}$/;
|
||||
function notImplementedHandler(req, res, next) {
|
||||
res.sendStatus(418);
|
||||
}
|
||||
|
@ -24,8 +24,14 @@ async function get_namespace_id(name) {
|
|||
});
|
||||
}
|
||||
async function add_counter(opts) {
|
||||
const { key, value, enable_reset, update_lowerbound, update_upperbound, namespace } =
|
||||
opts;
|
||||
const {
|
||||
key,
|
||||
value,
|
||||
enable_reset,
|
||||
update_lowerbound,
|
||||
update_upperbound,
|
||||
namespace,
|
||||
} = opts;
|
||||
if (!valid_regex.test(key) || !valid_regex.test(namespace)) return false;
|
||||
const nsid = await get_namespace_id(namespace);
|
||||
console.log(nsid);
|
||||
|
|
Loading…
Reference in a new issue