Skip to content

Commit 0f6d457

Browse files
Merge pull request #511 from gjsjohnmurray/fix-510
fix #510 respect pathPrefix on server action URLs
2 parents 428221f + 011cb32 commit 0f6d457

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/api/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ export class AtelierAPI {
137137
}
138138

139139
public xdebugUrl(): string {
140-
const { host, https, port, apiVersion } = this.config;
140+
const { host, https, port, apiVersion, pathPrefix } = this.config;
141141
const proto = https ? "wss" : "ws";
142-
return `${proto}://${host}:${port}/api/atelier/v${apiVersion}/%25SYS/debug`;
142+
return `${proto}://${host}:${port}${pathPrefix}/api/atelier/v${apiVersion}/%25SYS/debug`;
143143
}
144144

145145
public updateCookies(newCookies: string[]): Promise<any> {
@@ -315,7 +315,7 @@ export class AtelierAPI {
315315
}
316316
await this.updateCookies(response.headers.raw()["set-cookie"] || []);
317317
panel.text = `${this.connInfo}`;
318-
panel.tooltip = `Connected as ${username}`;
318+
panel.tooltip = `Connected${pathPrefix ? " to " + pathPrefix : ""} as ${username}`;
319319
if (method === "HEAD") {
320320
authRequestMap.delete(target);
321321
return this.cookies;

src/commands/serverActions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type ServerAction = { detail: string; id: string; label: string };
1515
export async function serverActions(): Promise<void> {
1616
const { apiTarget, configName: workspaceFolder } = connectionTarget();
1717
const api = new AtelierAPI(apiTarget);
18-
const { active, host = "", ns = "", https, port = 0, username, password, docker } = api.config;
18+
const { active, host = "", ns = "", https, port = 0, pathPrefix, username, password, docker } = api.config;
1919
const explorerCount = (await explorerProvider.getChildren()).length;
2020
if (!explorerCount && (!docker || host === "")) {
2121
await vscode.commands.executeCommand("ObjectScriptExplorer.focus");
@@ -71,7 +71,7 @@ export async function serverActions(): Promise<void> {
7171
const classname = file && file.name.toLowerCase().endsWith(".cls") ? file.name.slice(0, -4) : "";
7272
const classnameEncoded = encodeURIComponent(classname);
7373
const connInfo = `${host}:${port}[${nsEncoded}]`;
74-
const serverUrl = `${https ? "https" : "http"}://${host}:${port}`;
74+
const serverUrl = `${https ? "https" : "http"}://${host}:${port}${pathPrefix}`;
7575
const portalUrl = `${serverUrl}/csp/sys/UtilHome.csp?$NAMESPACE=${nsEncoded}`;
7676
const classRef = `${serverUrl}/csp/documatic/%25CSP.Documatic.cls?LIBRARY=${nsEncoded}${
7777
classname ? "&CLASSNAME=" + classnameEncoded : ""

src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export async function checkConnection(clearCookies = false, uri?: vscode.Uri): P
199199
_onDidChangeConnection.fire();
200200
}
201201
let api = new AtelierAPI(apiTarget, false);
202-
const { active, host = "", port = 0, username, ns = "" } = api.config;
202+
const { active, host = "", port = 0, pathPrefix, username, ns = "" } = api.config;
203203
vscode.commands.executeCommand("setContext", "vscode-objectscript.connectActive", active);
204204
if (!panel.text) {
205205
panel.text = `${PANEL_LABEL}`;
@@ -268,7 +268,7 @@ export async function checkConnection(clearCookies = false, uri?: vscode.Uri): P
268268
.serverInfo()
269269
.then((info) => {
270270
panel.text = api.connInfo;
271-
panel.tooltip = `Connected as ${username}`;
271+
panel.tooltip = `Connected${pathPrefix ? " to " + pathPrefix : ""} as ${username}`;
272272
const hasHS = info.result.content.features.find((el) => el.name === "HEALTHSHARE" && el.enabled) !== undefined;
273273
reporter &&
274274
reporter.sendTelemetryEvent("connected", {

0 commit comments

Comments
 (0)