first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1 @@
(globalThis.webpackChunkreally_simple_ssl_modal=globalThis.webpackChunkreally_simple_ssl_modal||[]).push([[204],{204:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>p});var r=l(196),n=l(609),s=l(307),a=l(736),o=l(317),m=l.n(o);class c extends r.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null},this.resetError=this.resetError.bind(this)}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t}),console.log("ErrorBoundary",e,t)}resetError(){this.setState({hasError:!1,error:null,errorInfo:null})}render(){return this.state.hasError?(0,r.createElement)("div",null,(0,r.createElement)("h1",null,"Something went wrong."),(0,r.createElement)("p",null,this.props.fallback),(0,r.createElement)("button",{onClick:this.resetError},"Try Again")):this.props.children}}c.propTypes={children:m().node,fallback:m().node};const i=c,p=({title:e,subTitle:t,buttons:o,content:m,list:c,confirmAction:p,confirmText:u,alternativeAction:d,alternativeText:E,alternativeClassName:h,isOpen:f,setOpen:g,className:y})=>{const[w,b]=(0,s.useState)(null);let _="undefined"!=typeof rsssl_modal?rsssl_modal.plugin_url:rsssl_settings.plugin_url;h=h||"rsssl-warning",(0,s.useEffect)((()=>{w||Promise.all([l.e(357),l.e(658)]).then(l.bind(l,658)).then((({default:e})=>{b((()=>e))}))}),[]);let C=y?" "+y:"";return wp.element.createElement(r.Fragment,null,f&&wp.element.createElement(r.Fragment,null,wp.element.createElement(i,{fallback:"Error loading modal"},wp.element.createElement(n.Modal,{className:"rsssl-modal"+C,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,title:e,onRequestClose:()=>g(!1),open:f},wp.element.createElement("div",{className:"rsssl-modal-body"},t&&wp.element.createElement("p",null,t),m&&wp.element.createElement(r.Fragment,null,m),c&&w&&wp.element.createElement("ul",null,c.map(((e,t)=>wp.element.createElement("li",{key:t},wp.element.createElement(w,{name:e.icon,color:e.color}),e.text))))),wp.element.createElement("div",{className:"rsssl-modal-footer"},wp.element.createElement("div",{className:"rsssl-modal-footer-image"},wp.element.createElement("img",{className:"rsssl-logo",src:_+"assets/img/really-simple-ssl-logo.svg",alt:"Really Simple SSL"})),wp.element.createElement("div",{className:"rsssl-modal-footer-buttons"},wp.element.createElement(n.Button,{onClick:()=>g(!1)},(0,a.__)("Cancel","really-simple-ssl")),o&&wp.element.createElement(r.Fragment,null,o),!o&&wp.element.createElement(r.Fragment,null,E&&wp.element.createElement(n.Button,{className:h,onClick:()=>d()},E),u&&wp.element.createElement(n.Button,{isPrimary:!0,onClick:()=>p()},u))))))))}},545:(e,t,l)=>{"use strict";var r=l(825);function n(){}function s(){}s.resetWarningCache=n,e.exports=function(){function e(e,t,l,n,s,a){if(a!==r){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var l={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:n};return l.PropTypes=l,l}},317:(e,t,l)=>{e.exports=l(545)()},825:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}}]);

View File

