mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-09 11:45:36 +00:00
Compare commits
50 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72377d3438 | ||
|
|
512c9803bd | ||
|
|
4c45d6217d | ||
|
|
b4b8060a78 | ||
|
|
ed042b8515 | ||
|
|
06bc58c93c | ||
|
|
b58caed44f | ||
|
|
174ade1c2e | ||
|
|
31ce8c048b | ||
|
|
ce401881d7 | ||
|
|
c49e8e1062 | ||
|
|
15648157c9 | ||
|
|
4280edd5af | ||
|
|
a3d4e2c502 | ||
|
|
bed5443685 | ||
|
|
f9f5d77cd0 | ||
|
|
0f8a6a107a | ||
|
|
02e8cb264f | ||
|
|
385ac595b9 | ||
|
|
6df0876286 | ||
|
|
827a35f73e | ||
|
|
eb3a9e8c89 | ||
|
|
6c3ac403f6 | ||
|
|
1ce2a60dd5 | ||
|
|
f5bb74e921 | ||
|
|
352fba6302 | ||
|
|
ace2aa5d73 | ||
|
|
3256b01276 | ||
|
|
96244132c6 | ||
|
|
a9cdd13543 | ||
|
|
1b6c5b8f97 | ||
|
|
27e6606516 | ||
|
|
4902d304b6 | ||
|
|
a182ff2dd1 | ||
|
|
0361e3ce1c | ||
|
|
32539e58ac | ||
|
|
eeb1359d90 | ||
|
|
e2dde364eb | ||
|
|
0c1ce9f598 | ||
|
|
15d37da667 | ||
|
|
9e4c063749 | ||
|
|
398d044ca2 | ||
|
|
d576003dd1 | ||
|
|
fc0e8708b9 | ||
|
|
d05eb3e882 | ||
|
|
db2a55115a | ||
|
|
c6316f2dad | ||
|
|
3d6611455a | ||
|
|
5b37d2fc87 | ||
|
|
2fa214ea6f |
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -1,2 +1,2 @@
|
|||||||
public/locales/* linguist-documentation
|
public/locales/*/*.ftl linguist-documentation
|
||||||
docs/* linguist-documentation
|
docs/** linguist-documentation
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# Build project
|
# Build project
|
||||||
FROM node:15.5.1-alpine AS builder
|
FROM node:current-alpine AS builder
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
# Add user
|
# Add user
|
||||||
&& addgroup --gid 10001 app \
|
&& addgroup --gid 10001 app \
|
||||||
@@ -26,7 +26,7 @@ RUN set -x \
|
|||||||
|
|
||||||
|
|
||||||
# Main image
|
# Main image
|
||||||
FROM node:15.5.1-alpine
|
FROM node:current-alpine
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
# Add user
|
# Add user
|
||||||
&& addgroup --gid 10001 app \
|
&& addgroup --gid 10001 app \
|
||||||
|
|||||||
15
README.md
15
README.md
@@ -66,6 +66,7 @@ Thanks [Mozilla][mozilla] for building this amazing tool!
|
|||||||
* [Configuration](#configuration)
|
* [Configuration](#configuration)
|
||||||
* [Localization](#localization)
|
* [Localization](#localization)
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
|
* [Instances](#instances)
|
||||||
* [Deployment](#deployment)
|
* [Deployment](#deployment)
|
||||||
* [Clients](#clients)
|
* [Clients](#clients)
|
||||||
* [License](#license)
|
* [License](#license)
|
||||||
@@ -120,21 +121,25 @@ The server is configured with environment variables. See [server/config.js](serv
|
|||||||
|
|
||||||
## Localization
|
## Localization
|
||||||
|
|
||||||
Send localization is managed via [Pontoon](https://pontoon.mozilla.org/projects/test-pilot-firefox-send/), not direct pull requests to the repository. If you want to fix a typo, add a new language, or simply know more about localization, please get in touch with the [existing localization team](https://pontoon.mozilla.org/teams/) for your language or Mozilla’s [l10n-drivers](https://wiki.mozilla.org/L10n:Mozilla_Team#Mozilla_Corporation) for guidance.
|
see [docs/localization.md](docs/localization.md)
|
||||||
|
|
||||||
see also [docs/localization.md](docs/localization.md)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Pull requests are always welcome! Feel free to check out the list of ["good first issues"](https://github.com/mozilla/send/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).
|
Pull requests are always welcome! Feel free to check out the list of "good first issues" (to be implemented).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Instances
|
||||||
|
|
||||||
|
Find a list of public instances here: https://github.com/timvisee/send-instances/
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
see also [docs/deployment.md](docs/deployment.md)
|
See also [docs/deployment.md](docs/deployment.md)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ details {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
details > summary::-webkit-details-marker {
|
details > summary::marker {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
app/user.js
12
app/user.js
@@ -81,21 +81,15 @@ export default class User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get maxSize() {
|
get maxSize() {
|
||||||
return this.loggedIn
|
return this.limits.MAX_FILE_SIZE;
|
||||||
? this.limits.MAX_FILE_SIZE
|
|
||||||
: this.limits.ANON.MAX_FILE_SIZE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get maxExpireSeconds() {
|
get maxExpireSeconds() {
|
||||||
return this.loggedIn
|
return this.limits.MAX_EXPIRE_SECONDS;
|
||||||
? this.limits.MAX_EXPIRE_SECONDS
|
|
||||||
: this.limits.ANON.MAX_EXPIRE_SECONDS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get maxDownloads() {
|
get maxDownloads() {
|
||||||
return this.loggedIn
|
return this.limits.MAX_DOWNLOADS;
|
||||||
? this.limits.MAX_DOWNLOADS
|
|
||||||
: this.limits.ANON.MAX_DOWNLOADS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async metricId() {
|
async metricId() {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ For Debian/Ubuntu systems this probably just means something like this:
|
|||||||
## Building
|
## Building
|
||||||
* We assume an already configured virtual-host on your webserver with an existing empty htdocs folder
|
* We assume an already configured virtual-host on your webserver with an existing empty htdocs folder
|
||||||
* First, remove that htdocs folder - we will replace it with Send's version now
|
* First, remove that htdocs folder - we will replace it with Send's version now
|
||||||
* git clone https://github.com/mozilla/send.git htdocs
|
* git clone https://github.com/timvisee/send.git htdocs
|
||||||
* Make now sure you are NOT root but rather the user your webserver is serving files under (e.g. "su www-data" or whoever the owner of your htdocs folder is)
|
* Make now sure you are NOT root but rather the user your webserver is serving files under (e.g. "su www-data" or whoever the owner of your htdocs folder is)
|
||||||
* npm install
|
* npm install
|
||||||
* npm run build
|
* npm run build
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Localization
|
# Localization
|
||||||
|
|
||||||
Send is localized in over 50 languages. We use the [fluent](http://projectfluent.org/) library and store our translations in [FTL](http://projectfluent.org/fluent/guide/) files in `public/locales/`. `en-US` is our base language, and other languages are managed by [pontoon](https://pontoon.mozilla.org/projects/test-pilot-firefox-send/).
|
Send is localized in over 50 languages. We use the [fluent](http://projectfluent.org/) library and store our translations in [FTL](http://projectfluent.org/fluent/guide/) files in `public/locales/`. `en-US` is our base language.
|
||||||
|
|
||||||
## Process
|
## Process
|
||||||
|
|
||||||
|
|||||||
1401
package-lock.json
generated
1401
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "send",
|
"name": "send",
|
||||||
"description": "File Sharing Experiment",
|
"description": "File Sharing Experiment",
|
||||||
"version": "3.4.5",
|
"version": "3.4.10",
|
||||||
"author": "Mozilla (https://mozilla.org)",
|
"author": "Mozilla (https://mozilla.org)",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Tim Visee <3a4fb3964f@sinenomine.email> (https://timvisee.com)"
|
"Tim Visee <3a4fb3964f@sinenomine.email> (https://timvisee.com)"
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
"test:report": "nyc report --reporter=html",
|
"test:report": "nyc report --reporter=html",
|
||||||
"test-integration": "cross-env NODE_ENV=development wdio test/wdio.docker.conf.js",
|
"test-integration": "cross-env NODE_ENV=development wdio test/wdio.docker.conf.js",
|
||||||
"circleci-test-integration": "echo 'webdriverio tests need to be updated to node 12'",
|
"circleci-test-integration": "echo 'webdriverio tests need to be updated to node 12'",
|
||||||
"start": "npm run clean && cross-env NODE_ENV=development L10N_DEV=true FXA_CLIENT_ID=fced6b5e3f4c66b9 BASE_URL=http://localhost:8080 webpack-dev-server --mode=development",
|
"start": "npm run clean && cross-env NODE_ENV=development L10N_DEV=true BASE_URL=http://localhost:8080 DETECT_BASE_URL=true webpack-dev-server --mode=development",
|
||||||
"android": "cross-env ANDROID=1 npm start",
|
"android": "cross-env ANDROID=1 npm start",
|
||||||
"prod": "node server/bin/prod.js"
|
"prod": "node server/bin/prod.js"
|
||||||
},
|
},
|
||||||
@@ -64,10 +64,10 @@
|
|||||||
"node": "^15.5.1"
|
"node": "^15.5.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.13.10",
|
"@babel/core": "^7.14.0",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||||
"@babel/preset-env": "^7.13.10",
|
"@babel/preset-env": "^7.14.1",
|
||||||
"@dannycoates/webcrypto-liner": "^0.1.37",
|
"@dannycoates/webcrypto-liner": "^0.1.37",
|
||||||
"@fullhuman/postcss-purgecss": "^1.3.0",
|
"@fullhuman/postcss-purgecss": "^1.3.0",
|
||||||
"@mattiasbuelens/web-streams-polyfill": "0.2.1",
|
"@mattiasbuelens/web-streams-polyfill": "0.2.1",
|
||||||
@@ -78,12 +78,12 @@
|
|||||||
"base64-js": "^1.5.1",
|
"base64-js": "^1.5.1",
|
||||||
"content-disposition": "^0.5.3",
|
"content-disposition": "^0.5.3",
|
||||||
"copy-webpack-plugin": "^5.1.2",
|
"copy-webpack-plugin": "^5.1.2",
|
||||||
"core-js": "^3.9.1",
|
"core-js": "^3.12.0",
|
||||||
"crc": "^3.8.0",
|
"crc": "^3.8.0",
|
||||||
"cross-env": "^6.0.3",
|
"cross-env": "^6.0.3",
|
||||||
"css-loader": "^3.6.0",
|
"css-loader": "^3.6.0",
|
||||||
"css-mqpacker": "^7.0.0",
|
"css-mqpacker": "^7.0.0",
|
||||||
"cssnano": "^4.1.10",
|
"cssnano": "^4.1.11",
|
||||||
"eslint": "^6.6.0",
|
"eslint": "^6.6.0",
|
||||||
"eslint-config-prettier": "^6.15.0",
|
"eslint-config-prettier": "^6.15.0",
|
||||||
"eslint-plugin-mocha": "^6.2.1",
|
"eslint-plugin-mocha": "^6.2.1",
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
"script-loader": "^0.7.2",
|
"script-loader": "^0.7.2",
|
||||||
"sinon": "^7.5.0",
|
"sinon": "^7.5.0",
|
||||||
"string-hash": "^1.1.3",
|
"string-hash": "^1.1.3",
|
||||||
"stylelint": "^13.12.0",
|
"stylelint": "^13.13.1",
|
||||||
"stylelint-config-standard": "^19.0.0",
|
"stylelint-config-standard": "^19.0.0",
|
||||||
"stylelint-no-unsupported-browser-features": "^4.1.4",
|
"stylelint-no-unsupported-browser-features": "^4.1.4",
|
||||||
"svgo": "^1.3.2",
|
"svgo": "^1.3.2",
|
||||||
@@ -135,9 +135,9 @@
|
|||||||
"@dannycoates/express-ws": "^5.0.3",
|
"@dannycoates/express-ws": "^5.0.3",
|
||||||
"@fluent/bundle": "^0.13.0",
|
"@fluent/bundle": "^0.13.0",
|
||||||
"@fluent/langneg": "^0.3.0",
|
"@fluent/langneg": "^0.3.0",
|
||||||
"@google-cloud/storage": "^5.8.1",
|
"@google-cloud/storage": "^5.8.5",
|
||||||
"@sentry/node": "^5.30.0",
|
"@sentry/node": "^5.30.0",
|
||||||
"aws-sdk": "^2.864.0",
|
"aws-sdk": "^2.902.0",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"choo": "^7.0.0",
|
"choo": "^7.0.0",
|
||||||
"cldr-core": "^35.1.0",
|
"cldr-core": "^35.1.0",
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
"redis": "^2.8.0",
|
"redis": "^2.8.0",
|
||||||
"redis-mock": "^0.47.0",
|
"redis-mock": "^0.47.0",
|
||||||
"selenium-standalone": "^6.23.0",
|
"selenium-standalone": "^6.23.0",
|
||||||
"ua-parser-js": "^0.7.24"
|
"ua-parser-js": "^0.7.28"
|
||||||
},
|
},
|
||||||
"availableLanguages": [
|
"availableLanguages": [
|
||||||
"en-US",
|
"en-US",
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ notSupportedOutdatedDetail = Helaas ondersteunt deze versie van Firefox de webte
|
|||||||
updateFirefox = Firefox bijwerken
|
updateFirefox = Firefox bijwerken
|
||||||
deletePopupCancel = Annuleren
|
deletePopupCancel = Annuleren
|
||||||
deleteButtonHover = Verwijderen
|
deleteButtonHover = Verwijderen
|
||||||
footerText = Niet aangesloten aan Mozilla of Firefox.
|
footerText = Niet gelieerd aan Mozilla of Firefox.
|
||||||
footerLinkDonate = Doneren
|
footerLinkDonate = Doneren
|
||||||
footerLinkCli = CLI
|
footerLinkCli = CLI
|
||||||
footerLinkDmca = DMCA
|
footerLinkDmca = DMCA
|
||||||
@@ -52,7 +52,7 @@ passwordSetError = Dit wachtwoord kon niet worden ingesteld
|
|||||||
-send-short-brand = Send
|
-send-short-brand = Send
|
||||||
-firefox = Firefox
|
-firefox = Firefox
|
||||||
-mozilla = Mozilla
|
-mozilla = Mozilla
|
||||||
introTitle = Eenvoudig, privé bestanden delen
|
introTitle = Bestanden delen, eenvoudig en privé
|
||||||
introDescription = Met { -send-brand } kunt u bestanden delen met end-to-endversleuteling en een koppeling die automatisch verloopt. Hierdoor kunt u privé houden wat u wilt delen en er zeker van zijn dat uw zaken niet voor altijd online blijven.
|
introDescription = Met { -send-brand } kunt u bestanden delen met end-to-endversleuteling en een koppeling die automatisch verloopt. Hierdoor kunt u privé houden wat u wilt delen en er zeker van zijn dat uw zaken niet voor altijd online blijven.
|
||||||
notifyUploadEncryptDone = Uw bestand is versleuteld en klaar voor verzending
|
notifyUploadEncryptDone = Uw bestand is versleuteld en klaar voor verzending
|
||||||
# downloadCount is from the downloadCount string and timespan is a timespanMinutes string. ex. 'Expires after 2 downloads or 25 minutes'
|
# downloadCount is from the downloadCount string and timespan is a timespanMinutes string. ex. 'Expires after 2 downloads or 25 minutes'
|
||||||
|
|||||||
@@ -2,11 +2,6 @@ const config = require('./config');
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
LIMITS: {
|
LIMITS: {
|
||||||
ANON: {
|
|
||||||
MAX_FILE_SIZE: config.anon_max_file_size,
|
|
||||||
MAX_DOWNLOADS: config.anon_max_downloads,
|
|
||||||
MAX_EXPIRE_SECONDS: config.anon_max_expire_seconds
|
|
||||||
},
|
|
||||||
MAX_FILE_SIZE: config.max_file_size,
|
MAX_FILE_SIZE: config.max_file_size,
|
||||||
MAX_DOWNLOADS: config.max_downloads,
|
MAX_DOWNLOADS: config.max_downloads,
|
||||||
MAX_EXPIRE_SECONDS: config.max_expire_seconds,
|
MAX_EXPIRE_SECONDS: config.max_expire_seconds,
|
||||||
|
|||||||
@@ -39,11 +39,6 @@ const conf = convict({
|
|||||||
default: 86400 * 7,
|
default: 86400 * 7,
|
||||||
env: 'MAX_EXPIRE_SECONDS'
|
env: 'MAX_EXPIRE_SECONDS'
|
||||||
},
|
},
|
||||||
anon_max_expire_seconds: {
|
|
||||||
format: Number,
|
|
||||||
default: 86400,
|
|
||||||
env: 'ANON_MAX_EXPIRE_SECONDS'
|
|
||||||
},
|
|
||||||
download_counts: {
|
download_counts: {
|
||||||
format: Array,
|
format: Array,
|
||||||
default: [1, 2, 3, 4, 5, 20, 50, 100],
|
default: [1, 2, 3, 4, 5, 20, 50, 100],
|
||||||
@@ -54,11 +49,6 @@ const conf = convict({
|
|||||||
default: 100,
|
default: 100,
|
||||||
env: 'MAX_DOWNLOADS'
|
env: 'MAX_DOWNLOADS'
|
||||||
},
|
},
|
||||||
anon_max_downloads: {
|
|
||||||
format: Number,
|
|
||||||
default: 5,
|
|
||||||
env: 'ANON_MAX_DOWNLOADS'
|
|
||||||
},
|
|
||||||
max_files_per_archive: {
|
max_files_per_archive: {
|
||||||
format: Number,
|
format: Number,
|
||||||
default: 64,
|
default: 64,
|
||||||
@@ -74,6 +64,16 @@ const conf = convict({
|
|||||||
default: 'localhost',
|
default: 'localhost',
|
||||||
env: 'REDIS_HOST'
|
env: 'REDIS_HOST'
|
||||||
},
|
},
|
||||||
|
redis_port: {
|
||||||
|
format: Number,
|
||||||
|
default: 6379,
|
||||||
|
env: 'REDIS_PORT'
|
||||||
|
},
|
||||||
|
redis_password: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'REDIS_PASSWORD'
|
||||||
|
},
|
||||||
redis_event_expire: {
|
redis_event_expire: {
|
||||||
format: Boolean,
|
format: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
@@ -120,11 +120,6 @@ const conf = convict({
|
|||||||
default: 1024 * 1024 * 1024 * 2.5,
|
default: 1024 * 1024 * 1024 * 2.5,
|
||||||
env: 'MAX_FILE_SIZE'
|
env: 'MAX_FILE_SIZE'
|
||||||
},
|
},
|
||||||
anon_max_file_size: {
|
|
||||||
format: Number,
|
|
||||||
default: 1024 * 1024 * 1024,
|
|
||||||
env: 'ANON_MAX_FILE_SIZE'
|
|
||||||
},
|
|
||||||
l10n_dev: {
|
l10n_dev: {
|
||||||
format: Boolean,
|
format: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
@@ -135,6 +130,11 @@ const conf = convict({
|
|||||||
default: 'https://send.firefox.com',
|
default: 'https://send.firefox.com',
|
||||||
env: 'BASE_URL'
|
env: 'BASE_URL'
|
||||||
},
|
},
|
||||||
|
detect_base_url: {
|
||||||
|
format: Boolean,
|
||||||
|
default: false,
|
||||||
|
env: 'DETECT_BASE_URL'
|
||||||
|
},
|
||||||
file_dir: {
|
file_dir: {
|
||||||
format: 'String',
|
format: 'String',
|
||||||
default: `${tmpdir()}${path.sep}send-${randomBytes(4).toString('hex')}`,
|
default: `${tmpdir()}${path.sep}send-${randomBytes(4).toString('hex')}`,
|
||||||
@@ -211,4 +211,17 @@ const conf = convict({
|
|||||||
conf.validate({ allowed: 'strict' });
|
conf.validate({ allowed: 'strict' });
|
||||||
|
|
||||||
const props = conf.getProperties();
|
const props = conf.getProperties();
|
||||||
module.exports = props;
|
|
||||||
|
const deriveBaseUrl = req => {
|
||||||
|
if (!props.detect_base_url) {
|
||||||
|
return props.base_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
const protocol = req.secure ? 'https://' : 'http://';
|
||||||
|
return `${protocol}${req.headers.host}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
...props,
|
||||||
|
deriveBaseUrl
|
||||||
|
};
|
||||||
|
|||||||
@@ -36,9 +36,14 @@ module.exports = function(app) {
|
|||||||
defaultSrc: ["'self'"],
|
defaultSrc: ["'self'"],
|
||||||
connectSrc: [
|
connectSrc: [
|
||||||
"'self'",
|
"'self'",
|
||||||
config.base_url.replace(/^https:\/\//, 'wss://')
|
function(req) {
|
||||||
|
const baseUrl = config.deriveBaseUrl(req);
|
||||||
|
const r = baseUrl.replace(/^http(s?):\/\//, 'ws$1://');
|
||||||
|
console.log([baseUrl, r]);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
],
|
],
|
||||||
imgSrc: ["'self'"],
|
imgSrc: ["'self'", 'data:'],
|
||||||
scriptSrc: [
|
scriptSrc: [
|
||||||
"'self'",
|
"'self'",
|
||||||
function(req) {
|
function(req) {
|
||||||
@@ -52,10 +57,6 @@ module.exports = function(app) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
csp.directives.connectSrc.push(
|
|
||||||
config.base_url.replace(/^https:\/\//, 'wss://')
|
|
||||||
);
|
|
||||||
|
|
||||||
app.use(helmet.contentSecurityPolicy(csp));
|
app.use(helmet.contentSecurityPolicy(csp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const config = require('../config');
|
|||||||
const storage = require('../storage');
|
const storage = require('../storage');
|
||||||
|
|
||||||
module.exports = function(req, res) {
|
module.exports = function(req, res) {
|
||||||
const max = req.user ? config.max_downloads : config.anon_max_downloads;
|
const max = config.max_downloads;
|
||||||
const dlimit = req.body.dlimit;
|
const dlimit = req.body.dlimit;
|
||||||
if (!dlimit || dlimit > max) {
|
if (!dlimit || dlimit > max) {
|
||||||
return res.sendStatus(400);
|
return res.sendStatus(400);
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ module.exports = async function(req, res) {
|
|||||||
//this hasn't been updated to expiration time setting yet
|
//this hasn't been updated to expiration time setting yet
|
||||||
//if you want to fallback to this code add this
|
//if you want to fallback to this code add this
|
||||||
await storage.set(newId, fileStream, meta, config.default_expire_seconds);
|
await storage.set(newId, fileStream, meta, config.default_expire_seconds);
|
||||||
const protocol = config.env === 'production' ? 'https' : req.protocol;
|
const url = `${config.deriveBaseUrl(req)}/download/${newId}/`;
|
||||||
const url = `${protocol}://${req.get('host')}/download/${newId}/`;
|
|
||||||
res.set('WWW-Authenticate', `send-v1 ${meta.nonce}`);
|
res.set('WWW-Authenticate', `send-v1 ${meta.nonce}`);
|
||||||
res.json({
|
res.json({
|
||||||
url,
|
url,
|
||||||
|
|||||||
@@ -30,15 +30,9 @@ module.exports = function(ws, req) {
|
|||||||
const metadata = fileInfo.fileMetadata;
|
const metadata = fileInfo.fileMetadata;
|
||||||
const auth = fileInfo.authorization;
|
const auth = fileInfo.authorization;
|
||||||
const user = await fxa.verify(fileInfo.bearer);
|
const user = await fxa.verify(fileInfo.bearer);
|
||||||
const maxFileSize = user
|
const maxFileSize = config.max_file_size;
|
||||||
? config.max_file_size
|
const maxExpireSeconds = config.max_expire_seconds;
|
||||||
: config.anon_max_file_size;
|
const maxDownloads = config.max_downloads;
|
||||||
const maxExpireSeconds = user
|
|
||||||
? config.max_expire_seconds
|
|
||||||
: config.anon_max_expire_seconds;
|
|
||||||
const maxDownloads = user
|
|
||||||
? config.max_downloads
|
|
||||||
: config.anon_max_downloads;
|
|
||||||
|
|
||||||
if (config.fxa_required && !user) {
|
if (config.fxa_required && !user) {
|
||||||
ws.send(
|
ws.send(
|
||||||
@@ -71,8 +65,7 @@ module.exports = function(ws, req) {
|
|||||||
nonce: crypto.randomBytes(16).toString('base64')
|
nonce: crypto.randomBytes(16).toString('base64')
|
||||||
};
|
};
|
||||||
|
|
||||||
const protocol = config.env === 'production' ? 'https' : req.protocol;
|
const url = `${config.deriveBaseUrl(req)}/download/${newId}/`;
|
||||||
const url = `${protocol}://${req.get('host')}/download/${newId}/`;
|
|
||||||
|
|
||||||
ws.send(
|
ws.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ module.exports = async function(req) {
|
|||||||
if (config.survey_url) {
|
if (config.survey_url) {
|
||||||
prefs.surveyUrl = config.survey_url;
|
prefs.surveyUrl = config.survey_url;
|
||||||
}
|
}
|
||||||
|
const baseUrl = config.deriveBaseUrl(req);
|
||||||
return {
|
return {
|
||||||
archive: {
|
archive: {
|
||||||
numFiles: 0
|
numFiles: 0
|
||||||
@@ -33,7 +34,7 @@ module.exports = async function(req) {
|
|||||||
title: 'Send',
|
title: 'Send',
|
||||||
description:
|
description:
|
||||||
'Encrypt and send files with a link that automatically expires to ensure your important documents don’t stay online forever.',
|
'Encrypt and send files with a link that automatically expires to ensure your important documents don’t stay online forever.',
|
||||||
baseUrl: config.base_url,
|
baseUrl,
|
||||||
ui: {},
|
ui: {},
|
||||||
storage: {
|
storage: {
|
||||||
files: []
|
files: []
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ module.exports = function(config) {
|
|||||||
|
|
||||||
//eslint-disable-next-line security/detect-non-literal-require
|
//eslint-disable-next-line security/detect-non-literal-require
|
||||||
const redis = require(redis_lib);
|
const redis = require(redis_lib);
|
||||||
const client = redis.createClient({
|
|
||||||
|
var client_config = {
|
||||||
host: config.redis_host,
|
host: config.redis_host,
|
||||||
|
port: config.redis_port,
|
||||||
retry_strategy: options => {
|
retry_strategy: options => {
|
||||||
if (options.total_retry_time > config.redis_retry_time) {
|
if (options.total_retry_time > config.redis_retry_time) {
|
||||||
client.emit('error', 'Retry time exhausted');
|
client.emit('error', 'Retry time exhausted');
|
||||||
@@ -18,7 +20,10 @@ module.exports = function(config) {
|
|||||||
|
|
||||||
return config.redis_retry_delay;
|
return config.redis_retry_delay;
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
if (config.redis_password != null && config.redis_password.length > 0)
|
||||||
|
client_config.password = config.redis_password;
|
||||||
|
const client = redis.createClient(client_config);
|
||||||
|
|
||||||
client.ttlAsync = promisify(client.ttl);
|
client.ttlAsync = promisify(client.ttl);
|
||||||
client.hgetallAsync = promisify(client.hgetall);
|
client.hgetallAsync = promisify(client.hgetall);
|
||||||
|
|||||||
Reference in New Issue
Block a user