(hostname: Hostname)
| 268 | * @returns The URL with pre-filled query parameters. |
| 269 | */ |
| 270 | export function getNewOAuthAppURL(hostname: Hostname): Link { |
| 271 | const date = format(new Date(), 'PP p'); |
| 272 | const newOAuthAppURL = new URL( |
| 273 | `https://${hostname}/settings/applications/new`, |
| 274 | ); |
| 275 | newOAuthAppURL.searchParams.append( |
| 276 | 'oauth_application[name]', |
| 277 | `${APPLICATION.NAME} (Created on ${date})`, |
| 278 | ); |
| 279 | newOAuthAppURL.searchParams.append( |
| 280 | 'oauth_application[url]', |
| 281 | 'https://gitify.io', |
| 282 | ); |
| 283 | newOAuthAppURL.searchParams.append( |
| 284 | 'oauth_application[callback_url]', |
| 285 | 'gitify://oauth', |
| 286 | ); |
| 287 | |
| 288 | return newOAuthAppURL.toString() as Link; |
| 289 | } |
| 290 | |
| 291 | /** |
| 292 | * Return true if `hostname` is a valid DNS hostname (e.g. `github.com`). |
no test coverage detected