mirror of
https://github.com/sst/opencode.git
synced 2025-08-25 07:24:05 +00:00
Api: only return session messages
This commit is contained in:
parent
a6142cf975
commit
e054454109
1 changed files with 6 additions and 8 deletions
|
@ -19,9 +19,9 @@ export class SyncServer extends DurableObject<Env> {
|
||||||
this.ctx.acceptWebSocket(server)
|
this.ctx.acceptWebSocket(server)
|
||||||
|
|
||||||
const data = await this.ctx.storage.list()
|
const data = await this.ctx.storage.list()
|
||||||
for (const [key, content] of data.entries()) {
|
Array.from(data.entries())
|
||||||
server.send(JSON.stringify({ key, content }))
|
.filter(([key, _]) => key.startsWith("session/"))
|
||||||
}
|
.map(([key, content]) => server.send(JSON.stringify({ key, content })))
|
||||||
|
|
||||||
return new Response(null, {
|
return new Response(null, {
|
||||||
status: 101,
|
status: 101,
|
||||||
|
@ -71,11 +71,9 @@ export class SyncServer extends DurableObject<Env> {
|
||||||
|
|
||||||
public async getData() {
|
public async getData() {
|
||||||
const data = await this.ctx.storage.list()
|
const data = await this.ctx.storage.list()
|
||||||
const messages = []
|
return Array.from(data.entries())
|
||||||
for (const [key, content] of data.entries()) {
|
.filter(([key, _]) => key.startsWith("session/"))
|
||||||
messages.push({ key, content })
|
.map(([key, content]) => ({ key, content }))
|
||||||
}
|
|
||||||
return messages
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getSecret() {
|
private async getSecret() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue