From 5ee368b504199d846da7e2f24b8f34be952ebc9d Mon Sep 17 00:00:00 2001 From: LucHeart Date: Sat, 2 May 2026 23:39:12 +0200 Subject: [PATCH 1/9] add ctrl + click to live buttons --- .../ControlModules/LiveButton.svelte | 84 +++++++++++-------- .../ControlModules/impl/LiveSlider.svelte | 16 ++-- src/lib/state/live-control-state.svelte.ts | 58 +++++++++++++ src/routes/(app)/shockers/own/+page.svelte | 26 ++---- src/routes/(app)/shockers/shared/+page.svelte | 26 ++---- src/routes/+layout.svelte | 39 +++++---- .../public/[shareId=guid]/ControlView.svelte | 64 ++++++-------- 7 files changed, 182 insertions(+), 131 deletions(-) diff --git a/src/lib/components/ControlModules/LiveButton.svelte b/src/lib/components/ControlModules/LiveButton.svelte index c47e3e7b..25fb48eb 100644 --- a/src/lib/components/ControlModules/LiveButton.svelte +++ b/src/lib/components/ControlModules/LiveButton.svelte @@ -1,53 +1,71 @@
- + + + LIVE + {#if isConnecting} + + {/if} + + +
+ + {#if isActive} + Live — {connection?.gateway} ({connection?.country}) — {connection?.latency}ms + {:else if isConnecting} + Connecting... + {:else} + Connect to Live Control + {/if} + + Ctrl+click for whole hub +
+
+
{#if isActive && connection && !compact} {connection.gateway} ({connection.country}) — {connection.latency}ms diff --git a/src/lib/components/ControlModules/impl/LiveSlider.svelte b/src/lib/components/ControlModules/impl/LiveSlider.svelte index 4d8fd82f..2cdef036 100644 --- a/src/lib/components/ControlModules/impl/LiveSlider.svelte +++ b/src/lib/components/ControlModules/impl/LiveSlider.svelte @@ -72,7 +72,7 @@
- -
+ +
+
+
- + - + + (sidebarOpen.value = v)}> + +
+ {#if PUBLIC_DEVELOPMENT_BANNER === 'true'} +
+

+ This is the OpenShock DEVELOPMENT environment. No data is saved, and + regularly overwritten by production data +

+
+ {/if} +
+
+ {@render children?.()} +
+
+
+
+
diff --git a/src/routes/shares/public/[shareId=guid]/ControlView.svelte b/src/routes/shares/public/[shareId=guid]/ControlView.svelte index 23a8cd71..24f8c149 100644 --- a/src/routes/shares/public/[shareId=guid]/ControlView.svelte +++ b/src/routes/shares/public/[shareId=guid]/ControlView.svelte @@ -12,10 +12,10 @@ import type { Control } from '$lib/signalr/models/Control'; import { ControlType } from '$lib/signalr/models/ControlType'; import { - ensureLiveConnection, getLiveConnection, liveConnections, LiveConnectionState, + registerHubShockers, } from '$lib/state/live-control-state.svelte'; import { onMount, untrack } from 'svelte'; import { page } from '$app/state'; @@ -68,18 +68,17 @@ ) ); - // Eagerly create LiveDeviceConnection and LiveShockerState entries + // Register each hub's shockers with the live-control state store $effect(() => { const currentDeviceIds: string[] = []; for (const device of shareLinkRoot.devices ?? []) { currentDeviceIds.push(device.id); - ensureLiveConnection(device.id); - const conn = getLiveConnection(device.id); - if (conn) { - for (const shocker of device.shockers) { - conn.ensureShockerState(shocker.id); - } - } + registerHubShockers( + device.id, + device.shockers + .filter((s) => s.permissions.live) + .map((s) => ({ id: s.id, isPaused: s.paused !== 0 })) + ); } for (const [deviceId, conn] of liveConnections) { if (!currentDeviceIds.includes(deviceId)) { @@ -112,26 +111,24 @@ {/if} - - - - - - - - {shareLinkRoot.author.name.charAt(0)} - - -

{shareLinkRoot.author.name}

-
-
- -

Shared by

-
-
-
+ + + + + + + {shareLinkRoot.author.name.charAt(0)} + + +

{shareLinkRoot.author.name}

+
+
+ +

Shared by

+
+
@@ -148,14 +145,7 @@ > {#snippet live()} {#if shocker.permissions.live} - + {/if} {/snippet} {#if isShockerLiveActive && liveState && liveConn} From fa2771ac9b1704f158044c11319461e315ae6d5e Mon Sep 17 00:00:00 2001 From: LucHeart Date: Tue, 5 May 2026 04:05:50 +0200 Subject: [PATCH 2/9] add sloppa history graph --- package.json | 2 +- .../ControlModules/impl/LiveSlider.svelte | 111 +++++++++++++++++- 2 files changed, 107 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index cb51bc39..673ce757 100644 --- a/package.json +++ b/package.json @@ -83,4 +83,4 @@ "defaults and fully supports es6-module" ], "packageManager": "pnpm@10.33.2" -} \ No newline at end of file +} diff --git a/src/lib/components/ControlModules/impl/LiveSlider.svelte b/src/lib/components/ControlModules/impl/LiveSlider.svelte index 2cdef036..a7f5a601 100644 --- a/src/lib/components/ControlModules/impl/LiveSlider.svelte +++ b/src/lib/components/ControlModules/impl/LiveSlider.svelte @@ -1,4 +1,5 @@