From a9b6474b8fd5fb5e4a99cef26232668f158543e3 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Mon, 17 Jun 2024 14:54:29 +0200 Subject: [PATCH] Authentication token generation WIP (#98) First working version. --- assets/styles/elements/_token-list.scss | 12 +++++ client/@types/global.d.ts | 2 +- .../lib/elements/templates/token-list.ts | 23 ++++++--- client/common/lib/elements/token-list.ts | 10 +++- .../common/videowatch/elements/share-chat.ts | 49 +++++++++++-------- .../elements/templates/share-chat.ts | 9 +++- languages/en.yml | 2 +- 7 files changed, 75 insertions(+), 32 deletions(-) diff --git a/assets/styles/elements/_token-list.scss b/assets/styles/elements/_token-list.scss index cd6281bc..0f80b15e 100644 --- a/assets/styles/elements/_token-list.scss +++ b/assets/styles/elements/_token-list.scss @@ -10,6 +10,18 @@ livechat-token-list { table { @include tables.data-table; + + width: 100%; + + tr th:first-child, + tr th:last-child { + width: 50px; + } + + label { + // Reset some styles set by peertube + font-weight: inherit; + } } .livechat-create-token { diff --git a/client/@types/global.d.ts b/client/@types/global.d.ts index ff3d961a..de85adaf 100644 --- a/client/@types/global.d.ts +++ b/client/@types/global.d.ts @@ -116,8 +116,8 @@ declare const LOC_SHARE_CHAT_PEERTUBE_TIPS: string declare const LOC_SHARE_CHAT_DOCK: string declare const LOC_SHARE_CHAT_DOCK_TIPS: string declare const LOC_TOKEN_LABEL: string -declare const LOC_TOKEN_JID: string declare const LOC_TOKEN_PASSWORD: string declare const LOC_TOKEN_ACTION_CREATE: string declare const LOC_TOKEN_ACTION_REVOKE: string declare const LOC_TOKEN_DEFAULT_LABEL: string +declare const LOC_TOKEN_ACTION_REVOKE_CONFIRM: string diff --git a/client/common/lib/elements/templates/token-list.ts b/client/common/lib/elements/templates/token-list.ts index 7ce9e3b6..063c5638 100644 --- a/client/common/lib/elements/templates/token-list.ts +++ b/client/common/lib/elements/templates/token-list.ts @@ -16,7 +16,6 @@ export function tplTokenList (el: LivechatTokenListElement): TemplateResult { ${ptTr(LOC_TOKEN_LABEL)} - ${ptTr(LOC_TOKEN_JID)} ${ptTr(LOC_TOKEN_PASSWORD)} @@ -24,19 +23,29 @@ export function tplTokenList (el: LivechatTokenListElement): TemplateResult { ${ repeat(el.tokenList ?? [], (token) => token.id, (token) => { - html` + return html` ${ el.mode === 'select' ? html` el.selectToken(ev, token)} />` : '' } - ${token.label} - ${token.jid} - ${token.password} + + + + + +