From 4846c7884891cd87471889d9037785b9aec73389 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Feb 2026 15:49:32 +0000 Subject: build: rebuild frontend dist (fix ui-check CI failure) Source changes since last dist commit shifted Vite content hashes. Rebuilding ensures web/dist/v3/ matches a fresh `make ui-vanilla`. --- web/dist/v3/assets/index-7eLT9hpx.js | 143 -------------------------------- web/dist/v3/assets/index-BX6NJQDg.css | 1 - web/dist/v3/assets/index-CFkVnbAe.css | 1 + web/dist/v3/assets/index-CZ6KJbnj.js | 148 ++++++++++++++++++++++++++++++++++ web/dist/v3/index.html | 4 +- 5 files changed, 151 insertions(+), 146 deletions(-) delete mode 100644 web/dist/v3/assets/index-7eLT9hpx.js delete mode 100644 web/dist/v3/assets/index-BX6NJQDg.css create mode 100644 web/dist/v3/assets/index-CFkVnbAe.css create mode 100644 web/dist/v3/assets/index-CZ6KJbnj.js (limited to 'web/dist/v3') diff --git a/web/dist/v3/assets/index-7eLT9hpx.js b/web/dist/v3/assets/index-7eLT9hpx.js deleted file mode 100644 index 5e0576a..0000000 --- a/web/dist/v3/assets/index-7eLT9hpx.js +++ /dev/null @@ -1,143 +0,0 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const d of o.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function a(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(n){if(n.ep)return;n.ep=!0;const o=a(n);fetch(n.href,o)}})();function A(t){const a=`; ${document.cookie}`.split(`; ${t}=`);if(a.length===2)return a.pop()?.split(";").shift()}async function m(t,e){const a=e?.method?.toUpperCase()||"GET",s=["POST","PUT","DELETE"].includes(a),n=new Headers(e?.headers||{});if(s){const o=A("csrf_token");o&&n.set("X-CSRF-Token",o)}return fetch(t,{...e,headers:n,credentials:"include"})}function R(){const t=document.cookie.split("; ").find(e=>e.startsWith("neko_sidebar="));return t?t.split("=")[1]==="1":null}function C(t){document.cookie=`neko_sidebar=${t?"1":"0"}; path=/; max-age=31536000; SameSite=Lax`}function B(){const t=R();return t!==null?t:window.innerWidth>1024}class P extends EventTarget{feeds=[];tags=[];items=[];activeFeedId=null;activeTagName=null;filter="unread";searchQuery="";loading=!1;hasMore=!0;theme=localStorage.getItem("neko-theme")||"light";fontTheme=localStorage.getItem("neko-font-theme")||"default";sidebarVisible=B();setFeeds(e){this.feeds=e,this.emit("feeds-updated")}setTags(e){this.tags=e,this.emit("tags-updated")}setItems(e,a=!1){a?this.items=[...this.items,...e]:this.items=e,this.emit("items-updated")}setActiveFeed(e){this.activeFeedId=e,this.activeTagName=null,this.emit("active-feed-updated")}setActiveTag(e){this.activeTagName=e,this.activeFeedId=null,this.emit("active-tag-updated")}setFilter(e){this.filter!==e&&(this.filter=e,this.emit("filter-updated"))}setSearchQuery(e){this.searchQuery!==e&&(this.searchQuery=e,this.emit("search-updated"))}setLoading(e){this.loading=e,this.emit("loading-state-changed")}setHasMore(e){this.hasMore=e}setTheme(e){this.theme=e,localStorage.setItem("neko-theme",e),this.emit("theme-updated")}setFontTheme(e){this.fontTheme=e,localStorage.setItem("neko-font-theme",e),this.emit("theme-updated")}setSidebarVisible(e){this.sidebarVisible=e,C(e),this.emit("sidebar-toggle")}toggleSidebar(){this.setSidebarVisible(!this.sidebarVisible)}emit(e,a){this.dispatchEvent(new CustomEvent(e,{detail:a}))}on(e,a){this.addEventListener(e,a)}}const i=new P;class x extends EventTarget{constructor(){super(),window.addEventListener("popstate",()=>this.handleRouteChange())}handleRouteChange(){this.dispatchEvent(new CustomEvent("route-changed",{detail:this.getCurrentRoute()}))}getCurrentRoute(){const e=new URL(window.location.href),s=e.pathname.replace(/^\/v3\//,"").split("/").filter(Boolean);let n="/";const o={};return s[0]==="feed"&&s[1]?(n="/feed",o.feedId=s[1]):s[0]==="tag"&&s[1]?(n="/tag",o.tagName=decodeURIComponent(s[1])):s[0]==="settings"&&(n="/settings"),{path:n,params:o,query:e.searchParams}}navigate(e,a){let s=`/v3${e}`;if(a){const n=new URLSearchParams(a);s+=`?${n.toString()}`}window.history.pushState({},"",s),this.handleRouteChange()}updateQuery(e){const a=new URL(window.location.href);for(const[s,n]of Object.entries(e))n?a.searchParams.set(s,n):a.searchParams.delete(s);window.history.pushState({},"",a.toString()),this.handleRouteChange()}}const r=new x;function M(t,e=!1){const a=new Date(t.publish_date).toLocaleDateString();return` -
  • - - - ${t.full_content||t.description?` -
    - ${t.full_content||t.description} -
    - `:""} -
  • - `}let f=null,p=null;function O(){p=document.querySelector("#app"),p&&(p.className=`theme-${i.theme} font-${i.fontTheme}`,p.innerHTML=` -
    - - - -
    -
    -
    -
    - `,q())}function q(){document.getElementById("search-input")?.addEventListener("input",n=>{const o=n.target.value;r.updateQuery({q:o})}),document.getElementById("logo-link")?.addEventListener("click",()=>r.navigate("/")),document.getElementById("logout-button")?.addEventListener("click",n=>{n.preventDefault(),W()}),document.getElementById("sidebar-toggle-btn")?.addEventListener("click",()=>{i.toggleSidebar()}),document.getElementById("sidebar-backdrop")?.addEventListener("click",()=>{i.setSidebarVisible(!1)}),document.querySelectorAll(".sidebar-section.collapsible h3").forEach(n=>{n.addEventListener("click",()=>{n.parentElement?.classList.toggle("collapsed")})}),document.getElementById("sidebar")?.addEventListener("click",n=>{const o=n.target,d=o.closest("a");if(!d){o.classList.contains("logo")&&(n.preventDefault(),r.navigate("/",{}));return}const g=d.getAttribute("data-nav"),u=Object.fromEntries(r.getCurrentRoute().query.entries());if(g==="filter"){n.preventDefault();const l=d.getAttribute("data-value");r.getCurrentRoute().path==="/settings"?r.navigate("/",{...u,filter:l}):r.updateQuery({filter:l})}else if(g==="tag"){n.preventDefault();const l=d.getAttribute("data-value");r.navigate(`/tag/${encodeURIComponent(l)}`,u)}else if(g==="feed"){n.preventDefault();const l=d.getAttribute("data-value"),c=r.getCurrentRoute();i.activeFeedId===parseInt(l)&&c.path!=="/settings"?r.navigate("/",u):r.navigate(`/feed/${l}`,u)}else g==="settings"&&(n.preventDefault(),r.getCurrentRoute().path==="/settings"?r.navigate("/",u):r.navigate("/settings",u));window.innerWidth<=768&&i.setSidebarVisible(!1)}),document.getElementById("content-area")?.addEventListener("click",n=>{const o=n.target,d=o.closest('[data-action="toggle-star"]');if(d){const c=d.closest("[data-id]");if(c){const v=parseInt(c.getAttribute("data-id"));U(v)}return}const g=o.closest('[data-action="scrape"]');if(g){const c=g.closest("[data-id]");if(c){const v=parseInt(c.getAttribute("data-id"));V(v)}return}const u=o.closest('[data-action="open"]'),l=o.closest(".feed-item");if(l&&!u){const c=parseInt(l.getAttribute("data-id"));f=c,document.querySelectorAll(".feed-item").forEach(y=>{const F=parseInt(y.getAttribute("data-id")||"0");y.classList.toggle("selected",F===f)});const v=i.items.find(y=>y._id===c);v&&!v.read&&h(c,{read:!0})}})}function T(){const{feeds:t,activeFeedId:e}=i,a=document.getElementById("feed-list");a&&(a.innerHTML=t.map(s=>` -
  • - - ${s.title||s.url} - -
  • - `).join(""))}function k(){const{tags:t,activeTagName:e}=i,a=document.getElementById("tag-list");a&&(a.innerHTML=t.map(s=>` -
  • - - ${s.title} - -
  • - `).join(""))}function $(){const{filter:t}=i,e=document.getElementById("filter-list");e&&e.querySelectorAll("li").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-filter")===t)})}function L(){const{items:t,loading:e}=i,a=document.getElementById("content-area");if(!a||r.getCurrentRoute().path==="/settings")return;if(e&&t.length===0){a.innerHTML='

    Loading items...

    ';return}if(t.length===0){a.innerHTML='

    No items found.

    ';return}a.innerHTML=` - - ${i.hasMore?'
    Loading more...
    ':""} - `;const s=document.getElementById("main-content"),n=document.getElementById("load-more-sentinel");if(n&&new IntersectionObserver(d=>{d[0].isIntersecting&&!i.loading&&i.hasMore&&H()},{root:s,threshold:.1}).observe(n),s){let o=null;const d=()=>{o===null&&(o=window.setTimeout(()=>{const g=s.getBoundingClientRect();i.items.forEach(u=>{if(u.read)return;const l=document.querySelector(`.feed-item[data-id="${u._id}"]`);l&&l.getBoundingClientRect().bottom -

    Settings

    - -
    -

    Add Feed

    -
    - - -
    -
    - -
    -

    Appearance

    -
    - -
    - - -
    -
    -
    - - -
    -
    - -
    -

    Manage Feeds

    -
      - ${i.feeds.map(e=>` -
    • -
      -
      ${e.title||e.url}
      -
      ${e.url}
      -
      -
      - - - -
      -
    • - `).join("")} -
    -
    - -
    -

    Data Management

    -
    - -
    - - -
    -
    -
    - - `,document.getElementById("theme-options")?.addEventListener("click",e=>{const a=e.target.closest("button");if(a){const s=a.getAttribute("data-theme");i.setTheme(s),w()}}),document.getElementById("font-selector")?.addEventListener("change",e=>{i.setFontTheme(e.target.value)}),document.getElementById("add-feed-btn")?.addEventListener("click",async()=>{const e=document.getElementById("new-feed-url"),a=e.value.trim();a&&(await N(a)?(e.value="",alert("Feed added successfully!"),b()):alert("Failed to add feed."))}),document.getElementById("export-opml-btn")?.addEventListener("click",()=>{window.location.href="/api/export/opml"}),document.getElementById("import-opml-file")?.addEventListener("change",async e=>{const a=e.target.files?.[0];a&&(await D(a)?(alert("OPML imported successfully! Crawling started."),b()):alert("Failed to import OPML."))}),document.querySelectorAll(".delete-feed-btn").forEach(e=>{e.addEventListener("click",async a=>{const s=parseInt(a.target.getAttribute("data-id"));confirm("Are you sure you want to delete this feed?")&&(await Q(s),b(),await b(),w())})}),document.querySelectorAll(".update-feed-tag-btn").forEach(e=>{e.addEventListener("click",async a=>{const s=parseInt(a.target.getAttribute("data-id")),o=document.querySelector(`.feed-tag-input[data-id="${s}"]`).value.trim();await j(s,{category:o}),await b(),await _(),w(),alert("Feed updated")})}))}async function N(t){try{return(await m("/api/feed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:t})})).ok}catch(e){return console.error("Failed to add feed",e),!1}}async function D(t){try{const e=new FormData;e.append("file",t),e.append("format","opml");const a=document.cookie.split("; ").find(n=>n.startsWith("csrf_token="))?.split("=")[1];return(await fetch("/api/import",{method:"POST",headers:{"X-CSRF-Token":a||""},body:e})).ok}catch(e){return console.error("Failed to import OPML",e),!1}}async function Q(t){try{return(await m(`/api/feed/${t}`,{method:"DELETE"})).ok}catch(e){return console.error("Failed to delete feed",e),!1}}async function j(t,e){try{return(await m("/api/feed",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,_id:t})})).ok}catch(a){return console.error("Failed to update feed",a),!1}}async function U(t){const e=i.items.find(a=>a._id===t);e&&h(t,{starred:!e.starred})}async function V(t){if(i.items.find(a=>a._id===t))try{const a=await m(`/api/item/${t}/content`);if(a.ok){const s=await a.json();s.full_content&&h(t,{full_content:s.full_content})}}catch(a){console.error("Failed to fetch full content",a)}}async function h(t,e){try{if((await m(`/api/item/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok){const s=i.items.find(n=>n._id===t);if(s){Object.assign(s,e);const n=document.querySelector(`.feed-item[data-id="${t}"]`);if(n){if(e.read!==void 0&&n.classList.toggle("read",e.read),e.starred!==void 0){const o=n.querySelector(".star-btn");o&&(o.classList.toggle("is-starred",e.starred),o.classList.toggle("is-unstarred",!e.starred),o.setAttribute("title",e.starred?"Unstar":"Star"))}e.full_content&&L()}}}}catch(a){console.error("Failed to update item",a)}}async function b(){const t=await m("/api/feed/");if(t.ok){const e=await t.json();i.setFeeds(e)}}async function _(){const t=await m("/api/tag");if(t.ok){const e=await t.json();i.setTags(e)}}async function I(t,e,a=!1){i.setLoading(!0);try{const s=new URLSearchParams;t&&s.append("feed_id",t),e&&s.append("tag",e),i.searchQuery&&s.append("q",i.searchQuery),(i.filter==="starred"||i.filter==="all")&&s.append("read_filter","all"),i.filter==="starred"&&s.append("starred","true"),a&&i.items.length>0&&s.append("max_id",String(i.items[i.items.length-1]._id));const n=await m(`/api/stream?${s.toString()}`);if(n.ok){const o=await n.json();i.setHasMore(o.length>=50),i.setItems(o,a)}}finally{i.setLoading(!1)}}async function H(){const t=r.getCurrentRoute();I(t.params.feedId,t.params.tagName,!0)}async function W(){await m("/api/logout",{method:"POST"}),window.location.href="/login/"}function E(){const t=r.getCurrentRoute(),e=t.query.get("filter");i.setFilter(e||"unread");const a=t.query.get("q");if(a!==null&&i.setSearchQuery(a),t.path==="/settings"){w();return}if(t.path==="/feed"&&t.params.feedId){const s=parseInt(t.params.feedId);i.setActiveFeed(s),I(t.params.feedId),document.getElementById("section-feeds")?.classList.remove("collapsed")}else t.path==="/tag"&&t.params.tagName?(i.setActiveTag(t.params.tagName),I(void 0,t.params.tagName),document.getElementById("section-tags")?.classList.remove("collapsed")):(i.setActiveFeed(null),i.setActiveTag(null),I())}window.addEventListener("keydown",t=>{if(!["INPUT","TEXTAREA"].includes(t.target.tagName))switch(t.key){case"j":S(1);break;case"k":S(-1);break;case"r":if(f){const e=i.items.find(a=>a._id===f);e&&h(e._id,{read:!e.read})}break;case"s":if(f){const e=i.items.find(a=>a._id===f);e&&h(e._id,{starred:!e.starred})}break;case"/":t.preventDefault(),document.getElementById("search-input")?.focus();break}});function S(t){if(i.items.length===0)return;const e=i.items.findIndex(s=>s._id===f);let a;if(e===-1?a=t>0?0:i.items.length-1:a=e+t,a>=0&&a{const o=parseInt(n.getAttribute("data-id")||"0");n.classList.toggle("selected",o===f)});const s=document.querySelector(`.feed-item[data-id="${f}"]`);s&&s.scrollIntoView({block:"start",behavior:"smooth"}),i.items[a].read||h(f,{read:!0})}}i.on("feeds-updated",T);i.on("tags-updated",k);i.on("active-feed-updated",T);i.on("active-tag-updated",k);i.on("filter-updated",$);i.on("search-updated",()=>{const t=document.getElementById("search-input");t&&t.value!==i.searchQuery&&(t.value=i.searchQuery),E()});i.on("theme-updated",()=>{p||(p=document.querySelector("#app")),p&&(p.className=`theme-${i.theme} font-${i.fontTheme}`)});i.on("sidebar-toggle",()=>{const t=document.querySelector(".layout");t&&(i.sidebarVisible?(t.classList.remove("sidebar-hidden"),t.classList.add("sidebar-visible")):(t.classList.remove("sidebar-visible"),t.classList.add("sidebar-hidden")))});i.on("items-updated",L);i.on("loading-state-changed",L);r.addEventListener("route-changed",E);window.app={navigate:t=>r.navigate(t)};async function J(){const t=await m("/api/auth");if(!t||t.status===401){window.location.href="/login/";return}O(),$();try{await Promise.all([b(),_()])}catch(e){console.error("Initial fetch failed",e)}E()}typeof window<"u"&&!window.__VITEST__&&J(); diff --git a/web/dist/v3/assets/index-BX6NJQDg.css b/web/dist/v3/assets/index-BX6NJQDg.css deleted file mode 100644 index a1fdf40..0000000 --- a/web/dist/v3/assets/index-BX6NJQDg.css +++ /dev/null @@ -1 +0,0 @@ -:root{--font-body: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;--font-heading: "Helvetica Neue", Helvetica, Arial, sans-serif;--font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;line-height:1.5;font-size:18px;--bg-color: #ffffff;--text-color: rgba(0, 0, 0, .87);--sidebar-bg: #ccc;--link-color: #0000ee;--border-color: #999;--accent-color: #007bff;color-scheme:light dark}*{box-sizing:border-box}body{margin:0;font-family:var(--font-body);background-color:var(--bg-color);color:var(--text-color);height:100vh;width:100%;max-width:100vw;overflow:hidden}html{overflow-x:hidden;max-width:100vw}#app{height:100%;width:100%}.layout{display:flex;height:100%;width:100%;overflow-x:hidden;position:relative}.sidebar{width:11rem;background:#ffffff0d;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-right:1px solid rgba(255,255,255,.1);display:flex;flex-direction:column;height:100%;overflow:hidden;z-index:100;padding:5rem 1.5rem 1.5rem}.theme-dark .sidebar{background:#0003;border-right-color:#ffffff0d}.sidebar-search{margin-bottom:2rem}.sidebar-search input{width:100%;border-radius:20px;background:#0000000d;border:1px solid rgba(255,255,255,.1);color:var(--text-color);padding:.5rem 1rem;font-size:.9rem}.sidebar-scroll{flex:1;overflow-y:auto;margin:0 -1.5rem;padding:0 1.5rem}.sidebar-section h3{font-family:var(--font-sans);font-size:.7rem;text-transform:uppercase;letter-spacing:.1em;opacity:.5;margin-top:2rem;margin-bottom:.5rem;font-weight:700;display:flex;align-items:center;justify-content:space-between;cursor:pointer;-webkit-user-select:none;user-select:none}.sidebar-section h3:hover{opacity:.8}.sidebar-section .caret{font-size:.6rem;transition:transform .2s ease;transform:rotate(90deg)}.sidebar-section.collapsed .caret{transform:rotate(0)}.sidebar-section.collapsed ul{display:none}.sidebar-section ul{list-style:none;padding:0;margin:0}.sidebar-section li a{display:block;padding:.3rem .8rem;margin:.1rem 0;border-radius:8px;transition:all .2s ease;font-weight:500;font-size:.85rem;text-decoration:none;color:var(--text-color);opacity:.8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--font-sans)}.sidebar-section li a:hover{background:#ffffff1a;opacity:1;transform:translate(4px)}.sidebar-section li.active a{background:#ffffff40;opacity:1;font-weight:700;box-shadow:0 4px 12px #0000001a;border:1px solid rgba(255,255,255,.2)}.sidebar-footer{margin-top:auto;padding-top:1.5rem;border-top:1px solid rgba(255,255,255,.1);display:flex;flex-direction:column;gap:.5rem}.sidebar-footer a{opacity:.6;padding:.5rem .8rem;border-radius:8px;text-decoration:none;color:var(--text-color);font-size:.9rem;font-family:var(--font-sans)}.sidebar-footer a:hover{background:#ffffff0d;opacity:1}.main-content{flex:1;min-width:0;overflow-y:auto;background-color:var(--bg-color);padding:1.5rem 2rem;transition:padding .3s ease}@media(max-width:1024px){.main-content{padding:4rem 1rem 1rem}}.main-content>*{max-width:35em;margin-left:auto;margin-right:auto}.sidebar-toggle{position:fixed;top:1rem;left:1rem;z-index:1001;background:none;border:none;width:3rem;height:3rem;font-size:1.5rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:transform .2s cubic-bezier(.175,.885,.32,1.275)}.sidebar-toggle:hover{transform:scale(1.1)}.sidebar-toggle:active{transform:scale(.95)}.sidebar-backdrop{display:none;position:fixed;inset:0;background:#0000004d;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);z-index:999}@media(max-width:1024px){.sidebar-visible .sidebar-backdrop{display:block}.sidebar{position:fixed;top:0;left:0;bottom:0;z-index:1000;transform:translate(-100%);transition:transform .3s cubic-bezier(.4,0,.2,1);box-shadow:none}.sidebar-visible .sidebar{transform:translate(0);box-shadow:10px 0 20px #0000001a}}.sidebar-hidden .sidebar{display:none}@media(min-width:1025px){.sidebar-hidden .sidebar{display:none}.sidebar-visible .sidebar{display:flex}}input[type=text],input[type=url],input[type=search],select{padding:.4rem .8rem;border-radius:8px;border:1px solid var(--border-color);background:var(--bg-color);color:var(--text-color);font-family:inherit;font-size:.9rem}input:focus,select:focus{outline:none;border-color:var(--accent-color);box-shadow:0 0 0 2px #007bff33}.logo{font-size:2.5rem;margin:0 0 1.5rem;cursor:pointer;text-align:center;-webkit-user-select:none;user-select:none}.sidebar .logo{margin-bottom:1.5rem}.item-list{list-style:none;padding:0;margin:0}.feed-item{padding:1rem .5rem;margin-top:2rem;border-bottom:none;border-radius:8px;transition:background-color .2s ease}.feed-item.selected{background-color:#007bff0d;box-shadow:inset 4px 0 0 var(--accent-color)}.theme-dark .feed-item.selected{background-color:#2188ff1a}.item-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:.5rem}.item-title{font-family:var(--font-heading);font-size:1.8rem;font-weight:700;text-decoration:none;color:var(--link-color);display:block;flex:1;cursor:pointer}.item-title:hover{text-decoration:underline}.star-btn{background:none;border:none;cursor:pointer;font-size:1.25rem;padding:0 0 0 .5rem;vertical-align:middle;transition:color .2s;line-height:1}.star-btn.is-starred{color:#00f}.star-btn.is-unstarred{color:var(--text-color);opacity:.3}.dateline{margin-top:0;font-weight:400;font-size:.75em;color:#ccc;margin-bottom:1rem}.dateline a{color:#ccc;text-decoration:none}.item-description{color:var(--text-color);line-height:1.5;font-size:1rem;margin-top:1rem;overflow-wrap:break-word;word-break:break-word}.item-description img,.item-description video,.item-description pre{max-width:100%;height:auto;display:block;margin:1rem 0}.item-description pre{white-space:pre-wrap;word-wrap:break-word;overflow-x:auto;background:#0000000d;padding:1em;border-radius:4px}.scrape-btn{background:var(--bg-color);border:1px solid var(--border-color, #ccc);color:#00f;cursor:pointer;font-family:var(--font-heading);font-weight:700;font-size:.8rem;padding:2px 6px;margin-left:.5rem}.theme-dark{--bg-color: #000000;--text-color: #ffffff;--sidebar-bg: #000000;--link-color: #5ac8fa;--border-color: #333333;--accent-color: #2188ff}.font-serif{--font-body: Georgia, "Times New Roman", Times, serif;font-family:var(--font-body)}.font-sans{--font-body: var(--font-heading);font-family:var(--font-body)}.font-mono{--font-body: Menlo, Monaco, Consolas, "Courier New", monospace;font-family:var(--font-body)}.settings-view{padding-top:2rem}.settings-section{margin-bottom:2.5rem}.settings-section h3{font-family:var(--font-heading);border-bottom:1px solid var(--border-color);padding-bottom:.5rem;margin-bottom:1rem}.theme-options{display:flex;gap:1rem}button{border-radius:8px;border:1px solid var(--border-color);padding:.6em 1.2em;font-size:1em;font-weight:700;font-family:inherit;background-color:#f9f9f9;cursor:pointer;transition:all .2s}.theme-dark button{background-color:#1a1a1a;color:#fff;border-color:#333}button.active{border-color:var(--accent-color);background-color:#eef}.theme-dark button.active{background-color:#282e34;border-color:var(--accent-color)}.theme-dark input,.theme-dark select{background-color:#111;color:#fff;border-color:#333}.add-feed-form{display:flex;gap:.5rem}.add-feed-form input{flex:1;padding:.6rem 1rem;border-radius:8px;border:1px solid var(--border-color);background:var(--bg-color);color:var(--text-color)}.settings-group label{display:block;font-size:.85rem;font-weight:600;margin-bottom:.5rem;opacity:.7}#font-selector{width:100%;padding:.6rem;border-radius:8px;border:1px solid var(--border-color);background:var(--bg-color);color:var(--text-color)}.data-actions button,.data-actions .button{display:inline-block;text-align:center;width:100%}label.button{cursor:pointer} diff --git a/web/dist/v3/assets/index-CFkVnbAe.css b/web/dist/v3/assets/index-CFkVnbAe.css new file mode 100644 index 0000000..b6ede1d --- /dev/null +++ b/web/dist/v3/assets/index-CFkVnbAe.css @@ -0,0 +1 @@ +:root{--font-body: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;--font-heading: "Helvetica Neue", Helvetica, Arial, sans-serif;--font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;line-height:1.5;font-size:18px;--bg-color: #ffffff;--text-color: rgba(0, 0, 0, .87);--sidebar-bg: #ccc;--link-color: #0000ee;--border-color: #999;--accent-color: #007bff;color-scheme:light dark}*{box-sizing:border-box}body{margin:0;font-family:var(--font-body);background-color:var(--bg-color);color:var(--text-color);height:100vh;width:100%;max-width:100vw;overflow:hidden}html{overflow-x:hidden;max-width:100vw}#app{height:100%;width:100%}.layout{display:flex;height:100%;width:100%;overflow-x:hidden;position:relative}.sidebar{width:11rem;background:#ffffff0d;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-right:1px solid rgba(255,255,255,.1);display:flex;flex-direction:column;height:100%;overflow:hidden;z-index:100;padding:5rem 1.5rem 1.5rem}.theme-dark .sidebar{background:#0003;border-right-color:#ffffff0d}.sidebar-search{margin-top:1rem;margin-bottom:1rem}.sidebar-search input{width:100%;border-radius:20px;background:#0000000d;border:1px solid rgba(255,255,255,.1);color:var(--text-color);padding:.5rem 1rem;font-size:.9rem}.sidebar-scroll{flex:1;overflow-y:auto;margin:0 -1.5rem;padding:0 1.5rem}.sidebar-section h3{font-family:var(--font-sans);font-size:.7rem;text-transform:uppercase;letter-spacing:.1em;opacity:.5;margin-top:2rem;margin-bottom:.5rem;font-weight:700;display:flex;align-items:center;justify-content:space-between;cursor:pointer;-webkit-user-select:none;user-select:none}.sidebar-section h3:hover{opacity:.8}.sidebar-section .caret{font-size:.6rem;transition:transform .2s ease;transform:rotate(90deg)}.sidebar-section.collapsed .caret{transform:rotate(0)}.sidebar-section.collapsed ul{display:none}.sidebar-section ul{list-style:none;padding:0;margin:0}.sidebar-section li a{display:block;padding:.3rem .8rem;margin:.1rem 0;border-radius:8px;transition:all .2s ease;font-weight:500;font-size:.85rem;text-decoration:none;color:var(--text-color);opacity:.8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--font-sans)}.sidebar-section li a:hover{background:#ffffff1a;opacity:1;transform:translate(4px)}.sidebar-section li.active a{background:#ffffff40;opacity:1;font-weight:700;box-shadow:0 4px 12px #0000001a;border:1px solid rgba(255,255,255,.2)}.sidebar-footer{margin-top:auto;padding-top:1.5rem;border-top:1px solid rgba(255,255,255,.1);display:flex;flex-direction:column;gap:.5rem}.sidebar-footer a{opacity:.6;padding:.5rem .8rem;border-radius:8px;text-decoration:none;color:var(--text-color);font-size:.9rem;font-family:var(--font-sans)}.sidebar-footer a:hover{background:#ffffff0d;opacity:1}.main-content{width:100%;min-width:0;overflow-y:auto;background-color:var(--bg-color);padding:1.5rem 2rem;transition:padding .3s ease}@media(max-width:1024px){.main-content{padding:4rem 1rem 1rem}}.main-content>*{max-width:35em;margin-left:auto;margin-right:auto}.sidebar-toggle{position:fixed;top:1rem;left:1rem;z-index:1001;background:none;border:none;width:3rem;height:3rem;font-size:1.5rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:transform .2s cubic-bezier(.175,.885,.32,1.275)}.sidebar-toggle:hover{transform:scale(1.1)}.sidebar-toggle:active{transform:scale(.95)}.sidebar-backdrop{display:none;position:fixed;inset:0;background:#0000004d;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);z-index:999}@media(max-width:1024px){.sidebar-visible .sidebar-backdrop{display:block}.sidebar{position:fixed;top:0;left:0;bottom:0;z-index:1000;transform:translate(-100%);transition:transform .3s cubic-bezier(.4,0,.2,1);box-shadow:none}.sidebar-visible .sidebar{transform:translate(0);box-shadow:10px 0 20px #0000001a}}@media(min-width:1025px){.sidebar{position:fixed;top:0;left:0;bottom:0;z-index:1000;transform:translate(-100%);transition:transform .3s cubic-bezier(.4,0,.2,1)}.sidebar-visible .sidebar{transform:translate(0);box-shadow:10px 0 20px #0000001a}.sidebar-hidden .sidebar{transform:translate(-100%)}}.sidebar-hidden .sidebar,.sidebar-visible .sidebar{display:flex}input[type=text],input[type=url],input[type=search],select{padding:.4rem .8rem;border-radius:8px;border:1px solid var(--border-color);background:var(--bg-color);color:var(--text-color);font-family:inherit;font-size:.9rem}input:focus,select:focus{outline:none;border-color:var(--accent-color);box-shadow:0 0 0 2px #007bff33}.logo{font-size:2.5rem;margin:0 0 1.5rem;cursor:pointer;text-align:center;-webkit-user-select:none;user-select:none}.sidebar .logo{margin-bottom:1.5rem}.item-list{list-style:none;padding:0;margin:0}.feed-item{padding:1rem .5rem;margin-top:2rem;border-bottom:none;border-radius:8px;transition:background-color .2s ease}.feed-item.selected{background-color:#007bff0d;box-shadow:inset 4px 0 0 var(--accent-color)}.theme-dark .feed-item.selected{background-color:#2188ff1a}.item-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:.5rem}.item-title{font-family:var(--font-heading);font-size:1.8rem;font-weight:700;text-decoration:none;color:var(--link-color);display:block;flex:1;cursor:pointer}.item-title:hover{text-decoration:underline}.star-btn{background:none;border:none;cursor:pointer;font-size:1.25rem;padding:0 0 0 .5rem;vertical-align:middle;transition:color .2s;line-height:1}.star-btn.is-starred{color:#00f}.star-btn.is-unstarred{color:var(--text-color);opacity:.3}.dateline{margin-top:0;font-weight:400;font-size:.75em;color:#ccc;margin-bottom:1rem}.dateline a{color:#ccc;text-decoration:none}.item-description{color:var(--text-color);line-height:1.5;font-size:1rem;margin-top:1rem;overflow-wrap:break-word;word-break:break-word}.item-description a{text-decoration:none;color:var(--link-color)}.item-description img,.item-description video,.item-description pre{max-width:100%;height:auto;display:block;margin:1rem 0}.item-description pre{white-space:pre-wrap;word-wrap:break-word;overflow-x:auto;background:#0000000d;padding:1em;border-radius:4px}.scrape-btn{background:var(--bg-color);border:1px solid var(--border-color, #ccc);color:#00f;cursor:pointer;font-family:var(--font-heading);font-weight:700;font-size:.8rem;padding:2px 6px;margin-left:.5rem}.theme-dark{--bg-color: #000000;--text-color: #ffffff;--sidebar-bg: #000000;--link-color: #5ac8fa;--border-color: #333333;--accent-color: #2188ff;--sidebar-text-color: rgba(0, 0, 0, .87)}.theme-dark .sidebar{background:#b4b4b4d9;border-right-color:#00000026}.theme-dark .sidebar-section li a,.theme-dark .sidebar-section h3,.theme-dark .sidebar-footer a{color:#000000de}.theme-dark .sidebar-section li.active a{background:#00000026}.theme-dark .sidebar-section li a:hover{background:#00000014}.theme-dark .sidebar-toggle{background:none}.theme-dark .sidebar-search input{background:#ffffffb3;color:#000000de;border-color:#0003}.font-serif{--font-body: Georgia, "Times New Roman", Times, serif;font-family:var(--font-body)}.font-sans{--font-body: var(--font-heading);font-family:var(--font-body)}.font-mono{--font-body: Menlo, Monaco, Consolas, "Courier New", monospace;font-family:var(--font-body)}.settings-view{padding-top:2rem}.settings-section{margin-bottom:2.5rem}.settings-section h3{font-family:var(--font-heading);border-bottom:1px solid var(--border-color);padding-bottom:.5rem;margin-bottom:1rem}.theme-options{display:flex;gap:1rem}button{border-radius:8px;border:1px solid var(--border-color);padding:.6em 1.2em;font-size:1em;font-weight:700;font-family:inherit;background-color:#f9f9f9;cursor:pointer;transition:all .2s}.theme-dark button{background-color:#1a1a1a;color:#fff;border-color:#333}button.active{border-color:var(--accent-color);background-color:#eef}.theme-dark button.active{background-color:#282e34;border-color:var(--accent-color)}.theme-dark input,.theme-dark select{background-color:#111;color:#fff;border-color:#333}.add-feed-form{display:flex;gap:.5rem}.add-feed-form input{flex:1;padding:.6rem 1rem;border-radius:8px;border:1px solid var(--border-color);background:var(--bg-color);color:var(--text-color)}.settings-group label{display:block;font-size:.85rem;font-weight:600;margin-bottom:.5rem;opacity:.7}#font-selector{width:100%;padding:.6rem;border-radius:8px;border:1px solid var(--border-color);background:var(--bg-color);color:var(--text-color)}.data-actions button,.data-actions .button{display:inline-block;text-align:center;width:100%}label.button{cursor:pointer} diff --git a/web/dist/v3/assets/index-CZ6KJbnj.js b/web/dist/v3/assets/index-CZ6KJbnj.js new file mode 100644 index 0000000..8aaf391 --- /dev/null +++ b/web/dist/v3/assets/index-CZ6KJbnj.js @@ -0,0 +1,148 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const d of o.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function a(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(n){if(n.ep)return;n.ep=!0;const o=a(n);fetch(n.href,o)}})();function A(t){const a=`; ${document.cookie}`.split(`; ${t}=`);if(a.length===2)return a.pop()?.split(";").shift()}async function m(t,e){const a=e?.method?.toUpperCase()||"GET",s=["POST","PUT","DELETE"].includes(a),n=new Headers(e?.headers||{});if(s){const o=A("csrf_token");o&&n.set("X-CSRF-Token",o)}return fetch(t,{...e,headers:n,credentials:"include"})}function R(){const t=document.cookie.split("; ").find(e=>e.startsWith("neko_sidebar="));return t?t.split("=")[1]==="1":null}function C(t){document.cookie=`neko_sidebar=${t?"1":"0"}; path=/; max-age=31536000; SameSite=Lax`}function B(){const t=R();return t!==null?t:window.innerWidth>1024}class P extends EventTarget{feeds=[];tags=[];items=[];activeFeedId=null;activeTagName=null;filter="unread";searchQuery="";loading=!1;hasMore=!0;theme=localStorage.getItem("neko-theme")||"light";fontTheme=localStorage.getItem("neko-font-theme")||"default";sidebarVisible=B();setFeeds(e){this.feeds=e,this.emit("feeds-updated")}setTags(e){this.tags=e,this.emit("tags-updated")}setItems(e,a=!1){a?this.items=[...this.items,...e]:this.items=e,this.emit("items-updated")}setActiveFeed(e){this.activeFeedId=e,this.activeTagName=null,this.emit("active-feed-updated")}setActiveTag(e){this.activeTagName=e,this.activeFeedId=null,this.emit("active-tag-updated")}setFilter(e){this.filter!==e&&(this.filter=e,this.emit("filter-updated"))}setSearchQuery(e){this.searchQuery!==e&&(this.searchQuery=e,this.emit("search-updated"))}setLoading(e){this.loading=e,this.emit("loading-state-changed")}setHasMore(e){this.hasMore=e}setTheme(e){this.theme=e,localStorage.setItem("neko-theme",e),this.emit("theme-updated")}setFontTheme(e){this.fontTheme=e,localStorage.setItem("neko-font-theme",e),this.emit("theme-updated")}setSidebarVisible(e){this.sidebarVisible=e,C(e),this.emit("sidebar-toggle")}toggleSidebar(){this.setSidebarVisible(!this.sidebarVisible)}emit(e,a){this.dispatchEvent(new CustomEvent(e,{detail:a}))}on(e,a){this.addEventListener(e,a)}}const i=new P;class x extends EventTarget{constructor(){super(),window.addEventListener("popstate",()=>this.handleRouteChange())}handleRouteChange(){this.dispatchEvent(new CustomEvent("route-changed",{detail:this.getCurrentRoute()}))}getCurrentRoute(){const e=new URL(window.location.href),s=e.pathname.replace(/^\/v3\//,"").split("/").filter(Boolean);let n="/";const o={};return s[0]==="feed"&&s[1]?(n="/feed",o.feedId=s[1]):s[0]==="tag"&&s[1]?(n="/tag",o.tagName=decodeURIComponent(s[1])):s[0]==="settings"&&(n="/settings"),{path:n,params:o,query:e.searchParams}}navigate(e,a){let s=`/v3${e}`;if(a){const n=new URLSearchParams(a);s+=`?${n.toString()}`}window.history.pushState({},"",s),this.handleRouteChange()}updateQuery(e){const a=new URL(window.location.href);for(const[s,n]of Object.entries(e))n?a.searchParams.set(s,n):a.searchParams.delete(s);window.history.pushState({},"",a.toString()),this.handleRouteChange()}}const r=new x;function M(t,e=!1){const a=new Date(t.publish_date).toLocaleDateString();return` +
  • + + + ${t.full_content||t.description?` +
    + ${t.full_content||t.description} +
    + `:""} +
  • + `}let f=null,p=null;function O(){p=document.querySelector("#app"),p&&(p.className=`theme-${i.theme} font-${i.fontTheme}`,p.innerHTML=` +
    + + + +
    +
    +
    +
    + `,q())}function q(){document.getElementById("search-input")?.addEventListener("input",n=>{const o=n.target.value;r.updateQuery({q:o})}),document.getElementById("logo-link")?.addEventListener("click",()=>r.navigate("/")),document.getElementById("logout-button")?.addEventListener("click",n=>{n.preventDefault(),W()}),document.getElementById("sidebar-toggle-btn")?.addEventListener("click",()=>{i.toggleSidebar()}),document.getElementById("sidebar-backdrop")?.addEventListener("click",()=>{i.setSidebarVisible(!1)}),document.querySelectorAll(".sidebar-section.collapsible h3").forEach(n=>{n.addEventListener("click",()=>{n.parentElement?.classList.toggle("collapsed")})}),document.getElementById("sidebar")?.addEventListener("click",n=>{const o=n.target,d=o.closest("a");if(!d){o.classList.contains("logo")&&(n.preventDefault(),r.navigate("/",{}));return}const g=d.getAttribute("data-nav"),u=Object.fromEntries(r.getCurrentRoute().query.entries());if(g==="filter"){n.preventDefault();const l=d.getAttribute("data-value");r.getCurrentRoute().path==="/settings"?r.navigate("/",{...u,filter:l}):r.updateQuery({filter:l})}else if(g==="tag"){n.preventDefault();const l=d.getAttribute("data-value");r.navigate(`/tag/${encodeURIComponent(l)}`,u)}else if(g==="feed"){n.preventDefault();const l=d.getAttribute("data-value"),c=r.getCurrentRoute();i.activeFeedId===parseInt(l)&&c.path!=="/settings"?r.navigate("/",u):r.navigate(`/feed/${l}`,u)}else g==="settings"&&(n.preventDefault(),r.getCurrentRoute().path==="/settings"?r.navigate("/",u):r.navigate("/settings",u));window.innerWidth<=768&&i.setSidebarVisible(!1)}),document.getElementById("content-area")?.addEventListener("click",n=>{const o=n.target,d=o.closest('[data-action="toggle-star"]');if(d){const c=d.closest("[data-id]");if(c){const v=parseInt(c.getAttribute("data-id"));U(v)}return}const g=o.closest('[data-action="scrape"]');if(g){const c=g.closest("[data-id]");if(c){const v=parseInt(c.getAttribute("data-id"));V(v)}return}const u=o.closest('[data-action="open"]'),l=o.closest(".feed-item");if(l&&!u){const c=parseInt(l.getAttribute("data-id"));f=c,document.querySelectorAll(".feed-item").forEach(y=>{const F=parseInt(y.getAttribute("data-id")||"0");y.classList.toggle("selected",F===f)});const v=i.items.find(y=>y._id===c);v&&!v.read&&h(c,{read:!0})}})}function T(){const{feeds:t,activeFeedId:e}=i,a=document.getElementById("feed-list");a&&(a.innerHTML=t.map(s=>` +
  • + + ${s.title||s.url} + +
  • + `).join(""))}function k(){const{tags:t,activeTagName:e}=i,a=document.getElementById("tag-list");a&&(a.innerHTML=t.map(s=>` +
  • + + ${s.title} + +
  • + `).join(""))}function $(){const{filter:t}=i,e=document.getElementById("filter-list");e&&e.querySelectorAll("li").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-filter")===t)})}function L(){const{items:t,loading:e}=i,a=document.getElementById("content-area");if(!a||r.getCurrentRoute().path==="/settings")return;if(e&&t.length===0){a.innerHTML='

    Loading items...

    ';return}if(t.length===0){a.innerHTML='

    No items found.

    ';return}a.innerHTML=` +
      + ${t.map(o=>M(o,o._id===f)).join("")} +
    + ${i.hasMore?'
    Loading more...
    ':""} + `;const s=document.getElementById("main-content"),n=document.getElementById("load-more-sentinel");if(n&&new IntersectionObserver(d=>{d[0].isIntersecting&&!i.loading&&i.hasMore&&H()},{root:s,threshold:.1}).observe(n),s){let o=null;const d=()=>{o===null&&(o=window.setTimeout(()=>{const g=s.getBoundingClientRect();i.items.forEach(u=>{if(u.read)return;const l=document.querySelector(`.feed-item[data-id="${u._id}"]`);l&&l.getBoundingClientRect().bottom +

    Settings

    + +
    +

    Add Feed

    +
    + + +
    +
    + +
    +

    Appearance

    +
    + +
    + + +
    +
    +
    + + +
    +
    + +
    +

    Manage Feeds

    +
      + ${i.feeds.map(e=>` +
    • +
      +
      ${e.title||e.url}
      +
      ${e.url}
      +
      +
      + + + +
      +
    • + `).join("")} +
    +
    + +
    +

    Data Management

    +
    + +
    + + +
    +
    +
    + + `,document.getElementById("theme-options")?.addEventListener("click",e=>{const a=e.target.closest("button");if(a){const s=a.getAttribute("data-theme");i.setTheme(s),w()}}),document.getElementById("font-selector")?.addEventListener("change",e=>{i.setFontTheme(e.target.value)}),document.getElementById("add-feed-btn")?.addEventListener("click",async()=>{const e=document.getElementById("new-feed-url"),a=e.value.trim();a&&(await N(a)?(e.value="",alert("Feed added successfully!"),b()):alert("Failed to add feed."))}),document.getElementById("export-opml-btn")?.addEventListener("click",()=>{window.location.href="/api/export/opml"}),document.getElementById("import-opml-file")?.addEventListener("change",async e=>{const a=e.target.files?.[0];a&&(await D(a)?(alert("OPML imported successfully! Crawling started."),b()):alert("Failed to import OPML."))}),document.querySelectorAll(".delete-feed-btn").forEach(e=>{e.addEventListener("click",async a=>{const s=parseInt(a.target.getAttribute("data-id"));confirm("Are you sure you want to delete this feed?")&&(await Q(s),b(),await b(),w())})}),document.querySelectorAll(".update-feed-tag-btn").forEach(e=>{e.addEventListener("click",async a=>{const s=parseInt(a.target.getAttribute("data-id")),o=document.querySelector(`.feed-tag-input[data-id="${s}"]`).value.trim();await j(s,{category:o}),await b(),await _(),w(),alert("Feed updated")})}))}async function N(t){try{return(await m("/api/feed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:t})})).ok}catch(e){return console.error("Failed to add feed",e),!1}}async function D(t){try{const e=new FormData;e.append("file",t),e.append("format","opml");const a=document.cookie.split("; ").find(n=>n.startsWith("csrf_token="))?.split("=")[1];return(await fetch("/api/import",{method:"POST",headers:{"X-CSRF-Token":a||""},body:e})).ok}catch(e){return console.error("Failed to import OPML",e),!1}}async function Q(t){try{return(await m(`/api/feed/${t}`,{method:"DELETE"})).ok}catch(e){return console.error("Failed to delete feed",e),!1}}async function j(t,e){try{return(await m("/api/feed",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,_id:t})})).ok}catch(a){return console.error("Failed to update feed",a),!1}}async function U(t){const e=i.items.find(a=>a._id===t);e&&h(t,{starred:!e.starred})}async function V(t){if(i.items.find(a=>a._id===t))try{const a=await m(`/api/item/${t}/content`);if(a.ok){const s=await a.json();s.full_content&&h(t,{full_content:s.full_content})}}catch(a){console.error("Failed to fetch full content",a)}}async function h(t,e){try{if((await m(`/api/item/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok){const s=i.items.find(n=>n._id===t);if(s){Object.assign(s,e);const n=document.querySelector(`.feed-item[data-id="${t}"]`);if(n){if(e.read!==void 0&&n.classList.toggle("read",e.read),e.starred!==void 0){const o=n.querySelector(".star-btn");o&&(o.classList.toggle("is-starred",e.starred),o.classList.toggle("is-unstarred",!e.starred),o.setAttribute("title",e.starred?"Unstar":"Star"))}e.full_content&&L()}}}}catch(a){console.error("Failed to update item",a)}}async function b(){const t=await m("/api/feed/");if(t.ok){const e=await t.json();i.setFeeds(e)}}async function _(){const t=await m("/api/tag");if(t.ok){const e=await t.json();i.setTags(e)}}async function I(t,e,a=!1){i.setLoading(!0);try{const s=new URLSearchParams;t&&s.append("feed_id",t),e&&s.append("tag",e),i.searchQuery&&s.append("q",i.searchQuery),(i.filter==="starred"||i.filter==="all")&&s.append("read_filter","all"),i.filter==="starred"&&s.append("starred","true"),a&&i.items.length>0&&s.append("max_id",String(i.items[i.items.length-1]._id));const n=await m(`/api/stream?${s.toString()}`);if(n.ok){const o=await n.json();i.setHasMore(o.length>=50),i.setItems(o,a)}}finally{i.setLoading(!1)}}async function H(){const t=r.getCurrentRoute();I(t.params.feedId,t.params.tagName,!0)}async function W(){await m("/api/logout",{method:"POST"}),window.location.href="/login/"}function E(){const t=r.getCurrentRoute(),e=t.query.get("filter");i.setFilter(e||"unread");const a=t.query.get("q");if(a!==null&&i.setSearchQuery(a),t.path==="/settings"){w();return}if(t.path==="/feed"&&t.params.feedId){const s=parseInt(t.params.feedId);i.setActiveFeed(s),I(t.params.feedId),document.getElementById("section-feeds")?.classList.remove("collapsed")}else t.path==="/tag"&&t.params.tagName?(i.setActiveTag(t.params.tagName),I(void 0,t.params.tagName),document.getElementById("section-tags")?.classList.remove("collapsed")):(i.setActiveFeed(null),i.setActiveTag(null),I())}window.addEventListener("keydown",t=>{if(!["INPUT","TEXTAREA"].includes(t.target.tagName))switch(t.key){case"j":S(1);break;case"k":S(-1);break;case"r":if(f){const e=i.items.find(a=>a._id===f);e&&h(e._id,{read:!e.read})}break;case"s":if(f){const e=i.items.find(a=>a._id===f);e&&h(e._id,{starred:!e.starred})}break;case"/":t.preventDefault(),document.getElementById("search-input")?.focus();break}});function S(t){if(i.items.length===0)return;const e=i.items.findIndex(s=>s._id===f);let a;if(e===-1?a=t>0?0:i.items.length-1:a=e+t,a>=0&&a{const o=parseInt(n.getAttribute("data-id")||"0");n.classList.toggle("selected",o===f)});const s=document.querySelector(`.feed-item[data-id="${f}"]`);s&&s.scrollIntoView({block:"start",behavior:"smooth"}),i.items[a].read||h(f,{read:!0})}}i.on("feeds-updated",T);i.on("tags-updated",k);i.on("active-feed-updated",T);i.on("active-tag-updated",k);i.on("filter-updated",$);i.on("search-updated",()=>{const t=document.getElementById("search-input");t&&t.value!==i.searchQuery&&(t.value=i.searchQuery),E()});i.on("theme-updated",()=>{p||(p=document.querySelector("#app")),p&&(p.className=`theme-${i.theme} font-${i.fontTheme}`)});i.on("sidebar-toggle",()=>{const t=document.querySelector(".layout");t&&(i.sidebarVisible?(t.classList.remove("sidebar-hidden"),t.classList.add("sidebar-visible")):(t.classList.remove("sidebar-visible"),t.classList.add("sidebar-hidden")))});i.on("items-updated",L);i.on("loading-state-changed",L);r.addEventListener("route-changed",E);window.app={navigate:t=>r.navigate(t)};async function J(){const t=await m("/api/auth");if(!t||t.status===401){window.location.href="/login/";return}O(),$();try{await Promise.all([b(),_()])}catch(e){console.error("Initial fetch failed",e)}E()}typeof window<"u"&&!window.__VITEST__&&J(); diff --git a/web/dist/v3/index.html b/web/dist/v3/index.html index 854a74a..0661307 100644 --- a/web/dist/v3/index.html +++ b/web/dist/v3/index.html @@ -5,8 +5,8 @@ neko - - + +
    -- cgit v1.2.3