diff --git a/CHANGELOG.md b/CHANGELOG.md index dbadeb81..a39cc63a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,25 @@ # Changelog +## (unreleased yet) + +### Fixes + +* Fix spanish translation. +* Hide secret keys in diagnostic tool. + +## v5.0.2 + +### Fixes + +* Fix some cases where the chat immediatly close (Peertube events are not fired in the good order). + ## v5.0.1 ### Breaking changes * If you have some CSS customization for the plugin, it may be broken. * Auto color detection can have bad result for some Peertube themes. If so, you can disable it in the settings. -* Note: if updating the plugin to v5.0.1 fails with an error like `Cannot find module 'validate-color'`, try to restart peertube, then install/update the plugin. See https://github.com/Chocobozzz/PeerTube/issues/4593 +* Note: if updating the plugin to v5.0.1 fails with an error like `Cannot find module 'validate-color'`, try to restart peertube, then install/update the plugin. See ### Features diff --git a/ROADMAP.md b/ROADMAP.md index 1fbc3419..876e8994 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -39,3 +39,4 @@ This roadmap is given as an indication. It will be updated as we go along accord [ ] | Builtin Prosody | Add on option to limit webchat to registered users. [x] | Builtin Prosody (or all modes?) | Offer a way for users to have a webchat per channel. See [#59](https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/58). | v4.0.0 [ ] | Common | Handle federation: if video is remote, then try to check if the plugin is installed on the instance, and open it. +[ ] | Builtin Prosody | Moderation Bot. diff --git a/client/common-client-plugin.ts b/client/common-client-plugin.ts index e5c40d82..6bee6279 100644 --- a/client/common-client-plugin.ts +++ b/client/common-client-plugin.ts @@ -5,6 +5,15 @@ async function register ({ peertubeHelpers, registerHook, registerVideoField }: handler: () => { const container = document.querySelector('#peertube-plugin-livechat-container') if (container) { + const url = container.getAttribute('peertube-plugin-livechat-current-url') + if (url && url === window.location.href) { + console.warn( + '[peertube-plugin-livechat navigation-end] ' + + 'It seems that action:router.navigation-end was called after action:video-watch.video.loaded. ' + + 'No removing the chat from the DOM.' + ) + return + } container.remove() } } diff --git a/client/videowatch-client-plugin.ts b/client/videowatch-client-plugin.ts index ef888934..db017173 100644 --- a/client/videowatch-client-plugin.ts +++ b/client/videowatch-client-plugin.ts @@ -289,6 +289,7 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void { container = document.createElement('div') container.setAttribute('id', 'peertube-plugin-livechat-container') container.setAttribute('peertube-plugin-livechat-state', 'initializing') + container.setAttribute('peertube-plugin-livechat-current-url', window.location.href) placeholder.append(container) peertubeHelpers.getSettings().then((s: any) => { diff --git a/documentation/prosody.md b/documentation/prosody.md index 8f567a70..8efa2a04 100644 --- a/documentation/prosody.md +++ b/documentation/prosody.md @@ -116,3 +116,9 @@ If the video is local (not from a remote Peertube), the video owner will be admi You can use [ConverseJS moderation commands](https://conversejs.org/docs/html/features.html#moderating-chatrooms) to moderate the room. When you open the chat room in full screen, there will also be a menu with dedicated commands on the top right. + +## Advanced usages + +### OBS Overlay using Matterbridge + +Here is a tutorial to use Matterbridge with the plugin: diff --git a/languages/es.json b/languages/es.json index 9b4df245..1e71fce2 100644 --- a/languages/es.json +++ b/languages/es.json @@ -1,7 +1,7 @@ { - "Open chat": "Abrir el chat.", - "Open chat in a new window": "Abrir el chat en otra ventana.", - "Close chat": "Cerrar el chat.", - "Use chat": "Habilitar el chat.", - "If enabled, there will be a chat next to the video.": "Activado, abre el chat junto al vídeo." + "Open chat": "Abrir el chat", + "Open chat in a new window": "Abrir el chat en otra ventana", + "Close chat": "Cerrar el chat", + "Use chat": "Habilitar el chat", + "If enabled, there will be a chat next to the video.": "Activado, abre el chat junto al vídeo" } diff --git a/package-lock.json b/package-lock.json index 844d9fab..5e4dde69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "peertube-plugin-livechat", - "version": "5.0.1", + "version": "5.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 99a07a5b..7481786b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "peertube-plugin-livechat", "description": "PeerTube plugin livechat: offers a way to embed a chat system into Peertube.", - "version": "5.0.1", + "version": "5.0.2", "author": { "name": "John Livingston", "url": "https://github.com/JohnXLivingston" diff --git a/server/lib/diagnostic/prosody.ts b/server/lib/diagnostic/prosody.ts index 6488e07f..6990339d 100644 --- a/server/lib/diagnostic/prosody.ts +++ b/server/lib/diagnostic/prosody.ts @@ -1,4 +1,4 @@ -import { getProsodyConfig, getWorkingDir } from '../prosody/config' +import { getProsodyConfig, getProsodyConfigContentForDiagnostic, getWorkingDir } from '../prosody/config' import { getProsodyAbout, testProsodyCorrectlyRunning } from '../prosody/ctl' import { newResult, TestResult } from './utils' import { getAPIKey } from '../apikey' @@ -58,7 +58,10 @@ export async function diagProsody (test: string, options: RegisterServerOptions) result.debug.push({ title: 'Current prosody configuration', - message: actualContent + // we have to hide secret keys and other values. + // But here, we haven't them for actualContent. + // So we will use values in wantedConfig, hopping it is enough. + message: getProsodyConfigContentForDiagnostic(wantedConfig, actualContent) }) const wantedContent = wantedConfig.content @@ -68,7 +71,8 @@ export async function diagProsody (test: string, options: RegisterServerOptions) result.messages.push('Prosody configuration file content is not correct.') result.debug.push({ title: 'Prosody configuration should be', - message: wantedContent + // we have to hide secret keys and other values: + message: getProsodyConfigContentForDiagnostic(wantedConfig) }) return result } diff --git a/server/lib/prosody/config.ts b/server/lib/prosody/config.ts index 577b0c7f..cab7285e 100644 --- a/server/lib/prosody/config.ts +++ b/server/lib/prosody/config.ts @@ -72,25 +72,38 @@ interface ProsodyConfig { roomType: 'video' | 'channel' logByDefault: boolean logExpiration: ConfigLogExpiration + valuesToHideInDiagnostic: {[key: string]: string} } async function getProsodyConfig (options: RegisterServerOptions): Promise { const logger = options.peertubeHelpers.logger logger.debug('Calling getProsodyConfig') - const port = (await options.settingsManager.getSetting('prosody-port') as string) || '52800' + const settings = await options.settingsManager.getSettings([ + 'prosody-port', + 'prosody-muc-log-by-default', + 'prosody-muc-expiration', + 'prosody-c2s', + 'prosody-room-type', + 'prosody-peertube-uri', + 'prosody-c2s-port' + ]) + + const valuesToHideInDiagnostic: {[key: string]: string} = {} + const port = (settings['prosody-port'] as string) || '52800' if (!/^\d+$/.test(port)) { throw new Error('Invalid port') } - const logByDefault = (await options.settingsManager.getSetting('prosody-muc-log-by-default') as boolean) ?? true - const logExpirationSetting = - (await options.settingsManager.getSetting('prosody-muc-expiration') as string) ?? DEFAULTLOGEXPIRATION - const enableC2s = (await options.settingsManager.getSetting('prosody-c2s') as boolean) || false + const logByDefault = (settings['prosody-muc-log-by-default'] as boolean) ?? true + const logExpirationSetting = (settings['prosody-muc-expiration'] as string) ?? DEFAULTLOGEXPIRATION + const enableC2s = (settings['prosody-c2s'] as boolean) || false const prosodyDomain = await getProsodyDomain(options) const paths = await getProsodyFilePaths(options) - const roomType = (await options.settingsManager.getSetting('prosody-room-type')) === 'channel' ? 'channel' : 'video' + const roomType = settings['prosody-room-type'] === 'channel' ? 'channel' : 'video' const apikey = await getAPIKey(options) - let baseApiUrl = await options.settingsManager.getSetting('prosody-peertube-uri') as string + valuesToHideInDiagnostic.APIKey = apikey + + let baseApiUrl = settings['prosody-peertube-uri'] as string if (baseApiUrl && !/^https?:\/\/[a-z0-9.-_]+(?::\d+)?$/.test(baseApiUrl)) { throw new Error('Invalid prosody-peertube-uri') } @@ -109,7 +122,7 @@ async function getProsodyConfig (options: RegisterServerOptions): Promise