2025-08-14 21:48:38 +01:00
|
|
|
import { pathToFileURL } from 'node:url'
|
|
|
|
|
|
|
|
|
|
import { match as matchLocale } from '@formatjs/intl-localematcher'
|
2025-09-16 16:57:34 +01:00
|
|
|
import serverSidedVue from '@vitejs/plugin-vue'
|
2025-08-14 21:48:38 +01:00
|
|
|
import { consola } from 'consola'
|
|
|
|
|
import { promises as fs } from 'fs'
|
|
|
|
|
import { globIterate } from 'glob'
|
|
|
|
|
import { defineNuxtConfig } from 'nuxt/config'
|
|
|
|
|
import { $fetch } from 'ofetch'
|
|
|
|
|
import { basename, relative, resolve } from 'pathe'
|
|
|
|
|
import svgLoader from 'vite-svg-loader'
|
|
|
|
|
|
|
|
|
|
const STAGING_API_URL = 'https://staging-api.modrinth.com/v2/'
|
Rewrite Parity (#647)
* Rewrite Parity
* Update SEO, fix modals, add dashes to changelog
* Edit create version title
* Cache tags, SEO for search/partial noscript support, notifications fix
* Deploy?
* Fix vercel config
* Fix it again
* Finish user editing
* Remove broken docker build
* Switch reports to modals
* Update project card
* Navbar line animation in most places
* Add chips
* Move to navlink query params
* remove autogen file
* Add copy code
* Fix webkit text box outlines, port report modal
* Update error page
* Switch to avatar component
* Make keyboard nav work
* Fix team member spacing
* improve project ID display (#676)
* Bug fixes
* Update OG site title
* More fixes
* Design tweaks
* Fix card wrapping on mobile
* Darken light theme color a little
* Sidebar navigation for settings, notifications, and moderation
* Change follow icon from a heart to a bell
* Revert "Change follow icon from a heart to a bell"
This reverts commit e30b46ec5d93c57df847be88eba123c7419dd03b.
* Change follows icon in settings
* AaaaUUUUUUUGghghhhhhhhh
* Project sidebar transparent button animations
* Update file input button styling and change icon remove button text
* Fix environments filter condition being inverted
* Remove -> revert
* Improve readability of warning banners on light mode
* Fix mobile menu button colors
* Clean up notifications page more
* Creator dashboard and monetization work
* Add processing fees declarations and acknowledgement box
* Beta badges
* Downgrade Nuxt Vercel Builder
* Update the style of button groups to be more consistent
* More button consistency
* Remove desktop navbar on mobile
* Update home page progress indicators
* Fix page jumping (Thanks @stairman06)
* Make checkbox checked style consistent with other selection indicators
* More home page updates
* Properly reset NavRows
* Move filters menu on mobile
* Stylized checkbox updated to match active styling
* Filters icon
* Respect prefers-reduced-motion
* Add most backend payouts changes (untested)
* Finish tested payouts code
* Allow monetization unenrolling
* No longer use brand color for active highlights on standard nav elements
* More consistent button group on project page
* Rounded tables
* Fix some things (#716)
* Team member fixes + re-add changelog/versions stuff
* Remove dummy data
* The great CSS refactor
* Remove commented out css
* Give modals the legacy label styles and update profile edit labels
* Fix active chip size
* Remove shadow from selected chip
* Require email set for CMP
* Update styles of notifications to universal-card
* Equivalent exchange, trading some jank for some less bad jank
* Fix all gallery buttons being missing when there is only 1 image
* Update project creation modal
* Make beta badge less bright
* Beta badge heading styling
* Update withdraw processing fees info
* Remove redundant label
* be
* Fix inverted logic
* 2% is 0.02
* Add toggle to turn off alpha modpacks banner
* Why warning button?
* Add more footer links (#719)
* Add more footer links
* Move twitter
* Make items on user pages less comically large and move ad above navigation
* Bump text down a little on home page
* Update favicon colors
* Remove task list package and change default description to use bullet points
* I don't remember why I made this important but let's not
* Ah, yes
* this doesn't actually need to be important
* Align items in input groups
* Adjust some spacings and clear creation modal on opening
* Versions now clickable
* Add link to edit page to default description
* Improve monetization information text
* Make wrapped text inputs not shrink
* Make chips work better
* smol margin on clear mod message button
* Allow non-authenticated users to access settings
* Remove settings anchors
* Fix versions page button style on firefox
* Add advanced rendering toggle
* Update slug input and icon card in project edit page
* Legal sidebar
* h1 at beginning of description no longer has top margin
* Use universal card for legal pages
* Update email addresses on legal pages
* Update various page titles and descriptions for consistency
* Various fixes and consolidation to API URL retrieval
Prevents a bug where it's possible to generate the tags under one API, switch the API, and still have tags leftover from the old API
Also finally fixes staging URL being jank
* Make the theme button show regardless of login state
Also remove the change theme from the user dropdown because it's very redundant with the several other ways of changing theme
* Make mobile profile dropdown ordering consistent with desktop
* Change the base url back
* Revert "Change the base url back"
This reverts commit c1da89fddb83776b39f626eab33c8dc67f8a75e4.
* constantize
* Tiny fixes (#722)
* Box-shadow chip outlines
* Show settings when signed out
* mods -> projects
* space
* Beta badge border
* Slug input overflow fix, scrollable
* 🙈 it will all be okay 🙊 this is just temporary 🙉 😭😭 forgive me
* Fix minor bugs
* fix moderation page
* More fixes
* Temp fix for download button
* BEGONE TABLES
* Fix download button
Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Co-authored-by: Prospector <prospectordev@gmail.com>
Co-authored-by: stairman06 <36215135+stairman06@users.noreply.github.com>
Co-authored-by: triphora <emmaffle@modrinth.com>
2022-11-12 17:57:40 -07:00
|
|
|
|
2023-05-06 22:17:43 +03:00
|
|
|
const preloadedFonts = [
|
2025-08-14 21:48:38 +01:00
|
|
|
'inter/Inter-Regular.woff2',
|
|
|
|
|
'inter/Inter-Medium.woff2',
|
|
|
|
|
'inter/Inter-SemiBold.woff2',
|
|
|
|
|
'inter/Inter-Bold.woff2',
|
|
|
|
|
]
|
2023-05-06 22:17:43 +03:00
|
|
|
|
|
|
|
|
const favicons = {
|
2025-08-14 21:48:38 +01:00
|
|
|
'(prefers-color-scheme:no-preference)': '/favicon-light.ico',
|
|
|
|
|
'(prefers-color-scheme:light)': '/favicon-light.ico',
|
|
|
|
|
'(prefers-color-scheme:dark)': '/favicon.ico',
|
|
|
|
|
}
|
2023-05-06 22:17:43 +03:00
|
|
|
|
2023-06-11 19:08:16 +01:00
|
|
|
/**
|
|
|
|
|
* Tags of locales that are auto-discovered besides the default locale.
|
|
|
|
|
*
|
|
|
|
|
* Preferably only the locales that reach a certain threshold of complete
|
|
|
|
|
* translations would be included in this array.
|
|
|
|
|
*/
|
2025-08-14 21:48:38 +01:00
|
|
|
const enabledLocales: string[] = []
|
2023-08-21 19:26:39 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Overrides for the categories of the certain locales.
|
|
|
|
|
*/
|
2025-08-14 21:48:38 +01:00
|
|
|
const localesCategoriesOverrides: Partial<Record<string, 'fun' | 'experimental'>> = {
|
|
|
|
|
'en-x-pirate': 'fun',
|
|
|
|
|
'en-x-updown': 'fun',
|
|
|
|
|
'en-x-lolcat': 'fun',
|
|
|
|
|
'en-x-uwu': 'fun',
|
|
|
|
|
'ru-x-bandit': 'fun',
|
|
|
|
|
ar: 'experimental',
|
|
|
|
|
he: 'experimental',
|
|
|
|
|
pes: 'experimental',
|
|
|
|
|
}
|
2023-06-11 19:08:16 +01:00
|
|
|
|
2023-03-09 10:05:32 -07:00
|
|
|
export default defineNuxtConfig({
|
2025-08-14 21:48:38 +01:00
|
|
|
srcDir: 'src/',
|
|
|
|
|
app: {
|
|
|
|
|
head: {
|
|
|
|
|
htmlAttrs: {
|
|
|
|
|
lang: 'en',
|
|
|
|
|
},
|
|
|
|
|
title: 'Modrinth',
|
|
|
|
|
link: [
|
|
|
|
|
// The type is necessary because the linter can't always compare this very nested/complex type on itself
|
|
|
|
|
...preloadedFonts.map((font): object => {
|
|
|
|
|
return {
|
|
|
|
|
rel: 'preload',
|
|
|
|
|
href: `https://cdn-raw.modrinth.com/fonts/${font}?v=3.19`,
|
|
|
|
|
as: 'font',
|
|
|
|
|
type: 'font/woff2',
|
|
|
|
|
crossorigin: 'anonymous',
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
...Object.entries(favicons).map(([media, href]): object => {
|
|
|
|
|
return { rel: 'icon', type: 'image/x-icon', href, media }
|
|
|
|
|
}),
|
|
|
|
|
...Object.entries(favicons).map(([media, href]): object => {
|
|
|
|
|
return { rel: 'apple-touch-icon', type: 'image/x-icon', href, media, sizes: '64x64' }
|
|
|
|
|
}),
|
|
|
|
|
{
|
|
|
|
|
rel: 'search',
|
|
|
|
|
type: 'application/opensearchdescription+xml',
|
|
|
|
|
href: '/opensearch.xml',
|
|
|
|
|
title: 'Modrinth mods',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
vite: {
|
|
|
|
|
define: {
|
|
|
|
|
global: {},
|
|
|
|
|
},
|
|
|
|
|
esbuild: {
|
|
|
|
|
define: {
|
|
|
|
|
global: 'globalThis',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
cacheDir: '../../node_modules/.vite/apps/knossos',
|
|
|
|
|
resolve: {
|
|
|
|
|
dedupe: ['vue'],
|
|
|
|
|
},
|
|
|
|
|
plugins: [
|
|
|
|
|
svgLoader({
|
|
|
|
|
svgoConfig: {
|
|
|
|
|
plugins: [
|
|
|
|
|
{
|
|
|
|
|
name: 'preset-default',
|
|
|
|
|
params: {
|
|
|
|
|
overrides: {
|
|
|
|
|
removeViewBox: false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
hooks: {
|
2025-09-16 16:57:34 +01:00
|
|
|
async 'nitro:config'(nitroConfig) {
|
|
|
|
|
const emailTemplates = Object.keys(
|
2025-10-07 11:47:59 +01:00
|
|
|
await import('./src/templates/emails/index.ts').then((m) => m.default),
|
|
|
|
|
)
|
|
|
|
|
const docTemplates = Object.keys(
|
|
|
|
|
await import('./src/templates/docs/index.ts').then((m) => m.default),
|
2025-09-16 16:57:34 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
nitroConfig.prerender = nitroConfig.prerender || {}
|
|
|
|
|
nitroConfig.prerender.routes = nitroConfig.prerender.routes || []
|
|
|
|
|
for (const template of emailTemplates) {
|
2025-10-07 11:47:59 +01:00
|
|
|
nitroConfig.prerender.routes.push(`/_internal/templates/email/${template}`)
|
|
|
|
|
}
|
|
|
|
|
for (const template of docTemplates) {
|
|
|
|
|
nitroConfig.prerender.routes.push(`/_internal/templates/doc/${template}`)
|
2025-09-16 16:57:34 +01:00
|
|
|
}
|
|
|
|
|
},
|
2025-08-14 21:48:38 +01:00
|
|
|
async 'build:before'() {
|
|
|
|
|
// 30 minutes
|
|
|
|
|
const TTL = 30 * 60 * 1000
|
|
|
|
|
|
|
|
|
|
let state: {
|
|
|
|
|
lastGenerated?: string
|
|
|
|
|
apiUrl?: string
|
|
|
|
|
categories?: any[]
|
|
|
|
|
loaders?: any[]
|
|
|
|
|
gameVersions?: any[]
|
|
|
|
|
donationPlatforms?: any[]
|
|
|
|
|
reportTypes?: any[]
|
|
|
|
|
homePageProjects?: any[]
|
|
|
|
|
homePageSearch?: any[]
|
|
|
|
|
homePageNotifs?: any[]
|
|
|
|
|
products?: any[]
|
|
|
|
|
errors?: number[]
|
|
|
|
|
} = {}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
state = JSON.parse(await fs.readFile('./src/generated/state.json', 'utf8'))
|
|
|
|
|
} catch {
|
|
|
|
|
// File doesn't exist, create folder
|
|
|
|
|
await fs.mkdir('./src/generated', { recursive: true })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const API_URL = getApiUrl()
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
// Skip regeneration if within TTL...
|
|
|
|
|
state.lastGenerated &&
|
|
|
|
|
new Date(state.lastGenerated).getTime() + TTL > new Date().getTime() &&
|
|
|
|
|
// ...but only if the API URL is the same
|
|
|
|
|
state.apiUrl === API_URL &&
|
|
|
|
|
// ...and if no errors were caught during the last generation
|
|
|
|
|
(state.errors ?? []).length === 0
|
|
|
|
|
) {
|
|
|
|
|
console.log(
|
|
|
|
|
'Tags already recently generated. Delete apps/frontend/generated/state.json to force regeneration.',
|
|
|
|
|
)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.lastGenerated = new Date().toISOString()
|
|
|
|
|
|
|
|
|
|
state.apiUrl = API_URL
|
|
|
|
|
|
|
|
|
|
const headers = {
|
|
|
|
|
headers: {
|
|
|
|
|
'user-agent': 'Knossos generator (support@modrinth.com)',
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const caughtErrorCodes = new Set<number>()
|
|
|
|
|
|
|
|
|
|
function handleFetchError(err: any, defaultValue: any) {
|
|
|
|
|
console.error('Error generating state: ', err)
|
|
|
|
|
caughtErrorCodes.add(err.status)
|
|
|
|
|
return defaultValue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const [
|
|
|
|
|
categories,
|
|
|
|
|
loaders,
|
|
|
|
|
gameVersions,
|
|
|
|
|
donationPlatforms,
|
|
|
|
|
reportTypes,
|
|
|
|
|
homePageProjects,
|
|
|
|
|
homePageSearch,
|
|
|
|
|
homePageNotifs,
|
|
|
|
|
products,
|
|
|
|
|
] = await Promise.all([
|
|
|
|
|
$fetch(`${API_URL}tag/category`, headers).catch((err) => handleFetchError(err, [])),
|
|
|
|
|
$fetch(`${API_URL}tag/loader`, headers).catch((err) => handleFetchError(err, [])),
|
|
|
|
|
$fetch(`${API_URL}tag/game_version`, headers).catch((err) => handleFetchError(err, [])),
|
|
|
|
|
$fetch(`${API_URL}tag/donation_platform`, headers).catch((err) =>
|
|
|
|
|
handleFetchError(err, []),
|
|
|
|
|
),
|
|
|
|
|
$fetch(`${API_URL}tag/report_type`, headers).catch((err) => handleFetchError(err, [])),
|
|
|
|
|
$fetch(`${API_URL}projects_random?count=60`, headers).catch((err) =>
|
|
|
|
|
handleFetchError(err, []),
|
|
|
|
|
),
|
|
|
|
|
$fetch(`${API_URL}search?limit=3&query=leave&index=relevance`, headers).catch((err) =>
|
|
|
|
|
handleFetchError(err, {}),
|
|
|
|
|
),
|
|
|
|
|
$fetch(`${API_URL}search?limit=3&query=&index=updated`, headers).catch((err) =>
|
|
|
|
|
handleFetchError(err, {}),
|
|
|
|
|
),
|
|
|
|
|
$fetch(`${API_URL.replace('/v2/', '/_internal/')}billing/products`, headers).catch((err) =>
|
|
|
|
|
handleFetchError(err, []),
|
|
|
|
|
),
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
state.categories = categories
|
|
|
|
|
state.loaders = loaders
|
|
|
|
|
state.gameVersions = gameVersions
|
|
|
|
|
state.donationPlatforms = donationPlatforms
|
|
|
|
|
state.reportTypes = reportTypes
|
|
|
|
|
state.homePageProjects = homePageProjects
|
|
|
|
|
state.homePageSearch = homePageSearch
|
|
|
|
|
state.homePageNotifs = homePageNotifs
|
|
|
|
|
state.products = products
|
|
|
|
|
state.errors = [...caughtErrorCodes]
|
|
|
|
|
|
|
|
|
|
await fs.writeFile('./src/generated/state.json', JSON.stringify(state))
|
|
|
|
|
|
|
|
|
|
console.log('Tags generated!')
|
|
|
|
|
},
|
|
|
|
|
'pages:extend'(routes) {
|
|
|
|
|
routes.splice(
|
|
|
|
|
routes.findIndex((x) => x.name === 'search-searchProjectType'),
|
|
|
|
|
1,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const types = ['mods', 'modpacks', 'plugins', 'resourcepacks', 'shaders', 'datapacks']
|
|
|
|
|
|
|
|
|
|
types.forEach((type) =>
|
|
|
|
|
routes.push({
|
|
|
|
|
name: `search-${type}`,
|
|
|
|
|
path: `/${type}`,
|
|
|
|
|
file: resolve(__dirname, 'src/pages/search/[searchProjectType].vue'),
|
|
|
|
|
children: [],
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
async 'vintl:extendOptions'(opts) {
|
|
|
|
|
opts.locales ??= []
|
|
|
|
|
|
|
|
|
|
const isProduction = getDomain() === 'https://modrinth.com'
|
|
|
|
|
|
|
|
|
|
const resolveCompactNumberDataImport = await (async () => {
|
|
|
|
|
const compactNumberLocales: string[] = []
|
|
|
|
|
|
|
|
|
|
for await (const localeFile of globIterate(
|
|
|
|
|
'node_modules/@vintl/compact-number/dist/locale-data/*.mjs',
|
|
|
|
|
{ ignore: '**/*.data.mjs' },
|
|
|
|
|
)) {
|
|
|
|
|
const tag = basename(localeFile, '.mjs')
|
|
|
|
|
compactNumberLocales.push(tag)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function resolveImport(tag: string) {
|
|
|
|
|
const matchedTag = matchLocale([tag], compactNumberLocales, 'en-x-placeholder')
|
|
|
|
|
return matchedTag === 'en-x-placeholder'
|
|
|
|
|
? undefined
|
|
|
|
|
: `@vintl/compact-number/locale-data/${matchedTag}`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return resolveImport
|
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
const resolveOmorphiaLocaleImport = await (async () => {
|
|
|
|
|
const omorphiaLocales: string[] = []
|
|
|
|
|
const omorphiaLocaleSets = new Map<string, { files: { from: string; format?: string }[] }>()
|
|
|
|
|
|
|
|
|
|
for (const pkgLocales of [`node_modules/@modrinth/**/src/locales/*`]) {
|
|
|
|
|
for await (const localeDir of globIterate(pkgLocales, {
|
|
|
|
|
posix: true,
|
|
|
|
|
})) {
|
|
|
|
|
const tag = basename(localeDir)
|
|
|
|
|
if (!omorphiaLocales.includes(tag)) {
|
|
|
|
|
omorphiaLocales.push(tag)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const entry = omorphiaLocaleSets.get(tag) ?? { files: [] }
|
|
|
|
|
omorphiaLocaleSets.set(tag, entry)
|
|
|
|
|
|
|
|
|
|
for await (const localeFile of globIterate(`${localeDir}/*`, { posix: true })) {
|
|
|
|
|
entry.files.push({
|
|
|
|
|
from: pathToFileURL(localeFile).toString(),
|
|
|
|
|
format: 'default',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return function resolveLocaleImport(tag: string) {
|
|
|
|
|
return omorphiaLocaleSets.get(matchLocale([tag], omorphiaLocales, 'en-x-placeholder'))
|
|
|
|
|
}
|
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
for await (const localeDir of globIterate('src/locales/*/', { posix: true })) {
|
|
|
|
|
const tag = basename(localeDir)
|
|
|
|
|
if (isProduction && !enabledLocales.includes(tag) && opts.defaultLocale !== tag) continue
|
|
|
|
|
|
|
|
|
|
const locale =
|
|
|
|
|
opts.locales.find((locale) => locale.tag === tag) ??
|
|
|
|
|
opts.locales[opts.locales.push({ tag }) - 1]!
|
|
|
|
|
|
|
|
|
|
const localeFiles = (locale.files ??= [])
|
|
|
|
|
|
|
|
|
|
for await (const localeFile of globIterate(`${localeDir}/*`, { posix: true })) {
|
|
|
|
|
const fileName = basename(localeFile)
|
|
|
|
|
if (fileName === 'index.json') {
|
|
|
|
|
localeFiles.push({
|
|
|
|
|
from: `./${relative('./src', localeFile)}`,
|
|
|
|
|
format: 'crowdin',
|
|
|
|
|
})
|
|
|
|
|
} else if (fileName === 'meta.json') {
|
|
|
|
|
const meta: Record<string, { message: string }> = await fs
|
|
|
|
|
.readFile(localeFile, 'utf8')
|
|
|
|
|
.then((date) => JSON.parse(date))
|
|
|
|
|
const localeMeta = (locale.meta ??= {})
|
|
|
|
|
for (const key in meta) {
|
|
|
|
|
const value = meta[key]
|
|
|
|
|
if (value === undefined) continue
|
|
|
|
|
localeMeta[key] = value.message
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
;(locale.resources ??= {})[fileName] = `./${relative('./src', localeFile)}`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const categoryOverride = localesCategoriesOverrides[tag]
|
|
|
|
|
if (categoryOverride != null) {
|
|
|
|
|
;(locale.meta ??= {}).category = categoryOverride
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const omorphiaLocaleData = resolveOmorphiaLocaleImport(tag)
|
|
|
|
|
if (omorphiaLocaleData != null) {
|
|
|
|
|
localeFiles.push(...omorphiaLocaleData.files)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const cnDataImport = resolveCompactNumberDataImport(tag)
|
|
|
|
|
if (cnDataImport != null) {
|
|
|
|
|
;(locale.additionalImports ??= []).push({
|
|
|
|
|
from: cnDataImport,
|
|
|
|
|
resolve: false,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
runtimeConfig: {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
apiBaseUrl: process.env.BASE_URL ?? globalThis.BASE_URL ?? getApiUrl(),
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
rateLimitKey: process.env.RATE_LIMIT_IGNORE_KEY ?? globalThis.RATE_LIMIT_IGNORE_KEY,
|
|
|
|
|
pyroBaseUrl: process.env.PYRO_BASE_URL,
|
|
|
|
|
public: {
|
|
|
|
|
apiBaseUrl: getApiUrl(),
|
|
|
|
|
pyroBaseUrl: process.env.PYRO_BASE_URL,
|
|
|
|
|
siteUrl: getDomain(),
|
|
|
|
|
production: isProduction(),
|
|
|
|
|
featureFlagOverrides: getFeatureFlagOverrides(),
|
|
|
|
|
|
|
|
|
|
owner: process.env.VERCEL_GIT_REPO_OWNER || 'modrinth',
|
|
|
|
|
slug: process.env.VERCEL_GIT_REPO_SLUG || 'code',
|
|
|
|
|
branch:
|
|
|
|
|
process.env.VERCEL_GIT_COMMIT_REF ||
|
|
|
|
|
process.env.CF_PAGES_BRANCH ||
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
globalThis.CF_PAGES_BRANCH ||
|
|
|
|
|
'master',
|
|
|
|
|
hash:
|
|
|
|
|
process.env.VERCEL_GIT_COMMIT_SHA ||
|
|
|
|
|
process.env.CF_PAGES_COMMIT_SHA ||
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
globalThis.CF_PAGES_COMMIT_SHA ||
|
|
|
|
|
'unknown',
|
|
|
|
|
|
|
|
|
|
stripePublishableKey:
|
|
|
|
|
process.env.STRIPE_PUBLISHABLE_KEY ||
|
|
|
|
|
globalThis.STRIPE_PUBLISHABLE_KEY ||
|
|
|
|
|
'pk_test_51JbFxJJygY5LJFfKV50mnXzz3YLvBVe2Gd1jn7ljWAkaBlRz3VQdxN9mXcPSrFbSqxwAb0svte9yhnsmm7qHfcWn00R611Ce7b',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
typescript: {
|
|
|
|
|
shim: false,
|
|
|
|
|
strict: true,
|
|
|
|
|
typeCheck: false,
|
|
|
|
|
tsConfig: {
|
|
|
|
|
compilerOptions: {
|
|
|
|
|
moduleResolution: 'bundler',
|
|
|
|
|
allowImportingTsExtensions: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
modules: ['@vintl/nuxt', '@pinia/nuxt'],
|
|
|
|
|
vintl: {
|
|
|
|
|
defaultLocale: 'en-US',
|
|
|
|
|
locales: [
|
|
|
|
|
{
|
|
|
|
|
tag: 'en-US',
|
|
|
|
|
meta: {
|
|
|
|
|
static: {
|
|
|
|
|
iso: 'en',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
storage: 'cookie',
|
|
|
|
|
parserless: 'only-prod',
|
|
|
|
|
seo: {
|
|
|
|
|
defaultLocaleHasParameter: false,
|
|
|
|
|
},
|
|
|
|
|
onParseError({ error, message, messageId, moduleId, parseMessage, parserOptions }) {
|
|
|
|
|
const errorMessage = String(error)
|
|
|
|
|
const modulePath = relative(__dirname, moduleId)
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const fallback = parseMessage(message, { ...parserOptions, ignoreTag: true })
|
|
|
|
|
|
|
|
|
|
consola.warn(
|
|
|
|
|
`[i18n] ${messageId} in ${modulePath} cannot be parsed normally due to ${errorMessage}. The tags will will not be parsed.`,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return fallback
|
|
|
|
|
} catch (err) {
|
|
|
|
|
const secondaryErrorMessage = String(err)
|
|
|
|
|
|
|
|
|
|
const reason =
|
|
|
|
|
errorMessage === secondaryErrorMessage
|
|
|
|
|
? errorMessage
|
|
|
|
|
: `${errorMessage} and ${secondaryErrorMessage}`
|
|
|
|
|
|
|
|
|
|
consola.warn(
|
|
|
|
|
`[i18n] ${messageId} in ${modulePath} cannot be parsed due to ${reason}. It will be skipped.`,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
nitro: {
|
|
|
|
|
moduleSideEffects: ['@vintl/compact-number/locale-data'],
|
2025-09-16 16:57:34 +01:00
|
|
|
rollupConfig: {
|
|
|
|
|
// @ts-expect-error it's not infinite.
|
|
|
|
|
plugins: [serverSidedVue()],
|
|
|
|
|
},
|
2025-08-14 21:48:38 +01:00
|
|
|
},
|
|
|
|
|
devtools: {
|
|
|
|
|
enabled: true,
|
|
|
|
|
},
|
|
|
|
|
css: ['~/assets/styles/tailwind.css'],
|
|
|
|
|
postcss: {
|
|
|
|
|
plugins: {
|
|
|
|
|
tailwindcss: {},
|
|
|
|
|
autoprefixer: {},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
routeRules: {
|
|
|
|
|
'/**': {
|
|
|
|
|
headers: {
|
|
|
|
|
'Accept-CH': 'Sec-CH-Prefers-Color-Scheme',
|
|
|
|
|
'Critical-CH': 'Sec-CH-Prefers-Color-Scheme',
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-09-16 16:57:34 +01:00
|
|
|
'/email/**': {
|
2025-10-07 11:47:59 +01:00
|
|
|
redirect: '/_internal/templates/email/**',
|
|
|
|
|
},
|
|
|
|
|
'/_internal/templates/email/**': {
|
|
|
|
|
prerender: true,
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'text/html',
|
|
|
|
|
'Cache-Control': 'public, max-age=3600',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
'/_internal/templates/doc/**': {
|
2025-09-16 16:57:34 +01:00
|
|
|
prerender: true,
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'text/html',
|
|
|
|
|
'Cache-Control': 'public, max-age=3600',
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-08-14 21:48:38 +01:00
|
|
|
},
|
|
|
|
|
compatibilityDate: '2024-07-03',
|
|
|
|
|
telemetry: false,
|
|
|
|
|
})
|
2021-05-27 09:27:13 -07:00
|
|
|
|
Rewrite Parity (#647)
* Rewrite Parity
* Update SEO, fix modals, add dashes to changelog
* Edit create version title
* Cache tags, SEO for search/partial noscript support, notifications fix
* Deploy?
* Fix vercel config
* Fix it again
* Finish user editing
* Remove broken docker build
* Switch reports to modals
* Update project card
* Navbar line animation in most places
* Add chips
* Move to navlink query params
* remove autogen file
* Add copy code
* Fix webkit text box outlines, port report modal
* Update error page
* Switch to avatar component
* Make keyboard nav work
* Fix team member spacing
* improve project ID display (#676)
* Bug fixes
* Update OG site title
* More fixes
* Design tweaks
* Fix card wrapping on mobile
* Darken light theme color a little
* Sidebar navigation for settings, notifications, and moderation
* Change follow icon from a heart to a bell
* Revert "Change follow icon from a heart to a bell"
This reverts commit e30b46ec5d93c57df847be88eba123c7419dd03b.
* Change follows icon in settings
* AaaaUUUUUUUGghghhhhhhhh
* Project sidebar transparent button animations
* Update file input button styling and change icon remove button text
* Fix environments filter condition being inverted
* Remove -> revert
* Improve readability of warning banners on light mode
* Fix mobile menu button colors
* Clean up notifications page more
* Creator dashboard and monetization work
* Add processing fees declarations and acknowledgement box
* Beta badges
* Downgrade Nuxt Vercel Builder
* Update the style of button groups to be more consistent
* More button consistency
* Remove desktop navbar on mobile
* Update home page progress indicators
* Fix page jumping (Thanks @stairman06)
* Make checkbox checked style consistent with other selection indicators
* More home page updates
* Properly reset NavRows
* Move filters menu on mobile
* Stylized checkbox updated to match active styling
* Filters icon
* Respect prefers-reduced-motion
* Add most backend payouts changes (untested)
* Finish tested payouts code
* Allow monetization unenrolling
* No longer use brand color for active highlights on standard nav elements
* More consistent button group on project page
* Rounded tables
* Fix some things (#716)
* Team member fixes + re-add changelog/versions stuff
* Remove dummy data
* The great CSS refactor
* Remove commented out css
* Give modals the legacy label styles and update profile edit labels
* Fix active chip size
* Remove shadow from selected chip
* Require email set for CMP
* Update styles of notifications to universal-card
* Equivalent exchange, trading some jank for some less bad jank
* Fix all gallery buttons being missing when there is only 1 image
* Update project creation modal
* Make beta badge less bright
* Beta badge heading styling
* Update withdraw processing fees info
* Remove redundant label
* be
* Fix inverted logic
* 2% is 0.02
* Add toggle to turn off alpha modpacks banner
* Why warning button?
* Add more footer links (#719)
* Add more footer links
* Move twitter
* Make items on user pages less comically large and move ad above navigation
* Bump text down a little on home page
* Update favicon colors
* Remove task list package and change default description to use bullet points
* I don't remember why I made this important but let's not
* Ah, yes
* this doesn't actually need to be important
* Align items in input groups
* Adjust some spacings and clear creation modal on opening
* Versions now clickable
* Add link to edit page to default description
* Improve monetization information text
* Make wrapped text inputs not shrink
* Make chips work better
* smol margin on clear mod message button
* Allow non-authenticated users to access settings
* Remove settings anchors
* Fix versions page button style on firefox
* Add advanced rendering toggle
* Update slug input and icon card in project edit page
* Legal sidebar
* h1 at beginning of description no longer has top margin
* Use universal card for legal pages
* Update email addresses on legal pages
* Update various page titles and descriptions for consistency
* Various fixes and consolidation to API URL retrieval
Prevents a bug where it's possible to generate the tags under one API, switch the API, and still have tags leftover from the old API
Also finally fixes staging URL being jank
* Make the theme button show regardless of login state
Also remove the change theme from the user dropdown because it's very redundant with the several other ways of changing theme
* Make mobile profile dropdown ordering consistent with desktop
* Change the base url back
* Revert "Change the base url back"
This reverts commit c1da89fddb83776b39f626eab33c8dc67f8a75e4.
* constantize
* Tiny fixes (#722)
* Box-shadow chip outlines
* Show settings when signed out
* mods -> projects
* space
* Beta badge border
* Slug input overflow fix, scrollable
* 🙈 it will all be okay 🙊 this is just temporary 🙉 😭😭 forgive me
* Fix minor bugs
* fix moderation page
* More fixes
* Temp fix for download button
* BEGONE TABLES
* Fix download button
Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Co-authored-by: Prospector <prospectordev@gmail.com>
Co-authored-by: stairman06 <36215135+stairman06@users.noreply.github.com>
Co-authored-by: triphora <emmaffle@modrinth.com>
2022-11-12 17:57:40 -07:00
|
|
|
function getApiUrl() {
|
2025-08-14 21:48:38 +01:00
|
|
|
// @ts-ignore
|
|
|
|
|
return process.env.BROWSER_BASE_URL ?? globalThis.BROWSER_BASE_URL ?? STAGING_API_URL
|
Rewrite Parity (#647)
* Rewrite Parity
* Update SEO, fix modals, add dashes to changelog
* Edit create version title
* Cache tags, SEO for search/partial noscript support, notifications fix
* Deploy?
* Fix vercel config
* Fix it again
* Finish user editing
* Remove broken docker build
* Switch reports to modals
* Update project card
* Navbar line animation in most places
* Add chips
* Move to navlink query params
* remove autogen file
* Add copy code
* Fix webkit text box outlines, port report modal
* Update error page
* Switch to avatar component
* Make keyboard nav work
* Fix team member spacing
* improve project ID display (#676)
* Bug fixes
* Update OG site title
* More fixes
* Design tweaks
* Fix card wrapping on mobile
* Darken light theme color a little
* Sidebar navigation for settings, notifications, and moderation
* Change follow icon from a heart to a bell
* Revert "Change follow icon from a heart to a bell"
This reverts commit e30b46ec5d93c57df847be88eba123c7419dd03b.
* Change follows icon in settings
* AaaaUUUUUUUGghghhhhhhhh
* Project sidebar transparent button animations
* Update file input button styling and change icon remove button text
* Fix environments filter condition being inverted
* Remove -> revert
* Improve readability of warning banners on light mode
* Fix mobile menu button colors
* Clean up notifications page more
* Creator dashboard and monetization work
* Add processing fees declarations and acknowledgement box
* Beta badges
* Downgrade Nuxt Vercel Builder
* Update the style of button groups to be more consistent
* More button consistency
* Remove desktop navbar on mobile
* Update home page progress indicators
* Fix page jumping (Thanks @stairman06)
* Make checkbox checked style consistent with other selection indicators
* More home page updates
* Properly reset NavRows
* Move filters menu on mobile
* Stylized checkbox updated to match active styling
* Filters icon
* Respect prefers-reduced-motion
* Add most backend payouts changes (untested)
* Finish tested payouts code
* Allow monetization unenrolling
* No longer use brand color for active highlights on standard nav elements
* More consistent button group on project page
* Rounded tables
* Fix some things (#716)
* Team member fixes + re-add changelog/versions stuff
* Remove dummy data
* The great CSS refactor
* Remove commented out css
* Give modals the legacy label styles and update profile edit labels
* Fix active chip size
* Remove shadow from selected chip
* Require email set for CMP
* Update styles of notifications to universal-card
* Equivalent exchange, trading some jank for some less bad jank
* Fix all gallery buttons being missing when there is only 1 image
* Update project creation modal
* Make beta badge less bright
* Beta badge heading styling
* Update withdraw processing fees info
* Remove redundant label
* be
* Fix inverted logic
* 2% is 0.02
* Add toggle to turn off alpha modpacks banner
* Why warning button?
* Add more footer links (#719)
* Add more footer links
* Move twitter
* Make items on user pages less comically large and move ad above navigation
* Bump text down a little on home page
* Update favicon colors
* Remove task list package and change default description to use bullet points
* I don't remember why I made this important but let's not
* Ah, yes
* this doesn't actually need to be important
* Align items in input groups
* Adjust some spacings and clear creation modal on opening
* Versions now clickable
* Add link to edit page to default description
* Improve monetization information text
* Make wrapped text inputs not shrink
* Make chips work better
* smol margin on clear mod message button
* Allow non-authenticated users to access settings
* Remove settings anchors
* Fix versions page button style on firefox
* Add advanced rendering toggle
* Update slug input and icon card in project edit page
* Legal sidebar
* h1 at beginning of description no longer has top margin
* Use universal card for legal pages
* Update email addresses on legal pages
* Update various page titles and descriptions for consistency
* Various fixes and consolidation to API URL retrieval
Prevents a bug where it's possible to generate the tags under one API, switch the API, and still have tags leftover from the old API
Also finally fixes staging URL being jank
* Make the theme button show regardless of login state
Also remove the change theme from the user dropdown because it's very redundant with the several other ways of changing theme
* Make mobile profile dropdown ordering consistent with desktop
* Change the base url back
* Revert "Change the base url back"
This reverts commit c1da89fddb83776b39f626eab33c8dc67f8a75e4.
* constantize
* Tiny fixes (#722)
* Box-shadow chip outlines
* Show settings when signed out
* mods -> projects
* space
* Beta badge border
* Slug input overflow fix, scrollable
* 🙈 it will all be okay 🙊 this is just temporary 🙉 😭😭 forgive me
* Fix minor bugs
* fix moderation page
* More fixes
* Temp fix for download button
* BEGONE TABLES
* Fix download button
Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Co-authored-by: Prospector <prospectordev@gmail.com>
Co-authored-by: stairman06 <36215135+stairman06@users.noreply.github.com>
Co-authored-by: triphora <emmaffle@modrinth.com>
2022-11-12 17:57:40 -07:00
|
|
|
}
|
|
|
|
|
|
2024-06-11 19:46:07 -07:00
|
|
|
function isProduction() {
|
2025-08-14 21:48:38 +01:00
|
|
|
return process.env.NODE_ENV === 'production'
|
2024-06-11 19:46:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getFeatureFlagOverrides() {
|
2025-08-14 21:48:38 +01:00
|
|
|
return JSON.parse(process.env.FLAG_OVERRIDES ?? '{}')
|
2024-06-11 19:46:07 -07:00
|
|
|
}
|
|
|
|
|
|
2021-05-27 09:27:13 -07:00
|
|
|
function getDomain() {
|
2025-08-14 21:48:38 +01:00
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
if (process.env.SITE_URL) {
|
|
|
|
|
return process.env.SITE_URL
|
|
|
|
|
}
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
else if (process.env.CF_PAGES_URL || globalThis.CF_PAGES_URL) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
return process.env.CF_PAGES_URL ?? globalThis.CF_PAGES_URL
|
|
|
|
|
} else if (process.env.HEROKU_APP_NAME) {
|
|
|
|
|
return `https://${process.env.HEROKU_APP_NAME}.herokuapp.com`
|
|
|
|
|
} else if (process.env.VERCEL_URL) {
|
|
|
|
|
return `https://${process.env.VERCEL_URL}`
|
|
|
|
|
} else if (getApiUrl() === STAGING_API_URL) {
|
|
|
|
|
return 'https://staging.modrinth.com'
|
|
|
|
|
} else {
|
|
|
|
|
return 'https://modrinth.com'
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const port = process.env.PORT || 3000
|
|
|
|
|
return `http://localhost:${port}`
|
|
|
|
|
}
|
2021-05-27 09:27:13 -07:00
|
|
|
}
|