Compare commits

...

17 Commits

Author SHA1 Message Date
timvisee
0806b8fd9d Bump version to 3.4.3 2021-02-05 02:31:15 +01:00
timvisee
2dbc740998 Update dependencies 2021-02-05 02:29:19 +01:00
timvisee
5b9c8301c7 Fix incorrect environment variable for config property 2021-02-05 02:24:48 +01:00
timvisee
42506dda9d Bump version to 3.4.2 2021-01-27 13:38:58 +01:00
timvisee
8e868a642c Fix footer, properly layout no affiliation notice on small screens 2021-01-27 13:34:26 +01:00
timvisee
638f68334a Bump version to 3.4.1 2021-01-27 00:35:26 +01:00
timvisee
d2907c6d8b Add missing global variable to linter configuration to fix lint test 2021-01-27 00:30:44 +01:00
timvisee
4b05a2f705 Update dependencies 2021-01-27 00:25:04 +01:00
timvisee
6960cc75fa Add configurable donate, CLI and DMCA and source links in footer 2021-01-27 00:21:03 +01:00
timvisee
7f3da34318 Update Docker configuration 2021-01-26 20:22:04 +01:00
timvisee
4369baa258 Add S3 lifecycle policy example configuration 2021-01-26 20:14:09 +01:00
timvisee
6f1942a446 Add clients section in README 2021-01-24 21:38:05 +01:00
timvisee
b6d2e7c1ca Update dependencies 2021-01-18 16:04:11 +01:00
timvisee
58dd5b7a70 Merge branch 'dependabot/npm_and_yarn/ini-1.3.8' 2021-01-10 23:01:20 +01:00
timvisee
4f3a2e4fc1 Merge branch 'dependabot/npm_and_yarn/ini-1.3.8' 2021-01-10 23:00:03 +01:00
timvisee
a798b14620 Merge branch 'master' into dependabot/npm_and_yarn/ini-1.3.8 2021-01-10 22:59:42 +01:00
dependabot[bot]
2bc1a13ae6 Bump ini from 1.3.5 to 1.3.8
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-09 18:20:00 +00:00
17 changed files with 1300 additions and 1275 deletions

View File

@@ -68,7 +68,7 @@ Thanks [Mozilla][mozilla] for building this amazing tool!
* [Contributing](#contributing)
* [Testing](#testing)
* [Deployment](#deployment)
* [Android](#android)
* [Clients](#clients)
* [License](#license)
---
@@ -149,9 +149,18 @@ see also [docs/deployment.md](docs/deployment.md)
---
## Android
## Clients
The android implementation is contained in the `android` directory, and can be viewed locally for easy testing and editing by running `ANDROID=1 npm start` and then visiting <http://localhost:8080>. CSS and image files are located in the `android/app/src/main/assets` directory.
- Web: _this repository_
- Command-line: [`ffsend`](https://github.com/timvisee/ffsend)
- Android: _see [Android](#android) section_
#### Android
The android implementation is contained in the `android` directory,
and can be viewed locally for easy testing and editing by running `ANDROID=1 npm
start` and then visiting <http://localhost:8080>. CSS and image files are
located in the `android/app/src/main/assets` directory.
---

View File

@@ -69,9 +69,10 @@ function body(main) {
(async function start() {
const translate = await getTranslator('en-US');
setTranslate(translate);
const { LIMITS, DEFAULTS } = await getConstants();
const { LIMITS, WEB_UI, DEFAULTS } = await getConstants();
app.use(state => {
state.LIMITS = LIMITS;
state.WEB_UI = WEB_UI;
state.DEFAULTS = DEFAULTS;
state.translate = translate;
state.capabilities = {

View File

@@ -134,7 +134,7 @@ details[open] > summary > svg {
transform: rotate(90deg);
}
footer li:hover {
footer li a:hover {
text-decoration: underline;
}

View File

@@ -1,4 +1,4 @@
/* global DEFAULTS LIMITS PREFS */
/* global DEFAULTS LIMITS WEB_UI PREFS */
import 'core-js';
import 'fast-text-encoding'; // MS Edge support
import 'intl-pluralrules';
@@ -51,6 +51,7 @@ if (process.env.NODE_ENV === 'production') {
window.initialState = {
LIMITS,
DEFAULTS,
WEB_UI,
PREFS,
archive: new Archive([], DEFAULTS.EXPIRE_SECONDS),
capabilities,

View File

@@ -13,19 +13,71 @@ class Footer extends Component {
createElement() {
const translate = this.state.translate;
// Add additional links from configuration if available
var links = [];
if (this.state != undefined && this.state.WEB_UI != undefined) {
const WEB_UI = this.state.WEB_UI;
if (WEB_UI.FOOTER_DONATE_URL != '') {
links.push(html`
<li class="m-2">
<a href="${WEB_UI.FOOTER_DONATE_URL}" target="_blank">
${translate('footerLinkDonate')}
</a>
</li>
`);
}
if (WEB_UI.FOOTER_CLI_URL != '') {
links.push(html`
<li class="m-2">
<a href="${WEB_UI.FOOTER_CLI_URL}" target="_blank">
${translate('footerLinkCli')}
</a>
</li>
`);
}
if (WEB_UI.FOOTER_DMCA_URL != '') {
links.push(html`
<li class="m-2">
<a href="${WEB_UI.FOOTER_DMCA_URL}" target="_blank">
${translate('footerLinkDmca')}
</a>
</li>
`);
}
if (WEB_UI.FOOTER_SOURCE_URL != '') {
links.push(html`
<li class="m-2">
<a href="${WEB_UI.FOOTER_SOURCE_URL}" target="_blank">
${translate('footerLinkSource')}
</a>
</li>
`);
}
} else {
links.push(html`
<li class="m-2">
<a href="https://gitlab.com/timvisee/send" target="_blank">
${translate('footerLinkSource')}
</a>
</li>
`);
}
return html`
<footer
class="flex flex-col md:flex-row items-start w-full flex-none self-start p-6 md:p-8 font-medium text-xs text-grey-60 dark:text-grey-40 md:items-center justify-between"
>
<div>${translate('footerText')}</div>
<ul
class="flex flex-col md:flex-row items-start md:items-center md:justify-start"
>
<li class="m-2">${translate('footerText')}</li>
</ul>
<ul
class="flex flex-col md:flex-row items-start md:items-center md:justify-end"
>
<li class="m-2">
<a href="https://gitlab.com/timvisee/send"
>${translate('footerLinkSource')}</a
>
</li>
${links}
</ul>
</footer>
`;

View File

@@ -16,6 +16,7 @@ class Header extends Component {
this.account.render();
return false;
}
createElement() {
const title =
platform() === 'android'

View File

@@ -12,18 +12,24 @@ Or run `docker build -t send:latest .` to create an image locally or `docker-com
| Name | Description
|------------------|-------------|
| `BASE_URL` | The HTTPS URL where traffic will be served (e.g. `https://send.firefox.com`)
| `PORT` | Port the server will listen on (defaults to 1443).
| `NODE_ENV` | `"production"`
| `FILE_DIR` | Uploads directory for local storage
| `S3_BUCKET` | The S3 bucket name.
| `S3_ENDPOINT`| Optional custom S3 endpoint host.
| `S3_USE_PATH_STYLE_ENDPOINTS`| `true` or `false`
| `AWS_ACCESS_KEY_ID` | S3 access key ID
| `AWS_SECRET_ACCESS_KEY` | S3 secret access key ID
| `MAX_FILE_SIZE` | Maximum upload file size in bytes (defaults to 2147483648)
| `MAX_EXPIRE_SECONDS` | Maximum upload expiry time in seconds (defaults to 604800)
| `REDIS_HOST` | Host name of the Redis server.
| `SENTRY_CLIENT` | Sentry Client ID
| `SENTRY_DSN` | Sentry DSN
| `MAX_FILE_SIZE` | in bytes (defaults to 2147483648)
| `NODE_ENV` | "production"
| `BASE_URL` | The HTTPS URL where traffic will be served (e.g. `https://send.firefox.com`)
## Example:
```sh
```bash
$ docker run --net=host -e 'NODE_ENV=production' \
-e 'S3_BUCKET=testpilot-p2p-dev' \
-e 'REDIS_HOST=dyf9s2r4vo3.bolxr4.0001.usw2.cache.amazonaws.com' \
@@ -32,3 +38,9 @@ $ docker run --net=host -e 'NODE_ENV=production' \
-e 'BASE_URL=https://send.firefox.com' \
registry.gitlab.com/timvisee/send:latest
```
## Docker compose
For a Docker compose configuration example, see:
https://github.com/timvisee/send-docker-compose

2362
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "send",
"description": "File Sharing Experiment",
"version": "3.4.0",
"version": "3.4.3",
"author": "Mozilla (https://mozilla.org)",
"contributors": [
"Tim Visee <3a4fb3964f@sinenomine.email> (https://timvisee.com)"
@@ -64,21 +64,21 @@
"node": "^12.16.3"
},
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/core": "^7.12.13",
"@babel/plugin-proposal-class-properties": "^7.12.13",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.12.11",
"@babel/preset-env": "^7.12.13",
"@dannycoates/webcrypto-liner": "^0.1.37",
"@fullhuman/postcss-purgecss": "^1.3.0",
"@mattiasbuelens/web-streams-polyfill": "0.2.1",
"@sentry/browser": "^5.29.2",
"@sentry/browser": "^5.30.0",
"asmcrypto.js": "^0.22.0",
"babel-loader": "^8.2.2",
"babel-plugin-istanbul": "^5.2.0",
"base64-js": "^1.5.1",
"content-disposition": "^0.5.3",
"copy-webpack-plugin": "^5.1.2",
"core-js": "^3.8.2",
"core-js": "^3.8.3",
"crc": "^3.8.0",
"cross-env": "^6.0.3",
"css-loader": "^3.6.0",
@@ -118,7 +118,7 @@
"script-loader": "^0.7.2",
"sinon": "^7.5.0",
"string-hash": "^1.1.3",
"stylelint": "^13.8.0",
"stylelint": "^13.9.0",
"stylelint-config-standard": "^19.0.0",
"stylelint-no-unsupported-browser-features": "^4.1.4",
"svgo": "^1.3.2",
@@ -128,7 +128,7 @@
"webpack": "4.38.0",
"webpack-cli": "^3.3.12",
"webpack-dev-middleware": "^3.7.3",
"webpack-dev-server": "^3.11.1",
"webpack-dev-server": "^3.11.2",
"webpack-manifest-plugin": "^2.2.0",
"webpack-unassert-loader": "^1.2.0"
},
@@ -136,9 +136,9 @@
"@dannycoates/express-ws": "^5.0.3",
"@fluent/bundle": "^0.13.0",
"@fluent/langneg": "^0.3.0",
"@google-cloud/storage": "^5.7.1",
"@sentry/node": "^5.29.2",
"aws-sdk": "^2.824.0",
"@google-cloud/storage": "^5.7.4",
"@sentry/node": "^5.30.0",
"aws-sdk": "^2.838.0",
"body-parser": "^1.19.0",
"choo": "^7.0.0",
"cldr-core": "^35.1.0",

View File

@@ -29,6 +29,9 @@ updateFirefox = Update Firefox
deletePopupCancel = Cancel
deleteButtonHover = Delete
footerText = Not affiliated with Mozilla or Firefox.
footerLinkDonate = Donate
footerLinkCli = CLI
footerLinkDmca = DMCA
footerLinkSource = Source
passwordTryAgain = Incorrect password. Try again.
javascriptRequired = Send requires JavaScript

View File

@@ -27,6 +27,9 @@ updateFirefox = Update Firefox
deletePopupCancel = Cancel
deleteButtonHover = Delete
footerText = Not affiliated with Mozilla or Firefox.
footerLinkDonate = Donate
footerLinkCli = CLI
footerLinkDmca = DMCA
footerLinkSource = Source
passwordTryAgain = Incorrect password. Try again.
javascriptRequired = Send requires JavaScript

View File

@@ -29,6 +29,9 @@ updateFirefox = Firefox bijwerken
deletePopupCancel = Annuleren
deleteButtonHover = Verwijderen
footerText = Niet aangesloten aan Mozilla of Firefox.
footerLinkDonate = Doneren
footerLinkCli = CLI
footerLinkDmca = DMCA
footerLinkSource = Broncode
passwordTryAgain = Onjuist wachtwoord. Probeer het opnieuw.
javascriptRequired = Send vereist JavaScript

39
s3-lifecycle-example.xml Normal file
View File

@@ -0,0 +1,39 @@
<?xml version="1.0" ?>
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<!-- remove files for 1 day after 1 day -->
<Rule>
<ID>1skjet8gxudyans73v3p3d6hvq6yn3w02kq7931h81ohopd3</ID>
<Prefix>1-</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>1</Days>
</Expiration>
</Rule>
<!-- remove files for 7 days after 7 days -->
<Rule>
<ID>1skjet8gxudyans73v3p3d6hvq6yn3w02kq7931h81ohopd4</ID>
<Prefix>7-</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>7</Days>
</Expiration>
</Rule>
<!-- remove all files after 1 month -->
<Rule>
<ID>1skjet8gxudyans73v3p3d6hvq6yn3w02kq7931h81ohopd5</ID>
<Prefix/>
<Status>Enabled</Status>
<Expiration>
<Days>30</Days>
</Expiration>
</Rule>
<!-- remove aborted uploads after 1 day -->
<Rule>
<ID>1skjet8gxudyans73v3p3d6hvq6yn3w02kq7931h81ohopd6</ID>
<Prefix></Prefix>
<Status>Enabled</Status>
<AbortIncompleteMultipartUpload>
<DaysAfterInitiation>1</DaysAfterInitiation>
</AbortIncompleteMultipartUpload>
</Rule>
</LifecycleConfiguration>

View File

@@ -13,6 +13,12 @@ module.exports = {
MAX_FILES_PER_ARCHIVE: config.max_files_per_archive,
MAX_ARCHIVES_PER_USER: config.max_archives_per_user
},
WEB_UI: {
FOOTER_DONATE_URL: config.footer_donate_url,
FOOTER_CLI_URL: config.footer_cli_url,
FOOTER_DMCA_URL: config.footer_dmca_url,
FOOTER_SOURCE_URL: config.footer_source_url
},
DEFAULTS: {
DOWNLOAD_COUNTS: config.download_counts,
EXPIRE_TIMES_SECONDS: config.expire_times_seconds,

View File

@@ -194,6 +194,26 @@ const conf = convict({
format: String,
default: '',
env: 'IP_DB'
},
footer_donate_url: {
format: String,
default: '',
env: 'SEND_FOOTER_DONATE_URL'
},
footer_cli_url: {
format: String,
default: 'https://github.com/timvisee/ffsend',
env: 'SEND_FOOTER_CLI_URL'
},
footer_dmca_url: {
format: String,
default: '',
env: 'SEND_FOOTER_DMCA_URL'
},
footer_source_url: {
format: String,
default: 'https://github.com/timvisee/send',
env: 'SEND_FOOTER_SOURCE_URL'
}
});

View File

@@ -43,6 +43,7 @@ module.exports = function(state) {
}
var LIMITS = ${JSON.stringify(clientConstants.LIMITS)};
var WEB_UI = ${JSON.stringify(clientConstants.WEB_UI)};
var DEFAULTS = ${JSON.stringify(clientConstants.DEFAULTS)};
var PREFS = ${JSON.stringify(state.prefs)};
var downloadMetadata = ${

View File

@@ -6,9 +6,9 @@ class S3Storage {
this.log = log;
const cfg = {};
if (config.s3_endpoint != '') {
cfg['endpoint'] = config.s3_endpoint;
cfg['endpoint'] = config.s3_endpoint;
}
cfg['s3ForcePathStyle'] = config.s3_use_path_style_endpoint
cfg['s3ForcePathStyle'] = config.s3_use_path_style_endpoint;
AWS.config.update(cfg);
this.s3 = new AWS.S3();
}
@@ -21,7 +21,9 @@ class S3Storage {
}
getStream(id) {
return this.s3.getObject({ Bucket: this.bucket, Key: id }).createReadStream();
return this.s3
.getObject({ Bucket: this.bucket, Key: id })
.createReadStream();
}
set(id, file) {