Skip to content

Commit dbc9da7

Browse files
committed
fix: use computed baseUrl in overlay effects/widgets
1 parent 3e0741b commit dbc9da7

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/backend/effects/builtin/play-sound.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ const model: EffectType<{
158158
onOverlayEvent: (event) => {
159159
const data = event;
160160
const token = encodeURIComponent(data.resourceToken);
161-
const resourcePath = `http://${
162-
window.location.hostname
163-
}:7472/resource/${token}`;
161+
const resourcePath = `//${baseUrl}/resource/${token}`;
164162

165163
// Generate UUID to use as class name.
166164

src/backend/effects/builtin/play-video.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,8 @@ const playVideo = {
658658
const loop = data.loop;
659659

660660
const token = encodeURIComponent(data.resourceToken);
661-
const filepathNew = `http://${window.location.hostname}:7472/resource/${token}`;
661+
// eslint-disable-next-line no-undef
662+
const filepathNew = `//${baseUrl}/resource/${token}`;
662663

663664
// Generate UUID to use as id
664665

src/backend/effects/builtin/show-image.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ const showImage = {
247247
filepathNew = data.url;
248248
} else {
249249
const token = encodeURIComponent(data.resourceToken);
250-
filepathNew = `http://${window.location.hostname}:7472/resource/${token}`;
250+
// eslint-disable-next-line no-undef
251+
filepathNew = `//${baseUrl}/resource/${token}`;
251252
}
252253

253254
// NEW WAY EXAMPLE:

src/backend/overlay-widgets/builtin-types/image/image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const image: OverlayWidgetType<Settings, State> = {
9393
if (config.settings?.imageType === "url" && config.settings?.url) {
9494
imageSrc = config.settings.url;
9595
} else if (config.settings?.imageType === "local" && config.resourceTokens.filepath) {
96-
imageSrc = `http://${window.location.hostname}:7472/resource/${config.resourceTokens.filepath}`;
96+
imageSrc = `//${baseUrl}/resource/${config.resourceTokens.filepath}`;
9797
}
9898

9999
return `

0 commit comments

Comments
 (0)