diff --git a/ass.js b/ass.js index d1b30f5..11e6752 100755 --- a/ass.js +++ b/ass.js @@ -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; diff --git a/package-lock.json b/package-lock.json index 723d980..7639471 100755 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 1dd0799..10f44c3 100755 --- a/package.json +++ b/package.json @@ -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",