Skip to content

Commit bbc3b89

Browse files
committed
fix(tui): keep /share available to copy existing link
1 parent de0f4ef commit bbc3b89

File tree

1 file changed

+13
-8
lines changed
  • packages/opencode/src/cli/cmd/tui/routes/session

1 file changed

+13
-8
lines changed

packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,26 +314,31 @@ export function Session() {
314314
const command = useCommandDialog()
315315
command.register(() => [
316316
{
317-
title: "Share session",
317+
title: session()?.share?.url ? "Copy share link" : "Share session",
318318
value: "session.share",
319319
suggested: route.type === "session",
320320
keybind: "session_share",
321321
category: "Session",
322-
enabled: sync.data.config.share !== "disabled" && !session()?.share?.url,
322+
enabled: sync.data.config.share !== "disabled",
323323
slash: {
324324
name: "share",
325325
},
326326
onSelect: async (dialog) => {
327+
const copy = (url: string) =>
328+
Clipboard.copy(url)
329+
.then(() => toast.show({ message: "Share URL copied to clipboard!", variant: "success" }))
330+
.catch(() => toast.show({ message: "Failed to copy URL to clipboard", variant: "error" }))
331+
const url = session()?.share?.url
332+
if (url) {
333+
await copy(url)
334+
dialog.clear()
335+
return
336+
}
327337
await sdk.client.session
328338
.share({
329339
sessionID: route.sessionID,
330340
})
331-
.then((res) =>
332-
Clipboard.copy(res.data!.share!.url).catch(() =>
333-
toast.show({ message: "Failed to copy URL to clipboard", variant: "error" }),
334-
),
335-
)
336-
.then(() => toast.show({ message: "Share URL copied to clipboard!", variant: "success" }))
341+
.then((res) => copy(res.data!.share!.url))
337342
.catch(() => toast.show({ message: "Failed to share session", variant: "error" }))
338343
dialog.clear()
339344
},

0 commit comments

Comments
 (0)