eslint 8.57 WIP:
* tweaking rules * fixing issues
This commit is contained in:
@ -60,8 +60,8 @@ async function initChat (video: Video): Promise<void> {
|
||||
return
|
||||
}
|
||||
|
||||
let showShareUrlButton: boolean = false
|
||||
let showPromote: boolean = false
|
||||
let showShareUrlButton = false
|
||||
let showPromote = false
|
||||
if (video.isLocal) { // No need for shareButton on remote chats.
|
||||
const chatShareUrl = settings['chat-share-url'] ?? ''
|
||||
if (chatShareUrl === 'everyone') {
|
||||
@ -187,9 +187,10 @@ async function _insertChatDom (
|
||||
callback: async () => {
|
||||
try {
|
||||
// First we must get the room JID (can be video.uuid@ or channel.id@)
|
||||
const url = getBaseRoute(ptContext.ptOptions) + '/api/configuration/room/' +
|
||||
encodeURIComponent(video.uuid)
|
||||
const response = await fetch(
|
||||
getBaseRoute(ptContext.ptOptions) + '/api/configuration/room/' +
|
||||
encodeURIComponent(video.uuid),
|
||||
url,
|
||||
{
|
||||
method: 'GET',
|
||||
headers: peertubeHelpers.getAuthHeader()
|
||||
@ -303,7 +304,7 @@ async function _openChat (video: Video): Promise<void | false> {
|
||||
|
||||
// Loading converseJS...
|
||||
await displayConverseJS(ptContext.ptOptions, container, roomkey, 'peertube-video', false)
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
// Displaying an error page.
|
||||
if (container) {
|
||||
const message = document.createElement('div')
|
||||
|
@ -14,7 +14,7 @@ import { getIframeUri, getXMPPAddr, UriOptions } from '../uri'
|
||||
import { isAnonymousUser } from '../../../utils/user'
|
||||
|
||||
// First is default tab.
|
||||
const validTabNames = ['embed', 'dock', 'peertube', 'xmpp'] as const
|
||||
const validTabNames: string[] = ['embed', 'dock', 'peertube', 'xmpp'] as const
|
||||
|
||||
type ValidTabNames = typeof validTabNames[number]
|
||||
|
||||
@ -61,49 +61,49 @@ export class ShareChatElement extends LivechatElement {
|
||||
* Should we render the XMPP tab?
|
||||
*/
|
||||
@property({ attribute: false })
|
||||
public xmppUriEnabled: boolean = false
|
||||
public xmppUriEnabled = false
|
||||
|
||||
/**
|
||||
* Should we render the Dock tab?
|
||||
*/
|
||||
@property({ attribute: false })
|
||||
public dockEnabled: boolean = false
|
||||
public dockEnabled = false
|
||||
|
||||
/**
|
||||
* Can we use autocolors?
|
||||
*/
|
||||
@property({ attribute: false })
|
||||
public autocolorsAvailable: boolean = false
|
||||
public autocolorsAvailable = false
|
||||
|
||||
/**
|
||||
* In the Embed tab, should we generated an iframe link.
|
||||
*/
|
||||
@property({ attribute: false })
|
||||
public embedIFrame: boolean = false
|
||||
public embedIFrame = false
|
||||
|
||||
/**
|
||||
* In the Embed tab, should we generated a read-only chat link.
|
||||
*/
|
||||
@property({ attribute: false })
|
||||
public embedReadOnly: boolean = false
|
||||
public embedReadOnly = false
|
||||
|
||||
/**
|
||||
* Read-only, with scrollbar?
|
||||
*/
|
||||
@property({ attribute: false })
|
||||
public embedReadOnlyScrollbar: boolean = false
|
||||
public embedReadOnlyScrollbar = false
|
||||
|
||||
/**
|
||||
* Read-only, transparent background?
|
||||
*/
|
||||
@property({ attribute: false })
|
||||
public embedReadOnlyTransparentBackground: boolean = false
|
||||
public embedReadOnlyTransparentBackground = false
|
||||
|
||||
/**
|
||||
* In the Embed tab, should we use current theme color?
|
||||
*/
|
||||
@property({ attribute: false })
|
||||
public embedAutocolors: boolean = false
|
||||
public embedAutocolors = false
|
||||
|
||||
protected override firstUpdated (changedProperties: PropertyValues): void {
|
||||
super.firstUpdated(changedProperties)
|
||||
@ -156,7 +156,7 @@ export class ShareChatElement extends LivechatElement {
|
||||
return
|
||||
}
|
||||
this.logger.log('Restoring previous state')
|
||||
if (validTabNames.includes(v.currentTab)) {
|
||||
if (validTabNames.includes(v.currentTab as string)) {
|
||||
this.currentTab = v.currentTab
|
||||
}
|
||||
this.embedIFrame = !!v.embedIFrame
|
||||
|
@ -2,6 +2,9 @@
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
// FIXME: @stylistic/indent is buggy with strings literrals.
|
||||
/* eslint-disable @stylistic/indent */
|
||||
|
||||
import type { ShareChatElement } from '../share-chat'
|
||||
import { html, TemplateResult } from 'lit'
|
||||
import { ptTr } from '../../../lib/directives/translation'
|
||||
|
@ -71,8 +71,7 @@ async function shareChatUrl (
|
||||
addedNodes.forEach(node => {
|
||||
if ((node as HTMLElement).localName === 'ngb-modal-window') {
|
||||
logger.info('Detecting a new modal, checking if this is the good one...')
|
||||
if (!(node as HTMLElement).querySelector) { return }
|
||||
const title = (node as HTMLElement).querySelector('.modal-title')
|
||||
const title = (node as HTMLElement).querySelector?.('.modal-title')
|
||||
if (!(title?.textContent === labelShare)) {
|
||||
return
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
||||
import type { Video } from '@peertube/peertube-types'
|
||||
import type { LiveChatSettings } from '../lib/contexts/peertube'
|
||||
import { AutoColors, isAutoColorsAvailable } from 'shared/lib/autocolors'
|
||||
import { getBaseRoute } from '../../utils/uri'
|
||||
import { logger } from '../../utils/logger'
|
||||
@ -17,7 +18,7 @@ interface UriOptions {
|
||||
}
|
||||
|
||||
function getIframeUri (
|
||||
registerOptions: RegisterClientOptions, settings: any, video: Video, uriOptions: UriOptions = {}
|
||||
registerOptions: RegisterClientOptions, settings: LiveChatSettings, video: Video, uriOptions: UriOptions = {}
|
||||
): string | null {
|
||||
if (!settings) {
|
||||
logger.error('Settings are not initialized, too soon to compute the iframeUri')
|
||||
|
Reference in New Issue
Block a user