MCPcopy Create free account
hub / github.com/e2b-dev/desktop / getUrl

Method getUrl

packages/js-sdk/src/sandbox.ts:643–667  ·  view source on GitHub ↗

* Get the URL to a web page with a stream of the desktop sandbox. * @param autoConnect - Whether to automatically connect to the server after opening the URL. * @param viewOnly - Whether to prevent user interaction through the client. * @param resize - Whether to resize the view when the wi

({
    autoConnect = true,
    viewOnly = false,
    resize = 'scale',
    authKey,
  }: UrlOptions = {})

Source from the content-addressed store, hash-verified

641 * @returns The URL to connect to the VNC server.
642 */
643 public getUrl({
644 autoConnect = true,
645 viewOnly = false,
646 resize = 'scale',
647 authKey,
648 }: UrlOptions = {}): string {
649 if (this.url === null) {
650 throw new Error('Server is not running')
651 }
652
653 const url = new URL(this.url)
654 if (autoConnect) {
655 url.searchParams.set('autoconnect', 'true')
656 }
657 if (viewOnly) {
658 url.searchParams.set('view_only', 'true')
659 }
660 if (resize) {
661 url.searchParams.set('resize', resize)
662 }
663 if (authKey) {
664 url.searchParams.set('password', authKey)
665 }
666 return url.toString()
667 }
668
669 /**
670 * Start the VNC server.

Callers 1

mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected