You must be logged in. Please login now. cfparam(name="attributes",default={}); // === parameter options === // loadResources = false; if ( structKeyExists(request.params,"load") AND IsBoolean(request.params.load) ) loadResources = request.params.load; if ( !structKeyExists(request.params, "scriptsPackage") ) request.params.scriptsPackage = ""; // Options: full or min // Group List filter (one or more items) if ( !structKeyExists(request.params, "groupList") ) request.params.groupList = ""; // Options: full,min,jquery,jqueryui,fontawesome // Alias List Filter (one or more items) if ( !structKeyExists(request.params, "aliasList") ) request.params.aliasList = ""; // Options: [any available resource alias] // if scriptsPackage is used, add them to the groupList filter if ( LEN(TRIM(request.params.scriptsPackage)) ) request.params.groupList = ListAppend(request.params.groupList,request.params.scriptsPackage); // "full" overrides all other groups if ( ListFindNoCase("full",request.params.groupList) ) request.params.groupList = ""; useIntegrityFilter = true; if ( structKeyExists(request.params,"showIntegrityOnly") AND IsBoolean(request.params.showIntegrityOnly) ) useIntegrityFilter = request.params.showIntegrityOnly; if ( !structKeyExists(request.params, "verboseOutput") OR !IsBoolean(request.params.verboseOutput) ) request.params.verboseOutput = false; // Get the standard external (with Local) scripts list scriptsSource = "external"; // Add jquery dependancies if ( FindNoCase('jQueryUI',request.params.aliasList) ) { //WriteDUmp('Found jQueryUI!'); request.params.aliasList = ListPrepend(request.params.aliasList,'jquery'); } //WriteDUmp(request.params.aliasList); // === START: get update data === // if ( LEN(TRIM(request.params.aliasList)) ) { // Get the Scripts By AliasList scriptsArr = application.ADF.resourceService.getScriptsByAliasList(aliasList=request.params.aliasList,source=scriptsSource); } else if ( LEN(TRIM(request.params.groupList)) ) { // Get the Scripts By GroupList scriptsArr = application.ADF.resourceService.getScriptsByGroupList(groupList=request.params.groupList,source=scriptsSource); } else { // Get the All Scripts Data scriptsArr = application.ADF.resourceService.getAllScripts(source=scriptsSource); } //WriteOutput("All Scripts Count: #ArrayLen(scriptsArr)#
"); //WriteDump(scriptsArr); //exit; // Filter out locals, return External Resources only tempArr = []; for ( r=1; r <= ArrayLen(scriptsArr); r++ ) { hasIntegrity = false; tempData = scriptsArr[r]; //WriteDump(var=tempData,expand=false); if ( structKeyExists(tempData,"source") AND structKeyExists(tempData.source,"external") ) { tempCssArr = []; if ( StructKeyExists(tempData.source.external,"css") AND IsArray(tempData.source.external.css) ) tempCssArr = tempData.source.external.css; tempJsArr = []; if ( StructKeyExists(tempData.source.external,"js") AND IsArray(tempData.source.external.js) ) tempJsArr = tempData.source.external.js; if ( ArrayLen(tempCssArr) ) hasIntegrity = sourceCheckForIntegrity(srcArr=tempCssArr); if ( NOT hasIntegrity AND ArrayLen(tempJsArr) ) hasIntegrity = sourceCheckForIntegrity(srcArr=tempJsArr); if ( hasIntegrity OR !useIntegrityFilter ) ArrayAppend(tempArr,tempData); } } // Copy the tempArr filter to the main scriptsArr variable scriptsArr = tempArr; RenderHeader(Title="Resource Integrity Validator"); WO('Open the "Browser Console" to check for any Integrity key failures.',"p"); WO('Note: Loading all may produce resource conflicts.',"p"); //WriteDump(var=attributes,label="attributes",expand=false); //WriteDump(var=attributes.groupList,expand=false); WO("External Scripts Count: #ArrayLen(scriptsArr)#","p"); //WriteDump(var=scriptsArr,expand=false,label="external scripts"); //exit; WO('Load All Resources | Reset All',"div"); WriteOutput("
"); for ( i=1; i <= ArrayLen(scriptsArr); i++ ) { regData = scriptsArr[i]; //WriteDump(var=regData,expand=false,label="regData"); cssProps = []; jsProps = []; if ( StructKeyExists(regData,"cssSourceArray") ) cssProps = regData.cssSourceArray; if ( StructKeyExists(regData,"jsSourceArray") ) jsProps = regData.jsSourceArray; WriteOutput(regData.name); WriteOutput("
"); for ( a=1; a <= ArrayLen(cssProps); a++ ) { cssProp = cssProps[a]; if ( !StructKeyExists(cssProp,"integrity") ) cssProp.integrity = ''; if ( !StructKeyExists(cssProp,"Crossorigin") ) cssProp.Crossorigin = ''; // TODO: Add checkRemoteResourceURL() if ( LEN(TRIM(cssProp.integrity)) ) { outputLinkTag(href=cssProp.SourceURL, integrity=cssProp.integrity, crossorigin=cssProp.Crossorigin); } } for ( b=1; b <= ArrayLen(jsProps); b++ ) { jsProp = jsProps[b]; if ( !StructKeyExists(jsProp,"integrity") ) jsProp.integrity = ''; if ( !StructKeyExists(jsProp,"Crossorigin") ) jsProp.Crossorigin = ''; // TODO: Add checkRemoteResourceURL() if ( LEN(TRIM(jsProp.integrity)) ) { outputScriptTag(src=jsProp.SourceURL, integrity=jsProp.integrity, crossorigin=jsProp.Crossorigin); } } if ( loadResources ) WO('Load Resource | Reset Resource | Reset All',"div"); else WO('Load Resource',"div"); WriteOutput("
"); if ( loadResources ) { renderCssResources(cssArr=cssProps); renderJsResources(jsArr=jsProps); WO('Resources Loaded... Check Browser Console for any Integrity key failures!',"div"); } } RenderFooter();
var propsArr = arguments.cssArr; var props = {}; var a = 1; for ( a=1; a <= ArrayLen(propsArr); a++ ) { props = propsArr[a]; if ( !StructKeyExists(props,"integrity") ) props.integrity = ''; if ( !StructKeyExists(props,"Crossorigin") ) props.Crossorigin = ''; if ( LEN(TRIM(props.integrity)) ) { renderLinkTag(href=props.SourceURL, integrity=props.integrity, crossorigin=props.Crossorigin); } } var propsArr = arguments.jsArr; var props = {}; var a = 1; for ( a=1; a <= ArrayLen(propsArr); a++ ) { props = propsArr[a]; if ( !StructKeyExists(props,"integrity") ) props.integrity = ''; if ( !StructKeyExists(props,"Crossorigin") ) props.Crossorigin = ''; if ( LEN(TRIM(props.integrity)) ) { renderScriptTag(src=props.SourceURL, integrity=props.integrity, crossorigin=props.Crossorigin); } } integrity="#arguments.integrity#" crossorigin="#arguments.crossorigin#"> var outStr = ''; savecontent variable="outStr" { WriteOutput(renderLinkTag(argumentCollection=arguments)); } WriteOutput("
");
		WriteOutput(EncodeForHTML(outStr));
		WriteOutput("
");
var outStr = ''; savecontent variable="outStr" { WriteOutput(renderScriptTag(argumentCollection=arguments)); } WriteOutput("
");
		WriteOutput(EncodeForHTML(outStr));
		WriteOutput("
");
var retFlag = false; var t = 1; var props = {}; for ( t=1; t <= ArrayLen(arguments.srcArr); t++ ) { props = arguments.srcArr[t]; if ( StructKeyExists(props,"integrity") AND LEN(TRIM(props.integrity)) ) { retFlag = true; break; } } return retFlag; <#TRIM(arguments.tag)# class="#arguments.class#">#arguments.comment# #arguments.title#

#arguments.title#