Fix issues with privacy settings
This commit is contained in:
parent
03b2d02742
commit
7d3ad5a639
@ -13,8 +13,8 @@
|
|||||||
button below:
|
button below:
|
||||||
</span>
|
</span>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button class="btn button" @click="hide">Accept all</button>
|
<button class="btn button" @click="review">Review</button>
|
||||||
<button class="btn brand-button" @click="review">Review</button>
|
<button class="btn brand-button" @click="hide">Accept all</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -24,12 +24,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'CookieConsent',
|
name: 'CookieConsent',
|
||||||
data() {
|
fetch() {
|
||||||
return {
|
|
||||||
shown: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
// Get informations in the store
|
// Get informations in the store
|
||||||
this.$store.dispatch('consent/loadFromCookies', this.$cookies)
|
this.$store.dispatch('consent/loadFromCookies', this.$cookies)
|
||||||
if (
|
if (
|
||||||
@ -39,12 +34,20 @@ export default {
|
|||||||
this.shown = true
|
this.shown = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
shown: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
hide() {
|
hide() {
|
||||||
this.shown = false
|
this.$store.commit('consent/set_consent', true)
|
||||||
|
this.$store.commit('consent/add_scope', true)
|
||||||
|
this.$store.commit('consent/remove_scope', true)
|
||||||
|
this.$store.dispatch('consent/save', this.$cookies)
|
||||||
},
|
},
|
||||||
review() {
|
review() {
|
||||||
this.hide()
|
this.shown = false
|
||||||
this.$router.push('/dashboard/privacy')
|
this.$router.push('/dashboard/privacy')
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -9,6 +9,9 @@ function isAnalyticsOn(ctx) {
|
|||||||
// Rely on the client
|
// Rely on the client
|
||||||
cookies = document.cookie;
|
cookies = document.cookie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!cookies) return true;
|
||||||
|
|
||||||
let processed = {}
|
let processed = {}
|
||||||
cookies.split(';').forEach((e) => {
|
cookies.split(';').forEach((e) => {
|
||||||
let val = e.trim().split('=');
|
let val = e.trim().split('=');
|
||||||
@ -27,14 +30,13 @@ export default async function (ctx, inject) {
|
|||||||
const tag = config.tracking_code ?? '<%= options.tracking_code %>';
|
const tag = config.tracking_code ?? '<%= options.tracking_code %>';
|
||||||
const enabled = config.enabled ?? <%= options.enabled || false %>;
|
const enabled = config.enabled ?? <%= options.enabled || false %>;
|
||||||
// Check if the parameters are not changed by runtime config:
|
// Check if the parameters are not changed by runtime config:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const UNAMI_LIB_TAG_ID = '<%= options.UNAMI_LIB_TAG_ID %>';
|
const UNAMI_LIB_TAG_ID = '<%= options.UNAMI_LIB_TAG_ID %>';
|
||||||
|
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
console.log("Analytics are not enabled.")
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
function isPersonalizedAdsOn(ctx) {
|
function isPersonalizedAdsOn(ctx) {
|
||||||
let cookies = null
|
let cookies = []
|
||||||
if (ctx.req != null) {
|
if (ctx.req != null) {
|
||||||
//Server side rendering
|
//Server side rendering
|
||||||
cookies = ctx.req.headers.cookie;
|
cookies = ctx.req.headers.cookie;
|
||||||
@ -9,6 +9,9 @@ function isPersonalizedAdsOn(ctx) {
|
|||||||
// Rely on the client
|
// Rely on the client
|
||||||
cookies = document.cookie;
|
cookies = document.cookie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!cookies) return true;
|
||||||
|
|
||||||
let processed = {}
|
let processed = {}
|
||||||
cookies.split(';').forEach((e) => {
|
cookies.split(';').forEach((e) => {
|
||||||
let val = e.trim().split('=')
|
let val = e.trim().split('=')
|
||||||
@ -102,7 +105,7 @@ export default async function (ctx, inject) {
|
|||||||
};
|
};
|
||||||
injectScript(gptInitScript);
|
injectScript(gptInitScript);
|
||||||
|
|
||||||
|
|
||||||
const component = require('./component.js');
|
const component = require('./component.js');
|
||||||
Vue.component('<%= options.componentName %>', component.default || component);
|
Vue.component('<%= options.componentName %>', component.default || component);
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,10 @@
|
|||||||
<SettingsIcon />
|
<SettingsIcon />
|
||||||
Settings
|
Settings
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
|
<nuxt-link :to="'/dashboard/privacy'" class="tab last">
|
||||||
|
<SettingsIcon />
|
||||||
|
Privacy Settings
|
||||||
|
</nuxt-link>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="card page-nav">
|
<div v-else class="card page-nav">
|
||||||
<a :href="authUrl" class="tab last">
|
<a :href="authUrl" class="tab last">
|
||||||
|
|||||||
@ -47,20 +47,25 @@
|
|||||||
import scopes from '@/privacy-toggles'
|
import scopes from '@/privacy-toggles'
|
||||||
export default {
|
export default {
|
||||||
name: 'Privacy',
|
name: 'Privacy',
|
||||||
data: () => {
|
fetch() {
|
||||||
const settings = scopes.settings
|
Object.keys(scopes.settings).forEach((key) => {
|
||||||
return {
|
scopes.settings[key].value = scopes.settings[key].default
|
||||||
scopes: settings,
|
})
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$store.dispatch('consent/loadFromCookies', this.$cookies)
|
this.$store.dispatch('consent/loadFromCookies', this.$cookies)
|
||||||
|
|
||||||
// Load the allowed scopes from the store
|
// Load the allowed scopes from the store
|
||||||
this.$store.state.consent.scopes_allowed.forEach((scope) => {
|
this.$store.state.consent.scopes_allowed.forEach((scope) => {
|
||||||
if (this.scopes[scope] != null)
|
if (this.scopes[scope] != null)
|
||||||
this.$set(this.scopes[scope], 'value', true)
|
this.$set(this.scopes[scope], 'value', true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
data: () => {
|
||||||
|
const settings = scopes.settings
|
||||||
|
return {
|
||||||
|
scopes: settings,
|
||||||
|
}
|
||||||
|
},
|
||||||
options: {
|
options: {
|
||||||
auth: false,
|
auth: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -5,7 +5,7 @@ export default {
|
|||||||
description: `Marketing/target cookies are usually used to show you advertisements that meet your interests.
|
description: `Marketing/target cookies are usually used to show you advertisements that meet your interests.
|
||||||
When you visit another website, your browser's cookie is recognized and selected ads are displayed to you
|
When you visit another website, your browser's cookie is recognized and selected ads are displayed to you
|
||||||
based on the information stored in this cookie.`,
|
based on the information stored in this cookie.`,
|
||||||
default: false,
|
default: true,
|
||||||
},
|
},
|
||||||
analytics: {
|
analytics: {
|
||||||
title: 'Analytics',
|
title: 'Analytics',
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export const actions = {
|
|||||||
}
|
}
|
||||||
state.commit('set_consent', $cookies.get('modrinth-consent') === true)
|
state.commit('set_consent', $cookies.get('modrinth-consent') === true)
|
||||||
const scopes = $cookies.get('modrinth-scopes')
|
const scopes = $cookies.get('modrinth-scopes')
|
||||||
if (scopes == null) return
|
if (!scopes) return
|
||||||
scopes.split(',').forEach((elem) => {
|
scopes.split(',').forEach((elem) => {
|
||||||
state.commit('add_scope', elem)
|
state.commit('add_scope', elem)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user