feat: support subpath installation?

This commit is contained in:
lesion 2024-07-30 23:35:44 +02:00
parent 3b750c89ab
commit 244a857e1b
No known key found for this signature in database
GPG key ID: 352918250B012177
9 changed files with 21 additions and 19 deletions

View file

@ -10,7 +10,7 @@
:height="height" :width="width" :height="height" :width="width"
:style="{ 'object-position': thumbnailPosition }"> :style="{ 'object-position': thumbnailPosition }">
<img v-else-if='!media && thumb' class='thumb' src="/fallbackimage.png" alt=''> <img v-else-if='!media && thumb' class='thumb' src="fallbackimage.png" alt=''>
</div> </div>
</template> </template>
<script> <script>
@ -32,7 +32,7 @@ export default {
}, },
srcset () { srcset () {
if (this.thumb) return '' if (this.thumb) return ''
return `/media/thumb/${this.media.url} 500w, /media/${this.media.url} 1200w` return `media/thumb/${this.media.url} 500w, media/${this.media.url} 1200w`
}, },
media () { media () {
return this.event.media && this.event.media[0] return this.event.media && this.event.media[0]
@ -45,7 +45,7 @@ export default {
}, },
src () { src () {
if (this.media) { if (this.media) {
return '/media/thumb/' + this.media.url return 'media/thumb/' + this.media.url
} }
if (this.thumb) { if (this.thumb) {
return '/noimg.svg' return '/noimg.svg'

View file

@ -1,13 +1,13 @@
<template> <template>
<div class='d-flex pa-4'> <div class='d-flex pa-4'>
<v-btn icon large nuxt to='/'> <v-btn icon large nuxt to='/'>
<img src='/logo.png' height='40' /> <img src='logo.png' height='40' />
</v-btn> </v-btn>
<v-spacer/> <v-spacer/>
<div class='d-flex'> <div class='d-flex'>
<v-btn icon large href='/about' :title='$t("common.about")' :aria-label='$t("common.about")'> <v-btn icon large href='about' :title='$t("common.about")' :aria-label='$t("common.about")'>
<v-icon v-text='mdiInformation' /> <v-icon v-text='mdiInformation' />
</v-btn> </v-btn>
<v-btn icon large @click='toggleDark'> <v-btn icon large @click='toggleDark'>

View file

@ -27,7 +27,7 @@ v-container
accept='image/*') accept='image/*')
template(slot='append-outer') template(slot='append-outer')
v-btn(color='warning' text @click='resetLogo') <v-icon v-text='mdiRestore'></v-icon> {{$t('common.reset')}} v-btn(color='warning' text @click='resetLogo') <v-icon v-text='mdiRestore'></v-icon> {{$t('common.reset')}}
v-img.mt-2(:src='`/logo.png?${logoKey}`' max-height="60px" contain) v-img.mt-2(:src='`logo.png?${logoKey}`' max-height="60px" contain)
v-col(cols='4') v-col(cols='4')
//- FALLBACK IMAGE //- FALLBACK IMAGE
@ -38,7 +38,7 @@ v-container
accept='image/*') accept='image/*')
template(slot='append-outer') template(slot='append-outer')
v-btn(color='warning' text @click='resetFallbackImage') <v-icon v-text='mdiRestore'></v-icon> {{$t('common.reset')}} v-btn(color='warning' text @click='resetFallbackImage') <v-icon v-text='mdiRestore'></v-icon> {{$t('common.reset')}}
v-img.mt-2(:src='`/fallbackimage.png?${fallbackImageKey}`' max-height="150px" contain) v-img.mt-2(:src='`fallbackimage.png?${fallbackImageKey}`' max-height="150px" contain)
v-col(cols='4') v-col(cols='4')
//- HEADER IMAGE //- HEADER IMAGE
@ -49,7 +49,7 @@ v-container
accept='image/*') accept='image/*')
template(slot='append-outer') template(slot='append-outer')
v-btn(color='warning' text @click='resetHeaderImage') <v-icon v-text='mdiRestore'></v-icon> {{$t('common.reset')}} v-btn(color='warning' text @click='resetHeaderImage') <v-icon v-text='mdiRestore'></v-icon> {{$t('common.reset')}}
v-img.mt-2(:src='`/headerimage.png?${headerImageKey}`' max-height="150px" contain) v-img.mt-2(:src='`headerimage.png?${headerImageKey}`' max-height="150px" contain)
v-card-title {{$t('admin.colors')}} v-card-title {{$t('admin.colors')}}

