Skip to content

Commit 26d40ea

Browse files
committed
Added GET path at /id
1 parent 3d34f6b commit 26d40ea

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

api/helper.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ function sign(str){
2121
return Crypto.createHmac('md5', secret).update(str).digest('base64url').substr(0,sigLen);
2222
}
2323

24+
export function id(){
25+
return sign('id');
26+
}
27+
2428
export function validate(key){
2529
const sig = key.substr(0, sigLen);
2630
const hash = key.substr(sigLen,);

api/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ fastify.get('/', (request, reply) => {
3838
reply.redirect('https://securelay.github.io', 301);
3939
})
4040

41-
fastify.post('/', (request, reply) => {
42-
reply.redirect('https://securelay.github.io', 301);
41+
fastify.get('/id', (request, reply) => {
42+
reply.send(helper.id());
4343
})
4444

4545
fastify.get('/keys', (request, reply) => {

vercel.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
{
1717
"source": "/(public|private|keys)/:path*",
1818
"destination": "/api"
19+
},
20+
{
21+
"source": "/id",
22+
"destination": "/api"
1923
}
2024
]
2125
}

0 commit comments

Comments
 (0)