Skip to content

Commit

Permalink
feat: display user descriptions (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusheine authored Nov 3, 2023
1 parent e4022b2 commit 6b318ee
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"clean": "rm -rf dist/ node_modules/",
"lint": "eslint --max-warnings 0 .",
"lint:format": "prettier --check .",
"start": "pnpm tsup src/index.ts --dts --format cjs,esm --watch",
"start": "pnpm tsup src/index.ts --dts --format cjs,esm --watch --onSuccess 'node dist/index.js'",
"test": "vitest run --coverage",
"test:watch": "vitest",
"typecheck": "tsc --noEmit",
Expand Down
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type ConfigUser = {
username: string;
email: string;
name: string;
description?: string;
};

export type Config = {
Expand Down Expand Up @@ -39,6 +40,7 @@ export function getConfig(): Config {
username: 'herbert',
email: 'her@bert.de',
name: 'Herbert',
description: 'This is our good old friend Herbert',
},
],
tokenExpiresIn: 24 * 60 * 60, // 24 hours in seconds
Expand Down
15 changes: 14 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ server.get(`/auth/realms/${config.realm}/protocol/openid-connect/auth`, async (r
padding: .5rem;
border-radius: .25rem;
}
li > div {
display: flex;
flex-direction: column;
}
</style>
</head>
<body>
Expand All @@ -71,7 +76,15 @@ server.get(`/auth/realms/${config.realm}/protocol/openid-connect/auth`, async (r
.map(
(user) =>
`<li>
<a href="/do-login?username=${user.username}&redirect_uri=${query.redirect_uri}">${user.name}</a>
<div>
<div>
<a href="/do-login?username=${user.username}&redirect_uri=${query.redirect_uri}">
${user.name}
</a>
(${user.email})
</div>
${user.description ? `<i>${user.description}</i>` : ''}
</div>
</li>`,
)
.join('')}
Expand Down

0 comments on commit 6b318ee

Please sign in to comment.