(hostname: Hostname)
| 243 | * @returns The URL with pre-filled query parameters. |
| 244 | */ |
| 245 | export function getNewTokenURL(hostname: Hostname): Link { |
| 246 | const date = format(new Date(), 'PP p'); |
| 247 | const newTokenURL = new URL(`https://${hostname}/settings/tokens/new`); |
| 248 | newTokenURL.searchParams.append( |
| 249 | 'description', |
| 250 | `${APPLICATION.NAME} (Created on ${date})`, |
| 251 | ); |
| 252 | newTokenURL.searchParams.append( |
| 253 | 'scopes', |
| 254 | getRecommendedScopeNames().join(','), |
| 255 | ); |
| 256 | newTokenURL.searchParams.append('default_expires_at', '90'); // 90 days |
| 257 | |
| 258 | return newTokenURL.toString() as Link; |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Build a pre-filled URL for registering a new OAuth App. |
no test coverage detected