File manager - Edit - /usr/local/cpanel/whostmgr/docroot/templates/mod_security/directives/ruleVendorUrlValidator.min.js
Back
define(["angular","lodash","cjt/validator/validator-utils","cjt/util/locale","cjt/validator/domain-validators","cjt/validator/validateDirectiveFactory"],(function(angular,_,UTILS,LOCALE,DOMAIN_VALIDATORS){var _expandProtocol=function(value){return value+":"};var VALID_PROTOCOLS=["http","https"];var VALID_PROTOCOLS_PATTERN=new RegExp("^(?:"+_.map(VALID_PROTOCOLS,_expandProtocol).join("|")+")$","i");var VALID_FILE_NAME_PATTERN=/^meta_[a-zA-Z0-9_-]+\.yaml$/;var VALID_FILE_PREFIX=/^meta_/;var VALID_FILE_EXTENSION=/\.yaml$/;var validators={isModsecVendorUrl:function(value){var result=UTILS.initializeValidationResult();if(value){var parts=value.split(/\//);var length=parts.length;var last=length-1;if(length<4){result.isValid=false;result.add("isModsecVendorUrl",LOCALE.maketext("The URL must contain a protocol, domain, and file name in the correct format. (Example: [asis,https://example.com/example/meta_example.yaml])"));return result}if(!VALID_PROTOCOLS_PATTERN.test(parts[0])){result.isValid=false;result.add("isModsecVendorUrl",LOCALE.maketext("The URL must use one of the following recognized protocols: [join,~, ,_1]",VALID_PROTOCOLS));return result}if(parts[1]!==""){result.isValid=false;result.add("isModsecVendorUrl",LOCALE.maketext("The protocol should be followed by a colon and two forward slashes. (Example: [asis,https://])"));return result}var domainResults=DOMAIN_VALIDATORS.methods.fqdn(parts[2]);if(!domainResults.isValid){result.isValid=false;result.add("isModsecVendorUrl",domainResults.messages[0].message);return result}if(last<3){result.add("isModsecVendorUrl",LOCALE.maketext("The file name must start with meta_, followed by the vendor name and have the .yaml extension. (Example: [asis,meta_example.yaml])"))}else{var fileName=parts[last];if(!VALID_FILE_NAME_PATTERN.test(fileName)){result.isValid=false;var failedPrefixTest=!VALID_FILE_PREFIX.test(fileName);var failedExtensionTest=!VALID_FILE_EXTENSION.test(fileName);var numFailed=failedPrefixTest+failedExtensionTest;if(numFailed>1){result.add("isModsecVendorUrl",LOCALE.maketext("The file name must use the meta_ prefix, followed by the vendor name and a .yaml extension. The vendor name must only contain characters in the following set: [join,~, ,_1] (Example: [asis,meta_example.yaml])",["a-z","A-Z","0-9","-","_"]))}else if(failedPrefixTest){result.add("isModsecVendorUrl",LOCALE.maketext("The file name must use the meta_ prefix. (Example: [asis,meta_example.yaml])"))}else if(failedExtensionTest){result.add("isModsecVendorUrl",LOCALE.maketext("The file name must have the .yaml extension. (Example: [asis,meta_example.yaml])"))}else{result.add("isModsecVendorUrl",LOCALE.maketext("The vendor name part of the file name must only contain characters in the following set: [join,~, ,_1] (Example: [asis,meta_example.yaml])",["a-z","A-Z","0-9","-","_"]))}return result}}}return result}};var validatorModule=angular.module("cjt2.validate");validatorModule.run(["validatorFactory",function(validatorFactory){validatorFactory.generate(validators)}]);return{methods:validators,name:"ruleVendorUrlValidator",description:"Validation directives for rule vendor urls.",version:11.48}}));
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings