Simpler settings screen (tips, help, titles, ...)

This commit is contained in:
John Livingston 2021-06-03 12:20:19 +02:00
parent 22f7423f50
commit 5e69474234
3 changed files with 49 additions and 44 deletions

View File

@ -50,3 +50,7 @@
min-height: 30vh; min-height: 30vh;
height: 100%; height: 100%;
} }
.peertube-plugin-livechat-warning {
color: orange;
}

View File

@ -21,6 +21,8 @@ function register ({ registerSettingsScript }: RegisterOptions): void {
return options.formValues['chat-type'] !== ('external-uri' as ChatType) return options.formValues['chat-type'] !== ('external-uri' as ChatType)
case 'chat-style': case 'chat-style':
return options.formValues['chat-type'] === 'disabled' return options.formValues['chat-type'] === 'disabled'
case 'chat-only-locals-warning':
return options.formValues['chat-only-locals'] === true
} }
return false return false

View File

@ -5,57 +5,38 @@ import type { ChatType } from '../../shared/lib/types'
function initSettings (options: RegisterServerOptions): void { function initSettings (options: RegisterServerOptions): void {
const { peertubeHelpers, registerSetting, settingsManager } = options const { peertubeHelpers, registerSetting, settingsManager } = options
// ********** IMPORTANT NOTES
registerSetting({ registerSetting({
name: 'chat-read-documentation', type: 'html',
label: 'I have read the documentation', private: true,
type: 'input-checkbox', descriptionHTML: '<h3>Important notes</h3>'
default: false, })
private: false, // not private so that I can check when doing support registerSetting({
descriptionHTML: ` type: 'html',
Please read the private: true,
descriptionHTML: `Please read the
<a href="https://github.com/JohnXLivingston/peertube-plugin-livechat/blob/main/README.md" target="_blank"> <a href="https://github.com/JohnXLivingston/peertube-plugin-livechat/blob/main/README.md" target="_blank">
documentation documentation
</a> </a> before trying to use this plugin.`
before trying to use this plugin.<br> })
There is 3 way to use it: registerSetting({
<ul> type: 'html',
<li> private: true,
By installing the Prosoxy XMPP server package on your server, descriptionHTML: `Before asking for help, please use the diagnostic tool:
and using the «builtin Prosody XMPP Server» feature.
<a
href="https://github.com/JohnXLivingston/peertube-plugin-livechat/blob/main/documentation/prosody.md"
target="_blank"
>
See Documentation
</a>
</li>
<li>
By using an existing XMPP server, with anonymous authentication and rooms enabled.
<a
href="https://github.com/JohnXLivingston/peertube-plugin-livechat/blob/main/documentation/conversejs.md"
target="_blank"
>
See Documentation
</a>
</li>
<li>
By using any external webchat that can be included in an iframe.
<a
href="https://github.com/JohnXLivingston/peertube-plugin-livechat/blob/main/documentation/external.md"
target="_blank"
>
See Documentation
</a>
</li>
</ul>
<br>
Before asking for help, please use this diagnostic tool:
<a href="${getBaseRouterRoute(options)}settings/diagnostic" target="_blank">Launch diagnostic</a> <a href="${getBaseRouterRoute(options)}settings/diagnostic" target="_blank">Launch diagnostic</a>
<br>` <br>`
}) })
// ********** Chat behaviour
registerSetting({
type: 'html',
private: true,
descriptionHTML: '<h3>Chat behaviour</h3>'
})
registerSetting({ registerSetting({
name: 'chat-auto-display', name: 'chat-auto-display',
label: 'Automatically open the chat', label: 'Automatically open the chat',
descriptionHTML: 'When watching a video, the chatbox will automatically open',
type: 'input-checkbox', type: 'input-checkbox',
default: true, default: true,
private: false private: false
@ -63,6 +44,7 @@ Before asking for help, please use this diagnostic tool:
registerSetting({ registerSetting({
name: 'chat-open-blank', name: 'chat-open-blank',
label: 'Show the «open in new window» button', label: 'Show the «open in new window» button',
descriptionHTML: 'There will be a button for opening the webchat in a new window.',
private: false, private: false,
type: 'input-checkbox', type: 'input-checkbox',
default: true default: true
@ -70,16 +52,27 @@ Before asking for help, please use this diagnostic tool:
registerSetting({ registerSetting({
name: 'chat-only-locals', name: 'chat-only-locals',
label: 'Chats are only available for local videos.', 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', type: 'input-checkbox',
default: true, default: true,
private: false private: false
}) })
registerSetting({
name: 'chat-only-locals-warning',
type: 'html',
private: true,
descriptionHTML: `
<span class="peertube-plugin-livechat-warning">
The plugin is not compatible with video federation yet.
The webchat will only be accessible for people watching videos on your server.
</span>`
})
registerSetting({ registerSetting({
name: 'chat-all-lives', name: 'chat-all-lives',
label: 'Activate chat for all lives', label: 'Activate chat for all lives',
type: 'input-checkbox', type: 'input-checkbox',
default: true, 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 private: false
}) })
registerSetting({ registerSetting({
@ -87,7 +80,7 @@ Before asking for help, please use this diagnostic tool:
label: 'Activate chat for all non-lives', label: 'Activate chat for all non-lives',
type: 'input-checkbox', type: 'input-checkbox',
default: false, 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 private: false
}) })
registerSetting({ registerSetting({
@ -102,6 +95,12 @@ Before asking for help, please use this diagnostic tool:
private: false private: false
}) })
// ********** Chat Mode
registerSetting({
type: 'html',
private: true,
descriptionHTML: '<h3>Chat mode</h3>'
})
registerSetting({ registerSetting({
name: 'chat-type', name: 'chat-type',
label: 'Webchat mode', label: 'Webchat mode',