nextcloud/dist/theming-settings-admin.mjs
Ferdinand Thiessen b4b5986be9 chore: compile assets
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-01-27 23:52:40 +01:00

2 lines
14 KiB
JavaScript

import{b as x,a0 as K,r as b,v as I,c as _,o as p,w as g,k as v,e as m,j as P,l as B,t as y,u as e,g as U,a1 as N,a2 as E,S as ee,a3 as ae,y as te,Z as D,n as k,N as le,p as Q,m as ne,J as ie,x as oe,F as J,h as se}from"./runtime-dom.esm-bundler-DSTOTAEf.chunk.mjs";import{l as V,a as $}from"./index-xFugdZPW.chunk.mjs";import{N as re}from"./NcNoteCard-CVhtNL04-CdF6Qoal.chunk.mjs";import{c as F,i as L}from"./index-D9L8KHF3.chunk.mjs";import{a as A}from"./index-JpgrUA2Z-D4yQFKNw.chunk.mjs";import{t}from"./translation-DoG5ZELJ-2ffMJaM4.chunk.mjs";import{g as w}from"./createElementId-DhjFt1I9-Bjk2333q.chunk.mjs";import{N as W}from"./NcCheckboxRadioSwitch-BCSKF7Tk-BDM2s1GW.chunk.mjs";import{N as ue}from"./NcSelect-Czzsi3P_-wYuKB0zM.chunk.mjs";import{N as G}from"./ContentCopy-caJ7vqeg.chunk.mjs";import{l as R,A as de,g as me,r as S}from"./refreshStyles-f-d6PTSt.chunk.mjs";import{N as O,g as ce,h as X,i as pe}from"./mdi-kAZc0JKn.chunk.mjs";import{_ as ge}from"./TrashCanOutline-DKx7CxBb.chunk.mjs";import{w as Y}from"./index-Dzo4H_NA.chunk.mjs";import{c as M,N as z}from"./logger-D3RVzcfQ-iUjwSNGe.chunk.mjs";import{N as he}from"./NcColorPicker-Kc0JqRtp-DZI9oazy.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./index-6_gsQFyp.chunk.mjs";import"./string_decoder-BO00msnV.chunk.mjs";import"./NcInputField-Bwsh2aHY-Bf_22pmD.chunk.mjs";import"./colors-Go3zmZRD-Bml2X1sg.chunk.mjs";const fe={class:"info-note"},ye=["aria-labelledby"],ve=["id"],be={class:"info-note"},_e=x({__name:"AdminSectionAppMenu",setup(l){const d=K(),{defaultApps:a}=V("theming","adminThemingParameters"),n=V("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 F.put(u,{setting:r,value:s})}return(r,s)=>(p(),_(e(G),{name:e(t)("theming","Navigation bar settings")},{default:g(()=>[v("h3",null,y(e(t)("theming","Default app")),1),v("p",fe,y(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(()=>[U(y(e(t)("theming","Use custom default app")),1)]),_:1},8,["modelValue"]),o.value?(p(),P("section",{key:0,"aria-labelledby":e(d)},[v("h4",{id:e(d)},y(e(t)("theming","Global default app")),9,ve),m(e(ue),{modelValue:i.value,"onUpdate:modelValue":s[1]||(s[1]=u=>i.value=u),keepOpen:"",multiple:"",placeholder:e(t)("theming","Global default apps"),options:e(n)},null,8,["modelValue","placeholder","options"]),v("h5",null,y(e(t)("theming","Default app priority")),1),v("p",be,y(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,ye)):B("",!0)]),_:1},8,["name"]))}}),ke=$(_e,[["__scopeId","data-v-a9baec70"]]);function q(l,d,a){let n=!1;const i=b(!1),o=b(!1);Y(d,async()=>{if(!i.value){if(n){n=!1;return}i.value=!0,o.value=!1;try{await we(N(l),N(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 Ve(N(l));r&&ee(a)&&!ae(a)&&(a.value=r),n=!0,d.value=N(a)}finally{i.value=!1}}return{isSaving:E(i),isSaved:E(o),reset:c}}async function we(l,d){const a=w("/apps/theming/ajax/updateStylesheet");try{await F.post(a,{setting:l,value:String(d)})}catch(n){throw R.error("Failed to save changes",{error:n,setting:l,value:d}),L(n)&&n.response?.data?.data?.message&&A(n.response.data.data.message),n}}async function Ve(l){const d=w("/apps/theming/ajax/undoChanges");try{const{data:a}=await F.post(d,{setting:l});return a.data.value}catch(a){if(R.error("Failed to reset theming value",{error:a,setting:l}),L(a)&&a.response?.data?.data?.message)return A(a.response.data.data.message),!1;throw a}}const C=x({__name:"TextField",props:{name:{},label:{},defaultValue:{},type:{default:"text"}},setup(l){const d=l,a=b(V("theming","adminThemingParameters")[d.name].toString()),{isSaving:n,isSaved:i,reset:o}=q(D(()=>d.name),a,D(()=>d.defaultValue));return Y(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,showTrailingButton:a.value!==l.defaultValue,trailingButtonIcon:l.defaultValue?"undo":"close",onTrailingButtonClick:e(o)},te({_:2},[e(n)?{name:"icon",fn:g(()=>[m(e(O))]),key:"0"}:void 0]),1032,["modelValue","label","readonly","success","type","showTrailingButton","trailingButtonIcon","onTrailingButtonClick"]))}}),Te=x({__name:"AdminSectionTheming",setup(l){const d=V("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."),docUrl:e(d).docUrl,"data-admin-theming-settings":""},{default:g(()=>[v("div",{class:k(a.$style.adminSectionTheming)},[m(C,{name:"name",label:e(t)("theming","Name"),defaultValue:"Nextcloud",maxlength:"250"},null,8,["label"]),m(C,{name:"url",label:e(t)("theming","Web link"),defaultValue:"https://nextcloud.com",placeholder:"https://…",type:"url",maxlength:"500"},null,8,["label"]),m(C,{name:"slogan",label:e(t)("theming","Slogan"),defaultValue:e(t)("settings","a safe home for all your data"),maxlength:"500"},null,8,["label","defaultValue"]),n[0]||(n[0]=v("hr",null,null,-1)),m(C,{name:"legalNoticeUrl",label:e(t)("theming","Legal notice link"),defaultValue:"",type:"url",placeholder:"https://…",maxlength:"500"},null,8,["label"]),m(C,{name:"privacyPolicyUrl",label:e(t)("theming","Privacy policy link"),defaultValue:"",type:"url",placeholder:"https://…",maxlength:"500"},null,8,["label"])],2)]),_:1},8,["name","description","docUrl"]))}}),Fe="_adminSectionTheming_1p8pd_2",Ue={adminSectionTheming:Fe},xe={$style:Ue},Se=$(Te,[["__cssModules",xe]]),Pe=x({__name:"ColorPickerField",props:{name:{},label:{},defaultValue:{}},emits:["updated"],setup(l,{emit:d}){const a=l,n=d,i=K(),o=b(V("theming","adminThemingParameters")[a.name]),c=b(o.value);I(o,h=>{c.value=h});const{isSaving:r,reset:s}=q(()=>a.name,o,D(a,"defaultValue"));I(r,h=>!h&&n("updated"));const u=Q(()=>me(c.value));return(h,f)=>(p(),P("div",{class:k(h.$style.colorPickerField)},[v("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),advancedFields:"",onSubmit:f[1]||(f[1]=T=>o.value=T)},{default:g(()=>[m(e(M),{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(O),{key:0,appearance:u.value==="#ffffff"?"light":"dark"},null,8,["appearance"])):(p(),_(e(z),{key:1,path:e(ce)},null,8,["path"]))]),default:g(()=>[U(" "+y(l.label),1)]),_:1},8,["class","style"])]),_:1},8,["id","modelValue"]),o.value!==l.defaultValue?(p(),_(e(M),{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(z),{path:e(X)},null,8,["path"])]),_:1},8,["aria-label","title","onClick"])):B("",!0)],2),v("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",Ne={colorPickerField:Ce,colorPickerField__row:Ie,colorPickerField__button:$e,colorPickerField__description:Ae},je={$style:Ne},Z=$(Pe,[["__cssModules",je]]),Be=["aria-label"],Me=["disabled","name"],ze=x({__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(V("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 F.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 F.post(w("/apps/theming/ajax/undoChanges"),{setting:a.name}),o.value="",n("updated")}finally{i.value=!1}}}return(f,T)=>(p(),P("div",{class:k(f.$style.fileInputField)},[m(e(M),{class:k(f.$style.fileInputField__button),alignment:"start",disabled:l.disabled,size:"large",onClick:s},{icon:g(()=>[i.value?(p(),_(e(O),{key:0})):(p(),_(e(z),{key:1,path:e(pe)},null,8,["path"]))]),default:g(()=>[U(" "+y(l.label),1)]),_:1},8,["class","disabled"]),o.value.startsWith("image/")?(p(),P("div",{key:0,class:k(f.$style.fileInputField__preview),role:"img","aria-label":e(t)("theming","Preview of the selected image")},null,10,Be)):B("",!0),o.value&&!l.disabled?(p(),_(e(M),{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(z),{path:e(X)},null,8,["path"])]),_:1},8,["aria-label","title"])):B("",!0),v("input",{ref:"input",class:"hidden-visually","aria-hidden":"true",disabled:l.disabled,type:"file",accept:"image/*",name:l.name,onChange:u},null,40,Me)],2))}}),Re="_fileInputField_1u7zs_2",De="_fileInputField__button_1u7zs_10",We="_fileInputField__preview_1u7zs_14",Le={fileInputField:Re,fileInputField__button:De,fileInputField__preview:We},Ge={$style:Le},j=$(ze,[["__cssModules",Ge]]),Oe=x({__name:"AdminSectionThemingAdvanced",setup(l){const{defaultBackgroundColor:d}=V("theming","adminThemingInfo"),a=V("theming","adminThemingParameters"),n=b(a.disableUserTheming),{isSaving:i}=q("disableUserTheming",n,!1),o=b(!1),c=b(a.backgroundMime==="backgroundColor");I(c,r);async function r(s){o.value=!0;try{s?(await F.post(w("/apps/theming/ajax/undoChanges"),{setting:"background"}),await F.post(w("/apps/theming/ajax/updateStylesheet"),{setting:"backgroundMime",value:"backgroundColor"})):await F.post(w("/apps/theming/ajax/undoChanges"),{setting:"backgroundMime"}),await S()}catch(u){if(R.error("Failed to remove background image",{error:u}),L(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(()=>[v("div",{class:k(s.$style.adminSectionThemingAdvanced)},[m(Z,{name:"primaryColor",label:e(t)("theming","Primary color"),defaultValue:"#00679e",onUpdated:e(S)},{description:g(()=>[U(y(e(t)("theming","Set the default primary color, used to highlight important elements."))+" "+y(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(Z,{name:"backgroundColor",label:e(t)("theming","Background color"),defaultValue:e(d),onUpdated:e(S)},{description:g(()=>[U(y(e(t)("theming","When no background image is set the background color will be used."))+" "+y(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","defaultValue","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(()=>[U(y(e(t)("theming","Remove background image")),1)]),_:1},8,["modelValue","loading","description"]),m(j,{name:"background",disabled:c.value,label:e(t)("theming","Background image"),onUpdated:e(S)},null,8,["disabled","label","onUpdated"]),m(j,{name:"favicon",label:e(t)("theming","Favicon")},null,8,["label"]),m(j,{name:"logo",label:e(t)("theming","Logo"),onUpdated:e(S)},null,8,["label","onUpdated"]),m(j,{name:"logoheader",label:e(t)("theming","Navigation bar logo"),onUpdated:e(S)},null,8,["label","onUpdated"]),u[2]||(u[2]=v("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(()=>[U(y(e(t)("theming","Disable user theming")),1)]),_:1},8,["modelValue","loading","description"])],2)]),_:1},8,["name"]))}}),qe="_adminSectionThemingAdvanced_dyaj4_2",Ee={adminSectionThemingAdvanced:qe},Je={$style:Ee},Ze=$(Oe,[["__cssModules",Je]]),He=x({__name:"AdminTheming",setup(l){const{isThemeable:d,notThemeableErrorMessage:a}=V("theming","adminThemingInfo");return(n,i)=>(p(),P(J,null,[e(d)?(p(),P(J,{key:1},[m(Se),m(Ze)],64)):(p(),_(e(re),{key:0,text:e(a),showAlert:"",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