2019-03-01 13:29:00 +00:00
|
|
|
<template>
|
2019-08-03 19:03:45 +00:00
|
|
|
<div id="connect" class="window" role="tabpanel" aria-label="Connect">
|
2019-03-01 13:29:00 +00:00
|
|
|
<div class="header">
|
2019-04-13 20:44:04 +00:00
|
|
|
<SidebarToggle />
|
2019-03-01 13:29:00 +00:00
|
|
|
</div>
|
2019-08-03 19:03:45 +00:00
|
|
|
<form class="container" method="post" action="" @submit.prevent="onSubmit">
|
2019-12-12 11:20:07 +00:00
|
|
|
<h1 class="title">
|
|
|
|
<template v-if="defaults.uuid">
|
|
|
|
<input type="hidden" name="uuid" :value="defaults.uuid" />
|
|
|
|
Edit {{ defaults.name }}
|
2019-03-01 13:29:00 +00:00
|
|
|
</template>
|
2019-12-12 11:20:07 +00:00
|
|
|
<template v-else>
|
|
|
|
<template v-if="config.public">The Lounge - </template>
|
|
|
|
Connect
|
|
|
|
<template v-if="!config.displayNetwork">
|
|
|
|
<template v-if="config.lockNetwork"> to {{ defaults.name }} </template>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</h1>
|
|
|
|
<template v-if="config.displayNetwork">
|
|
|
|
<h2>Network settings</h2>
|
|
|
|
<div class="connect-row">
|
|
|
|
<label for="connect:name">Name</label>
|
2019-03-01 13:29:00 +00:00
|
|
|
<input
|
2019-12-12 11:20:07 +00:00
|
|
|
id="connect:name"
|
|
|
|
class="input"
|
|
|
|
name="name"
|
|
|
|
:value="defaults.name"
|
2019-03-01 13:29:00 +00:00
|
|
|
maxlength="100"
|
2019-08-03 19:03:45 +00:00
|
|
|
/>
|
2019-03-01 13:29:00 +00:00
|
|
|
</div>
|
2019-12-12 11:20:07 +00:00
|
|
|
<div class="connect-row">
|
|
|
|
<label for="connect:host">Server</label>
|
|
|
|
<div class="input-wrap">
|
2019-03-01 13:29:00 +00:00
|
|
|
<input
|
2019-12-12 11:20:07 +00:00
|
|
|
id="connect:host"
|
|
|
|
class="input"
|
|
|
|
name="host"
|
|
|
|
:value="defaults.host"
|
|
|
|
aria-label="Server address"
|
|
|
|
maxlength="255"
|
|
|
|
required
|
|
|
|
:disabled="config.lockNetwork ? true : false"
|
2019-08-03 19:03:45 +00:00
|
|
|
/>
|
2019-12-12 11:20:07 +00:00
|
|
|
<span id="connect:portseparator">:</span>
|
2019-03-01 13:29:00 +00:00
|
|
|
<input
|
2019-12-12 11:20:07 +00:00
|
|
|
id="connect:port"
|
2019-12-28 21:08:46 +00:00
|
|
|
ref="serverPort"
|
2019-03-01 13:29:00 +00:00
|
|
|
class="input"
|
2019-12-12 11:20:07 +00:00
|
|
|
type="number"
|
|
|
|
min="1"
|
|
|
|
max="65535"
|
|
|
|
name="port"
|
|
|
|
:value="defaults.port"
|
|
|
|
aria-label="Server port"
|
|
|
|
:disabled="config.lockNetwork ? true : false"
|
2019-08-03 19:03:45 +00:00
|
|
|
/>
|
2019-12-12 11:20:07 +00:00
|
|
|
</div>
|
2019-03-01 13:29:00 +00:00
|
|
|
</div>
|
2019-12-12 11:20:07 +00:00
|
|
|
<div class="connect-row">
|
|
|
|
<label></label>
|
|
|
|
<div class="input-wrap">
|
|
|
|
<label class="tls">
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="tls"
|
|
|
|
:checked="defaults.tls ? true : false"
|
|
|
|
:disabled="config.lockNetwork ? true : false"
|
2019-12-28 21:08:46 +00:00
|
|
|
@change="onSecureChanged"
|
2019-12-12 11:20:07 +00:00
|
|
|
/>
|
|
|
|
Use secure connection (TLS)
|
|
|
|
</label>
|
|
|
|
<label class="tls">
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="rejectUnauthorized"
|
|
|
|
:checked="defaults.rejectUnauthorized ? true : false"
|
|
|
|
:disabled="config.lockNetwork ? true : false"
|
|
|
|
/>
|
|
|
|
Only allow trusted certificates
|
|
|
|
</label>
|
|
|
|
</div>
|
2019-03-01 13:29:00 +00:00
|
|
|
</div>
|
2019-12-12 11:20:07 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<h2>User preferences</h2>
|
|
|
|
<div class="connect-row">
|
|
|
|
<label for="connect:nick">Nick</label>
|
|
|
|
<input
|
|
|
|
id="connect:nick"
|
|
|
|
class="input nick"
|
|
|
|
name="nick"
|
|
|
|
:value="defaults.nick"
|
|
|
|
maxlength="100"
|
|
|
|
required
|
|
|
|
@input="onNickChanged"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<template v-if="!config.useHexIp">
|
|
|
|
<div class="connect-row">
|
|
|
|
<label for="connect:username">Username</label>
|
2019-03-01 13:29:00 +00:00
|
|
|
<input
|
2019-12-12 11:20:07 +00:00
|
|
|
id="connect:username"
|
|
|
|
ref="usernameInput"
|
|
|
|
class="input username"
|
|
|
|
name="username"
|
|
|
|
:value="defaults.username"
|
2019-03-01 14:18:16 +00:00
|
|
|
maxlength="512"
|
2019-08-03 19:03:45 +00:00
|
|
|
/>
|
2019-03-01 13:29:00 +00:00
|
|
|
</div>
|
2019-12-12 11:20:07 +00:00
|
|
|
</template>
|
|
|
|
<div class="connect-row">
|
|
|
|
<label for="connect:password">Password</label>
|
2019-12-12 11:37:53 +00:00
|
|
|
<RevealPassword v-slot:default="slotProps" class="input-wrap password-container">
|
2019-12-12 11:20:07 +00:00
|
|
|
<input
|
|
|
|
id="connect:password"
|
|
|
|
v-model="defaults.password"
|
|
|
|
class="input"
|
|
|
|
:type="slotProps.isVisible ? 'text' : 'password'"
|
|
|
|
name="password"
|
|
|
|
maxlength="512"
|
|
|
|
/>
|
|
|
|
</RevealPassword>
|
|
|
|
</div>
|
|
|
|
<div class="connect-row">
|
|
|
|
<label for="connect:realname">Real name</label>
|
|
|
|
<input
|
|
|
|
id="connect:realname"
|
|
|
|
class="input"
|
|
|
|
name="realname"
|
|
|
|
:value="defaults.realname"
|
|
|
|
maxlength="512"
|
|
|
|
/>
|
2019-03-01 13:29:00 +00:00
|
|
|
</div>
|
2019-12-12 11:20:07 +00:00
|
|
|
<template v-if="defaults.uuid">
|
|
|
|
<div class="connect-row">
|
|
|
|
<label for="connect:commands">Commands</label>
|
|
|
|
<textarea
|
|
|
|
id="connect:commands"
|
|
|
|
class="input"
|
|
|
|
name="commands"
|
|
|
|
placeholder="One raw command per line, each command will be executed on new connection"
|
|
|
|
:value="defaults.commands ? defaults.commands.join('\n') : ''"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<button type="submit" class="btn" :disabled="disabled ? true : false">
|
|
|
|
Save
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<div class="connect-row">
|
|
|
|
<label for="connect:channels">Channels</label>
|
|
|
|
<input id="connect:channels" class="input" name="join" :value="defaults.join" />
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<button type="submit" class="btn" :disabled="disabled ? true : false">
|
|
|
|
Connect
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</template>
|
2019-03-01 13:29:00 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import RevealPassword from "./RevealPassword.vue";
|
2019-04-13 20:44:04 +00:00
|
|
|
import SidebarToggle from "./SidebarToggle.vue";
|
2019-03-01 13:29:00 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "NetworkForm",
|
|
|
|
components: {
|
|
|
|
RevealPassword,
|
2019-04-13 20:44:04 +00:00
|
|
|
SidebarToggle,
|
2019-03-01 13:29:00 +00:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
handleSubmit: Function,
|
|
|
|
defaults: Object,
|
|
|
|
disabled: Boolean,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2019-11-02 19:40:59 +00:00
|
|
|
config: this.$store.state.serverConfiguration,
|
2019-11-08 19:41:27 +00:00
|
|
|
previousUsername: this.defaults.username,
|
2019-03-01 13:29:00 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
2019-11-08 19:41:27 +00:00
|
|
|
onNickChanged(event) {
|
|
|
|
if (
|
|
|
|
!this.$refs.usernameInput.value ||
|
|
|
|
this.$refs.usernameInput.value === this.previousUsername
|
|
|
|
) {
|
|
|
|
this.$refs.usernameInput.value = event.target.value;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.previousUsername = event.target.value;
|
|
|
|
},
|
2019-12-28 21:08:46 +00:00
|
|
|
onSecureChanged(event) {
|
|
|
|
const ports = ["6667", "6697"];
|
|
|
|
const newPort = event.target.checked ? 0 : 1;
|
|
|
|
|
|
|
|
// If you disable TLS and current port is 6697,
|
|
|
|
// set it to 6667, and vice versa
|
|
|
|
if (this.$refs.serverPort.value === ports[newPort]) {
|
|
|
|
this.$refs.serverPort.value = ports[1 - newPort];
|
|
|
|
}
|
|
|
|
},
|
2019-03-01 13:29:00 +00:00
|
|
|
onSubmit(event) {
|
|
|
|
const formData = new FormData(event.target);
|
|
|
|
const data = {};
|
|
|
|
|
|
|
|
for (const item of formData.entries()) {
|
|
|
|
data[item[0]] = item[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
this.handleSubmit(data);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|