HEX
Server: nginx/1.28.3
System: Linux ip-172-31-12-242 6.17.0-1007-aws #7~24.04.1-Ubuntu SMP Thu Jan 22 21:04:49 UTC 2026 x86_64
User: root (0)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/server/panel/BTPanel/static/js/useController2.js
import{a7 as re,r as _,g as T,aD as ae}from"./base-lib.js?v=1777008528";import{c as oe,p as O,q as ne,T as c,t as A,v as $,w as b,x as ce,D as x,y as ie,z as se,A as le,f as he,C as ue}from"./utils-lib.js?v=1777008528";import{e as de,v as fe,i as ge}from"./config.js?v=1777008528";import{g as me}from"./useStore.js?v=1777008528";const be=()=>{const{savaPanelTheme:i,getPanelTheme:z}=me(),{globalTheme:s}=oe(),o=he(),g=re(),y=_(!1),w=_(!1),D=_(O()),v=T(()=>g.value?"dark":"light"),h=ae(()=>{i()},500),r=e=>{ue(s.value,e)},C=(e=(t=>(t=s.value.interface)==null?void 0:t.bg_image)()||"")=>{var m,p,f;const a=s.value,n=(m=a.theme)==null?void 0:m.view,l=["/static/images/bg-default.png","/static/images/bg-main.png","/static/images/bg-main-dark.png"];let u=(f=(p=a.interface)==null?void 0:p.is_show_bg)!=null?f:!1,d=!1;l.includes(e)&&(n==="aapanel"&&e!==l[g.value?2:1]&&(e=l[g.value?2:1],u=!0,d=!0),n==="default"&&(e=l[0],u=!g.value,d=!0),d&&r({interface:{bg_image:e,is_show_bg:u}}),c.updateInterfaceBackgroundImage(e,u))},k=(e,t)=>{ne(t,()=>{var a;try{const n=$((a=s.value.theme)==null?void 0:a.color);["auto","light"].includes(e)&&n==="gold"&&(r({theme:{color:x.theme.color}}),o.warn("自动模式/亮色下不支持暗金色主题,已自动切换为默认颜色")),r({theme:{preset:e}}),c.updateThemePreset(e),g.value=e==="auto"?O()==="dark":e==="dark",C(),i()}catch(n){}},!0)},B=e=>{try{r(e==="aapanel"?{sidebar:{opacity:80},interface:{content_opacity:80,bg_image_opacity:80,rounded:"large"},home:{overview_view:"tile"}}:{sidebar:{opacity:100},interface:{content_opacity:90,bg_image_opacity:20,rounded:"smaller"},home:{overview_view:"default"}}),r({theme:{view:e}}),c.updateThemeView(e),C(),i()}catch(t){}},M=e=>{var t;try{const a=A(e),n=$(a);if(!a)return;if(r({theme:{color:a}}),["auto","light"].includes((t=s.value.theme)==null?void 0:t.preset)&&n==="gold"){k("dark"),o.warn("自动模式/亮色下不支持暗金色主题,已自动切换为深色模式");return}c.updateThemeColor(a,v.value),h()}catch(a){}},N=e=>{e&&c.updateThemeColor(e,v.value)},P=e=>{try{const t=A(e);if(!t)return;r({sidebar:{color:t}}),c.updateSidebarColor(t,v.value),h()}catch(t){}},R=e=>{try{r({sidebar:{opacity:e}}),c.updateSidebarOpacity(e),h()}catch(t){}},E=e=>{try{r({interface:{rounded:e}}),c.updateInterfaceRadius(e,v.value),i()}catch(t){}},F=e=>{try{r({interface:{is_show_bg:e}}),C(),i()}catch(t){}},L=async e=>{try{I(e);const t=e.url||"";C(t)}catch(t){}},U=e=>{try{r({interface:{bg_image_opacity:e}}),c.updateInterfaceBgImageOpacity(e),h()}catch(t){}},V=e=>{try{r({interface:{content_opacity:e}}),c.updateInterfaceContentOpacity(e),h()}catch(t){}},j=e=>{try{const t=Array.isArray(e)?e[0]:e;r({interface:{shadow_opacity:t}}),c.updateInterfaceShadowOpacity(t),h()}catch(t){}},G=e=>{try{if(!e)return;r({interface:{shadow_color:e}}),c.updateInterfaceShadowColor(e),h()}catch(t){}},H=e=>{c.updateInterfaceShadowColor(e)},J=e=>{try{r({interface:{container_width:e}}),i()}catch(t){}},W=T(()=>{var e,t;return[{value:"default",label:"卡片模式",active:((e=s.value.home)==null?void 0:e.overview_view)==="default",icon:'<rect x="2" y="2" width="9" height="7" rx="1" fill="currentColor" opacity="0.3" /><rect x="3" y="6" width="7" height="1.5" rx="0.5" fill="currentColor" /><rect x="13" y="2" width="9" height="7" rx="1" fill="currentColor" opacity="0.3" /><rect x="14" y="6" width="7" height="1.5" rx="0.5" fill="currentColor" /><rect x="2" y="13" width="9" height="7" rx="1" fill="currentColor" opacity="0.3" /><rect x="3" y="17" width="7" height="1.5" rx="0.5" fill="currentColor" /><rect x="13" y="13" width="9" height="7" rx="1" fill="currentColor" opacity="0.3" /><rect x="14" y="17" width="7" height="1.5" rx="0.5" fill="currentColor" />'},{value:"tile",label:"经典模式",active:((t=s.value.home)==null?void 0:t.overview_view)==="tile",icon:'<circle cx="6" cy="6" r="4" fill="none" stroke="currentColor" stroke-width="1" opacity="0.3" /><path d="M 6 2 A 4 4 0 0 1 9.464 4.464" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" /><circle cx="18" cy="6" r="4" fill="none" stroke="currentColor" stroke-width="1" opacity="0.3" /><path d="M 18 2 A 4 4 0 1 1 14.536 7.464" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" /><circle cx="6" cy="18" r="4" fill="none" stroke="currentColor" stroke-width="1" opacity="0.3" /><path d="M 6 14 A 4 4 0 1 1 2.536 19.464" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" /><circle cx="18" cy="18" r="4" fill="none" stroke="currentColor" stroke-width="1" opacity="0.3" /><path d="M 18 14 A 4 4 0 0 1 21.464 16.464" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" />'}]}),q=e=>{r({home:{overview_view:e}}),i()},K=e=>{const t=Array.isArray(e)?e[0]:e;r({home:{overview_size:Number(t)}}),c.updateHomeFontSize(Number(t)),i()},Q=()=>{r({login:{is_show_logo:s.value.login.is_show_logo}}),i()},X=()=>{r({login:{is_show_bg:s.value.login.is_show_bg}}),i()},Y=e=>{const t=Array.isArray(e)?e[0]:e;r({login:{bg_image_opacity:t}}),h()},Z=e=>{const t=Array.isArray(e)?e[0]:e;r({login:{content_opacity:t}}),h()},ee=async(e,t)=>{try{const a=t?"恢复【".concat(t,"】默认配置,是否继续?"):"恢复所有默认配置,是否继续?";await b({title:"恢复【"+(t||"所有")+"】默认配置",content:a});const n=e?ce(e):x;r(n),e||c.init(n),(!e||e==="interface.bg_image")&&C(),i(!e)}catch(a){}},te=async()=>{try{await b({content:"确认要恢复所有默认设置吗?此操作不可撤销。"});const e=JSON.parse(JSON.stringify(x));Object.assign(s.value,e),r(e),await i()}catch(e){}},I=e=>{if(e&&e.status){const t=e.url||"",a=ie(e.type,t);r(a),i()}else o.error(e&&e.msg||"上传失败")};return{importLoading:y,exportLoading:w,isDark:g,systemTheme:D,overviewViewOptions:W,handleImportConfig:e=>{if(y.value)return o.success("正在导入配置,请稍候...");try{const t=document.createElement("input");t.type="file",t.accept=".gz,.json",t.onchange=async a=>{const n=a.target.files[0];if(n)try{if(y.value=!0,o.success("正在处理文件..."),!se(n,[".tar.gz"]))return o.error("只支持 .tar.gz 格式的文件");await le(n,{path:"/tmp",name:n.name,useChunked:n.size>10*1024*1024,onProgress:p=>o.success("上传进度: ".concat(p,"%")),onError:()=>{o.error("文件上传失败")}});const l=await fe({file_path:"/tmp/".concat(n.name)});if(!l.status){o.error(l.msg||"文件验证失败");return}const u=l.data;let d="确定要导入此配置吗?这将覆盖当前的界面设置。\n\n";u.file_info&&(d+="文件信息:\n",d+="- 总文件数:".concat(u.file_info.total_files,"\n"),d+="- 配置文件:".concat(u.file_info.config_files,"\n"),d+="- 资源文件:".concat(u.file_info.resource_files,"\n")),await b({title:"导入配置",content:d});const m=await ge({file_path:"/tmp/".concat(n.name),backup_existing:!0});if(m.status){const{data:p}=await z();s.value=p.data,c.init(s.value),e!=null&&e.onSuccess&&e.onSuccess();const f=m.data;let S="配置导入成功";f!=null&&f.import_info&&(S+=",已导入 ".concat(f.import_info.total_files," 个文件")),o.success(S)}else o.error(m.msg||"导入配置失败")}catch(l){if(l.message&&l.message.includes("用户取消"))return;o.error("导入配置失败:"+(l.message||"文件处理错误"))}finally{y.value=!1}},t.click()}catch(t){o.error("创建文件选择器失败"),y.value=!1}},handleExportConfig:async()=>{if(w.value)return o.success("正在导出配置,请稍候...");try{w.value=!0,o.success("正在准备导出配置...");const e=await de();if(e.status){const t=e.data.data;if(t.export_path){o.success("正在下载配置文件...");const a=document.createElement("a");a.href="/download?filename=".concat(encodeURIComponent(t.export_path)),document.body.appendChild(a),a.click(),document.body.removeChild(a),o.success("配置导出成功!")}else o.error("导出失败:无法获取导出文件路径")}else{const t=e.msg||"导出配置失败";o.error("导出失败:".concat(t))}}catch(e){o.error("导出配置失败")}finally{w.value=!1}},handleRestoreDefault:ee,handleRestoreAllDefaultsConfig:te,handleUploadImage:I,handleThemePresetChange:k,handleThemeViewChange:B,handleThemeColorChange:M,handleSidebarColorChange:P,handleSidebarOpacityChange:R,handleInterfaceRadiusChange:E,handleInterfaceBgShowChange:F,handleInterfaceBgImageChange:L,handleInterfaceBgImageOpacityChange:U,handleInterfaceContentOpacityChange:V,handleInterfaceShadowColorChange:G,handleInterfaceShadowOpacityChange:j,handleContainerWidthChange:J,handleOverviewViewChange:q,handleHomeFontSizeChange:K,handleLogoShowChange:Q,handleLoginBgShowChange:X,handleLoginBgImageOpacityChange:Y,handleLoginContentOpacityChange:Z,updateInterfaceShadowColor:H,updateThemeColor:N}};export{be as u};