Files
nextcloud-server-mirror/dist/files-settings-admin.mjs
2026-10-07 08:58:40 +00:00

4 lines
6.6 KiB
JavaScript

import{t as a}from"./translations-pLZlvQeM.chunk.mjs";import{e as R,q as v,Z as H,o as l,k,u as e,w as u,l as d,z as r,t as i,f as m,G as F,p as c,I as E,H as I,h as W,y as M,i as P,a as X}from"./PencilOutline-C4ZkKkas.chunk.mjs";import{c as x,i as Y}from"./index-DHyMMYTN.chunk.mjs";import{b as U}from"./index-UXL_i2di.chunk.mjs";import{l as j,d as V,c as B}from"./star-outline-BpDZzOb8.chunk.mjs";import{N as Z}from"./NcCheckboxRadioSwitch-BgZXg73g.chunk.mjs";import{N as J}from"./NcSettingsSection-DeN6Lle1.chunk.mjs";import{N as T}from"./Link-CUdpEe-t.chunk.mjs";import{N as K}from"./NcInputField-wKF2DDSn.chunk.mjs";import{N as D}from"./Check-CEU1oy_I.chunk.mjs";import{N}from"./cancel-DDzvQ-HX.chunk.mjs";import{N as Q}from"./NcProgressBar-Dixhlp8F.chunk.mjs";import{l as A}from"./logger-BJoaV_Xz.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./livePhotoUtils-CVUhgL4S.chunk.mjs";import"./index-D6fZh9CR.chunk.mjs";import"./AlertCircleOutline-jA3ki2Uu.chunk.mjs";import"./TrayArrowDown-vMg8Cl05.chunk.mjs";import"./Web-BMG0zIln.chunk.mjs";import"./_l10n-CK24vgHE.chunk.mjs";import"./File-xDTWu8L0.chunk.mjs";import"./ArrowRight-COu6qSN5.chunk.mjs";import"./NcModal-BxLzaUZK.chunk.mjs";import"./formatRelative-uuSCBZ1C.chunk.mjs";import"./MapMarkerOutline-Ip3bQdll.chunk.mjs";var h=(s=>(s[s.Unknown=0]="Unknown",s[s.Scheduled=1]="Scheduled",s[s.Running=2]="Running",s[s.Done=3]="Done",s[s.Error=4]="Error",s))(h||{});const $={class:"sanitize-filenames__progress-container"},ee=["disabled"],ae=["aria-label"],ie=["aria-label"],se={class:"sanitize-filenames__fields"},le={key:0,class:"hidden-visually"},te=R({__name:"SettingsSanitizeFilenames",setup(s){const{status:y}=j("files","filesCompatibilitySettings"),n=v(!1),w=v(10),f=v(y.status),o=v(y.processed),p=v(y.total),z=H(y.errors||{}),g=P(()=>o.value>0?Math.round(o.value*100/p.value):0),_=P(()=>f.value===h.Scheduled||f.value===h.Running);async function L(){if(!_.value)try{n.value=!0,await x.post(V("apps/files/api/v1/filenames/sanitization"),{limit:w.value}),f.value=h.Scheduled}catch(t){A.error("Failed to start filename sanitization.",{error:t}),Y(t)&&t.response?.data?.ocs?U(t.response.data.ocs.meta.message):U(a("files","Failed to start filename sanitization."))}finally{n.value=!1}}async function q(){if(!n.value)try{n.value=!0;const{data:t}=await x.get(V("apps/files/api/v1/filenames/sanitization"));f.value=t.ocs.data.status,p.value=t.ocs.data.total,o.value=t.ocs.data.processed,z.value=t.ocs.data.errors||{}}catch(t){A.error("Failed to refresh filename sanitization status.",{error:t}),U(a("files","Failed to refresh filename sanitization status."))}finally{n.value=!1}}return(t,b)=>_.value?(l(),k(e(N),{key:0},{default:u(()=>[d("div",$,[d("p",null,[r(i(e(a)("files","Filename sanitization in progress."))+" ",1),b[1]||(b[1]=d("br",null,null,-1)),o.value>0?(l(),m(F,{key:0},[r(i(e(a)("files","Currently {processedUsers} of {totalUsers} accounts are already processed.",{processedUsers:o.value,totalUsers:p.value})),1)],64)):(l(),m(F,{key:1},[r(i(e(a)("files","Preparing …")),1)],64))]),c(e(Q),{value:g.value,size:12},null,8,["value"]),c(e(T),{variant:"tertiary",onClick:q},E({default:u(()=>[r(" "+i(e(a)("files","Refresh")),1)]),_:2},[n.value?{name:"icon",fn:u(()=>[c(e(D))]),key:"0"}:void 0]),1024)])]),_:1})):f.value===e(h).Done?(l(),k(e(N),{key:1,type:"success"},{default:u(()=>[r(i(e(a)("files","All files have been sanitized for Windows filename support.")),1)]),_:1})):(l(),m("form",{key:2,class:"sanitize-filenames__form",disabled:n.value,onSubmit:M(L,["stop","prevent"])},[f.value===e(h).Error?(l(),k(e(N),{key:0,type:"error"},{default:u(()=>[r(i(e(a)("files","Some files could not be sanitized, please check your logs."))+" ",1),d("ul",{class:"sanitize-filenames__errors","aria-label":e(a)("files","Sanitization errors")},[(l(!0),m(F,null,I(Object.entries(z.value),([S,G])=>(l(),m("li",{key:S},[d("h4",null,i(S)+":",1),d("ul",{"aria-label":e(a)("files","Not sanitized filenames")},[(l(!0),m(F,null,I(G,C=>(l(),m("li",{key:C},i(C),1))),128))],8,ie)]))),128))],8,ae)]),_:1})):W("",!0),c(e(N),null,{default:u(()=>[r(i(e(a)("files","Windows filename support has been enabled."))+" ",1),b[2]||(b[2]=d("br",null,null,-1)),r(" "+i(e(a)("files","While this blocks users from creating new files with unsupported filenames, existing files are not yet renamed and thus still may break sync on Windows."))+" "+i(e(a)("files","You can trigger a rename of files with invalid filenames, this will be done in the background and may take some time."))+" "+i(e(a)("files","Please note that this may cause high workload on the sync clients.")),1)]),_:1}),d("fieldset",se,[c(e(K),{modelValue:w.value,"onUpdate:modelValue":b[0]||(b[0]=S=>w.value=S),label:e(a)("files","Limit"),helperText:e(a)("files","This allows to configure how many users should be processed in one background job run."),min:"1",type:"number"},null,8,["modelValue","label","helperText"]),c(e(T),{type:"submit",variant:"error"},E({default:u(()=>[r(" "+i(e(a)("files","Sanitize filenames"))+" ",1),n.value?(l(),m("span",le,i(e(a)("files","(starting)")),1)):W("",!0)]),_:2},[n.value?{name:"icon",fn:u(()=>[c(e(D))]),key:"0"}:void 0]),1024)])],40,ee))}}),ne=B(te,[["__scopeId","data-v-0eec7b54"]]),oe={class:"hint"},re=R({__name:"SettingsAdmin",setup(s){const{docUrl:y,isRunningSanitization:n,windowsSupport:w}=j("files","filesCompatibilitySettings"),f=a("files","Allow to restrict filenames to ensure files can be synced with all clients. By default all filenames valid on POSIX (e.g. Linux or macOS) are allowed.")+`
`+a("files","After enabling the Windows compatible filenames, existing files cannot be modified anymore but can be renamed to valid new names by their owner."),o=v(!1),p=v(w);async function z(g){if(!o.value)try{o.value=!0,await x.post(V("apps/files/api/v1/filenames/windows-compatibility"),{enabled:g}),p.value=g}catch(_){U(a("files","Failed to toggle Windows filename support")),A.error("Failed to toggle Windows filename support",{error:_})}finally{o.value=!1}}return(g,_)=>(l(),k(e(J),{docUrl:e(y),name:e(a)("files","Files compatibility"),description:f},{default:u(()=>[c(e(Z),{modelValue:p.value,disabled:e(n),loading:o.value,type:"switch","onUpdate:modelValue":z},{default:u(()=>[r(i(e(a)("files","Enforce Windows compatibility")),1)]),_:1},8,["modelValue","disabled","loading"]),d("p",oe,i(e(a)("files","This will block filenames not valid on Windows systems, like using reserved names or special characters. But this will not enforce compatibility of case sensitivity.")),1),p.value?(l(),k(ne,{key:0})):W("",!0)]),_:1},8,["docUrl","name"]))}}),ue=B(re,[["__scopeId","data-v-1cd10912"]]),O=X(ue);O.config.globalProperties.t=a,O.mount("#files-admin-settings");
//# sourceMappingURL=files-settings-admin.mjs.map