diff --git a/dist/assets/index-BQPvK7LI.js b/dist/assets/index-CEGVDOLp.js similarity index 99% rename from dist/assets/index-BQPvK7LI.js rename to dist/assets/index-CEGVDOLp.js index edade14..2696f7d 100644 --- a/dist/assets/index-BQPvK7LI.js +++ b/dist/assets/index-CEGVDOLp.js @@ -1421,14 +1421,19 @@ $(el.threadSyncBtn).on("click", async () => { if (mode) { const idxFile = await ghApi(info.full), sha = idxFile?.sha, toRemove = []; for (const t of THREAD.list) { + if (t.status === "deleted") { + if (t.type === "thread") { + const fPath2 = `${info.dir}${t.id}.json`; + const ex = await ghApi(fPath2 + "?ref=" + info.branch); + if (ex?.sha) await ghApi(fPath2, "DELETE", { message: `Delete thread ${t.id}`, sha: ex.sha, branch: info.branch }); + await localforage.removeItem("rem_t_" + t.id); + } + toRemove.push(t.id); + continue; + } 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") { + 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"; diff --git a/dist/index.html b/dist/index.html index 4d92e26..730e675 100644 --- a/dist/index.html +++ b/dist/index.html @@ -12,7 +12,7 @@ - + diff --git a/dist/sw.js b/dist/sw.js index 8f1c1c7..6bf5fe0 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),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:"53e6b21a560a1889362c3547606c261b"},{url:"assets/index-JLEDB1oP.css",revision:null},{url:"assets/index-BQPvK7LI.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),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:"1ea650a7f1d84f653051a7cdd850c6e3"},{url:"assets/index-JLEDB1oP.css",revision:null},{url:"assets/index-CEGVDOLp.js",revision:null},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});