Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(quality): explicit promise-existence checks + protocol-aware WebDAV URL

diegosouzapwb6bda1991939
diff --git a/open-sse/services/combo.ts b/open-sse/services/combo.ts
index 5f6dfa2ee6..88c8c09a35 100644
--- a/open-sse/services/combo.ts
+++ b/open-sse/services/combo.ts
@@ -1761,7 +1761,7 @@ async function fetchResetAwareQuotaWithCache({
const refresh = () => {
const existing = resetAwareQuotaCache.get(cacheKey);
- if (existing?.refreshPromise) return existing.refreshPromise;
+ if (existing?.refreshPromise != null) return existing.refreshPromise;
const refreshPromise = fetcher(connectionId, connection)
.then((quota) => {
diff --git a/src/app/(dashboard)/dashboard/endpoint/components/ObsidianSourceCard.tsx b/src/app/(dashboard)/dashboard/endpoint/components/ObsidianSourceCard.tsx
index 820195c091..35c29e502c 100644
--- a/src/app/(dashboard)/dashboard/endpoint/components/ObsidianSourceCard.tsx
+++ b/src/app/(dashboard)/dashboard/endpoint/components/ObsidianSourceCard.tsx
@@ -165,10 +165,11 @@ export default function ObsidianSourceCard() {
};
const getWebdavUrl = (): string => {
- if (typeof window === "undefined") return "http://<server-ip>/api/v1/webdav/";
- const host = window.location.hostname;
- const port = window.location.port;
- return `http://${host}:${port}/api/v1/webdav`;
+ if (typeof window === "undefined") return "<server-ip>/api/v1/webdav/";
+ // Inherit the page protocol (http on localhost, https behind a TLS proxy)
+ // instead of hard-coding http.
+ const { protocol, hostname, port } = window.location;
+ return `${protocol}//${hostname}:${port}/api/v1/webdav`;
};
return (
diff --git a/src/app/api/providers/[id]/sync-models/route.ts b/src/app/api/providers/[id]/sync-models/route.ts
index b124b34d3c..1d1a9f4a9d 100644
--- a/src/app/api/providers/[id]/sync-models/route.ts
+++ b/src/app/api/providers/[id]/sync-models/route.ts
@@ -174,7 +174,7 @@ export type EnsureReadyOptions = {
};
export async function ensureLoopbackServerReady(opts: EnsureReadyOptions = {}): Promise<void> {
- if (__loopbackReadyPromise) return __loopbackReadyPromise;
+ if (__loopbackReadyPromise != null) return __loopbackReadyPromise;
__loopbackReadyPromise = (async () => {
const f = opts.fetch ?? fetch;
const maxWaitMs = opts.maxWaitMs ?? 30_000;