TYPO3 v15 dev-main snapshot ()

This commit is contained in:
wappler committed 2026-08-10 22:31:00 +02:00
commit f9941541b7
1178 files changed
+135377

No files matched your search

@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as b,state as h,customElement as $}from"lit/decorators.js";import{LitElement as v,html as s,nothing as d}from"lit";import{classMap as R}from"lit/directives/class-map.js";import p from"@typo3/core/ajax/ajax-request.js";import y from"@typo3/core/event/regular-event.js";import i from"~labels/backend.modules.content_security_policy";import"bootstrap";var a=function(r,e,t,l){var o=arguments.length,c=o<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,t):l,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(r,e,t,l);else for(var m=r.length-1;m>=0;m--)(u=r[m])&&(c=(o<3?u(c):o>3?u(e,t,c):u(e,t))||c);return o>3&&c&&Object.defineProperty(e,t,c),c},f;(function(r){r.fixable="fixable",r.irrelevant="irrelevant",r.suspicious="suspicious"})(f||(f={}));let n=class extends v{constructor(){super(...arguments),this.selectedScope=null,this.reports=[],this.selectedReport=null,this.suggestions=[],this.previouslyFocusedRow=null}connectedCallback(){super.connectedCallback(),this.fetchReports(),this.peripheralEvent=new y("click",(e,t)=>{t.dataset.cspReportsHandler==="refresh"&&(e.preventDefault(),this.fetchReports())}),this.peripheralEvent.delegateTo(document,"[data-csp-reports-handler]")}disconnectedCallback(){super.disconnectedCallback(),this.peripheralEvent?.release()}updated(e){super.updated(e),e.has("selectedReport")&&this.selectedReport!==null&&this.updateComplete.then(()=>{this.querySelector("#report-details")?.focus()})}createRenderRoot(){return this}render(){return s`<div class=infolist-container><div class=infolist><div class=infolist-header>${this.renderNavigation()}</div><div class=infolist-content><div class="table-fit mb-0"><table class="table table-striped"><thead><tr><th>${i.get("module.label.created")}</th><th>${i.get("module.label.scope")}</th><th>${i.get("module.label.violation")}</th><th>${i.get("module.label.uri")}</th><th></th></tr></thead><tbody>${this.reports.length===0?s`<tr><td colspan=5>${i.get("module.label.noEntriesAvailable")}</td></tr>`:d} ${this.reports.map(e=>s`<tr class=${R({"table-info":this.selectedReport===e})} data-mutation-group=${e.mutationHashes.join("-")} @click=${()=>this.selectReport(e)} @keydown=${t=>this.handleReportKeydown(t,e)} tabindex=0 role=button aria-label=${i.get("module.label.showDetails",[e.details.effectiveDirective,e.details.blockedUri])}><td>${e.created}</td><td>${e.scope}</td><td><span class="badge badge-warning">${e.count}</span> ${e.details.effectiveDirective}</td><td>${this.shortenUri(e.details.blockedUri)}</td><td>${e.attributes.join(", ")}</td></tr>`)}</tbody></table></div></div><div class=infolist-info${this.selectedReport?" infolist-info-showrecord":""}>${this.renderGuide()} ${this.renderSelectedReport()}</div></div></div>`}renderNavigation(){return s`<div class=btn-toolbar><button type=button class="btn btn-default dropdown-toggle" data-bs-toggle=dropdown aria-expanded=false title=${i.get("module.label.scope")}>${this.selectedScope===null?i.get("module.label.all"):this.selectedScope}</button><ul class=dropdown-menu><button class="dropdown-item dropdown-item-spaced" title=${i.get("module.label.all")} @click=${()=>this.selectScope(null)}><span class=${this.selectedScope===null?"text-primary":""}> <typo3-backend-icon identifier=${this.selectedScope===null?"actions-dot":"empty-empty"} size=small></typo3-backend-icon> </span>${i.get("module.label.all")}</button> ${this.scopes.map(e=>s`<li><button class="dropdown-item dropdown-item-spaced" title=${e} @click=${()=>this.selectScope(e)}><span class=${e===this.selectedScope?"text-primary":""}> <typo3-backend-icon identifier=${e===this.selectedScope?"actions-dot":"empty-empty"} size=small></typo3-backend-icon> </span>${e}</button></li>`)}</ul><button type=button class="btn btn-danger" title=${i.get("module.label.removeAll")} @click=${()=>this.invokeDeleteReportsAction()}>${i.get("module.label.removeAll")} ${this.selectedScope!==null?s`"${this.selectedScope}"`:d}</button></div>`}renderGuide(){return s`${this.selectedReport?d:s`<div class=infolist-info-norecord><div class="card mb-0"><div class=card-body><p>${i.get("module.label.guide.no_record_selected")}</p></div></div></div>`}`}renderSelectedReport(){const e=this.selectedReport;return s`${e?s`<div class=infolist-info-record><div class="card mb-0" tabindex=-1 id=report-details @keydown=${t=>this.handleDetailsKeydown(t)}><div class=card-header><h3>${i.get("module.label.details")}</h3></div><div class=card-body><dl><dt>${i.get("module.label.directive")} / ${i.get("module.label.disposition")}</dt><dd>${e.details.effectiveDirective} / ${e.details.disposition}</dd><dt>${i.get("module.label.document_uri")}</dt><dd>${e.details.documentUri} ${this.renderCodeLocation(e)}</dd>${e.details.sourceFile&&e.details.sourceFile!==e.details.documentUri?s`<dt>${i.get("module.label.source_file")}</dt><dd>${e.details.sourceFile}</dd>`:d}<dt>${i.get("module.label.blocked_uri")}</dt><dd>${e.details.blockedUri}</dd>${e.details.scriptSample?s`<dt>${i.geLine truncated
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{property as n,customElement as m,state as w,query as b}from"lit/decorators.js";import{LitElement as P,nothing as u,html as d}from"lit";import I from"@typo3/core/ajax/ajax-request.js";import{AjaxResponse as g}from"@typo3/core/ajax/ajax-response.js";import E from"@typo3/backend/viewport.js";import{topLevelModuleImport as T}from"@typo3/backend/utility/top-level-module-import.js";import M,{Sizes as $}from"@typo3/backend/modal.js";import{SeverityEnum as y}from"@typo3/backend/enum/severity.js";var r=function(i,e,s,o){var a=arguments.length,t=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,s):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(i,e,s,o);else for(var h=i.length-1;h>=0;h--)(c=i[h])&&(t=(a<3?c(t):a>3?c(e,s,t):c(e,s))||t);return a>3&&t&&Object.defineProperty(e,s,t),t};class l extends P{}r([n({type:String})],l.prototype,"verifyActionUri",void 0),r([n({type:String})],l.prototype,"cancelUri",void 0),r([n({type:Boolean})],l.prototype,"isAjax",void 0),r([n({type:Boolean,attribute:"has-fatal-error"})],l.prototype,"hasFatalError",void 0),r([n({type:Boolean,attribute:"allow-install-tool-password"})],l.prototype,"allowInstallToolPassword",void 0),r([n({type:Object})],l.prototype,"labels",void 0);const v=async i=>{window.location!==window.parent.location&&T("@typo3/backend/security/element/sudo-mode.js");const s=top.document.createElement("typo3-backend-security-sudo-mode");return Object.assign(s,i),s.windowRef=window,top.document.body.append(s),new Promise((o,a)=>{s.addEventListener("typo3:sudo-mode:verified",()=>o()),s.addEventListener("typo3:sudo-mode:finished",()=>a())})};let f=class extends l{render(){return u}async firstUpdated(){if(window.location!==window.parent.location){try{await v(this.getPropertyValues())}catch{history.go(-1)}return}M.advanced({title:this.hasFatalError?this.labels.verificationFailed:this.labels.verifyWithUserPassword,severity:this.hasFatalError?y.error:y.notice,size:$.small,additionalCssClasses:["modal-sudo-mode-verification"],buttons:[this.hasFatalError?{text:this.labels.cancel,btnClass:"btn-default",trigger:()=>{top.location.href=this.cancelUri}}:{text:this.labels.verify,name:"verify",form:"verify-sudo-mode",btnClass:"btn-primary"}],content:d`<typo3-backend-security-sudo-mode-form .labels=${this.labels} .verifyActionUri=${this.verifyActionUri} .cancelUri=${this.cancelUri} .isAjax=${this.isAjax} .hasFatalError=${this.hasFatalError} .allowInstallToolPassword=${this.allowInstallToolPassword} .windowRef=${this.windowRef} @typo3:sudo-mode:verified=${()=>this.dispatchEvent(new Event("typo3:sudo-mode:verified"))}></typo3-backend-security-sudo-mode-form>`}).addEventListener("typo3-modal-hidden",()=>{this.dispatchEvent(new Event("typo3:sudo-mode:finished")),this.remove()})}getPropertyValues(){const e={},s=this.constructor;for(const o of s.elementProperties.keys())e[o]=this[o];return e}};f=r([m("typo3-backend-security-sudo-mode")],f);let p=class extends l{constructor(){super(...arguments),this.useInstallToolPassword=!1,this.errorMessage=null}createRenderRoot(){return this}render(){return this.hasFatalError?d`<div><div class="alert alert-danger">${this.labels.verificationExpired}</div></div>`:d`<div>${this.errorMessage?d`<div class="alert alert-danger" id=invalid-password>${this.labels[this.errorMessage]||this.errorMessage}</div>`:u}<p>${this.useInstallToolPassword?this.labels.sudoModeInstallToolPasswordExplanation:this.labels.sudoModeUserPasswordExplanation}</p><form method=post class=form id=verify-sudo-mode spellcheck=false @submit=${e=>this.verifyPassword(e)}>${this.useInstallToolPassword?u:d`<input hidden aria-hidden=true type=text autocomplete=username value=${TYPO3.configuration.username}>`}<div class=form-group><label class=form-label for=password>${this.labels.password}</label> <input required class=form-control id=password type=password name=password autofocus autocomplete=${this.useInstallToolPassword?"section-install current-password":"current-password"}></div></form>${this.allowInstallToolPassword?d`<div class=text-end><a href=# @click=${e=>this.toggleUseInstallToolPassword(e)}> ${this.useInstallToolPassword?this.labels.userPasswordMode:this.labels.installToolPasswordMode} </a></div>`:u}</div>`}updated(e){e.has("useInstallToolPassword")&&(this.closest("typo3-backend-modal").modalTitle=this.getModalTitle())}getModalTitle(){return this.hasFatalError?this.labels.verificationFailed:this.useInstallToolPassword?this.labels.verifyWithInstallToolPassword:this.labels.verifyWithUserPassword}async verifyPassword(e){e.preventDefault(),this.errorMessage=null;try{const o=await(await new I(this.verifyActionUri).post({password:this.passwordElement.value,useInstallToolPassword:this.useInstallToolPassword?1:0})).resolve("application/json");if(this.dispatchEvent(new Event("typo3:sudo-mode:verified")),this.closest("typo3-backend-modal").hideModal(),!this.isAjax&&o.redirect){const{uri:a}=o.redirect,t=this.windowRef??window;t.name==="list_frame"?E.ContentLine truncated