Add "createchannel" endpoint
This commit is contained in:
parent
9ec91b3f2a
commit
0dc449feaa
7 changed files with 331 additions and 25 deletions
|
|
@ -1,16 +1,16 @@
|
||||||
@import "@/assets/css/main.scss";
|
@import "@/assets/css/main.scss";
|
||||||
|
|
||||||
.getlink-root {
|
.create-root {
|
||||||
background-color: $background;
|
background-color: $background;
|
||||||
|
|
||||||
.getlink-loggedin {
|
.create-loggedin {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
button {
|
button {
|
||||||
min-width: 200px !important;
|
min-width: 200px !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.getlink-image {
|
.create-image {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
max-width: 325px;
|
max-width: 325px;
|
||||||
max-height: 257px;
|
max-height: 257px;
|
||||||
|
|
@ -21,7 +21,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.getlink-title {
|
.create-image-small {
|
||||||
|
text-align: center;
|
||||||
|
max-width: 72px;
|
||||||
|
max-height: 72px;
|
||||||
|
width: 100%;
|
||||||
|
.v-icon__component {
|
||||||
|
width: unset;
|
||||||
|
height: unset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.create-title {
|
||||||
color: #000;
|
color: #000;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: "Poppins";
|
font-family: "Poppins";
|
||||||
|
|
@ -34,7 +45,7 @@
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.getlink-info {
|
.create-info {
|
||||||
color: #000;
|
color: #000;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-feature-settings: "clig" off, "liga" off;
|
font-feature-settings: "clig" off, "liga" off;
|
||||||
|
|
@ -47,7 +58,7 @@
|
||||||
margin: 15px 9px 40px 9px;
|
margin: 15px 9px 40px 9px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.getlink-subtitle {
|
.create-subtitle {
|
||||||
color: #000;
|
color: #000;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-feature-settings: "clig" off, "liga" off;
|
font-feature-settings: "clig" off, "liga" off;
|
||||||
|
|
@ -95,7 +106,7 @@
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.getlink-share {
|
.create-share {
|
||||||
color: #161616;
|
color: #161616;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: "Inter";
|
font-family: "Inter";
|
||||||
|
|
@ -118,7 +129,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.getlink-buttons {
|
.create-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
@ -137,7 +137,10 @@
|
||||||
"got_it": "Got it",
|
"got_it": "Got it",
|
||||||
"no_past_messages": "Welcome! For your security, past messages are not available.",
|
"no_past_messages": "Welcome! For your security, past messages are not available.",
|
||||||
"direct_info": "Hi, {you}. You’re in a private chat with {user}.",
|
"direct_info": "Hi, {you}. You’re in a private chat with {user}.",
|
||||||
"direct_private_chat": "Direct Message"
|
"direct_private_chat": "Direct Message",
|
||||||
|
"join_channel": "All set! Invite people to join you: {link}",
|
||||||
|
"info_retention": "🕓 Messages sent within {time} are viewable by anyone with the link.",
|
||||||
|
"change": "Change"
|
||||||
},
|
},
|
||||||
"new_room": {
|
"new_room": {
|
||||||
"new_room": "New Room",
|
"new_room": "New Room",
|
||||||
|
|
@ -202,6 +205,14 @@
|
||||||
"share_qr": "Share QR",
|
"share_qr": "Share QR",
|
||||||
"qr_image_copied": "Image copied to clipboard"
|
"qr_image_copied": "Image copied to clipboard"
|
||||||
},
|
},
|
||||||
|
"createchannel": {
|
||||||
|
"title": "Create a Channel",
|
||||||
|
"info": "Broadcast news or knowledge in any format—video, podcast, text, pictures or PDFs.",
|
||||||
|
"channel_name": "Name your channel",
|
||||||
|
"channel_topic": "Describe it",
|
||||||
|
"name_required": "Channel name is required",
|
||||||
|
"error_channel": "Failed to create channel"
|
||||||
|
},
|
||||||
"profile": {
|
"profile": {
|
||||||
"title": "My Profile",
|
"title": "My Profile",
|
||||||
"temporary_identity": "This identity is temporary. Set a password to use it again",
|
"temporary_identity": "This identity is temporary. Set a password to use it again",
|
||||||
|
|
|
||||||
280
src/components/CreateChannel.vue
Normal file
280
src/components/CreateChannel.vue
Normal file
|
|
@ -0,0 +1,280 @@
|
||||||
|
<template>
|
||||||
|
<div class="pa-4 create-root fill-height">
|
||||||
|
<YouAre v-if="loggedIn" class="mt-4" />
|
||||||
|
<div class="text-center">
|
||||||
|
<v-avatar class="create-image-small" size="50" color="#ededed" @click.stop="showAvatarPicker">
|
||||||
|
<v-img v-if="roomAvatar" :src="roomAvatar" />
|
||||||
|
<v-icon v-else>camera_alt</v-icon>
|
||||||
|
</v-avatar>
|
||||||
|
<div class="create-title">{{ $t("createchannel.title") }}</div>
|
||||||
|
<div class="create-info">{{ $t("createchannel.info") }}</div>
|
||||||
|
<div color="rgba(255,255,255,0.1)" class="text-center">
|
||||||
|
<v-form v-model="isValid" ref="form">
|
||||||
|
<v-text-field v-model="roomName" :label="$t('createchannel.channel_name')" color="black"
|
||||||
|
background-color="white" solo :rules="[(v) => !!v || $t('createchannel.name_required')]" required
|
||||||
|
v-on:keydown="message = null"></v-text-field>
|
||||||
|
<v-text-field v-model="roomTopic" :label="$t('createchannel.channel_topic')" color="black"
|
||||||
|
background-color="#F5F5F5" filled v-on:keydown="message = null"></v-text-field>
|
||||||
|
|
||||||
|
<!-- <div class="error--text" v-if="loadingLoginFlows">Loading login flows...</div> -->
|
||||||
|
|
||||||
|
<div class="error--text" v-if="message != null">{{ this.message }}</div>
|
||||||
|
|
||||||
|
<interactive-auth ref="interactiveAuth" />
|
||||||
|
|
||||||
|
<v-btn :disabled="!isValid || loading" color="primary" depressed block @click.stop="handleNext"
|
||||||
|
:loading="loading" class="filled-button mt-4">{{ $t("getlink.next") }}</v-btn>
|
||||||
|
<v-btn v-if="!loggedIn" color="black" depressed text block @click.stop="goToLoginPage" class="text-button">{{
|
||||||
|
$t("menu.login")
|
||||||
|
}}</v-btn>
|
||||||
|
</v-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input id="room-avatar-picker" ref="avatar" type="file" name="avatar" @change="handlePickedAvatar($event)"
|
||||||
|
accept="image/*" class="d-none" />
|
||||||
|
|
||||||
|
<div :class="{ 'toast-at-bottom': true, 'visible': showQRCopiedToast }">{{ $t("getlink.qr_image_copied") }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import rememberMeMixin from "./rememberMeMixin";
|
||||||
|
import * as sdk from "matrix-js-sdk";
|
||||||
|
import logoMixin from "./logoMixin";
|
||||||
|
import InteractiveAuth from './InteractiveAuth.vue';
|
||||||
|
import util, { ROOM_TYPE_CHANNEL } from "../plugins/utils";
|
||||||
|
import YouAre from "../components/YouAre.vue";
|
||||||
|
import User from "../models/user";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "CreateChannel",
|
||||||
|
mixins: [rememberMeMixin, logoMixin],
|
||||||
|
components: { InteractiveAuth, YouAre },
|
||||||
|
data() {
|
||||||
|
return this.defaultData();
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
loggedIn() {
|
||||||
|
return this.$store.state.auth.status.loggedIn;
|
||||||
|
},
|
||||||
|
currentUser() {
|
||||||
|
return this.$store.state.auth.user;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
defaultData() {
|
||||||
|
return {
|
||||||
|
roomName: "",
|
||||||
|
roomTopic: "",
|
||||||
|
isValid: false,
|
||||||
|
loading: false,
|
||||||
|
message: null,
|
||||||
|
currentLoginServer: "",
|
||||||
|
loadingLoginFlows: false,
|
||||||
|
loginFlows: null,
|
||||||
|
showQRCopiedToast: false,
|
||||||
|
roomAvatar: null,
|
||||||
|
roomAvatarFile: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
goHome() {
|
||||||
|
this.$navigation.push({ name: "Home" }, -1);
|
||||||
|
},
|
||||||
|
goToLoginPage() {
|
||||||
|
this.$navigation.push({ name: "Login", params: { showCreateRoomOption: false, redirect: "GetLink" } }, 1);
|
||||||
|
},
|
||||||
|
handleNext() {
|
||||||
|
const prefix = this.$config.userIdPrefix;
|
||||||
|
const user = new User(util.randomUser(prefix), util.randomPass(), false);
|
||||||
|
|
||||||
|
// Reset errors
|
||||||
|
this.message = null;
|
||||||
|
this.loading = true;
|
||||||
|
|
||||||
|
const login = this.loggedIn ? Promise.resolve(this.currentUser) : this.loadLoginFlows().then(() => {
|
||||||
|
return this.$store.dispatch("createUser", { user, registrationFlowHandler: this.$refs.interactiveAuth.registrationFlowHandler })
|
||||||
|
});
|
||||||
|
login
|
||||||
|
.then(
|
||||||
|
(ignoreduser) => {
|
||||||
|
return this.createRoom();
|
||||||
|
})
|
||||||
|
.catch(
|
||||||
|
(ignorederror) => {
|
||||||
|
this.message = this.$t("createchannel.error_channel");
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
loadLoginFlows() {
|
||||||
|
var user = Object.assign({}, this.user);
|
||||||
|
return util.getMatrixBaseUrl(user, this.$config)
|
||||||
|
.then((baseUrl) => {
|
||||||
|
if (baseUrl !== this.currentLoginServer) {
|
||||||
|
this.currentLoginServer = baseUrl;
|
||||||
|
this.loadingLoginFlows = true;
|
||||||
|
|
||||||
|
const matrixClient = sdk.createClient({ baseUrl: baseUrl });
|
||||||
|
return matrixClient.loginFlows().then((response) => {
|
||||||
|
console.log("FLOWS", response.flows);
|
||||||
|
this.loginFlows = response.flows.filter(this.supportedLoginFlow);
|
||||||
|
this.loadingLoginFlows = false;
|
||||||
|
if (this.loginFlows.length == 0) {
|
||||||
|
this.message = this.$t('login.no_supported_flow')
|
||||||
|
} else {
|
||||||
|
this.message = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
supportedLoginFlow(flow) {
|
||||||
|
return ["m.login.password"].includes(flow.type);
|
||||||
|
},
|
||||||
|
createRoom() {
|
||||||
|
const createRoomOptions = {
|
||||||
|
visibility: "private", // Not listed!
|
||||||
|
name: this.roomName,
|
||||||
|
preset: "public_chat",
|
||||||
|
initial_state:
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "m.room.encryption",
|
||||||
|
state_key: "",
|
||||||
|
content: {
|
||||||
|
algorithm: "m.megolm.v1.aes-sha2",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "m.room.history_visibility",
|
||||||
|
state_key: "",
|
||||||
|
content: {
|
||||||
|
history_visibility: "joined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "m.room.retention",
|
||||||
|
state_key: "",
|
||||||
|
content: {
|
||||||
|
max_lifetime: 3600 * 24 * 7 * 1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
if (this.roomTopic && this.roomTopic.length > 0) {
|
||||||
|
// Add topic
|
||||||
|
createRoomOptions.topic = this.roomTopic;
|
||||||
|
}
|
||||||
|
|
||||||
|
createRoomOptions.creation_content = {
|
||||||
|
type: ROOM_TYPE_CHANNEL
|
||||||
|
}
|
||||||
|
|
||||||
|
let roomId = "";
|
||||||
|
|
||||||
|
return util
|
||||||
|
.getUniqueAliasForRoomName(
|
||||||
|
this.$matrix.matrixClient,
|
||||||
|
this.roomName,
|
||||||
|
this.$matrix.currentUserMXDomain
|
||||||
|
)
|
||||||
|
.then((alias) => {
|
||||||
|
createRoomOptions.room_alias_name = alias;
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
|
||||||
|
// Set power level event. Need to do that here, because we might not have the userId when the options object is created.
|
||||||
|
const powerLevels = {};
|
||||||
|
powerLevels[this.$matrix.currentUserId] = 100;
|
||||||
|
let powerLevelContent = {
|
||||||
|
users: powerLevels,
|
||||||
|
events_default: 50
|
||||||
|
}
|
||||||
|
powerLevelContent.events = {
|
||||||
|
"m.room.encrypted": 0, // NOTE! Since practically all events in encrypted rooms get sent as "m.room.encrypted" we need to set
|
||||||
|
// power to 0 here. Otherwise we would not be able to send quick reactions or poll responses...
|
||||||
|
"m.poll.response": 0,
|
||||||
|
"org.matrix.msc3381.poll.response": 0,
|
||||||
|
"m.reaction": 0,
|
||||||
|
"m.room.redaction": 0,
|
||||||
|
};
|
||||||
|
createRoomOptions.initial_state.push(
|
||||||
|
{
|
||||||
|
type: "m.room.power_levels",
|
||||||
|
state_key: "",
|
||||||
|
content: powerLevelContent
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.$matrix.matrixClient
|
||||||
|
.createRoom(createRoomOptions)
|
||||||
|
.then(({ room_id, room_alias }) => {
|
||||||
|
roomId = room_alias || room_id;
|
||||||
|
if (!this.roomAvatarFile) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const self = this;
|
||||||
|
return util.setRoomAvatar(
|
||||||
|
this.$matrix.matrixClient,
|
||||||
|
room_id,
|
||||||
|
this.roomAvatarFile,
|
||||||
|
(p) => {
|
||||||
|
if (p.total) {
|
||||||
|
self.status = this.$t("new_room.status_avatar_total", {
|
||||||
|
count: p.loaded || 0,
|
||||||
|
total: p.total,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
self.status = this.$t("new_room.status_avatar", {
|
||||||
|
count: p.loaded || 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.$navigation.push(
|
||||||
|
{
|
||||||
|
name: "Chat",
|
||||||
|
params: { roomId: util.sanitizeRoomId(roomId) },
|
||||||
|
},
|
||||||
|
-1
|
||||||
|
);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show picker to select room avatar file
|
||||||
|
*/
|
||||||
|
showAvatarPicker() {
|
||||||
|
this.$refs.avatar.click();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle picked avatar
|
||||||
|
*/
|
||||||
|
handlePickedAvatar(event) {
|
||||||
|
if (event.target.files && event.target.files[0]) {
|
||||||
|
var reader = new FileReader();
|
||||||
|
reader.onload = (e) => {
|
||||||
|
this.roomAvatar = e.target.result;
|
||||||
|
this.roomAvatarFile = event.target.files[0];
|
||||||
|
};
|
||||||
|
reader.readAsDataURL(event.target.files[0]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import "@/assets/css/create.scss";
|
||||||
|
</style>
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="pa-4 getlink-root fill-height">
|
<div class="pa-4 create-root fill-height">
|
||||||
<div v-if="!loggedIn" class="text-center">
|
<div v-if="!loggedIn" class="text-center">
|
||||||
<v-icon class="getlink-image">$vuetify.icons.getlink</v-icon>
|
<v-icon class="create-image">$vuetify.icons.getlink</v-icon>
|
||||||
<div class="getlink-title">{{ $t("getlink.title") }}</div>
|
<div class="create-title">{{ $t("getlink.title") }}</div>
|
||||||
<div class="getlink-info">{{ $t("getlink.info") }}</div>
|
<div class="create-info">{{ $t("getlink.info") }}</div>
|
||||||
<div color="rgba(255,255,255,0.1)" class="text-center">
|
<div color="rgba(255,255,255,0.1)" class="text-center">
|
||||||
<v-form v-model="isValid" ref="form">
|
<v-form v-model="isValid" ref="form">
|
||||||
<v-text-field v-model="user.user_id" :label="$t('getlink.username')" color="black" background-color="white" solo
|
<v-text-field v-model="user.user_id" :label="$t('getlink.username')" color="black" background-color="white" solo
|
||||||
|
|
@ -23,20 +23,20 @@
|
||||||
</v-form>
|
</v-form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else style="position:relative" class="getlink-loggedin">
|
<div v-else style="position:relative" class="create-loggedin">
|
||||||
<!-- Logged in/account created -->
|
<!-- Logged in/account created -->
|
||||||
<div class="getlink-title">{{ $t("getlink.hello", { user: $matrix.currentUserDisplayName }) }}</div>
|
<div class="create-title">{{ $t("getlink.hello", { user: $matrix.currentUserDisplayName }) }}</div>
|
||||||
<div class="getlink-subtitle">{{ $t("getlink.ready_to_share") }}</div>
|
<div class="create-subtitle">{{ $t("getlink.ready_to_share") }}</div>
|
||||||
<copy-link ref="qr" :locationLink="directMessageLink" i18nQrPopupTitleKey="getlink.scan_title"
|
<copy-link ref="qr" :locationLink="directMessageLink" i18nQrPopupTitleKey="getlink.scan_title"
|
||||||
v-on:long-tap="copyQRImage">
|
v-on:long-tap="copyQRImage">
|
||||||
<template v-slot:share>
|
<template v-slot:share>
|
||||||
<div v-if="shareSupported" class="clickable getlink-share" @click="shareLink">
|
<div v-if="shareSupported" class="clickable create-share" @click="shareLink">
|
||||||
<div>{{ $t("getlink.share_qr") }}</div>
|
<div>{{ $t("getlink.share_qr") }}</div>
|
||||||
<v-img src="@/assets/icons/ic_share.svg" />
|
<v-img src="@/assets/icons/ic_share.svg" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</copy-link>
|
</copy-link>
|
||||||
<div class="getlink-buttons">
|
<div class="create-buttons">
|
||||||
<v-btn color="black" depressed @click.stop="goHome" class="outlined-button">{{ $t("getlink.continue") }}</v-btn>
|
<v-btn color="black" depressed @click.stop="goHome" class="outlined-button">{{ $t("getlink.continue") }}</v-btn>
|
||||||
<v-btn color="black" depressed text block @click.stop="getDifferentLink" class="text-button">{{
|
<v-btn color="black" depressed text block @click.stop="getDifferentLink" class="text-button">{{
|
||||||
$t("getlink.different_link") }}</v-btn>
|
$t("getlink.different_link") }}</v-btn>
|
||||||
|
|
@ -181,9 +181,6 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleCreateRoom() {
|
|
||||||
this.$navigation.push({ name: "CreateRoom" });
|
|
||||||
},
|
|
||||||
onUsernameEnter() {
|
onUsernameEnter() {
|
||||||
this.handleLogin();
|
this.handleLogin();
|
||||||
},
|
},
|
||||||
|
|
@ -246,5 +243,5 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "@/assets/css/getlink.scss";
|
@import "@/assets/css/create.scss";
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { ROOM_TYPE_VOICE_MODE, ROOM_TYPE_FILE_MODE, ROOM_TYPE_DEFAULT, STATE_EVENT_ROOM_TYPE } from "../plugins/utils";
|
import { ROOM_TYPE_VOICE_MODE, ROOM_TYPE_FILE_MODE, ROOM_TYPE_DEFAULT, STATE_EVENT_ROOM_TYPE, ROOM_TYPE_CHANNEL } from "../plugins/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -34,7 +34,7 @@ export default {
|
||||||
if (e) {
|
if (e) {
|
||||||
const roomType = e.getContent().type;
|
const roomType = e.getContent().type;
|
||||||
// Validate value, or return default
|
// Validate value, or return default
|
||||||
if ([ROOM_TYPE_FILE_MODE, ROOM_TYPE_VOICE_MODE].includes(roomType)) {
|
if ([ROOM_TYPE_FILE_MODE, ROOM_TYPE_VOICE_MODE, ROOM_TYPE_CHANNEL].includes(roomType)) {
|
||||||
this.roomDisplayType = roomType;
|
this.roomDisplayType = roomType;
|
||||||
} else {
|
} else {
|
||||||
this.roomDisplayType = ROOM_TYPE_DEFAULT;
|
this.roomDisplayType = ROOM_TYPE_DEFAULT;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ export const STATE_EVENT_ROOM_DELETED = "im.keanu.room_deleted";
|
||||||
export const ROOM_TYPE_DEFAULT = "im.keanu.room_type_default";
|
export const ROOM_TYPE_DEFAULT = "im.keanu.room_type_default";
|
||||||
export const ROOM_TYPE_VOICE_MODE = "im.keanu.room_type_voice";
|
export const ROOM_TYPE_VOICE_MODE = "im.keanu.room_type_voice";
|
||||||
export const ROOM_TYPE_FILE_MODE = "im.keanu.room_type_file";
|
export const ROOM_TYPE_FILE_MODE = "im.keanu.room_type_file";
|
||||||
|
export const ROOM_TYPE_CHANNEL = "im.keanu.room_type_channel";
|
||||||
|
|
||||||
export const STATE_EVENT_ROOM_TYPE = "im.keanu.room_type";
|
export const STATE_EVENT_ROOM_TYPE = "im.keanu.room_type";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import Login from '../components/Login.vue'
|
||||||
import Profile from '../components/Profile.vue'
|
import Profile from '../components/Profile.vue'
|
||||||
import CreateRoom from '../components/CreateRoom.vue'
|
import CreateRoom from '../components/CreateRoom.vue'
|
||||||
import GetLink from '../components/GetLink.vue'
|
import GetLink from '../components/GetLink.vue'
|
||||||
|
import CreateChannel from '../components/CreateChannel.vue'
|
||||||
import User from '../models/user'
|
import User from '../models/user'
|
||||||
import util from '../plugins/utils'
|
import util from '../plugins/utils'
|
||||||
|
|
||||||
|
|
@ -60,6 +61,11 @@ const routes = [
|
||||||
name: 'GetLink',
|
name: 'GetLink',
|
||||||
component: GetLink,
|
component: GetLink,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/createchannel',
|
||||||
|
name: 'CreateChannel',
|
||||||
|
component: CreateChannel,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
|
|
@ -97,7 +103,7 @@ const router = new VueRouter({
|
||||||
});
|
});
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
const publicPages = ['/login', '/createroom', '/getlink'];
|
const publicPages = ['/login', '/createroom', '/getlink', '/createchannel'];
|
||||||
var authRequired = !publicPages.includes(to.path);
|
var authRequired = !publicPages.includes(to.path);
|
||||||
const loggedIn = router.app.$store.state.auth.user;
|
const loggedIn = router.app.$store.state.auth.user;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue