thelounge/client/components/Windows/Settings.vue

476 lines
11 KiB
Vue
Raw Normal View History

2019-02-18 09:18:32 +00:00
<template>
<div
id="settings"
class="window"
role="tabpanel"
2019-03-01 14:18:16 +00:00
aria-label="Settings"
>
2019-02-18 09:18:32 +00:00
<div class="header">
<button
class="lt"
2019-03-01 14:18:16 +00:00
aria-label="Toggle channel list"
/>
2019-02-18 09:18:32 +00:00
</div>
<div class="container">
<h1 class="title">Settings</h1>
<div class="row">
<div class="col-sm-6">
<label class="opt">
<input
type="checkbox"
2019-03-01 14:18:16 +00:00
name="advanced"
>
2019-02-18 09:18:32 +00:00
Advanced settings
</label>
</div>
</div>
<div class="row">
<div
id="native-app"
class="col-sm-12"
2019-03-01 14:18:16 +00:00
hidden
>
2019-02-18 09:18:32 +00:00
<h2>Native app</h2>
<button
id="webapp-install-button"
type="button"
class="btn"
2019-03-01 14:18:16 +00:00
hidden
>Add The Lounge to Home screen</button>
2019-02-18 09:18:32 +00:00
<button
id="make-default-client"
type="button"
2019-03-01 14:18:16 +00:00
class="btn"
>Open irc:// URLs with The Lounge</button>
2019-02-18 09:18:32 +00:00
</div>
<div
2019-02-20 09:10:18 +00:00
v-if="!this.$root.serverConfiguration.public"
2019-02-18 09:18:32 +00:00
class="col-sm-12"
2019-03-01 14:18:16 +00:00
data-advanced
>
2019-02-18 09:18:32 +00:00
<h2>
Settings synchronisation
<span
class="tooltipped tooltipped-n tooltipped-no-delay"
2019-03-01 14:18:16 +00:00
aria-label="Note: This is an experimental feature and may change in future releases."
>
2019-02-18 09:18:32 +00:00
<button
class="extra-experimental"
2019-03-01 14:18:16 +00:00
aria-label="Note: This is an experimental feature and may change in future releases."
/>
2019-02-18 09:18:32 +00:00
</span>
</h2>
<label class="opt">
<input
type="checkbox"
2019-03-01 14:18:16 +00:00
name="syncSettings"
>
2019-02-18 09:18:32 +00:00
Synchronize settings with other clients.
</label>
<p class="sync-warning-override"><strong>Warning</strong> Checking this box will override the settings of this client with those stored on the server.</p>
<p class="sync-warning-base"><strong>Warning</strong> No settings have been synced before. Enabling this will sync all settings of this client as the base for other clients.</p>
<div class="opt force-sync-button">
<button
type="button"
2019-02-20 09:10:18 +00:00
class="btn"
2019-03-01 14:18:16 +00:00
@click="onForceSyncClick"
>Force sync settings</button>
2019-02-18 09:18:32 +00:00
<p>This will override any settings already synced to the server.</p>
</div>
</div>
2019-02-20 09:10:18 +00:00
2019-02-18 09:18:32 +00:00
<div class="col-sm-12">
<h2>Messages</h2>
</div>
<div class="col-sm-6">
<label class="opt">
<input
type="checkbox"
2019-03-01 14:18:16 +00:00
name="motd"
>
2019-02-18 09:18:32 +00:00
Show <abbr title="Message Of The Day">MOTD</abbr>
</label>
</div>
<div class="col-sm-6">
<label class="opt">
<input
type="checkbox"
2019-03-01 14:18:16 +00:00
name="showSeconds"
>
2019-02-18 09:18:32 +00:00
Show seconds in timestamp
</label>
</div>
<div class="col-sm-12">
<h2>
Status messages
<span
class="tooltipped tooltipped-n tooltipped-no-delay"
2019-03-01 14:18:16 +00:00
aria-label="Joins, parts, kicks, nick changes, away changes, and mode changes"
>
2019-02-18 09:18:32 +00:00
<button
class="extra-help"
2019-03-01 14:18:16 +00:00
aria-label="Joins, parts, kicks, nick changes, away changes, and mode changes"
/>
2019-02-18 09:18:32 +00:00
</span>
</h2>
</div>
<div class="col-sm-12">
<label class="opt">
<input
type="radio"
name="statusMessages"
2019-03-01 14:18:16 +00:00
value="shown"
>
2019-02-18 09:18:32 +00:00
Show all status messages individually
</label>
<label class="opt">
<input
type="radio"
name="statusMessages"
2019-03-01 14:18:16 +00:00
value="condensed"
>
2019-02-18 09:18:32 +00:00
Condense status messages together
</label>
<label class="opt">
<input
type="radio"
name="statusMessages"
2019-03-01 14:18:16 +00:00
value="hidden"
>
2019-02-18 09:18:32 +00:00
Hide all status messages
</label>
</div>
<div class="col-sm-12">
<h2>Visual Aids</h2>
</div>
<div class="col-sm-12">
<label class="opt">
<input
type="checkbox"
2019-03-01 14:18:16 +00:00
name="coloredNicks"
>
2019-02-18 09:18:32 +00:00
Enable colored nicknames
</label>
<label class="opt">
<input
type="checkbox"
2019-03-01 14:18:16 +00:00
name="autocomplete"
>
2019-02-18 09:18:32 +00:00
Enable autocomplete
</label>
</div>
<div
class="col-sm-12"
2019-03-01 14:18:16 +00:00
data-advanced
>
2019-02-18 09:18:32 +00:00
<label class="opt">
<label
for="nickPostfix"
2019-03-01 14:18:16 +00:00
class="sr-only"
>Nick autocomplete postfix (e.g. <code>, </code>)</label>
2019-02-18 09:18:32 +00:00
<input
id="nickPostfix"
type="text"
name="nickPostfix"
class="input"
2019-03-01 14:18:16 +00:00
placeholder="Nick autocomplete postfix (e.g. ', ')"
>
2019-02-18 09:18:32 +00:00
</label>
</div>
<div class="col-sm-12">
<h2>Theme</h2>
</div>
<div class="col-sm-12">
<label
for="theme-select"
2019-03-01 14:18:16 +00:00
class="sr-only"
>Theme</label>
2019-02-18 09:18:32 +00:00
<select
id="theme-select"
name="theme"
2019-03-01 14:18:16 +00:00
class="input"
>
2019-02-20 09:10:18 +00:00
<option
v-for="theme in this.$root.serverConfiguration.themes"
2019-03-01 14:18:16 +00:00
:key="theme.name"
>
2019-02-20 09:10:18 +00:00
{{ theme.displayName }}
2019-02-18 09:18:32 +00:00
</option>
</select>
</div>
2019-02-20 09:10:18 +00:00
<template v-if="this.$root.serverConfiguration.prefetch">
<div class="col-sm-12">
<h2>Link previews</h2>
2019-02-18 09:18:32 +00:00
</div>
2019-02-20 09:10:18 +00:00
<div class="col-sm-6">
<label class="opt">
<input
type="checkbox"
2019-03-01 14:18:16 +00:00
name="media"
>
2019-02-20 09:10:18 +00:00
Auto-expand media
</label>
2019-02-18 09:18:32 +00:00
</div>
2019-02-20 09:10:18 +00:00
<div class="col-sm-6">
<label class="opt">
<input
type="checkbox"
2019-03-01 14:18:16 +00:00
name="links"
>
2019-02-20 09:10:18 +00:00
Auto-expand websites
</label>
</div>
</template>
<template v-if="!this.$root.serverConfiguration.public">
<div class="col-sm-12">
<h2>Push Notifications</h2>
</div>
<div class="col-sm-12">
<button
id="pushNotifications"
type="button"
class="btn"
disabled
2019-03-01 14:18:16 +00:00
data-text-alternate="Unsubscribe from push notifications"
>Subscribe to push notifications</button>
2019-02-20 09:10:18 +00:00
<div
v-if="this.$root.pushNotificationState === 'nohttps'"
2019-03-01 14:18:16 +00:00
class="error"
>
2019-02-20 09:10:18 +00:00
<strong>Warning</strong>:
Push notifications are only supported over HTTPS connections.
</div>
<div
v-if="this.$root.pushNotificationState === 'unsupported'"
2019-03-01 14:18:16 +00:00
class="error"
>
2019-02-20 09:10:18 +00:00
<strong>Warning</strong>:
<span>Push notifications are not supported by your browser.</span>
</div>
</div>
</template>
2019-02-18 09:18:32 +00:00
<div class="col-sm-12">
<h2>Browser Notifications</h2>
</div>
<div class="col-sm-12">
<label class="opt">
<input
id="desktopNotifications"
type="checkbox"
2019-03-01 14:18:16 +00:00
name="desktopNotifications"
>
2019-02-18 09:18:32 +00:00
Enable browser notifications<br>
<div
2019-02-20 09:10:18 +00:00
v-if="this.$root.desktopNotificationState === 'unsupported'"
2019-03-01 14:18:16 +00:00
class="error"
>
2019-02-18 09:18:32 +00:00
<strong>Warning</strong>:
Notifications are not supported by your browser.
</div>
<div
2019-02-20 09:10:18 +00:00
v-if="this.$root.desktopNotificationState === 'blocked'"
2019-02-18 09:18:32 +00:00
id="warnBlockedDesktopNotifications"
2019-03-01 14:18:16 +00:00
class="error"
>
2019-02-18 09:18:32 +00:00
<strong>Warning</strong>:
Notifications are blocked by your browser.
</div>
</label>
</div>
<div class="col-sm-12">
<label class="opt">
<input
type="checkbox"
2019-03-01 14:18:16 +00:00
name="notification"
>
2019-02-18 09:18:32 +00:00
Enable notification sound
</label>
</div>
<div class="col-sm-12">
<div class="opt">
<button id="play">Play sound</button>
</div>
</div>
<div
class="col-sm-12"
2019-03-01 14:18:16 +00:00
data-advanced
>
2019-02-18 09:18:32 +00:00
<label class="opt">
<input
type="checkbox"
2019-03-01 14:18:16 +00:00
name="notifyAllMessages"
>
2019-02-18 09:18:32 +00:00
Enable notification for all messages
</label>
</div>
<div
class="col-sm-12"
2019-03-01 14:18:16 +00:00
data-advanced
>
2019-02-18 09:18:32 +00:00
<label class="opt">
<label
for="highlights"
2019-03-01 14:18:16 +00:00
class="sr-only"
>Custom highlights (comma-separated keywords)</label>
2019-02-18 09:18:32 +00:00
<input
id="highlights"
type="text"
name="highlights"
class="input"
2019-03-01 14:18:16 +00:00
placeholder="Custom highlights (comma-separated keywords)"
>
2019-02-18 09:18:32 +00:00
</label>
</div>
2019-02-20 09:10:18 +00:00
<div
v-if="!this.$root.serverConfiguration.public && !this.$root.serverConfiguration.ldapEnabled"
2019-03-01 14:18:16 +00:00
id="change-password"
>
2019-02-18 09:18:32 +00:00
<form
action=""
method="post"
2019-03-01 14:18:16 +00:00
data-event="change-password"
>
2019-02-18 09:18:32 +00:00
<div class="col-sm-12">
<h2>Change password</h2>
</div>
<div class="col-sm-12 password-container">
<!-- TODO: use revealPassword -->
2019-02-18 09:18:32 +00:00
<label
for="old_password_input"
2019-03-01 14:18:16 +00:00
class="sr-only"
>Enter current password</label>
2019-02-18 09:18:32 +00:00
<input
id="old_password_input"
type="password"
name="old_password"
class="input"
2019-03-01 14:18:16 +00:00
placeholder="Enter current password"
>
2019-02-18 09:18:32 +00:00
</div>
<div class="col-sm-12 password-container">
<label
for="new_password_input"
2019-03-01 14:18:16 +00:00
class="sr-only"
>Enter desired new password</label>
2019-02-18 09:18:32 +00:00
<input
id="new_password_input"
type="password"
name="new_password"
class="input"
2019-03-01 14:18:16 +00:00
placeholder="Enter desired new password"
>
2019-02-18 09:18:32 +00:00
</div>
<div class="col-sm-12 password-container">
<label
for="verify_password_input"
2019-03-01 14:18:16 +00:00
class="sr-only"
>Repeat new password</label>
2019-02-18 09:18:32 +00:00
<input
id="verify_password_input"
type="password"
name="verify_password"
class="input"
2019-03-01 14:18:16 +00:00
placeholder="Repeat new password"
>
2019-02-18 09:18:32 +00:00
</div>
<div class="col-sm-12 feedback" />
<div class="col-sm-12">
<button
type="submit"
2019-03-01 14:18:16 +00:00
class="btn"
>Change password</button>
2019-02-18 09:18:32 +00:00
</div>
</form>
</div>
2019-02-20 09:10:18 +00:00
2019-02-18 09:18:32 +00:00
<div
class="col-sm-12"
2019-03-01 14:18:16 +00:00
data-advanced
>
2019-02-18 09:18:32 +00:00
<h2>Custom Stylesheet</h2>
</div>
<div
class="col-sm-12"
2019-03-01 14:18:16 +00:00
data-advanced
>
2019-02-18 09:18:32 +00:00
<label
for="user-specified-css-input"
2019-03-01 14:18:16 +00:00
class="sr-only"
>Custom stylesheet. You can override any style with CSS here.</label>
2019-02-18 09:18:32 +00:00
<textarea
id="user-specified-css-input"
2019-02-20 09:10:18 +00:00
v-model="$root.settings.userStyles"
2019-02-18 09:18:32 +00:00
class="input"
name="userStyles"
2019-03-01 14:18:16 +00:00
placeholder="/* You can override any style with CSS here */"
/>
2019-02-18 09:18:32 +00:00
</div>
</div>
2019-02-20 09:10:18 +00:00
<div
v-if="!this.$root.serverConfiguration.public"
2019-03-01 14:18:16 +00:00
class="session-list"
>
2019-02-18 09:18:32 +00:00
<h2>Sessions</h2>
<h3>Current session</h3>
<div id="session-current" />
<h3>Other sessions</h3>
<div id="session-list" />
</div>
</div>
</div>
</template>
<script>
const storage = require("../../js/localStorage");
import socket from "../../js/socket";
import RevealPassword from "../RevealPassword.vue";
export default {
name: "Settings",
components: {
RevealPassword,
},
data() {
return {
inFlight: false,
errorShown: false,
};
},
methods: {
onSubmit(event) {
event.preventDefault();
this.inFlight = true;
this.errorShown = false;
const values = {
user: this.$refs.username.value,
password: this.$refs.password.value,
};
storage.set("user", values.user);
socket.emit("auth", values);
},
2019-02-20 09:10:18 +00:00
onForceSyncClick() {
const options = require("../../js/options");
options.syncAllSettings(true);
},
2019-02-18 09:18:32 +00:00
},
};
</script>