nextcloud/dist/theming-settings-admin.mjs
Ferdinand Thiessen f9d4bb2ba8
chore: compile assets
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-01-05 22:21:43 +01:00

2 lines
13 KiB
JavaScript

import{j as U,am as J,l as F,q as b,k as I,t,c as _,o as p,w as g,H as y,b as m,E as S,F as N,f as v,y as e,e as x,an as H,ao as j,aa as ee,ap as ae,ag as D,v as te,G as k,s as K,X as le,aq as ne,ar as Q,x as ie,Y as oe,p as se,as as re,M as O,h as ue}from"./mdi-B9XVyi7B.chunk.mjs";import{b as z,N as B,e as de}from"./NcNoteCard-CVhtNL04-BSciYEDO.chunk.mjs";import{c as V,i as q}from"./index-BOuI_nzB.chunk.mjs";import{s as $,w as Z}from"./index-JpgrUA2Z-ClfXhQGo.chunk.mjs";import{d as w,_ as A}from"./_plugin-vue_export-helper-CDPKodk-.chunk.mjs";import{N as W}from"./NcCheckboxRadioSwitch-BCSKF7Tk-bH1fDMyQ.chunk.mjs";import{N as me}from"./NcSelect-Czzsi3P_-DAfF4XPJ.chunk.mjs";import{N as G}from"./ContentCopy-CFmC6HSf.chunk.mjs";import{l as R,A as ce,g as pe,r as P}from"./refreshStyles-CCxdNvOX.chunk.mjs";import{N as L}from"./PencilOutline-BWbwYeLs.chunk.mjs";import{_ as ge}from"./TrashCanOutline-u_08oBcy.chunk.mjs";import{N as he}from"./NcColorPicker-Kc0JqRtp-C2qhhhpg.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./string_decoder-mL5xNZ9K.chunk.mjs";import"./NcInputField-Bwsh2aHY-kbXSi5f0.chunk.mjs";import"./colors-Go3zmZRD-COThczpI.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}),$(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(W),{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(me),{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(ce,{modelValue:i.value,"onUpdate:modelValue":s[2]||(s[2]=u=>i.value=u)},null,8,["modelValue"])],8,ve)):N("",!0)]),_:1},8,["name"]))}}),ke=A(_e,[["__scopeId","data-v-7c334f63"]]);function E(l,d,a){let n=!1;const i=b(!1),o=b(!1);Z(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:H(i),isSaved:H(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}),q(n)&&n.response?.data?.data?.message&&$(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}),q(a)&&a.response?.data?.data?.message)return $(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 Z(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(L))]),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=A(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=K(()=>pe(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(L),{key:0,appearance:u.value==="#ffffff"?"light":"dark"},null,8,["appearance"])):(p(),_(e(B),{key:1,path:e(ne)},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(Q)},null,8,["path"])]),_:1},8,["aria-label","title","onClick"])):N("",!0)],2),y("p",{class:k(h.$style.colorPickerField__description)},[ie(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},Me={$style:je},X=A(Se,[["__cssModules",Me]]),Ne=["aria-label"],ze=["disabled","name"],Be=U({__name:"FileInputField",props:{name:{},label:{},disabled:{type:Boolean}},emits:["updated"],setup(l,{emit:d}){oe(f=>({v59d9a0d3:r.value}));const a=l,n=d,i=b(!1),o=b(F("theming","adminThemingParameters")[a.name+"Mime"]),c=se("input"),r=K(()=>`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/")){$(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(L),{key:0})):(p(),_(e(B),{key:1,path:e(re)},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,Ne)):N("",!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(Q)},null,8,["path"])]),_:1},8,["aria-label","title"])):N("",!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",We="_fileInputField__preview_1u7zs_14",qe={fileInputField:Re,fileInputField__button:De,fileInputField__preview:We},Ge={$style:qe},M=A(Be,[["__cssModules",Ge]]),Le=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}),q(u)&&u.response?.data?.data?.message){$(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(X,{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(X,{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(W),{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(M,{name:"background",disabled:c.value,label:e(t)("theming","Background image"),onUpdated:e(P)},null,8,["disabled","label","onUpdated"]),m(M,{name:"favicon",label:e(t)("theming","Favicon")},null,8,["label"]),m(M,{name:"logo",label:e(t)("theming","Logo"),onUpdated:e(P)},null,8,["label","onUpdated"]),m(M,{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(W),{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",He={adminSectionThemingAdvanced:Ee},Oe={$style:He},Xe=A(Le,[["__cssModules",Oe]]),Ye=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(Xe)],64)):(p(),_(e(de),{key:0,text:e(a),"show-alert":"",type:"error"},null,8,["text"])),m(ke)],64))}}),Y=ue(Ye);Y.config.idPrefix="settings",Y.mount("#settings-admin-theming");
//# sourceMappingURL=theming-settings-admin.mjs.map