url#format TypeScript Examples

The following examples show how to use url#format. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.ts    From test with BSD 3-Clause "New" or "Revised" License 7 votes vote down vote up
getRedirectUrl = req => {
  if (process.env.DEFAULT_REDIRECT_URL) {
    return process.env.DEFAULT_REDIRECT_URL
  }

  const url = originalUrl(req)

  if (url) {
    return format({
      ...url,
      pathname: '/',
      hostname: url.hostname.replace('accounts', 'cabinet'),
    })
  }

  return ''
}
Example #2
Source File: connection.ts    From Assistive-Webdriver with MIT License 6 votes vote down vote up
async connect(url: string): Promise<void> {
    const parsedURL = new URL(url);
    const urlWithoutAuth = format(parsedURL, {
      auth: false
    });
    this.websessionManager = await connect(urlWithoutAuth);
    this.virtualbox = await this.websessionManager.logon(
      parsedURL.username,
      parsedURL.password
    );
    this.keepAlive();
  }
Example #3
Source File: RewindElectronApp.ts    From rewind with MIT License 6 votes vote down vote up
loadApiWindow() {
    this.apiWindow?.loadURL(
      format({
        pathname: join(__dirname, "..", "desktop-backend", "assets", "index.html"),
        protocol: "file:",
        slashes: true,
      }),
    );
  }
Example #4
Source File: RewindElectronApp.ts    From rewind with MIT License 6 votes vote down vote up
loadMainWindow() {
    const handleFinishedLoading = () => console.log("Finished loading");

    // In DEV mode we want to utilize hot reloading, therefore we are going to connect to the development server.
    // Therefore `nx run desktop-frontend:serve` must be run first before this is executed.
    if (this.isDevMode) {
      this.mainWindow?.loadURL(`http://localhost:${rendererAppDevPort}`).then(handleFinishedLoading);
    } else {
      this.mainWindow
        ?.loadURL(
          format({
            pathname: join(__dirname, "..", rendererAppName, "index.html"),
            protocol: "file:",
            slashes: true,
          }),
        )
        .then(handleFinishedLoading);
    }
  }