Skip to content

Commit

Permalink
Fix issue with AJAX calls to site in subfolder. ACE updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbj committed Jul 31, 2024
1 parent 1fb3b01 commit 63eae91
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion TracyDebugger.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static function getModuleInfo() {
'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__),
'author' => 'Adrian Jones',
'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/',
'version' => '4.26.34',
'version' => '4.26.35',
'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first
'singular' => true,
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',
Expand Down
7 changes: 4 additions & 3 deletions panels/ConsolePanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function getTab() {
public function getPanel() {

$rootPath = $this->wire('config')->paths->root;
$rootUrl = $this->wire('config')->urls->root;
$tracyModuleUrl = $this->wire('config')->urls->TracyDebugger;
$inAdmin = \TracyDebugger::$inAdmin;

Expand Down Expand Up @@ -402,7 +403,7 @@ public function getPanel() {
var backupFilename = document.getElementById("backupFilename").value;
var accessTemplateVars = !this.inAdmin ? document.getElementById("accessTemplateVars").checked : "false";
xmlhttp.open("POST", "/", true);
xmlhttp.open("POST", "$rootUrl", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.send("tracyConsole=1&codeReturn=codeReturn&allowBluescreen="+allowBluescreen+"&dbBackup="+dbBackup+"&backupFilename="+backupFilename+"&accessTemplateVars="+accessTemplateVars+"&pid={$pid}&fid={$fid}&tid={$tid}&mid={$mid}&code="+encodeURIComponent(code));
Expand Down Expand Up @@ -444,7 +445,7 @@ public function getPanel() {
xmlhttp.getAllResponseHeaders();
}
};
xmlhttp.open("POST", "/", true);
xmlhttp.open("POST", "$rootUrl", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.send("tracysnippets=1&snippetname=" + name);
Expand Down Expand Up @@ -501,7 +502,7 @@ public function getPanel() {
xmlhttp.getAllResponseHeaders();
}
};
xmlhttp.open("POST", "/", true);
xmlhttp.open("POST", "$rootUrl", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
if(deleteSnippet) {
Expand Down
2 changes: 2 additions & 0 deletions panels/FileEditorPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function getTab() {
public function getPanel() {

$tracyModuleUrl = $this->wire('config')->urls->TracyDebugger;
$rootUrl = $this->wire('config')->urls->root;

$filePath = $this->wire('config')->paths->root . $this->tracyFileEditorFilePath;

Expand Down Expand Up @@ -140,6 +141,7 @@ public function getPanel() {
tfe: {},
tracyModuleUrl: "$tracyModuleUrl",
rootUrl: "$rootUrl",
tracyFileEditorFilePath: "{$this->tracyFileEditorFilePath}",
errorMessage: "{$this->errorMessage}",
customSnippetsUrl: "$customSnippetsUrl",
Expand Down
3 changes: 2 additions & 1 deletion panels/ProcesswireInfoPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function getPanel() {

$out = '';
$panelSections = \TracyDebugger::getDataValue('processwireInfoPanelSections');
$rootUrl = $this->wire('config')->urls->root;

if(in_array('gotoId', $panelSections)) {
$out .= <<< HTML
Expand Down Expand Up @@ -123,7 +124,7 @@ function tracyClearGoToPageID(matchStatus) {
}
}
xmlhttp.open("POST", "/", true);
xmlhttp.open("POST", "$rootUrl", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.send("goToPage="+pid);
Expand Down
2 changes: 2 additions & 0 deletions panels/TracyExceptionsPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function getTab() {
public function getPanel() {

$tracyModuleUrl = $this->wire('config')->urls->TracyDebugger;
$rootUrl = $this->wire('config')->urls->root;

$filePath = $this->wire('config')->paths->root . $this->tracyExceptionFile;

Expand All @@ -62,6 +63,7 @@ public function getPanel() {
var tracyExceptionsViewer = {
tracyModuleUrl: "$tracyModuleUrl",
rootURL: "$rootUrl",
};
function clearTracyExceptionsViewer() {
Expand Down
2 changes: 1 addition & 1 deletion scripts/ace-editor/ace.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/ace-editor/keybinding-emacs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/exception-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if(!tracyExceptionLoader) {
xmlhttp.getAllResponseHeaders();
}
};
xmlhttp.open("POST", "/", true);
xmlhttp.open("POST", tracyExceptionsViewer.rootUrl, true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.send("filePath=" + filePath);
Expand Down
2 changes: 1 addition & 1 deletion scripts/file-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ if(!tracyFileEditorLoader) {
xmlhttp.getAllResponseHeaders();
}
};
xmlhttp.open("POST", "/", true);
xmlhttp.open("POST", tracyFileEditor.rootUrl, true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.send("filePath=" + filePath);
Expand Down

0 comments on commit 63eae91

Please sign in to comment.