Support "mirrors" array in the config file for link sharing

For issue #642
This commit is contained in:
N-Pex 2025-06-18 17:39:09 +02:00
parent 4648e4969c
commit e3f7f1758f
9 changed files with 72 additions and 27 deletions

View file

@ -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() {