Browse Source

fix(sse): support sub-dir deployment

Jacky 1 day ago
parent
commit
1396cbf096

+ 1 - 0
.github/workflows/build.yml

@@ -6,6 +6,7 @@ on:
       - 'weblate'
     paths:
       - "app/**/*.js"
+      - "app/**/*.ts"
       - "app/**/*.vue"
       - "app/src/language/**/*.po"
       - "app/i18n.json"

+ 3 - 1
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

+ 4 - 1
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,
       },