Merge branch 'AaronDewes-chore/cleanup-dependencies' into master
See https://github.com/timvisee/send/pull/101
This commit is contained in:
commit
643287e235
@ -5,21 +5,24 @@ env:
|
|||||||
extends:
|
extends:
|
||||||
- eslint:recommended
|
- eslint:recommended
|
||||||
- prettier
|
- prettier
|
||||||
- plugin:node/recommended
|
- plugin:n/recommended
|
||||||
- plugin:security/recommended
|
- plugin:security/recommended
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- node
|
- n
|
||||||
- security
|
- security
|
||||||
|
|
||||||
root: true
|
root: true
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
node/no-deprecated-api: off
|
n/no-deprecated-api: off
|
||||||
node/no-unsupported-features/es-syntax: off
|
n/no-unsupported-features/es-syntax: off
|
||||||
node/no-unsupported-features/node-builtins: off
|
n/no-unsupported-features/node-builtins: off
|
||||||
node/no-unpublished-require: off
|
n/no-unpublished-require: off
|
||||||
node/no-unpublished-import: off
|
n/no-unpublished-import: off
|
||||||
|
n/no-process-exit: off
|
||||||
|
# This forces using file extensions in imports, which is a best practice, but refactoring would take some time
|
||||||
|
n/no-missing-import: off
|
||||||
|
|
||||||
security/detect-non-literal-fs-filename: off
|
security/detect-non-literal-fs-filename: off
|
||||||
security/detect-object-injection: off
|
security/detect-object-injection: off
|
||||||
|
@ -63,7 +63,6 @@ COPY --chown=app:app server server
|
|||||||
COPY --chown=app:app --from=builder /app/dist dist
|
COPY --chown=app:app --from=builder /app/dist dist
|
||||||
|
|
||||||
RUN npm ci --production && npm cache clean --force
|
RUN npm ci --production && npm cache clean --force
|
||||||
RUN mkdir -p /app/.config/configstore
|
|
||||||
RUN ln -s dist/version.json version.json
|
RUN ln -s dist/version.json version.json
|
||||||
|
|
||||||
ENV PORT=1443
|
ENV PORT=1443
|
||||||
|
@ -6,4 +6,4 @@ parserOptions:
|
|||||||
sourceType: module
|
sourceType: module
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
node/no-unsupported-features: off
|
n/no-unsupported-features: off
|
||||||
|
@ -45,15 +45,9 @@ async function checkCrypto() {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
try {
|
|
||||||
window.asmCrypto = await import('asmcrypto.js');
|
|
||||||
await import('@dannycoates/webcrypto-liner/build/shim');
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function checkStreams() {
|
function checkStreams() {
|
||||||
try {
|
try {
|
||||||
@ -66,25 +60,12 @@ function checkStreams() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function polyfillStreams() {
|
|
||||||
try {
|
|
||||||
await import('@mattiasbuelens/web-streams-polyfill');
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function getCapabilities() {
|
export default async function getCapabilities() {
|
||||||
const browser = browserName();
|
const browser = browserName();
|
||||||
const isMobile = /mobi|android/i.test(navigator.userAgent);
|
const isMobile = /mobi|android/i.test(navigator.userAgent);
|
||||||
const serviceWorker = 'serviceWorker' in navigator && browser !== 'edge';
|
const serviceWorker = 'serviceWorker' in navigator && browser !== 'edge';
|
||||||
let crypto = await checkCrypto();
|
let crypto = await checkCrypto();
|
||||||
const nativeStreams = checkStreams();
|
const nativeStreams = checkStreams();
|
||||||
let polyStreams = false;
|
|
||||||
if (!nativeStreams) {
|
|
||||||
polyStreams = await polyfillStreams();
|
|
||||||
}
|
|
||||||
let account = typeof AUTH_CONFIG !== 'undefined';
|
let account = typeof AUTH_CONFIG !== 'undefined';
|
||||||
try {
|
try {
|
||||||
account = account && !!localStorage;
|
account = account && !!localStorage;
|
||||||
@ -106,10 +87,10 @@ export default async function getCapabilities() {
|
|||||||
account,
|
account,
|
||||||
crypto,
|
crypto,
|
||||||
serviceWorker,
|
serviceWorker,
|
||||||
streamUpload: nativeStreams || polyStreams,
|
streamUpload: nativeStreams,
|
||||||
streamDownload:
|
streamDownload:
|
||||||
nativeStreams && serviceWorker && browser !== 'safari' && !mobileFirefox,
|
nativeStreams && serviceWorker && browser !== 'safari' && !mobileFirefox,
|
||||||
multifile: nativeStreams || polyStreams,
|
multifile: nativeStreams,
|
||||||
share,
|
share,
|
||||||
standalone
|
standalone
|
||||||
};
|
};
|
||||||
|
@ -48,7 +48,7 @@ class ECETransformer {
|
|||||||
name: 'AES-GCM',
|
name: 'AES-GCM',
|
||||||
length: 128
|
length: 128
|
||||||
},
|
},
|
||||||
true, // Edge polyfill requires key to be extractable to encrypt :/
|
false,
|
||||||
['encrypt', 'decrypt']
|
['encrypt', 'decrypt']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/* global DEFAULTS LIMITS WEB_UI PREFS */
|
/* global DEFAULTS LIMITS WEB_UI PREFS */
|
||||||
import 'core-js';
|
import 'core-js';
|
||||||
import 'fast-text-encoding'; // MS Edge support
|
|
||||||
import 'intl-pluralrules';
|
import 'intl-pluralrules';
|
||||||
import choo from 'choo';
|
import choo from 'choo';
|
||||||
import nanotiming from 'nanotiming';
|
import nanotiming from 'nanotiming';
|
||||||
|
@ -110,7 +110,7 @@ class Storage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set user(info) {
|
set user(info) {
|
||||||
return this.engine.setItem('user', JSON.stringify(info));
|
this.engine.setItem('user', JSON.stringify(info));
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileById(id) {
|
getFileById(id) {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* global TransformStream */
|
|
||||||
|
|
||||||
export function transformStream(readable, transformer, oncancel) {
|
export function transformStream(readable, transformer, oncancel) {
|
||||||
try {
|
try {
|
||||||
return readable.pipeThrough(new TransformStream(transformer));
|
return readable.pipeThrough(new TransformStream(transformer));
|
||||||
|
18
app/utils.js
18
app/utils.js
@ -23,21 +23,15 @@ function locale() {
|
|||||||
return document.querySelector('html').lang;
|
return document.querySelector('html').lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadShim(polyfill) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const shim = document.createElement('script');
|
|
||||||
shim.src = polyfill;
|
|
||||||
shim.addEventListener('load', () => resolve(true));
|
|
||||||
shim.addEventListener('error', () => resolve(false));
|
|
||||||
document.head.appendChild(shim);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function isFile(id) {
|
function isFile(id) {
|
||||||
return /^[0-9a-fA-F]{10,16}$/.test(id);
|
return /^[0-9a-fA-F]{10,16}$/.test(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyToClipboard(str) {
|
async function copyToClipboard(str) {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(str);
|
||||||
|
} catch {
|
||||||
|
// Older browsers or the clipboard API fails because of a missing permission
|
||||||
const aux = document.createElement('input');
|
const aux = document.createElement('input');
|
||||||
aux.setAttribute('value', str);
|
aux.setAttribute('value', str);
|
||||||
aux.contentEditable = true;
|
aux.contentEditable = true;
|
||||||
@ -57,6 +51,7 @@ function copyToClipboard(str) {
|
|||||||
document.body.removeChild(aux);
|
document.body.removeChild(aux);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const LOCALIZE_NUMBERS = !!(
|
const LOCALIZE_NUMBERS = !!(
|
||||||
typeof Intl === 'object' &&
|
typeof Intl === 'object' &&
|
||||||
@ -287,7 +282,6 @@ module.exports = {
|
|||||||
copyToClipboard,
|
copyToClipboard,
|
||||||
arrayToB64,
|
arrayToB64,
|
||||||
b64ToArray,
|
b64ToArray,
|
||||||
loadShim,
|
|
||||||
isFile,
|
isFile,
|
||||||
openLinksInNewTab,
|
openLinksInNewTab,
|
||||||
browserName,
|
browserName,
|
||||||
|
@ -3,7 +3,7 @@ const isServer = typeof genmap === 'function';
|
|||||||
let prefix = '';
|
let prefix = '';
|
||||||
let manifest = {};
|
let manifest = {};
|
||||||
try {
|
try {
|
||||||
//eslint-disable-next-line node/no-missing-require
|
//eslint-disable-next-line n/no-missing-require
|
||||||
manifest = require('../dist/manifest.json');
|
manifest = require('../dist/manifest.json');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// use middleware
|
// use middleware
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
- https://github.com/whatwg/streams/tree/master/reference-implementation
|
- https://github.com/whatwg/streams/tree/master/reference-implementation
|
||||||
- Examples
|
- Examples
|
||||||
- https://github.com/mdn/dom-examples/tree/master/streams
|
- https://github.com/mdn/dom-examples/tree/master/streams
|
||||||
- Polyfill
|
|
||||||
- https://github.com/MattiasBuelens/web-streams-polyfill
|
|
||||||
|
|
||||||
# Encrypted Content Encoding
|
# Encrypted Content Encoding
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global window, document, fetch */
|
/* global window, document */
|
||||||
|
|
||||||
const MAXFILESIZE = 1024 * 1024 * 1024 * 2;
|
const MAXFILESIZE = 1024 * 1024 * 1024 * 2;
|
||||||
|
|
||||||
|
5027
package-lock.json
generated
5027
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@ -66,13 +66,10 @@
|
|||||||
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||||
"@babel/preset-env": "^7.16.11",
|
"@babel/preset-env": "^7.16.11",
|
||||||
"@dannycoates/webcrypto-liner": "^0.1.37",
|
|
||||||
"@fullhuman/postcss-purgecss": "^4.1.3",
|
"@fullhuman/postcss-purgecss": "^4.1.3",
|
||||||
"@mattiasbuelens/web-streams-polyfill": "0.2.1",
|
|
||||||
"@sentry/browser": "^5.30.0",
|
"@sentry/browser": "^5.30.0",
|
||||||
"asmcrypto.js": "^0.22.0",
|
|
||||||
"babel-loader": "^8.2.4",
|
"babel-loader": "^8.2.4",
|
||||||
"babel-plugin-istanbul": "^5.2.0",
|
"babel-plugin-istanbul": "^6.1.1",
|
||||||
"base64-js": "^1.5.1",
|
"base64-js": "^1.5.1",
|
||||||
"content-disposition": "^0.5.4",
|
"content-disposition": "^0.5.4",
|
||||||
"copy-webpack-plugin": "^6.4.0",
|
"copy-webpack-plugin": "^6.4.0",
|
||||||
@ -80,20 +77,15 @@
|
|||||||
"crc": "^3.8.0",
|
"crc": "^3.8.0",
|
||||||
"cross-env": "^6.0.3",
|
"cross-env": "^6.0.3",
|
||||||
"css-loader": "^5.2.7",
|
"css-loader": "^5.2.7",
|
||||||
"css-mqpacker": "^7.0.0",
|
|
||||||
"cssnano": "^5.1.12",
|
"cssnano": "^5.1.12",
|
||||||
"eslint": "^6.6.0",
|
"eslint": "^8.21.0",
|
||||||
"eslint-config-prettier": "^6.15.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-mocha": "^6.2.1",
|
"eslint-plugin-mocha": "^10.1.0",
|
||||||
"eslint-plugin-node": "^10.0.0",
|
"eslint-plugin-n": "^15.2.4",
|
||||||
"eslint-plugin-security": "^1.4.0",
|
"eslint-plugin-security": "^1.5.0",
|
||||||
"expose-loader": "^0.7.5",
|
|
||||||
"extract-loader": "^3.2.0",
|
|
||||||
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
||||||
"fast-text-encoding": "^1.0.3",
|
|
||||||
"file-loader": "^6.2.0",
|
"file-loader": "^6.2.0",
|
||||||
"git-rev-sync": "^3.0.2",
|
"git-rev-sync": "^3.0.2",
|
||||||
"html-loader": "^0.5.5",
|
|
||||||
"http_ece": "^1.1.0",
|
"http_ece": "^1.1.0",
|
||||||
"husky": "^3.0.9",
|
"husky": "^3.0.9",
|
||||||
"intl-pluralrules": "^1.3.1",
|
"intl-pluralrules": "^1.3.1",
|
||||||
@ -113,7 +105,6 @@
|
|||||||
"puppeteer": "^2.0.0",
|
"puppeteer": "^2.0.0",
|
||||||
"raw-loader": "^3.1.0",
|
"raw-loader": "^3.1.0",
|
||||||
"rimraf": "^3.0.0",
|
"rimraf": "^3.0.0",
|
||||||
"script-loader": "^0.7.2",
|
|
||||||
"sinon": "^7.5.0",
|
"sinon": "^7.5.0",
|
||||||
"string-hash": "^1.1.3",
|
"string-hash": "^1.1.3",
|
||||||
"stylelint": "^14.9.1",
|
"stylelint": "^14.9.1",
|
||||||
@ -140,10 +131,8 @@
|
|||||||
"body-parser": "^1.20.0",
|
"body-parser": "^1.20.0",
|
||||||
"choo": "^7.0.0",
|
"choo": "^7.0.0",
|
||||||
"cldr-core": "^35.1.0",
|
"cldr-core": "^35.1.0",
|
||||||
"configstore": "github:dannycoates/configstore#master",
|
|
||||||
"convict": "^6.2.3",
|
"convict": "^6.2.3",
|
||||||
"convict-format-with-validator": "^6.2.0",
|
"convict-format-with-validator": "^6.2.0",
|
||||||
"double-ended-queue": "^2.1.0-0",
|
|
||||||
"express": "^4.17.3",
|
"express": "^4.17.3",
|
||||||
"helmet": "^3.23.3",
|
"helmet": "^3.23.3",
|
||||||
"mozlog": "^3.0.1",
|
"mozlog": "^3.0.1",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
rules:
|
rules:
|
||||||
node/shebang: off
|
n/shebang: off
|
||||||
security/detect-child-process: off
|
security/detect-child-process: off
|
||||||
|
|
||||||
no-console: off
|
no-console: off
|
||||||
|
@ -5,7 +5,7 @@ const clientConstants = require('./clientConstants');
|
|||||||
|
|
||||||
let sentry = '';
|
let sentry = '';
|
||||||
if (config.sentry_id) {
|
if (config.sentry_id) {
|
||||||
//eslint-disable-next-line node/no-missing-require
|
//eslint-disable-next-line n/no-missing-require
|
||||||
const version = require('../dist/version.json');
|
const version = require('../dist/version.json');
|
||||||
sentry = `
|
sentry = `
|
||||||
var SENTRY_CONFIG = {
|
var SENTRY_CONFIG = {
|
||||||
|
@ -120,7 +120,7 @@ module.exports = function(app) {
|
|||||||
);
|
);
|
||||||
app.post(`/api/info/:id${ID_REGEX}`, auth.owner, require('./info'));
|
app.post(`/api/info/:id${ID_REGEX}`, auth.owner, require('./info'));
|
||||||
app.get('/__version__', function(req, res) {
|
app.get('/__version__', function(req, res) {
|
||||||
// eslint-disable-next-line node/no-missing-require
|
// eslint-disable-next-line n/no-missing-require
|
||||||
res.sendFile(require.resolve('../../dist/version.json'));
|
res.sendFile(require.resolve('../../dist/version.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ extends:
|
|||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- mocha
|
- mocha
|
||||||
- node
|
- n
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
node/no-unpublished-require: off
|
n/no-unpublished-require: off
|
||||||
|
|
||||||
mocha/handle-done-callback: error
|
mocha/handle-done-callback: error
|
||||||
mocha/no-exclusive-tests: error
|
mocha/no-exclusive-tests: error
|
||||||
|
@ -5,4 +5,4 @@ parserOptions:
|
|||||||
sourceType: module
|
sourceType: module
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
node/no-unsupported-features: off
|
n/no-unsupported-features: off
|
@ -9,7 +9,7 @@ module.exports = function() {
|
|||||||
const files = fs
|
const files = fs
|
||||||
.readdirSync(path.join(__dirname, 'tests'))
|
.readdirSync(path.join(__dirname, 'tests'))
|
||||||
.filter(p => /\.js$/.test(p));
|
.filter(p => /\.js$/.test(p));
|
||||||
const code = "require('fast-text-encoding');\n" + files.map(kv).join(';\n');
|
const code = files.map(kv).join(';\n');
|
||||||
return {
|
return {
|
||||||
code,
|
code,
|
||||||
dependencies: files.map(f => require.resolve('./tests/' + f)),
|
dependencies: files.map(f => require.resolve('./tests/' + f)),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// eslint-disable-next-line node/no-extraneous-require
|
// eslint-disable-next-line n/no-extraneous-require
|
||||||
const ip = require('ip');
|
const ip = require('ip');
|
||||||
const common = require('./wdio.common.conf');
|
const common = require('./wdio.common.conf');
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// eslint-disable-next-line node/no-extraneous-require
|
// eslint-disable-next-line n/no-extraneous-require
|
||||||
const ip = require('ip');
|
const ip = require('ip');
|
||||||
const common = require('./wdio.common.conf');
|
const common = require('./wdio.common.conf');
|
||||||
const dir =
|
const dir =
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// eslint-disable-next-line node/no-extraneous-require
|
// eslint-disable-next-line n/no-extraneous-require
|
||||||
const ip = require('ip');
|
const ip = require('ip');
|
||||||
const common = require('./wdio.common.conf');
|
const common = require('./wdio.common.conf');
|
||||||
|
|
||||||
|
@ -111,10 +111,6 @@ const web = {
|
|||||||
path.resolve(__dirname, 'common'),
|
path.resolve(__dirname, 'common'),
|
||||||
// some dependencies need to get re-babeled because we
|
// some dependencies need to get re-babeled because we
|
||||||
// have different targets than their default configs
|
// have different targets than their default configs
|
||||||
path.resolve(
|
|
||||||
__dirname,
|
|
||||||
'node_modules/@dannycoates/webcrypto-liner'
|
|
||||||
),
|
|
||||||
path.resolve(__dirname, 'node_modules/@fluent'),
|
path.resolve(__dirname, 'node_modules/@fluent'),
|
||||||
path.resolve(__dirname, 'node_modules/intl-pluralrules')
|
path.resolve(__dirname, 'node_modules/intl-pluralrules')
|
||||||
],
|
],
|
||||||
@ -127,8 +123,7 @@ const web = {
|
|||||||
path.resolve(__dirname, 'node_modules/crc'),
|
path.resolve(__dirname, 'node_modules/crc'),
|
||||||
path.resolve(__dirname, 'node_modules/@fluent'),
|
path.resolve(__dirname, 'node_modules/@fluent'),
|
||||||
path.resolve(__dirname, 'node_modules/@sentry'),
|
path.resolve(__dirname, 'node_modules/@sentry'),
|
||||||
path.resolve(__dirname, 'node_modules/tslib'),
|
path.resolve(__dirname, 'node_modules/tslib')
|
||||||
path.resolve(__dirname, 'node_modules/webcrypto-core')
|
|
||||||
],
|
],
|
||||||
loader: 'webpack-unassert-loader'
|
loader: 'webpack-unassert-loader'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user