Add ability to make junk-drawer private-ish
This commit is contained in:
@@ -49,6 +49,7 @@
|
|||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rxjs": "^7.8.1",
|
"rxjs": "^7.8.1",
|
||||||
"slate-irc": "^0.9.3",
|
"slate-irc": "^0.9.3",
|
||||||
|
"uuid": "^10.0.0",
|
||||||
"xml": "^1.0.1"
|
"xml": "^1.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
"@types/ramda": "^0.29.3",
|
"@types/ramda": "^0.29.3",
|
||||||
"@types/slate-irc": "^0.0.29",
|
"@types/slate-irc": "^0.0.29",
|
||||||
"@types/supertest": "^2.0.12",
|
"@types/supertest": "^2.0.12",
|
||||||
|
"@types/uuid": "^10.0.0",
|
||||||
"@types/xml": "^1.0.9",
|
"@types/xml": "^1.0.9",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||||
"@typescript-eslint/parser": "^6.0.0",
|
"@typescript-eslint/parser": "^6.0.0",
|
||||||
|
@@ -74,8 +74,12 @@ export class JunkDrawerController {
|
|||||||
async handleFileUpload(
|
async handleFileUpload(
|
||||||
@UploadedFiles() files: Express.Multer.File[],
|
@UploadedFiles() files: Express.Multer.File[],
|
||||||
@Body('description') description: string,
|
@Body('description') description: string,
|
||||||
|
@Body('private-ish') privateIsh: boolean,
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const uniqueSlug = generateUniqueSlug();
|
console.log(privateIsh);
|
||||||
|
const uniqueSlug = generateUniqueSlug({
|
||||||
|
random: privateIsh,
|
||||||
|
});
|
||||||
const metadata: JunkDrawerMetadata = {
|
const metadata: JunkDrawerMetadata = {
|
||||||
slug: uniqueSlug,
|
slug: uniqueSlug,
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
interface SlugOptions {
|
interface SlugOptions {
|
||||||
year: boolean;
|
year: boolean;
|
||||||
month: boolean;
|
month: boolean;
|
||||||
@@ -36,7 +38,7 @@ export const generateUniqueSlug = (
|
|||||||
hour ? String(date.getHours()).padStart(2, '0') : '',
|
hour ? String(date.getHours()).padStart(2, '0') : '',
|
||||||
minute ? String(date.getMinutes()).padStart(2, '0') : '',
|
minute ? String(date.getMinutes()).padStart(2, '0') : '',
|
||||||
second ? String(date.getSeconds()).padStart(2, '0') : '',
|
second ? String(date.getSeconds()).padStart(2, '0') : '',
|
||||||
random ? Math.random().toString(36).substring(2, 15) : '',
|
random ? '-' + v4() : '',
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
|
|
||||||
return parts.join(separator);
|
return parts.join(separator);
|
||||||
|
@@ -3,6 +3,10 @@
|
|||||||
<label for='files'>Choose files to upload</label>
|
<label for='files'>Choose files to upload</label>
|
||||||
<input type='file' id='files' name='files' multiple />
|
<input type='file' id='files' name='files' multiple />
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for='private-ish'>Private-ish</label>
|
||||||
|
<input type='checkbox' id='private-ish' name='private-ish' />
|
||||||
|
</div>
|
||||||
<div style='display:flex; flex-direction:column;'>
|
<div style='display:flex; flex-direction:column;'>
|
||||||
<label for='description'>Description</label>
|
<label for='description'>Description</label>
|
||||||
<textarea
|
<textarea
|
||||||
|
10
yarn.lock
10
yarn.lock
@@ -1276,6 +1276,11 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/superagent" "*"
|
"@types/superagent" "*"
|
||||||
|
|
||||||
|
"@types/uuid@^10.0.0":
|
||||||
|
version "10.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-10.0.0.tgz#e9c07fe50da0f53dc24970cca94d619ff03f6f6d"
|
||||||
|
integrity sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==
|
||||||
|
|
||||||
"@types/xml@^1.0.9":
|
"@types/xml@^1.0.9":
|
||||||
version "1.0.9"
|
version "1.0.9"
|
||||||
resolved "https://registry.yarnpkg.com/@types/xml/-/xml-1.0.9.tgz#f3688ecbcc8e5a58d0deca789aaa6c351106bbb7"
|
resolved "https://registry.yarnpkg.com/@types/xml/-/xml-1.0.9.tgz#f3688ecbcc8e5a58d0deca789aaa6c351106bbb7"
|
||||||
@@ -5886,6 +5891,11 @@ uuid@9.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
|
||||||
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==
|
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==
|
||||||
|
|
||||||
|
uuid@^10.0.0:
|
||||||
|
version "10.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-10.0.0.tgz#5a95aa454e6e002725c79055fd42aaba30ca6294"
|
||||||
|
integrity sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==
|
||||||
|
|
||||||
uuid@^8.3.0:
|
uuid@^8.3.0:
|
||||||
version "8.3.2"
|
version "8.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||||
|
Reference in New Issue
Block a user