From cc44e24e60c0a4b3cfb9f7fd2db8c63f9a8280e4 Mon Sep 17 00:00:00 2001 From: Dooho Yi Date: Fri, 25 Nov 2022 01:03:34 +0900 Subject: [PATCH] anchor update --- package-lock.json | 14 ++++++++++++++ package.json | 4 ++++ server.js | 21 ++++++++++++++++++++- src/pages/parade.html | 4 ++-- 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 78877d7..e757416 100644 --- a/package-lock.json +++ b/package-lock.json @@ -108,6 +108,11 @@ "color-convert": "^2.0.1" } }, + "any-base": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", + "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" + }, "anymatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", @@ -1677,6 +1682,15 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "short-uuid": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/short-uuid/-/short-uuid-4.2.2.tgz", + "integrity": "sha512-IE7hDSGV2U/VZoCsjctKX6l5t5ak2jE0+aeGJi3KtvjIUNuZVmHVYUjNBhmo369FIWGDtaieRaO8A83Lvwfpqw==", + "requires": { + "any-base": "^1.1.0", + "uuid": "^8.3.2" + } + }, "signal-exit": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", diff --git a/package.json b/package.json index f76afb8..ad20ca5 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "moment-timezone": "^0.5.34", "nextcloud-node-client": "^1.8.2", "point-of-view": "^5.0.0", + "short-uuid": "^4.2.2", "socket.io": "~2.3.0", "uuid": "^8.3.2" }, @@ -36,5 +37,8 @@ ], "devDependencies": { "nodemon": "^2.0.15" + }, + "volta": { + "node": "14.19.3" } } diff --git a/server.js b/server.js index 854447c..f36ced5 100644 --- a/server.js +++ b/server.js @@ -27,6 +27,9 @@ const { v4: uuidv4, } = require('uuid'); +//short-uuid +const short = require('short-uuid'); + //moment const moment = require("moment-timezone"); @@ -73,6 +76,7 @@ fastify.get("/", async function (request, reply) { group: fields.group, title: fields.title, comment: fields.comment, + anchor: fields.anchor }); } } @@ -111,6 +115,7 @@ fastify.get("/list", async function (request, reply) { group: fields.group, title: fields.title, comment: fields.comment, + anchor: fields.anchor }); } } @@ -121,6 +126,17 @@ fastify.get("/list", async function (request, reply) { reply.send(folders); }); +//get '/short' +fastify.get("/short", function (request, reply) { + + let shorts = []; + for (var idx = 0; idx < 100; idx++) { + shorts.push(short.generate()); + } + + reply.send(shorts); +}); + //get '/uploads/:foldername/:filename' fastify.get("/uploads/:foldername/:filename", async function (request, reply) { @@ -171,6 +187,7 @@ fastify.get("/fields", async function (request, reply) { group: fields.group, title: fields.title, comment: fields.comment, + anchor: fields.anchor }); } } @@ -241,7 +258,8 @@ fastify.post("/", async function (request, reply) { group: audiofile.fields.group.value, title: audiofile.fields.title.value, comment: audiofile.fields.comment.value, - pass: audiofile.fields.pass.value + pass: audiofile.fields.pass.value, + anchor: short.generate() }))); const image = await folder.createFile("pixels.png", await fs.readFile(pixelfile.filepath)); // @@ -356,6 +374,7 @@ io.on("connection", function(socket) { group: fields.group, title: fields.title, comment: fields.comment, + anchor: fields.anchor }); } diff --git a/src/pages/parade.html b/src/pages/parade.html index 790d7ff..0d31d68 100644 --- a/src/pages/parade.html +++ b/src/pages/parade.html @@ -209,7 +209,7 @@ {{#each list}}
- + @@ -247,7 +247,7 @@ t = t + `
- +