Add ariadnee (#560)

This commit is contained in:
Geometrically 2022-07-01 20:15:01 -07:00 committed by GitHub
parent 153d77359f
commit 928f6e7009
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 13 deletions

View File

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

View File

@ -291,7 +291,9 @@ export default {
ethicalAds: process.env.ETHICAL_ADS,
},
analytics: {
base_url: process.env.ARIADNE_URL,
base_url:
process.env.BROWSER_ARIADNE_URL ||
'https://staging-ariadne.modrinth.com/v1/',
},
},
privateRuntimeConfig: {
@ -299,10 +301,15 @@ export default {
baseURL: process.env.BASE_URL,
headers: {
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: {} }
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) {

View File

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