From d8da1ca5ed90099b28e21c159907f0da6ef7d815 Mon Sep 17 00:00:00 2001
From: omg-xtao <100690902+omg-xtao@users.noreply.github.com>
Date: Sat, 30 Mar 2024 13:27:08 +0000
Subject: [PATCH] feat: tg mini app
---
dist/assets/index-1389e5a3.js | 4 ----
dist/assets/index-c1af15fa.css | 1 -
dist/favicon.png | Bin 3127 -> 0 bytes
dist/index.html | 16 ----------------
index.html | 25 +++++++++++++++++++++++++
src/App.svelte | 9 +++++++++
src/Message.svelte | 2 +-
src/global.css | 4 ----
8 files changed, 35 insertions(+), 26 deletions(-)
delete mode 100644 dist/assets/index-1389e5a3.js
delete mode 100644 dist/assets/index-c1af15fa.css
delete mode 100644 dist/favicon.png
delete mode 100644 dist/index.html
diff --git a/dist/assets/index-1389e5a3.js b/dist/assets/index-1389e5a3.js
deleted file mode 100644
index 14af36b..0000000
--- a/dist/assets/index-1389e5a3.js
+++ /dev/null
@@ -1,4 +0,0 @@
-var Re=Object.defineProperty;var Ie=(t,e,n)=>e in t?Re(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var re=(t,e,n)=>(Ie(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&l(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function l(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function j(){}function Me(t){return t()}function ye(){return Object.create(null)}function B(t){t.forEach(Me)}function Ue(t){return typeof t=="function"}function ae(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ne;function J(t,e){return t===e?!0:(ne||(ne=document.createElement("a")),ne.href=e,t===ne.href)}function Pe(t){return Object.keys(t).length===0}function g(t,e){t.appendChild(e)}function U(t,e,n){t.insertBefore(e,n||null)}function O(t){t.parentNode&&t.parentNode.removeChild(t)}function qe(t,e){for(let n=0;n
搜索字符串支持以下功能:
人名补全支持上下方向键和 Alt+N/P 进行选择。
搜索结果右下角的时间,悬停可查看绝对时间、最后编辑时间(如编辑过),点击可跳转到 - Telegram 中展示该消息。
`},m(n,l){U(n,e,l)},p:j,i:j,o:j,d(n){n&&O(e)}}}function dt(t){let e,n,l=Y(t[4].messages),s=[];for(let o=0;o到底了。
',p(e,"class","info svelte-cd7t1")},m(n,l){U(n,e,l)},p:j,d(n){n&&O(e)}}}function mt(t){let e;return{c(){e=v("div"),e.innerHTML='没有匹配的消息。
',p(e,"class","info svelte-cd7t1")},m(n,l){U(n,e,l)},p:j,d(n){n&&O(e)}}}function bt(t){let e,n;return{c(){e=v("p"),n=H(t[3]),p(e,"class","error svelte-cd7t1")},m(l,s){U(l,e,s),g(e,n)},p(l,s){s&8&&x(n,l[3])},d(l){l&&O(e)}}}function Ae(t){let e,n,l,s;return{c(){e=v("div"),n=v("button"),n.textContent="加载更多",p(n,"class","svelte-cd7t1"),p(e,"class","info svelte-cd7t1")},m(i,o){U(i,e,o),g(e,n),l||(s=N(n,"click",t[14]),l=!0)},p:j,d(i){i&&O(e),l=!1,s()}}}function wt(t){let e,n,l,s,i,o,r,u,_,h,f,d,w,a,m,k;function q(c,b){return c[0].length===0?ft:ct}let L=q(t),E=L(t);function R(c){t[21](c)}let C={group:t[2],selected_init:t[8]};t[7]!==void 0&&(C.selected=t[7]),o=new it({props:C}),te.push(()=>Ze(o,"selected",R));const D=[dt,_t],y=[];function A(c,b){return c[4]?0:!c[6]&&!c[3]?1:-1}~(f=A(t))&&(d=y[f]=D[f](t));function M(c,b){return c[6]?pt:ht}let S=M(t),F=S(t);return{c(){e=v("main"),n=v("div"),E.c(),l=T(),s=v("input"),i=T(),Te(o.$$.fragment),u=T(),_=v("button"),_.textContent="搜索",h=T(),d&&d.c(),w=T(),F.c(),p(s,"type","search"),p(s,"class","svelte-cd7t1"),p(_,"class","svelte-cd7t1"),p(n,"id","searchbox"),p(n,"class","svelte-cd7t1"),p(e,"class","svelte-cd7t1")},m(c,b){U(c,e,b),g(e,n),E.m(n,null),g(n,l),g(n,s),Q(s,t[1]),g(n,i),he(o,n,null),g(n,u),g(n,_),g(e,h),~f&&y[f].m(e,null),g(e,w),F.m(e,null),a=!0,m||(k=[N(window,"hashchange",t[16]),N(s,"input",t[18]),N(s,"input",t[19]),N(s,"keydown",t[20]),N(_,"click",t[22])],m=!0)},p(c,[b]){L===(L=q(c))&&E?E.p(c,b):(E.d(1),E=L(c),E&&(E.c(),E.m(n,l))),b&2&&s.value!==c[1]&&Q(s,c[1]);const I={};b&4&&(I.group=c[2]),b&256&&(I.selected_init=c[8]),!r&&b&128&&(r=!0,I.selected=c[7],Ve(()=>r=!1)),o.$set(I);let K=f;f=A(c),f===K?~f&&y[f].p(c,b):(d&&(Fe(),W(y[K],1,1,()=>{y[K]=null}),Se()),~f?(d=y[f],d?d.p(c,b):(d=y[f]=D[f](c),d.c()),P(d,1),d.m(e,w)):d=null),S===(S=M(c))&&F?F.p(c,b):(F.d(1),F=S(c),F&&(F.c(),F.m(e,null)))},i(c){a||(P(o.$$.fragment,c),P(d),a=!0)},o(c){W(o.$$.fragment,c),W(d),a=!1},d(c){c&&O(e),E.d(),pe(o),~f&&y[f].d(),F.d(),m=!1,B(k)}}}const Z="https://search-pub.xtaolabs.com/luoxu";function yt(){const t=location.hash;if(t)return new URLSearchParams(t.substring(1))}function vt(t,e,n){const l=Z.startsWith("http://localhost");let s=[],i,o,r,u,_=new Date,h=!1,f=!1,d,w,a=!1,m=new AbortController;Ke("LUOXU_URL",Z),Ne(async()=>{for(k();;)try{const c=await fetch(`${Z}/groups`);n(0,s=(await c.json()).groups),n(15,f=!0),i||n(2,i="");break}catch(c){console.error("failed to fetch group info, will retry",c),await ut(1e3)}});function k(){const c=yt();c&&(n(1,o=""),n(2,i=""),n(4,u=null),c.has("g")&&n(2,i=c.get("g")),c.has("q")&&n(1,o=c.get("q")),c.has("sender")&&(n(7,d=c.get("sender")),n(8,w=d)),(i||l)&&o&&(n(4,u=null),L()))}let q=0;async function L(c){q+=1;try{if(m.abort(),m=new AbortController,!i&&!l){n(3,r="请选择要搜索的群组");return}if(!o&&!l&&!d){n(3,r="请输入搜索关键字");return}n(3,r=""),n(9,a=!0),console.log(`searching ${o} for group ${i}, older than ${c}, from ${d}`);const b=new URLSearchParams;i&&b.append("g",i),o&&b.append("q",o),d&&b.append("sender",d);let I;const K=b.toString();c?I=`${Z}/search?${b}&end=${c}`:(location.hash=`#${K}`,n(15,f=!0),u&&n(4,u.messages=[],u),I=`${Z}/search?${K}`),n(5,_=new Date),n(6,h=!0);try{const we=await(await fetch(I,{signal:m.signal})).json();if(n(6,h=!1),m.signal.aborted)return[];if(c)return we;n(4,u=we)}catch(be){q<=1&&(n(3,r=be),n(6,h=!1))}n(9,a=!1)}finally{q-=1}}async function E(){n(3,r=""),o&&await L()}async function R(){const c=u.messages[u.messages.length-1].t,b=u.messages,I=await L(c);n(4,u.messages=[...b,...I.messages],u),n(4,u.has_more=I.has_more,u)}const C=()=>{a||k()};function D(){i=Xe(this),n(2,i),n(0,s)}function y(){o=this.value,n(1,o)}const A=()=>n(3,r=""),M=c=>{c.key==="Enter"&&L()};function S(c){d=c,n(7,d)}const F=()=>L();return t.$$.update=()=>{if(t.$$.dirty&32775&&f&&s){let c;for(const b of s)b.group_id===i&&(c=b.name);o&&c?document.title=`搜索:${o} 于 ${c} - 落絮`:o?document.title=`搜索:${o} - 落絮`:c?document.title=`搜索 ${c} - 落絮`:document.title="落絮",n(15,f=!1)}},[s,o,i,r,u,_,h,d,w,a,l,k,L,E,R,f,C,D,y,A,M,S,F]}class kt extends me{constructor(e){super(),ge(this,e,vt,wt,ae,{})}}new kt({target:document.body}); diff --git a/dist/assets/index-c1af15fa.css b/dist/assets/index-c1af15fa.css deleted file mode 100644 index 7907867..0000000 --- a/dist/assets/index-c1af15fa.css +++ /dev/null @@ -1 +0,0 @@ -.message.svelte-15hb0c4.svelte-15hb0c4{margin:1em 0;padding:.5em;max-width:max-content;border:1px #eeeeee solid;box-shadow:0 0 3px gray;border-radius:5px;display:flex}.avatar.svelte-15hb0c4.svelte-15hb0c4{padding-right:.5em}.content.svelte-15hb0c4.svelte-15hb0c4{overflow:hidden}.name.svelte-15hb0c4.svelte-15hb0c4{white-space:nowrap;color:#1e90ff;overflow:hidden;text-overflow:ellipsis}.text.svelte-15hb0c4.svelte-15hb0c4{white-space:pre-wrap;margin:.2em 0}.text.svelte-15hb0c4>.keyword{background-color:#ffffab}.time.svelte-15hb0c4.svelte-15hb0c4{font-size:.75em;float:right;margin-right:2px}.time.svelte-15hb0c4.svelte-15hb0c4,.time.svelte-15hb0c4>a.svelte-15hb0c4{color:gray}div.svelte-179qc5o.svelte-179qc5o{position:relative}ul.svelte-179qc5o.svelte-179qc5o{list-style:none;padding:0;margin:0;position:absolute;left:0;background-color:#fff;box-shadow:0 0 4px var(--color-inactive);clip-path:polygon(-100% 0,200% 0,200% 200%,-100% 200%)}li.svelte-179qc5o.svelte-179qc5o{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;line-height:2em}li.svelte-179qc5o>img.svelte-179qc5o{height:calc(2.3em - 2px);width:calc(2.3em - 2px);vertical-align:middle;padding-right:.5em;display:inline-block;overflow:hidden}ul.svelte-179qc5o:not(:hover)>li.selected.svelte-179qc5o,li.svelte-179qc5o.svelte-179qc5o:hover{background-color:#d9f5ff}input.svelte-179qc5o.svelte-179qc5o{padding-left:2.5em;width:100%}input.svelte-179qc5o.svelte-179qc5o,ul.svelte-179qc5o.svelte-179qc5o{border-radius:0;border:1px solid var(--color-inactive)}input.svelte-179qc5o.svelte-179qc5o:focus,input.svelte-179qc5o:focus~ul.svelte-179qc5o{border-color:var(--color-active);box-shadow:0 0 4px var(--color-active);outline:1px solid var(--color-active)}input.svelte-179qc5o:focus~ul.svelte-179qc5o{border-top-color:var(--color-inactive)}.selected-avatar.svelte-179qc5o.svelte-179qc5o{position:absolute;pointer-events:none;top:1px;left:1px;height:calc(2.3em - 2px);width:calc(2.3em - 2px)}.hidden.svelte-179qc5o.svelte-179qc5o{display:none}html,body{position:relative;width:100%;height:100%}body{color:#333;margin:0;padding:8px;box-sizing:border-box;line-height:1.2;font-family:DejaVu Sans,sans-serif;margin-left:calc(100vw - 100%);overflow-x:hidden}a{color:#0064c8;text-decoration:none}a:hover{text-decoration:underline}a:visited{color:#0050a0}label{display:block}input,button,select,textarea{font-family:inherit;font-size:inherit;-webkit-padding:.4em 0;padding:.4em;margin:0 0 .5em;box-sizing:border-box;border:1px solid #ccc;border-radius:2px}input:disabled{color:#ccc}button{color:#333;background-color:#f4f4f4;outline:none}button:disabled{color:#999}button:not(:disabled):active{background-color:#ddd}button:focus{border-color:#666}main.svelte-cd7t1.svelte-cd7t1{margin:1em}button.svelte-cd7t1.svelte-cd7t1{white-space:nowrap}#searchbox.svelte-cd7t1.svelte-cd7t1{display:flex;margin-left:1px}#searchbox.svelte-cd7t1>*{margin-left:-1px}#searchbox.svelte-cd7t1 input[type=search].svelte-cd7t1{flex-grow:1}@media (max-width: 700px){#searchbox.svelte-cd7t1.svelte-cd7t1{flex-direction:column}}.error.svelte-cd7t1.svelte-cd7t1{color:red;text-align:center}.info.svelte-cd7t1.svelte-cd7t1{display:flex;justify-content:center}.info.svelte-cd7t1>.svelte-cd7t1{padding:.5em 1em;margin:1em 0}.info.svelte-cd7t1>p.svelte-cd7t1{border:1px #bfbfbf solid;border-radius:2em}input,button,select{border-radius:0;border:1px solid var(--color-inactive);height:2.3em}input:focus,button:focus,select:focus{border-color:var(--color-active);outline:1px solid var(--color-active);z-index:10}:root{--color-inactive:#bfbfbf;--color-active:#add8e6} diff --git a/dist/favicon.png b/dist/favicon.png deleted file mode 100644 index 7e6f5eb5a2f1f1c882d265cf479de25caa925645..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3127 zcmV-749N3|P)