Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ extension SettingsStore {
}
}

var opencodegoDashboardURL: URL? {
let workspaceID = OpenCodeGoUsageFetcher.normalizeWorkspaceID(self.opencodegoWorkspaceID)
if let workspaceID {
return URL(string: "https://opencode.ai/workspace/\(workspaceID)/go")
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 Normalize workspace setting before building dashboard URL

Constructing the dashboard link with raw opencodegoWorkspaceID breaks when users paste a full workspace URL instead of just wrk_... (a format we already tolerate in OpenCodeGoUsageFetcher tests, e.g. URL-to-ID normalization). In that case this code produces https://opencode.ai/workspace/https://opencode.ai/workspace/.../go, so the “Usage Dashboard” action opens an invalid workspace path rather than the intended dashboard.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

updated here b17752d

}
return URL(string: "https://opencode.ai")
}

func ensureOpenCodeGoCookieLoaded() {}
}

Expand Down
4 changes: 4 additions & 0 deletions Sources/CodexBar/StatusItemController+Actions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ extension StatusItemController {
return self.settings.alibabaCodingPlanAPIRegion.dashboardURL
}

if provider == .opencodego {
return self.settings.opencodegoDashboardURL
}

let meta = self.store.metadata(for: provider)
let urlString: String? = if provider == .claude, self.store.isClaudeSubscription() {
meta.subscriptionDashboardURL ?? meta.dashboardURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public struct OpenCodeGoUsageFetcher: Sendable {
return ids[0]
}

private static func normalizeWorkspaceID(_ raw: String?) -> String? {
static func normalizeWorkspaceID(_ raw: String?) -> String? {
guard let raw else { return nil }
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
if trimmed.hasPrefix("wrk_"), trimmed.count > 4 {
Expand Down