2018-12-03 12:44:03 +02:00
|
|
|
<template>
|
2018-12-12 16:21:02 +02:00
|
|
|
<ui-card v-if="enableTwitterIntegration || enableDiscordIntegration || enableGithubIntegration">
|
2019-02-18 04:13:56 +02:00
|
|
|
<template #title><fa icon="share-alt"/> {{ $t('title') }}</template>
|
2018-12-03 12:44:03 +02:00
|
|
|
|
2018-12-12 16:21:02 +02:00
|
|
|
<section v-if="enableTwitterIntegration">
|
2018-12-03 12:44:03 +02:00
|
|
|
<header><fa :icon="['fab', 'twitter']"/> Twitter</header>
|
|
|
|
<p v-if="$store.state.i.twitter">{{ $t('connected-to') }}: <a :href="`https://twitter.com/${$store.state.i.twitter.screenName}`" target="_blank">@{{ $store.state.i.twitter.screenName }}</a></p>
|
|
|
|
<ui-button v-if="$store.state.i.twitter" @click="disconnectTwitter">{{ $t('disconnect') }}</ui-button>
|
|
|
|
<ui-button v-else @click="connectTwitter">{{ $t('connect') }}</ui-button>
|
|
|
|
</section>
|
|
|
|
|
2018-12-12 16:21:02 +02:00
|
|
|
<section v-if="enableDiscordIntegration">
|
2018-12-03 12:44:03 +02:00
|
|
|
<header><fa :icon="['fab', 'discord']"/> Discord</header>
|
2018-12-03 18:07:26 +02:00
|
|
|
<p v-if="$store.state.i.discord">{{ $t('connected-to') }}: <a :href="`https://discordapp.com/users/${$store.state.i.discord.id}`" target="_blank">@{{ $store.state.i.discord.username }}#{{ $store.state.i.discord.discriminator }}</a></p>
|
2018-12-03 12:44:03 +02:00
|
|
|
<ui-button v-if="$store.state.i.discord" @click="disconnectDiscord">{{ $t('disconnect') }}</ui-button>
|
|
|
|
<ui-button v-else @click="connectDiscord">{{ $t('connect') }}</ui-button>
|
|
|
|
</section>
|
|
|
|
|
2018-12-12 16:21:02 +02:00
|
|
|
<section v-if="enableGithubIntegration">
|
2018-12-03 12:44:03 +02:00
|
|
|
<header><fa :icon="['fab', 'github']"/> GitHub</header>
|
2018-12-03 18:07:26 +02:00
|
|
|
<p v-if="$store.state.i.github">{{ $t('connected-to') }}: <a :href="`https://github.com/${$store.state.i.github.login}`" target="_blank">@{{ $store.state.i.github.login }}</a></p>
|
2018-12-03 12:44:03 +02:00
|
|
|
<ui-button v-if="$store.state.i.github" @click="disconnectGithub">{{ $t('disconnect') }}</ui-button>
|
|
|
|
<ui-button v-else @click="connectGithub">{{ $t('connect') }}</ui-button>
|
|
|
|
</section>
|
|
|
|
</ui-card>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import i18n from '../../../i18n';
|
|
|
|
import { apiUrl } from '../../../config';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
i18n: i18n('common/views/components/integration-settings.vue'),
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
apiUrl,
|
|
|
|
twitterForm: null,
|
|
|
|
discordForm: null,
|
|
|
|
githubForm: null,
|
2018-12-12 16:21:02 +02:00
|
|
|
enableTwitterIntegration: false,
|
|
|
|
enableDiscordIntegration: false,
|
|
|
|
enableGithubIntegration: false,
|
2018-12-03 12:44:03 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2018-12-12 16:21:02 +02:00
|
|
|
created() {
|
|
|
|
this.$root.getMeta().then(meta => {
|
|
|
|
this.enableTwitterIntegration = meta.enableTwitterIntegration;
|
|
|
|
this.enableDiscordIntegration = meta.enableDiscordIntegration;
|
|
|
|
this.enableGithubIntegration = meta.enableGithubIntegration;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2018-12-03 12:44:03 +02:00
|
|
|
mounted() {
|
2018-12-09 18:44:43 +02:00
|
|
|
document.cookie = `i=${this.$store.state.i.token}`;
|
2018-12-03 12:44:03 +02:00
|
|
|
this.$watch('$store.state.i', () => {
|
|
|
|
if (this.$store.state.i.twitter) {
|
|
|
|
if (this.twitterForm) this.twitterForm.close();
|
|
|
|
}
|
2018-12-09 18:44:43 +02:00
|
|
|
if (this.$store.state.i.discord) {
|
|
|
|
if (this.discordForm) this.discordForm.close();
|
|
|
|
}
|
|
|
|
if (this.$store.state.i.github) {
|
|
|
|
if (this.githubForm) this.githubForm.close();
|
|
|
|
}
|
2018-12-03 12:44:03 +02:00
|
|
|
}, {
|
|
|
|
deep: true
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
connectTwitter() {
|
|
|
|
this.twitterForm = window.open(apiUrl + '/connect/twitter',
|
|
|
|
'twitter_connect_window',
|
|
|
|
'height=570, width=520');
|
|
|
|
},
|
|
|
|
|
|
|
|
disconnectTwitter() {
|
|
|
|
window.open(apiUrl + '/disconnect/twitter',
|
|
|
|
'twitter_disconnect_window',
|
|
|
|
'height=570, width=520');
|
|
|
|
},
|
|
|
|
|
|
|
|
connectDiscord() {
|
|
|
|
this.discordForm = window.open(apiUrl + '/connect/discord',
|
|
|
|
'discord_connect_window',
|
|
|
|
'height=570, width=520');
|
|
|
|
},
|
|
|
|
|
|
|
|
disconnectDiscord() {
|
|
|
|
window.open(apiUrl + '/disconnect/discord',
|
|
|
|
'discord_disconnect_window',
|
|
|
|
'height=570, width=520');
|
|
|
|
},
|
|
|
|
|
|
|
|
connectGithub() {
|
|
|
|
this.githubForm = window.open(apiUrl + '/connect/github',
|
|
|
|
'github_connect_window',
|
|
|
|
'height=570, width=520');
|
|
|
|
},
|
|
|
|
|
|
|
|
disconnectGithub() {
|
|
|
|
window.open(apiUrl + '/disconnect/github',
|
|
|
|
'github_disconnect_window',
|
|
|
|
'height=570, width=520');
|
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
</style>
|