fix: test break caused by #12273 (#12322)

* fix

* fix: websocket stream origin
This commit is contained in:
Nya Candy 2023-11-13 15:39:54 +08:00 committed by GitHub
parent 31174d6b79
commit 1361bdfbf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -11,8 +11,8 @@ const siteName = document.querySelector<HTMLMetaElement>('meta[property="og:site
export const host = address.host; export const host = address.host;
export const hostname = address.hostname; export const hostname = address.hostname;
export const url = address.origin; export const url = address.origin;
export const apiUrl = url + '/api'; export const apiUrl = location.origin + '/api';
export const wsUrl = url.replace('http://', 'ws://').replace('https://', 'wss://') + '/streaming'; export const wsOrigin = location.origin;
export const lang = miLocalStorage.getItem('lang') ?? 'en-US'; export const lang = miLocalStorage.getItem('lang') ?? 'en-US';
export const langs = _LANGS_; export const langs = _LANGS_;
const preParseLocale = miLocalStorage.getItem('locale'); const preParseLocale = miLocalStorage.getItem('locale');

View File

@ -6,14 +6,14 @@
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { markRaw } from 'vue'; import { markRaw } from 'vue';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { url } from '@/config.js'; import { wsOrigin } from '@/config.js';
let stream: Misskey.Stream | null = null; let stream: Misskey.Stream | null = null;
export function useStream(): Misskey.Stream { export function useStream(): Misskey.Stream {
if (stream) return stream; if (stream) return stream;
stream = markRaw(new Misskey.Stream(url, $i ? { stream = markRaw(new Misskey.Stream(wsOrigin, $i ? {
token: $i.token, token: $i.token,
} : null)); } : null));