This build was committed by a bot.

This commit is contained in:
github-actions[bot]
2026-01-16 22:21:49 +00:00
parent 895fa30540
commit 73977e6bfe
3 changed files with 10 additions and 11 deletions

View File

@@ -1387,9 +1387,8 @@ const ghApi = async (path, method = "GET", body = null) => {
return r.status === 404 ? null : r.json();
};
const parseGhUrl = (u) => {
const p = u.substring(5).split("/"), owner = p[0], repoPart = p[1] || "", branch = repoPart.includes("@") ? repoPart.split("@")[1] : "main", repo = repoPart.split("@")[0], path = p.slice(2).join("/");
const dirPath = path ? path + "/" : "";
return { owner, repo, branch, path, full: `${owner}/${repo}/contents/${dirPath}index.json?ref=${branch}`, dir: `${owner}/${repo}/contents/${dirPath}`.replace(/\/$/, "") + "/" };
const p = u.substring(5).split("/"), owner = p[0], repoPart = p[1] || "", branch = repoPart.includes("@") ? repoPart.split("@")[1] : "main", repo = repoPart.split("@")[0], path = p.slice(2).join("/").replace(/\/$/, "");
return { owner, repo, branch, path, apiPath: `${owner}/${repo}/contents${path ? "/" + path : ""}` };
};
$(el.threadRepoInput).on("change", async () => {
const u = el.threadRepoInput.value.trim();
@@ -1427,7 +1426,7 @@ $(el.threadSyncBtn).on("click", async () => {
const info = parseGhUrl(u);
try {
if (mode) {
const remoteItems = await ghApi(`${info.owner}/${info.repo}/contents/${info.path}?ref=${info.branch}`) || [], remoteMap = {};
const remoteItems = await ghApi(`${info.apiPath}?ref=${info.branch}`) || [], remoteMap = {};
remoteItems.forEach((i) => {
const d = deserializeThreadName(i.name);
if (d) remoteMap[d.id] = { name: i.name, sha: i.sha };
@@ -1436,7 +1435,7 @@ $(el.threadSyncBtn).on("click", async () => {
for (const t of THREAD.list) {
if (t.status === "deleted") {
if (remoteMap[t.id]) {
await ghApi(`${info.owner}/${info.repo}/contents/${info.path}/${remoteMap[t.id].name}`, "DELETE", { message: `Delete thread ${t.id}`, sha: remoteMap[t.id].sha, branch: info.branch });
await ghApi(`${info.apiPath}/${remoteMap[t.id].name}`, "DELETE", { message: `Delete thread ${t.id}`, sha: remoteMap[t.id].sha, branch: info.branch });
await localforage.removeItem("rem_t_" + t.id);
}
toRemove.push(t.id);
@@ -1446,10 +1445,10 @@ $(el.threadSyncBtn).on("click", async () => {
if (t.status === "modified" || t.status === "new") {
const newName = serializeThreadName(t), msgs = await localforage.getItem("rem_t_" + t.id);
if (remoteMap[t.id] && remoteMap[t.id].name !== newName) {
await ghApi(`${info.owner}/${info.repo}/contents/${info.path}/${remoteMap[t.id].name}`, "DELETE", { message: `Rename thread ${t.id}`, sha: remoteMap[t.id].sha, branch: info.branch });
await ghApi(`${info.apiPath}/${remoteMap[t.id].name}`, "DELETE", { message: `Rename thread ${t.id}`, sha: remoteMap[t.id].sha, branch: info.branch });
}
const ex = await ghApi(`${info.owner}/${info.repo}/contents/${info.path}/${newName}?ref=${info.branch}`);
await ghApi(`${info.owner}/${info.repo}/contents/${info.path}/${newName}`, "PUT", { message: `Sync thread ${t.id}`, content: utob(JSON.stringify(msgs, null, 2)), branch: info.branch, sha: ex?.sha });
const ex = await ghApi(`${info.apiPath}/${newName}?ref=${info.branch}`);
await ghApi(`${info.apiPath}/${newName}`, "PUT", { message: `Sync thread ${t.id}`, content: utob(JSON.stringify(msgs, null, 2)), branch: info.branch, sha: ex?.sha });
t.status = "synced";
}
}
@@ -1457,7 +1456,7 @@ $(el.threadSyncBtn).on("click", async () => {
await THREAD.save();
alert("Pushed to GitHub.");
} else {
const items = await ghApi(`${info.owner}/${info.repo}/contents/${info.path}?ref=${info.branch}`);
const items = await ghApi(`${info.apiPath}?ref=${info.branch}`);
if (!items) {
THREAD.list = [];
await THREAD.save();

2
dist/index.html vendored
View File

@@ -12,7 +12,7 @@
<script defer src="https://cdn.jsdelivr.net/npm/cash-dom/dist/cash.min.js"></script>
<script defer src="//unpkg.com/alpinejs"></script>
<script type="module" crossorigin src="/assets/index-Dk1VBKCH.js"></script>
<script type="module" crossorigin src="/assets/index-DiYgOCm5.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-JLEDB1oP.css">
<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')">

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 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-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"5f7ff0e511e85ad6a5d165a56b5997c2"},{url:"assets/index-JLEDB1oP.css",revision:null},{url:"assets/index-Dk1VBKCH.js",revision:null},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});
if(!self.define){let e,i={};const s=(s,n)=>(s=new URL(s+".js",n).href,i[s]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=s,e.onload=i,document.head.appendChild(e)}else e=s,importScripts(s),i()}).then(()=>{let e=i[s];if(!e)throw new Error(`Module ${s} didnt register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(i[t])return;let o={};const c=e=>s(e,t),l={module:{uri:t},exports:o,require:c};i[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:"0bdb9c92bc46620107f6d34ba6a9bbae"},{url:"assets/index-JLEDB1oP.css",revision:null},{url:"assets/index-DiYgOCm5.js",revision:null},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});