mirror of
https://github.com/multipleof4/sune.git
synced 2026-09-18 19:45:43 +00:00
This build was committed by a bot.
This commit is contained in:
@@ -2168,17 +2168,14 @@ el.htmlTab_index.textContent = "index.html";
|
|||||||
el.htmlTab_extension.textContent = "extension.html";
|
el.htmlTab_extension.textContent = "extension.html";
|
||||||
el.htmlTab_index.onclick = () => showHtmlTab("index");
|
el.htmlTab_index.onclick = () => showHtmlTab("index");
|
||||||
el.htmlTab_extension.onclick = () => showHtmlTab("extension");
|
el.htmlTab_extension.onclick = () => showHtmlTab("extension");
|
||||||
var pullThreads = async () => {
|
var pullThreads = async (invalidateAll = false) => {
|
||||||
const u = el.threadRepoInput.value.trim();
|
const u = el.threadRepoInput.value.trim();
|
||||||
if (!u.startsWith("gh://")) return;
|
if (!u.startsWith("gh://")) return;
|
||||||
const info = parseGhUrl(u);
|
const info = parseGhUrl(u);
|
||||||
try {
|
try {
|
||||||
const items = await ghApi(`${info.apiPath}?ref=${info.branch}`);
|
const items = await ghApi(`${info.apiPath}?ref=${info.branch}`);
|
||||||
if (!items) {
|
const local = await localforage.getItem("rem_index_" + u.substring(5)) || [];
|
||||||
THREAD.list = [];
|
const remote = (items || []).map((i) => {
|
||||||
await THREAD.save();
|
|
||||||
} else {
|
|
||||||
THREAD.list = items.map((i) => {
|
|
||||||
if (i.type === "dir") return {
|
if (i.type === "dir") return {
|
||||||
id: i.name,
|
id: i.name,
|
||||||
title: i.name,
|
title: i.name,
|
||||||
@@ -2197,11 +2194,18 @@ var pullThreads = async () => {
|
|||||||
status: "synced"
|
status: "synced"
|
||||||
} : null;
|
} : null;
|
||||||
}).filter(Boolean);
|
}).filter(Boolean);
|
||||||
await THREAD.save();
|
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();
|
await renderThreads();
|
||||||
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Auto-pull failed:", e);
|
console.error("Auto-pull failed:", e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$(el.threadRepoInput).on("change", async () => {
|
$(el.threadRepoInput).on("change", async () => {
|
||||||
@@ -2301,8 +2305,9 @@ $(el.threadSyncBtn).on("click", async () => {
|
|||||||
THREAD.list = THREAD.list.filter((x) => !toRemove.includes(x.id));
|
THREAD.list = THREAD.list.filter((x) => !toRemove.includes(x.id));
|
||||||
await THREAD.save();
|
await THREAD.save();
|
||||||
alert("Pushed to GitHub.");
|
alert("Pushed to GitHub.");
|
||||||
} else {
|
} else if (await pullThreads(true)) {
|
||||||
await pullThreads();
|
state.currentThreadId = null;
|
||||||
|
clearChat();
|
||||||
alert("Pulled from GitHub.");
|
alert("Pulled from GitHub.");
|
||||||
}
|
}
|
||||||
await renderThreads();
|
await renderThreads();
|
||||||
2
dist/index.html
vendored
2
dist/index.html
vendored
@@ -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-CWYcSOgO.js"></script>
|
<script type="module" crossorigin src="/assets/index-BqgZBjfh.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-DUC1RW1F.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-DUC1RW1F.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
2
dist/sw.js
vendored
@@ -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")))});
|
||||||
|
|||||||
Reference in New Issue
Block a user