Authentication token generation WIP (#98)

You can now generate links to join chatrooms with your current user. This can be used to create Docks in OBS for example. This could also be used to generate authentication token to join the chat from 3rd party tools.
This commit is contained in:
John Livingston
2024-06-16 19:48:02 +02:00
parent e83150cf87
commit 90afdafbd9
24 changed files with 988 additions and 205 deletions

View File

@ -22,7 +22,11 @@ export function tplShareChatCopy (el: ShareChatElement): TemplateResult {
input.setSelectionRange(0, 99999) /* For mobile devices */
}}
/>
<button type="button" class="btn btn-outline-secondary text-uppercase" @click=${el.copyUrl}>
<button
type="button" class="btn btn-outline-secondary text-uppercase"
@click=${el.copyUrl}
?disabled=${!computedUrl.shareString}
>
${ptTr(LOC_COPY)}
</button>
<button
@ -60,6 +64,11 @@ export function tplShareChatTabs (el: ShareChatElement): TemplateResult {
return html`
${_tplShareChatTab(el, 'peertube', LOC_WEB)}
${_tplShareChatTab(el, 'embed', LOC_SHARE_CHAT_EMBED)}
${
el.dockEnabled
? _tplShareChatTab(el, 'dock', LOC_SHARE_CHAT_DOCK)
: ''
}
${
el.xmppUriEnabled
? _tplShareChatTab(el, 'xmpp', LOC_CONNECT_USING_XMPP)
@ -79,6 +88,10 @@ export function tplShareChatTips (el: ShareChatElement): TemplateResult {
label = LOC_TIPS_FOR_STREAMERS
tips = html`<livechat-help-button .page=${'documentation/user/obs'}></livechat-help-button>`
break
case 'dock':
label = LOC_SHARE_CHAT_DOCK_TIPS
tips = html`<livechat-help-button .page=${'documentation/user/obs'}></livechat-help-button>`
break
case 'xmpp':
label = LOC_CONNECT_USING_XMPP_HELP
break
@ -154,6 +167,10 @@ function _tplShareChatEmbedOptions (el: ShareChatElement): TemplateResult {
`
}
function _tplShareChatDockOptions (_el: ShareChatElement): TemplateResult {
return html`<livechat-token-list mode="select"></livechat-token-list>`
}
function _tplShareChatXMPPOptions (_el: ShareChatElement): TemplateResult {
return html``
}
@ -167,6 +184,9 @@ export function tplShareChatOptions (el: ShareChatElement): TemplateResult {
case 'embed':
tpl = _tplShareChatEmbedOptions(el)
break
case 'dock':
tpl = _tplShareChatDockOptions(el)
break
case 'xmpp':
tpl = _tplShareChatXMPPOptions(el)
break