@@ -0,0 +1 @@
:root{--rsp-spacing-xxs:5px;--rsp-spacing-xs:10px;--rsp-spacing-s:15px;--rsp-spacing-m:20px;--rsp-spacing-l:25px;--rsp-spacing-xl:30px;--rsp-grid-margin:var(--rsp-spacing-s);--rsp-grid-gap:var(--rsp-spacing-m);--rsp-border-radius:12px;--rsp-border-radius-s:8px;--rsp-border-radius-xs:3px;--rsp-border:1px solid var(--rsp-border-color);--rsp-box-shadow:rgba(0,0,0,.1) 0px 4px 6px -1px,rgba(0,0,0,.06) 0px 2px 4px -1px;--rsp-box-shadow-dark:rgba(0,0,0,.2) 0px 4px 6px -1px,rgba(0,0,0,.12) 1px 0px 4px 1px;--rsp-border-color:#dfdfdf;--rsp-black:#333;--rsp-white:#fff;--rsp-yellow:#fbc43e;--rsp-blue:#009fff;--rsp-dark-yellow:#e6a800;--rsp-dark-blue:#1e73be;--rsp-green:#2e8a37;--rsp-red:#d7263d;--rsp-dark-red:#9b0212;--rsp-pink:#e35899;--rsp-wp-blue:#007cba;--rsp-yellow-faded:#fdf4df;--rsp-blue-faded:#ecf8fe;--rsp-dark-blue-faded:#ebf2f9;--rsp-green-faded:#ecf4ed;--rsp-red-faded:#fbebed;--rsp-pink-faded:#fceff5;--rsp-wp-blue-faded:#c6e0ef;--rsp-background-block-color:var(--rsp-white);--rsp-background-color:#f0f0f1;--rsp-input-background-color:#fff;--rsp-input-text-color:var(--rsp-text-color);--rsp-input-border-color:var(--rsp-grey-400);--rsp-text-color:rgba(26,26,26,.9);--rsp-text-color-invert:hsla(0,0%,100%,.9);--rsp-text-color-white:hsla(0,0%,100%,.9);--rsp-text-color-light:rgba(69,69,82,.9);--rsp-text-color-hover:var(--rsp-green);--rsp-grey-100:#fafafa;--rsp-grey-200:#f7f7f7;--rsp-grey-300:#ededed;--rsp-grey-400:#c6c6c6;--rsp-grey-500:#737373;--rsp-grey-600:#696969;--rsp-color-success:var(--rsp-green);--rsp-color-error:var(--rsp-red);--rsp-color-warning:var(--rsp-yellow);--rsp-color-open:var(--rsp-yellow);--rsp-color-disabled:var(--rsp-grey-300);--rsp-fs-100:0.6875rem;--rsp-fs-200:0.75rem;--rsp-fs-300:0.8125rem;--rsp-fs-400:0.875rem;--rsp-fs-500:1rem;--rsp-fs-600:1.125rem;--rsp-fs-700:1.25rem;--rsp-fs-800:1.5rem;--rsp-fs-850:2.8rem;--rsp-fs-900:3.5rem}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.rsssl-modal{border-radius:var(--rsp-border-radius) var(--rsp-border-radius);border-top:1px solid var(--rsp-grey-300);box-shadow:var(--rsp-box-shadow);margin:auto;max-height:calc(100% - 120px);padding:var(--rsp-spacing-m) var(--rsp-spacing-l);width:700px}@media(max-width:768px){.rsssl-modal{width:100%}}.rsssl-modal .components-modal__content{margin-top:45px;min-height:250px;padding:0}.rsssl-modal .components-modal__content>div:nth-child(2){display:flex;flex-direction:column;height:100%}.rsssl-modal .rsssl-modal-body{flex-grow:1;padding:12px 8px 80px}@media(max-width:768px){.rsssl-modal .rsssl-modal-body{padding:12px 8px 180px}}.rsssl-modal .rsssl-modal-body p{margin-top:0}.rsssl-modal .rsssl-modal-body ul{-moz-column-count:2;column-count:2;-moz-column-gap:20px;column-gap:20px;margin-bottom:0}.rsssl-modal .rsssl-modal-body ul li{display:flex;padding-bottom:5px}.rsssl-modal .rsssl-modal-body ul li .rsssl-icon{margin-right:10px;margin-top:2px}.rsssl-modal .rsssl-modal-footer{align-items:center;background-color:var(--rsp-grey-200);border-top:1px solid var(--rsp-grey-400);bottom:0;display:flex;justify-content:space-between;left:0;padding:20px 32px;position:absolute;right:0}.rsssl-modal .rsssl-modal-footer img{width:150px}@media(max-width:768px){.rsssl-modal .rsssl-modal-footer .rsssl-modal-footer-image{display:none}.rsssl-modal .rsssl-modal-footer .rsssl-modal-footer-buttons{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%}.rsssl-modal .rsssl-modal-footer .rsssl-modal-footer-buttons button{margin:0;width:100%}}.rsssl-modal .rsssl-modal-footer button+button{margin-left:10px}.rsssl-modal .rsssl-modal-footer button:not(.is-primary){background-color:transparent;border:1px solid var(--wp-admin-theme-color,#3858e9);color:var(--wp-admin-theme-color,#3858e9)}.rsssl-modal .rsssl-modal-footer button.rsssl-modal-warning{background-color:transparent;border:1px solid var(--rsp-red);color:var(--rsp-red)}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '7baa22d2f235f90d6196');

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '855f8bc8ac202db563f6');

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,54 @@
<?php
if ( ! defined('ABSPATH')) {
exit;
}
if ( ! function_exists('rsssl_plugin_plugin_page_scripts')) {
function rsssl_plugin_plugin_page_scripts($hook)
{
if ( $hook !== 'plugins.php' ) {
return;
}
$js_data = rsssl_get_chunk_translations( 'modal/build' );
if (empty($js_data)) {
return;
}
wp_enqueue_style('wp-components');
$handle = 'rsssl-modal';
wp_enqueue_script(
$handle,
plugins_url('build/' . $js_data['js_file'], __FILE__),
$js_data['dependencies'],
$js_data['version'],
true
);
wp_set_script_translations($handle, 'really-simple-ssl');
$token = wp_create_nonce('rsssl_deactivate_plugin');
$deactivate_keep_ssl_link = add_query_arg( [ 'page' => 'really-simple-security', 'action' => 'uninstall_keep_ssl', 'token' => $token ], rsssl_admin_url() );
wp_localize_script(
$handle,
'rsssl_modal',
apply_filters('rsssl_localize_script', [
'json_translations' => $js_data['json_translations'],
'plugin_url' => rsssl_url,
'deactivate_keep_https' => $deactivate_keep_ssl_link,
'pro_plugin_active' => defined('rsssl_pro_version'),
])
);
function rsssl_add_modal_root_div()
{
// Check if we're on the plugins.php page
$screen = get_current_screen();
if ($screen && $screen->id === 'plugins') {
echo '<div id="rsssl-modal-root"></div>';
}
}
add_action('admin_footer', 'rsssl_add_modal_root_div');
}
}
add_action('admin_enqueue_scripts', 'rsssl_plugin_plugin_page_scripts');

