summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFrank <[email protected]>2025-05-23 16:14:03 -0400
committerDax Raad <[email protected]>2025-05-26 12:40:17 -0400
commit9b331a917edc567cd1d4b75df7deff31a54836aa (patch)
tree921a0cca67fe993f2239c8f5326c2b357385d242
parentd51b4263aba59f60277766fc024f2931fc8874ec (diff)
downloadopencode-9b331a917edc567cd1d4b75df7deff31a54836aa.tar.gz
opencode-9b331a917edc567cd1d4b75df7deff31a54836aa.zip
Share: sync
-rw-r--r--app/packages/function/src/api.ts14
-rw-r--r--app/packages/web/src/app.tsx2
2 files changed, 8 insertions, 8 deletions
diff --git a/app/packages/function/src/api.ts b/app/packages/function/src/api.ts
index efe0c5625..2f8ece9f7 100644
--- a/app/packages/function/src/api.ts
+++ b/app/packages/function/src/api.ts
@@ -80,7 +80,7 @@ export default {
}
if (request.method === "POST" && url.pathname.endsWith("/share_create")) {
const body = await request.json()
- const sessionID = body.session_id
+ const sessionID = body.sessionID
const shareID = createHash("sha256").update(sessionID).digest("hex")
const infoFile = `${shareID}/info/${sessionID}.json`
const ret = await Resource.Bucket.get(infoFile)
@@ -89,14 +89,14 @@ export default {
await Resource.Bucket.put(infoFile, "")
- return new Response(JSON.stringify({ share_id: shareID }), {
+ return new Response(JSON.stringify({ shareID }), {
headers: { "Content-Type": "application/json" },
})
}
if (request.method === "POST" && url.pathname.endsWith("/share_delete")) {
const body = await request.json()
- const sessionID = body.session_id
- const shareID = body.share_id
+ const sessionID = body.sessionID
+ const shareID = body.shareID
const infoFile = `${shareID}/info/${sessionID}.json`
await Resource.Bucket.delete(infoFile)
return new Response(JSON.stringify({}), {
@@ -105,8 +105,8 @@ export default {
}
if (request.method === "POST" && url.pathname.endsWith("/share_sync")) {
const body = await request.json()
- const sessionID = body.session_id
- const shareID = body.share_id
+ const sessionID = body.sessionID
+ const shareID = body.shareID
const key = body.key
const content = body.content
@@ -142,7 +142,7 @@ export default {
}
// get query parameters
- const shareID = url.searchParams.get("share_id")
+ const shareID = url.searchParams.get("shareID")
if (!shareID)
return new Response("Error: Share ID is required", { status: 400 })
diff --git a/app/packages/web/src/app.tsx b/app/packages/web/src/app.tsx
index ee09bc954..01628b10a 100644
--- a/app/packages/web/src/app.tsx
+++ b/app/packages/web/src/app.tsx
@@ -45,7 +45,7 @@ export default function App() {
// Always use secure WebSocket protocol (wss)
const wsBaseUrl = apiUrl.replace(/^https?:\/\//, "wss://")
- const wsUrl = `${wsBaseUrl}/share_poll?share_id=${shareId}`
+ const wsUrl = `${wsBaseUrl}/share_poll?shareID=${shareId}`
console.log("Connecting to WebSocket URL:", wsUrl)
// Create WebSocket connection