@@ -6,6 +6,7 @@ const { accountDisplayName, accountIdentityLabel, maskAccountEmail } =
66const { compactNumber : fmtNum } = window . ReroutedNumberFormat ;
77const { createLatestRequestGate, guardSensitiveRender } = window . ReroutedRendererLockState ;
88const { buildProviderCatalog } = window . ReroutedProviderCatalog ;
9+ const { oauthPrompt } = window . ReroutedOAuthPrompt ;
910const $ = ( sel , el = document ) => el . querySelector ( sel ) ;
1011const view = $ ( "#view" ) ;
1112const nav = $ ( "#nav" ) ;
@@ -291,7 +292,6 @@ function wireSecrets(root = view) {
291292 } ) ;
292293}
293294
294- const PASTE_CODE_PLACEHOLDER = "Paste the full callback URL if prompted" ;
295295const OAUTH_RISK_NOTICE =
296296 "Notice: This provider's subscription or OAuth session is not officially licensed for proxy or router use. Using it this way may result in account restrictions or bans. Proceed at your own risk." ;
297297
@@ -450,15 +450,17 @@ function renderOauthProviders() {
450450 view . querySelectorAll ( ".tile" ) . forEach ( ( btn ) => {
451451 btn . onclick = async ( ) => {
452452 const type = btn . dataset . type ;
453+ const prompt = oauthPrompt ( type ) ;
453454 const panel = $ ( "#oauth-panel" ) ;
454- panel . innerHTML = `<div class="card"><div class="card-title">Signing in to ${ esc ( type ) } …</div>
455- <div class="card-sub">Complete login in your browser, then click Finish connection. </div>
455+ panel . innerHTML = `<div class="card"><div class="card-title">Signing in to ${ esc ( providerLabel ( type ) ) } …</div>
456+ <div class="card-sub">${ esc ( prompt . instruction ) } </div>
456457 ${ oauthRiskNotice ( ) }
457458 <div class="btn-row" style="margin-top:10px">
458- <button type="button" class="btn btn-secondary btn-sm" id="btn-reopen">Open browser again </button>
459+ <button type="button" class="btn btn-secondary btn-sm" id="btn-reopen">Restart sign-in </button>
459460 <button type="button" class="btn btn-primary btn-sm" id="btn-done">Finish connection</button>
460461 </div>
461- <input class="input" id="paste-code" placeholder="${ PASTE_CODE_PLACEHOLDER } " style="margin-top:10px" />
462+ <div class="oauth-paste-entry"><label class="label" for="paste-code">${ esc ( prompt . fieldLabel ) } </label>
463+ <input class="input" id="paste-code" placeholder="${ esc ( prompt . placeholder ) } " autocomplete="off" /></div>
462464 </div>` ;
463465 await api . invoke ( "app:oauth-start" , type ) ;
464466 $ ( "#btn-reopen" ) . onclick = ( ) => api . invoke ( "app:oauth-start" , type ) ;
@@ -1067,21 +1069,21 @@ function startOauthFlow({ type, providerId, onDone, opener }) {
10671069 box . className = "action-panel" ;
10681070 box . setAttribute ( "role" , "region" ) ;
10691071 box . setAttribute ( "aria-labelledby" , "oauth-panel-title" ) ;
1070- const claudeHint =
1071- type === "claude"
1072- ? "After authorizing, paste the full localhost callback URL if the browser cannot return automatically."
1073- : "Most providers return automatically. Paste the full callback URL only if automatic return fails." ;
1074- box . innerHTML = `<div class="action-panel-head"><div class="eyebrow">${ providerId ? "Reconnect" : "New account" } </div><div class="action-panel-title" id="oauth-panel-title" data-panel-heading tabindex="-1">${ esc ( providerLabel ( type ) ) } </div><div class="action-panel-sub">Opening a secure browser session. ${ esc ( claudeHint ) } </div></div>
1072+ const prompt = oauthPrompt ( type ) ;
1073+ const pasteField = `<div class="oauth-paste-entry"><label class="label" for="paste-code-oauth">${ esc ( prompt . fieldLabel ) } </label>
1074+ <input class="input" id="paste-code-oauth" placeholder="${ esc ( prompt . placeholder ) } " autocomplete="off" /></div>` ;
1075+ box . innerHTML = `<div class="action-panel-head"><div class="eyebrow">${ providerId ? "Reconnect" : "New account" } </div><div class="action-panel-title" id="oauth-panel-title" data-panel-heading tabindex="-1">${ esc ( providerLabel ( type ) ) } </div><div class="action-panel-sub">Opening a secure browser session. ${ esc ( prompt . instruction ) } </div></div>
10751076 ${ oauthRiskNotice ( ) }
10761077 <div class="gateway-state"><span class="status-node"></span><span id="oauth-status-line">Starting OAuth…</span></div>
1078+ ${ prompt . primaryPaste ? pasteField : "" }
10771079 <details class="disclosure" style="margin:10px 0 0">
10781080 <summary>Having trouble?</summary>
10791081 <div class="disclosure-body"><div class="label">Authorization URL</div><div class="auth-url-box" id="oauth-url-display">Starting…</div>
1080- <input class="input" id="paste-code-oauth" placeholder=" ${ type === "claude" ? "Paste full localhost callback URL " : PASTE_CODE_PLACEHOLDER } " autocomplete="off" /> </div>
1082+ ${ prompt . primaryPaste ? "" : pasteField } </div>
10811083 </details>
10821084 <div class="btn-row">
10831085 <button type="button" class="btn btn-secondary btn-sm" id="btn-copy-oauth-url">Copy URL</button>
1084- <button type="button" class="btn btn-secondary btn-sm" id="btn-reopen-oauth">Open browser </button>
1086+ <button type="button" class="btn btn-secondary btn-sm" id="btn-reopen-oauth">Restart sign-in </button>
10851087 <button type="button" class="btn btn-secondary btn-sm" id="btn-oauth-logs">Logs</button>
10861088 </div>
10871089 <div class="btn-row">
@@ -1132,9 +1134,11 @@ function startOauthFlow({ type, providerId, onDone, opener }) {
11321134 }
11331135 lastAuthUrl = r . authUrl || "" ;
11341136 disp . textContent = lastAuthUrl ;
1135- status . textContent = r . needsPaste
1136- ? `Redirect: ${ r . redirectUri || "—" } · after Authorize paste the full localhost callback URL`
1137- : `Redirect: ${ r . redirectUri || "—" } · waiting for browser callback` ;
1137+ status . textContent = prompt . primaryPaste
1138+ ? prompt . status
1139+ : r . needsPaste
1140+ ? `Redirect: ${ r . redirectUri || "—" } · ${ prompt . status } `
1141+ : `Redirect: ${ r . redirectUri || "—" } · waiting for browser callback` ;
11381142 }
11391143 start ( ) . catch ( ( e ) => {
11401144 if ( ! panelSession . closed ) toast ( e . message || "OAuth start failed" ) ;
0 commit comments