View File

@@ -0,0 +1,142 @@
import { __ } from "@wordpress/i18n";
import {useEffect, useState} from "@wordpress/element";
const DeactivationModal = () => {
const [isOpen, setOpen] = useState(false);
const [RssslModal, setRssslModal] = useState(false);
const targetPluginLink = document.getElementById('deactivate-really-simple-ssl');
const isPremium = rsssl_modal.pro_plugin_active;
const handleClick = (event) => {
event.preventDefault();
setOpen(true);
};
const deactivateKeepHttps = () => {
targetPluginLink.removeEventListener('click', handleClick);
//click the targetPluginLink
setOpen(false);
window.location.href = rsssl_modal.deactivate_keep_https;
}
const deactivateAndRevert = () => {
setOpen(false);
window.location.href = targetPluginLink.getAttribute('href');
}
useEffect(() => {
// Attach the click event listener to each link element
targetPluginLink.addEventListener('click', handleClick);
// Clean up the event listeners when the component unmounts
return () => {
targetPluginLink.removeEventListener('click', handleClick);
};
}, []);
useEffect(() => {
if ( isOpen ) {
targetPluginLink.removeEventListener('click', handleClick);
} else {
targetPluginLink.addEventListener('click', handleClick);
}
}, [isOpen]);
useEffect( () => {
if (!RssslModal) {
import ("../Modal/RssslModal").then(({default: RssslModal}) => {
setRssslModal(() => RssslModal);
});
}
}, [isOpen]);
const content = () => {
return (
<>
{__("Please choose the correct deactivation method, and before you go; you will miss out on below and future features in Really Simple Security", "really-simple-ssl")}
{isPremium && <> <b>Pro</b></>}
!
</>
);
}
const list = isPremium ? [
{
'icon':'circle-times',
'color':'red',
'text': __("Performant HTTPS redirection", "really-simple-ssl"),
},
{
'icon':'circle-times',
'color':'red',
'text': __("Vulnerability detection", "really-simple-ssl"),
},
{
'icon':'circle-times',
'color':'red',
'text': __("Security Headers", "really-simple-ssl"),
},
{
'icon':'circle-times',
'color':'red',
'text': __("Advanced hardening", "really-simple-ssl"),
},
{
'icon':'circle-times',
'color':'red',
'text': __("Mixed content scan", "really-simple-ssl"),
},
{
'icon':'circle-times',
'color':'red',
'text': __("Two-step verification", "really-simple-ssl"),
},
{
'icon':'circle-times',
'color':'red',
'text': __("Password security", "really-simple-ssl"),
},
{
'icon':'circle-times',
'color':'red',
'text': __("Limit login attempts", "really-simple-ssl"),
},
] :
[
{
'icon':'circle-times',
'color':'red',
'text': __("Performant HTTPS redirection", "really-simple-ssl"),
},
{
'icon':'circle-times',
'color':'red',
'text': __("Vulnerability detection", "really-simple-ssl"),
},
{
'icon':'circle-times',
'color':'red',
'text': __("WordPress hardening", "really-simple-ssl"),
},
{
'icon':'circle-times',
'color':'red',
'text': __("Mixed content fixer", "really-simple-ssl"),
},
];
return (
<>
{RssslModal && <RssslModal title={__("Are you sure?", "really-simple-ssl")}
confirmText = {__("Deactivate", "really-simple-ssl")}
confirmAction = {() => deactivateKeepHttps() }
alternativeText = {__("Deactivate and use HTTP", "really-simple-ssl") }
alternativeAction = { () => deactivateAndRevert() }
alternativeClassName = "rsssl-modal-warning"
content={content()}
list={list}
isOpen={isOpen}
setOpen={setOpen} />
}
</>
);
}
export default DeactivationModal;

View File

@@ -0,0 +1,66 @@
/** @jsx wp.element.createElement */
import { Modal, Button } from "@wordpress/components";
import {useEffect, useState} from "@wordpress/element";
import { __ } from "@wordpress/i18n";
import './RssslModal.scss';
import ErrorBoundary from "../../../../settings/src/utils/ErrorBoundary";
const RssslModal = ({title, subTitle, buttons, content, list, confirmAction, confirmText, alternativeAction, alternativeText, alternativeClassName, isOpen, setOpen, className}) => {
const [Icon, setIcon] = useState(null);
let pluginUrl = typeof rsssl_modal !== 'undefined' ? rsssl_modal.plugin_url : rsssl_settings.plugin_url;
alternativeClassName = alternativeClassName ? alternativeClassName : 'rsssl-warning';
useEffect( () => {
if (!Icon) {
import ("../../../../settings/src/utils/Icon").then(({default: Icon}) => {
setIcon(() => Icon);
});
}
}, []);
let modalCustomClass = className ? ' '+className : ""
return (
<>
{isOpen && (
<>
<ErrorBoundary fallback={"Error loading modal"}>
<Modal
className={"rsssl-modal"+modalCustomClass}
shouldCloseOnClickOutside={false}
shouldCloseOnEsc={false}
title={title}
onRequestClose={() => setOpen(false)}
open={isOpen}>
<div className="rsssl-modal-body">
{subTitle && <p>{subTitle}</p>}
{content && <>{content}</>}
{list && Icon && <ul>
{list.map((item, index) => <li key={index}><Icon name={item.icon} color={item.color}/>{item.text}</li>)}
</ul>}
</div>
<div className="rsssl-modal-footer">
<div className="rsssl-modal-footer-image">
<img className="rsssl-logo" src={pluginUrl+"assets/img/really-simple-ssl-logo.svg"} alt="Really Simple SSL" />
</div>
<div className="rsssl-modal-footer-buttons">
<Button onClick={() => setOpen(false)}>{__("Cancel", "really-simple-ssl")}</Button>
{ buttons && <>{buttons}</>}
{ !buttons && <>
{alternativeText && <Button className={alternativeClassName} onClick={() => alternativeAction()}>{alternativeText}</Button>}
{confirmText && <Button isPrimary onClick={()=> confirmAction() }>{confirmText}</Button>}
</>
}
</div>
</div>
</Modal>
</ErrorBoundary>
</>
)}
</>
);
}
export default RssslModal;

