Skip to content

Commit

Permalink
Merge pull request #49 from solid/feature/show-local-provider
Browse files Browse the repository at this point in the history
Show IDP button for current host
  • Loading branch information
RubenVerborgh committed Jul 16, 2018
2 parents 2312bdd + af2bd3e commit 909958b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion popup-app/index.js
Expand Up @@ -11,7 +11,7 @@ import NoParent from './components/NoParent'

import './index.css'

const idps = [
const defaultIdps = [
{
displayName: 'Solid Community',
url: 'https://solid.community/',
Expand All @@ -38,6 +38,15 @@ findAppOrigin().then(appOrigin => {
/>
)
} else {
const currentHost = window.location.href.replace(/(\/\/[^/]*\/).*/, '$1')
const idps = [...defaultIdps]
if (!idps.some(idp => idp.url === currentHost)) {
idps.unshift({
displayName: currentHost.replace(/^[^:]+:|\//g, ''),
url: currentHost,
iconUrl: currentHost + 'favicon.ico'
})
}
element = <IdpSelect idps={idps} appOrigin={appOrigin} appName={appName} />
}

Expand Down

0 comments on commit 909958b

Please sign in to comment.