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() {
|
||||
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 = {
|
||||
|
|
|
@ -51,6 +51,7 @@ if (process.env.NODE_ENV === 'production') {
|
|||
window.initialState = {
|
||||
LIMITS,
|
||||
DEFAULTS,
|
||||
WEB_UI,
|
||||
PREFS,
|
||||
archive: new Archive([], DEFAULTS.EXPIRE_SECONDS),
|
||||
capabilities,
|
||||
|
|
|
@ -13,6 +13,58 @@ 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"
|
||||
|
@ -21,11 +73,7 @@ class Footer extends Component {
|
|||
<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>
|
||||
`;
|
||||
|
|
|
@ -16,6 +16,7 @@ class Header extends Component {
|
|||
this.account.render();
|
||||
return false;
|
||||
}
|
||||
|
||||
createElement() {
|
||||
const title =
|
||||
platform() === 'android'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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_CLI_URL'
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -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 = ${
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue