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
18
package-lock.json
generated
18
package-lock.json
generated
|
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"name": "keanuapp-weblite",
|
"name": "keanuapp-weblite",
|
||||||
"version": "0.1.49",
|
"version": "0.1.51",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "keanuapp-weblite",
|
"name": "keanuapp-weblite",
|
||||||
"version": "0.1.49",
|
"version": "0.1.51",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@guardianproject/proofmode": "^0.3.2",
|
"@guardianproject/proofmode": "^0.4.0",
|
||||||
"@matrix-org/olm": "^3.2.12",
|
"@matrix-org/olm": "^3.2.12",
|
||||||
"@vitejs/plugin-vue": "^5.2.3",
|
"@vitejs/plugin-vue": "^5.2.3",
|
||||||
"aes-js": "^3.1.2",
|
"aes-js": "^3.1.2",
|
||||||
|
|
@ -942,9 +942,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@guardianproject/proofmode": {
|
"node_modules/@guardianproject/proofmode": {
|
||||||
"version": "0.3.2",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@guardianproject/proofmode/-/proofmode-0.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/@guardianproject/proofmode/-/proofmode-0.4.0.tgz",
|
||||||
"integrity": "sha512-p71l7hheUoAWYbq/t1WoP94n6Ug9PUnapNtUKytvY688+NgeFHjL7Uc8X/K+Li3ikztfm0kM30q5nbAOJU14Fw==",
|
"integrity": "sha512-k/zf7DoSF8ijoJ5QUpEA/O9/85P6sRUlTGAK/wHsZYwFkJiAWdDpy9D7muC9X5OtSeCUMFhaMo56lmyoetg6iA==",
|
||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
},
|
},
|
||||||
"node_modules/@humanwhocodes/config-array": {
|
"node_modules/@humanwhocodes/config-array": {
|
||||||
|
|
@ -8523,9 +8523,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@guardianproject/proofmode": {
|
"@guardianproject/proofmode": {
|
||||||
"version": "0.3.2",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@guardianproject/proofmode/-/proofmode-0.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/@guardianproject/proofmode/-/proofmode-0.4.0.tgz",
|
||||||
"integrity": "sha512-p71l7hheUoAWYbq/t1WoP94n6Ug9PUnapNtUKytvY688+NgeFHjL7Uc8X/K+Li3ikztfm0kM30q5nbAOJU14Fw=="
|
"integrity": "sha512-k/zf7DoSF8ijoJ5QUpEA/O9/85P6sRUlTGAK/wHsZYwFkJiAWdDpy9D7muC9X5OtSeCUMFhaMo56lmyoetg6iA=="
|
||||||
},
|
},
|
||||||
"@humanwhocodes/config-array": {
|
"@humanwhocodes/config-array": {
|
||||||
"version": "0.5.0",
|
"version": "0.5.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "keanuapp-weblite",
|
"name": "keanuapp-weblite",
|
||||||
"version": "0.1.51",
|
"version": "0.1.52",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
"create-sticker-config": "node ./create_sticker_config.js $1"
|
"create-sticker-config": "node ./create_sticker_config.js $1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@guardianproject/proofmode": "^0.3.2",
|
"@guardianproject/proofmode": "^0.4.0",
|
||||||
"@matrix-org/olm": "^3.2.12",
|
"@matrix-org/olm": "^3.2.12",
|
||||||
"@vitejs/plugin-vue": "^5.2.3",
|
"@vitejs/plugin-vue": "^5.2.3",
|
||||||
"aes-js": "^3.1.2",
|
"aes-js": "^3.1.2",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "keanuapp-weblite",
|
"name": "keanuapp-weblite",
|
||||||
"version": "0.1.50",
|
"version": "0.1.51",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
"create-sticker-config": "node ./create_sticker_config.js $1"
|
"create-sticker-config": "node ./create_sticker_config.js $1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@guardianproject/proofmode": "^0.3.2",
|
"@guardianproject/proofmode": "^0.4.0",
|
||||||
"@matrix-org/olm": "^3.2.12",
|
"@matrix-org/olm": "^3.2.12",
|
||||||
"@vitejs/plugin-vue": "^5.2.3",
|
"@vitejs/plugin-vue": "^5.2.3",
|
||||||
"aes-js": "^3.1.2",
|
"aes-js": "^3.1.2",
|
||||||
|
|
|
||||||
|
|
@ -53,5 +53,6 @@
|
||||||
"experimental_read_only_room": true,
|
"experimental_read_only_room": true,
|
||||||
"experimental_public_room": true,
|
"experimental_public_room": true,
|
||||||
"show_status_messages": "never",
|
"show_status_messages": "never",
|
||||||
"hide_add_room_on_home": false
|
"hide_add_room_on_home": false,
|
||||||
|
"mirrors": []
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<v-card class="ma-3" v-show="locationLink" variant="flat">
|
<v-card class="ma-3" v-show="locationLink" variant="flat">
|
||||||
<v-container>
|
<v-container>
|
||||||
<slot/>
|
<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">
|
<v-col cols="auto">
|
||||||
<canvas
|
<canvas
|
||||||
v-longTap:250="[
|
v-longTap:250="[
|
||||||
|
|
@ -23,7 +23,26 @@
|
||||||
<div class="link">{{ locationLink }}</div>
|
<div class="link">{{ locationLink }}</div>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</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-col align="center" class="mt-0 pt-0">
|
||||||
<v-btn
|
<v-btn
|
||||||
id="btn-copy-room-link"
|
id="btn-copy-room-link"
|
||||||
|
|
@ -50,6 +69,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
QRCodePopup
|
QRCodePopup
|
||||||
},
|
},
|
||||||
|
emits: ['mirror-change'],
|
||||||
props: {
|
props: {
|
||||||
locationLink: {
|
locationLink: {
|
||||||
type: String
|
type: String
|
||||||
|
|
@ -61,19 +81,32 @@ export default {
|
||||||
i18nQrPopupTitleKey: {
|
i18nQrPopupTitleKey: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'room_info.scan_code'
|
default: 'room_info.scan_code'
|
||||||
|
},
|
||||||
|
allowMirrors: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
locationLinkCopied: false,
|
locationLinkCopied: false,
|
||||||
showFullScreenQR: false,
|
showFullScreenQR: false,
|
||||||
|
currentMirror: "",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
popupTitle() {
|
popupTitle() {
|
||||||
return this.$t(this.i18nQrPopupTitleKey);
|
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: {
|
methods: {
|
||||||
copyRoomLink() {
|
copyRoomLink() {
|
||||||
|
|
@ -118,6 +151,11 @@ export default {
|
||||||
handler() {
|
handler() {
|
||||||
this.updateQRCode();
|
this.updateQRCode();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
currentMirror: {
|
||||||
|
handler(newVal) {
|
||||||
|
this.$emit("mirror-change", newVal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-container>
|
</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-title class="h2">{{ $t("room_info.direct_link") }}</v-card-title>
|
||||||
<v-card-text>{{ $t("room_info.direct_link_desc") }}</v-card-text>
|
<v-card-text>{{ $t("room_info.direct_link_desc") }}</v-card-text>
|
||||||
</copy-link>
|
</copy-link>
|
||||||
|
|
@ -297,7 +297,8 @@ export default {
|
||||||
isAvatarLoaded: true,
|
isAvatarLoaded: true,
|
||||||
loadValue: 0,
|
loadValue: 0,
|
||||||
newPasswordHasError: false,
|
newPasswordHasError: false,
|
||||||
notificationDialog: false
|
notificationDialog: false,
|
||||||
|
currentMirror: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -306,7 +307,7 @@ export default {
|
||||||
return this.$matrix.currentUser.user_id
|
return this.$matrix.currentUser.user_id
|
||||||
},
|
},
|
||||||
directMessageLink() {
|
directMessageLink() {
|
||||||
return this.$router.getDMLink(this.$matrix.currentUser, this.$config);
|
return this.$router.getDMLink(this.$matrix.currentUser, this.$config, this.currentMirror);
|
||||||
},
|
},
|
||||||
passwordsMatch() {
|
passwordsMatch() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -425,6 +426,7 @@ export default {
|
||||||
if(this.globalNotification && this.windowNotificationPermission() !== 'granted') {
|
if(this.globalNotification && this.windowNotificationPermission() !== 'granted') {
|
||||||
this.onUpdateGlobalNotification(false);
|
this.onUpdateGlobalNotification(false);
|
||||||
}
|
}
|
||||||
|
this.currentMirror = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@
|
||||||
{{ $t("room_info.created_by", { user: creator }) }}
|
{{ $t("room_info.created_by", { user: creator }) }}
|
||||||
</div>
|
</div>
|
||||||
</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 class="account ma-3" variant="flat">
|
||||||
<v-card-title class="h2">{{ $t("room_info.permissions") }}</v-card-title>
|
<v-card-title class="h2">{{ $t("room_info.permissions") }}</v-card-title>
|
||||||
|
|
@ -419,7 +419,8 @@ export default {
|
||||||
],
|
],
|
||||||
SHOW_MEMBER_LIMIT: 5,
|
SHOW_MEMBER_LIMIT: 5,
|
||||||
exporting: false,
|
exporting: false,
|
||||||
activeMember: null
|
activeMember: null,
|
||||||
|
currentMirror: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -427,6 +428,7 @@ export default {
|
||||||
this.updateMembers();
|
this.updateMembers();
|
||||||
this.updateMessageRetention();
|
this.updateMessageRetention();
|
||||||
this.user = this.$matrix.matrixClient.getUser(this.$matrix.currentUserId);
|
this.user = this.$matrix.matrixClient.getUser(this.$matrix.currentUserId);
|
||||||
|
this.currentMirror = null;
|
||||||
|
|
||||||
// Display build version
|
// Display build version
|
||||||
this.buildVersion = buildVersion;
|
this.buildVersion = buildVersion;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ export default {
|
||||||
isRoomTopicEditMode: false,
|
isRoomTopicEditMode: false,
|
||||||
roomTopicErrorMessage: null,
|
roomTopicErrorMessage: null,
|
||||||
messageRetentionDisplay: "",
|
messageRetentionDisplay: "",
|
||||||
|
currentMirror: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -69,7 +70,8 @@ export default {
|
||||||
this.room.name,
|
this.room.name,
|
||||||
utils.roomDisplayTypeToQueryParam(this.room, this.roomDisplayType),
|
utils.roomDisplayTypeToQueryParam(this.room, this.roomDisplayType),
|
||||||
this.roomDisplayType == ROOM_TYPE_CHANNEL, /* Auto join for channels */
|
this.roomDisplayType == ROOM_TYPE_CHANNEL, /* Auto join for channels */
|
||||||
this.roomJoinRule == "knock"
|
this.roomJoinRule == "knock",
|
||||||
|
this.currentMirror
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ router.beforeEach((to, from, next) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.getRoomLink = function (alias, roomId, roomName, mode, autojoin, knock) {
|
router.getRoomLink = function (alias, roomId, roomName, mode, autojoin, knock, mirror) {
|
||||||
let params = {};
|
let params = {};
|
||||||
if ((!alias || roomName.replace(/\s/g, "").toLowerCase() !== util.getRoomNameFromAlias(alias)) && roomName) {
|
if ((!alias || roomName.replace(/\s/g, "").toLowerCase() !== util.getRoomNameFromAlias(alias)) && roomName) {
|
||||||
// There is no longer a correlation between alias and room name, probably because room name has
|
// There is no longer a correlation between alias and room name, probably because room name has
|
||||||
|
|
@ -229,16 +229,16 @@ router.getRoomLink = function (alias, roomId, roomName, mode, autojoin, knock) {
|
||||||
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
||||||
.join('&')
|
.join('&')
|
||||||
}
|
}
|
||||||
return window.location.origin + window.location.pathname + "#/room/" + autoJoinSegment + encodeURIComponent(util.sanitizeRoomId(alias || roomId)) + queryString;
|
return (mirror ? (window.location.protocol + "//" + mirror) : window.location.origin) + window.location.pathname + "#/room/" + autoJoinSegment + encodeURIComponent(util.sanitizeRoomId(alias || roomId)) + queryString;
|
||||||
}
|
}
|
||||||
|
|
||||||
router.getDMLink = function (user, config) {
|
router.getDMLink = function (user, config, mirror) {
|
||||||
let userId = user.user_id;
|
let userId = user.user_id;
|
||||||
if (User.domainPart(userId) === config.defaultMatrixDomainPart && !config.useFullyQualifiedDMLinks) {
|
if (User.domainPart(userId) === config.defaultMatrixDomainPart && !config.useFullyQualifiedDMLinks) {
|
||||||
// Using default server, don't include it in the link
|
// Using default server, don't include it in the link
|
||||||
userId = User.localPart(user.user_id);
|
userId = User.localPart(user.user_id);
|
||||||
}
|
}
|
||||||
return `${window.location.origin + window.location.pathname}#/user/${encodeURIComponent(userId)}`
|
return `${(mirror ? (window.location.protocol + "//" + mirror) : window.location.origin) + window.location.pathname}#/user/${encodeURIComponent(userId)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue