Files
senmesh-zc/deployment/iw/web/assets/my-C6gzFuIT.js
KodouWZF d39b3b035d feat(部署): 新增 deployment/ 内外网两套按侧部署包
按 demo/ 的写法把交付包改成「角色由目录决定」:iw/ 拷内网机、ow/ 拷外网机,
各自含镜像 tar、SQL、配置与 install.sh,install.sh 不再收 iw/ow 参数。

前端不再打进镜像,改为静态包放在 <侧>/web/ 只读挂进 nginx:1.27-alpine,
现场临时改页面直接替换文件 + restart web 即可。数据仍全部挂宿主机,
子目录命名与 deploy/offline 一致(pgdata/redis/mq/upload/logs/gate),
默认根改为包内 ./volumes,放数据盘只改 .env 的 SFILE_DATA_ROOT。

后端镜像 sfile-app:1.0.1 含传输优化那一批(实测组包 11.4×、解包 9.9×)。
出包脚本 deployment/scripts/build-package.sh 负责 jar→镜像→前端双包→sql→tar→VERSION。
2026-11-04 21:44:56 +08:00

3 lines
15 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{t as e}from"./useQuery-dxbdhNvu.js";import{a as t,i as n,n as r,o as i,r as a,t as o}from"./select-stsOu5jD.js";import{n as s,t as c}from"./file-category-filter-BIAErrxo.js";import{t as l}from"./file-COj1kCUn.js";import{t as u}from"./folder-input--tEWrMtP.js";import{t as d}from"./folder-Dl7FxCLT.js";import{n as f,t as p}from"./remove-file-dialog-cN0TGs4y.js";import{t as m}from"./shield-alert-XSqo2W3w.js";import{t as h}from"./upload-Cr-BixPb.js";import{$ as g,F as _,Ft as v,G as y,H as b,J as x,Nt as S,Pt as C,Q as w,Qt as T,U as E,V as ee,Vn as D,W as O,Z as k,Zt as A,_n as te,ct as j,dt as M,et as N,fn as P,ft as F,ln as I,lt as ne,n as L,pt as R,q as z,qn as B,st as re,tn as V,tt as H,ut as U,wt as ie,yn as W,zn as ae}from"./index-BaTxSAlR.js";import{t as oe}from"./directory-breadcrumb-u3uCxukv.js";import{t as se}from"./data-table-CEq6a930.js";import{t as ce}from"./pagination-Bragnnjj.js";import{t as le}from"./use-fetch-files-rnWwNE4C.js";import{a as G,n as K,o as q,r as J,s as Y,t as X}from"./dialog-CnxDxMp1.js";import{n as ue,t as de}from"./es-6YDPW35u.js";import{i as fe,n as pe,r as me,t as he}from"./use-upload-config-OxxQwpLm.js";import{t as ge}from"./use-security-enabled-CyVC7otU.js";var _e=P(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),ve=P(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Z=B(D(),1);const ye=e=>{let{mutateAsync:t,isPending:n}=W({mutationFn:e=>e.id?ie(e):M(e),...e||{}});return{save:e=>{I.promise(t(e),{loading:`提交中...`,success:`操作成功`})},saveIsPending:n}};var Q=B(ae(),1),be=w({fileName:g().min(1,{message:`目录至少1个字符`}).max(32,{message:`目录最多32个字符`}).nonempty({message:`目录不能为空`})});function xe({open:e,setOpen:t,data:n,parentId:r,refetch:i}){let a=H({resolver:N(be),defaultValues:{fileName:``}}),{save:o,saveIsPending:s}=ye({onSuccess:()=>{i==null||i(),t(!1)}}),c=e=>{o({...n||{},...e,parentId:r})};return(0,Z.useEffect)(()=>{e&&a.reset({fileName:(n==null?void 0:n.fileName)||``})},[e,n]),(0,Q.jsx)(X,{open:e,onOpenChange:t,children:(0,Q.jsxs)(J,{className:`w-[400px]`,children:[(0,Q.jsx)(q,{children:(0,Q.jsx)(Y,{children:(n==null?void 0:n.fileType)===j.DIRECTORY&&!(n!=null&&n.id)?`创建目录`:`重命名`})}),(0,Q.jsx)(b,{...a,children:(0,Q.jsxs)(`form`,{onSubmit:a.handleSubmit(c),className:`space-y-4`,children:[(0,Q.jsx)(O,{control:a.control,name:`fileName`,render:({field:e})=>(0,Q.jsxs)(y,{children:[(0,Q.jsx)(E,{children:(0,Q.jsx)(ee,{placeholder:(n==null?void 0:n.fileType)===j.DIRECTORY?`请输入目录名`:`请输入文件名`,...e})}),(0,Q.jsx)(z,{})]})}),(0,Q.jsxs)(G,{children:[(0,Q.jsx)(K,{asChild:!0,children:(0,Q.jsx)(T,{variant:`outline`,children:`取消`})}),(0,Q.jsxs)(T,{type:`submit`,disabled:s,children:[s&&(0,Q.jsx)(A,{}),`确定`]})]})]})})]})})}var Se=`.docx,.txt,.md,.mdx,.markdown,.pdf,.html,.xlsx,.csv,.pptx,.xml,.epub,.mp3,.m4a,.wav,.amr,.mpga,.mp4,.mov,.mpeg,.webm,.jpg,.jpeg,.png,.gif,.svg`,Ce=50;function we({open:e,setOpen:t,parentId:n,refetch:r}){let{data:i}=me(),a=!!i&&i.uploadEnabled===!1,o=i!=null&&i.allowAllType?null:(i==null?void 0:i.allowedSuffixes)||null,s=he(i)??Se,c=i!=null&&i.maxFileSize&&i.maxFileSize>0?i.maxFileSize:Ce,l=pe(i)??Ce*1024*1024,{mutateAsync:u,isPending:d}=W({mutationFn:e=>v(e).then(e=>{var t,r;return M({fileCode:(t=e.data)==null?void 0:t.fileCode,fileName:(r=e.data)==null?void 0:r.fileName,fileType:j.FILE,parentId:n})})}),{getRootProps:f,getInputProps:p,isDragActive:m}=de({onDropAccepted:(0,Z.useCallback)(e=>{Promise.allSettled(e.map(async e=>{try{i!=null&&i.configured&&await fe({fileName:e.name,fileSize:e.size})}catch{return null}return u(e)})).then(e=>{e.filter(e=>e.status===`fulfilled`&&e.value).length>0&&(I.success(`上传完成`),r==null||r(),t(!1))})},[]),onDropRejected:(0,Z.useCallback)(e=>{let t=e[0].errors[0];if(t.code===ue.FileTooLarge){I.error(`超过单个文件最大限制(单个最大${c}MB)`);return}if(t.code===ue.TooManyFiles){I.error(`超过最大文件数量限制(最大100个)`);return}I.error(`文件上传失败`)},[]),maxFiles:100,minSize:1,maxSize:l,disabled:d||a,multiple:!0});return(0,Q.jsx)(X,{open:e,onOpenChange:t,children:(0,Q.jsxs)(J,{className:`w-[520px]`,children:[(0,Q.jsx)(q,{children:(0,Q.jsx)(Y,{children:`上传文件`})}),(0,Q.jsxs)(`div`,{className:`relative border border-dashed rounded-lg text-center transition-colors overflow-hidden
${a?`border-muted-foreground/25 opacity-60`:`cursor-pointer hover:border-primary`}
${m?`border-primary bg-primary/5`:`border-muted-foreground/25`}`,children:[d&&(0,Q.jsx)(`div`,{className:`absolute left-0 right-0 top-0 bottom-0 flex items-center justify-center backdrop-blur-xs bg-white/80 z-50`,children:(0,Q.jsx)(A,{className:`h-12 w-12 text-primary`})}),(0,Q.jsxs)(`div`,{...f(),className:`p-8 rounded-lg outline-none`,children:[(0,Q.jsx)(`input`,{...p({accept:s})}),(0,Q.jsx)(`div`,{className:`p-4 rounded-full bg-gray-50 inline-flex justify-center items-center`,children:(0,Q.jsx)(h,{className:`mx-auto h-6 w-6 text-muted-foreground`})}),(0,Q.jsx)(`p`,{className:`mt-2 text-lg`,children:a?`当前机构已禁止上传文件`:m?`松开鼠标以选择文件`:`拖放文件到这里,或点击选择`}),a?(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-black/50`,children:`请联系机构管理员开启上传权限`}):(0,Q.jsxs)(`p`,{className:`mt-2 text-sm text-black/50`,children:[o!=null&&o.length?`仅允许上传后缀为 ${o.join(`、`)} 的文件,`:``,`文件最大不能超过`,c,`MB`]})]})]})]})})}const Te=e=>{let{mutateAsync:t,isPending:n}=W({mutationFn:F,...e||{}});return{share:e=>{I.promise(t(e),{loading:`提交中...`,success:`操作成功`})},shareIsPending:n}};function Ee({check:e,actionName:t}){let n=(e==null?void 0:e.blockedFileNames)||[],r=(e==null?void 0:e.scanningFileNames)||[];return!n.length&&!r.length?null:(0,Q.jsxs)(`div`,{className:`rounded-md border border-red-200 bg-red-500/5 p-2.5 space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-red-500 leading-relaxed`,children:[(0,Q.jsx)(m,{size:14,className:`flex-none mt-0.5`}),(0,Q.jsxs)(`span`,{children:[`该目录下有 `,n.length,` 个文件安全检测未通过`,r.length>0&&`、${r.length} 个正在检测中`,`,确认后仅`,t,`检测通过的文件`]})]}),(0,Q.jsxs)(`div`,{className:`max-h-24 overflow-auto space-y-0.5 pl-5`,children:[n.map(e=>(0,Q.jsxs)(`div`,{className:`text-xs text-red-400 break-all`,children:[`• `,e]},e)),r.map(e=>(0,Q.jsxs)(`div`,{className:`text-xs text-amber-500 break-all`,children:[`• `,e,`(检测中)`]},e))]})]})}var De=w({validDays:k().or(g())});function Oe({open:s,setOpen:c,data:u}){var f;let p=H({resolver:N(De),defaultValues:{validDays:1}}),m=(u==null?void 0:u.fileType)===j.DIRECTORY,{data:h}=e({queryKey:[`shareSecurityCheck`,u==null?void 0:u.id,s],queryFn:()=>S(u.id).then(e=>e.data),enabled:s&&m}),g=(h==null||(f=h.excludeFileIds)==null?void 0:f.length)||0,{share:_,shareIsPending:v}=Te({onSuccess:()=>{c(!1)}}),C=e=>{_({userFileId:u.id,validDays:e.validDays,onlyPassed:g>0})};return(0,Z.useEffect)(()=>{s&&p.reset()},[s,u]),(0,Q.jsx)(X,{open:s,onOpenChange:c,children:(0,Q.jsxs)(J,{className:`w-[400px]`,children:[(0,Q.jsx)(q,{children:(0,Q.jsx)(Y,{children:`分享文件`})}),(0,Q.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-sm p-2 rounded-md bg-gray-50`,children:[(u==null?void 0:u.fileType)===j.FILE?(0,Q.jsx)(l,{size:16,className:`text-primary flex-none`}):(0,Q.jsx)(d,{size:16,className:`text-amber-500 flex-none`}),(0,Q.jsx)(`span`,{className:`break-all`,children:u==null?void 0:u.fileName})]}),m&&g>0&&(0,Q.jsx)(Ee,{check:h,actionName:`分享`}),(0,Q.jsx)(b,{...p,children:(0,Q.jsxs)(`form`,{onSubmit:p.handleSubmit(C),className:`space-y-4`,children:[(0,Q.jsx)(O,{control:p.control,name:`validDays`,render:({field:e})=>(0,Q.jsxs)(y,{children:[(0,Q.jsx)(x,{children:`有效期`}),(0,Q.jsx)(E,{children:(0,Q.jsxs)(o,{onValueChange:e.onChange,value:e.value.toString(),children:[(0,Q.jsx)(t,{className:`w-full`,children:(0,Q.jsx)(i,{placeholder:`请选择有效期`})}),(0,Q.jsx)(r,{children:(0,Q.jsxs)(a,{children:[(0,Q.jsx)(n,{value:`1`,children:`1天`}),(0,Q.jsx)(n,{value:`3`,children:`3天`}),(0,Q.jsx)(n,{value:`5`,children:`5天`}),(0,Q.jsx)(n,{value:`7`,children:`7天`}),(0,Q.jsx)(n,{value:`15`,children:`15天`})]})})]})}),(0,Q.jsx)(z,{})]})}),(0,Q.jsxs)(G,{children:[(0,Q.jsx)(K,{asChild:!0,children:(0,Q.jsx)(T,{variant:`outline`,children:`取消`})}),(0,Q.jsxs)(T,{type:`submit`,disabled:v,children:[v&&(0,Q.jsx)(A,{}),`确定`]})]})]})})]})})}const ke=e=>{let{mutateAsync:t,isPending:n}=W({mutationFn:C,...e||{}});return{transfer:e=>{I.promise(t(e),{loading:`提交中...`,success:`操作成功`})},transferIsPending:n}};function Ae({open:t,setOpen:n,data:r}){var i;let a=(r==null?void 0:r.fileType)===j.DIRECTORY,{data:o}=e({queryKey:[`transferSecurityCheck`,r==null?void 0:r.id,t],queryFn:()=>S(r.id).then(e=>e.data),enabled:t&&a}),s=(o==null||(i=o.excludeFileIds)==null?void 0:i.length)||0,{transfer:c,transferIsPending:u}=ke({onSuccess(){n(!1)}});return(0,Q.jsx)(X,{open:t,onOpenChange:n,children:(0,Q.jsxs)(J,{className:`w-[400px]`,children:[(0,Q.jsxs)(q,{children:[(0,Q.jsxs)(Y,{children:[`您确定要传输该`,(r==null?void 0:r.fileType)===j.FILE?`文件`:`目录`,`到`,`外网`,`?`]}),(0,Q.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-sm p-2 rounded-md bg-gray-50`,children:[(r==null?void 0:r.fileType)===j.FILE?(0,Q.jsx)(l,{size:16,className:`text-primary flex-none`}):(0,Q.jsx)(d,{size:16,className:`text-amber-500 flex-none`}),(0,Q.jsx)(`span`,{className:`break-all`,children:r==null?void 0:r.fileName})]}),a&&s>0&&(0,Q.jsx)(Ee,{check:o,actionName:`传输`})]}),(0,Q.jsxs)(G,{children:[(0,Q.jsx)(K,{asChild:!0,children:(0,Q.jsx)(T,{variant:`outline`,children:`取消`})}),(0,Q.jsxs)(T,{type:`submit`,disabled:u,onClick:()=>{c({userFileId:r==null?void 0:r.id,onlyPassed:s>0})},children:[u&&(0,Q.jsx)(A,{}),`确定`]})]})]})})}function je(e){return(e==null?void 0:e.fileType)===j.FILE&&((e==null?void 0:e.securityStatus)===U.REJECTED||(e==null?void 0:e.securityStatus)===U.SCANNING)}function $({handleEditFile:e,handleRemove:t,handleChangeParentId:n,handleShare:r,handleTransfer:i,handleMove:a,handleFilePreview:o,securityEnabled:s}){return[{accessorKey:`fileName`,header:`文件名`,cell:({row:e})=>{var t;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 break-all cursor-pointer hover:underline hover:text-primary group`,onClick:()=>{var t;(e==null||(t=e.original)==null?void 0:t.fileType)===j.DIRECTORY?n(e==null?void 0:e.original):o(e==null?void 0:e.original)},children:[(e==null||(t=e.original)==null?void 0:t.fileType)===j.FILE?(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(l,{size:18,className:`text-primary`})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{size:18,className:`text-amber-500 group-hover:hidden`}),(0,Q.jsx)(u,{size:18,className:`text-amber-500 group-hover:block hidden`})]}),(0,Q.jsx)(`span`,{children:e.getValue(`fileName`)})]})}},{accessorKey:`createTime`,header:`创建日期`,cell:({row:e})=>(0,Q.jsx)(`div`,{children:e.getValue(`createTime`)})},{accessorKey:`fileSize`,header:`文件大小`,cell:({row:e})=>(0,Q.jsx)(`div`,{children:V(e.getValue(`fileSize`))})},{accessorKey:`fileCategory`,header:`文件种类`,cell:({row:e})=>(0,Q.jsx)(`div`,{children:e.original.fileType===j.FILE?_(e.getValue(`fileCategory`)):`-`})},...s?[{accessorKey:`securityStatus`,header:`安全检测`,cell:({row:e})=>(0,Q.jsx)(L,{status:e.original.securityStatus,reason:e.original.securityReason,action:e.original.securityAction,reviewComment:e.original.securityReviewComment,time:e.original.securityTime,fileType:e.original.fileType})}]:[],{id:`actions`,enableHiding:!1,header:`操作`,cell:({row:n})=>{var o,s;let c=je(n.original),l=((o=n.original)==null?void 0:o.securityStatus)===U.REJECTED?`安全检测未通过,禁止分享与传输`:`文件正在安全检测中,请稍后再试`;return(0,Q.jsxs)(`div`,{className:`space-x-2`,children:[(0,Q.jsx)(T,{size:`sm`,variant:`outline`,onClick:()=>{e(n.original)},children:`编辑`}),(0,Q.jsx)(`span`,{title:c?l:void 0,children:(0,Q.jsx)(T,{size:`sm`,variant:`outline`,disabled:c,onClick:()=>r(n.original),children:`分享`})}),(0,Q.jsx)(`span`,{title:c?l:void 0,children:(0,Q.jsx)(T,{size:`sm`,variant:`outline`,disabled:c,onClick:()=>i(n.original),children:`传外网`})}),(0,Q.jsx)(T,{size:`sm`,variant:`destructive`,onClick:()=>t(n.original),children:`删除`}),(0,Q.jsx)(T,{size:`sm`,variant:`outline`,onClick:()=>a(n.original),children:`移动`}),((s=n.original)==null?void 0:s.fileType)===j.FILE&&(0,Q.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>{var e;R({code:(e=n.original)==null?void 0:e.fileCode})},children:`下载`})]})}}]}function Me(){let e=te(),{securityEnabled:t}=ge(),{data:n}=me(),r=!!n&&n.uploadEnabled===!1,[i,a]=(0,Z.useState)(null),[o,l]=(0,Z.useState)(!1),d=e=>{a(e),l(!0)},[m,h]=(0,Z.useState)(!1),g=e=>{a(e),h(!0)},[_,v]=(0,Z.useState)(!1),y=e=>{a(e),v(!0)},[b,x]=(0,Z.useState)(!1),S=e=>{a(e),x(!0)},[C,w]=(0,Z.useState)(!1),E=e=>{a(e),w(!0)},[ee,D]=(0,Z.useState)(!1),O=e=>{a(e),D(!0)},[k,A]=(0,Z.useState)(!1),M=e=>{a(e),A(!0)},[N,P]=(0,Z.useState)(`all`),F=(0,Z.useMemo)(()=>({rootType:ne.MY,fileStatus:re.VALID,fileCategory:N===`all`?void 0:N}),[N]),{openDirectorys:I,changeOpenDirectorys:L,parentId:R,table:z,query:B,reset:V}=le({useColumns:e=>$({securityEnabled:t,handleChangeParentId:e,handleEditFile:d,handleRemove:y,handleShare:S,handleTransfer:E,handleMove:O,handleFilePreview:M}),queryKey:[`myFiles`],params:F});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xe,{open:o,setOpen:l,data:i,parentId:R,refetch:B.refetch}),(0,Q.jsx)(we,{open:m,setOpen:h,data:i,parentId:R,refetch:B.refetch}),(0,Q.jsx)(p,{open:_,setOpen:v,data:i,refetch:B.refetch}),(0,Q.jsx)(Oe,{open:b,setOpen:x,data:i}),(0,Q.jsx)(Ae,{open:C,setOpen:w,data:i}),(0,Q.jsx)(f,{open:ee,setOpen:D,data:i,params:F,refetch:B.refetch}),(0,Q.jsx)(s,{open:k,setOpen:A,data:i}),(0,Q.jsxs)(`div`,{className:`p-4 box-border min-h-full space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-lg`,children:`我的文件`}),(0,Q.jsx)(`div`,{className:`text-xs text-black/50`,children:`您可以进行云端文件的管理、分享、内网传输`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(c,{fileCategory:N,setFileCategory:P,reset:V}),(0,Q.jsxs)(T,{variant:`outline`,size:`sm`,className:`rounded-full !bg-transparent`,onClick:()=>{e.navigate({to:`/outside`})},children:[(0,Q.jsx)(u,{}),`我的接收`]})]}),(0,Q.jsxs)(`div`,{className:`p-4 rounded-lg border bg-white space-y-2`,children:[(0,Q.jsx)(`div`,{className:`flex items-center gap-2 empty:hidden`,children:N!==`outside`&&(0,Q.jsxs)(Q.Fragment,{children:[!r&&(0,Q.jsxs)(T,{variant:`default`,onClick:()=>g(),children:[(0,Q.jsx)(_e,{}),`上传文件`]}),(0,Q.jsxs)(T,{variant:`default`,onClick:()=>d({fileType:j.DIRECTORY}),children:[(0,Q.jsx)(ve,{}),`创建目录`]})]})}),(0,Q.jsx)(oe,{directorys:I,onChangeDirectorys:L}),(0,Q.jsxs)(`div`,{className:`relative overflow-hidden`,children:[(0,Q.jsx)(se,{table:z,query:B}),(0,Q.jsx)(ce,{table:z,className:`justify-end p-2 sticky bottom-0 left-0 right-0 z-10 bg-white`})]})]})]})]})}export{Me as component,je as isSecurityBlocked,$ as useColumns};