Skip to content

The agent that grows with you

fix(webapp): let the bundled Radio plugin start on plain-HTTP origins

dokterdok1c5be2ba0bf2
diff --git a/apps/desktop/src/contrib/radio-plugin.test.ts b/apps/desktop/src/contrib/radio-plugin.test.ts
index d6c30125aac..1f88a47428f 100644
--- a/apps/desktop/src/contrib/radio-plugin.test.ts
+++ b/apps/desktop/src/contrib/radio-plugin.test.ts
@@ -39,6 +39,8 @@ describe('bundled Radio plugin', () => {
const audio = vi.fn()
vi.stubGlobal('fetch', fetch)
vi.stubGlobal('Audio', audio)
+ // A plain-HTTP origin from another machine: browsers expose no crypto.randomUUID there.
+ vi.stubGlobal('crypto', { getRandomValues: crypto.getRandomValues.bind(crypto) })
const initialStyles = document.head.querySelectorAll('style').length
discoverBundledPlugins()
diff --git a/apps/desktop/src/plugins/radio/plugin.js b/apps/desktop/src/plugins/radio/plugin.js
index 1ec2f1a92db..5ee509d8617 100644
--- a/apps/desktop/src/plugins/radio/plugin.js
+++ b/apps/desktop/src/plugins/radio/plugin.js
@@ -1,5 +1,5 @@
import {
- atom, Button, createBudgetedLoop, GlyphSpinner, icons, Popover, PopoverContent, PopoverTrigger,
+ atom, Button, createBudgetedLoop, GlyphSpinner, icons, Popover, PopoverContent, PopoverTrigger, randomUuid,
RowButton, SearchField, STATUSBAR_AREAS, Tip, usePluginI18n,
useQuery, useValue
} from '@hermes/plugin-sdk'
@@ -177,7 +177,7 @@ function createPlayer(ctx) {
let disposed = false
let lastVolume = volume.get() || 25
const bus = new BroadcastChannel('hermes:radio:playback')
- const windowId = crypto.randomUUID()
+ const windowId = randomUuid()
function stop(nextStatus = 'paused') {
generation++