added luxon for saving upload timestamp

pull/15/head
tycrek 4 years ago
parent db1b88fb5a
commit a997a137d3
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -14,6 +14,7 @@ const fs = require('fs-extra');
const express = require('express');
const useragent = require('express-useragent');
const multer = require('multer');
const DateTime = require('luxon').DateTime;
const OpenGraph = require('./ogp');
const { path, saveData, log, verify, generateToken, generateId } = require('./utils');
//#endregion
@ -83,6 +84,9 @@ function startup() {
let trueDomain = getTrueDomain(req.headers["x-ass-domain"]);
let generator = req.headers["x-ass-access"] || resourceIdType;
// Get the uploaded time in milliseconds
req.file.timestamp = DateTime.now().toMillis();
// Save the file information
let resourceId = generateId(generator, resourceIdSize, req.file.originalname);
data[resourceId.split('.')[0]] = req.file;

14
package-lock.json generated

@ -13,6 +13,7 @@
"express": "^4.17.1",
"express-useragent": "^1.0.15",
"fs-extra": "^9.1.0",
"luxon": "^1.26.0",
"multer": "^1.4.2",
"mustache": "^4.2.0",
"prompt": "^1.1.0",
@ -494,6 +495,14 @@
"universalify": "^2.0.0"
}
},
"node_modules/luxon": {
"version": "1.26.0",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-1.26.0.tgz",
"integrity": "sha512-+V5QIQ5f6CDXQpWNICELwjwuHdqeJM1UenlZWx5ujcRMc9venvluCjFb4t5NYLhb6IhkbMVOxzVuOqkgMxee2A==",
"engines": {
"node": "*"
}
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@ -1389,6 +1398,11 @@
"universalify": "^2.0.0"
}
},
"luxon": {
"version": "1.26.0",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-1.26.0.tgz",
"integrity": "sha512-+V5QIQ5f6CDXQpWNICELwjwuHdqeJM1UenlZWx5ujcRMc9venvluCjFb4t5NYLhb6IhkbMVOxzVuOqkgMxee2A=="
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",

@ -28,6 +28,7 @@
"express": "^4.17.1",
"express-useragent": "^1.0.15",
"fs-extra": "^9.1.0",
"luxon": "^1.26.0",
"multer": "^1.4.2",
"mustache": "^4.2.0",
"prompt": "^1.1.0",

Loading…
Cancel
Save