From 244a54463bd2467d42bc3880f7c7f4b7e27838fb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 20:16:53 +0000 Subject: [PATCH] This build was committed by a bot. --- .../{index-BdQE1Xqo.js => index-YfnOwjpc.js} | 29 +++++++++++++++---- dist/index.html | 2 +- dist/sw.js | 2 +- 3 files changed, 25 insertions(+), 8 deletions(-) rename dist/assets/{index-BdQE1Xqo.js => index-YfnOwjpc.js} (98%) diff --git a/dist/assets/index-BdQE1Xqo.js b/dist/assets/index-YfnOwjpc.js similarity index 98% rename from dist/assets/index-BdQE1Xqo.js rename to dist/assets/index-YfnOwjpc.js index 3162864..f27a6f3 100644 --- a/dist/assets/index-BdQE1Xqo.js +++ b/dist/assets/index-YfnOwjpc.js @@ -711,7 +711,7 @@ const threadRow = (t) => `
b.pinned - a.pinned || b.updatedAt - a.updatedAt); el.threadList.innerHTML = sortedThreads.slice(0, THREAD_PAGE_SIZE).map(threadRow).join(""); el.threadList.scrollTop = 0; isAddingThreads = false; @@ -815,8 +815,13 @@ $(el.threadPopover).on("click", async (e) => { } } else if (act === "delete") { if (confirm("Delete this chat?")) { - THREAD.list = THREAD.list.filter((x) => x.id !== th.id); - await localforage.removeItem(prefix + th.id); + if (u.startsWith("gh://")) { + th.status = "deleted"; + th.updatedAt = Date.now(); + } else { + THREAD.list = THREAD.list.filter((x) => x.id !== th.id); + await localforage.removeItem(prefix + th.id); + } if (state.currentThreadId === th.id) { state.currentThreadId = null; clearChat(); @@ -1381,6 +1386,10 @@ const parseGhUrl = (u) => { $(el.threadRepoInput).on("change", async () => { const u = el.threadRepoInput.value.trim(); localStorage.setItem("thread_repo_url", u); + if (state.currentThreadId) { + state.currentThreadId = null; + clearChat(); + } el.threadFolderBtn.classList.toggle("hidden", !u.startsWith("gh://")); el.threadBackBtn.classList.toggle("hidden", !u.startsWith("gh://") || u.split("/").length <= 3); await THREAD.load(); @@ -1410,14 +1419,22 @@ $(el.threadSyncBtn).on("click", async () => { const info = parseGhUrl(u); try { if (mode) { - const idxFile = await ghApi(info.full), sha = idxFile?.sha; + const idxFile = await ghApi(info.full), sha = idxFile?.sha, toRemove = []; for (const t of THREAD.list) { - if (t.type === "thread" && (t.status === "modified" || t.status === "new")) { - const msgs = await localforage.getItem("rem_t_" + t.id), fPath = `${info.dir}${t.id}.json`, ex = await ghApi(fPath + "?ref=" + info.branch); + if (t.type !== "thread") continue; + const fPath = `${info.dir}${t.id}.json`; + if (t.status === "deleted") { + const ex = await ghApi(fPath + "?ref=" + info.branch); + if (ex?.sha) await ghApi(fPath, "DELETE", { message: `Delete thread ${t.id}`, sha: ex.sha, branch: info.branch }); + await localforage.removeItem("rem_t_" + t.id); + toRemove.push(t.id); + } else if (t.status === "modified" || t.status === "new") { + const msgs = await localforage.getItem("rem_t_" + t.id), ex = await ghApi(fPath + "?ref=" + info.branch); await ghApi(fPath, "PUT", { message: `Sync thread ${t.id}`, content: utob(JSON.stringify(msgs, null, 2)), branch: info.branch, sha: ex?.sha }); t.status = "synced"; } } + THREAD.list = THREAD.list.filter((x) => !toRemove.includes(x.id)); await ghApi(info.full, "PUT", { message: "Update index.json", content: utob(JSON.stringify(THREAD.list, null, 2)), branch: info.branch, sha }); alert("Pushed to GitHub."); } else { diff --git a/dist/index.html b/dist/index.html index 0a1d5d1..c73a72e 100644 --- a/dist/index.html +++ b/dist/index.html @@ -12,7 +12,7 @@ - + diff --git a/dist/sw.js b/dist/sw.js index d6d542b..9dacbc7 100644 --- a/dist/sw.js +++ b/dist/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const c=e=>i(e,t),d={module:{uri:t},exports:o,require:c};s[t]=Promise.all(n.map(e=>d[e]||c(e))).then(e=>(r(...e),o))}}define(["./workbox-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"f5de2a58d8f0836b0c5c8b0917dfc229"},{url:"assets/index-JLEDB1oP.css",revision:null},{url:"assets/index-BdQE1Xqo.js",revision:null},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}); +if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const c=e=>i(e,t),l={module:{uri:t},exports:o,require:c};s[t]=Promise.all(n.map(e=>l[e]||c(e))).then(e=>(r(...e),o))}}define(["./workbox-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"e77936a1f49cc105f92b52dd1ca398f8"},{url:"assets/index-YfnOwjpc.js",revision:null},{url:"assets/index-JLEDB1oP.css",revision:null},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});