DS fixes once again

pull/20/head
tycrek 4 years ago
parent cd1954f9ad
commit 832566cc00
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -14,7 +14,6 @@ const fs = require('fs-extra');
const express = require('express'); const express = require('express');
const helmet = require("helmet"); const helmet = require("helmet");
const escape = require('escape-html'); const escape = require('escape-html');
const useragent = require('express-useragent');
const rateLimit = require("express-rate-limit"); const rateLimit = require("express-rate-limit");
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const marked = require('marked'); const marked = require('marked');
@ -82,9 +81,6 @@ function startup() {
app.set('trust proxy', isProxied); app.set('trust proxy', isProxied);
app.set('view engine', 'pug'); app.set('view engine', 'pug');
// Express middleware
app.use(useragent.express());
// Helmet security middleware // Helmet security middleware
app.use(helmet.noSniff()); app.use(helmet.noSniff());
app.use(helmet.ieNoOpen()); app.use(helmet.ieNoOpen());
@ -243,11 +239,11 @@ function startup() {
// Build OpenGraph meta tags // Build OpenGraph meta tags
const og = fileData.opengraph, ogs = ['']; const og = fileData.opengraph, ogs = [''];
og.title && (ogs.push(`<meta property="og:title" content="${og.title}">`)); og.title && (ogs.push(`<meta property="og:title" content="${og.title}">`)); // skipcq: JS-0093
og.description && (ogs.push(`<meta property="og:description" content="${og.description}">`)); og.description && (ogs.push(`<meta property="og:description" content="${og.description}">`)); // skipcq: JS-0093
og.author && (ogs.push(`<meta property="og:site_name" content="${og.author}">`)); og.author && (ogs.push(`<meta property="og:site_name" content="${og.author}">`)); // skipcq: JS-0093
og.color && (ogs.push(`<meta name="theme-color" content="${getResourceColor(og.color, fileData.vibrant)}">`)); og.color && (ogs.push(`<meta name="theme-color" content="${getResourceColor(og.color, fileData.vibrant)}">`)); // skipcq: JS-0093
!isVideo && (ogs.push(`<meta name="twitter:card" content="summary_large_image">`)); !isVideo && (ogs.push(`<meta name="twitter:card" content="summary_large_image">`)); // skipcq: JS-0093
// Send the view to the client // Send the view to the client
res.render('view', { res.render('view', {

@ -57,9 +57,9 @@ function formatBytes(bytes, decimals = 2) { // skipcq: JS-0074
function replaceholder(data, { size, timestamp, originalname }) { function replaceholder(data, { size, timestamp, originalname }) {
return data return data
.replace(new RegExp('&size', 'g'), formatBytes(size)) .replace(/&size/g, formatBytes(size))
.replace(new RegExp('&filename', 'g'), originalname) .replace(/&filename/g, originalname)
.replace(new RegExp('&timestamp', 'g'), formatTimestamp(timestamp)); .replace(/&timestamp/g, formatTimestamp(timestamp));
} }
const idModes = { const idModes = {

Loading…
Cancel
Save