Fixed connect URL generator for the file server.

canary
WolverinDEV 2019-11-06 12:38:33 +01:00
parent 687d8dac01
commit b5330b3318
2 changed files with 7 additions and 3 deletions

View File

@ -613,7 +613,7 @@ namespace server {
script += "?>"; script += "?>";
fs.writeFileSync(tmp_script_name, script, {flag: 'w'}); fs.writeFileSync(tmp_script_name, script, {flag: 'w'});
exec(php + " -d auto_prepend_file=" + tmp_script_name + " " + file).then(result => { exec(php + " -d auto_prepend_file=" + tmp_script_name + " " + file).then(result => {
if(result.stderr) { if(result.stderr && !result.stdout) {
response.writeHead(500); response.writeHead(500);
response.write("Encountered error while interpreting PHP script:\n"); response.write("Encountered error while interpreting PHP script:\n");
response.write(result.stderr); response.write(result.stderr);

View File

@ -352,6 +352,10 @@ class ConnectionHandler {
/* generate the tag */ /* generate the tag */
const tag = $.spawn("a").text(tr("here")); const tag = $.spawn("a").text(tr("here"));
let pathname = document.location.pathname;
if(pathname.endsWith(".php"))
pathname = pathname.substring(0, pathname.lastIndexOf("/"));
if(bipc.supported()) { if(bipc.supported()) {
tag.attr('href', "#"); tag.attr('href', "#");
let popup: Window; let popup: Window;
@ -380,7 +384,7 @@ class ConnectionHandler {
this.startConnection(properties.connect_address, profile, true, cprops); this.startConnection(properties.connect_address, profile, true, cprops);
}); });
const url = build_url(document.location.origin + document.location.pathname + "/popup/certaccept/", "", properties); const url = build_url(document.location.origin + pathname + "/popup/certaccept/", "", properties);
const features_string = [...Object.keys(features)].map(e => e + "=" + features[e]).reduce((a, b) => a + "," + b); const features_string = [...Object.keys(features)].map(e => e + "=" + features[e]).reduce((a, b) => a + "," + b);
popup = window.open(url, "TeaWeb certificate accept", features_string); popup = window.open(url, "TeaWeb certificate accept", features_string);
try { try {
@ -395,7 +399,7 @@ class ConnectionHandler {
} }
}); });
} else { } else {
tag.attr('href', build_url(document.location.origin + document.location.pathname, document.location.search, properties)); tag.attr('href', build_url(document.location.origin + pathname, document.location.search, properties));
} }
return tag; return tag;
} }