nextcloud/dist/theming-settings-admin.mjs
Anna Larch 6404d75191 fix(reuse): add apps/appstore/l10n to REUSE.toml coverage
New Transifex translation files landed in apps/appstore/l10n/ without
a matching annotation block, causing the REUSE compliance check to fail.

AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
2026-05-07 19:40:49 +02:00

2 lines
14 KiB
JavaScript

import{b as x,U as X,l as v,z as $,o as p,c as _,w as g,g as b,t as f,u as e,k as m,j as T,f as C,h as M,a8 as j,a9 as Z,Z as te,aa as ne,q as ie,a5 as q,y as k,Q as oe,i as se,v as Y,a7 as re,p as ue,F as H,e as de}from"./preload-helper-CX9gtE7n.chunk.mjs";import{l as V,_ as A}from"./public-C1mLBHT3.chunk.mjs";import{n as me,o as ee,p as ce,N as pe}from"./mdi-BjKyjJ9m.chunk.mjs";import{c as F,i as D}from"./index-BpWtOFbq.chunk.mjs";import{a as U}from"./index-C1xmmKTZ-BdqLiU2K.chunk.mjs";import{t as l}from"./translation-DoG5ZELJ-CPJIGC2H.chunk.mjs";import{b as w}from"./index-CziSTDUD.chunk.mjs";import{N as G}from"./NcCheckboxRadioSwitch-D0gFwEVl-DUWN1FjH.chunk.mjs";import{N as ge}from"./index-Ck6YKth1.chunk.mjs";import{N as O}from"./ContentCopy-DS0QzQtq.chunk.mjs";import{A as he,l as W,g as fe,r as S}from"./refreshStyles-DppQGmxm.chunk.mjs";import{N as E}from"./TrashCanOutline-B-GxU5E3.chunk.mjs";import{_ as ye}from"./NcTextField.vue_vue_type_script_setup_true_lang-B-4HNjYH-CTxKDSgI.chunk.mjs";import{w as ae}from"./index-DZVjGEW7.chunk.mjs";import{N as z}from"./ArrowRight-JDdFcric.chunk.mjs";import ve from"./index-blkJtiu8.chunk.mjs";import{N as R}from"./Web-lLWc6zap.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./util-BUyb4W9M.chunk.mjs";import"./index-C6zIcU-d.chunk.mjs";import"./NcModal-kyWZ3UFC-CV6Hvf6d.chunk.mjs";import"./NcInputField-CPL-a_MM-WQA5jsOf.chunk.mjs";import"./colors-BfjxNgsx-CknPG731.chunk.mjs";const be={class:"info-note"},_e=["aria-labelledby"],ke=["id"],we={class:"info-note"},Ve=x({__name:"AdminSectionAppMenu",setup(n){const d=X(),{defaultApps:a}=V("theming","adminThemingParameters"),i=V("core","apps").map(({id:t,name:r,icon:u})=>({label:r,id:t,icon:u})),o=v(a.map(t=>i.find(r=>r.id===t)).filter(Boolean));$(o,async t=>{try{await c("defaultApps",t.map(r=>r.id))}catch(r){W.error("Could not set global default apps",{error:r}),U(l("theming","Could not set global default apps"))}});const s=v(a.length>0);$(s,t=>{o.value=t?i.filter(r=>["dashboard","files"].includes(r.id)):[]});async function c(t,r){const u=w("/apps/theming/ajax/updateAppMenu");return await F.put(u,{setting:t,value:r})}return(t,r)=>(p(),_(e(O),{name:e(l)("theming","Navigation bar settings")},{default:g(()=>[b("h3",null,f(e(l)("theming","Default app")),1),b("p",be,f(e(l)("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(G),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=u=>s.value=u),type:"switch"},{default:g(()=>[T(f(e(l)("theming","Use custom default app")),1)]),_:1},8,["modelValue"]),s.value?(p(),C("section",{key:0,"aria-labelledby":e(d)},[b("h4",{id:e(d)},f(e(l)("theming","Global default app")),9,ke),m(e(ge),{modelValue:o.value,"onUpdate:modelValue":r[1]||(r[1]=u=>o.value=u),keepOpen:"",multiple:"",placeholder:e(l)("theming","Global default apps"),options:e(i)},null,8,["modelValue","placeholder","options"]),b("h5",null,f(e(l)("theming","Default app priority")),1),b("p",we,f(e(l)("theming","If an app is not enabled for a user, the next app with lower priority is used.")),1),m(he,{modelValue:o.value,"onUpdate:modelValue":r[2]||(r[2]=u=>o.value=u)},null,8,["modelValue"])],8,_e)):M("",!0)]),_:1},8,["name"]))}}),Fe=A(Ve,[["__scopeId","data-v-a9baec70"]]);function Q(n,d,a){let i=!1;const o=v(!1),s=v(!1);ae(d,async()=>{if(!o.value){if(i){i=!1;return}o.value=!0,s.value=!1;try{await Te(j(n),j(d)),s.value=!0,window.setTimeout(()=>{s.value=!1},2e3)}finally{o.value=!1}}},{debounce:800,flush:"sync"});async function c(){o.value=!0,s.value=!1;try{const t=await Ue(j(n));t&&te(a)&&!ne(a)&&(a.value=t),i=!0,d.value=j(a)}finally{o.value=!1}}return{isSaving:Z(o),isSaved:Z(s),reset:c}}async function Te(n,d){const a=w("/apps/theming/ajax/updateStylesheet");try{await F.post(a,{setting:n,value:String(d)})}catch(i){throw W.error("Failed to save changes",{error:i,setting:n,value:d}),D(i)&&i.response?.data?.data?.message&&U(i.response.data.data.message),i}}async function Ue(n){const d=w("/apps/theming/ajax/undoChanges");try{const{data:a}=await F.post(d,{setting:n});return a.data.value}catch(a){if(W.error("Failed to reset theming value",{error:a,setting:n}),D(a)&&a.response?.data?.data?.message)return U(a.response.data.data.message),!1;throw a}}const I=x({__name:"TextField",props:{name:{},label:{},defaultValue:{},type:{default:"text"}},setup(n){const d=n,a=v(V("theming","adminThemingParameters")[d.name].toString()),{isSaving:i,isSaved:o,reset:s}=Q(q(()=>d.name),a,q(()=>d.defaultValue));return ae(a,c=>{if(d.type==="url"&&c.includes('"'))try{const t=new URL(c);t.pathname=t.pathname.replaceAll(/"/g,"%22"),a.value=t.href}catch{return}},{debounce:600}),(c,t)=>(p(),_(e(ye),{modelValue:a.value,"onUpdate:modelValue":t[0]||(t[0]=r=>a.value=r),label:n.label,readonly:e(i),success:e(o),type:n.type,showTrailingButton:a.value!==n.defaultValue,trailingButtonIcon:n.defaultValue?"undo":"close",onTrailingButtonClick:e(s)},ie({_:2},[e(i)?{name:"icon",fn:g(()=>[m(e(E))]),key:"0"}:void 0]),1032,["modelValue","label","readonly","success","type","showTrailingButton","trailingButtonIcon","onTrailingButtonClick"]))}}),xe=x({__name:"AdminSectionTheming",setup(n){const d=V("theming","adminThemingInfo");return(a,i)=>(p(),_(e(O),{name:e(l)("theming","Theming"),description:e(l)("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(()=>[b("div",{class:k(a.$style.adminSectionTheming)},[m(I,{name:"name",label:e(l)("theming","Name"),defaultValue:"Nextcloud",maxlength:"250"},null,8,["label"]),m(I,{name:"url",label:e(l)("theming","Web link"),defaultValue:"https://nextcloud.com",placeholder:"https://…",type:"url",maxlength:"500"},null,8,["label"]),m(I,{name:"slogan",label:e(l)("theming","Slogan"),defaultValue:e(l)("settings","a safe home for all your data"),maxlength:"500"},null,8,["label","defaultValue"]),i[0]||(i[0]=b("hr",null,null,-1)),m(I,{name:"legalNoticeUrl",label:e(l)("theming","Legal notice link"),defaultValue:"",type:"url",placeholder:"https://…",maxlength:"500"},null,8,["label"]),m(I,{name:"privacyPolicyUrl",label:e(l)("theming","Privacy policy link"),defaultValue:"",type:"url",placeholder:"https://…",maxlength:"500"},null,8,["label"])],2)]),_:1},8,["name","description","docUrl"]))}}),Pe="_adminSectionTheming_1p8pd_2",Se={adminSectionTheming:Pe},Ce={$style:Se},Ie=A(xe,[["__cssModules",Ce]]),$e=x({__name:"ColorPickerField",props:{name:{},label:{},defaultValue:{}},emits:["updated"],setup(n,{emit:d}){const a=n,i=d,o=X(),s=v(V("theming","adminThemingParameters")[a.name]),c=v(s.value);$(s,h=>{c.value=h});const{isSaving:t,reset:r}=Q(()=>a.name,s,q(a,"defaultValue"));$(t,h=>!h&&i("updated"));const u=Y(()=>fe(c.value));return(h,P)=>(p(),C("div",{class:k(h.$style.colorPickerField)},[b("div",{class:k(h.$style.colorPickerField__row)},[m(e(ve),{id:e(o),modelValue:c.value,"onUpdate:modelValue":P[0]||(P[0]=y=>c.value=y),advancedFields:"",onSubmit:P[1]||(P[1]=y=>s.value=y)},{default:g(()=>[m(e(z),{class:k(h.$style.colorPickerField__button),size:"large",variant:"primary",style:oe({"--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(t)?(p(),_(e(E),{key:0,appearance:u.value==="#ffffff"?"light":"dark"},null,8,["appearance"])):(p(),_(e(R),{key:1,path:e(me)},null,8,["path"]))]),default:g(()=>[T(" "+f(n.label),1)]),_:1},8,["class","style"])]),_:1},8,["id","modelValue"]),s.value!==n.defaultValue?(p(),_(e(z),{key:0,variant:"tertiary","aria-label":e(l)("theming","Reset to default"),title:e(l)("theming","Reset to default"),onClick:e(r)},{icon:g(()=>[m(e(R),{path:e(ee)},null,8,["path"])]),_:1},8,["aria-label","title","onClick"])):M("",!0)],2),b("p",{class:k(h.$style.colorPickerField__description)},[se(h.$slots,"description")],2)],2))}}),Ae="_colorPickerField_o0yey_2",Ne="_colorPickerField__row_o0yey_7",je="_colorPickerField__button_o0yey_14",Be="_colorPickerField__description_o0yey_18",Me={colorPickerField:Ae,colorPickerField__row:Ne,colorPickerField__button:je,colorPickerField__description:Be},ze={$style:Me},J=A($e,[["__cssModules",ze]]),Re=["aria-label"],De=["disabled","name"],We=x({__name:"FileInputField",props:{name:{},label:{},disabled:{type:Boolean}},emits:["updated"],setup(n,{emit:d}){re(y=>({v6c51c3da:r.value}));const a=n,i=d,o=v(!1),s=v(V("theming","adminThemingParameters")[a.name+"Mime"]),c=v(Date.now()),t=ue("input"),r=Y(()=>`url(${w("/apps/theming/image/{key}",{key:a.name})}?v=${c.value}&m=${encodeURIComponent(s.value)})`);function u(){o.value||(t.value.files=null,t.value.click())}async function h(){if(!t.value.files?.[0])return;const y=t.value.files[0];if(y.type&&!y.type.startsWith("image/")){U(l("theming","Non image file selected"));return}o.value=!0;const N=new FormData;N.append("image",y),N.append("key",a.name);try{await F.post(w("/apps/theming/ajax/uploadImage"),N,{headers:{"Content-Type":"multipart/form-data"}}),s.value=y.type,c.value=Date.now(),i("updated")}catch(L){if(D(L)&&L.response?.status===422){const le=L.response.data?.data?.message;U(le||l("theming","Failed to upload image"))}else U(l("theming","Failed to upload image"))}finally{o.value=!1,t.value.value=""}}async function P(){if(!o.value){o.value=!0;try{await F.post(w("/apps/theming/ajax/undoChanges"),{setting:a.name}),s.value="",i("updated")}finally{o.value=!1}}}return(y,N)=>(p(),C("div",{class:k(y.$style.fileInputField)},[m(e(z),{class:k(y.$style.fileInputField__button),alignment:"start",disabled:n.disabled,size:"large",onClick:u},{icon:g(()=>[o.value?(p(),_(e(E),{key:0})):(p(),_(e(R),{key:1,path:e(ce)},null,8,["path"]))]),default:g(()=>[T(" "+f(n.label),1)]),_:1},8,["class","disabled"]),s.value.startsWith("image/")?(p(),C("div",{key:0,class:k(y.$style.fileInputField__preview),role:"img","aria-label":e(l)("theming","Preview of the selected image")},null,10,Re)):M("",!0),s.value&&!n.disabled?(p(),_(e(z),{key:1,"aria-label":e(l)("theming","Reset to default"),title:e(l)("theming","Reset to default"),size:"large",variant:"tertiary",onClick:P},{icon:g(()=>[m(e(R),{path:e(ee)},null,8,["path"])]),_:1},8,["aria-label","title"])):M("",!0),b("input",{ref:"input",class:"hidden-visually","aria-hidden":"true",disabled:n.disabled,type:"file",accept:"image/*",name:n.name,onChange:h},null,40,De)],2))}}),Le="_fileInputField_1u7zs_2",qe="_fileInputField__button_1u7zs_10",Ge="_fileInputField__preview_1u7zs_14",Oe={fileInputField:Le,fileInputField__button:qe,fileInputField__preview:Ge},Ee={$style:Oe},B=A(We,[["__cssModules",Ee]]),Qe=x({__name:"AdminSectionThemingAdvanced",setup(n){const{defaultBackgroundColor:d}=V("theming","adminThemingInfo"),a=V("theming","adminThemingParameters"),i=v(a.disableUserTheming),{isSaving:o}=Q("disableUserTheming",i,!1),s=v(!1),c=v(a.backgroundMime==="backgroundColor");$(c,t);async function t(r){s.value=!0;try{r?(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(W.error("Failed to remove background image",{error:u}),D(u)&&u.response?.data?.data?.message){U(u.response.data.data.message);return}throw u}finally{s.value=!1}}return(r,u)=>(p(),_(e(O),{name:e(l)("theming","Background and color")},{default:g(()=>[b("div",{class:k(r.$style.adminSectionThemingAdvanced)},[m(J,{name:"primaryColor",label:e(l)("theming","Primary color"),defaultValue:"#00679e",onUpdated:e(S)},{description:g(()=>[T(f(e(l)("theming","Set the default primary color, used to highlight important elements."))+" "+f(e(l)("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(J,{name:"backgroundColor",label:e(l)("theming","Background color"),defaultValue:e(d),onUpdated:e(S)},{description:g(()=>[T(f(e(l)("theming","When no background image is set the background color will be used."))+" "+f(e(l)("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(G),{modelValue:c.value,"onUpdate:modelValue":u[0]||(u[0]=h=>c.value=h),type:"switch",loading:s.value,description:e(l)("theming","Use a plain background color instead of a background image.")},{default:g(()=>[T(f(e(l)("theming","Remove background image")),1)]),_:1},8,["modelValue","loading","description"]),m(B,{name:"background",disabled:c.value,label:e(l)("theming","Background image"),onUpdated:e(S)},null,8,["disabled","label","onUpdated"]),m(B,{name:"favicon",label:e(l)("theming","Favicon")},null,8,["label"]),m(B,{name:"logo",label:e(l)("theming","Logo"),onUpdated:e(S)},null,8,["label","onUpdated"]),m(B,{name:"logoheader",label:e(l)("theming","Navigation bar logo"),onUpdated:e(S)},null,8,["label","onUpdated"]),u[2]||(u[2]=b("hr",null,null,-1)),m(e(G),{modelValue:i.value,"onUpdate:modelValue":u[1]||(u[1]=h=>i.value=h),type:"switch",loading:e(o),description:e(l)("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(()=>[T(f(e(l)("theming","Disable user theming")),1)]),_:1},8,["modelValue","loading","description"])],2)]),_:1},8,["name"]))}}),Ze="_adminSectionThemingAdvanced_dyaj4_2",He={adminSectionThemingAdvanced:Ze},Je={$style:He},Ke=A(Qe,[["__cssModules",Je]]),Xe=x({__name:"AdminTheming",setup(n){const{isThemeable:d,notThemeableErrorMessage:a}=V("theming","adminThemingInfo");return(i,o)=>(p(),C(H,null,[e(d)?(p(),C(H,{key:1},[m(Ie),m(Ke)],64)):(p(),_(e(pe),{key:0,text:e(a),showAlert:"",type:"error"},null,8,["text"])),m(Fe)],64))}}),K=de(Xe);K.config.idPrefix="settings",K.mount("#settings-admin-theming");
//# sourceMappingURL=theming-settings-admin.mjs.map