mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 19:26:54 +08:00
feat: add webdav support
This commit is contained in:
39
app/utils/cloud/upstash.ts
Normal file
39
app/utils/cloud/upstash.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { SyncStore } from "@/app/store/sync";
|
||||
|
||||
export type UpstashConfig = SyncStore["upstash"];
|
||||
export type UpStashClient = ReturnType<typeof createUpstashClient>;
|
||||
|
||||
export function createUpstashClient(config: UpstashConfig) {
|
||||
return {
|
||||
async check() {
|
||||
return true;
|
||||
},
|
||||
|
||||
async get() {
|
||||
throw Error("[Sync] not implemented");
|
||||
},
|
||||
|
||||
async set() {
|
||||
throw Error("[Sync] not implemented");
|
||||
},
|
||||
|
||||
headers() {
|
||||
return {
|
||||
Authorization: `Basic ${config.apiKey}`,
|
||||
};
|
||||
},
|
||||
path(path: string) {
|
||||
let url = config.endpoint;
|
||||
|
||||
if (!url.endsWith("/")) {
|
||||
url += "/";
|
||||
}
|
||||
|
||||
if (path.startsWith("/")) {
|
||||
path = path.slice(1);
|
||||
}
|
||||
|
||||
return url + path;
|
||||
},
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user