Compare commits
31 Commits
dee1e84e58
...
38a4552d52
Author | SHA1 | Date | |
---|---|---|---|
![]() |
38a4552d52 | ||
![]() |
9d2d81e063 | ||
![]() |
81d6c90c4e | ||
![]() |
2bdaa0c4bd | ||
![]() |
00d3bebc27 | ||
![]() |
ea384ff5d3 | ||
![]() |
062c439ec0 | ||
![]() |
54e528980b | ||
![]() |
b9292abefe | ||
![]() |
1520942ac9 | ||
![]() |
0e17cd567c | ||
![]() |
7b21b199c2 | ||
![]() |
6214b07a30 | ||
![]() |
941d87976b | ||
![]() |
8db3fed6fb | ||
![]() |
78ca1f06e0 | ||
![]() |
9fdc079878 | ||
![]() |
f08d078236 | ||
![]() |
46ae4a220b | ||
![]() |
d0932c26ea | ||
![]() |
798c399a38 | ||
![]() |
825e3942a2 | ||
![]() |
755459f57e | ||
![]() |
42f5ca9701 | ||
![]() |
1a923d21b5 | ||
![]() |
3bd9f00c25 | ||
![]() |
fa1c64369f | ||
![]() |
9280f47afc | ||
![]() |
3707b90d09 | ||
![]() |
21392f1157 | ||
![]() |
680d3ed948 |
|
@ -152,6 +152,7 @@ AWS example using Ubuntu Server `20.04`: [docs/AWS.md](docs/AWS.md)
|
|||
- Web: _this repository_
|
||||
- Command-line: [`ffsend`](https://github.com/timvisee/ffsend)
|
||||
- Android: _see [Android](#android) section_
|
||||
- Thunderbird: [FileLink provider for Send](https://addons.thunderbird.net/en-US/thunderbird/addon/filelink-provider-for-send/)
|
||||
|
||||
#### Android
|
||||
|
||||
|
|
|
@ -77,7 +77,11 @@ function body(main) {
|
|||
state.capabilities = {
|
||||
account: true
|
||||
}; //TODO
|
||||
state.archive = new Archive([], DEFAULTS.EXPIRE_SECONDS);
|
||||
state.archive = new Archive(
|
||||
[],
|
||||
DEFAULTS.EXPIRE_SECONDS,
|
||||
DEFAULTS.DOWNLOADS
|
||||
);
|
||||
state.storage = storage;
|
||||
state.user = new User(storage, LIMITS);
|
||||
state.sentry = Sentry;
|
||||
|
|
|
@ -14,11 +14,11 @@ function isDupe(newFile, array) {
|
|||
}
|
||||
|
||||
export default class Archive {
|
||||
constructor(files = [], defaultTimeLimit = 86400) {
|
||||
constructor(files = [], defaultTimeLimit = 86400, defaultDownloadLimit = 1) {
|
||||
this.files = Array.from(files);
|
||||
this.defaultTimeLimit = defaultTimeLimit;
|
||||
this.timeLimit = defaultTimeLimit;
|
||||
this.dlimit = 1;
|
||||
this.dlimit = defaultDownloadLimit;
|
||||
this.password = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -224,24 +224,6 @@ async function saveFile(file) {
|
|||
if (navigator.msSaveBlob) {
|
||||
navigator.msSaveBlob(blob, file.name);
|
||||
return resolve();
|
||||
} else if (/iPhone|fxios/i.test(navigator.userAgent)) {
|
||||
// This method is much slower but createObjectURL
|
||||
// is buggy on iOS
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener('loadend', function() {
|
||||
if (reader.error) {
|
||||
return reject(reader.error);
|
||||
}
|
||||
if (reader.result) {
|
||||
const a = document.createElement('a');
|
||||
a.href = reader.result;
|
||||
a.download = file.name;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
reader.readAsDataURL(blob);
|
||||
} else {
|
||||
const downloadUrl = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
|
|
|
@ -52,7 +52,7 @@ if (process.env.NODE_ENV === 'production') {
|
|||
DEFAULTS,
|
||||
WEB_UI,
|
||||
PREFS,
|
||||
archive: new Archive([], DEFAULTS.EXPIRE_SECONDS),
|
||||
archive: new Archive([], DEFAULTS.EXPIRE_SECONDS, DEFAULTS.DOWNLOADS),
|
||||
capabilities,
|
||||
translate,
|
||||
storage,
|
||||
|
|
1281
app/qrcode.js
1281
app/qrcode.js
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@ const raw = require('choo/html/raw');
|
|||
const qrcode = require('../qrcode');
|
||||
|
||||
module.exports = function(url) {
|
||||
const gen = qrcode(5, 'L');
|
||||
const gen = qrcode(0, 'L');
|
||||
gen.addData(url);
|
||||
gen.make();
|
||||
const qr = gen.createSvgTag({ scalable: true });
|
||||
|
|
|
@ -29,7 +29,7 @@ Config options expecting array values (e.g. `EXPIRE_TIMES_SECONDS`, `DOWNLOAD_CO
|
|||
| Name | Description |
|
||||
|------------------|-------------|
|
||||
| `BASE_URL` | The HTTPS URL where traffic will be served (e.g. `https://send.firefox.com`)
|
||||
| `DETECT_BASE_URL` | Autodetect the base URL using browser if `BASE_URL` is unset (defaults to `false`)
|
||||
| `DETECT_BASE_URL` | Autodetect the base URL using browser if `BASE_URL` is unset (defaults to `false`)
|
||||
| `PORT` | Port the server will listen on (defaults to `1443`)
|
||||
| `NODE_ENV` | Run in `development` mode (unsafe) or `production` mode (the default)
|
||||
| `SEND_FOOTER_DMCA_URL` | A URL to a contact page for DMCA requests (empty / not shown by default)
|
||||
|
@ -49,6 +49,8 @@ Configure the limits for uploads and downloads. Long expiration times are risky
|
|||
| `MAX_DOWNLOADS` | Maximum number of downloads (defaults to `100`)
|
||||
| `DOWNLOAD_COUNTS` | Download limit options to show in UI dropdown, e.g. `10,1,2,5,10,15,25,50,100,1000`
|
||||
| `EXPIRE_TIMES_SECONDS` | Expire time options to show in UI dropdown, e.g. `3600,86400,604800,2592000,31536000`
|
||||
| `DEFAULT_DOWNLOADS` | Default download limit in UI (defaults to `1`)
|
||||
| `DEFAULT_EXPIRE_SECONDS` | Default expire time in UI (defaults to `86400`)
|
||||
|
||||
*Note: more options can be found here: https://github.com/timvisee/send/blob/master/server/config.js*
|
||||
|
||||
|
@ -89,7 +91,7 @@ $ docker run -p 1443:1443 \
|
|||
registry.gitlab.com/timvisee/send:latest
|
||||
```
|
||||
|
||||
*Note: make sure to replace the example values above with your real values before running.*
|
||||
*Note: make sure to replace the example values above with your real values before running.*
|
||||
|
||||
|
||||
**Run totally self-hosted using the current filesystem directry (`$PWD`) to store the Redis data and file uploads, with a `5GB` upload limit, 1 month expiry, and contact URL set.**
|
||||
|
|
2954
package-lock.json
generated
2954
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "send",
|
||||
"description": "File Sharing Experiment",
|
||||
"version": "3.4.11",
|
||||
"version": "3.4.13",
|
||||
"author": "Mozilla (https://mozilla.org)",
|
||||
"contributors": [
|
||||
"Tim Visee <3a4fb3964f@sinenomine.email> (https://timvisee.com)"
|
||||
|
@ -37,9 +37,7 @@
|
|||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged",
|
||||
"pre-push": "npm test",
|
||||
"post-merge": "npm install",
|
||||
"post-checkout": "scripts/sync-npm-dependencies.sh"
|
||||
"pre-push": "npm test"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
|
@ -64,10 +62,10 @@
|
|||
"node": "^15.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||
"@babel/core": "^7.15.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||
"@babel/preset-env": "^7.14.2",
|
||||
"@babel/preset-env": "^7.15.0",
|
||||
"@dannycoates/webcrypto-liner": "^0.1.37",
|
||||
"@fullhuman/postcss-purgecss": "^1.3.0",
|
||||
"@mattiasbuelens/web-streams-polyfill": "0.2.1",
|
||||
|
@ -78,7 +76,7 @@
|
|||
"base64-js": "^1.5.1",
|
||||
"content-disposition": "^0.5.3",
|
||||
"copy-webpack-plugin": "^5.1.2",
|
||||
"core-js": "^3.12.1",
|
||||
"core-js": "^3.16.1",
|
||||
"crc": "^3.8.0",
|
||||
"cross-env": "^6.0.3",
|
||||
"css-loader": "^3.6.0",
|
||||
|
@ -135,22 +133,22 @@
|
|||
"@dannycoates/express-ws": "^5.0.3",
|
||||
"@fluent/bundle": "^0.13.0",
|
||||
"@fluent/langneg": "^0.3.0",
|
||||
"@google-cloud/storage": "^5.8.5",
|
||||
"@google-cloud/storage": "^5.12.0",
|
||||
"@sentry/node": "^5.30.0",
|
||||
"aws-sdk": "^2.909.0",
|
||||
"aws-sdk": "^2.963.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"choo": "^7.0.0",
|
||||
"cldr-core": "^35.1.0",
|
||||
"configstore": "github:dannycoates/configstore#master",
|
||||
"convict": "^5.2.0",
|
||||
"convict": "^5.2.1",
|
||||
"express": "^4.17.1",
|
||||
"helmet": "^3.23.3",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mozlog": "^2.2.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"redis": "^2.8.0",
|
||||
"redis": "^3.1.1",
|
||||
"redis-mock": "^0.47.0",
|
||||
"selenium-standalone": "^6.23.0",
|
||||
"selenium-standalone": "^6.24.0",
|
||||
"ua-parser-js": "^0.7.28"
|
||||
},
|
||||
"availableLanguages": [
|
||||
|
|
|
@ -15,6 +15,7 @@ module.exports = {
|
|||
FOOTER_SOURCE_URL: config.footer_source_url
|
||||
},
|
||||
DEFAULTS: {
|
||||
DOWNLOADS: config.default_downloads,
|
||||
DOWNLOAD_COUNTS: config.download_counts,
|
||||
EXPIRE_TIMES_SECONDS: config.expire_times_seconds,
|
||||
EXPIRE_SECONDS: config.default_expire_seconds
|
||||
|
|
|
@ -64,6 +64,11 @@ const conf = convict({
|
|||
default: [1, 2, 3, 4, 5, 20, 50, 100],
|
||||
env: 'DOWNLOAD_COUNTS'
|
||||
},
|
||||
default_downloads: {
|
||||
format: Number,
|
||||
default: 1,
|
||||
env: 'DEFAULT_DOWNLOADS'
|
||||
},
|
||||
max_downloads: {
|
||||
format: Number,
|
||||
default: 100,
|
||||
|
|
|
@ -26,7 +26,7 @@ module.exports = function(ws, req) {
|
|||
|
||||
const fileInfo = JSON.parse(message);
|
||||
const timeLimit = fileInfo.timeLimit || config.default_expire_seconds;
|
||||
const dlimit = fileInfo.dlimit || 1;
|
||||
const dlimit = fileInfo.dlimit || config.default_downloads;
|
||||
const metadata = fileInfo.fileMetadata;
|
||||
const auth = fileInfo.authorization;
|
||||
const user = await fxa.verify(fileInfo.bearer);
|
||||
|
|
Loading…
Reference in New Issue
Block a user