| 77 | // current endpoint path, which keeps it correct under whatever prefix the |
| 78 | // host app mounts the API. |
| 79 | const consentPageUrl = ( |
| 80 | requestUrl: string, |
| 81 | params: { redirectUri: string; state: Option.Option<string> }, |
| 82 | ) => { |
| 83 | const currentUrl = new URL(requestUrl, serverEnv().WEB_URL); |
| 84 | const startPath = Extension.ExtensionApiPaths.startAuth.slice( |
| 85 | Extension.ExtensionApiPaths.startAuth.lastIndexOf("/") + 1, |
| 86 | ); |
| 87 | const startUrl = new URL(startPath, currentUrl); |
| 88 | startUrl.search = ""; |
| 89 | startUrl.searchParams.set("redirectUri", params.redirectUri); |
| 90 | if (Option.isSome(params.state)) { |
| 91 | startUrl.searchParams.set("state", params.state.value); |
| 92 | } |
| 93 | return startUrl; |
| 94 | }; |
| 95 | |
| 96 | const escapeHtml = (value: string) => |
| 97 | value |