[ru] add age limit to protect our Russian contributors

This commit is contained in:
Andrea 2022-02-13 17:06:46 +01:00
parent 771e545e29
commit 3d9373192b
7 changed files with 33 additions and 4 deletions

View File

@ -58,6 +58,10 @@
<p class="h6 mb-2">
<T>footer.legal</T><T>quotation.colon</T>
</p>
<p v-if="$te('footer.ageLimit')">
<Icon v="exclamation-triangle"/>
<T>footer.ageLimit</T>
</p>
<ul class="list-unstyled mb-4">
<li class="mb-2">
<nuxt-link :to="`/${config.user.termsRoute}`">

View File

@ -27,7 +27,7 @@
<p v-for="line in profile.description.split('\n')" class="mb-1">
<Twemoji><Spelling escape :text="line"/></Twemoji>
</p>
<p v-if="profile.age">
<p v-if="profile.age && profile.age >= minAge">
<Icon v="birthday-cake"/>
{{ profile.age }}
</p>
@ -125,6 +125,7 @@
return {
allFlags: process.env.FLAGS,
glue: ' ' + this.$t('pronouns.or') + ' ',
minAge: parseInt(process.env.MIN_AGE),
}
},
computed: {
@ -197,7 +198,9 @@
return this.countFlags > 36 || this.countFlags === 0 || !this.hasDescriptionColumn;
},
hasDescriptionColumn() {
return this.profile.age || this.profile.description.trim().length || this.profile.team;
return (this.profile.age && this.profile.age > this.minAge)
|| this.profile.description.trim().length
|| this.profile.team;
},
mainRowCount() {
let c = 0;

View File

@ -17,6 +17,7 @@
import Vue from 'vue';
import dark from "../plugins/dark";
import sorter from "avris-sorter";
import {sleep} from "../src/helpers";
export default {
mixins: [dark],
@ -27,6 +28,7 @@
});
};
Vue.prototype.$confirm = (message = '', color='primary') => {
console.log(this, this.$refs);
return new Promise((resolve, reject) => {
this.$refs.dialogue.show(true, message, color, resolve, reject);
});
@ -52,6 +54,8 @@
//this.monkeyPatchBlockTrackers(['google-analytics.com', 'tkr.arc.io', 'browser.sentry-cdn.com',]);
this.$loadScript('arc', 'https://arc.io/widget.min.js#yHdNYRkC');
}
this.confirmAge();
},
methods: {
monkeyPatchBlockTrackers(trackers) {
@ -69,6 +73,18 @@
origInsertBefore.call(this, ...args);
};
},
async confirmAge() {
if (!this.$te('footer.ageLimit') || localStorage.getItem('ageConfirmed')) {
return;
}
while (this.$refs.dialogue === undefined) {
await sleep(100);
}
await this.$alert(this.$t('footer.ageLimit'));
localStorage.setItem('ageConfirmed', '1');
}
},
}
</script>

View File

@ -294,3 +294,5 @@ census:
redirects: []
api: ~
ageLimit: 18

View File

@ -85,7 +85,7 @@ sources:
Series: 'Сериалы'
Song: 'Музыка'
Poetry: 'Поэзия'
Comics: 'Комиксы'
Comics: 'Комиксы'
Game: 'Видеоигры'
Other: 'Другие'
submit:
@ -584,6 +584,9 @@ footer:
financial: 'Финансовая прозрачность'
technical: 'Технически'
sibling: 'Сестринские проекты'
ageLimit: >
Этот сайт имеет возрастное ограничение 18+.
Оставаясь на сайте, вы подтверждаете, что достигли совершеннолетия, и самостоятельно несёте ответственность за свои действия.
notFound:
message: 'Страница не найдена'

View File

@ -180,6 +180,7 @@ export default {
HCAPTCHA_SITEKEY: process.env.HCAPTCHA_SITEKEY,
ALL_LOCALES_URLS: process.env.ALL_LOCALES_URLS,
LOGO: logo,
MIN_AGE: config.ageLimit || 13,
},
serverMiddleware: ['~/server/no-ssr.js', '~/server/index.js'],
axios: {

View File

@ -1,6 +1,6 @@
const today = new Date();
const minBirthdate = new Date(1900, 0, 1);
const maxBirthdate = new Date(today.getFullYear()-13, today.getMonth(), today.getDate())
const maxBirthdate = new Date(today.getFullYear() - parseInt(process.env.MIN_AGE), today.getMonth(), today.getDate())
module.exports = {
minBirthdate,