fix(sse): support sub-dir deployment

This commit is contained in:
Jacky 2025-05-03 08:25:46 +00:00
parent 855c3375f8
commit 1396cbf096
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
3 changed files with 8 additions and 2 deletions

View file

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

View file

@ -62,7 +62,9 @@ export const useSelfCheckStore = defineStore('selfCheck', () => {
try { try {
await selfCheck.fix(taskName) await selfCheck.fix(taskName)
await nextTick() await nextTick()
check() setTimeout(() => {
check()
}, 1000)
} }
finally { finally {
fixing[taskName] = false fixing[taskName] = false

View file

@ -1,4 +1,5 @@
import type { SSEvent } from 'sse.js' import type { SSEvent } from 'sse.js'
import { urlJoin } from '@/lib/helper'
import { useUserStore } from '@/pinia' import { useUserStore } from '@/pinia'
import { SSE } from 'sse.js' import { SSE } from 'sse.js'
@ -37,7 +38,9 @@ export function useSSE() {
reconnectInterval = 5000, reconnectInterval = 5000,
} = options } = options
const sse = new SSE(url, { const fullUrl = urlJoin(window.location.pathname, url)
const sse = new SSE(fullUrl, {
headers: { headers: {
Authorization: token.value, Authorization: token.value,
}, },