Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
somebody1234 committed May 25, 2023
1 parent 95cf2ee commit 61802b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/ide-desktop/lib/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,14 @@ class App {
this.projectManagerHost ??= projectManagerHost!
this.projectManagerPort ??= await portfinder.getPortPromise({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
startPort: parseInt(projectManagerPort!),
port: parseInt(projectManagerPort!),
})
const projectManagerUrl = `ws://${this.projectManagerHost}:${this.projectManagerPort}`
this.args.groups.engine.options.projectManagerUrl.value = projectManagerUrl
const backendOpts = [
...(this.args.groups.debug.options.verbose.value ? ['-vv'] : []),
`--serverHost=${this.projectManagerHost}`,
`--serverPort=${this.projectManagerPort}`,
`--server-host=${this.projectManagerHost}`,
`--server-port=${this.projectManagerPort}`,
]
projectManager.spawn(this.args, backendOpts)
})
Expand Down
18 changes: 18 additions & 0 deletions app/ide-desktop/lib/content/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const SERVICE_WORKER_PATH = '/serviceWorker.js'
const SECOND = 1000
/** Time in seconds after which a `fetchTimeout` ends. */
const FETCH_TIMEOUT = 300
/** The URL parameter name of the "Project Manager URL" parameter.
* This MUST be changed if the corresponding option in
* `content-config/src/config.json` is changed. */
const PROJECT_MANAGER_URL_PARAMETER_NAME = 'engine.projectManagerUrl'

// ===================
// === Live reload ===
Expand Down Expand Up @@ -241,6 +245,20 @@ class Main implements AppRunner {
}
let projectManagerUrl =
contentConfig.OPTIONS.groups.engine.options.projectManagerUrl.value || null
// This option MUST currently be reset as the dashboard opens the IDE by specifying
// the RPC and data WebSocket endpoints, which are mutually exclusive with specifying
// the Project Manager WebSocket endpoint.
// This SHOULD stay unset when the dashboard switches to specifying the Project Manager
// endpoint, as it will still break opening projects on the cloud. Local projects will
// not break as this option is re-set by the dashboard.
contentConfig.OPTIONS.groups.engine.options.projectManagerUrl.value =
contentConfig.OPTIONS.groups.engine.options.projectManagerUrl.default
// The option must be removed from the URL as well.
if (projectManagerUrl != null) {
const parsedLocation = new URL(location.href)
parsedLocation.searchParams.delete(PROJECT_MANAGER_URL_PARAMETER_NAME)
history.replaceState(null, '', parsedLocation.toString())
}
authentication.run({
appRunner: this,
logger,
Expand Down

0 comments on commit 61802b5

Please sign in to comment.