ChatGPTNextWeb / ChatGPTNextWeb/NextChat
[Feature Request]: Switching to unified sync protocol and using tauri http package for native client
- Dominant language
- TypeScript
- Stars
- 88.8k
- Forks
- 59.1k
- PR merge metrics
- No merged PRs in 30d
Description
Let's turn it into a RPC, here is a proposal:
```ts
type WebDavConfig = {
type: 'webdav',
endpoint: string,
username: string,
password: string
}
type UpstashConfig = {
type: 'upstash',
endpoint: string,
username: STORAGE_KEY,
apiKey: string
}
type SyncAction = {
type: 'check'
} | {
type: 'get',
key: string,
} | {
type: 'set',
key: string,
value: string
}
type SyncPayload = {
config: WebDavConfig | UpstashConfig,
action: SyncAction
}
// client side
function createUpstashClient() {
return async check() {
return await call('/api/sync', { /* webdav config */ })
},
// get(key), set(key, value)
}
// server side, /api/sync/route.ts
async function handle(req) {
const payload = JSON.parse(await req.json()) as SyncPayload;
// dispatch payload to server side check/get/set actions
}
```
The main idea is to move all the sync actions that were previously done on the client side to the server side. The downside is that the desktop app can no longer use the sync feature unless we keep the official sync endpoint built in.
_Originally posted by @Yidadaa in https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/issues/4285#issuecomment-1995145175_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.