Skip to content

Commit

Permalink
cloud/etc: shuffle cors
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Mar 7, 2024
1 parent 0e1305e commit b320fd4
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 13 deletions.
4 changes: 2 additions & 2 deletions plugins/chromecast/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/chromecast/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/chromecast",
"version": "0.1.56",
"version": "0.1.57",
"description": "Send video, audio, and text to speech notifications to Chromecast and Google Home devices",
"author": "Scrypted",
"license": "Apache-2.0",
Expand Down
10 changes: 8 additions & 2 deletions plugins/chromecast/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class CastDevice extends ScryptedDeviceBase implements MediaPlayer, Refresh, Eng
let cameraStreamAuthToken: string;

try {
cameraStreamAuthToken= await mediaManager.convertMediaObjectToUrl(mo, ScryptedMimeTypes.LocalUrl);
cameraStreamAuthToken = await mediaManager.convertMediaObjectToUrl(mo, ScryptedMimeTypes.LocalUrl);
}
catch (e) {
this.log.a('Streaming failed. Install and set up Scrypted Cloud to cast this media type.');
Expand Down Expand Up @@ -469,6 +469,12 @@ class CastDeviceProvider extends ScryptedDeviceBase implements DeviceProvider {
constructor() {
super(null);

endpointManager.setAccessControlAllowOrigin({
origins: [
// chromecast receiver
'https://koush.github.io',
],
});

this.browser.on('response', response => {
for (const additional of response.additionals) {
Expand Down Expand Up @@ -562,7 +568,7 @@ class CastDeviceProvider extends ScryptedDeviceBase implements DeviceProvider {
}

async releaseDevice(id: string, nativeId: string): Promise<void> {

}

async discoverDevices(duration: number) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/cloud/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@
"@types/nat-upnp": "^1.1.5",
"@types/node": "^20.11.19"
},
"version": "0.2.12"
"version": "0.2.13"
}
2 changes: 0 additions & 2 deletions plugins/cloud/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,6 @@ class ScryptedCloud extends ScryptedDeviceBase implements OauthClient, Settings,
origins: [
`http://${SCRYPTED_SERVER}`,
`https://${SCRYPTED_SERVER}`,
// chromecast receiver. move this into google home and chromecast plugins?
'https://koush.github.io',
...this.storageSettings.values.additionalCorsOrigins,
],
});
Expand Down
4 changes: 2 additions & 2 deletions plugins/google-home/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/google-home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
"@types/lodash": "^4.14.168",
"@types/url-parse": "^1.4.3"
},
"version": "0.0.59"
"version": "0.0.60"
}
3 changes: 3 additions & 0 deletions plugins/google-home/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ class GoogleHome extends ScryptedDeviceBase implements HttpRequestHandler, Engin

endpointManager.setAccessControlAllowOrigin({
origins: [
// webrtc signaling
'https://www.gstatic.com',
// chromecast receiver
'https://koush.github.io',
],
});

Expand Down

0 comments on commit b320fd4

Please sign in to comment.