* fix * fix: websocket stream origin
This commit is contained in:
parent
31174d6b79
commit
1361bdfbf2
2 changed files with 4 additions and 4 deletions
|
@ -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');
|
||||||
|
|
|
@ -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));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue