Support "mirrors" array in the config file for link sharing
For issue #642
This commit is contained in:
parent
4648e4969c
commit
e3f7f1758f
9 changed files with 72 additions and 27 deletions
|
|
@ -4,7 +4,7 @@
|
|||
<v-card class="ma-3" v-show="locationLink" variant="flat">
|
||||
<v-container>
|
||||
<slot/>
|
||||
<v-row cols="12" class="qr-container ma-3">
|
||||
<v-row cols="12" class="qr-container mt-3 ml-3 mr-3">
|
||||
<v-col cols="auto">
|
||||
<canvas
|
||||
v-longTap:250="[
|
||||
|
|
@ -23,7 +23,26 @@
|
|||
<div class="link">{{ locationLink }}</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row align="center" class="mt-0 pt-0">
|
||||
<v-row v-if="mirrors.length > 0" justify="end" class="mt-3">
|
||||
<v-col cols="auto">
|
||||
<v-select
|
||||
:items="mirrors"
|
||||
v-model="currentMirror"
|
||||
:menu-props="{ auto: true }"
|
||||
hide-details
|
||||
single-line
|
||||
density="compact"
|
||||
bg-color="transparent"
|
||||
variant="solo"
|
||||
flat
|
||||
>
|
||||
<template v-slot:selection>
|
||||
<span style="font-size: 0.8rem">Use a mirror</span>
|
||||
</template>
|
||||
</v-select>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row align="center" class="mt-3 pt-0">
|
||||
<v-col align="center" class="mt-0 pt-0">
|
||||
<v-btn
|
||||
id="btn-copy-room-link"
|
||||
|
|
@ -50,6 +69,7 @@ export default {
|
|||
components: {
|
||||
QRCodePopup
|
||||
},
|
||||
emits: ['mirror-change'],
|
||||
props: {
|
||||
locationLink: {
|
||||
type: String
|
||||
|
|
@ -61,19 +81,32 @@ export default {
|
|||
i18nQrPopupTitleKey: {
|
||||
type: String,
|
||||
default: 'room_info.scan_code'
|
||||
},
|
||||
allowMirrors: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
locationLinkCopied: false,
|
||||
showFullScreenQR: false,
|
||||
currentMirror: "",
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
popupTitle() {
|
||||
return this.$t(this.i18nQrPopupTitleKey);
|
||||
},
|
||||
mirrors() {
|
||||
if (this.allowMirrors) {
|
||||
const m = this.$config.mirrors;
|
||||
if (m && Array.isArray(m) && m.length > 0) {
|
||||
return m;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
copyRoomLink() {
|
||||
|
|
@ -118,6 +151,11 @@ export default {
|
|||
handler() {
|
||||
this.updateQRCode();
|
||||
}
|
||||
},
|
||||
currentMirror: {
|
||||
handler(newVal) {
|
||||
this.$emit("mirror-change", newVal);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
</v-row>
|
||||
</v-container>
|
||||
|
||||
<copy-link :locationLink="directMessageLink" >
|
||||
<copy-link :locationLink="directMessageLink" :allowMirrors="true" @mirror-change="(mirror) => currentMirror = mirror">
|
||||
<v-card-title class="h2">{{ $t("room_info.direct_link") }}</v-card-title>
|
||||
<v-card-text>{{ $t("room_info.direct_link_desc") }}</v-card-text>
|
||||
</copy-link>
|
||||
|
|
@ -297,7 +297,8 @@ export default {
|
|||
isAvatarLoaded: true,
|
||||
loadValue: 0,
|
||||
newPasswordHasError: false,
|
||||
notificationDialog: false
|
||||
notificationDialog: false,
|
||||
currentMirror: null
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -306,7 +307,7 @@ export default {
|
|||
return this.$matrix.currentUser.user_id
|
||||
},
|
||||
directMessageLink() {
|
||||
return this.$router.getDMLink(this.$matrix.currentUser, this.$config);
|
||||
return this.$router.getDMLink(this.$matrix.currentUser, this.$config, this.currentMirror);
|
||||
},
|
||||
passwordsMatch() {
|
||||
return (
|
||||
|
|
@ -425,6 +426,7 @@ export default {
|
|||
if(this.globalNotification && this.windowNotificationPermission() !== 'granted') {
|
||||
this.onUpdateGlobalNotification(false);
|
||||
}
|
||||
this.currentMirror = null;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
{{ $t("room_info.created_by", { user: creator }) }}
|
||||
</div>
|
||||
</div>
|
||||
<copy-link :locationLink="publicRoomLink" i18nCopyLinkKey="copy_invite_link" />
|
||||
<copy-link :locationLink="publicRoomLink" i18nCopyLinkKey="copy_invite_link" :allowMirrors="true" @mirror-change="(mirror) => currentMirror = mirror" />
|
||||
|
||||
<v-card class="account ma-3" variant="flat">
|
||||
<v-card-title class="h2">{{ $t("room_info.permissions") }}</v-card-title>
|
||||
|
|
@ -419,7 +419,8 @@ export default {
|
|||
],
|
||||
SHOW_MEMBER_LIMIT: 5,
|
||||
exporting: false,
|
||||
activeMember: null
|
||||
activeMember: null,
|
||||
currentMirror: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -427,6 +428,7 @@ export default {
|
|||
this.updateMembers();
|
||||
this.updateMessageRetention();
|
||||
this.user = this.$matrix.matrixClient.getUser(this.$matrix.currentUserId);
|
||||
this.currentMirror = null;
|
||||
|
||||
// Display build version
|
||||
this.buildVersion = buildVersion;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export default {
|
|||
isRoomTopicEditMode: false,
|
||||
roomTopicErrorMessage: null,
|
||||
messageRetentionDisplay: "",
|
||||
currentMirror: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -69,7 +70,8 @@ export default {
|
|||
this.room.name,
|
||||
utils.roomDisplayTypeToQueryParam(this.room, this.roomDisplayType),
|
||||
this.roomDisplayType == ROOM_TYPE_CHANNEL, /* Auto join for channels */
|
||||
this.roomJoinRule == "knock"
|
||||
this.roomJoinRule == "knock",
|
||||
this.currentMirror
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue