Add configurable donate, CLI and DMCA and source links in footer
This commit is contained in:
parent
7f3da34318
commit
6960cc75fa
|
@ -69,9 +69,10 @@ function body(main) {
|
||||||
(async function start() {
|
(async function start() {
|
||||||
const translate = await getTranslator('en-US');
|
const translate = await getTranslator('en-US');
|
||||||
setTranslate(translate);
|
setTranslate(translate);
|
||||||
const { LIMITS, DEFAULTS } = await getConstants();
|
const { LIMITS, WEB_UI, DEFAULTS } = await getConstants();
|
||||||
app.use(state => {
|
app.use(state => {
|
||||||
state.LIMITS = LIMITS;
|
state.LIMITS = LIMITS;
|
||||||
|
state.WEB_UI = WEB_UI;
|
||||||
state.DEFAULTS = DEFAULTS;
|
state.DEFAULTS = DEFAULTS;
|
||||||
state.translate = translate;
|
state.translate = translate;
|
||||||
state.capabilities = {
|
state.capabilities = {
|
||||||
|
|
|
@ -51,6 +51,7 @@ if (process.env.NODE_ENV === 'production') {
|
||||||
window.initialState = {
|
window.initialState = {
|
||||||
LIMITS,
|
LIMITS,
|
||||||
DEFAULTS,
|
DEFAULTS,
|
||||||
|
WEB_UI,
|
||||||
PREFS,
|
PREFS,
|
||||||
archive: new Archive([], DEFAULTS.EXPIRE_SECONDS),
|
archive: new Archive([], DEFAULTS.EXPIRE_SECONDS),
|
||||||
capabilities,
|
capabilities,
|
||||||
|
|
|
@ -13,6 +13,58 @@ class Footer extends Component {
|
||||||
|
|
||||||
createElement() {
|
createElement() {
|
||||||
const translate = this.state.translate;
|
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`
|
return html`
|
||||||
<footer
|
<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"
|
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"
|
||||||
|
@ -21,11 +73,7 @@ class Footer extends Component {
|
||||||
<ul
|
<ul
|
||||||
class="flex flex-col md:flex-row items-start md:items-center md:justify-end"
|
class="flex flex-col md:flex-row items-start md:items-center md:justify-end"
|
||||||
>
|
>
|
||||||
<li class="m-2">
|
${links}
|
||||||
<a href="https://gitlab.com/timvisee/send"
|
|
||||||
>${translate('footerLinkSource')}</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</footer>
|
</footer>
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -16,6 +16,7 @@ class Header extends Component {
|
||||||
this.account.render();
|
this.account.render();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
createElement() {
|
createElement() {
|
||||||
const title =
|
const title =
|
||||||
platform() === 'android'
|
platform() === 'android'
|
||||||
|
|
|
@ -29,6 +29,9 @@ updateFirefox = Update Firefox
|
||||||
deletePopupCancel = Cancel
|
deletePopupCancel = Cancel
|
||||||
deleteButtonHover = Delete
|
deleteButtonHover = Delete
|
||||||
footerText = Not affiliated with Mozilla or Firefox.
|
footerText = Not affiliated with Mozilla or Firefox.
|
||||||
|
footerLinkDonate = Donate
|
||||||
|
footerLinkCli = CLI
|
||||||
|
footerLinkDmca = DMCA
|
||||||
footerLinkSource = Source
|
footerLinkSource = Source
|
||||||
passwordTryAgain = Incorrect password. Try again.
|
passwordTryAgain = Incorrect password. Try again.
|
||||||
javascriptRequired = Send requires JavaScript
|
javascriptRequired = Send requires JavaScript
|
||||||
|
|
|
@ -27,6 +27,9 @@ updateFirefox = Update Firefox
|
||||||
deletePopupCancel = Cancel
|
deletePopupCancel = Cancel
|
||||||
deleteButtonHover = Delete
|
deleteButtonHover = Delete
|
||||||
footerText = Not affiliated with Mozilla or Firefox.
|
footerText = Not affiliated with Mozilla or Firefox.
|
||||||
|
footerLinkDonate = Donate
|
||||||
|
footerLinkCli = CLI
|
||||||
|
footerLinkDmca = DMCA
|
||||||
footerLinkSource = Source
|
footerLinkSource = Source
|
||||||
passwordTryAgain = Incorrect password. Try again.
|
passwordTryAgain = Incorrect password. Try again.
|
||||||
javascriptRequired = Send requires JavaScript
|
javascriptRequired = Send requires JavaScript
|
||||||
|
|
|
@ -29,6 +29,9 @@ updateFirefox = Firefox bijwerken
|
||||||
deletePopupCancel = Annuleren
|
deletePopupCancel = Annuleren
|
||||||
deleteButtonHover = Verwijderen
|
deleteButtonHover = Verwijderen
|
||||||
footerText = Niet aangesloten aan Mozilla of Firefox.
|
footerText = Niet aangesloten aan Mozilla of Firefox.
|
||||||
|
footerLinkDonate = Doneren
|
||||||
|
footerLinkCli = CLI
|
||||||
|
footerLinkDmca = DMCA
|
||||||
footerLinkSource = Broncode
|
footerLinkSource = Broncode
|
||||||
passwordTryAgain = Onjuist wachtwoord. Probeer het opnieuw.
|
passwordTryAgain = Onjuist wachtwoord. Probeer het opnieuw.
|
||||||
javascriptRequired = Send vereist JavaScript
|
javascriptRequired = Send vereist JavaScript
|
||||||
|
|
|
@ -13,6 +13,12 @@ module.exports = {
|
||||||
MAX_FILES_PER_ARCHIVE: config.max_files_per_archive,
|
MAX_FILES_PER_ARCHIVE: config.max_files_per_archive,
|
||||||
MAX_ARCHIVES_PER_USER: config.max_archives_per_user
|
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: {
|
DEFAULTS: {
|
||||||
DOWNLOAD_COUNTS: config.download_counts,
|
DOWNLOAD_COUNTS: config.download_counts,
|
||||||
EXPIRE_TIMES_SECONDS: config.expire_times_seconds,
|
EXPIRE_TIMES_SECONDS: config.expire_times_seconds,
|
||||||
|
|
|
@ -194,6 +194,26 @@ const conf = convict({
|
||||||
format: String,
|
format: String,
|
||||||
default: '',
|
default: '',
|
||||||
env: 'IP_DB'
|
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_CLI_URL'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ module.exports = function(state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var LIMITS = ${JSON.stringify(clientConstants.LIMITS)};
|
var LIMITS = ${JSON.stringify(clientConstants.LIMITS)};
|
||||||
|
var WEB_UI = ${JSON.stringify(clientConstants.WEB_UI)};
|
||||||
var DEFAULTS = ${JSON.stringify(clientConstants.DEFAULTS)};
|
var DEFAULTS = ${JSON.stringify(clientConstants.DEFAULTS)};
|
||||||
var PREFS = ${JSON.stringify(state.prefs)};
|
var PREFS = ${JSON.stringify(state.prefs)};
|
||||||
var downloadMetadata = ${
|
var downloadMetadata = ${
|
||||||
|
|
|
@ -6,9 +6,9 @@ class S3Storage {
|
||||||
this.log = log;
|
this.log = log;
|
||||||
const cfg = {};
|
const cfg = {};
|
||||||
if (config.s3_endpoint != '') {
|
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);
|
AWS.config.update(cfg);
|
||||||
this.s3 = new AWS.S3();
|
this.s3 = new AWS.S3();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,9 @@ class S3Storage {
|
||||||
}
|
}
|
||||||
|
|
||||||
getStream(id) {
|
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) {
|
set(id, file) {
|
||||||
|
|
Loading…
Reference in New Issue