feat: footer text override option

This commit is contained in:
NGPixel 2023-02-16 20:45:55 -05:00
parent f972a9c7de
commit e954b50a7a
No known key found for this signature in database
GPG Key ID: 8FDA2F1757F60D63
8 changed files with 31 additions and 3 deletions

View File

@ -83,6 +83,14 @@
:hint='$t(`admin:general.contentLicenseHint`)' :hint='$t(`admin:general.contentLicenseHint`)'
persistent-hint persistent-hint
) )
v-text-field.mt-3(
outlined
:label='$t(`admin:general.footerOverride`)'
v-model='config.footerOverride'
prepend-icon='mdi-page-layout-footer'
persistent-hint
:hint='$t(`admin:general.footerOverrideHint`)'
)
v-divider v-divider
.overline.grey--text.pa-4 SEO .overline.grey--text.pa-4 SEO
.px-3.pb-3 .px-3.pb-3
@ -280,6 +288,7 @@ export default {
analyticsId: '', analyticsId: '',
company: '', company: '',
contentLicense: '', contentLicense: '',
footerOverride: '',
logoUrl: '', logoUrl: '',
featureAnalytics: false, featureAnalytics: false,
featurePageRatings: false, featurePageRatings: false,
@ -308,6 +317,7 @@ export default {
logoUrl: sync('site/logoUrl'), logoUrl: sync('site/logoUrl'),
company: sync('site/company'), company: sync('site/company'),
contentLicense: sync('site/contentLicense'), contentLicense: sync('site/contentLicense'),
footerOverride: sync('site/footerOverride'),
activeModal: sync('editor/activeModal'), activeModal: sync('editor/activeModal'),
contentLicenses () { contentLicenses () {
return [ return [
@ -346,6 +356,7 @@ export default {
$analyticsId: String $analyticsId: String
$company: String $company: String
$contentLicense: String $contentLicense: String
$footerOverride: String
$logoUrl: String $logoUrl: String
$pageExtensions: String $pageExtensions: String
$featurePageRatings: Boolean $featurePageRatings: Boolean
@ -369,6 +380,7 @@ export default {
analyticsId: $analyticsId analyticsId: $analyticsId
company: $company company: $company
contentLicense: $contentLicense contentLicense: $contentLicense
footerOverride: $footerOverride
logoUrl: $logoUrl logoUrl: $logoUrl
pageExtensions: $pageExtensions pageExtensions: $pageExtensions
featurePageRatings: $featurePageRatings featurePageRatings: $featurePageRatings
@ -401,6 +413,7 @@ export default {
analyticsId: _.get(this.config, 'analyticsId', ''), analyticsId: _.get(this.config, 'analyticsId', ''),
company: _.get(this.config, 'company', ''), company: _.get(this.config, 'company', ''),
contentLicense: _.get(this.config, 'contentLicense', ''), contentLicense: _.get(this.config, 'contentLicense', ''),
footerOverride: _.get(this.config, 'footerOverride', ''),
logoUrl: _.get(this.config, 'logoUrl', ''), logoUrl: _.get(this.config, 'logoUrl', ''),
pageExtensions: _.get(this.config, 'pageExtensions', ''), pageExtensions: _.get(this.config, 'pageExtensions', ''),
featurePageRatings: _.get(this.config, 'featurePageRatings', false), featurePageRatings: _.get(this.config, 'featurePageRatings', false),
@ -426,6 +439,7 @@ export default {
this.siteTitle = this.config.title this.siteTitle = this.config.title
this.company = this.config.company this.company = this.config.company
this.contentLicense = this.config.contentLicense this.contentLicense = this.config.contentLicense
this.footerOverride = this.config.footerOverride
this.logoUrl = this.config.logoUrl this.logoUrl = this.config.logoUrl
} catch (err) { } catch (err) {
this.$store.commit('pushGraphError', err) this.$store.commit('pushGraphError', err)
@ -461,6 +475,7 @@ export default {
analyticsId analyticsId
company company
contentLicense contentLicense
footerOverride
logoUrl logoUrl
pageExtensions pageExtensions
featurePageRatings featurePageRatings

View File

@ -5,6 +5,7 @@ import { make } from 'vuex-pathify'
const state = { const state = {
company: siteConfig.company, company: siteConfig.company,
contentLicense: siteConfig.contentLicense, contentLicense: siteConfig.contentLicense,
footerOverride: siteConfig.footerOverride,
dark: siteConfig.darkMode, dark: siteConfig.darkMode,
tocPosition: siteConfig.tocPosition, tocPosition: siteConfig.tocPosition,
mascot: true, mascot: true,

View File

@ -1,7 +1,9 @@
<template lang="pug"> <template lang="pug">
v-footer.justify-center(:color='bgColor', inset) v-footer.justify-center(:color='bgColor', inset)
.caption.grey--text(:class='$vuetify.theme.dark ? `text--lighten-1` : `text--darken-1`') .caption.grey--text(:class='$vuetify.theme.dark ? `text--lighten-1` : `text--darken-1`')
template(v-if='company && company.length > 0 && contentLicense !== ``') template(v-if='footerOverride')
span {{footerOverride}} |&nbsp;
template(v-else-if='company && company.length > 0 && contentLicense !== ``')
span(v-if='contentLicense === `alr`') {{ $t('common:footer.copyright', { company: company, year: currentYear, interpolation: { escapeValue: false } }) }} |&nbsp; span(v-if='contentLicense === `alr`') {{ $t('common:footer.copyright', { company: company, year: currentYear, interpolation: { escapeValue: false } }) }} |&nbsp;
span(v-else) {{ $t('common:footer.license', { company: company, license: $t('common:license.' + contentLicense), interpolation: { escapeValue: false } }) }} |&nbsp; span(v-else) {{ $t('common:footer.license', { company: company, license: $t('common:license.' + contentLicense), interpolation: { escapeValue: false } }) }} |&nbsp;
span {{ $t('common:footer.poweredBy') }} #[a(href='https://wiki.js.org', ref='nofollow') Wiki.js] span {{ $t('common:footer.poweredBy') }} #[a(href='https://wiki.js.org', ref='nofollow') Wiki.js]
@ -29,6 +31,7 @@ export default {
computed: { computed: {
company: get('site/company'), company: get('site/company'),
contentLicense: get('site/contentLicense'), contentLicense: get('site/contentLicense'),
footerOverride: get('site/footerOverride'),
bgColor() { bgColor() {
if (!this.$vuetify.theme.dark) { if (!this.$vuetify.theme.dark) {
return this.color return this.color

View File

@ -44,6 +44,7 @@ defaults:
title: Wiki.js title: Wiki.js
company: '' company: ''
contentLicense: '' contentLicense: ''
footerOverride: ''
logoUrl: https://static.requarks.io/logo/wikijs-butterfly.svg logoUrl: https://static.requarks.io/logo/wikijs-butterfly.svg
pageExtensions: pageExtensions:
- md - md

View File

@ -17,6 +17,7 @@ module.exports = {
title: WIKI.config.title, title: WIKI.config.title,
company: WIKI.config.company, company: WIKI.config.company,
contentLicense: WIKI.config.contentLicense, contentLicense: WIKI.config.contentLicense,
footerOverride: WIKI.config.footerOverride,
logoUrl: WIKI.config.logoUrl, logoUrl: WIKI.config.logoUrl,
pageExtensions: WIKI.config.pageExtensions.join(', '), pageExtensions: WIKI.config.pageExtensions.join(', '),
...WIKI.config.seo, ...WIKI.config.seo,
@ -60,6 +61,10 @@ module.exports = {
WIKI.config.contentLicense = args.contentLicense WIKI.config.contentLicense = args.contentLicense
} }
if (args.hasOwnProperty('footerOverride')) {
WIKI.config.footerOverride = args.footerOverride
}
if (args.hasOwnProperty('logoUrl')) { if (args.hasOwnProperty('logoUrl')) {
WIKI.config.logoUrl = _.trim(args.logoUrl) WIKI.config.logoUrl = _.trim(args.logoUrl)
} }
@ -120,7 +125,7 @@ module.exports = {
forceDownload: _.get(args, 'uploadForceDownload', WIKI.config.uploads.forceDownload) forceDownload: _.get(args, 'uploadForceDownload', WIKI.config.uploads.forceDownload)
} }
await WIKI.configSvc.saveToDb(['host', 'title', 'company', 'contentLicense', 'seo', 'logoUrl', 'pageExtensions', 'auth', 'editShortcuts', 'features', 'security', 'uploads']) await WIKI.configSvc.saveToDb(['host', 'title', 'company', 'contentLicense', 'footerOverride', 'seo', 'logoUrl', 'pageExtensions', 'auth', 'editShortcuts', 'features', 'security', 'uploads'])
if (WIKI.config.security.securityTrustProxy) { if (WIKI.config.security.securityTrustProxy) {
WIKI.app.enable('trust proxy') WIKI.app.enable('trust proxy')

View File

@ -32,6 +32,7 @@ type SiteMutation {
analyticsId: String analyticsId: String
company: String company: String
contentLicense: String contentLicense: String
footerOverride: String
logoUrl: String logoUrl: String
pageExtensions: String pageExtensions: String
authAutoLogin: Boolean authAutoLogin: Boolean
@ -81,6 +82,7 @@ type SiteConfig {
analyticsId: String analyticsId: String
company: String company: String
contentLicense: String contentLicense: String
footerOverride: String
logoUrl: String logoUrl: String
pageExtensions: String pageExtensions: String
authAutoLogin: Boolean authAutoLogin: Boolean

View File

@ -154,6 +154,7 @@ module.exports = async () => {
rtl: WIKI.config.lang.rtl, rtl: WIKI.config.lang.rtl,
company: WIKI.config.company, company: WIKI.config.company,
contentLicense: WIKI.config.contentLicense, contentLicense: WIKI.config.contentLicense,
footerOverride: WIKI.config.footerOverride,
logoUrl: WIKI.config.logoUrl logoUrl: WIKI.config.logoUrl
} }
res.locals.langs = await WIKI.models.locales.getNavLocales({ cache: true }) res.locals.langs = await WIKI.models.locales.getNavLocales({ cache: true })

View File

@ -160,7 +160,7 @@ module.exports = {
fNames.old = fMatch[1] fNames.old = fMatch[1]
fNames.new = fMatch[4] fNames.new = fMatch[4]
} else { } else {
fNames.old = (fMatch[1] + fMatch[2] + fMatch[4]).replace('//', '/'), fNames.old = (fMatch[1] + fMatch[2] + fMatch[4]).replace('//', '/')
fNames.new = (fMatch[1] + fMatch[3] + fMatch[4]).replace('//', '/') fNames.new = (fMatch[1] + fMatch[3] + fMatch[4]).replace('//', '/')
} }
const fPath = path.join(this.repoPath, fNames.new) const fPath = path.join(this.repoPath, fNames.new)