This build was committed by a bot.

This commit is contained in:
github-actions[bot]
2026-06-02 04:05:43 +00:00
parent e451273ac9
commit c7b58c37e1
3 changed files with 43 additions and 7 deletions

View File

@@ -526,6 +526,38 @@ var parseGhUrl = (u) => {
apiPath: `${owner}/${repo}/contents${path ? "/" + path : ""}` apiPath: `${owner}/${repo}/contents${path ? "/" + path : ""}`
}; };
}; };
var ghGetFileContent = async (info, fileName) => {
const meta = await ghApi(`${info.apiPath}/${fileName}?ref=${info.branch}`);
if (!meta) {
console.warn("[Sune] GH file not found:", fileName);
return null;
}
console.log("[Sune] GH file meta:", {
name: fileName,
size: meta.size,
encoding: meta.encoding,
hasContent: !!(meta.content && meta.content.trim()),
sha: meta.sha
});
if (meta.content && meta.encoding === "base64") try {
return btou(meta.content);
} catch (e) {
console.error("[Sune] decode (contents) failed:", e);
}
if (meta.sha) try {
const blob = await ghApi(`${info.owner}/${info.repo}/git/blobs/${meta.sha}`);
console.log("[Sune] GH blob:", {
size: blob?.size,
encoding: blob?.encoding,
hasContent: !!(blob?.content && blob.content.trim())
});
if (blob && blob.content && blob.encoding === "base64") return btou(blob.content);
} catch (e) {
console.error("[Sune] blob fetch failed:", e);
}
console.warn("[Sune] Could not retrieve content for", fileName);
return null;
};
//#endregion //#endregion
//#region src/markdown.js //#region src/markdown.js
var md = window.md = window.markdownit({ var md = window.md = window.markdownit({
@@ -1331,16 +1363,19 @@ $(el.threadList).on("click", async (e) => {
clearChat(); clearChat();
const u = el.threadRepoInput.value.trim(), prefix = u.startsWith("gh://") ? "rem_t_" : "t_"; const u = el.threadRepoInput.value.trim(), prefix = u.startsWith("gh://") ? "rem_t_" : "t_";
let msgs = await localforage.getItem(prefix + id); let msgs = await localforage.getItem(prefix + id);
if (!msgs && u.startsWith("gh://")) try { if ((!msgs || !Array.isArray(msgs) || !msgs.length) && u.startsWith("gh://")) try {
const info = parseGhUrl(u), fileName = serializeThreadName(th), res = await ghApi(`${info.apiPath}/${fileName}?ref=${info.branch}`); const info = parseGhUrl(u), fileName = serializeThreadName(th), text = await ghGetFileContent(info, fileName);
if (res && res.content) { if (text) try {
msgs = JSON.parse(btou(res.content)); msgs = JSON.parse(text);
await localforage.setItem(prefix + id, msgs); await localforage.setItem(prefix + id, msgs);
th.status = "synced"; th.status = "synced";
await THREAD.save(); await THREAD.save();
} catch (pe) {
console.error("[Sune] Thread JSON parse failed for", fileName, "len", text.length, pe);
} }
else console.warn("[Sune] Remote thread returned no content:", fileName);
} catch (e) { } catch (e) {
console.error("Remote fetch failed", e); console.error("[Sune] Remote fetch failed", e);
} }
state.messages = Array.isArray(msgs) ? [...msgs] : []; state.messages = Array.isArray(msgs) ? [...msgs] : [];
for (const m of state.messages) { for (const m of state.messages) {
@@ -2385,6 +2420,7 @@ Object.assign(window, {
cacheStore, cacheStore,
ghApi, ghApi,
parseGhUrl, parseGhUrl,
ghGetFileContent,
pullThreads pullThreads
}); });
//#endregion //#endregion

2
dist/index.html vendored
View File

@@ -13,7 +13,7 @@
<script defer src="//unpkg.com/alpinejs"></script> <script defer src="//unpkg.com/alpinejs"></script>
<script type="module" crossorigin src="/assets/index-CyJ4d9Tf.js"></script> <script type="module" crossorigin src="/assets/index-Dkjswwpy.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DaGRC7Kr.css"> <link rel="stylesheet" crossorigin href="/assets/index-DaGRC7Kr.css">
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head> <link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
<body class="bg-white text-gray-900 selection:bg-black/10" x-data @click.window="if($event.target.closest('button')) haptic(); if(!document.getElementById('threadPopover').contains($event.target)&&!$event.target.closest('[data-thread-menu]')) hideThreadPopover(); if(!document.getElementById('sunePopover').contains($event.target)&&!$event.target.closest('[data-sune-menu]')) hideSunePopover(); if(!document.getElementById('userMenu').contains($event.target)&&!document.getElementById('userMenuBtn').contains($event.target)) document.getElementById('userMenu').classList.add('hidden')"> <body class="bg-white text-gray-900 selection:bg-black/10" x-data @click.window="if($event.target.closest('button')) haptic(); if(!document.getElementById('threadPopover').contains($event.target)&&!$event.target.closest('[data-thread-menu]')) hideThreadPopover(); if(!document.getElementById('sunePopover').contains($event.target)&&!$event.target.closest('[data-sune-menu]')) hideSunePopover(); if(!document.getElementById('userMenu').contains($event.target)&&!document.getElementById('userMenuBtn').contains($event.target)) document.getElementById('userMenu').classList.add('hidden')">

2
dist/sw.js vendored
View File

@@ -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} didnt 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 d=e=>i(e,t),l={module:{uri:t},exports:o,require:d};s[t]=Promise.all(n.map(e=>l[e]||d(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:"6fb424e8125bb9d640d2dc5435d8abcf"},{url:"assets/index-DaGRC7Kr.css",revision:null},{url:"assets/index-CyJ4d9Tf.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} didnt 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:"c59f6739a7fe91142d3b8530653b2d5c"},{url:"assets/index-Dkjswwpy.js",revision:null},{url:"assets/index-DaGRC7Kr.css",revision:null},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});