From 5e69474234760f6f0b3a977c3a4f690e0ab9fd56 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Thu, 3 Jun 2021 12:20:19 +0200 Subject: [PATCH] Simpler settings screen (tips, help, titles, ...) --- assets/style.css | 4 ++ client/admin-plugin-client-plugin.ts | 2 + server/lib/settings.ts | 87 ++++++++++++++-------------- 3 files changed, 49 insertions(+), 44 deletions(-) diff --git a/assets/style.css b/assets/style.css index 6dd036c1..e5daefed 100644 --- a/assets/style.css +++ b/assets/style.css @@ -50,3 +50,7 @@ min-height: 30vh; height: 100%; } + +.peertube-plugin-livechat-warning { + color: orange; +} \ No newline at end of file diff --git a/client/admin-plugin-client-plugin.ts b/client/admin-plugin-client-plugin.ts index 615ae91f..44a39664 100644 --- a/client/admin-plugin-client-plugin.ts +++ b/client/admin-plugin-client-plugin.ts @@ -21,6 +21,8 @@ function register ({ registerSettingsScript }: RegisterOptions): void { return options.formValues['chat-type'] !== ('external-uri' as ChatType) case 'chat-style': return options.formValues['chat-type'] === 'disabled' + case 'chat-only-locals-warning': + return options.formValues['chat-only-locals'] === true } return false diff --git a/server/lib/settings.ts b/server/lib/settings.ts index 5c9b5479..b5426bcd 100644 --- a/server/lib/settings.ts +++ b/server/lib/settings.ts @@ -5,57 +5,38 @@ import type { ChatType } from '../../shared/lib/types' function initSettings (options: RegisterServerOptions): void { const { peertubeHelpers, registerSetting, settingsManager } = options + // ********** IMPORTANT NOTES registerSetting({ - name: 'chat-read-documentation', - label: 'I have read the documentation', - type: 'input-checkbox', - default: false, - private: false, // not private so that I can check when doing support - descriptionHTML: ` -Please read the + type: 'html', + private: true, + descriptionHTML: '

Important notes

' + }) + registerSetting({ + type: 'html', + private: true, + descriptionHTML: `Please read the documentation - -before trying to use this plugin.
-There is 3 way to use it: - -
-Before asking for help, please use this diagnostic tool: + before trying to use this plugin.` + }) + registerSetting({ + type: 'html', + private: true, + descriptionHTML: `Before asking for help, please use the diagnostic tool: Launch diagnostic
` }) + + // ********** Chat behaviour + registerSetting({ + type: 'html', + private: true, + descriptionHTML: '

Chat behaviour

' + }) registerSetting({ name: 'chat-auto-display', label: 'Automatically open the chat', + descriptionHTML: 'When watching a video, the chatbox will automatically open', type: 'input-checkbox', default: true, private: false @@ -63,6 +44,7 @@ Before asking for help, please use this diagnostic tool: registerSetting({ name: 'chat-open-blank', label: 'Show the «open in new window» button', + descriptionHTML: 'There will be a button for opening the webchat in a new window.', private: false, type: 'input-checkbox', default: true @@ -70,16 +52,27 @@ Before asking for help, please use this diagnostic tool: registerSetting({ name: 'chat-only-locals', label: 'Chats are only available for local videos.', + descriptionHTML: 'If you uncheck this settings, the chat will also be enabled on remote videos.', type: 'input-checkbox', default: true, private: false }) + registerSetting({ + name: 'chat-only-locals-warning', + type: 'html', + private: true, + descriptionHTML: ` + + The plugin is not compatible with video federation yet. + The webchat will only be accessible for people watching videos on your server. +` + }) registerSetting({ name: 'chat-all-lives', label: 'Activate chat for all lives', type: 'input-checkbox', default: true, - descriptionHTML: 'If checked, a chat will be added to all lives.', + descriptionHTML: 'If checked, the chat will be enabled for all lives.', private: false }) registerSetting({ @@ -87,7 +80,7 @@ Before asking for help, please use this diagnostic tool: label: 'Activate chat for all non-lives', type: 'input-checkbox', default: false, - descriptionHTML: 'If checked, a chat will be added to all video that are not lives.', + descriptionHTML: 'If checked, the chat will be enable for all video that are not lives.', private: false }) registerSetting({ @@ -102,6 +95,12 @@ Before asking for help, please use this diagnostic tool: private: false }) + // ********** Chat Mode + registerSetting({ + type: 'html', + private: true, + descriptionHTML: '

Chat mode

' + }) registerSetting({ name: 'chat-type', label: 'Webchat mode',