mirror of
https://github.com/multipleof4/sune.git
synced 2026-02-04 10:08:00 +00:00
This build was committed by a bot.
This commit is contained in:
@@ -1374,8 +1374,9 @@ const ghApi = async (path, method = "GET", body = null) => {
|
|||||||
return r.status === 404 ? null : r.json();
|
return r.status === 404 ? null : r.json();
|
||||||
};
|
};
|
||||||
const parseGhUrl = (u) => {
|
const parseGhUrl = (u) => {
|
||||||
const p = u.substring(5).split("/"), owner = p[0], repo = p[1], branch = repo?.includes("@") ? repo.split("@")[1] : "main", cleanRepo = repo?.split("@")[0], path = p.slice(2).join("/");
|
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("/");
|
||||||
return { owner, repo: cleanRepo, branch, path, full: `${owner}/${cleanRepo}/contents/${path ? path + "/" : ""}index.json?ref=${branch}`, dir: `${owner}/${cleanRepo}/contents/${path ? path + "/" : " "}`.trim() };
|
const dirPath = path ? path + "/" : "";
|
||||||
|
return { owner, repo, branch, path, full: `${owner}/${repo}/contents/${dirPath}index.json?ref=${branch}`, dir: `${owner}/${repo}/contents/${dirPath}` };
|
||||||
};
|
};
|
||||||
$(el.threadRepoInput).on("change", async () => {
|
$(el.threadRepoInput).on("change", async () => {
|
||||||
const u = el.threadRepoInput.value.trim();
|
const u = el.threadRepoInput.value.trim();
|
||||||
@@ -1413,11 +1414,11 @@ $(el.threadSyncBtn).on("click", async () => {
|
|||||||
for (const t of THREAD.list) {
|
for (const t of THREAD.list) {
|
||||||
if (t.type === "thread" && (t.status === "modified" || t.status === "new")) {
|
if (t.type === "thread" && (t.status === "modified" || t.status === "new")) {
|
||||||
const msgs = await localforage.getItem("rem_t_" + t.id), fPath = `${info.dir}${t.id}.json`, ex = await ghApi(fPath + "?ref=" + info.branch);
|
const msgs = await localforage.getItem("rem_t_" + t.id), fPath = `${info.dir}${t.id}.json`, ex = await ghApi(fPath + "?ref=" + info.branch);
|
||||||
await ghApi(fPath, "PUT", { message: `Sync thread ${t.id}`, content: utob(JSON.stringify(msgs)), branch: info.branch, sha: ex?.sha });
|
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";
|
t.status = "synced";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await ghApi(info.full, "PUT", { message: "Update index.json", content: utob(JSON.stringify(THREAD.list)), branch: info.branch, sha });
|
await ghApi(info.full, "PUT", { message: "Update index.json", content: utob(JSON.stringify(THREAD.list, null, 2)), branch: info.branch, sha });
|
||||||
alert("Pushed to GitHub.");
|
alert("Pushed to GitHub.");
|
||||||
} else {
|
} else {
|
||||||
const idxFile = await ghApi(info.full);
|
const idxFile = await ghApi(info.full);
|
||||||
2
dist/index.html
vendored
2
dist/index.html
vendored
@@ -12,7 +12,7 @@
|
|||||||
<script defer src="https://cdn.jsdelivr.net/npm/cash-dom/dist/cash.min.js"></script>
|
<script defer src="https://cdn.jsdelivr.net/npm/cash-dom/dist/cash.min.js"></script>
|
||||||
<script defer src="//unpkg.com/alpinejs"></script>
|
<script defer src="//unpkg.com/alpinejs"></script>
|
||||||
|
|
||||||
<script type="module" crossorigin src="/assets/index-va-QrBFS.js"></script>
|
<script type="module" crossorigin src="/assets/index-BdQE1Xqo.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-JLEDB1oP.css">
|
<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>
|
<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),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:"ccf24cd20b77e03a1658744f9d9673db"},{url:"assets/index-va-QrBFS.js",revision:null},{url:"assets/index-JLEDB1oP.css",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:"f5de2a58d8f0836b0c5c8b0917dfc229"},{url:"assets/index-JLEDB1oP.css",revision:null},{url:"assets/index-BdQE1Xqo.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