mirror of
https://github.com/SableClient/Sable.git
synced 2026-12-06 00:32:26 -08:00
fix(tauri): use getAppOrigin() for all origin-dependent paths
This commit is contained in:
4 files changed
+19
-11
No files matched your search
@@ -10,6 +10,7 @@ import {
|
||||
} from 'matrix-widget-api';
|
||||
import { CallWidgetDriver } from './CallWidgetDriver';
|
||||
import { trimTrailingSlash } from '../../utils/common';
|
||||
import { getAppOrigin } from '../../utils/platform';
|
||||
import type { ElementCallThemeKind, ElementMediaStateDetail } from './types';
|
||||
import { color, config } from 'folds';
|
||||
import { ElementCallIntent, ElementWidgetActions } from './types';
|
||||
@@ -96,12 +97,7 @@ export class CallEmbed {
|
||||
): Widget {
|
||||
const userId = mx.getSafeUserId();
|
||||
const deviceId = mx.getDeviceId() ?? '';
|
||||
// window.location.origin is "null" on Tauri (tauri:// is opaque per WHATWG).
|
||||
// The widget does new URL(parentUrl), which throws on "null".
|
||||
const clientOrigin =
|
||||
window.location.origin === 'null'
|
||||
? `${window.location.protocol}//${window.location.host}`
|
||||
: window.location.origin;
|
||||
const clientOrigin = getAppOrigin();
|
||||
const widgetId = 'call-embed';
|
||||
|
||||
const params = new URLSearchParams({
|
||||
@@ -130,7 +126,7 @@ export class CallEmbed {
|
||||
let widgetUrl: URL;
|
||||
if (elementCallUrl && elementCallUrl.trim()) {
|
||||
try {
|
||||
widgetUrl = new URL(elementCallUrl, window.location.origin);
|
||||
widgetUrl = new URL(elementCallUrl, clientOrigin);
|
||||
} catch (error) {
|
||||
debugLog.warn(
|
||||
'call',
|
||||
@@ -142,13 +138,13 @@ export class CallEmbed {
|
||||
);
|
||||
widgetUrl = new URL(
|
||||
`${trimTrailingSlash(import.meta.env.BASE_URL)}/public/element-call/index.html`,
|
||||
window.location.origin
|
||||
clientOrigin
|
||||
);
|
||||
}
|
||||
} else {
|
||||
widgetUrl = new URL(
|
||||
`${trimTrailingSlash(import.meta.env.BASE_URL)}/public/element-call/index.html`,
|
||||
window.location.origin
|
||||
clientOrigin
|
||||
);
|
||||
}
|
||||
widgetUrl.search = params.toString();
|
||||
|
||||
Reference in new issue
Block a user