diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0258607..b45a6d3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,13 +18,16 @@ jobs: strategy: fail-fast: false matrix: - cfengine: [ "lucee@5", "adobe@2018", "adobe@2021", "adobe@2023" ] + cfengine: [ "lucee@5", "lucee@6", "adobe@2018", "adobe@2021", "adobe@2023" ] coldboxVersion: [ "^6.0.0", "^7.0.0" ] experimental: [ false ] include: - coldboxVersion: "be" cfengine: "lucee@5" experimental: true + - coldboxVersion: "be" + cfengine: "lucee@6" + experimental: true - coldboxVersion: "be" cfengine: "adobe@2018" experimental: true diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index 481a602..5896abf 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -32,6 +32,14 @@ component { * Settings */ variables.settings = { + // Internal engine flags + engine : { + isLucee : server.keyExists( "lucee" ), + isBoxLang : server.keyExists( "boxlang" ), + isAdobe : server.keyExists( "coldfusion" ) && server.coldfusion.productName.findNoCase( + "ColdFusion" + ) + }, // This flag enables/disables the tracking of request data to our storage facilities // To disable all tracking, turn this master key off enabled : true, @@ -39,6 +47,9 @@ component { // The debugger will still track requests even in non debug mode. debugMode : controller.getSetting( name = "environment", defaultValue = "production" ) == "development", // The URL password to use to activate it on demand + // if set to cb:null, will generate random password + // to enable debugger in dev environment set to empty or custom password + // in live environment leave cb:null or set your own password debugPassword : "cb:null", // This flag enables/disables the end of request debugger panel docked to the bottem of the page. // If you disable i, then the only way to visualize the debugger is via the `/cbdebugger` endpoint diff --git a/box.json b/box.json index 9c9ecfa..fbf52e9 100644 --- a/box.json +++ b/box.json @@ -2,7 +2,7 @@ "name":"ColdBox Debugger", "author":"Ortus Solutions ", "Luis Majano " ], - "dependencies":{ - }, + "dependencies":{}, "devDependencies":{ "commandbox-cfformat":"*", "commandbox-docbox":"*", @@ -64,6 +63,5 @@ "logs:2018":"server log name=cbdebugger-adobe@2018 --follow", "logs:2021":"server log name=cbdebugger-adobe@2021 --follow" }, - "installPaths":{ - } + "installPaths":{} } diff --git a/build/Build.cfc b/build/Build.cfc index ee9366e..b15a671 100644 --- a/build/Build.cfc +++ b/build/Build.cfc @@ -12,6 +12,7 @@ component { variables.cwd = getCWD().reReplace( "\.$", "" ); variables.artifactsDir = cwd & "/.artifacts"; variables.buildDir = cwd & "/.tmp"; + variables.apidDocsDir = variables.buildDir & "/apidocs"; variables.apiDocsURL = "http://localhost:60299/apidocs/"; variables.testRunner = "http://localhost:60299/tests/runner.cfm"; @@ -31,7 +32,8 @@ component { // Cleanup + Init Build Directories [ variables.buildDir, - variables.artifactsDir + variables.artifactsDir, + variables.apidDocsDir ].each( function( item ){ if ( directoryExists( item ) ) { directoryDelete( item, true ); diff --git a/changelog.md b/changelog.md index 77aa5fb..34f0261 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Addded + +- Lucee 6 Certification +- BoxLang additions +- Better information in dev env, if debugger is not accessible + +### Fixed + +- CBDEBUGGER-25 - Account for null datasource in QoQ +- Alias for testing mode in CommandBox 6 +- JVMUtil wrong location for the temp directory for producing heap dumps + ## [4.2.0] - 2024-01-10 ### Added diff --git a/handlers/Main.cfc b/handlers/Main.cfc index 7704619..6640f3c 100644 --- a/handlers/Main.cfc +++ b/handlers/Main.cfc @@ -30,11 +30,21 @@ component extends="coldbox.system.RestHandler" { * Debugger disabled event */ function disabled( event, rc, prc ){ + var data = "Page Not Found"; + + if ( getSetting( "environment" ) == "DEVELOPMENT" ) { + data = " isDebugCookieValid defined: " & debuggerService.isDebugCookieValid(); + data &= ", secretKey defined: " & debuggerService.isSecretKeyDefined(); + data &= ", doesCookieMatchesSecretKey: " & debuggerService.doesCookieMatchesSecretKey(); + + data &= ", debugMode: " & debuggerService.getDebugMode(); + } + event.renderData( statusCode = 404, statusText = "Not Found", type = "text", - data = "Page Not Found" + data = data ); } diff --git a/models/DebuggerService.cfc b/models/DebuggerService.cfc index 0870b62..851e0f1 100755 --- a/models/DebuggerService.cfc +++ b/models/DebuggerService.cfc @@ -146,23 +146,34 @@ component */ boolean function getDebugMode(){ // If no secretKey has been set, don't allow debug mode - if ( not ( len( variables.secretKey ) ) ) { + if ( not ( isSecretKeyDefined() ) ) { return false; } // If Cookie exists, it's value is used. if ( isDebugCookieValid() ) { // Must be equal to the current secret key - if ( cookie[ variables.cookieName ] == variables.secretKey ) { - return true; - } else { - return false; - } + return doesCookieMatchesSecretKey() } // If there is no cookie, then use default to app setting return variables.debugMode; } + /** + * returns boolean if secret key is defined + * init() will set secret key + */ + boolean function isSecretKeyDefined(){ + return javacast( "Boolean", len( variables.secretKey ) ); + } + + /** + * checks if cookie matches secret key + */ + boolean function doesCookieMatchesSecretKey(){ + return cookie[ variables.cookieName ] == variables.secretKey; + } + /** * Checks if the debug cookie is a valid cookie. Boolean */ diff --git a/models/JVMUtil.cfc b/models/JVMUtil.cfc index d1cc24a..819df49 100644 --- a/models/JVMUtil.cfc +++ b/models/JVMUtil.cfc @@ -27,9 +27,9 @@ component singleton { * * @return The absolute path to the generated heap dump */ - string function generateHeapDump( directoryPath ){ + string function generateHeapDump( directoryPath = getTempDirectory() ){ // Create it if it doesn't exist - if ( !directoryExists( arguments.directoryPath = getTempDirectory() ) ) { + if ( !directoryExists( arguments.directoryPath ) ) { directoryCreate( arguments.directoryPath ); } diff --git a/readme.md b/readme.md index 1a0d09d..990618e 100644 --- a/readme.md +++ b/readme.md @@ -69,6 +69,7 @@ Apache License, Version 2.0. - Lucee 5+ - ColdFusion 2018+ - ColdBox 6+ +- CommandBox 6 For Development ## Optional Requirements diff --git a/server-adobe@2018.json b/server-adobe@2018.json index 90b75d8..06b22f6 100644 --- a/server-adobe@2018.json +++ b/server-adobe@2018.json @@ -13,7 +13,7 @@ }, "webroot":"test-harness", "aliases":{ - "/moduleroot/cbdebugger":"../" + "/moduleroot/cbdebugger":"./" } }, "openBrowser":"false", diff --git a/server-adobe@2021.json b/server-adobe@2021.json index f6a027c..957953f 100644 --- a/server-adobe@2021.json +++ b/server-adobe@2021.json @@ -13,7 +13,7 @@ }, "webroot":"test-harness", "aliases":{ - "/moduleroot/cbdebugger":"../" + "/moduleroot/cbdebugger":"./" } }, "openBrowser":"false", diff --git a/server-adobe@2023.json b/server-adobe@2023.json index f051571..a2c7d76 100644 --- a/server-adobe@2023.json +++ b/server-adobe@2023.json @@ -13,7 +13,7 @@ }, "webroot": "test-harness", "aliases":{ - "/moduleroot/cbdebugger":"../" + "/moduleroot/cbdebugger":"./" } }, "jvm":{ diff --git a/server-boxlang@1.json b/server-boxlang@1.json new file mode 100644 index 0000000..dd35bde --- /dev/null +++ b/server-boxlang@1.json @@ -0,0 +1,29 @@ +{ + "name":"cbdebugger-boxlang@1", + "app":{ + "serverHomeDirectory":".engine/boxlang", + "cfengine":"boxlang@1" + }, + "web":{ + "http":{ + "port":"60299" + }, + "rewrites":{ + "enable":"true" + }, + "webroot":"test-harness", + "aliases":{ + "/moduleroot/cbdebugger":"./" + } + }, + "openBrowser":"false", + "cfconfig":{ + "file":".cfconfig.json" + }, + "env":{ + + }, + "scripts" : { + "onServerInitialInstall":"install bx-compat" + } +} diff --git a/server-lucee@5.json b/server-lucee@5.json index 59eefe2..572f6aa 100644 --- a/server-lucee@5.json +++ b/server-lucee@5.json @@ -13,14 +13,14 @@ }, "webroot":"test-harness", "aliases":{ - "/moduleroot/cbdebugger":"../" + "/moduleroot/cbdebugger":"./" } }, "openBrowser":"false", "cfconfig":{ "file":".cfconfig.json" }, - "env":{ + "env":{ "lucee-extensions":"D062D72F-F8A2-46F0-8CBC91325B2F067B" } } diff --git a/server-lucee@6.json b/server-lucee@6.json new file mode 100644 index 0000000..34dc204 --- /dev/null +++ b/server-lucee@6.json @@ -0,0 +1,26 @@ +{ + "name":"cbdebugger-lucee@6", + "app":{ + "serverHomeDirectory":".engine/lucee6", + "cfengine":"lucee@6" + }, + "web":{ + "http":{ + "port":"60299" + }, + "rewrites":{ + "enable":"true" + }, + "webroot":"test-harness", + "aliases":{ + "/moduleroot/cbdebugger":"./" + } + }, + "openBrowser":"false", + "cfconfig":{ + "file":".cfconfig.json" + }, + "env":{ + "lucee-extensions":"D062D72F-F8A2-46F0-8CBC91325B2F067B" + } +} diff --git a/views/main/panels/requestTracker/acfSqlPanel.cfm b/views/main/panels/requestTracker/acfSqlPanel.cfm index 8ddf323..4337848 100755 --- a/views/main/panels/requestTracker/acfSqlPanel.cfm +++ b/views/main/panels/requestTracker/acfSqlPanel.cfm @@ -182,7 +182,7 @@ #numberFormat( q.endTime - q.startTime )# ms - #q.datasource# + #( q.datasource ?: "QoQ" )# diff --git a/views/main/panels/requestTracker/acfSqlTable.cfm b/views/main/panels/requestTracker/acfSqlTable.cfm index c7178e1..4374364 100644 --- a/views/main/panels/requestTracker/acfSqlTable.cfm +++ b/views/main/panels/requestTracker/acfSqlTable.cfm @@ -31,7 +31,7 @@ - #q.datasource# + #( q.datasource ?: "QoQ" )# diff --git a/views/main/panels/requestTracker/luceeSqlPanel.cfm b/views/main/panels/requestTracker/luceeSqlPanel.cfm index a6e63dc..72adea5 100755 --- a/views/main/panels/requestTracker/luceeSqlPanel.cfm +++ b/views/main/panels/requestTracker/luceeSqlPanel.cfm @@ -197,7 +197,7 @@ #numberFormat( q.executionTime / 1000000 )# ms - #q.datasource# + #( q.datasource ?: "QoQ" )# diff --git a/views/main/panels/requestTracker/luceeSqlTable.cfm b/views/main/panels/requestTracker/luceeSqlTable.cfm index ee00890..679a9c2 100644 --- a/views/main/panels/requestTracker/luceeSqlTable.cfm +++ b/views/main/panels/requestTracker/luceeSqlTable.cfm @@ -30,7 +30,7 @@ - #q.datasource# + #( q.datasource ?: "QoQ" )#