2020-01-29 13:37:25 -06:00
|
|
|
<template>
|
2022-01-04 03:21:00 -06:00
|
|
|
<div class="_formRoot">
|
|
|
|
<FormSection v-if="enableTwitterIntegration">
|
|
|
|
<template #label><i class="fab fa-twitter"></i> Twitter</template>
|
|
|
|
<p v-if="integrations.twitter">{{ $ts.connectedTo }}: <a :href="`https://twitter.com/${integrations.twitter.screenName}`" rel="nofollow noopener" target="_blank">@{{ integrations.twitter.screenName }}</a></p>
|
|
|
|
<MkButton v-if="integrations.twitter" danger @click="disconnectTwitter">{{ $ts.disconnectService }}</MkButton>
|
|
|
|
<MkButton v-else primary @click="connectTwitter">{{ $ts.connectService }}</MkButton>
|
|
|
|
</FormSection>
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2022-01-04 03:21:00 -06:00
|
|
|
<FormSection v-if="enableDiscordIntegration">
|
|
|
|
<template #label><i class="fab fa-discord"></i> Discord</template>
|
|
|
|
<p v-if="integrations.discord">{{ $ts.connectedTo }}: <a :href="`https://discord.com/users/${integrations.discord.id}`" rel="nofollow noopener" target="_blank">@{{ integrations.discord.username }}#{{ integrations.discord.discriminator }}</a></p>
|
|
|
|
<MkButton v-if="integrations.discord" danger @click="disconnectDiscord">{{ $ts.disconnectService }}</MkButton>
|
|
|
|
<MkButton v-else primary @click="connectDiscord">{{ $ts.connectService }}</MkButton>
|
|
|
|
</FormSection>
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2022-01-04 03:21:00 -06:00
|
|
|
<FormSection v-if="enableGithubIntegration">
|
|
|
|
<template #label><i class="fab fa-github"></i> GitHub</template>
|
|
|
|
<p v-if="integrations.github">{{ $ts.connectedTo }}: <a :href="`https://github.com/${integrations.github.login}`" rel="nofollow noopener" target="_blank">@{{ integrations.github.login }}</a></p>
|
|
|
|
<MkButton v-if="integrations.github" danger @click="disconnectGithub">{{ $ts.disconnectService }}</MkButton>
|
|
|
|
<MkButton v-else primary @click="connectGithub">{{ $ts.connectService }}</MkButton>
|
|
|
|
</FormSection>
|
|
|
|
</div>
|
2020-01-29 13:37:25 -06:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 06:12:00 -05:00
|
|
|
import { defineComponent } from 'vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import { apiUrl } from '@/config';
|
2022-01-04 03:21:00 -06:00
|
|
|
import FormSection from '@/components/form/section.vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import MkButton from '@/components/ui/button.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import * as symbols from '@/symbols';
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
export default defineComponent({
|
2020-01-29 13:37:25 -06:00
|
|
|
components: {
|
2022-01-04 03:21:00 -06:00
|
|
|
FormSection,
|
2020-01-29 13:37:25 -06:00
|
|
|
MkButton
|
|
|
|
},
|
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
emits: ['info'],
|
|
|
|
|
2020-01-29 13:37:25 -06:00
|
|
|
data() {
|
|
|
|
return {
|
2021-04-09 22:54:12 -05:00
|
|
|
[symbols.PAGE_INFO]: {
|
2020-12-25 19:47:36 -06:00
|
|
|
title: this.$ts.integration,
|
2021-09-29 10:50:45 -05:00
|
|
|
icon: 'fas fa-share-alt',
|
|
|
|
bg: 'var(--bg)',
|
2020-10-17 06:12:00 -05:00
|
|
|
},
|
2020-01-29 13:37:25 -06:00
|
|
|
apiUrl,
|
|
|
|
twitterForm: null,
|
|
|
|
discordForm: null,
|
|
|
|
githubForm: null,
|
|
|
|
enableTwitterIntegration: false,
|
|
|
|
enableDiscordIntegration: false,
|
|
|
|
enableGithubIntegration: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-01-31 16:16:52 -06:00
|
|
|
computed: {
|
|
|
|
integrations() {
|
2020-12-18 19:55:52 -06:00
|
|
|
return this.$i.integrations;
|
2020-02-10 08:17:42 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
meta() {
|
2020-12-18 19:55:52 -06:00
|
|
|
return this.$instance;
|
2020-02-10 08:17:42 -06:00
|
|
|
},
|
2020-01-31 16:16:52 -06:00
|
|
|
},
|
|
|
|
|
2020-01-29 13:37:25 -06:00
|
|
|
created() {
|
2020-02-10 08:17:42 -06:00
|
|
|
this.enableTwitterIntegration = this.meta.enableTwitterIntegration;
|
|
|
|
this.enableDiscordIntegration = this.meta.enableDiscordIntegration;
|
|
|
|
this.enableGithubIntegration = this.meta.enableGithubIntegration;
|
2020-01-29 13:37:25 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2021-04-09 22:54:12 -05:00
|
|
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2020-12-18 19:55:52 -06:00
|
|
|
document.cookie = `igi=${this.$i.token}; path=/;` +
|
2020-03-19 23:56:22 -05:00
|
|
|
` max-age=31536000;` +
|
2020-01-29 13:37:25 -06:00
|
|
|
(document.location.protocol.startsWith('https') ? ' secure' : '');
|
2020-03-19 23:56:22 -05:00
|
|
|
|
2020-01-31 16:16:52 -06:00
|
|
|
this.$watch('integrations', () => {
|
|
|
|
if (this.integrations.twitter) {
|
2020-01-29 13:37:25 -06:00
|
|
|
if (this.twitterForm) this.twitterForm.close();
|
|
|
|
}
|
2020-01-31 16:16:52 -06:00
|
|
|
if (this.integrations.discord) {
|
2020-01-29 13:37:25 -06:00
|
|
|
if (this.discordForm) this.discordForm.close();
|
|
|
|
}
|
2020-01-31 16:16:52 -06:00
|
|
|
if (this.integrations.github) {
|
2020-01-29 13:37:25 -06:00
|
|
|
if (this.githubForm) this.githubForm.close();
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
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>
|