You've already forked AstralRinth
forked from didirus/AstralRinth
Disallow all in robots.txt unless prod (#5078)
This commit is contained in:
@@ -20,6 +20,9 @@ const favicons = {
|
|||||||
'(prefers-color-scheme:dark)': '/favicon.ico',
|
'(prefers-color-scheme:dark)': '/favicon.ico',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const PROD_MODRINTH_URL = 'https://modrinth.com'
|
||||||
|
const STAGING_MODRINTH_URL = 'https://staging.modrinth.com'
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
srcDir: 'src/',
|
srcDir: 'src/',
|
||||||
app: {
|
app: {
|
||||||
@@ -165,6 +168,13 @@ export default defineNuxtConfig({
|
|||||||
await fs.writeFile('./src/generated/state.json', JSON.stringify(state))
|
await fs.writeFile('./src/generated/state.json', JSON.stringify(state))
|
||||||
|
|
||||||
console.log('Tags generated!')
|
console.log('Tags generated!')
|
||||||
|
|
||||||
|
const robotsContent =
|
||||||
|
getDomain() === PROD_MODRINTH_URL
|
||||||
|
? 'User-agent: *\nDisallow: /_internal/'
|
||||||
|
: 'User-agent: *\nDisallow: /'
|
||||||
|
|
||||||
|
await fs.writeFile('./src/public/robots.txt', robotsContent)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
@@ -329,9 +339,9 @@ function getDomain() {
|
|||||||
} else if (process.env.VERCEL_URL) {
|
} else if (process.env.VERCEL_URL) {
|
||||||
return `https://${process.env.VERCEL_URL}`
|
return `https://${process.env.VERCEL_URL}`
|
||||||
} else if (getApiUrl() === STAGING_API_URL) {
|
} else if (getApiUrl() === STAGING_API_URL) {
|
||||||
return 'https://staging.modrinth.com'
|
return STAGING_MODRINTH_URL
|
||||||
} else {
|
} else {
|
||||||
return 'https://modrinth.com'
|
return PROD_MODRINTH_URL
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const port = process.env.PORT || 3000
|
const port = process.env.PORT || 3000
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
User-agent: *
|
User-agent: *
|
||||||
Disallow: /_internal/
|
Disallow: /
|
||||||
Reference in New Issue
Block a user