Add ariadnee (#560)

This commit is contained in:
Geometrically
2022-07-01 20:15:01 -07:00
committed by GitHub
parent 153d77359f
commit 928f6e7009
5 changed files with 25 additions and 13 deletions

View File

@@ -1,6 +1,4 @@
export default function (context) { export default function (context) {
// Temporary disable analytics
/*
if (process.client && context.from.path === context.route.path) { if (process.client && context.from.path === context.route.path) {
return return
} }
@@ -11,15 +9,22 @@ export default function (context) {
setTimeout(() => { setTimeout(() => {
context.$axios context.$axios
.post(`${context.$config.analytics.base_url}/register/visit`, { .post(
path: context.route.path, `${context.$config.analytics.base_url}view`,
domain: process.server ? context.req.headers.host : location.host, {
consent: false, url: process.env.domain + context.route.fullPath,
}) },
context.$config.analytics.admin_key
? {
headers: {
'Modrinth-Admin': context.$config.analytics.admin_key,
},
}
: {}
)
.then(() => {}) .then(() => {})
.catch((e) => { .catch((e) => {
console.error('An error occurred while registering the visit: ', e) console.error('An error occurred while registering the visit: ', e)
}) })
}) })
*/
} }

View File

@@ -291,7 +291,9 @@ export default {
ethicalAds: process.env.ETHICAL_ADS, ethicalAds: process.env.ETHICAL_ADS,
}, },
analytics: { analytics: {
base_url: process.env.ARIADNE_URL, base_url:
process.env.BROWSER_ARIADNE_URL ||
'https://staging-ariadne.modrinth.com/v1/',
}, },
}, },
privateRuntimeConfig: { privateRuntimeConfig: {
@@ -299,10 +301,15 @@ export default {
baseURL: process.env.BASE_URL, baseURL: process.env.BASE_URL,
headers: { headers: {
common: { common: {
'x-ratelimit-key': process.env.RATE_LIMIT_IGNORE_KEY, 'x-ratelimit-key': process.env.RATE_LIMIT_IGNORE_KEY || '',
}, },
}, },
}, },
analytics: {
base_url:
process.env.ARIADNE_URL || 'https://staging-ariadne.modrinth.com/v1/',
admin_key: process.env.ARIADNE_ADMIN_KEY,
},
}, },
} }

View File

@@ -6,7 +6,7 @@ export default ({ store }, inject) => {
const obj = { headers: {} } const obj = { headers: {} }
if (process.server && process.env.RATE_LIMIT_IGNORE_KEY) { if (process.server && process.env.RATE_LIMIT_IGNORE_KEY) {
obj.headers['x-ratelimit-key'] = process.env.RATE_LIMIT_IGNORE_KEY obj.headers['x-ratelimit-key'] = process.env.RATE_LIMIT_IGNORE_KEY || ''
} }
if (store.state.auth.user) { if (store.state.auth.user) {

View File

@@ -24,7 +24,7 @@ export const actions = {
headers: { headers: {
Authorization: token, Authorization: token,
'x-ratelimit-key': process.server 'x-ratelimit-key': process.server
? process.env.RATE_LIMIT_IGNORE_KEY ? process.env.RATE_LIMIT_IGNORE_KEY || ''
: '', : '',
}, },
}) })

View File

@@ -29,7 +29,7 @@ export const actions = {
const headers = { const headers = {
headers: { headers: {
'x-ratelimit-key': process.server 'x-ratelimit-key': process.server
? process.env.RATE_LIMIT_IGNORE_KEY ? process.env.RATE_LIMIT_IGNORE_KEY || ''
: '', : '',
}, },
} }