mirror of
https://github.com/MarSeventh/CloudFlare-ImgBed.git
synced 2026-02-01 14:44:02 +00:00
2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
"use strict";(self["webpackChunksanyue_imghub"]=self["webpackChunksanyue_imghub"]||[]).push([[850],{213:function(e,a,t){t(5331),t(9104)},456:function(e,a,t){t(5331)},694:function(e,a,t){t(5331)},797:function(e,a,t){t.d(a,{A:function(){return s}});t(4114),t(4979);var i=t(5774),n=t(1219),o=t(6181);async function s(e,a={}){const t=i.A.getters.credentials||btoa("unset:unset");a.headers={...a.headers,Authorization:`Basic ${t}`},a.credentials="include";const s=await fetch(e,a);return 401===s.status&&(n.nk.error("认证状态错误,请重新登录"),o.A.push("/adminLogin")),s}},2850:function(e,a,t){t.r(a),t.d(a,{default:function(){return F}});var i=t(9114),n=(t(5331),t(694),t(47)),o=(t(9648),t(7815)),s=(t(2907),t(5558)),l=(t(456),t(7138)),r=(t(8736),t(213),t(5970),t(7009)),c=(t(8450),t(8785),t(4880)),d=(t(7128),t(4500)),u=t(6830),h=t(6768),m=t(4232);const g={class:"container"},p={class:"header-content"},b={class:"header-action"},f={class:"main-container"},k={style:{margin:"8px"}},y=["src"],v={key:2,style:{width:"100px",height:"100px",display:"flex","justify-content":"center","align-items":"center"}},C={class:"pagination-container"};function x(e,a,t,x,_,T){const w=u.A,D=(0,h.g2)("font-awesome-icon"),F=d.R7,L=c.bZ,S=l.o8,A=r.Zq,z=l.Up,W=s.qi,E=o.aQ,X=n.S2,$=i.A;return(0,h.uX)(),(0,h.CE)("div",g,[(0,h.bF)(L,null,{default:(0,h.k6)(()=>[(0,h.Lk)("div",p,[(0,h.bF)(w,{activeTab:"customerConfig"}),(0,h.Lk)("div",b,[(0,h.bF)(F,{disabled:T.disableTooltip,content:"退出登录",placement:"bottom"},{default:(0,h.k6)(()=>[(0,h.bF)(D,{icon:"sign-out-alt",class:"header-icon",onClick:T.handleLogout},null,8,["onClick"])]),_:1},8,["disabled"])])])]),_:1}),(0,h.Lk)("div",f,[(0,h.bo)(((0,h.uX)(),(0,h.Wv)(z,{data:T.paginatedData,"default-sort":{prop:"count",order:"descending"},class:"main-table","table-layout":"fixed"},{default:(0,h.k6)(()=>[(0,h.bF)(S,{type:"expand"},{default:(0,h.k6)(e=>[(0,h.Lk)("div",k,[a[0]||(a[0]=(0,h.Lk)("h3",{style:{"text-align":"center"}},"上传文件列表",-1)),(0,h.bF)(z,{data:e.row.data,style:{width:"100%"},"default-sort":{prop:"metadata.TimeStamp",order:"descending"},"table-layout":"fixed","max-height":400},{default:(0,h.k6)(()=>[(0,h.bF)(S,{prop:"metadata.FileName",label:"文件名"}),(0,h.bF)(S,{prop:"name",label:"文件预览"},{default:(0,h.k6)(({row:e})=>[e.metadata?.FileType?.includes("image")?((0,h.uX)(),(0,h.Wv)(A,{key:0,src:"/file/"+e.name+"?from=admin",fit:"cover",lazy:"",style:{width:"100px",height:"100px"}},null,8,["src"])):e.metadata?.FileType?.includes("video")?((0,h.uX)(),(0,h.CE)("video",{key:1,src:"/file/"+e.name+"?from=admin",controls:"",style:{width:"100px",height:"100px"}},null,8,y)):((0,h.uX)(),(0,h.CE)("div",v,[(0,h.bF)(D,{icon:"file",style:{"font-size":"2em"}})]))]),_:1}),(0,h.bF)(S,{formatter:T.formatTimeStamp,label:"上传时间",prop:"metadata.TimeStamp",sortable:"","sort-method":T.sortByTimestamp},{default:(0,h.k6)(({row:e})=>[(0,h.eW)((0,m.v_)(T.formatTimeStamp(e.metadata.TimeStamp)),1)]),_:1},8,["formatter","sort-method"])]),_:2},1032,["data"])])]),_:1}),(0,h.bF)(S,{prop:"ip",label:"IP地址"}),(0,h.bF)(S,{prop:"address",label:"地址"}),(0,h.bF)(S,{prop:"count",label:"上传次数",sortable:""}),(0,h.bF)(S,{label:"允许上传"},{default:(0,h.k6)(({row:e})=>[(0,h.bF)(W,{modelValue:e.enable,"onUpdate:modelValue":a=>e.enable=a,"active-color":"#13ce66","inactive-color":"#ff4949","active-text":"允许","inactive-text":"禁止",onChange:a=>T.handleSwitchEnable(e)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1})]),_:1},8,["data"])),[[$,_.loading]]),(0,h.Lk)("div",C,[(0,h.bF)(E,{background:"",layout:"prev, pager, next",total:_.dealedData.length,"current-page":_.currentPage,"page-size":_.pageSize,onCurrentChange:T.handlePageChange},null,8,["total","current-page","page-size","onCurrentChange"]),_.currentPage===Math.ceil(_.dealedData.length/_.pageSize)?((0,h.uX)(),(0,h.Wv)(X,{key:0,type:"primary",onClick:T.loadMoreData,loading:_.loading,class:"load-more"},{default:(0,h.k6)(()=>a[1]||(a[1]=[(0,h.eW)("加载更多")])),_:1,__:[1]},8,["onClick","loading"])):(0,h.Q3)("",!0)])])])}t(4114),t(8111),t(2489),t(1701);var _=t(797),T={name:"CustomerConfig",data(){return{tableData:[],dealedData:[],blockipList:[],loading:!1,currentPage:1,pageSize:10}},components:{DashboardTabs:u.A},computed:{disableTooltip(){return window.innerWidth<768},paginatedData(){const e=(this.currentPage-1)*this.pageSize,a=e+this.pageSize;return this.dealedData.slice(e,a)}},methods:{handleLogout(){this.$store.commit("setCredentials",null),this.$router.push("/adminLogin")},formatTimeStamp(e){return new Date(e).toLocaleString()},sortByTimestamp(e,a){return new Date(e.metadata.TimeStamp)-new Date(a.metadata.TimeStamp)},async handleSwitchEnable(e){const a=e.ip,t=e.enable;t?(this.blockipList=this.blockipList.filter(e=>e!==a),await(0,_.A)("/api/manage/cusConfig/whiteip",{method:"POST",body:a})):(this.blockipList.push(a),await(0,_.A)("/api/manage/cusConfig/blockip",{method:"POST",body:a}))},handlePageChange(e){this.currentPage=e,e===Math.ceil(this.dealedData.length/this.pageSize)&&this.loadMoreData()},loadMoreData(){this.loading=!0;const e=this.dealedData.length,a=20;(0,_.A)(`/api/manage/cusConfig/list?start=${e}&count=${a}`,{method:"GET"}).then(e=>e.json()).then(e=>{this.dealedData=this.dealedData.concat(e.map(e=>{const a=!this.blockipList.includes(e.ip);return{ip:e.ip,address:e.address,count:e.count,data:e.data,enable:a}}))}).catch(()=>{this.$message.error("加载更多数据时出错,请检查网络连接")}).finally(()=>{this.loading=!1})},handleSizeChange(e){this.pageSize=e,this.currentPage=1}},mounted(){this.loading=!0,(0,_.A)("/api/manage/check",{method:"GET"}).then(e=>e.text()).then(e=>{if("true"==e)return this.showLogoutButton=!0,(0,_.A)("/api/manage/cusConfig/list?count=20",{method:"GET"});if("Not using basic auth."==e)return(0,_.A)("/api/manage/cusConfig/list?count=20",{method:"GET"});throw new Error("Unauthorized")}).then(e=>e.json()).then(async e=>{const a=await(0,_.A)("/api/manage/cusConfig/blockipList",{method:"GET"});this.blockipList=(await a.text()).split(","),this.dealedData=e.map(e=>{const a=!this.blockipList.includes(e.ip);return{ip:e.ip,address:e.address,count:e.count,data:e.data,enable:a}})}).catch(e=>{"Unauthorized"!==e.message&&this.$message.error("同步数据时出错,请检查网络连接")}).finally(()=>{this.loading=!1})}},w=t(1241);const D=(0,w.A)(T,[["render",x],["__scopeId","data-v-3fe64ba1"]]);var F=D},2907:function(e,a,t){t(5331),t(6808),t(9092)},3597:function(e,a,t){t(5331)},4318:function(){},5970:function(e,a,t){t(5331)},6055:function(e,a,t){t(5331),t(9648),t(8050),t(9104),t(5970)},6808:function(e,a,t){t(5331),t(8785),t(7819),t(5970),t(9104)},6830:function(e,a,t){t.d(a,{A:function(){return v}});var i=t(6768),n=t(4232);const o={id:"themeMask"},s=["cx","cy","r"],l=["r"],r=["opacity"];function c(e,a,t,c,d,u){return(0,i.uX)(),(0,i.CE)("div",{id:"themeToggle",onClick:a[0]||(a[0]=(...e)=>u.handleToggleClick&&u.handleToggleClick(...e))},[((0,i.uX)(),(0,i.CE)("svg",{class:(0,n.C4)(["theme_toggle_svg",{dark:d.isDark}]),width:"1.3em",height:"1.3em",viewBox:"0 0 24 24",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",stroke:"currentColor"},[(0,i.Lk)("mask",o,[a[1]||(a[1]=(0,i.Lk)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"},null,-1)),(0,i.Lk)("circle",{class:"theme_toggle_circle1",fill:"black",cx:d.isDark?"50%":"100%",cy:d.isDark?"23%":"0%",r:d.isDark?"9":"5"},null,8,s)]),(0,i.Lk)("circle",{class:"theme_toggle_circle2",cx:"12",cy:"12",r:d.isDark?"9":"5",mask:"url(#themeMask)"},null,8,l),(0,i.Lk)("g",{class:"theme_toggle_g",stroke:"currentColor",opacity:d.isDark?0:1},a[2]||(a[2]=[(0,i.Fv)('<line x1="12" y1="1" x2="12" y2="3" data-v-4c88bff4></line><line x1="12" y1="21" x2="12" y2="23" data-v-4c88bff4></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64" data-v-4c88bff4></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" data-v-4c88bff4></line><line x1="1" y1="12" x2="3" y2="12" data-v-4c88bff4></line><line x1="21" y1="12" x2="23" y2="12" data-v-4c88bff4></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36" data-v-4c88bff4></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" data-v-4c88bff4></line>',8)]),8,r)],2))])}var d={name:"ToggleDark",data(){return{isDark:this.$store.getters.useDarkMode}},methods:{handleToggleClick(){this.isDark=!this.isDark,this.$store.commit("setUseDarkMode",this.isDark),this.$store.commit("setCusDarkMode",!0)}}},u=t(1241);const h=(0,u.A)(d,[["render",c],["__scopeId","data-v-4c88bff4"]]);var m=h,g=t(8162);t(5331),t(6055),t(8830),t(3597);const p={class:"tabs"},b={class:"tabs-dropdown-link"};function f(e,a,t,o,s,l){const r=(0,i.g2)("font-awesome-icon"),c=g.c6,d=g.Iy,u=g.dW,h=m;return(0,i.uX)(),(0,i.CE)("div",p,[(0,i.Lk)("span",{class:"title",onClick:a[0]||(a[0]=(...e)=>l.refreshDashboard&&l.refreshDashboard(...e))},[(0,i.bF)(r,{icon:l.iconName,class:"fa-images"},null,8,["icon"]),(0,i.eW)(" "+(0,n.v_)(l.titleName),1)]),(0,i.bF)(u,{onCommand:l.handleTabClick,class:"tabs-dropdown",role:"navigation",onVisibleChange:l.handleDropdownVisible,"popper-class":"tabs-dropdown-popper"},{dropdown:(0,i.k6)(()=>[(0,i.bF)(d,null,{default:(0,i.k6)(()=>["dashboard"!==t.activeTab?((0,i.uX)(),(0,i.Wv)(c,{key:0,command:"dashboard"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"images",style:{"margin-right":"5px"}}),a[1]||(a[1]=(0,i.eW)(" Gallery "))]),_:1,__:[1]})):(0,i.Q3)("",!0),"customerConfig"!==t.activeTab?((0,i.uX)(),(0,i.Wv)(c,{key:1,command:"customerConfig"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"user-cog",style:{"margin-right":"5px"}}),a[2]||(a[2]=(0,i.eW)(" 用户管理 "))]),_:1,__:[2]})):(0,i.Q3)("",!0),"systemConfig"!==t.activeTab?((0,i.uX)(),(0,i.Wv)(c,{key:2,command:"systemConfig"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"cogs",style:{"margin-right":"5px"}}),a[3]||(a[3]=(0,i.eW)(" 系统设置 "))]),_:1,__:[3]})):(0,i.Q3)("",!0),(0,i.bF)(c,{command:""},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"upload",style:{"margin-right":"5px"}}),a[4]||(a[4]=(0,i.eW)(" 上传页面 "))]),_:1,__:[4]})]),_:1})]),default:(0,i.k6)(()=>[(0,i.Lk)("span",b,[(0,i.bF)(r,{icon:"bars",class:"tabs-arrow"})])]),_:1},8,["onCommand","onVisibleChange"]),(0,i.bF)(h)])}t(4114);var k={name:"DashboardTabs",props:{activeTab:{type:String,default:"dashboard"}},components:{AdminToggleDark:m},computed:{titleName(){return"dashboard"===this.activeTab?"Gallery":"customerConfig"===this.activeTab?"用户管理":"systemConfig"===this.activeTab?"系统设置":"上传页面"},iconName(){return"dashboard"===this.activeTab?"images":"customerConfig"===this.activeTab?"user-cog":"systemConfig"===this.activeTab?"cogs":"upload"}},methods:{refreshDashboard(){location.reload()},handleTabClick(e){this.$router.push(`/${e}`)},handleDropdownVisible(e){const a=document.querySelector(".tabs-dropdown-link");e?a.classList.add("rotate-up"):a.classList.remove("rotate-up")}}};const y=(0,u.A)(k,[["render",f],["__scopeId","data-v-06379666"]]);var v=y},7128:function(e,a,t){t(5331),t(4318)},7819:function(e,a,t){t(5331)},8050:function(e,a,t){t(5331)},8450:function(e,a,t){t(5331)},8736:function(e,a,t){t(5331)},8785:function(e,a,t){t(5331)},8830:function(e,a,t){t(5331)},9104:function(e,a,t){t(5331)}}]);
|
|
//# sourceMappingURL=850.53a266df.js.map
|