H-162: serve built frontend from Go image (#34)

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-15 20:49:26 +08:00
committed by GitHub
co-authored by rogee
parent e61f5b252f
commit 21a9a6793d
10 changed files with 183 additions and 122 deletions
@@ -1,3 +1,5 @@
import './dashboardConfig';
import { createApp } from 'vue';
import { createI18n } from 'vue-i18n';
@@ -0,0 +1,60 @@
const config = window.__GOCHAT_CONFIG__ || {};
window.chatwootConfig = Object.assign(
{
hostURL: '',
helpCenterURL: '',
fbAppId: '',
instagramAppId: '',
tiktokAppId: '',
googleOAuthClientId: '',
googleOAuthCallbackUrl: '',
allowedLoginMethods: ['email'],
fbApiVersion: '',
whatsappAppId: '',
whatsappConfigurationId: '',
whatsappApiVersion: '',
signupEnabled: 'false',
isMfaEnabled: 'false',
inboxEventsEnabled: 'false',
selectedLocale: 'zh_CN',
enabledLanguages: [
{ name: '中文', iso_639_1_code: 'zh_CN' },
{ name: 'English', iso_639_1_code: 'en' },
],
helpUrls: {},
},
config
);
window.globalConfig = Object.assign(
{
INSTALLATION_NAME: 'GoChat',
CREATE_NEW_ACCOUNT_FROM_DASHBOARD: false,
DISPLAY_MANIFEST: false,
LOGO_THUMBNAIL: '/favicon-32x32.png',
},
config.globalConfig || {}
);
window.errorLoggingConfig = '';
window.browserConfig = { browser_name: navigator.userAgent };
try {
const sessionCookie = document.cookie
.split('; ')
.find(cookie => cookie.startsWith('cw_d_session_info='));
if (sessionCookie) {
const raw = decodeURIComponent(sessionCookie.split('=').slice(1).join('='));
const extract = key =>
raw.match(new RegExp(`"${key}":"([^"]+)"`))?.[1] || '';
const token = extract('access-token');
if (token) {
localStorage.setItem('access-token', token);
localStorage.setItem('client', extract('client'));
localStorage.setItem('uid', extract('uid'));
localStorage.setItem('token-type', extract('token-type') || 'Bearer');
localStorage.setItem('expiry', extract('expiry'));
}
}
} catch {
// Ignore malformed legacy session cookies.
}