fc49015ff0
* Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (405 of 405 strings) Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (2781 of 2781 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (135 of 135 strings) Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (217 of 217 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (56 of 56 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (13 of 13 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (112 of 112 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (131 of 131 strings) Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (405 of 405 strings) Translated using Weblate (Portuguese) Currently translated at 81.7% (331 of 405 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (214 of 214 strings) Translated using Weblate (Portuguese) Currently translated at 62.5% (5 of 8 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (61 of 61 strings) Translated using Weblate (Portuguese) Currently translated at 63.8% (1777 of 2781 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (182 of 182 strings) Translated using Weblate (Portuguese) Currently translated at 71.6% (43 of 60 strings) Translated using Weblate (Portuguese) Currently translated at 79.7% (609 of 764 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (375 of 375 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (47 of 47 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (770 of 770 strings) Translated using Weblate (Portuguese) Currently translated at 100.0% (146 of 146 strings) Translated using Weblate (German) Currently translated at 100.0% (404 of 404 strings) Translated using Weblate (German) Currently translated at 79.5% (97 of 122 strings) Translated using Weblate (German) Currently translated at 97.7% (753 of 770 strings) Translated using Weblate (German) Currently translated at 100.0% (146 of 146 strings) Translated using Weblate (Portuguese) Currently translated at 77.0% (94 of 122 strings) Translated using Weblate (Indonesian) Currently translated at 76.7% (310 of 404 strings) Translated using Weblate (Portuguese) Currently translated at 76.2% (93 of 122 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 85.6% (2381 of 2781 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (60 of 60 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (217 of 217 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (112 of 112 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (267 of 267 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (404 of 404 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (182 of 182 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 95.8% (732 of 764 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (122 of 122 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (375 of 375 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (770 of 770 strings) Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (146 of 146 strings) Translated using Weblate (Portuguese) Currently translated at 74.5% (91 of 122 strings) Translated using Weblate (Portuguese) Currently translated at 72.1% (88 of 122 strings) Co-authored-by: Ana Beatriz <anabeatriz.augusto06@yahoo.com> Co-authored-by: Andressa Murari Sudré <andressa@sudre.com.br> Co-authored-by: Cachinhos <cachnhos@gmail.com> Co-authored-by: Falzart Werefox <muh_fauzi_ramadhan@yahoo.co.id> Co-authored-by: Jay <fallacyofwildlifeconservation@gmail.com> Co-authored-by: Jerry Chen <minecjraft@qq.com> Co-authored-by: Weblate <noreply@weblate.org> Co-authored-by: Yu-Wei Tien <a38498987911@gmail.com> Translate-URL: https://translate.habitica.com/projects/habitica/achievements/de/ Translate-URL: https://translate.habitica.com/projects/habitica/achievements/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/achievements/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/backgrounds/de/ Translate-URL: https://translate.habitica.com/projects/habitica/backgrounds/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/backgrounds/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/communityguidelines/de/ Translate-URL: https://translate.habitica.com/projects/habitica/communityguidelines/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/communityguidelines/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/content/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/content/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/contrib/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/faq/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/faq/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/front/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/front/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/gear/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/gear/zh_Hans/ Translate-URL: https://translate.habitica.com/projects/habitica/gear/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/generic/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/groups/de/ Translate-URL: https://translate.habitica.com/projects/habitica/groups/id/ Translate-URL: https://translate.habitica.com/projects/habitica/groups/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/groups/pt_BR/ Translate-URL: https://translate.habitica.com/projects/habitica/groups/zh_Hans/ Translate-URL: https://translate.habitica.com/projects/habitica/groups/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/limited/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/messages/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/npc/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/overview/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/pets/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/pets/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/questscontent/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/questscontent/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/rebirth/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/spells/pt/ Translate-URL: https://translate.habitica.com/projects/habitica/subscriber/pt_BR/ Translate-URL: https://translate.habitica.com/projects/habitica/subscriber/zh_Hant/ Translate-URL: https://translate.habitica.com/projects/habitica/tasks/pt/ Translation: Habitica/Achievements Translation: Habitica/Backgrounds Translation: Habitica/Communityguidelines Translation: Habitica/Content Translation: Habitica/Contrib Translation: Habitica/Faq Translation: Habitica/Front Translation: Habitica/Gear Translation: Habitica/Generic Translation: Habitica/Groups Translation: Habitica/Limited Translation: Habitica/Messages Translation: Habitica/Npc Translation: Habitica/Overview Translation: Habitica/Pets Translation: Habitica/Questscontent Translation: Habitica/Rebirth Translation: Habitica/Spells Translation: Habitica/Subscriber Translation: Habitica/Tasks * update press kit and third party app list in settings --------- Co-authored-by: Weblate <noreply@weblate.org> Co-authored-by: Ana Beatriz <anabeatriz.augusto06@yahoo.com> Co-authored-by: Andressa Murari Sudré <andressa@sudre.com.br> Co-authored-by: Cachinhos <cachnhos@gmail.com> Co-authored-by: Falzart Werefox <muh_fauzi_ramadhan@yahoo.co.id> Co-authored-by: Jay <fallacyofwildlifeconservation@gmail.com> Co-authored-by: Jerry Chen <minecjraft@qq.com> Co-authored-by: Yu-Wei Tien <a38498987911@gmail.com> Co-authored-by: SabreCat <sabe@habitica.com>
191 lines
5.2 KiB
Vue
191 lines
5.2 KiB
Vue
<template>
|
|
<div class="row standard-page">
|
|
<div class="col-6">
|
|
<h2>{{ $t('API') }}</h2>
|
|
<p>{{ $t('APIText') }}</p>
|
|
<div class="section">
|
|
<h6>{{ $t('userId') }}</h6>
|
|
<pre class="prettyprint">{{ user.id }}</pre>
|
|
<h6>{{ $t('APIToken') }}</h6>
|
|
<div class="d-flex align-items-center mb-3">
|
|
<button
|
|
class="btn btn-secondary"
|
|
@click="showApiToken = !showApiToken"
|
|
>
|
|
{{ $t(`${showApiToken ? 'hide' : 'show'}APIToken`) }}
|
|
</button>
|
|
<pre
|
|
v-if="showApiToken"
|
|
class="prettyprint ml-4 mb-0"
|
|
>{{ apiToken }}</pre>
|
|
</div>
|
|
<p v-html="$t('APITokenWarning', { hrefTechAssistanceEmail })"></p>
|
|
</div>
|
|
<div class="section">
|
|
<h3>{{ $t('thirdPartyApps') }}</h3>
|
|
<p v-html="$t('thirdPartyTools')"></p>
|
|
<hr>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<h2>{{ $t('webhooks') }}</h2>
|
|
<p v-html="$t('webhooksInfo')"></p>
|
|
<table class="table table-striped">
|
|
<thead v-if="user.webhooks.length">
|
|
<tr>
|
|
<th>{{ $t('enabled') }}</th>
|
|
<th>{{ $t('webhookURL') }}</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr
|
|
v-for="(webhook, index) in user.webhooks"
|
|
:key="webhook.id"
|
|
>
|
|
<td>
|
|
<input
|
|
v-model="webhook.enabled"
|
|
type="checkbox"
|
|
@change="saveWebhook(webhook, index)"
|
|
>
|
|
</td>
|
|
<td>
|
|
<input
|
|
v-model="webhook.url"
|
|
class="form-control"
|
|
type="url"
|
|
>
|
|
</td>
|
|
<td>
|
|
<div
|
|
class="btn btn-danger checklist-icons mr-2"
|
|
@click="deleteWebhook(webhook, index)"
|
|
>
|
|
<span
|
|
class="glyphicon glyphicon-trash"
|
|
:tooltip="$t('delete')"
|
|
> {{ $t('delete') }} </span>
|
|
</div>
|
|
<div
|
|
class="btn btn-primary checklist-icons"
|
|
@click="saveWebhook(webhook, index)"
|
|
>
|
|
{{ $t('subUpdateTitle') }}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">
|
|
<div class="form-horizontal">
|
|
<div class="form-group col-sm-10">
|
|
<input
|
|
v-model="newWebhook.url"
|
|
class="form-control"
|
|
type="url"
|
|
:placeholder="$t('webhookURL')"
|
|
>
|
|
</div>
|
|
<div class="col-sm-2">
|
|
<button
|
|
class="btn btn-sm btn-primary"
|
|
type="submit"
|
|
@click="addWebhook(newWebhook.url)"
|
|
>
|
|
{{ $t('add') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.section {
|
|
margin-top: 2em;
|
|
}
|
|
li span
|
|
{
|
|
display: block;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
import { mapState } from '@/libs/store';
|
|
import uuid from '@/../../common/script/libs/uuid';
|
|
// @TODO: env.EMAILS.TECH_ASSISTANCE_EMAIL
|
|
const TECH_ASSISTANCE_EMAIL = 'admin@habitica.com';
|
|
|
|
export default {
|
|
data () {
|
|
return {
|
|
newWebhook: {
|
|
url: '',
|
|
},
|
|
hrefTechAssistanceEmail: `<a href="mailto:${TECH_ASSISTANCE_EMAIL}">${TECH_ASSISTANCE_EMAIL}</a>`,
|
|
showApiToken: false,
|
|
};
|
|
},
|
|
computed: {
|
|
...mapState({ user: 'user.data', credentials: 'credentials' }),
|
|
apiToken () {
|
|
return this.credentials.API_TOKEN;
|
|
},
|
|
},
|
|
mounted () {
|
|
this.$store.dispatch('common:setTitle', {
|
|
section: this.$t('settings'),
|
|
subSection: this.$t('API'),
|
|
});
|
|
window.addEventListener('message', this.receiveMessage, false);
|
|
},
|
|
destroy () {
|
|
window.removeEventListener('message', this.receiveMessage);
|
|
},
|
|
methods: {
|
|
receiveMessage (eventFrom) {
|
|
if (eventFrom.origin !== 'https://www.spritely.app') return;
|
|
|
|
const creds = {
|
|
userId: this.user._id,
|
|
apiToken: this.credentials.API_TOKEN,
|
|
};
|
|
eventFrom.source.postMessage(creds, eventFrom.origin);
|
|
},
|
|
async addWebhook (url) {
|
|
const webhookInfo = {
|
|
id: uuid(),
|
|
type: 'taskActivity',
|
|
options: {
|
|
created: false,
|
|
updated: false,
|
|
deleted: false,
|
|
scored: true,
|
|
},
|
|
url,
|
|
enabled: true,
|
|
};
|
|
|
|
const webhook = await this.$store.dispatch('user:addWebhook', { webhookInfo });
|
|
this.user.webhooks.push(webhook);
|
|
|
|
this.newWebhook.url = '';
|
|
},
|
|
async saveWebhook (webhook, index) {
|
|
delete webhook._editing;
|
|
const updatedWebhook = await this.$store.dispatch('user:updateWebhook', { webhook });
|
|
this.user.webhooks[index] = updatedWebhook;
|
|
},
|
|
async deleteWebhook (webhook, index) {
|
|
delete webhook._editing;
|
|
await this.$store.dispatch('user:deleteWebhook', { webhook });
|
|
this.user.webhooks.splice(index, 1);
|
|
},
|
|
},
|
|
};
|
|
</script>
|