diff --git a/src/App.svelte b/src/App.svelte index dcbf67b..740f9cd 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -9,6 +9,7 @@ let readFromLocalStorage = false; let darkMode = false; let highlighter; + let isHelloMode = false; const scopes = { standard: [ @@ -22,25 +23,27 @@ 'given_name', 'family_name' ], - // update: ['update_profile', 'update_email', 'update_phone', 'update_picture'], + pi_standard: ['preferred_username'], custom: ['ethereum', 'discord', 'twitter', 'github', 'gitlab'], - required: ['openid'], - claims: [ - 'sub', - 'name', - 'nickname', - 'given_name', - 'family_name', - 'email', - 'phone', - 'picture', - 'ethereum', - 'discord', - 'twitter', - 'github', - 'gitlab' - ] + pi_custom: [ + // "mastodon", + // "instagram", + // "bio", + // "banner", + 'recovery', + 'verified_name', + 'existing_name', + 'existing_username' + ], + required: ['openid'] }; + scopes.claims = [ + 'sub', + ...scopes.standard, + ...scopes.pi_standard, + ...scopes.custom, + ...scopes.pi_custom + ]; const possibleSlugs = [ 'apple', @@ -61,8 +64,8 @@ 'ethereum', 'qrcode', 'passkey' - // 'managed' ]; + const pi_possibleSlugs = ['managed']; let invalidProviderHintSlug = null; let debounceTimer; @@ -75,7 +78,7 @@ const providerHintsArr = states.query_param_values?.provider_hint?.split(' '); const invalidSlugs = providerHintsArr .map((i) => i.replace('--', '')) - .filter((i) => !possibleSlugs.includes(i) && i); + .filter((i) => ![...possibleSlugs, ...(isHelloMode ? pi_possibleSlugs : [])].includes(i) && i); if (invalidSlugs?.length) { invalidProviderHintSlug = Array.from(invalidSlugs); @@ -105,6 +108,9 @@ const _states = JSON.stringify(states); localStorage.setItem('states', _states); } + + isHelloMode = !!localStorage.plausible_ignore; + readFromLocalStorage = true; processFragmentOrQuery(); @@ -112,28 +118,6 @@ sendEvent(); - if (localStorage.plausible_ignore == 'true') { - const _standard_scopes = ['preferred_username']; - const _custom_scopes = [ - // "twitter", - // "github", - // "gitlab", - // "mastodon", - // "instagram", - // "bio", - // "banner", - 'recovery', - 'verified_name', - 'existing_name', - 'existing_username' - ]; - scopes.standard = [...scopes.standard, ..._standard_scopes]; - scopes.custom = [...scopes.custom, ..._custom_scopes]; - scopes.claims = [...scopes.claims, ..._standard_scopes, ..._custom_scopes]; - protocolParams.params.passkeys = states.protocol_param_values.passkeys = 'global'; - queryParams.params.account = ['personal', 'managed']; - } - if ( !['https://wallet.hello.coop/authorize', ...states.custom_authorization_servers].includes( states.selected_authorization_server @@ -181,6 +165,9 @@ params: { provider_hint: '' }, + pi_params: { + account: ['personal', 'managed'] + }, required: [] }; const protocolParams = { @@ -198,6 +185,9 @@ scope: '', custom: '' }, + pi_params: { + passkeys: 'global' + }, required: ['client_id', 'redirect_uri', 'nonce', 'response_type'] }; @@ -245,7 +235,8 @@ redirect_uri: window.location.origin + '/', response_mode: 'fragment', response_type: 'id_token', - prompt: ['consent'] + prompt: ['consent'], + passkeys: 'global' }, dropdowns: { scopeParam: true, @@ -365,7 +356,7 @@ window.location.href = _requestUrl; } catch (err) { console.error(err); - errorNotification = 'Invalid Issuer URL'; + errorNotification = 'Error fetching ' + iss + '/.well-known/openid-configuration'; } } if (initiate_login) { @@ -704,7 +695,7 @@ }); async function sendEvent() { - if (localStorage.getItem('plausible_ignore') == 'true') { + if (isHelloMode) { console.info('Ignoring Event: localStorage flag'); return; } @@ -798,9 +789,6 @@ - {#if localStorage.plausible_ignore} - devM0de - {/if}