View File

@@ -0,0 +1,106 @@
@import '../../../../assets/css/variables.scss';
.rsssl-modal {
width: 700px;
//background:var(--rsp-grey-100);
padding:var(--rsp-spacing-m) var(--rsp-spacing-l);
box-shadow:var(--rsp-box-shadow);
border-radius:var(--rsp-border-radius) var(--rsp-border-radius);
border-top:1px solid var(--rsp-grey-300);
max-height: calc(100% - 120px); //the default wp modal limits this to minimum 600px, but this creates an ugly modal.
margin:auto;//the default wp modal limits this to minimum 600px, but this creates an ugly modal.
@media (max-width: 768px) {
width: 100%;
}
.components-modal__content {
min-height: 250px;
//reset default padding so we can add a footer with background
padding:0;
margin-top:45px;
& > div:nth-child(2) {
display: flex;
height: 100%;
flex-direction: column;
}
}
.rsssl-modal-body {
flex-grow: 1;
padding: 12px 8px 80px 8px; //80 is for the complete footer height + margin
@media (max-width: 768px) {
padding: 12px 8px 180px 8px;
}
p {
margin-top:0;
}
ul {
column-count: 2;
column-gap: 20px;
margin-bottom:0;
li {
display: flex;
padding-bottom: 5px;
.rsssl-icon {
margin-top: 2px;
margin-right: 10px;
}
}
}
}
.rsssl-modal-footer {
background-color: var(--rsp-grey-200);
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid var(--rsp-grey-400);
padding: 20px 32px;
//ensure the footer doesn't scroll out of sight on smaller screens.
bottom: 0;
position: absolute;
left: 0;
right: 0;
img {
width: 150px;
}
@media (max-width: 768px) {
.rsssl-modal-footer-image {
display:none;
}
.rsssl-modal-footer-buttons {
width:100%;
display:flex;
flex-direction: column;
gap: 10px;
align-items: center;
button {
width: 100%;
margin:0;
}
}
}
button + button {
margin-left: 10px;
}
button {
&:not(.is-primary) {
border: 1px solid var(--wp-admin-theme-color, #3858e9);
color: var(--wp-admin-theme-color, #3858e9);
background-color: transparent;
}
&.rsssl-modal-warning {
border: 1px solid var(--rsp-red);
color: var(--rsp-red);
background-color: transparent;
}
}
}
}

View File

@@ -0,0 +1,14 @@
import {
render, createRoot
} from '@wordpress/element';
import DeactivationModal from "./components/DeactivationModal/DeactivationModal";
document.addEventListener( 'DOMContentLoaded', () => {
const container = document.getElementById( 'rsssl-modal-root' );
if ( container ) {
if ( createRoot ) {
createRoot( container ).render( <DeactivationModal/> );
} else {
render( <DeactivationModal/>, container );
}
}
});

View File

@@ -0,0 +1,10 @@
const defaultConfig = require("@wordpress/scripts/config/webpack.config");
module.exports = {
...defaultConfig,
output: {
...defaultConfig.output,
filename: '[name].[contenthash].js',
chunkFilename: '[name].[contenthash].js',
}
};