nextcloud/dist/theming-settings-admin.mjs
Ferdinand Thiessen a623bffb00
chore: compile assets
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-01-14 10:27:02 +01:00

2 lines
14 KiB
JavaScript

import{b as U,a0 as J,r as b,s as I,c as _,o as p,w as g,k as y,e as m,j as S,l as M,t as v,u as e,g as x,a1 as j,a2 as K,R as ee,a3 as ae,Y as D,y as te,n as k,x as Q,K as le,m as ne,L as ie,v as oe,F as O,h as se}from"./runtime-dom.esm-bundler-BrYCUcZF.chunk.mjs";import{l as F,a as $}from"./index-xFugdZPW.chunk.mjs";import{c as z,a as B,N as re}from"./NcNoteCard-CVhtNL04-hwuc093N.chunk.mjs";import{c as V,i as W}from"./index-BfylblLb.chunk.mjs";import{a as A,w as X}from"./index-JpgrUA2Z-BFiKKJ1W.chunk.mjs";import{t}from"./translation-DoG5ZELJ-gw0g4US-.chunk.mjs";import{g as w}from"./createElementId-DhjFt1I9--Zqj3wLs.chunk.mjs";import{N as L}from"./NcCheckboxRadioSwitch-BCSKF7Tk-yPckcGKs.chunk.mjs";import{N as ue}from"./NcSelect-Czzsi3P_-DLFUGW7z.chunk.mjs";import{N as G}from"./ContentCopy-DVkZwwZt.chunk.mjs";import{l as R,A as de,g as me,r as P}from"./refreshStyles-CT-IO_Ke.chunk.mjs";import{N as q,g as ce,h as Z,i as pe}from"./mdi-D55n0uzy.chunk.mjs";import{_ as ge}from"./TrashCanOutline-CvWRJ8GE.chunk.mjs";import{N as he}from"./NcColorPicker-Kc0JqRtp-VtydDeG1.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./index-6_gsQFyp.chunk.mjs";import"./string_decoder-BO00msnV.chunk.mjs";import"./NcInputField-Bwsh2aHY-CHbAfY0u.chunk.mjs";import"./colors-Go3zmZRD-DU6ImAGi.chunk.mjs";const fe={class:"info-note"},ve=["aria-labelledby"],ye=["id"],be={class:"info-note"},_e=U({__name:"AdminSectionAppMenu",setup(l){const d=J(),{defaultApps:a}=F("theming","adminThemingParameters"),n=F("core","apps").map(({id:r,name:s,icon:u})=>({label:s,id:r,icon:u})),i=b(a.map(r=>n.find(s=>s.id===r)).filter(Boolean));I(i,async r=>{try{await c("defaultApps",r.map(s=>s.id))}catch(s){R.error("Could not set global default apps",{error:s}),A(t("theming","Could not set global default apps"))}});const o=b(a.length>0);I(o,r=>{i.value=r?n.filter(s=>["dashboard","files"].includes(s.id)):[]});async function c(r,s){const u=w("/apps/theming/ajax/updateAppMenu");return await V.put(u,{setting:r,value:s})}return(r,s)=>(p(),_(e(G),{name:e(t)("theming","Navigation bar settings")},{default:g(()=>[y("h3",null,v(e(t)("theming","Default app")),1),y("p",fe,v(e(t)("theming","The default app is the app that is e.g. opened after login or when the logo in the menu is clicked.")),1),m(e(L),{modelValue:o.value,"onUpdate:modelValue":s[0]||(s[0]=u=>o.value=u),type:"switch"},{default:g(()=>[x(v(e(t)("theming","Use custom default app")),1)]),_:1},8,["modelValue"]),o.value?(p(),S("section",{key:0,"aria-labelledby":e(d)},[y("h4",{id:e(d)},v(e(t)("theming","Global default app")),9,ye),m(e(ue),{modelValue:i.value,"onUpdate:modelValue":s[1]||(s[1]=u=>i.value=u),"keep-open":"",multiple:"",placeholder:e(t)("theming","Global default apps"),options:e(n)},null,8,["modelValue","placeholder","options"]),y("h5",null,v(e(t)("theming","Default app priority")),1),y("p",be,v(e(t)("theming","If an app is not enabled for a user, the next app with lower priority is used.")),1),m(de,{modelValue:i.value,"onUpdate:modelValue":s[2]||(s[2]=u=>i.value=u)},null,8,["modelValue"])],8,ve)):M("",!0)]),_:1},8,["name"]))}}),ke=$(_e,[["__scopeId","data-v-7c334f63"]]);function E(l,d,a){let n=!1;const i=b(!1),o=b(!1);X(d,async()=>{if(!i.value){if(n){n=!1;return}i.value=!0,o.value=!1;try{await we(j(l),j(d)),o.value=!0,window.setTimeout(()=>{o.value=!1},2e3)}finally{i.value=!1}}},{debounce:800,flush:"sync"});async function c(){i.value=!0,o.value=!1;try{const r=await Fe(j(l));r&&ee(a)&&!ae(a)&&(a.value=r),n=!0,d.value=j(a)}finally{i.value=!1}}return{isSaving:K(i),isSaved:K(o),reset:c}}async function we(l,d){const a=w("/apps/theming/ajax/updateStylesheet");try{await V.post(a,{setting:l,value:String(d)})}catch(n){throw R.error("Failed to save changes",{error:n,setting:l,value:d}),W(n)&&n.response?.data?.data?.message&&A(n.response.data.data.message),n}}async function Fe(l){const d=w("/apps/theming/ajax/undoChanges");try{const{data:a}=await V.post(d,{setting:l});return a.data.value}catch(a){if(R.error("Failed to reset theming value",{error:a,setting:l}),W(a)&&a.response?.data?.data?.message)return A(a.response.data.data.message),!1;throw a}}const C=U({__name:"TextField",props:{name:{},label:{},defaultValue:{},type:{default:"text"}},setup(l){const d=l,a=b(F("theming","adminThemingParameters")[d.name].toString()),{isSaving:n,isSaved:i,reset:o}=E(D(()=>d.name),a,D(()=>d.defaultValue));return X(a,c=>{if(d.type==="url"&&c.includes('"'))try{const r=new URL(c);r.pathname=r.pathname.replaceAll(/"/g,"%22"),a.value=r.href}catch{return}},{debounce:600}),(c,r)=>(p(),_(e(ge),{modelValue:a.value,"onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),label:l.label,readonly:e(n),success:e(i),type:l.type,"show-trailing-button":a.value!==l.defaultValue,"trailing-button-icon":l.defaultValue?"undo":"close",onTrailingButtonClick:e(o)},te({_:2},[e(n)?{name:"icon",fn:g(()=>[m(e(q))]),key:"0"}:void 0]),1032,["modelValue","label","readonly","success","type","show-trailing-button","trailing-button-icon","onTrailingButtonClick"]))}}),Te=U({__name:"AdminSectionTheming",setup(l){const d=F("theming","adminThemingInfo");return(a,n)=>(p(),_(e(G),{name:e(t)("theming","Theming"),description:e(t)("theming","Theming makes it possible to easily customize the look and feel of your instance and supported clients. This will be visible for all users."),"doc-url":e(d).docUrl,"data-admin-theming-settings":""},{default:g(()=>[y("div",{class:k(a.$style.adminSectionTheming)},[m(C,{name:"name",label:e(t)("theming","Name"),"default-value":"Nextcloud",maxlength:"250"},null,8,["label"]),m(C,{name:"url",label:e(t)("theming","Web link"),"default-value":"https://nextcloud.com",placeholder:"https://…",type:"url",maxlength:"500"},null,8,["label"]),m(C,{name:"slogan",label:e(t)("theming","Slogan"),"default-value":e(t)("settings","a safe home for all your data"),maxlength:"500"},null,8,["label","default-value"]),n[0]||(n[0]=y("hr",null,null,-1)),m(C,{name:"legalNoticeUrl",label:e(t)("theming","Legal notice link"),"default-value":"",type:"url",placeholder:"https://…",maxlength:"500"},null,8,["label"]),m(C,{name:"privacyPolicyUrl",label:e(t)("theming","Privacy policy link"),"default-value":"",type:"url",placeholder:"https://…",maxlength:"500"},null,8,["label"])],2)]),_:1},8,["name","description","doc-url"]))}}),Ve="_adminSectionTheming_1p8pd_2",xe={adminSectionTheming:Ve},Ue={$style:xe},Pe=$(Te,[["__cssModules",Ue]]),Se=U({__name:"ColorPickerField",props:{name:{},label:{},defaultValue:{}},emits:["updated"],setup(l,{emit:d}){const a=l,n=d,i=J(),o=b(F("theming","adminThemingParameters")[a.name]),c=b(o.value);I(o,h=>{c.value=h});const{isSaving:r,reset:s}=E(()=>a.name,o,D(a,"defaultValue"));I(r,h=>!h&&n("updated"));const u=Q(()=>me(c.value));return(h,f)=>(p(),S("div",{class:k(h.$style.colorPickerField)},[y("div",{class:k(h.$style.colorPickerField__row)},[m(e(he),{id:e(i),modelValue:c.value,"onUpdate:modelValue":f[0]||(f[0]=T=>c.value=T),"advanced-fields":"",onSubmit:f[1]||(f[1]=T=>o.value=T)},{default:g(()=>[m(e(z),{class:k(h.$style.colorPickerField__button),size:"large",variant:"primary",style:le({"--color-primary-element":c.value,"--color-primary-element-text":u.value,"--color-primary-element-hover":"color-mix(in srgb, var(--color-primary-element) 70%, var(--color-primary-element-text))"})},{icon:g(()=>[e(r)?(p(),_(e(q),{key:0,appearance:u.value==="#ffffff"?"light":"dark"},null,8,["appearance"])):(p(),_(e(B),{key:1,path:e(ce)},null,8,["path"]))]),default:g(()=>[x(" "+v(l.label),1)]),_:1},8,["class","style"])]),_:1},8,["id","modelValue"]),o.value!==l.defaultValue?(p(),_(e(z),{key:0,variant:"tertiary","aria-label":e(t)("theming","Reset to default"),title:e(t)("theming","Reset to default"),onClick:e(s)},{icon:g(()=>[m(e(B),{path:e(Z)},null,8,["path"])]),_:1},8,["aria-label","title","onClick"])):M("",!0)],2),y("p",{class:k(h.$style.colorPickerField__description)},[ne(h.$slots,"description")],2)],2))}}),Ce="_colorPickerField_o0yey_2",Ie="_colorPickerField__row_o0yey_7",$e="_colorPickerField__button_o0yey_14",Ae="_colorPickerField__description_o0yey_18",je={colorPickerField:Ce,colorPickerField__row:Ie,colorPickerField__button:$e,colorPickerField__description:Ae},Ne={$style:je},Y=$(Se,[["__cssModules",Ne]]),Me=["aria-label"],ze=["disabled","name"],Be=U({__name:"FileInputField",props:{name:{},label:{},disabled:{type:Boolean}},emits:["updated"],setup(l,{emit:d}){ie(f=>({v59d9a0d3:r.value}));const a=l,n=d,i=b(!1),o=b(F("theming","adminThemingParameters")[a.name+"Mime"]),c=oe("input"),r=Q(()=>`url(${w("/apps/theming/image/{key}",{key:a.name})}?v=${Date.now()}&m=${encodeURIComponent(o.value)})`);function s(){i.value||(c.value.files=null,c.value.click())}async function u(){if(!c.value.files?.[0])return;const f=c.value.files[0];if(f.type&&!f.type.startsWith("image/")){A(t("theming","Non image file selected"));return}i.value=!0;const T=new FormData;T.append("image",f),T.append("key",a.name);try{await V.post(w("/apps/theming/ajax/uploadImage"),T,{headers:{"Content-Type":"multipart/form-data"}}),o.value=f.type,n("updated")}finally{i.value=!1}}async function h(){if(!i.value){i.value=!0;try{await V.post(w("/apps/theming/ajax/undoChanges"),{setting:a.name}),o.value="",n("updated")}finally{i.value=!1}}}return(f,T)=>(p(),S("div",{class:k(f.$style.fileInputField)},[m(e(z),{class:k(f.$style.fileInputField__button),alignment:"start",disabled:l.disabled,size:"large",onClick:s},{icon:g(()=>[i.value?(p(),_(e(q),{key:0})):(p(),_(e(B),{key:1,path:e(pe)},null,8,["path"]))]),default:g(()=>[x(" "+v(l.label),1)]),_:1},8,["class","disabled"]),o.value.startsWith("image/")?(p(),S("div",{key:0,class:k(f.$style.fileInputField__preview),role:"img","aria-label":e(t)("theming","Preview of the selected image")},null,10,Me)):M("",!0),o.value&&!l.disabled?(p(),_(e(z),{key:1,"aria-label":e(t)("theming","Reset to default"),title:e(t)("theming","Reset to default"),size:"large",variant:"tertiary",onClick:h},{icon:g(()=>[m(e(B),{path:e(Z)},null,8,["path"])]),_:1},8,["aria-label","title"])):M("",!0),y("input",{ref:"input",class:"hidden-visually","aria-hidden":"true",disabled:l.disabled,type:"file",accept:"image/*",name:l.name,onChange:u},null,40,ze)],2))}}),Re="_fileInputField_1u7zs_2",De="_fileInputField__button_1u7zs_10",Le="_fileInputField__preview_1u7zs_14",We={fileInputField:Re,fileInputField__button:De,fileInputField__preview:Le},Ge={$style:We},N=$(Be,[["__cssModules",Ge]]),qe=U({__name:"AdminSectionThemingAdvanced",setup(l){const{defaultBackgroundColor:d}=F("theming","adminThemingInfo"),a=F("theming","adminThemingParameters"),n=b(a.disableUserTheming),{isSaving:i}=E("disableUserTheming",n,!1),o=b(!1),c=b(a.backgroundMime==="backgroundColor");I(c,r);async function r(s){o.value=!0;try{s?(await V.post(w("/apps/theming/ajax/undoChanges"),{setting:"background"}),await V.post(w("/apps/theming/ajax/updateStylesheet"),{setting:"backgroundMime",value:"backgroundColor"})):await V.post(w("/apps/theming/ajax/undoChanges"),{setting:"backgroundMime"}),await P()}catch(u){if(R.error("Failed to remove background image",{error:u}),W(u)&&u.response?.data?.data?.message){A(u.response.data.data.message);return}throw u}finally{o.value=!1}}return(s,u)=>(p(),_(e(G),{name:e(t)("theming","Background and color")},{default:g(()=>[y("div",{class:k(s.$style.adminSectionThemingAdvanced)},[m(Y,{name:"primaryColor",label:e(t)("theming","Primary color"),"default-value":"#00679e",onUpdated:e(P)},{description:g(()=>[x(v(e(t)("theming","Set the default primary color, used to highlight important elements."))+" "+v(e(t)("theming","The color used for elements such as primary buttons might differ a bit as it gets adjusted to fulfill accessibility requirements.")),1)]),_:1},8,["label","onUpdated"]),m(Y,{name:"backgroundColor",label:e(t)("theming","Background color"),"default-value":e(d),onUpdated:e(P)},{description:g(()=>[x(v(e(t)("theming","When no background image is set the background color will be used."))+" "+v(e(t)("theming","Otherwise the background color is by default generated from the background image, but can be adjusted to fine tune the color of the navigation icons.")),1)]),_:1},8,["label","default-value","onUpdated"]),m(e(L),{modelValue:c.value,"onUpdate:modelValue":u[0]||(u[0]=h=>c.value=h),type:"switch",loading:o.value,description:e(t)("theming","Use a plain background color instead of a background image.")},{default:g(()=>[x(v(e(t)("theming","Remove background image")),1)]),_:1},8,["modelValue","loading","description"]),m(N,{name:"background",disabled:c.value,label:e(t)("theming","Background image"),onUpdated:e(P)},null,8,["disabled","label","onUpdated"]),m(N,{name:"favicon",label:e(t)("theming","Favicon")},null,8,["label"]),m(N,{name:"logo",label:e(t)("theming","Logo"),onUpdated:e(P)},null,8,["label","onUpdated"]),m(N,{name:"logoheader",label:e(t)("theming","Navigation bar logo"),onUpdated:e(P)},null,8,["label","onUpdated"]),u[2]||(u[2]=y("hr",null,null,-1)),m(e(L),{modelValue:n.value,"onUpdate:modelValue":u[1]||(u[1]=h=>n.value=h),type:"switch",loading:e(i),description:e(t)("theming","Although you can select and customize your instance, users can change their background and colors. If you want to enforce your customization, you can toggle this on.")},{default:g(()=>[x(v(e(t)("theming","Disable user theming")),1)]),_:1},8,["modelValue","loading","description"])],2)]),_:1},8,["name"]))}}),Ee="_adminSectionThemingAdvanced_dyaj4_2",Ke={adminSectionThemingAdvanced:Ee},Oe={$style:Ke},Ye=$(qe,[["__cssModules",Oe]]),He=U({__name:"AdminTheming",setup(l){const{isThemeable:d,notThemeableErrorMessage:a}=F("theming","adminThemingInfo");return(n,i)=>(p(),S(O,null,[e(d)?(p(),S(O,{key:1},[m(Pe),m(Ye)],64)):(p(),_(e(re),{key:0,text:e(a),"show-alert":"",type:"error"},null,8,["text"])),m(ke)],64))}}),H=se(He);H.config.idPrefix="settings",H.mount("#settings-admin-theming");
//# sourceMappingURL=theming-settings-admin.mjs.map