mirror of
https://github.com/multipleof4/sune.git
synced 2026-09-18 03:25:44 +00:00
This build was committed by a bot.
This commit is contained in:
@@ -328,9 +328,9 @@ var el = window.el = Object.fromEntries([
|
|||||||
"suneRepoInput",
|
"suneRepoInput",
|
||||||
"suneSyncBtn",
|
"suneSyncBtn",
|
||||||
"suneSyncBadge",
|
"suneSyncBadge",
|
||||||
"suneSyncPopover",
|
"sunesSyncPopover",
|
||||||
"suneSyncUploadBtn",
|
"sunesSyncUploadBtn",
|
||||||
"suneSyncDownloadBtn"
|
"sunesSyncDownloadBtn"
|
||||||
].map((id) => [id, document.getElementById(id)]));
|
].map((id) => [id, document.getElementById(id)]));
|
||||||
//#endregion
|
//#endregion
|
||||||
//#region src/utils.js
|
//#region src/utils.js
|
||||||
@@ -927,14 +927,15 @@ var markLocalDirty = () => {
|
|||||||
setLocalSunesUpdatedAt();
|
setLocalSunesUpdatedAt();
|
||||||
setSuneSyncStatus("desynced");
|
setSuneSyncStatus("desynced");
|
||||||
};
|
};
|
||||||
|
var isSuneStorageKey = (k) => !SYSTEM_KEYS.has(k) && /^sune_[^_]+_/.test(k);
|
||||||
var _origSetItem = localStorage.setItem.bind(localStorage), _origRemoveItem = localStorage.removeItem.bind(localStorage);
|
var _origSetItem = localStorage.setItem.bind(localStorage), _origRemoveItem = localStorage.removeItem.bind(localStorage);
|
||||||
localStorage.setItem = (k, v) => {
|
localStorage.setItem = (k, v) => {
|
||||||
_origSetItem(k, v);
|
_origSetItem(k, v);
|
||||||
if (!isSyncPulling && k.startsWith("sune_")) markLocalDirty();
|
if (!isSyncPulling && isSuneStorageKey(k)) markLocalDirty();
|
||||||
};
|
};
|
||||||
localStorage.removeItem = (k) => {
|
localStorage.removeItem = (k) => {
|
||||||
_origRemoveItem(k);
|
_origRemoveItem(k);
|
||||||
if (!isSyncPulling && k.startsWith("sune_")) markLocalDirty();
|
if (!isSyncPulling && isSuneStorageKey(k)) markLocalDirty();
|
||||||
};
|
};
|
||||||
function setSuneSyncStatus(status) {
|
function setSuneSyncStatus(status) {
|
||||||
const b = el.suneSyncBadge;
|
const b = el.suneSyncBadge;
|
||||||
@@ -1495,14 +1496,15 @@ function showSunePopover(btn, id) {
|
|||||||
positionPopover(btn, el.sunePopover);
|
positionPopover(btn, el.sunePopover);
|
||||||
icons();
|
icons();
|
||||||
}
|
}
|
||||||
var hideSuneSyncPopover = () => {
|
var hideSunesSyncPopover = () => {
|
||||||
el.suneSyncPopover.classList.add("hidden");
|
el.sunesSyncPopover.classList.add("hidden");
|
||||||
};
|
}, hideSuneSyncPopover = hideSunesSyncPopover;
|
||||||
function showSuneSyncPopover(btn) {
|
function showSunesSyncPopover(btn) {
|
||||||
el.suneSyncPopover.classList.remove("hidden");
|
el.sunesSyncPopover.classList.remove("hidden");
|
||||||
positionPopover(btn || el.suneSyncBtn, el.suneSyncPopover);
|
positionPopover(btn || el.suneSyncBtn, el.sunesSyncPopover);
|
||||||
icons();
|
icons();
|
||||||
}
|
}
|
||||||
|
var showSuneSyncPopover = showSunesSyncPopover;
|
||||||
$(el.threadList).on("click", async (e) => {
|
$(el.threadList).on("click", async (e) => {
|
||||||
const openBtn = e.target.closest("[data-open-thread]"), menuBtn = e.target.closest("[data-thread-menu]");
|
const openBtn = e.target.closest("[data-open-thread]"), menuBtn = e.target.closest("[data-thread-menu]");
|
||||||
if (openBtn) {
|
if (openBtn) {
|
||||||
@@ -1720,12 +1722,12 @@ $(el.sunePopover).on("click", async (e) => {
|
|||||||
} else if (act === "export") dl(`sune-${(s.name || "sune").replace(/\W/g, "_")}-${ts()}.sune`, [s]);
|
} else if (act === "export") dl(`sune-${(s.name || "sune").replace(/\W/g, "_")}-${ts()}.sune`, [s]);
|
||||||
hideSunePopover();
|
hideSunePopover();
|
||||||
});
|
});
|
||||||
$(el.suneSyncUploadBtn).on("click", () => {
|
$(el.sunesSyncUploadBtn).on("click", () => {
|
||||||
hideSuneSyncPopover();
|
hideSunesSyncPopover();
|
||||||
performSuneUpload();
|
performSuneUpload();
|
||||||
});
|
});
|
||||||
$(el.suneSyncDownloadBtn).on("click", () => {
|
$(el.sunesSyncDownloadBtn).on("click", () => {
|
||||||
hideSuneSyncPopover();
|
hideSunesSyncPopover();
|
||||||
performSuneDownload(false);
|
performSuneDownload(false);
|
||||||
});
|
});
|
||||||
function updateAttachBadge() {
|
function updateAttachBadge() {
|
||||||
@@ -2126,10 +2128,10 @@ async function init() {
|
|||||||
$(window).on("resize", () => {
|
$(window).on("resize", () => {
|
||||||
hideThreadPopover();
|
hideThreadPopover();
|
||||||
hideSunePopover();
|
hideSunePopover();
|
||||||
hideSuneSyncPopover();
|
hideSunesSyncPopover();
|
||||||
});
|
});
|
||||||
$(document).on("click", (e) => {
|
$(document).on("click", (e) => {
|
||||||
if (el.suneSyncPopover && !el.suneSyncPopover.classList.contains("hidden") && !el.suneSyncPopover.contains(e.target) && !el.suneSyncBtn.contains(e.target)) hideSuneSyncPopover();
|
if (el.sunesSyncPopover && !el.sunesSyncPopover.classList.contains("hidden") && !el.sunesSyncPopover.contains(e.target) && !el.suneSyncBtn.contains(e.target)) hideSunesSyncPopover();
|
||||||
});
|
});
|
||||||
var htmlTabs = {
|
var htmlTabs = {
|
||||||
index: ["htmlTab_index", "htmlEditor"],
|
index: ["htmlTab_index", "htmlEditor"],
|
||||||
@@ -2350,13 +2352,16 @@ var performSuneDownload = async (isAuto = false, prefData = null, prefSha = null
|
|||||||
if (Array.isArray(data.sunes)) {
|
if (Array.isArray(data.sunes)) {
|
||||||
sunes = data.sunes.map(makeSune);
|
sunes = data.sunes.map(makeSune);
|
||||||
su.save(sunes);
|
su.save(sunes);
|
||||||
if (data.activeId) SUNE.setActive(data.activeId);
|
const nextActive = data.activeId || (sunes.some((s) => s.id === su.getActiveId()) ? su.getActiveId() : sunes[0]?.id);
|
||||||
|
if (nextActive) SUNE.setActive(nextActive);
|
||||||
}
|
}
|
||||||
if (data.storage && typeof data.storage === "object") {
|
if (data.storage && typeof data.storage === "object") {
|
||||||
Object.keys(localStorage).forEach((k) => {
|
Object.keys(localStorage).forEach((k) => {
|
||||||
if (k.startsWith("sune_")) localStorage.removeItem(k);
|
if (isSuneStorageKey(k)) localStorage.removeItem(k);
|
||||||
|
});
|
||||||
|
Object.entries(data.storage).forEach(([k, v]) => {
|
||||||
|
if (isSuneStorageKey(k)) localStorage.setItem(k, v);
|
||||||
});
|
});
|
||||||
Object.entries(data.storage).forEach(([k, v]) => localStorage.setItem(k, v));
|
|
||||||
}
|
}
|
||||||
setLocalSunesUpdatedAt(num(data.updatedAt, Date.now()));
|
setLocalSunesUpdatedAt(num(data.updatedAt, Date.now()));
|
||||||
} finally {
|
} finally {
|
||||||
@@ -2379,7 +2384,6 @@ var performSuneUpload = async () => {
|
|||||||
const info = parseGhUrl(u);
|
const info = parseGhUrl(u);
|
||||||
try {
|
try {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
setLocalSunesUpdatedAt(now);
|
|
||||||
const data = {
|
const data = {
|
||||||
version: 1,
|
version: 1,
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
@@ -2394,12 +2398,14 @@ var performSuneUpload = async () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
const x = await ghApi(`${info.apiPath}/sunes.json?ref=${info.branch}`);
|
const x = await ghApi(`${info.apiPath}/sunes.json?ref=${info.branch}`);
|
||||||
(await ghApi(`${info.apiPath}/sunes.json`, "PUT", {
|
const res = await ghApi(`${info.apiPath}/sunes.json`, "PUT", {
|
||||||
message: "Sync Sunes",
|
message: "Sync Sunes",
|
||||||
content: utob(JSON.stringify(data, null, 2)),
|
content: utob(JSON.stringify(data, null, 2)),
|
||||||
branch: info.branch,
|
branch: info.branch,
|
||||||
sha: x?.sha
|
sha: x?.sha
|
||||||
}))?.content?.sha;
|
});
|
||||||
|
setLocalSunesUpdatedAt(now);
|
||||||
|
res?.content?.sha;
|
||||||
setSuneSyncStatus("synced");
|
setSuneSyncStatus("synced");
|
||||||
alert("Sunes pushed.");
|
alert("Sunes pushed.");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -2414,7 +2420,7 @@ $(el.suneRepoInput).on("change", () => {
|
|||||||
$(el.suneSyncBtn).on("click", (e) => {
|
$(el.suneSyncBtn).on("click", (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (!el.suneRepoInput.value.trim().startsWith("gh://")) return;
|
if (!el.suneRepoInput.value.trim().startsWith("gh://")) return;
|
||||||
showSuneSyncPopover(el.suneSyncBtn);
|
showSunesSyncPopover(el.suneSyncBtn);
|
||||||
});
|
});
|
||||||
$(el.sidebarBtnLeft).on("click", () => {
|
$(el.sidebarBtnLeft).on("click", () => {
|
||||||
if (el.suneRepoInput.value.trim().startsWith("gh://")) checkSuneSyncStatus();
|
if (el.suneRepoInput.value.trim().startsWith("gh://")) checkSuneSyncStatus();
|
||||||
@@ -2737,6 +2743,8 @@ Object.assign(window, {
|
|||||||
showSunePopover,
|
showSunePopover,
|
||||||
hideSuneSyncPopover,
|
hideSuneSyncPopover,
|
||||||
showSuneSyncPopover,
|
showSuneSyncPopover,
|
||||||
|
hideSunesSyncPopover,
|
||||||
|
showSunesSyncPopover,
|
||||||
setSuneSyncStatus,
|
setSuneSyncStatus,
|
||||||
checkSuneSyncStatus,
|
checkSuneSyncStatus,
|
||||||
performSuneDownload,
|
performSuneDownload,
|
||||||
10
dist/index.html
vendored
10
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-CIiJlteO.js"></script>
|
<script type="module" crossorigin src="/assets/index-TjHmRKFx.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')">
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="sidebarOverlayLeft" class="fixed inset-0 z-40 bg-black/20 hidden" @click="document.getElementById('sidebarLeft').classList.add('-translate-x-full');$el.classList.add('hidden');document.getElementById('sidebarRight').classList.add('translate-x-full');document.getElementById('sidebarOverlayRight').classList.add('hidden');hideThreadPopover();hideSunePopover();hideSuneSyncPopover()"></div>
|
<div id="sidebarOverlayLeft" class="fixed inset-0 z-40 bg-black/20 hidden" @click="document.getElementById('sidebarLeft').classList.add('-translate-x-full');$el.classList.add('hidden');document.getElementById('sidebarRight').classList.add('translate-x-full');document.getElementById('sidebarOverlayRight').classList.add('hidden');hideThreadPopover();hideSunePopover();hideSunesSyncPopover()"></div>
|
||||||
<aside id="sidebarLeft" class="fixed inset-y-0 left-0 z-50 w-72 max-w-[85vw] bg-white border-r border-gray-200 shadow-xl transform -translate-x-full transition-transform duration-200 ease-out flex flex-col">
|
<aside id="sidebarLeft" class="fixed inset-y-0 left-0 z-50 w-72 max-w-[85vw] bg-white border-r border-gray-200 shadow-xl transform -translate-x-full transition-transform duration-200 ease-out flex flex-col">
|
||||||
<div class="p-2 border-b flex flex-col gap-2">
|
<div class="p-2 border-b flex flex-col gap-2">
|
||||||
<input id="suneRepoInput" type="text" placeholder="gh://owner/sunes" class="w-full h-9 rounded-lg border-0 bg-gray-100 px-3 text-xs font-mono focus:ring-2 focus:ring-black focus:bg-white"/>
|
<input id="suneRepoInput" type="text" placeholder="gh://owner/sunes" class="w-full h-9 rounded-lg border-0 bg-gray-100 px-3 text-xs font-mono focus:ring-2 focus:ring-black focus:bg-white"/>
|
||||||
@@ -94,9 +94,9 @@
|
|||||||
<button data-action="pfp" class="menu-item"><i data-lucide="image" class="h-4 w-4"></i><span>Change pfp</span></button>
|
<button data-action="pfp" class="menu-item"><i data-lucide="image" class="h-4 w-4"></i><span>Change pfp</span></button>
|
||||||
<button data-action="export" class="menu-item"><i data-lucide="download" class="h-4 w-4"></i><span>Export sune (.sune)</span></button>
|
<button data-action="export" class="menu-item"><i data-lucide="download" class="h-4 w-4"></i><span>Export sune (.sune)</span></button>
|
||||||
</div>
|
</div>
|
||||||
<div id="suneSyncPopover" class="menu-card hidden">
|
<div id="sunesSyncPopover" class="menu-card hidden">
|
||||||
<button id="suneSyncUploadBtn" class="menu-item"><i data-lucide="upload-cloud" class="h-4 w-4"></i><span>Upload to GitHub</span></button>
|
<button id="sunesSyncUploadBtn" class="menu-item"><i data-lucide="upload-cloud" class="h-4 w-4"></i><span>Upload to GitHub</span></button>
|
||||||
<button id="suneSyncDownloadBtn" class="menu-item"><i data-lucide="download-cloud" class="h-4 w-4"></i><span>Download from GitHub</span></button>
|
<button id="sunesSyncDownloadBtn" class="menu-item"><i data-lucide="download-cloud" class="h-4 w-4"></i><span>Download from GitHub</span></button>
|
||||||
</div>
|
</div>
|
||||||
<div id="suneModal" class="hidden fixed inset-0 z-50">
|
<div id="suneModal" class="hidden fixed inset-0 z-50">
|
||||||
<div class="absolute inset-0 bg-black/30"></div>
|
<div class="absolute inset-0 bg-black/30"></div>
|
||||||
|
|||||||
2
dist/sw.js
vendored
2
dist/sw.js
vendored
@@ -1 +1 @@
|
|||||||
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} didn’t register its module`);return e}));self.define=(n,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(i[r])return;let o={};const l=e=>s(e,r),d={module:{uri:r},exports:o,require:l};i[r]=Promise.all(n.map(e=>d[e]||l(e))).then(e=>(t(...e),o))}}define(["./workbox-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"045ea755906b79a6e8657e409e3ad7f3"},{url:"assets/index-DUC1RW1F.css",revision:null},{url:"assets/index-CIiJlteO.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:"a64ac52329387d11ea67cf7b0a2b461d"},{url:"assets/index-TjHmRKFx.js",revision:null},{url:"assets/index-DUC1RW1F.css",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