mirror of
https://github.com/sune-org/sune.git
synced 2026-09-18 12:45:45 +00:00
This build was committed by a bot.
This commit is contained in:
@@ -875,6 +875,76 @@ var __vitePreload = function preload(baseModule, deps, importerUrl) {
|
||||
var DEFAULT_MODEL = "openrouter/free";
|
||||
var icons = () => window.lucide && lucide.createIcons();
|
||||
var haptic = () => /android/i.test(navigator.userAgent) && navigator.vibrate?.(1);
|
||||
var SYSTEM_KEYS = new Set([
|
||||
"sunes_v1",
|
||||
"active_sune_id",
|
||||
"thread_repo_url",
|
||||
"user_name",
|
||||
"user_avatar",
|
||||
"provider",
|
||||
"openrouter_api_key",
|
||||
"openai_api_key",
|
||||
"google_api_key",
|
||||
"claude_api_key",
|
||||
"cloudflare_api_key",
|
||||
"master_prompt",
|
||||
"title_model",
|
||||
"gh_token",
|
||||
"custom_key_1"
|
||||
]);
|
||||
var gcStorage = () => {
|
||||
try {
|
||||
const alive = new Set(sunes.map((s) => s.id));
|
||||
Object.keys(localStorage).forEach((k) => {
|
||||
if (SYSTEM_KEYS.has(k) || /^(t_|rem_t_|rem_index_|localforage|threads_)/.test(k)) return;
|
||||
const m = k.match(/^sune_([a-zA-Z0-9_-]+)_/);
|
||||
if (m && alive.has(m[1])) return;
|
||||
localStorage.removeItem(k);
|
||||
});
|
||||
} catch {}
|
||||
};
|
||||
var cleanSuneStorage = (id) => {
|
||||
if (!id) return;
|
||||
const p = `sune_${id}_`;
|
||||
Object.keys(localStorage).forEach((k) => {
|
||||
if (k.startsWith(p)) localStorage.removeItem(k);
|
||||
});
|
||||
};
|
||||
var suneStorage = {
|
||||
get(k, def = null) {
|
||||
const id = SUNE.id;
|
||||
if (!id) return def;
|
||||
const v = localStorage.getItem(`sune_${id}_${k}`);
|
||||
if (v === null) return def;
|
||||
try {
|
||||
return JSON.parse(v);
|
||||
} catch {
|
||||
return v;
|
||||
}
|
||||
},
|
||||
set(k, v) {
|
||||
const id = SUNE.id;
|
||||
if (id) localStorage.setItem(`sune_${id}_${k}`, JSON.stringify(v));
|
||||
},
|
||||
remove(k) {
|
||||
const id = SUNE.id;
|
||||
if (id) localStorage.removeItem(`sune_${id}_${k}`);
|
||||
},
|
||||
clear() {
|
||||
const id = SUNE.id;
|
||||
if (id) cleanSuneStorage(id);
|
||||
},
|
||||
keys() {
|
||||
const id = SUNE.id;
|
||||
if (!id) return [];
|
||||
const p = `sune_${id}_`;
|
||||
return Object.keys(localStorage).filter((k) => k.startsWith(p)).map((k) => k.slice(p.length));
|
||||
},
|
||||
key(k) {
|
||||
const id = SUNE.id;
|
||||
return id ? `sune_${id}_${k}` : k;
|
||||
}
|
||||
};
|
||||
var su = {
|
||||
key: "sunes_v1",
|
||||
activeKey: "active_sune_id",
|
||||
@@ -927,6 +997,7 @@ var makeSune = (p = {}) => ({
|
||||
});
|
||||
var sunes = (su.load() || []).map(makeSune);
|
||||
var SUNE = window.SUNE = new Proxy({
|
||||
storage: suneStorage,
|
||||
get list() {
|
||||
return sunes;
|
||||
},
|
||||
@@ -948,6 +1019,8 @@ var SUNE = window.SUNE = new Proxy({
|
||||
const curId = this.id;
|
||||
sunes = sunes.filter((s) => s.id !== id);
|
||||
su.save(sunes);
|
||||
cleanSuneStorage(id);
|
||||
gcStorage();
|
||||
if (sunes.length === 0) {
|
||||
const def = this.create({ name: "Default" });
|
||||
this.setActive(def.id);
|
||||
@@ -1961,6 +2034,7 @@ USER.logMany = async (msgs) => {
|
||||
await THREAD.persist();
|
||||
};
|
||||
async function init() {
|
||||
gcStorage();
|
||||
const u = localStorage.getItem("thread_repo_url") || "";
|
||||
el.threadRepoInput.value = u;
|
||||
el.threadFolderBtn.classList.toggle("hidden", !u.startsWith("gh://"));
|
||||
@@ -2480,6 +2554,9 @@ Object.assign(window, {
|
||||
ghApi,
|
||||
parseGhUrl,
|
||||
ghGetFileContent,
|
||||
pullThreads
|
||||
pullThreads,
|
||||
suneStorage,
|
||||
gcStorage,
|
||||
cleanSuneStorage
|
||||
});
|
||||
//#endregion
|
||||
2
dist/index.html
vendored
2
dist/index.html
vendored
@@ -13,7 +13,7 @@
|
||||
<script defer src="//unpkg.com/alpinejs"></script>
|
||||
|
||||
|
||||
<script type="module" crossorigin src="/assets/index-DSULKYNe.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-DorXURih.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')">
|
||||
|
||||
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-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"a5eb77c86e6543dd7b8f4cd4109829ce"},{url:"assets/index-DUC1RW1F.css",revision:null},{url:"assets/index-DSULKYNe.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} didn’t 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 d=e=>s(e,t),l={module:{uri:t},exports:o,require:d};i[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:"ebdd4240397f887b5520ce6ff6679cde"},{url:"assets/index-DorXURih.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