From 2870f9217e167becefbaec3f1f4ef4f638fe4411 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 3 Oct 2020 14:58:33 +0200 Subject: [PATCH] Show caldav url in settings if it's enabled server side --- src/components/sharing/linkSharing.vue | 4 +-- src/store/modules/config.js | 2 ++ src/styles/theme/link-share.scss | 26 +++++++------- src/views/user/Settings.vue | 49 +++++++++++++++++++++++++- 4 files changed, 64 insertions(+), 17 deletions(-) diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index 79c12db9..59cc923b 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -38,12 +38,12 @@ @@ -204,6 +238,7 @@ import TotpService from '../../services/totp' import {mapState} from 'vuex' import AvatarSettings from '../../components/user/avatar-settings' +import copy from 'copy-to-clipboard' export default { name: 'Settings', @@ -223,6 +258,8 @@ export default { totpConfirmPasscode: '', totpDisableForm: false, totpDisablePassword: '', + + caldavUrl: '', } }, components: { @@ -239,6 +276,7 @@ export default { this.totp = new TotpModel() this.totpStatus() + this.buildCaldavUrl() }, mounted() { this.setTitle('Settings') @@ -246,6 +284,8 @@ export default { computed: mapState({ totpEnabled: state => state.config.totpEnabled, migratorsEnabled: state => state.config.availableMigrators !== null && state.config.availableMigrators.length > 0, + caldavEnabled: state => state.config.caldavEnabled, + userInfo: state => state.auth.info, }), methods: { updatePassword() { @@ -319,6 +359,13 @@ export default { }) .catch(e => this.error(e, this)) }, + buildCaldavUrl() { + const apiBase = window.API_URL.replace('/api/v1', '') + this.caldavUrl = `${apiBase}/dav/principals/${this.userInfo.username}/` + }, + copy(text) { + copy(text) + }, }, }