Skip to content

Commit

Permalink
fix: add actualURL property to GET /api/list
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Nov 15, 2023
1 parent d97ffb1 commit bc1019e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/helpers/APIHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export class APIHelper {
ctx.response.status = 200
ctx.body = `
<a href="/api/status?apiKey=${this.config?.apiKey}">GET /api/status</a><br>
<a href="/api/list?apiKey=${this.config?.apiKey}">GET /api/list</a><br>
POST /api/playURL/:windowId body: {"url": "", "jsCode": "" }<br>
POST /api/restart/:windowId<br>
POST /api/stop/:windowId<br>
Expand Down Expand Up @@ -321,6 +322,7 @@ POST /api/execute/:windowId body: {"jsCode": "" }<br>
body: windows.map((w) => ({
id: w.id,
url: w.window.url,
actualUrl: w.window.getURL(),
statusCode: w.window.status.statusCode,
statusMessage: w.window.status.message,
})),
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/WindowHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class WindowHelper extends EventEmitter {

this.emit('window-has-been-modified')
}
private getURL(): string {
public getURL(): string {
const windowUrl = this._url ?? this._config.defaultURL

if (this._sharedConfig.baseURL && !windowUrl.match(/^(?:[a-z+]+:)?\/\//i)) {
Expand Down
1 change: 1 addition & 0 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface APIResponseList extends APIResponseBase {
body: {
id: string
url: string | null
actualUrl: string
statusCode: string
statusMessage: string
}[]
Expand Down

0 comments on commit bc1019e

Please sign in to comment.