-
-
Notifications
You must be signed in to change notification settings - Fork 262
Fix setup template incorrectly loading update.js script #3785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Co-authored-by: thorsten <45284+thorsten@users.noreply.github.com>
Co-authored-by: thorsten <45284+thorsten@users.noreply.github.com>
phpmyfaq/assets/public/update.js
Outdated
| @@ -0,0 +1,2 @@ | |||
| import"./assets/bootstrap-7pRM7VCB.js";import"./assets/theme-switcher-DdK6h2Sc.js";document.addEventListener("DOMContentLoaded",async()=>{(()=>{const e=document.getElementById("phpmyfaq-update-next-step-button"),t=document.getElementById("phpmyfaq-update-next-step");e&&t&&e.addEventListener("click",e=>{e.preventDefault(),window.location.replace(`?step=${t.value}`)})})(),await(async()=>{if(window.location.href.endsWith("/update/")||window.location.href.endsWith("/update/index.php")){const t=document.getElementById("phpmyfaq-update-installed-version");if(!t)return;try{const e=await fetch("../api/setup/check",{method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:t.value});if(!e.ok){const t=await e.json();throw new Error(t.message)}const n=document.getElementById("phpmyfaq-update-next-step-button"),a=document.getElementById("phpmyfaq-update-check-success");a&&n&&(a.classList.remove("d-none"),n.classList.remove("disabled"),n.disabled=!1)}catch(e){let t;t=e instanceof SyntaxError?"The requested resource was not found on the server. Please check your server configuration, if you use Apache, the RewriteBase in your .htaccess configuration. If you use nginx, please check your nginx rewrite configuration.":e.message;const n=document.getElementById("phpmyfaq-update-check-alert"),a=document.getElementById("phpmyfaq-update-check-result");n&&a&&(n.classList.remove("d-none"),a.innerText=t)}}})(),await(async()=>{if(window.location.href.endsWith("/update/?step=2")||window.location.href.endsWith("/update/index.php?step=2")){const t=document.getElementById("phpmyfaq-update-installed-version");if(!t)return;try{const e=await fetch("../api/setup/backup",{method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:t.value});if(!e.ok)throw new Error("Network response was not ok");const n=await e.json(),a=document.getElementById("phpmyfaq-update-backup-download-link");a&&(a.href=n.backupFile)}catch(e){const t=e.cause&&e.cause.response?await e.cause.response.json():{error:"Unknown error"};console.error(t.error)}}})(),await(async()=>{if(window.location.href.endsWith("/update/?step=3")||window.location.href.endsWith("/update/index.php?step=3")){const t=document.getElementById("phpmyfaq-update-installed-version");if(!t)return;try{const e=await fetch("../api/setup/update-database",{method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:t.value}),n=await e.json(),a=document.getElementById("result-update");if(e.ok){a&&(a.style.width="100%",a.innerText="100%",a.classList.remove("progress-bar-animated"));const e=document.getElementById("phpmyfaq-update-database-success");e&&(e.classList.remove("d-none"),e.innerText=n.success)}else{a&&(a.style.width="100%",a.innerText="100%",a.classList.remove("progress-bar-animated"));const e=document.getElementById("phpmyfaq-update-database-error"),t=document.getElementById("error-messages");e&&t&&(e.classList.remove("d-none"),t.innerHTML=n.error)}}catch(e){console.error("Error details:",e);const t=document.getElementById("phpmyfaq-update-database-error");t&&(t.classList.remove("d-none"),t.innerText=`Error: ${e.message}`)}}})()}); | |||
Check failure
Code scanning / CodeQL
DOM text reinterpreted as HTML High
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 days ago
To fix the problem, we should ensure that any user-controlled value incorporated into a URL (particularly as a query parameter) is properly encoded to prevent injection of meta-characters that could lead to cross-site scripting. The most effective and general-purpose solution is to use encodeURIComponent on t.value before incorporating it into the URL string. This will ensure that any special characters in the input are percent-encoded and cannot interfere with the structure of the URL or subsequent processing. The change should be made directly in the region where `?step=${t.value}` is constructed for the call to window.location.replace. No new dependencies are required, and no additional methods need to be defined, as encodeURIComponent is built into JavaScript.
-
Copy modified line R1
| @@ -1,2 +1,2 @@ | ||
| import"./assets/bootstrap-7pRM7VCB.js";import"./assets/theme-switcher-DdK6h2Sc.js";document.addEventListener("DOMContentLoaded",async()=>{(()=>{const e=document.getElementById("phpmyfaq-update-next-step-button"),t=document.getElementById("phpmyfaq-update-next-step");e&&t&&e.addEventListener("click",e=>{e.preventDefault(),window.location.replace(`?step=${t.value}`)})})(),await(async()=>{if(window.location.href.endsWith("/update/")||window.location.href.endsWith("/update/index.php")){const t=document.getElementById("phpmyfaq-update-installed-version");if(!t)return;try{const e=await fetch("../api/setup/check",{method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:t.value});if(!e.ok){const t=await e.json();throw new Error(t.message)}const n=document.getElementById("phpmyfaq-update-next-step-button"),a=document.getElementById("phpmyfaq-update-check-success");a&&n&&(a.classList.remove("d-none"),n.classList.remove("disabled"),n.disabled=!1)}catch(e){let t;t=e instanceof SyntaxError?"The requested resource was not found on the server. Please check your server configuration, if you use Apache, the RewriteBase in your .htaccess configuration. If you use nginx, please check your nginx rewrite configuration.":e.message;const n=document.getElementById("phpmyfaq-update-check-alert"),a=document.getElementById("phpmyfaq-update-check-result");n&&a&&(n.classList.remove("d-none"),a.innerText=t)}}})(),await(async()=>{if(window.location.href.endsWith("/update/?step=2")||window.location.href.endsWith("/update/index.php?step=2")){const t=document.getElementById("phpmyfaq-update-installed-version");if(!t)return;try{const e=await fetch("../api/setup/backup",{method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:t.value});if(!e.ok)throw new Error("Network response was not ok");const n=await e.json(),a=document.getElementById("phpmyfaq-update-backup-download-link");a&&(a.href=n.backupFile)}catch(e){const t=e.cause&&e.cause.response?await e.cause.response.json():{error:"Unknown error"};console.error(t.error)}}})(),await(async()=>{if(window.location.href.endsWith("/update/?step=3")||window.location.href.endsWith("/update/index.php?step=3")){const t=document.getElementById("phpmyfaq-update-installed-version");if(!t)return;try{const e=await fetch("../api/setup/update-database",{method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:t.value}),n=await e.json(),a=document.getElementById("result-update");if(e.ok){a&&(a.style.width="100%",a.innerText="100%",a.classList.remove("progress-bar-animated"));const e=document.getElementById("phpmyfaq-update-database-success");e&&(e.classList.remove("d-none"),e.innerText=n.success)}else{a&&(a.style.width="100%",a.innerText="100%",a.classList.remove("progress-bar-animated"));const e=document.getElementById("phpmyfaq-update-database-error"),t=document.getElementById("error-messages");e&&t&&(e.classList.remove("d-none"),t.innerHTML=n.error)}}catch(e){console.error("Error details:",e);const t=document.getElementById("phpmyfaq-update-database-error");t&&(t.classList.remove("d-none"),t.innerText=`Error: ${e.message}`)}}})()}); | ||
| import"./assets/bootstrap-7pRM7VCB.js";import"./assets/theme-switcher-DdK6h2Sc.js";document.addEventListener("DOMContentLoaded",async()=>{(()=>{const e=document.getElementById("phpmyfaq-update-next-step-button"),t=document.getElementById("phpmyfaq-update-next-step");e&&t&&e.addEventListener("click",e=>{e.preventDefault(),window.location.replace(`?step=${encodeURIComponent(t.value)}`)})})(),await(async()=>{if(window.location.href.endsWith("/update/")||window.location.href.endsWith("/update/index.php")){const t=document.getElementById("phpmyfaq-update-installed-version");if(!t)return;try{const e=await fetch("../api/setup/check",{method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:t.value});if(!e.ok){const t=await e.json();throw new Error(t.message)}const n=document.getElementById("phpmyfaq-update-next-step-button"),a=document.getElementById("phpmyfaq-update-check-success");a&&n&&(a.classList.remove("d-none"),n.classList.remove("disabled"),n.disabled=!1)}catch(e){let t;t=e instanceof SyntaxError?"The requested resource was not found on the server. Please check your server configuration, if you use Apache, the RewriteBase in your .htaccess configuration. If you use nginx, please check your nginx rewrite configuration.":e.message;const n=document.getElementById("phpmyfaq-update-check-alert"),a=document.getElementById("phpmyfaq-update-check-result");n&&a&&(n.classList.remove("d-none"),a.innerText=t)}}})(),await(async()=>{if(window.location.href.endsWith("/update/?step=2")||window.location.href.endsWith("/update/index.php?step=2")){const t=document.getElementById("phpmyfaq-update-installed-version");if(!t)return;try{const e=await fetch("../api/setup/backup",{method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:t.value});if(!e.ok)throw new Error("Network response was not ok");const n=await e.json(),a=document.getElementById("phpmyfaq-update-backup-download-link");a&&(a.href=n.backupFile)}catch(e){const t=e.cause&&e.cause.response?await e.cause.response.json():{error:"Unknown error"};console.error(t.error)}}})(),await(async()=>{if(window.location.href.endsWith("/update/?step=3")||window.location.href.endsWith("/update/index.php?step=3")){const t=document.getElementById("phpmyfaq-update-installed-version");if(!t)return;try{const e=await fetch("../api/setup/update-database",{method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:t.value}),n=await e.json(),a=document.getElementById("result-update");if(e.ok){a&&(a.style.width="100%",a.innerText="100%",a.classList.remove("progress-bar-animated"));const e=document.getElementById("phpmyfaq-update-database-success");e&&(e.classList.remove("d-none"),e.innerText=n.success)}else{a&&(a.style.width="100%",a.innerText="100%",a.classList.remove("progress-bar-animated"));const e=document.getElementById("phpmyfaq-update-database-error"),t=document.getElementById("error-messages");e&&t&&(e.classList.remove("d-none"),t.innerHTML=n.error)}}catch(e){console.error("Error details:",e);const t=document.getElementById("phpmyfaq-update-database-error");t&&(t.classList.remove("d-none"),t.innerText=`Error: ${e.message}`)}}})()}); | ||
| //# sourceMappingURL=update.js.map |
| @@ -0,0 +1,2 @@ | |||
| const e="opt-in",t="opt-out",o="show--consent",n="show--preferences",s="disable--interaction",a="data-category",c="div",r="button",i="aria-hidden",l="btn-group",d="click",u="data-role",p="consentModal",f="preferencesModal";const h=new class{constructor(){this.t={mode:e,revision:0,autoShow:!0,lazyHtmlGeneration:!0,autoClearCookies:!0,manageScriptTags:!0,hideFromBots:!0,cookie:{name:"cc_cookie",expiresAfterDays:182,domain:"",path:"/",secure:!0,sameSite:"Lax"}},this.o={i:{},l:"",_:{},u:{},p:{},m:[],v:!1,h:null,C:null,S:null,M:"",D:!0,T:!1,k:!1,A:!1,N:!1,H:[],V:!1,I:!0,L:[],j:!1,F:"",P:!1,O:[],R:[],B:[],$:[],G:!1,J:!1,U:!1,q:[],K:[],W:[],X:{},Y:{},Z:{},ee:{},te:{},oe:[]},this.ne={ae:{},se:{}},this.ce={},this.re={ie:"cc:onFirstConsent",le:"cc:onConsent",de:"cc:onChange",fe:"cc:onModalShow",_e:"cc:onModalHide",ue:"cc:onModalReady"}}},m=(e,t)=>e.indexOf(t),g=(e,t)=>-1!==m(e,t),b=e=>Array.isArray(e),y=e=>"string"==typeof e,w=e=>!!e&&"object"==typeof e&&!b(e),v=e=>"function"==typeof e,C=e=>Object.keys(e),k=e=>Array.from(new Set(e)),L=()=>document.activeElement,T=e=>e.preventDefault(),S=(e,t)=>e.querySelectorAll(t),M=e=>{const t=document.createElement(e);return e===r&&(t.type=e),t},_=(e,t,o)=>e.setAttribute(t,o),x=(e,t,o)=>{e.removeAttribute(o?"data-"+t:t)},H=(e,t,o)=>e.getAttribute(o?"data-"+t:t),A=(e,t)=>e.appendChild(t),D=(e,t)=>e.classList.add(t),O=(e,t)=>D(e,"cm__"+t),I=(e,t)=>D(e,"pm__"+t),B=(e,t)=>e.classList.remove(t),R=e=>{if("object"!=typeof e)return e;if(e instanceof Date)return new Date(e.getTime());let t=Array.isArray(e)?[]:{};for(let o in e){let n=e[o];t[o]=R(n)}return t},N=(e,t)=>dispatchEvent(new CustomEvent(e,{detail:t})),P=(e,t,o,n)=>{e.addEventListener(t,o),n&&h.o.m.push({pe:e,ge:t,me:o})},j=(e,t)=>{const o=e||[],n=t||[];return o.filter(e=>!g(n,e)).concat(n.filter(e=>!g(o,e)))},E=e=>{h.o.R=k(e),h.o.F=(()=>{let e="custom";const{R:t,O:o,B:n}=h.o,s=t.length;return s===o.length?e="all":s===n.length&&(e="necessary"),e})()},F=(e,t,o,n)=>{const s="accept-",{show:a,showPreferences:c,hide:r,hidePreferences:i,acceptCategory:l}=t,u=e||document,p=e=>S(u,`[data-cc="${e}"]`),f=(e,t)=>{T(e),l(t),i(),r()},m=p("show-preferencesModal"),g=p("show-consentModal"),b=p(s+"all"),y=p(s+"necessary"),w=p(s+"custom"),v=h.t.lazyHtmlGeneration;for(const C of m)_(C,"aria-haspopup","dialog"),P(C,d,e=>{T(e),c()}),v&&(P(C,"mouseenter",e=>{T(e),h.o.N||o(t,n)},!0),P(C,"focus",()=>{h.o.N||o(t,n)}));for(let h of g)_(h,"aria-haspopup","dialog"),P(h,d,e=>{T(e),a(!0)},!0);for(let h of b)P(h,d,e=>{f(e,"all")},!0);for(let h of w)P(h,d,e=>{f(e)},!0);for(let h of y)P(h,d,e=>{f(e,[])},!0)},Y=(e,t)=>{e&&(t&&(e.tabIndex=-1),e.focus(),t&&e.removeAttribute("tabindex"))},Z=(e,t)=>{const o=n=>{n.target.removeEventListener("transitionend",o),"opacity"===n.propertyName&&"1"===getComputedStyle(e).opacity&&Y(1===t?h.ne.be:h.ne.ve)};P(e,"transitionend",o)};let q;const G=e=>{clearTimeout(q),e?D(h.ne.ye,s):q=setTimeout(()=>{B(h.ne.ye,s)},500)},J=["M 19.5 4.5 L 4.5 19.5 M 4.5 4.501 L 19.5 19.5","M 3.572 13.406 L 8.281 18.115 L 20.428 5.885","M 21.999 6.94 L 11.639 17.18 L 2.001 6.82 "],$=(e=0,t=1.5)=>`<svg viewBox="0 0 24 24" stroke-width="${t}"><path d="${J[e]}"/></svg>`,X=e=>{const t=h.ne,o=h.o;(e=>{const n=e===t.he,s=o.i.disablePageInteraction?t.ye:n?t.Ce:t.ye;P(s,"keydown",t=>{if("Tab"!==t.key||!(n?o.k&&!o.A:o.A))return;const s=L(),a=n?o.q:o.K;0!==a.length&&(t.shiftKey?s!==a[0]&&e.contains(s)||(T(t),Y(a[1])):s!==a[1]&&e.contains(s)||(T(t),Y(a[0])))},!0)})(e)},W=["[href]",r,"input","details","[tabindex]"].map(e=>e+':not([tabindex="-1"])').join(","),z=e=>{const{o:t,ne:o}=h,n=(e,t)=>{const o=S(e,W);t[0]=o[0],t[1]=o[o.length-1]};1===e&&t.T&&n(o.he,t.q),2===e&&t.N&&n(o.we,t.K)},U=(e,t,o)=>{const{de:n,le:s,ie:a,_e:c,ue:r,fe:i}=h.ce,l=h.re;if(t){const n={modalName:t};return e===l.fe?v(i)&&i(n):e===l._e?v(c)&&c(n):(n.modal=o,v(r)&&r(n)),N(e,n)}const d={cookie:h.o.p};e===l.ie?v(a)&&a(R(d)):e===l.le?v(s)&&s(R(d)):(d.changedCategories=h.o.L,d.changedServices=h.o.ee,v(n)&&n(R(d))),N(e,R(d))},V=(e,t)=>{try{return e()}catch(o){return!t&&console.warn("CookieConsent:",o),!1}},K=e=>{const{Y:t,ee:o,O:n,X:s,oe:c,p:r,L:i}=h.o;for(const a of n){const e=o[a]||t[a]||[];for(const o of e){const e=s[a][o];if(!e)continue;const{onAccept:n,onReject:c}=e;!e.Se&&g(t[a],o)?(e.Se=!0,v(n)&&n()):e.Se&&!g(t[a],o)&&(e.Se=!1,v(c)&&c())}}if(!h.t.manageScriptTags)return;const l=c,d=e||r.categories||[],u=(e,n)=>{if(n>=e.length)return;const s=c[n];if(s.xe)return u(e,n+1);const r=s.Me,l=s.De,p=s.Te,f=g(d,l),h=!!p&&g(t[l],p);if(!p&&!s.ke&&f||!p&&s.ke&&!f&&g(i,l)||p&&!s.ke&&h||p&&s.ke&&!h&&g(o[l]||[],p)){s.xe=!0;const t=H(r,"type",!0);x(r,"type",!!t),x(r,a);let o=H(r,"src",!0);o&&x(r,"src",!0);const c=M("script");c.textContent=r.innerHTML;for(const{nodeName:e}of r.attributes)_(c,e,r[e]||H(r,e));t&&(c.type=t),o?c.src=o:o=r.src;const i=!!o&&(!t||["text/javascript","module"].includes(t));if(i&&(c.onload=c.onerror=()=>{u(e,++n)}),r.replaceWith(c),i)return}u(e,++n)};u(l,0)},Q="bottom",ee="left",te="center",oe="right",ne="inline",se="wide",ae="pm--",ce=["middle","top",Q],re=[ee,te,oe],ie={box:{Ee:[se,ne],Ae:ce,Ne:re,He:Q,Ve:oe},cloud:{Ee:[ne],Ae:ce,Ne:re,He:Q,Ve:te},bar:{Ee:[ne],Ae:ce.slice(1),Ne:[],He:Q,Ve:""}},le={box:{Ee:[],Ae:[],Ne:[],He:"",Ve:""},bar:{Ee:[se],Ae:[],Ne:[ee,oe],He:"",Ve:ee}},de=e=>{const t=h.o.i.guiOptions,o=t&&t.consentModal,n=t&&t.preferencesModal;0===e&&ue(h.ne.he,ie,o,"cm--","box","cm"),1===e&&ue(h.ne.we,le,n,ae,"box","pm")},ue=(e,t,o,n,s,a)=>{e.className=a;const c=o&&o.layout,r=o&&o.position,i=o&&o.flipButtons,l=!o||!1!==o.equalWeightButtons,d=c&&c.split(" ")||[],u=d[0],p=d[1],f=u in t?u:s,m=t[f],b=g(m.Ee,p)&&p,y=r&&r.split(" ")||[],w=y[0],v=n===ae?y[0]:y[1],C=g(m.Ae,w)?w:m.He,k=g(m.Ne,v)?v:m.Ve,L=t=>{t&&D(e,n+t)};L(f),L(b),L(C),L(k),i&&L("flip");const T=a+"__btn--secondary";if("cm"===a){const{Ie:e,Le:t}=h.ne;e&&(l?B(e,T):D(e,T)),t&&(l?B(t,T):D(t,T))}else{const{je:e}=h.ne;e&&(l?B(e,T):D(e,T))}},pe=(e,t)=>{const o=h.o,n=h.ne,{hide:s,hidePreferences:a,acceptCategory:p}=e,m=e=>{p(e),a(),s()},g=o.u&&o.u.preferencesModal;if(!g)return;const b=g.title,v=g.closeIconLabel,k=g.acceptAllBtn,L=g.acceptNecessaryBtn,T=g.savePreferencesBtn,S=g.sections||[],x=k||L||T;if(n.Fe)n.Pe=M(c),I(n.Pe,"body");else{n.Fe=M(c),D(n.Fe,"pm-wrapper");const e=M("div");D(e,"pm-overlay"),A(n.Fe,e),P(e,d,a),n.we=M(c),D(n.we,"pm"),_(n.we,"role","dialog"),_(n.we,i,!0),_(n.we,"aria-modal",!0),_(n.we,"aria-labelledby","pm__title"),P(n.ye,"keydown",e=>{27===e.keyCode&&a()},!0),n.Oe=M(c),I(n.Oe,"header"),n.Re=M("h2"),I(n.Re,"title"),n.Re.id="pm__title",n.Be=M(r),I(n.Be,"close-btn"),_(n.Be,"aria-label",g.closeIconLabel||""),P(n.Be,d,a),n.$e=M("span"),n.$e.innerHTML=$(),A(n.Be,n.$e),n.Ge=M(c),I(n.Ge,"body"),n.Je=M(c),I(n.Je,"footer");var H=M(c);D(H,"btns");var O=M(c),R=M(c);I(O,l),I(R,l),A(n.Je,O),A(n.Je,R),A(n.Oe,n.Re),A(n.Oe,n.Be),n.ve=M(c),_(n.ve,"tabIndex",-1),A(n.we,n.ve),A(n.we,n.Oe),A(n.we,n.Ge),x&&A(n.we,n.Je),A(n.Fe,n.we)}let N;b&&(n.Re.innerHTML=b,v&&_(n.Be,"aria-label",v)),S.forEach((e,t)=>{const s=e.title,a=e.description,l=e.linkedCategory,u=l&&o.P[l],p=e.cookieTable,f=p&&p.body,h=p&&p.caption,m=f&&f.length>0,b=!!u,v=b&&o.X[l],k=w(v)&&C(v)||[],L=b&&(!!a||!!m||C(v).length>0);var T=M(c);if(I(T,"section"),L||a){var S=M(c);I(S,"section-desc-wrapper")}let x=k.length;if(L&&x>0){const e=M(c);I(e,"section-services");for(const t of k){const o=v[t],n=o&&o.label||t,s=M(c),a=M(c),r=M(c),i=M(c);I(s,"service"),I(i,"service-title"),I(a,"service-header"),I(r,"service-icon");const d=fe(n,t,u,!0,l);i.innerHTML=n,A(a,r),A(a,i),A(s,a),A(s,d),A(e,s)}A(S,e)}if(s){var H=M(c),O=M(b?r:c);if(I(H,"section-title-wrapper"),I(O,"section-title"),O.innerHTML=s,A(H,O),b){const e=M("span");e.innerHTML=$(2,3.5),I(e,"section-arrow"),A(H,e),T.className+="--toggle";const t=fe(s,l,u);let o=g.serviceCounterLabel;if(x>0&&y(o)){let e=M("span");I(e,"badge"),I(e,"service-counter"),_(e,i,!0),_(e,"data-servicecounter",x),o&&(o=o.split("|"),o=o.length>1&&x>1?o[1]:o[0],_(e,"data-counterlabel",o)),e.innerHTML=x+(o?" "+o:""),A(O,e)}if(L){I(T,"section--expandable");var R=l+"-desc";_(O,"aria-expanded",!1),_(O,"aria-controls",R)}A(H,t)}else _(O,"role","heading"),_(O,"aria-level","3");A(T,H)}if(a){var j=M("p");I(j,"section-desc"),j.innerHTML=a,A(S,j)}if(L&&(_(S,i,"true"),S.id=R,E=S,F=T,Y=O,P(O,d,()=>{F.classList.contains("is-expanded")?(B(F,"is-expanded"),_(Y,"aria-expanded","false"),_(E,i,"true")):(D(F,"is-expanded"),_(Y,"aria-expanded","true"),_(E,i,"false"))}),m)){const e=M("table"),o=M("thead"),s=M("tbody");if(h){const t=M("caption");I(t,"table-caption"),t.innerHTML=h,e.appendChild(t)}I(e,"section-table"),I(o,"table-head"),I(s,"table-body");const a=p.headers,r=C(a),i=n.Ue.createDocumentFragment(),l=M("tr");for(const n of r){const e=a[n],o=M("th");o.id="cc__row-"+e+t,_(o,"scope","col"),I(o,"table-th"),o.innerHTML=e,A(i,o)}A(l,i),A(o,l);const d=n.Ue.createDocumentFragment();for(const n of f){const e=M("tr");I(e,"table-tr");for(const o of r){const s=a[o],r=n[o],i=M("td"),l=M(c);I(i,"table-td"),_(i,"data-column",s),_(i,"headers","cc__row-"+s+t),l.insertAdjacentHTML("beforeend",r),A(i,l),A(e,i)}A(d,e)}A(s,d),A(e,o),A(e,s),A(S,e)}var E,F,Y;(L||a)&&A(T,S);const Z=n.Pe||n.Ge;b?(N||(N=M(c),I(N,"section-toggles")),N.appendChild(T)):N=null,A(Z,N||T)}),k&&(n.ze||(n.ze=M(r),I(n.ze,"btn"),_(n.ze,u,"all"),A(O,n.ze),P(n.ze,d,()=>m("all"))),n.ze.innerHTML=k),L&&(n.je||(n.je=M(r),I(n.je,"btn"),_(n.je,u,"necessary"),A(O,n.je),P(n.je,d,()=>m([]))),n.je.innerHTML=L),T&&(n.qe||(n.qe=M(r),I(n.qe,"btn"),I(n.qe,"btn--secondary"),_(n.qe,u,"save"),A(R,n.qe),P(n.qe,d,()=>m())),n.qe.innerHTML=T),n.Pe&&(n.we.replaceChild(n.Pe,n.Ge),n.Ge=n.Pe),de(1),o.N||(o.N=!0,U(h.re.ue,f,n.we),t(e),A(n.Ce,n.Fe),X(n.we),setTimeout(()=>D(n.Fe,"cc--anim"),100)),z(2)};function fe(e,t,o,n,s){const c=h.o,r=h.ne,l=M("label"),u=M("input"),p=M("span"),f=M("span"),m=M("span"),b=M("span"),y=M("span");if(b.innerHTML=$(1,3),y.innerHTML=$(0,3),u.type="checkbox",D(l,"section__toggle-wrapper"),D(u,"section__toggle"),D(b,"toggle__icon-on"),D(y,"toggle__icon-off"),D(p,"toggle__icon"),D(f,"toggle__icon-circle"),D(m,"toggle__label"),_(p,i,"true"),n?(D(l,"toggle-service"),_(u,a,s),r.se[s][t]=u):r.ae[t]=u,n?(w=s,P(u,"change",()=>{const e=r.se[w],t=r.ae[w];c.Z[w]=[];for(let o in e){const t=e[o];t.checked&&c.Z[w].push(t.value)}t.checked=c.Z[w].length>0})):(e=>{P(u,d,()=>{const t=r.se[e],o=u.checked;c.Z[e]=[];for(let n in t)t[n].checked=o,o&&c.Z[e].push(n)})})(t),u.value=t,m.textContent=e.replace(/<.*>.*<\/.*>/gm,""),A(f,y),A(f,b),A(p,f),c.D)(o.readOnly||o.enabled)&&(u.checked=!0);else if(n){const e=c.Y[s];u.checked=o.readOnly||g(e,t)}else g(c.R,t)&&(u.checked=!0);var w;return o.readOnly&&(u.disabled=!0),A(l,u),A(l,p),A(l,m),l}const he=()=>{const e=M("span");return h.ne.Ke||(h.ne.Ke=e),e},me=(e,t)=>{const o=h.o,n=h.ne,{hide:s,showPreferences:a,acceptCategory:f}=e,m=o.u&&o.u.consentModal;if(!m)return;const g=m.acceptAllBtn,b=m.acceptNecessaryBtn,y=m.showPreferencesBtn,w=m.closeIconLabel,v=m.footer,C=m.label,k=m.title,L=e=>{s(),f(e)};if(!n.Qe){n.Qe=M(c),n.he=M(c),n.We=M(c),n.Xe=M(c),n.Ye=M(c),D(n.Qe,"cm-wrapper"),D(n.he,"cm"),O(n.We,"body"),O(n.Xe,"texts"),O(n.Ye,"btns"),_(n.he,"role","dialog"),_(n.he,"aria-modal","true"),_(n.he,i,"false"),_(n.he,"aria-describedby","cm__desc"),C?_(n.he,"aria-label",C):k&&_(n.he,"aria-labelledby","cm__title");const e="box",t=o.i.guiOptions,s=t&&t.consentModal,a=(s&&s.layout||e).split(" ")[0]===e;k&&w&&a&&(n.Le||(n.Le=M(r),n.Le.innerHTML=$(),O(n.Le,"btn"),O(n.Le,"btn--close"),P(n.Le,d,()=>{L([])}),A(n.We,n.Le)),_(n.Le,"aria-label",w)),A(n.We,n.Xe),(g||b||y)&&A(n.We,n.Ye),n.be=M(c),_(n.be,"tabIndex",-1),A(n.he,n.be),A(n.he,n.We),A(n.Qe,n.he)}k&&(n.Ze||(n.Ze=M("h2"),n.Ze.className=n.Ze.id="cm__title",A(n.Xe,n.Ze)),n.Ze.innerHTML=k);let T=m.description;if(T&&(o.V&&(T=T.replace("{{revisionMessage}}",o.I?"":m.revisionMessage||"")),n.et||(n.et=M("p"),n.et.className=n.et.id="cm__desc",A(n.Xe,n.et)),n.et.innerHTML=T),g&&(n.tt||(n.tt=M(r),A(n.tt,he()),O(n.tt,"btn"),_(n.tt,u,"all"),P(n.tt,d,()=>{L("all")})),n.tt.firstElementChild.innerHTML=g),b&&(n.Ie||(n.Ie=M(r),A(n.Ie,he()),O(n.Ie,"btn"),_(n.Ie,u,"necessary"),P(n.Ie,d,()=>{L([])})),n.Ie.firstElementChild.innerHTML=b),y&&(n.ot||(n.ot=M(r),A(n.ot,he()),O(n.ot,"btn"),O(n.ot,"btn--secondary"),_(n.ot,u,"show"),P(n.ot,"mouseenter",()=>{o.N||pe(e,t)}),P(n.ot,d,a)),n.ot.firstElementChild.innerHTML=y),n.nt||(n.nt=M(c),O(n.nt,l),g&&A(n.nt,n.tt),b&&A(n.nt,n.Ie),(g||b)&&A(n.We,n.nt),A(n.Ye,n.nt)),n.ot&&!n.st&&(n.st=M(c),n.Ie&&n.tt?(O(n.st,l),A(n.st,n.ot),A(n.Ye,n.st)):(A(n.nt,n.ot),O(n.nt,l+"--uneven"))),v){if(!n.ct){let e=M(c),t=M(c);n.ct=M(c),O(e,"footer"),O(t,"links"),O(n.ct,"link-group"),A(t,n.ct),A(e,t),A(n.he,e)}n.ct.innerHTML=v}de(0),o.T||(o.T=!0,U(h.re.ue,p,n.he),t(e),A(n.Ce,n.Qe),X(n.he),setTimeout(()=>D(n.Qe,"cc--anim"),100)),z(1),F(n.We,e,pe,t)},ge=e=>{if(!y(e))return null;if(e in h.o._)return e;let t=e.slice(0,2);return t in h.o._?t:null},be=()=>h.o.l||h.o.i.language.default,ye=e=>{e&&(h.o.l=e)},we=()=>{const e=h.ne;if(e.Ce)return;e.Ce=M(c),e.Ce.id="cc-main",e.Ce.setAttribute("data-nosnippet",""),(()=>{let e=h.o.i.language.rtl,t=h.ne.Ce;e&&t&&(b(e)||(e=[e]),g(e,h.o.l)?D(t,"cc--rtl"):B(t,"cc--rtl"))})();let t=h.o.i.root;t&&y(t)&&(t=document.querySelector(t)),(t||e.Ue.body).appendChild(e.Ce)},ve=(e,t)=>{if(t instanceof RegExp)return e.filter(e=>t.test(e));{const o=m(e,t);return o>-1?[e[o]]:[]}},Ce=e=>{const{hostname:t,protocol:o}=location,{name:n,path:s,domain:a,sameSite:c,useLocalStorage:r,secure:i}=h.t.cookie,l=864e5*(()=>{const e=h.t.cookie.expiresAfterDays;return v(e)?e(h.o.F):e})(),d=new Date;d.setTime(d.getTime()+l),h.o.p.expirationTime=d.getTime();const u=JSON.stringify(h.o.p);let p=n+"="+encodeURIComponent(u)+(0!==l?"; expires="+d.toUTCString():"")+"; Path="+s+"; SameSite="+c;var f,m;g(t,".")&&(p+="; Domain="+a),i&&"https:"===o&&(p+="; Secure"),r?(f=n,m=u,V(()=>localStorage.setItem(f,m))):document.cookie=p,h.o.p},ke=(e,t,o)=>{if(0===e.length)return;const n=o||h.t.cookie.domain,s=t||h.t.cookie.path,a="www."===n.slice(0,4),c=a&&n.substring(4),r=(e,t)=>{t&&"."!==t.slice(0,1)&&(t="."+t),document.cookie=e+"=; path="+s+(t?"; domain="+t:"")+"; expires=Thu, 01 Jan 1970 00:00:01 GMT;"};for(const i of e)r(i,o),o||r(i,n),a&&r(i,c)},Le=(e,t)=>{const o=document.cookie.match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)");return o?o.pop():""},Te=e=>{const t=h.o.D?[]:h.o.R;return g(t,e)},Se=(e,t)=>{const o=h.o.D?[]:h.o.Y[t]||[];return g(o,e)},Me=e=>{const{ne:t,o:n}=h;if(!n.k){if(!n.T){if(!e)return;me(xe,we)}n.k=!0,n.J=L(),n.v&&G(!0),Z(t.he,1),D(t.ye,o),_(t.he,i,"false"),setTimeout(()=>{Y(h.ne.be)},100),U(h.re.fe,p)}},_e=()=>{const e=h.o;e.A||(e.N||pe(xe,we),e.A=!0,e.k?e.U=L():e.J=L(),Z(h.ne.we,2),D(h.ne.ye,n),_(h.ne.we,i,"false"),setTimeout(()=>{Y(h.ne.ve)},100),U(h.re.fe,f))};var xe={show:Me,hide:()=>{const{ne:e,o:t,re:n}=h;t.k&&(t.k=!1,t.v&&G(),Y(e.Ke,!0),B(e.ye,o),_(e.he,i,"true"),Y(t.J),t.J=null,U(n._e,p))},showPreferences:_e,hidePreferences:()=>{const e=h.o;e.A&&(e.A=!1,(()=>{const e=He(),t=h.o.P,o=h.ne.ae,n=h.ne.se,s=e=>g(h.o.$,e);for(const a in o){const c=!!t[a].readOnly;o[a].checked=c||(e?Te(a):s(a));for(const t in n[a])n[a][t].checked=c||(e?Se(t,a):s(a))}})(),Y(h.ne.$e,!0),B(h.ne.ye,n),_(h.ne.we,i,"true"),e.k?(Y(e.U),e.U=null):(Y(e.J),e.J=null),U(h.re._e,f))},acceptCategory:(o,n=[])=>{((e,t)=>{const{O:o,R:n,B:s,N:a,Z:c,$:r,X:i}=h.o;let l=[];if(e){b(e)?l.push(...e):y(e)&&(l="all"===e?o:[e]);for(const e of o)c[e]=g(l,e)?C(i[e]):[]}else l=[...n,...r],a&&(l=(()=>{const e=h.ne.ae;if(!e)return[];let t=[];for(let o in e)e[o].checked&&t.push(o);return t})());l=l.filter(e=>!g(o,e)||!g(t,e)),l.push(...s),E(l)})(o,n),(()=>{const e=h.o,{Z:t,B:o,Y:n,X:s,O:a}=e,c=a;e.te=R(n);for(const r of c){const a=s[r],c=C(a),i=t[r]&&t[r].length>0,l=g(o,r);if(0!==c.length){if(n[r]=[],l)n[r].push(...c);else if(i){const e=t[r];n[r].push(...e)}else n[r]=e.Z[r];n[r]=k(n[r])}}})(),(()=>{const o=h.o;o.L=h.t.mode===t&&o.D?j(o.$,o.R):j(o.R,o.p.categories);let n=o.L.length>0,s=!1;for(const e of o.O)o.ee[e]=j(o.Y[e],o.te[e]),o.ee[e].length>0&&(s=!0);const a=h.ne.ae;for(const e in a)a[e].checked=g(o.R,e);for(const e of o.O){const t=h.ne.se[e],n=o.Y[e];for(const e in t)t[e].checked=g(n,e)}o.C||(o.C=new Date),o.M||(o.M="10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),o.p={categories:R(o.R),revision:h.t.revision,data:o.h,consentTimestamp:o.C.toISOString(),consentId:o.M,services:R(o.Y),languageCode:h.o.l},o.S&&(o.p.lastConsentTimestamp=o.S.toISOString());let c=!1;const r=n||s;(o.D||r)&&(o.D&&(o.D=!1,c=!0),o.S=o.S?new Date:o.C,o.p.lastConsentTimestamp=o.S.toISOString(),Ce(),h.t.autoClearCookies&&(c||r)&&(e=>{const t=h.o,o=(()=>{const e=document.cookie.split(/;\s*/),t=[];for(const o of e){let e=o.split("=")[0];t.push(e)}return t})(),n=(e=>{const t=h.o;return(e?t.O:t.L).filter(e=>{const o=t.P[e];return!!o&&!o.readOnly&&!!o.autoClear})})(e);for(const s in t.ee)for(const e of t.ee[s]){const n=t.X[s][e].cookies;if(!g(t.Y[s],e)&&n)for(const e of n){const t=ve(o,e.name);ke(t,e.path,e.domain)}}for(const s of n){const n=t.P[s].autoClear,a=n&&n.cookies||[],c=g(t.L,s),r=!g(t.R,s),i=c&&r;if(e?r:i){n.reloadPage&&i&&(t.j=!0);for(const e of a){const t=ve(o,e.name);ke(t,e.path,e.domain)}}}})(c),K()),c&&(U(h.re.ie),U(h.re.le),h.t.mode===e)||(r&&U(h.re.de),o.j&&(o.j=!1,location.reload()))})()}};const He=()=>!h.o.D;(async e=>{const{o:o,t:n,re:s}=h,c=window;if(!c._ccRun){if(c._ccRun=!0,(e=>{const{ne:o,t:n,o:s}=h,c=n,r=s,{cookie:i}=c,l=h.ce,d=e.cookie,u=e.categories,p=C(u)||[],f=navigator,m=document;o.Ue=m,o.ye=m.documentElement,i.domain=location.hostname,r.i=e,r.P=u,r.O=p,r._=e.language.translations,r.v=!!e.disablePageInteraction,l.ie=e.onFirstConsent,l.le=e.onConsent,l.de=e.onChange,l._e=e.onModalHide,l.fe=e.onModalShow,l.ue=e.onModalReady;const{mode:b,autoShow:y,lazyHtmlGeneration:v,autoClearCookies:k,revision:L,manageScriptTags:T,hideFromBots:M}=e;b===t&&(c.mode=b),"boolean"==typeof k&&(c.autoClearCookies=k),"boolean"==typeof T&&(c.manageScriptTags=T),"number"==typeof L&&L>=0&&(c.revision=L,r.V=!0),"boolean"==typeof y&&(c.autoShow=y),"boolean"==typeof v&&(c.lazyHtmlGeneration=v),!1===M&&(c.hideFromBots=!1),!0===c.hideFromBots&&f&&(r.G=f.userAgent&&/bot|crawl|spider|slurp|teoma/i.test(f.userAgent)||f.webdriver),w(d)&&(c.cookie={...i,...d}),c.autoClearCookies,r.V,c.manageScriptTags,(e=>{const{P:t,X:o,Y:n,Z:s,B:a}=h.o;for(let c of e){const e=t[c],r=e.services||{},i=w(r)&&C(r)||[];o[c]={},n[c]=[],s[c]=[],e.readOnly&&(a.push(c),n[c]=i),h.ne.se[c]={};for(let t of i){const e=r[t];e.Se=!1,o[c][t]=e}}})(p),(()=>{if(!h.t.manageScriptTags)return;const e=h.o,t=S(document,"script["+a+"]");for(const o of t){let t=H(o,a),n=o.dataset.service||"",s=!1;if(t&&"!"===t.charAt(0)&&(t=t.slice(1),s=!0),"!"===n.charAt(0)&&(n=n.slice(1),s=!0),g(e.O,t)&&(e.oe.push({Me:o,xe:!1,ke:s,De:t,Te:n}),n)){const o=e.X[t];o[n]||(o[n]={Se:!1})}}})(),ye((()=>{const e=h.o.i.language.autoDetect;if(e){const t={browser:navigator.language,document:document.documentElement.lang},o=ge(t[e]);if(o)return o}return be()})())})(e),o.G)return;(()=>{const e=h.o,o=h.t,n=(()=>{const e=h.t.cookie.name,t=h.t.cookie.useLocalStorage;return((e,t)=>{let o;return o=V(()=>JSON.parse(t?e:decodeURIComponent(e)),!0)||{},o})(t?(o=e,V(()=>localStorage.getItem(o))||""):Le(e),t);var o})(),{categories:s,services:a,consentId:c,consentTimestamp:r,lastConsentTimestamp:i,data:l,revision:d}=n,u=b(s);e.p=n,e.M=c;const p=!!c&&y(c);e.C=r,e.C&&(e.C=new Date(r)),e.S=i,e.S&&(e.S=new Date(i)),e.h=void 0!==l?l:null,e.V&&p&&d!==o.revision&&(e.I=!1),e.D=!(p&&e.I&&e.C&&e.S&&u),o.cookie.useLocalStorage&&!e.D&&(e.D=(new Date).getTime()>(n.expirationTime||0),e.D&&(e=>{V(()=>localStorage.removeItem(e))})(o.cookie.name)),e.D,(()=>{const e=h.o;for(const o of e.O){const n=e.P[o];if(n.readOnly||n.enabled){e.$.push(o);const n=e.X[o]||{};for(let s in n)e.Z[o].push(s),e.i.mode===t&&e.Y[o].push(s)}}})(),e.D?o.mode===t&&(e.R=[...e.$]):(e.Y={...e.Y,...a},e.Z={...e.Y},E([...e.B,...s]))})();const i=He();if(!(await(async e=>{const t=h.o;let o=ge(e)?e:be(),n=t._[o];if(y(n)?n=await(async e=>{try{const t=await fetch(e);return await t.json()}catch(t){return console.error(t),!1}})(n):v(n)&&(n=await n()),!n)throw`Could not load translation for the '${o}' language`;return t.u=n,ye(o),!0})()))return!1;if(F(null,r=xe,pe,we),h.o.D&&me(r,we),h.t.lazyHtmlGeneration||pe(r,we),n.autoShow&&!i&&Me(!0),i)return K(),U(s.le);n.mode===t&&K(o.$)}var r})({autoShow:!0,mode:"opt-in",cookie:{name:"pmf_cc_cookie",domain:location.hostname,sameSite:"Strict",expiresAfterDays:182},guiOptions:{consentModal:{layout:"box inline",position:"top center",equalWeightButtons:!0,flipButtons:!1},preferencesModal:{layout:"box",equalWeightButtons:!0,flipButtons:!1}},onFirstConsent:({})=>{},onConsent:({})=>{},onChange:({})=>{},onModalReady:({})=>{},onModalShow:({})=>{},onModalHide:({})=>{},categories:{necessary:{enabled:!0,readOnly:!0}},language:{default:"en",autoDetect:"document",translations:{de:"./translations/cookie-consent/de.json",en:"./translations/cookie-consent/en.json",pl:"./translations/cookie-consent/pl.json"}}});const Ae=document.getElementById("showCookieConsent");Ae&&Ae.addEventListener("click",e=>{e.preventDefault(),_e()}); | |||
Check failure
Code scanning / CodeQL
Incomplete multi-character sanitization High
<script
Copilot Autofix
AI 2 days ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
thorsten
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is crap. Don't remove husky code, don't add compiled JS/CSS into the repo.
Co-authored-by: thorsten <45284+thorsten@users.noreply.github.com>
Reverted in commit 04799ec. Removed all built assets, restored husky hooks and .gitignore. The PR now only contains the template fix (removing update.js from base.twig). The original issue of missing built assets in nightly builds should be addressed in the release/packaging process, not by committing them to the repository. |
Fixes a template architecture issue where the setup wizard incorrectly loaded the update script alongside the setup script.
Changes
Fix template script loading
update.jsfromsetup/base.twig(only needed inupdate.twig)setup.js<footer class="setup-footer container mt-1"> <p class="text-end"> © 2001-{{ currentYear }} <a target="_blank" href="https://www.phpmyfaq.de/">phpMyFAQ Team</a> </p> </footer> -<script type="module" src="../assets/public/update.js"></script> </body> </html>Files Changed
phpmyfaq/assets/templates/setup/base.twig- Remove update.js script tagNote
The
base.twigtemplate is used byindex.twig(setup wizard) andinstall.twig(installation results). Theupdate.twighas its own separate template structure and includesupdate.jsindependently. This fix ensures proper template architecture and reduces unnecessary script loading during setup.Users installing from source need to run
pnpm buildto generate assets inphpmyfaq/assets/public/before installation, as documented in the repository setup instructions. Official release packages from phpmyfaq.de include pre-built assets.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.