View file

@ -23,18 +23,18 @@ import { mapState, mapGetters } from 'vuex'
export default { export default {
head () { head () {
const custom_script = [{ type: 'application/javascript', defer: true, src: '/custom_js', body: true }] const custom_script = [{ type: 'application/javascript', defer: true, src: 'custom_js', body: true }]
const custom_style = [{ rel: 'stylesheet', href: this.settings.baseurl + '/custom_css'}] const custom_style = [{ rel: 'stylesheet', href: 'custom_css'}]
return { return {
htmlAttrs: { htmlAttrs: {
lang: this.locale lang: this.locale
}, },
link: [ link: [
{ rel: 'icon', type: 'image/png', href: this.settings.baseurl + '/logo.png' }, { rel: 'icon', type: 'image/png', href: 'logo.png' },
...custom_style ...custom_style
], ],
script: [ script: [
{ src: '/gancio-events.es.js', body: true, defer: true }, { src: 'gancio-events.es.js', body: true, defer: true },
...custom_script ...custom_script
] ]
} }

View file

@ -317,7 +317,7 @@
"hide_thumbs": "Hide thumbs", "hide_thumbs": "Hide thumbs",
"hide_calendar": "Hide calendar", "hide_calendar": "Hide calendar",
"default_images": "Default images", "default_images": "Default images",
"default_images_help": "You have to <a href='/admin?tab=theme'>refresh</a> the page to see the changes.", "default_images_help": "You have to <a href='admin?tab=theme'>refresh</a> the page to see the changes.",
"blocked": "Blocked", "blocked": "Blocked",
"domain": "Domain", "domain": "Domain",
"known_users": "Known users", "known_users": "Known users",
@ -368,7 +368,7 @@
"confirm": { "confirm": {
"title": "User confirmation", "title": "User confirmation",
"not_valid": "Something went wrong.", "not_valid": "Something went wrong.",
"valid": "Your account is confirmed, you can now <a href=\"/login\">log in</a>" "valid": "Your account is confirmed, you can now <a href=\"login\">log in</a>"
}, },
"ordinal": { "ordinal": {
"1": "first", "1": "first",

View file

@ -1,10 +1,10 @@
export default async (context, locale) => { export default async (context, locale) => {
try { try {
if (process.server) { if (process.server) {
return context.$axios.$get(`locale/${locale}`) return fetch(`${context.res.locals.settings.baseurl}/api/locale/${locale}`).then(ret => ret.json())
} else { } else {
// cannot use $axios here as plugins have not yet been loaded // cannot use $axios here as plugins have not yet been loaded
return fetch(`${window.location.origin}/api/locale/${locale}`).then(ret => ret.json()) return fetch(`${context.store.state.settings.baseurl}/api/locale/${locale}`).then(ret => ret.json())
} }
} catch (e) { } catch (e) {
console.error(`Error loading locale ${locale}`, e) console.error(`Error loading locale ${locale}`, e)

View file

@ -61,7 +61,9 @@ module.exports = {
'@nuxtjs/sitemap', '@nuxtjs/sitemap',
['cookie-universal-nuxt', { alias: 'cookies' }], ['cookie-universal-nuxt', { alias: 'cookies' }],
], ],
router: {
base: new URL(config?.baseurl)?.pathname ?? '/'
},
sitemap: { sitemap: {
hostname: config.baseurl, hostname: config.baseurl,
gzip: true, gzip: true,

View file

@ -98,7 +98,7 @@ export default {
async asyncData ({ $axios, req }) { async asyncData ({ $axios, req }) {
let url let url
if (process.client) { if (process.client) {
url = window.location.protocol + '//' + window.location.host url = document.baseURI
} else { } else {
url = req.protocol + '://' + req.headers.host url = req.protocol + '://' + req.headers.host
} }

View file

@ -1,6 +1,6 @@
export default function ({ $axios, store }) { export default function ({ $axios, store }) {
if (process.client) { if (process.client) {
$axios.setBaseURL(window.location.origin + '/api') $axios.setBaseURL(store.state.settings.baseurl + '/api')
} else { } else {
const config = require('../server/config') const config = require('../server/config')
$axios.setBaseURL(config.baseurl + '/api') $axios.setBaseURL(config.baseurl + '/api')