Fix: server nuxt client directly without proxy

This commit is contained in:
Aram Becker 2023-05-02 10:44:32 +02:00
parent 57994ffb5b
commit a8b7c56bec
7 changed files with 30 additions and 49 deletions

View file

@ -1,5 +1,5 @@
<template>
<div class="text-white max-h-screen h-screen overflow-hidden bg-bg">
<div class="h-screen max-h-screen overflow-hidden text-white bg-bg">
<app-appbar />
<app-side-rail v-if="isShowingSideRail" class="hidden md:block" />
@ -368,6 +368,7 @@ export default {
initializeSocket() {
this.socket = this.$nuxtSocket({
name: process.env.NODE_ENV === 'development' ? 'dev' : 'prod',
channel: this.$config.routerBasePath,
persist: 'main',
teardown: false,
transports: ['websocket'],

View file

@ -33,13 +33,12 @@ export default function rewritePwaManifest () {
const currentBasePath = manifest.start_url.split('?')[0]
if (currentBasePath !== routerBasePath) {
if (currentBasePath !== (routerBasePath || '/')) {
// Rewrite start_url and icons paths
manifest.start_url = `${routerBasePath || '/'}${manifest.start_url.slice(currentBasePath.length)}`
manifest.start_url = `${routerBasePath}${manifest.start_url.slice(currentBasePath.length)}`
for (const icon of manifest.icons) {
icon.src = currentBasePath.startsWith('.')
? `${routerBasePath}${icon.src}` // Initially, the start_url is `./`
: `${routerBasePath}/${icon.src.slice(currentBasePath.length)}`
const path = icon.src.startsWith('/') ? icon.src.slice(currentBasePath.length) : icon.src
icon.src = `${routerBasePath}${path}`
}
// Update manifest file

View file

@ -117,11 +117,11 @@ module.exports = ({ command }) => ({
background_color: '#373838',
icons: [
{
src: '/icon.svg',
src: 'icon.svg',
sizes: "any"
},
{
src: '/icon64.png',
src: 'icon64.png',
type: "image/png",
sizes: "64x64"
}
@ -151,7 +151,7 @@ module.exports = ({ command }) => ({
}
},
server: {
port: process.env.CLIENT_PORT || 3000,
port: process.env.NODE_ENV === 'production' ? 80 : 3000,
host: '0.0.0.0'
},