11import fetch from "node-fetch" ;
22
3+ import { getPublicAPIEndpoint , getGitpodEndpoint } from "../../../preferences/gitpod_endpoint" ;
34import { CreateWorkspace , WorkspaceStreamer } from "../WorkspaceStreamer" ;
45
56import { IWorkspaceError } from "./IWorkspaceError" ;
@@ -21,12 +22,13 @@ type ICreateWorkspaceParams = {
2122 } ;
2223} ;
2324
25+ const publicAPIEndpoint = getPublicAPIEndpoint ( ) ;
2426const workspaceURLs = {
25- getWorkspace : "https://api. gitpod.io/gitpod. experimental.v1.WorkspacesService/GetWorkspace" ,
26- getAllWorkspaces : "https://api. gitpod.io/gitpod. experimental.v1.WorkspacesService/ListWorkspaces" ,
27- deleteWorkspace : "https://api. gitpod.io/gitpod. experimental.v1.WorkspacesService/DeleteWorkspace" ,
28- startWorkspace : "https://api. gitpod.io/gitpod. experimental.v1.WorkspacesService/StartWorkspace" ,
29- stopWorkspace : "https://api. gitpod.io/gitpod. experimental.v1.WorkspacesService/StopWorkspace" ,
27+ getWorkspace : ` ${ publicAPIEndpoint } / gitpod.experimental.v1.WorkspacesService/GetWorkspace` ,
28+ getAllWorkspaces : ` ${ publicAPIEndpoint } / gitpod.experimental.v1.WorkspacesService/ListWorkspaces` ,
29+ deleteWorkspace : ` ${ publicAPIEndpoint } / gitpod.experimental.v1.WorkspacesService/DeleteWorkspace` ,
30+ startWorkspace : ` ${ publicAPIEndpoint } / gitpod.experimental.v1.WorkspacesService/StartWorkspace` ,
31+ stopWorkspace : ` ${ publicAPIEndpoint } / gitpod.experimental.v1.WorkspacesService/StopWorkspace` ,
3032} ;
3133
3234export class IWorkspace implements GitpodDataModel {
@@ -159,7 +161,7 @@ export class IWorkspace implements GitpodDataModel {
159161 this . instanceId = workspace . status . instance . instanceId ;
160162 this . initialized = true ;
161163 this . createdAt = workspace . status . instance . createdAt ;
162- this . ideURL = workspace . status . instance ? workspace . status . instance . status . url : "https://gitpod.io" ;
164+ this . ideURL = workspace . status . instance ? workspace . status . instance . status . url : getGitpodEndpoint ( ) ;
163165 this . repository = workspace . context . git . repository . name ;
164166
165167 if ( workspace . status . instance . status . gitStatus ) {
0 commit comments