Compare commits

...
Sign in to create a new pull request.

2 commits
main ... dev

Author SHA1 Message Date
thororen
09ccf0878d
Fix Vencloud syncing
Some checks failed
Build Branches / Build Equicord (push) Has been skipped
Sync to Codeberg / codeberg (push) Has been skipped
Test / Test (push) Failing after 4s
2026-10-03 23:34:54 -04:00
thororen
ead6a60a70
Fix SidebarChat 2026-10-03 19:17:00 -04:00
2 changed files with 23 additions and 2 deletions

View file

@ -144,6 +144,22 @@ function handleAuthFailure() {
Settings.cloud.authenticated = false;
}
async function isV1Reachable() {
try {
const res = await fetch(new URL("/v1/settings", getCloudUrl()), {
method: "GET",
headers: {
Authorization: await getCloudAuth(),
Accept: "application/octet-stream",
"If-None-Match": Settings.cloud.settingsSyncVersion.toString(),
},
});
return res.ok || res.status === 304 || res.status === 404;
} catch {
return false;
}
}
async function doSyncV2(uploads: SyncRequest["uploads"], clientManifest: ManifestEntry[]): Promise<SyncResponse | null> {
let res: Response;
try {
@ -156,7 +172,12 @@ async function doSyncV2(uploads: SyncRequest["uploads"], clientManifest: Manifes
body: JSON.stringify({ client_manifest: clientManifest, uploads } satisfies SyncRequest),
});
} catch (e) {
logger.error("v2 sync network error, will retry next sync", e);
if (await isV1Reachable()) {
logger.info("v2 sync request failed but v1 is reachable, falling back to v1", e);
await setApiVersion("v1");
} else {
logger.error("v2 sync network error, will retry next sync", e);
}
return null;
}

View file

@ -326,7 +326,7 @@ export default definePlugin({
replace: "$&vc_SidebarChat=$self.renderSidebar(),"
},
{
match: /(?<=return )null!=\i&&\i\?\(0,\i\.jsx\)\(\i,\{channel:\i\},\i\.id\):\(0,\i\.jsx\)\(\i,\{\}\)(?=\},)/,
match: /(?<=return)\(0,\i\.jsx\)\(\i,\{\}\)(?=\},)/,
replace: "[$&,vc_SidebarChat]"
},
],