From d3e56d2b8819f925d87fab1885f9a642058925ac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 18 Sep 2026 18:52:27 +0000 Subject: [PATCH] This build was committed by a bot. --- .../{index-CWYcSOgO.js => index-BqgZBjfh.js} | 59 ++++++++++--------- dist/index.html | 2 +- dist/sw.js | 2 +- 3 files changed, 34 insertions(+), 29 deletions(-) rename dist/assets/{index-CWYcSOgO.js => index-BqgZBjfh.js} (98%) diff --git a/dist/assets/index-CWYcSOgO.js b/dist/assets/index-BqgZBjfh.js similarity index 98% rename from dist/assets/index-CWYcSOgO.js rename to dist/assets/index-BqgZBjfh.js index 1e4ec07..f1179f3 100644 --- a/dist/assets/index-CWYcSOgO.js +++ b/dist/assets/index-BqgZBjfh.js @@ -2168,40 +2168,44 @@ el.htmlTab_index.textContent = "index.html"; el.htmlTab_extension.textContent = "extension.html"; el.htmlTab_index.onclick = () => showHtmlTab("index"); el.htmlTab_extension.onclick = () => showHtmlTab("extension"); -var pullThreads = async () => { +var pullThreads = async (invalidateAll = false) => { const u = el.threadRepoInput.value.trim(); if (!u.startsWith("gh://")) return; const info = parseGhUrl(u); try { const items = await ghApi(`${info.apiPath}?ref=${info.branch}`); - if (!items) { - THREAD.list = []; - await THREAD.save(); - } else { - THREAD.list = items.map((i) => { - if (i.type === "dir") return { - id: i.name, - title: i.name, - type: "folder", - updatedAt: 0 - }; - if (i.type === "file" && i.name.endsWith(".md")) return { - id: i.path, - title: i.name, - type: "file", - updatedAt: 0 - }; - const d = deserializeThreadName(i.name); - return d ? { - ...d, - status: "synced" - } : null; - }).filter(Boolean); - await THREAD.save(); + const local = await localforage.getItem("rem_index_" + u.substring(5)) || []; + const remote = (items || []).map((i) => { + if (i.type === "dir") return { + id: i.name, + title: i.name, + type: "folder", + updatedAt: 0 + }; + if (i.type === "file" && i.name.endsWith(".md")) return { + id: i.path, + title: i.name, + type: "file", + updatedAt: 0 + }; + const d = deserializeThreadName(i.name); + return d ? { + ...d, + status: "synced" + } : null; + }).filter(Boolean); + for (const t of invalidateAll ? [...local, ...remote] : local) { + if (t.type !== "thread") continue; + const next = remote.find((r) => r.type === "thread" && r.id === t.id); + if (invalidateAll || t.status !== "synced" || !next || next.updatedAt > t.updatedAt) await localforage.removeItem("rem_t_" + t.id); } + THREAD.list = remote; + await THREAD.save(); await renderThreads(); + return true; } catch (e) { console.error("Auto-pull failed:", e); + return false; } }; $(el.threadRepoInput).on("change", async () => { @@ -2301,8 +2305,9 @@ $(el.threadSyncBtn).on("click", async () => { THREAD.list = THREAD.list.filter((x) => !toRemove.includes(x.id)); await THREAD.save(); alert("Pushed to GitHub."); - } else { - await pullThreads(); + } else if (await pullThreads(true)) { + state.currentThreadId = null; + clearChat(); alert("Pulled from GitHub."); } await renderThreads(); diff --git a/dist/index.html b/dist/index.html index 7e062b6..2c16579 100644 --- a/dist/index.html +++ b/dist/index.html @@ -13,7 +13,7 @@ - + diff --git a/dist/sw.js b/dist/sw.js index 5541812..d19de50 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-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"f8c767b8fe6e11fa13e704d51b97ffbc"},{url:"assets/index-DUC1RW1F.css",revision:null},{url:"assets/index-CWYcSOgO.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 l=e=>i(e,t),c={module:{uri:t},exports:o,require:l};s[t]=Promise.all(n.map(e=>c[e]||l(e))).then(e=>(r(...e),o))}}define(["./workbox-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"f47c1e8b7a8062c7e3289f887383a9fa"},{url:"assets/index-DUC1RW1F.css",revision:null},{url:"assets/index-BqgZBjfh.js",revision:null},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});