Skip to content

Feature/shared hubs - #83

Open
LucHeart wants to merge 3 commits into
developfrom
feature/shared-hubs
Open

Feature/shared hubs#83
LucHeart wants to merge 3 commits into
developfrom
feature/shared-hubs

Conversation

@LucHeart

Copy link
Copy Markdown
Member

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e79b3ccd9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Desktop/Backend/OpenShockApi.cs Outdated
if (shockerList.ContainsKey(shockerId)) continue;

// Shared shockers are present in the permission map; owned shockers are not.
var enabled = !_sharedShockerPermissions.ContainsKey(shockerId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add a way to enable newly shared shockers

When a shared shocker is first discovered, this defaults Enabled to false, but the only enable checkbox I found is in Desktop/Ui/Pages/Dash/Tabs/ShockersTab/ShockersTab.razor and it renders only OpenShockApi.Hubs.Value.SelectMany(...), i.e. owned hubs. In the normal UI flow a newly shared shocker therefore stays disabled forever, so BackendHubManager.CanControl and IsLiveControllable filter it out even when the user has permissions; include shared shockers in the opt-in UI or provide another persisted opt-in path.

Useful? React with 👍 / 👎.

Comment thread Desktop/Services/AuthService.cs Outdated
Comment on lines +68 to +69
await _apiClient.RefreshHubs();
await _apiClient.RefreshSharedHubs();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve shared-shocker config across login refreshes

On startup or re-auth, SharedHubs is still empty when RefreshHubs() runs, so its SyncShockerConfig() rewrites and saves Config.OpenShock.Shockers with only owned IDs before this newly added shared refresh happens. The subsequent RefreshSharedHubs() call no longer sees any saved Enabled=true entries for shared shockers and re-adds them as default-disabled, so any prior opt-in/manual config for shared shockers is lost on every login; defer the sync/save until both owned and shared responses are loaded or preserve existing shared entries during the owned refresh.

Useful? React with 👍 / 👎.

Comment thread Desktop/Services/LiveControlManager.cs Outdated
Comment on lines +203 to +205
// Frames are only accepted once the socket is connected; while it is still warming up (or reconnecting) we
// drop them. EnsureConnection already kicked off / kept the connection alive.
if (connection.Client.State.Value != WebsocketConnectionState.Connected) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Queue the first live-control frame while connecting

With the new lazy connection flow, the first call to LiveControl or ControlAllShockers creates the socket and immediately reaches this guard while the client is still connecting, so the frame is dropped instead of being passed to IntakeFrame. A short one-frame live-control burst now does nothing unless another frame arrives after the connection finishes; either wait/queue the frame or keep clients warm before accepting live-control calls.

Useful? React with 👍 / 👎.

Comment on lines +129 to +130
if (_apiClient.SharedShockerPermissions.TryGetValue(shockerId, out var permissions))
return permissions.Live;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check action permissions for shared live control

For a shared shocker with Live=true but without the requested Shock, Vibrate, or Sound permission, this filter still allows the shocker through because it ignores the type passed to ControlShockers. The regular control path checks the action-specific permission, so live control can attempt frames the share owner did not grant or trigger server-side rejections for those permission combinations; include the requested control type in this check.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant