mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-07 14:40:55 +03:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96244132c6 | ||
|
|
a9cdd13543 | ||
|
|
1b6c5b8f97 | ||
|
|
27e6606516 | ||
|
|
4902d304b6 | ||
|
|
a182ff2dd1 | ||
|
|
0361e3ce1c | ||
|
|
eeb1359d90 | ||
|
|
e2dde364eb | ||
|
|
0c1ce9f598 | ||
|
|
15d37da667 | ||
|
|
9e4c063749 | ||
|
|
398d044ca2 | ||
|
|
d576003dd1 | ||
|
|
fc0e8708b9 | ||
|
|
d05eb3e882 | ||
|
|
db2a55115a | ||
|
|
c6316f2dad | ||
|
|
3d6611455a | ||
|
|
5b37d2fc87 | ||
|
|
2fa214ea6f |
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
# Build project
|
||||
FROM node:15.5.1-alpine AS builder
|
||||
FROM node:current-alpine AS builder
|
||||
RUN set -x \
|
||||
# Add user
|
||||
&& addgroup --gid 10001 app \
|
||||
@@ -26,7 +26,7 @@ RUN set -x \
|
||||
|
||||
|
||||
# Main image
|
||||
FROM node:15.5.1-alpine
|
||||
FROM node:current-alpine
|
||||
RUN set -x \
|
||||
# Add user
|
||||
&& addgroup --gid 10001 app \
|
||||
|
||||
15
README.md
15
README.md
@@ -66,6 +66,7 @@ Thanks [Mozilla][mozilla] for building this amazing tool!
|
||||
* [Configuration](#configuration)
|
||||
* [Localization](#localization)
|
||||
* [Contributing](#contributing)
|
||||
* [Instances](#instances)
|
||||
* [Deployment](#deployment)
|
||||
* [Clients](#clients)
|
||||
* [License](#license)
|
||||
@@ -120,21 +121,25 @@ The server is configured with environment variables. See [server/config.js](serv
|
||||
|
||||
## 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 also [docs/localization.md](docs/localization.md)
|
||||
see [docs/localization.md](docs/localization.md)
|
||||
|
||||
---
|
||||
|
||||
## 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
|
||||
|
||||
see also [docs/deployment.md](docs/deployment.md)
|
||||
See also [docs/deployment.md](docs/deployment.md)
|
||||
|
||||
---
|
||||
|
||||
|
||||
12
app/user.js
12
app/user.js
@@ -81,21 +81,15 @@ export default class User {
|
||||
}
|
||||
|
||||
get maxSize() {
|
||||
return this.loggedIn
|
||||
? this.limits.MAX_FILE_SIZE
|
||||
: this.limits.ANON.MAX_FILE_SIZE;
|
||||
return this.limits.MAX_FILE_SIZE;
|
||||
}
|
||||
|
||||
get maxExpireSeconds() {
|
||||
return this.loggedIn
|
||||
? this.limits.MAX_EXPIRE_SECONDS
|
||||
: this.limits.ANON.MAX_EXPIRE_SECONDS;
|
||||
return this.limits.MAX_EXPIRE_SECONDS;
|
||||
}
|
||||
|
||||
get maxDownloads() {
|
||||
return this.loggedIn
|
||||
? this.limits.MAX_DOWNLOADS
|
||||
: this.limits.ANON.MAX_DOWNLOADS;
|
||||
return this.limits.MAX_DOWNLOADS;
|
||||
}
|
||||
|
||||
async metricId() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 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
|
||||
|
||||
|
||||
634
package-lock.json
generated
634
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "send",
|
||||
"description": "File Sharing Experiment",
|
||||
"version": "3.4.5",
|
||||
"version": "3.4.8",
|
||||
"author": "Mozilla (https://mozilla.org)",
|
||||
"contributors": [
|
||||
"Tim Visee <3a4fb3964f@sinenomine.email> (https://timvisee.com)"
|
||||
@@ -64,10 +64,10 @@
|
||||
"node": "^15.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.13.10",
|
||||
"@babel/core": "^7.13.16",
|
||||
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||
"@babel/preset-env": "^7.13.10",
|
||||
"@babel/preset-env": "^7.13.15",
|
||||
"@dannycoates/webcrypto-liner": "^0.1.37",
|
||||
"@fullhuman/postcss-purgecss": "^1.3.0",
|
||||
"@mattiasbuelens/web-streams-polyfill": "0.2.1",
|
||||
@@ -78,12 +78,12 @@
|
||||
"base64-js": "^1.5.1",
|
||||
"content-disposition": "^0.5.3",
|
||||
"copy-webpack-plugin": "^5.1.2",
|
||||
"core-js": "^3.9.1",
|
||||
"core-js": "^3.10.2",
|
||||
"crc": "^3.8.0",
|
||||
"cross-env": "^6.0.3",
|
||||
"css-loader": "^3.6.0",
|
||||
"css-mqpacker": "^7.0.0",
|
||||
"cssnano": "^4.1.10",
|
||||
"cssnano": "^4.1.11",
|
||||
"eslint": "^6.6.0",
|
||||
"eslint-config-prettier": "^6.15.0",
|
||||
"eslint-plugin-mocha": "^6.2.1",
|
||||
@@ -135,9 +135,9 @@
|
||||
"@dannycoates/express-ws": "^5.0.3",
|
||||
"@fluent/bundle": "^0.13.0",
|
||||
"@fluent/langneg": "^0.3.0",
|
||||
"@google-cloud/storage": "^5.8.1",
|
||||
"@google-cloud/storage": "^5.8.4",
|
||||
"@sentry/node": "^5.30.0",
|
||||
"aws-sdk": "^2.864.0",
|
||||
"aws-sdk": "^2.889.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"choo": "^7.0.0",
|
||||
"cldr-core": "^35.1.0",
|
||||
@@ -151,7 +151,7 @@
|
||||
"redis": "^2.8.0",
|
||||
"redis-mock": "^0.47.0",
|
||||
"selenium-standalone": "^6.23.0",
|
||||
"ua-parser-js": "^0.7.24"
|
||||
"ua-parser-js": "^0.7.28"
|
||||
},
|
||||
"availableLanguages": [
|
||||
"en-US",
|
||||
|
||||
@@ -2,11 +2,6 @@ const config = require('./config');
|
||||
|
||||
module.exports = {
|
||||
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_DOWNLOADS: config.max_downloads,
|
||||
MAX_EXPIRE_SECONDS: config.max_expire_seconds,
|
||||
|
||||
@@ -39,11 +39,6 @@ const conf = convict({
|
||||
default: 86400 * 7,
|
||||
env: 'MAX_EXPIRE_SECONDS'
|
||||
},
|
||||
anon_max_expire_seconds: {
|
||||
format: Number,
|
||||
default: 86400,
|
||||
env: 'ANON_MAX_EXPIRE_SECONDS'
|
||||
},
|
||||
download_counts: {
|
||||
format: Array,
|
||||
default: [1, 2, 3, 4, 5, 20, 50, 100],
|
||||
@@ -54,11 +49,6 @@ const conf = convict({
|
||||
default: 100,
|
||||
env: 'MAX_DOWNLOADS'
|
||||
},
|
||||
anon_max_downloads: {
|
||||
format: Number,
|
||||
default: 5,
|
||||
env: 'ANON_MAX_DOWNLOADS'
|
||||
},
|
||||
max_files_per_archive: {
|
||||
format: Number,
|
||||
default: 64,
|
||||
@@ -74,6 +64,16 @@ const conf = convict({
|
||||
default: 'localhost',
|
||||
env: 'REDIS_HOST'
|
||||
},
|
||||
redis_port: {
|
||||
format: Number,
|
||||
default: 6379,
|
||||
env: 'REDIS_PORT'
|
||||
},
|
||||
redis_password: {
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'REDIS_PASSWORD'
|
||||
},
|
||||
redis_event_expire: {
|
||||
format: Boolean,
|
||||
default: false,
|
||||
@@ -120,11 +120,6 @@ const conf = convict({
|
||||
default: 1024 * 1024 * 1024 * 2.5,
|
||||
env: 'MAX_FILE_SIZE'
|
||||
},
|
||||
anon_max_file_size: {
|
||||
format: Number,
|
||||
default: 1024 * 1024 * 1024,
|
||||
env: 'ANON_MAX_FILE_SIZE'
|
||||
},
|
||||
l10n_dev: {
|
||||
format: Boolean,
|
||||
default: false,
|
||||
|
||||
@@ -2,7 +2,7 @@ const config = require('../config');
|
||||
const storage = require('../storage');
|
||||
|
||||
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;
|
||||
if (!dlimit || dlimit > max) {
|
||||
return res.sendStatus(400);
|
||||
|
||||
@@ -30,15 +30,9 @@ module.exports = function(ws, req) {
|
||||
const metadata = fileInfo.fileMetadata;
|
||||
const auth = fileInfo.authorization;
|
||||
const user = await fxa.verify(fileInfo.bearer);
|
||||
const maxFileSize = user
|
||||
? config.max_file_size
|
||||
: config.anon_max_file_size;
|
||||
const maxExpireSeconds = user
|
||||
? config.max_expire_seconds
|
||||
: config.anon_max_expire_seconds;
|
||||
const maxDownloads = user
|
||||
? config.max_downloads
|
||||
: config.anon_max_downloads;
|
||||
const maxFileSize = config.max_file_size;
|
||||
const maxExpireSeconds = config.max_expire_seconds;
|
||||
const maxDownloads = config.max_downloads;
|
||||
|
||||
if (config.fxa_required && !user) {
|
||||
ws.send(
|
||||
|
||||
@@ -8,8 +8,10 @@ module.exports = function(config) {
|
||||
|
||||
//eslint-disable-next-line security/detect-non-literal-require
|
||||
const redis = require(redis_lib);
|
||||
const client = redis.createClient({
|
||||
|
||||
var client_config = {
|
||||
host: config.redis_host,
|
||||
port: config.redis_port,
|
||||
retry_strategy: options => {
|
||||
if (options.total_retry_time > config.redis_retry_time) {
|
||||
client.emit('error', 'Retry time exhausted');
|
||||
@@ -18,7 +20,10 @@ module.exports = function(config) {
|
||||
|
||||
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.hgetallAsync = promisify(client.hgetall);
|
||||
|
||||
Reference in New Issue
Block a user