From 1396cbf0963f5b0c4c356e9650ba3e9cad63571c Mon Sep 17 00:00:00 2001 From: Jacky Date: Sat, 3 May 2025 08:25:46 +0000 Subject: [PATCH] fix(sse): support sub-dir deployment --- .github/workflows/build.yml | 1 + app/src/components/SelfCheck/store.ts | 4 +++- app/src/composables/useSSE.ts | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a6f7de39..3aa6c94e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,7 @@ on: - 'weblate' paths: - "app/**/*.js" + - "app/**/*.ts" - "app/**/*.vue" - "app/src/language/**/*.po" - "app/i18n.json" diff --git a/app/src/components/SelfCheck/store.ts b/app/src/components/SelfCheck/store.ts index db6ad54c..0d913bea 100644 --- a/app/src/components/SelfCheck/store.ts +++ b/app/src/components/SelfCheck/store.ts @@ -62,7 +62,9 @@ export const useSelfCheckStore = defineStore('selfCheck', () => { try { await selfCheck.fix(taskName) await nextTick() - check() + setTimeout(() => { + check() + }, 1000) } finally { fixing[taskName] = false diff --git a/app/src/composables/useSSE.ts b/app/src/composables/useSSE.ts index 76a4e1cc..2aa820de 100644 --- a/app/src/composables/useSSE.ts +++ b/app/src/composables/useSSE.ts @@ -1,4 +1,5 @@ import type { SSEvent } from 'sse.js' +import { urlJoin } from '@/lib/helper' import { useUserStore } from '@/pinia' import { SSE } from 'sse.js' @@ -37,7 +38,9 @@ export function useSSE() { reconnectInterval = 5000, } = options - const sse = new SSE(url, { + const fullUrl = urlJoin(window.location.pathname, url) + + const sse = new SSE(fullUrl, { headers: { Authorization: token.value, },