mirror of
https://github.com/multipleof4/sune.git
synced 2026-09-18 11:35:43 +00:00
This build was committed by a bot.
This commit is contained in:
@@ -324,7 +324,9 @@ var el = window.el = Object.fromEntries([
|
||||
"threadRepoInput",
|
||||
"threadBackBtn",
|
||||
"threadFolderBtn",
|
||||
"threadSyncBtn"
|
||||
"threadSyncBtn",
|
||||
"suneRepoInput",
|
||||
"suneSyncBtn"
|
||||
].map((id) => [id, document.getElementById(id)]));
|
||||
//#endregion
|
||||
//#region src/utils.js
|
||||
@@ -879,6 +881,7 @@ var SYSTEM_KEYS = new Set([
|
||||
"sunes_v1",
|
||||
"active_sune_id",
|
||||
"thread_repo_url",
|
||||
"sune_repo_url",
|
||||
"user_name",
|
||||
"user_avatar",
|
||||
"provider",
|
||||
@@ -2035,8 +2038,9 @@ USER.logMany = async (msgs) => {
|
||||
};
|
||||
async function init() {
|
||||
gcStorage();
|
||||
const u = localStorage.getItem("thread_repo_url") || "";
|
||||
const u = localStorage.getItem("thread_repo_url") || "", suR = localStorage.getItem("sune_repo_url") || "";
|
||||
el.threadRepoInput.value = u;
|
||||
el.suneRepoInput.value = suR;
|
||||
el.threadFolderBtn.classList.toggle("hidden", !u.startsWith("gh://"));
|
||||
el.threadBackBtn.classList.toggle("hidden", !u.startsWith("gh://") || u.split("/").length <= 3);
|
||||
await THREAD.load();
|
||||
@@ -2213,6 +2217,53 @@ $(el.threadSyncBtn).on("click", async () => {
|
||||
alert("Sync failed: " + e.message);
|
||||
}
|
||||
});
|
||||
$(el.suneRepoInput).on("change", () => {
|
||||
localStorage.setItem("sune_repo_url", el.suneRepoInput.value.trim());
|
||||
});
|
||||
$(el.suneSyncBtn).on("click", async () => {
|
||||
const u = el.suneRepoInput.value.trim();
|
||||
if (!u.startsWith("gh://")) return;
|
||||
const mode = confirm("Sync Sunes:\nOK = Upload (Push)\nCancel = Download (Pull)"), info = parseGhUrl(u);
|
||||
try {
|
||||
if (mode) {
|
||||
const data = {
|
||||
version: 1,
|
||||
sunes: SUNE.list,
|
||||
activeId: SUNE.id,
|
||||
storage: {}
|
||||
};
|
||||
SUNE.list.forEach((s) => {
|
||||
const p = `sune_${s.id}_`;
|
||||
Object.keys(localStorage).forEach((k) => {
|
||||
if (k.startsWith(p)) data.storage[k] = localStorage.getItem(k);
|
||||
});
|
||||
});
|
||||
const x = await ghApi(`${info.apiPath}/sunes.json?ref=${info.branch}`);
|
||||
await ghApi(`${info.apiPath}/sunes.json`, "PUT", {
|
||||
message: "Sync Sunes",
|
||||
content: utob(JSON.stringify(data, null, 2)),
|
||||
branch: info.branch,
|
||||
sha: x?.sha
|
||||
});
|
||||
alert("Sunes pushed.");
|
||||
} else {
|
||||
const text = await ghGetFileContent(info, "sunes.json");
|
||||
if (!text) throw new Error("sunes.json not found");
|
||||
const data = JSON.parse(text);
|
||||
if (data.sunes) {
|
||||
sunes = data.sunes.map(makeSune);
|
||||
SUNE.save();
|
||||
if (data.activeId) SUNE.setActive(data.activeId);
|
||||
}
|
||||
if (data.storage) Object.entries(data.storage).forEach(([k, v]) => localStorage.setItem(k, v));
|
||||
renderSidebar();
|
||||
await reflectActiveSune();
|
||||
alert("Sunes pulled.");
|
||||
}
|
||||
} catch (e) {
|
||||
alert("Sync failed: " + e.message);
|
||||
}
|
||||
});
|
||||
init();
|
||||
var accountTabs = {
|
||||
General: ["accountTabGeneral", "accountPanelGeneral"],
|
||||
@@ -2233,6 +2284,7 @@ function openAccountSettings() {
|
||||
el.set_api_key_claude.value = USER.apiKeyClaude || "";
|
||||
el.set_api_key_cf.value = USER.apiKeyCloudflare || "";
|
||||
el.set_api_key_custom1.value = USER.customKey1 || "";
|
||||
el.set_api_key_custom1.value = USER.customKey1 || "";
|
||||
el.set_master_prompt.value = USER.masterPrompt || "";
|
||||
el.set_title_model.value = USER.titleModel;
|
||||
el.set_gh_token.value = USER.githubToken || "";
|
||||
10
dist/index.html
vendored
10
dist/index.html
vendored
@@ -13,7 +13,7 @@
|
||||
<script defer src="//unpkg.com/alpinejs"></script>
|
||||
|
||||
|
||||
<script type="module" crossorigin src="/assets/index-B9_XUvqP.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-BgxroUTU.js"></script>
|
||||
<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>
|
||||
<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')">
|
||||
@@ -44,7 +44,13 @@
|
||||
</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()"></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">
|
||||
<div class="p-3 border-b flex items-center gap-2"><button id="newSuneBtn" class="px-3 py-2 rounded-xl bg-black text-white text-sm hover:bg-black/90">New sune</button><span class="text-xs text-gray-500">Click name to equip</span></div>
|
||||
<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"/>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<button id="newSuneBtn" class="px-3 py-1.5 rounded-lg bg-black text-white text-[10px] font-bold uppercase tracking-wider hover:bg-black/90 transition">New Sune</button>
|
||||
<button id="suneSyncBtn" class="px-3 py-1.5 rounded-lg bg-gray-100 text-gray-900 text-[10px] font-bold uppercase tracking-wider hover:bg-gray-200 transition flex items-center gap-1"><i data-lucide="refresh-cw" class="h-3 w-3"></i><span>Sync</span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="suneList" class="flex-1 overflow-y-auto divide-y"></div>
|
||||
<div class="p-3 border-t relative flex items-center gap-2">
|
||||
<button id="userMenuBtn" class="flex-1 flex items-center justify-between px-3 py-2 rounded-xl bg-gray-100 hover:bg-gray-200 active:scale-[.99] transition" @click.stop="document.getElementById('userMenu').classList.toggle('hidden')"><span class="flex items-center gap-2"><span id="userMenuAvatar" class="h-6 w-6 rounded-full bg-gray-900 text-white flex items-center justify-center overflow-hidden shrink-0">👤</span><span class="text-sm">User</span></span><i data-lucide="chevron-down" class="h-4 w-4"></i></button>
|
||||
|
||||
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 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:"ffc0102df9ec879074587fd90a2b13b0"},{url:"assets/index-DUC1RW1F.css",revision:null},{url:"assets/index-B9_XUvqP.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 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:"4dfde2d75701f65ce92ab40f913497db"},{url:"assets/index-DUC1RW1F.css",revision:null},{url:"assets/index-BgxroUTU.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