Files
FileShare/server/web/dist/assets/DocsView-Ds78oqBY.js
T
SKYMirror 9686fe887a FileCodeBox Go 重写版 v2.5.6(安全审计修复版)
Go 1.27.1 (Gin+GORM) + Vue 3 文件快传服务:

- 安全审计全部修复(docs/security-audit-2026-09-05.md):
  bcrypt 密码哈希与自动升级、presign 直传服务端大小/内容校验、
  全局请求体上限、依赖升级(govulncheck 0 命中)、janitor 后台清理、
  管理端审计动作落库、/admin CORS 收紧、通知内容白名单净化、
  会话默认 7 天、限流缓存故障降级、robots.txt 端点等
- 前端:取件链接复制修复(不再重复拼接提取码)、markdown 净化器加固
- Redis 支持库号(FCB_REDIS_DB / redis://…/db URL)
- 文档:docs/api/* 与 openapi.yaml 同步最新行为(robots.txt、
  提码 5 位起、chunk 32MiB 上限、admin 审计动作等)

验证:gofmt/go vet/go test 全绿;二进制端到端冒烟通过
2026-09-05 04:22:41 +08:00

2 lines
5.2 KiB
JavaScript

import{d as R,u as V,i as z,j as y,I,J as $,z as E,A as O,N as W,b as c,C as j,D as G,f as h,c as l,q as x,t as u,F as C,r as A,w as T,e as M,g as S,h as H,B as K,o as r}from"./index-DYsKpclu.js";import{P as U}from"./PageShell-D87JkPkG.js";import{d as B,a as J,l as Q}from"./docsSource-BXkkn0HE.js";import{k as X}from"./markdown-B5D8JARp.js";import"./SiteNav.vue_vue_type_script_setup_true_lang-CwaEJKIZ.js";function Y(m,o){const n=m.toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").trim().replace(/\s+/g,"-")||"section";let d=n,i=2;for(;o.has(d);)d=`${n}-${i++}`;return o.add(d),d}const Z=new Set(["script","style","iframe","object","embed","form","link","meta","base","svg","math","frame","frameset","applet","template","noscript","title"]),tt=new Set(["srcdoc","sandbox","formaction","action","xlink:href","srcset","poster","background","dynsrc","lowsrc","data"]);function et(m,o){const n=m.trim();return o&&/^data:image\//i.test(n)?!0:/^(https?:|mailto:|\/|#|\.\/)/i.test(n)||!/^[a-z][a-z0-9+.-]*:/i.test(n)}function st(m){const o=new DOMParser().parseFromString(m,"text/html");for(const n of[...o.body.querySelectorAll("*")]){const d=n.tagName.toLowerCase();if(Z.has(d)){n.remove();continue}for(const i of[...n.attributes]){const e=i.name.toLowerCase();if(e.startsWith("on")||tt.has(e)){n.removeAttribute(i.name);continue}(e==="href"||e==="src"||e.endsWith(":src")||e.endsWith(":href"))&&!et(i.value,e==="src")&&n.removeAttribute(i.name)}}return o.body.innerHTML}function ot(m){const o=X.parse(m,{gfm:!0,breaks:!1}),n=new DOMParser().parseFromString(o,"text/html");for(const e of[...n.body.querySelectorAll("a[href]")]){const f=e.getAttribute("href")??"";/^https?:\/\//i.test(f)&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"))}const d=new Set,i=[];for(const e of[...n.body.querySelectorAll("h1, h2, h3")]){const f=Number(e.tagName.substring(1)),p=(e.textContent??"").trim();if(!p)continue;const v=Y(p,d);e.setAttribute("id",v),f>=2&&i.push({id:v,text:p,level:f})}return{html:st(n.body.innerHTML),toc:i}}const nt={class:"docs-shell"},at={class:"docs-sidebar"},rt=["placeholder"],lt={key:0,class:"empty",style:{padding:"20px 8px"}},ct={class:"hint"},it=["aria-label"],ut=["onClick"],dt={key:0,class:"badge badge-muted",style:{"margin-left":"6px"}},ht={key:0,class:"hint",style:{padding:"0 11px"}},mt={key:1,class:"doc-toc"},ft={class:"toc-title"},pt=["href","onClick"],vt={class:"docs-content"},gt={key:0,class:"loading-block"},yt={key:1,class:"empty"},_t={style:{"font-weight":"600",color:"var(--c-text)"}},bt={class:"hint",style:{"max-width":"420px",margin:"0 auto"}},kt={key:2,class:"empty"},wt=["innerHTML"],At=R({__name:"DocsView",setup(m){const{t:o}=V(),n=W(),d=K(),i=z(),e=y([...B]),f=y(""),p=y(""),v=y(""),_=y([]),k=y(!1),b=y("");I(async()=>{const a=await J();a.length&&(e.value=[...B,...a]),L()});const N=()=>{if(typeof n.params.slug=="string")return n.params.slug;const a=n.query.p;return typeof a=="string"?a:""};async function L(){const a=N(),s=e.value;if(!s.length)return;const t=s.find(g=>g.slug===a)??s[0];if(t&&!(t.slug===f.value&&p.value)){f.value=t.slug,k.value=!0;try{p.value=await Q(t);const{html:g,toc:P}=ot(p.value);v.value=g,_.value=P}catch{v.value="",_.value=[],i.error(o("docs.loadFailed",{title:t.title}))}finally{k.value=!1}}}$(()=>n.fullPath,()=>{L()});function F(a){d.push({name:"docs-detail",params:{slug:a}})}function q(a){document.getElementById(a)?.scrollIntoView({behavior:"smooth"})}const D=H(()=>{const a=b.value.trim().toLowerCase();return a?e.value.map(s=>{const g=(s.embedded??"").toLowerCase().split(a).length-1+(s.title.toLowerCase().includes(a)?1:0);return{doc:s,hits:g}}).filter(s=>s.hits>0).sort((s,t)=>t.hits-s.hits):e.value.map(s=>({doc:s,hits:-1}))}),w=H(()=>b.value.trim().length>0);return(a,s)=>(r(),E(U,null,{default:O(()=>[c("div",nt,[c("aside",at,[j(c("input",{"onUpdate:modelValue":s[0]||(s[0]=t=>b.value=t),class:"input docs-search",placeholder:h(o)("docs.searchPlaceholder")},null,8,rt),[[G,b.value]]),e.value.length?(r(),l(C,{key:1},[c("nav",{class:"doc-list","aria-label":h(o)("docs.sidebar")},[(r(!0),l(C,null,A(D.value,t=>(r(),l("a",{key:t.doc.slug,class:M({active:t.doc.slug===f.value}),href:"#",onClick:T(g=>F(t.doc.slug),["prevent"])},[x(u(t.doc.title)+" ",1),w.value&&t.hits>0?(r(),l("span",dt,u(t.hits),1)):S("",!0)],10,ut))),128))],8,it),w.value&&!D.value.length?(r(),l("p",ht,u(h(o)("docs.noMatch")),1)):S("",!0),_.value.length&&!w.value?(r(),l("div",mt,[c("div",ft,u(h(o)("docs.tocTitle")),1),(r(!0),l(C,null,A(_.value,t=>(r(),l("a",{key:t.id,href:`#${t.id}`,class:M({"lvl-3":t.level>=3}),onClick:T(g=>q(t.id),["prevent"])},u(t.text),11,pt))),128))])):S("",!0)],64)):(r(),l("div",lt,[x(u(h(o)("docs.notGenerated")),1),s[1]||(s[1]=c("br",null,null,-1)),c("span",ct,u(h(o)("docs.buildHint")),1)]))]),c("article",vt,[k.value?(r(),l("div",gt,[s[2]||(s[2]=c("span",{class:"spin","aria-hidden":"true"},null,-1)),x(" "+u(h(o)("docs.loading")),1)])):e.value.length?v.value?(r(),l("div",{key:3,class:"markdown-body",innerHTML:v.value},null,8,wt)):(r(),l("div",kt,u(h(o)("docs.emptyContent")),1)):(r(),l("div",yt,[s[3]||(s[3]=c("div",{class:"empty-icon"},"📚",-1)),c("p",_t,u(h(o)("docs.preparing")),1),c("p",bt,u(h(o)("docs.preparingHint")),1)]))])])]),_:1}))}});export{At as default};