-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathconstants.ts
More file actions
45 lines (37 loc) · 1.7 KB
/
Copy pathconstants.ts
File metadata and controls
45 lines (37 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/** Stable devframe id for the code-server plugin. */
export const PLUGIN_ID = 'devframes-plugin-code-server'
/**
* Shared-state key holding the serializable, secret-free server status and
* detection result. The authentication cookie is never published here — it
* is returned only from the `start` / `status` RPCs to the already-authorized
* client (see {@link CodeServerAuth}).
*/
export const STATE_KEY = 'devframes-plugin-code-server:state'
/** Default dev-server port for the plugin's own launcher SPA (standalone CLI). */
export const DEFAULT_PORT = 9013
/** Preferred port for the spawned code-server process (falls back if taken). */
export const DEFAULT_CODE_SERVER_PORT = 8080
/** How long to wait for code-server to answer its `/healthz` probe. */
export const DEFAULT_START_TIMEOUT = 30_000
/** code-server's session cookie base name (see `getCookieSessionName`). */
export const SESSION_COOKIE_BASE = 'code-server-session'
/**
* Title for the read-only terminal session surfaced when the plugin is mounted
* in a hub (`ctx.terminals`). Mirrors the plugin's own name.
*/
export const TERMINAL_SESSION_TITLE = 'Code Server'
/**
* Icon for that terminal session. Mirrors the plugin's declared icon so the
* hub's terminals panel shows the same glyph as the rest of the plugin.
*/
export const TERMINAL_SESSION_ICON = 'ph:code-duotone'
/**
* Compute code-server's session cookie name for an optional `--cookie-suffix`.
* Mirrors code-server's own `getCookieSessionName` so the client sets the
* exact cookie the server reads.
*/
export function getCookieSessionName(suffix?: string): string {
return suffix
? `${SESSION_COOKIE_BASE}-${suffix.replace(/[^a-z0-9-]/gi, '-')}`
: SESSION_COOKIE_BASE
}