2021-01-31 10:00:11 +08:00
|
|
|
import { NuxtConfig } from '@nuxt/types';
|
2021-03-28 06:41:20 +08:00
|
|
|
import colors from 'vuetify/lib/util/colors';
|
2021-01-31 10:00:11 +08:00
|
|
|
|
2021-08-05 01:22:13 +08:00
|
|
|
import de from './locales/de';
|
2021-01-23 06:36:52 +08:00
|
|
|
import en from './locales/en';
|
2021-08-05 01:22:13 +08:00
|
|
|
import es from './locales/es';
|
2021-01-23 06:36:52 +08:00
|
|
|
import fr from './locales/fr';
|
2021-08-04 17:30:55 +08:00
|
|
|
import it from './locales/it';
|
2021-08-05 01:22:13 +08:00
|
|
|
import nl from './locales/nl';
|
|
|
|
import tr from './locales/tr';
|
|
|
|
import zhHans from './locales/zh_hans';
|
|
|
|
import zhHant from './locales/zh_hant';
|
|
|
|
import dum from './locales/dum';
|
2021-08-04 17:30:55 +08:00
|
|
|
|
2021-04-04 07:53:58 +08:00
|
|
|
require('events').EventEmitter.defaultMaxListeners = 20;
|
2021-01-21 11:36:18 +08:00
|
|
|
require('dotenv').config();
|
|
|
|
|
2021-02-08 05:36:36 +08:00
|
|
|
const proxyHost = process.env.proxyHost || 'http://localhost:8080';
|
2021-10-16 18:09:44 +08:00
|
|
|
const oauthHost = process.env.oauthHost || 'http://localhost:4444';
|
2021-02-08 06:06:06 +08:00
|
|
|
const authHost = process.env.authHost || 'http://localhost:8000';
|
2021-06-07 05:45:56 +08:00
|
|
|
const lazyAuthHost = process.env.lazyAuthHost || 'http://localhost:8000';
|
2021-03-16 03:31:16 +08:00
|
|
|
const publicHost = process.env.PUBLIC_HOST || 'http://localhost:3000';
|
2021-02-08 07:02:17 +08:00
|
|
|
const host = process.env.host || 'localhost';
|
2021-03-17 01:43:58 +08:00
|
|
|
const nodeEnv = process.env.NODE_ENV;
|
2021-08-05 01:22:13 +08:00
|
|
|
const publicPath = process.env.PUBLIC_PATH || '/_nuxt/';
|
2021-02-08 05:32:28 +08:00
|
|
|
|
2021-06-07 05:45:56 +08:00
|
|
|
// noinspection JSUnusedGlobalSymbols
|
2021-01-21 11:36:18 +08:00
|
|
|
export default {
|
2021-01-22 00:24:35 +08:00
|
|
|
telemetry: false,
|
2021-05-23 04:21:04 +08:00
|
|
|
modern: 'server',
|
2021-05-23 02:48:27 +08:00
|
|
|
|
|
|
|
// PWA module configuration: https://go.nuxtjs.dev/pwa
|
|
|
|
pwa: {
|
|
|
|
manifest: {
|
|
|
|
name: 'Hangar | PaperMC',
|
|
|
|
short_name: 'Hangar',
|
|
|
|
description: 'Plugin repository for Paper plugins and more!',
|
|
|
|
lang: 'en',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2021-01-21 11:36:18 +08:00
|
|
|
// Global page headers: https://go.nuxtjs.dev/config-head
|
|
|
|
head: {
|
2021-03-29 04:10:41 +08:00
|
|
|
htmlAttrs: {
|
|
|
|
dir: 'ltr',
|
|
|
|
},
|
2021-05-23 02:48:27 +08:00
|
|
|
titleTemplate: (titleChunk) => (titleChunk ? `${titleChunk} | Hangar` : 'Hangar'),
|
2021-01-21 11:36:18 +08:00
|
|
|
meta: [
|
2021-05-23 02:48:27 +08:00
|
|
|
{ hid: 'charset', charset: 'utf-8' },
|
2021-01-21 11:36:18 +08:00
|
|
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
2021-05-23 02:48:27 +08:00
|
|
|
{ property: 'twitter:site', name: 'twitter:site', hid: 'twitter:site', content: 'hangar' },
|
|
|
|
{ property: 'twitter:card', name: 'twitter:card', hid: 'twitter:card', content: 'summary' },
|
2021-01-21 11:36:18 +08:00
|
|
|
],
|
2021-05-23 02:48:27 +08:00
|
|
|
noscript: [{ innerHTML: 'We are sorry, but Hangar requires JavaScript to work properly.' }],
|
2021-01-21 11:36:18 +08:00
|
|
|
},
|
|
|
|
|
2021-03-17 01:43:58 +08:00
|
|
|
env: {
|
|
|
|
proxyHost,
|
2021-10-16 18:09:44 +08:00
|
|
|
oauthHost,
|
2021-03-17 01:43:58 +08:00
|
|
|
authHost,
|
2021-06-07 05:45:56 +08:00
|
|
|
lazyAuthHost,
|
2021-03-17 01:43:58 +08:00
|
|
|
publicHost,
|
|
|
|
host,
|
|
|
|
nodeEnv,
|
|
|
|
},
|
|
|
|
|
2021-01-21 11:36:18 +08:00
|
|
|
// Global CSS: https://go.nuxtjs.dev/config-css
|
2021-02-12 11:33:01 +08:00
|
|
|
css: ['~/assets/main.scss'],
|
2021-01-21 11:36:18 +08:00
|
|
|
|
|
|
|
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
|
2021-05-23 02:48:27 +08:00
|
|
|
plugins: ['~/plugins/api.ts', '~/plugins/utils.ts', '~/plugins/auth.ts', '~/plugins/perms.ts', '~/plugins/seo.ts'],
|
2021-01-21 11:36:18 +08:00
|
|
|
|
|
|
|
// Auto import components: https://go.nuxtjs.dev/config-components
|
2021-04-08 12:58:49 +08:00
|
|
|
components: false,
|
2021-01-21 11:36:18 +08:00
|
|
|
|
|
|
|
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
|
|
|
|
buildModules: [
|
|
|
|
// https://go.nuxtjs.dev/typescript
|
|
|
|
'@nuxt/typescript-build',
|
|
|
|
// https://go.nuxtjs.dev/vuetify
|
|
|
|
'@nuxtjs/vuetify',
|
2021-01-31 10:00:11 +08:00
|
|
|
// https://go.nuxtjs.dev/eslint
|
|
|
|
'@nuxtjs/eslint-module',
|
2021-02-06 16:29:16 +08:00
|
|
|
// https://go.nuxtjs.dev/pwa
|
|
|
|
'@nuxtjs/pwa',
|
2021-01-22 04:32:08 +08:00
|
|
|
'@nuxtjs/dotenv',
|
2021-01-21 11:36:18 +08:00
|
|
|
],
|
|
|
|
|
|
|
|
// Modules: https://go.nuxtjs.dev/config-modules
|
|
|
|
modules: [
|
|
|
|
// https://go.nuxtjs.dev/axios
|
|
|
|
'@nuxtjs/axios',
|
|
|
|
'cookie-universal-nuxt',
|
2021-01-22 03:47:58 +08:00
|
|
|
'@nuxtjs/proxy',
|
2021-01-23 05:06:44 +08:00
|
|
|
'nuxt-i18n',
|
2021-04-06 02:01:24 +08:00
|
|
|
'@dansmaculotte/nuxt-security',
|
2021-01-21 11:36:18 +08:00
|
|
|
],
|
|
|
|
|
|
|
|
// Axios module configuration: https://go.nuxtjs.dev/config-axios
|
2021-01-23 13:24:48 +08:00
|
|
|
axios: {},
|
2021-01-21 11:36:18 +08:00
|
|
|
|
|
|
|
// Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
|
|
|
|
vuetify: {
|
|
|
|
customVariables: ['~/assets/variables.scss'],
|
2021-03-11 05:41:26 +08:00
|
|
|
optionsPath: '~/plugins/vuetify.ts',
|
2021-01-31 01:27:36 +08:00
|
|
|
treeShake: true,
|
2021-01-21 11:36:18 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
// Build Configuration: https://go.nuxtjs.dev/config-build
|
2021-01-31 01:27:36 +08:00
|
|
|
build: {
|
2021-02-24 05:40:59 +08:00
|
|
|
transpile: ['lodash-es'],
|
2021-08-05 01:22:13 +08:00
|
|
|
publicPath,
|
2021-01-31 01:27:36 +08:00
|
|
|
},
|
2021-01-22 03:47:58 +08:00
|
|
|
|
2021-01-22 11:11:24 +08:00
|
|
|
router: {
|
2021-10-16 18:09:44 +08:00
|
|
|
middleware: ['routePermissions'],
|
2021-01-22 11:11:24 +08:00
|
|
|
},
|
|
|
|
|
2021-01-31 03:55:24 +08:00
|
|
|
proxy: [
|
2021-02-08 06:06:06 +08:00
|
|
|
// backend
|
2021-02-08 05:32:28 +08:00
|
|
|
proxyHost + '/api/',
|
|
|
|
proxyHost + '/signup',
|
|
|
|
proxyHost + '/login',
|
|
|
|
proxyHost + '/logout',
|
|
|
|
proxyHost + '/refresh',
|
|
|
|
proxyHost + '/invalidate',
|
|
|
|
proxyHost + '/v2/api-docs/',
|
2021-04-04 07:53:58 +08:00
|
|
|
proxyHost + '/robots.txt',
|
|
|
|
proxyHost + '/sitemap.xml',
|
|
|
|
proxyHost + '/global-sitemap.xml',
|
|
|
|
proxyHost + '/*/sitemap.xml',
|
2021-04-04 13:17:05 +08:00
|
|
|
proxyHost + '/statusz',
|
2021-02-08 06:06:06 +08:00
|
|
|
// auth
|
2021-06-07 05:45:56 +08:00
|
|
|
lazyAuthHost + '/avatar',
|
2021-01-31 03:55:24 +08:00
|
|
|
],
|
2021-01-22 03:47:58 +08:00
|
|
|
|
2021-01-23 05:06:44 +08:00
|
|
|
i18n: {
|
|
|
|
vueI18nLoader: true,
|
|
|
|
strategy: 'no_prefix',
|
|
|
|
defaultLocale: 'en',
|
|
|
|
locales: [
|
2021-08-05 01:22:13 +08:00
|
|
|
{ code: 'de', iso: 'de-DE', name: 'Deutsch', icon: 'Test' },
|
2021-06-06 17:03:39 +08:00
|
|
|
{ code: 'fr', iso: 'fr-FR', name: 'Français', icon: 'Test' },
|
|
|
|
{ code: 'en', iso: 'en-US', name: 'English', icon: 'Test' },
|
2021-08-05 01:22:13 +08:00
|
|
|
{ code: 'es', iso: 'es-ES', name: 'Español', icon: 'Test' },
|
2021-08-04 17:30:55 +08:00
|
|
|
{ code: 'it', iso: 'it-IT', name: 'Italiano', icon: 'Test' },
|
2021-08-05 01:22:13 +08:00
|
|
|
{ code: 'nl', iso: 'nl-NL', name: 'Nederlands', icon: 'Test' },
|
|
|
|
{ code: 'tr', iso: 'tr-TR', name: 'Türkçe', icon: 'Test' },
|
|
|
|
{ code: 'zhS', iso: 'zh-HANS', name: 'Simplified Chinese', icon: 'Test' },
|
|
|
|
{ code: 'zhT', iso: 'zh-HANT', name: 'Traditional Chinese', icon: 'Test' },
|
|
|
|
{ code: 'dum', iso: 'dum', name: 'Crowdin Dummy', icon: 'Test' },
|
2021-01-23 05:06:44 +08:00
|
|
|
],
|
|
|
|
vueI18n: {
|
|
|
|
locale: 'en',
|
|
|
|
fallbackLocale: 'en',
|
|
|
|
messages: {
|
2021-08-05 01:22:13 +08:00
|
|
|
de,
|
2021-01-23 05:06:44 +08:00
|
|
|
en,
|
|
|
|
fr,
|
2021-08-04 17:29:46 +08:00
|
|
|
es,
|
2021-08-05 01:22:13 +08:00
|
|
|
it,
|
|
|
|
nl,
|
|
|
|
tr,
|
|
|
|
zh_hans: zhHans,
|
|
|
|
zh_hant: zhHant,
|
|
|
|
dum,
|
2021-01-23 05:06:44 +08:00
|
|
|
},
|
|
|
|
},
|
2021-06-06 17:03:39 +08:00
|
|
|
detectBrowserLanguage: {
|
|
|
|
useCookie: true,
|
|
|
|
cookieKey: 'i18n_redirected',
|
|
|
|
onlyOnRoot: true,
|
|
|
|
},
|
2021-01-31 10:00:11 +08:00
|
|
|
},
|
2021-01-23 05:06:44 +08:00
|
|
|
|
2021-04-06 02:01:24 +08:00
|
|
|
security: {
|
|
|
|
dev: true,
|
|
|
|
hsts: {
|
|
|
|
maxAge: 15552000,
|
|
|
|
includeSubDomains: true,
|
|
|
|
preload: true,
|
|
|
|
},
|
2021-04-06 00:49:46 +08:00
|
|
|
csp: {
|
2021-04-06 02:01:24 +08:00
|
|
|
directives: {
|
|
|
|
defaultSrc: ["'self'", 'https://google-analytics.com', 'https://fonts.gstatic.com', 'https://fonts.googleapis.com'],
|
2021-08-05 01:22:13 +08:00
|
|
|
styleSrc: ["'self'", 'https://fonts.googleapis.com', 'cdn.jsdelivr.net', "'unsafe-inline'", 'https://cdn.crowdin.com'],
|
2021-04-06 02:01:24 +08:00
|
|
|
fontSrc: ['fonts.gstatic.com', 'cdn.jsdelivr.net'],
|
2021-08-05 01:22:13 +08:00
|
|
|
scriptSrc: [
|
|
|
|
"'self'" /* , "'nonce-{nonce}'" */,
|
|
|
|
"'unsafe-inline'",
|
|
|
|
"'unsafe-eval'",
|
|
|
|
'https://static.cloudflareinsights.com',
|
|
|
|
'https://cdn.crowdin.com',
|
|
|
|
],
|
2021-04-06 02:01:24 +08:00
|
|
|
imgSrc: [
|
2021-04-06 00:49:46 +08:00
|
|
|
"'self'",
|
|
|
|
'https://www.google-analytics.com',
|
|
|
|
'https://www.gravatar.com',
|
2021-06-07 05:58:08 +08:00
|
|
|
lazyAuthHost,
|
2021-04-06 00:49:46 +08:00
|
|
|
'data: papermc.io paper.readthedocs.io',
|
|
|
|
'https:', // ppl can use images in descriptions, we would need an image proxy or smth
|
|
|
|
],
|
2021-10-05 16:54:31 +08:00
|
|
|
frameSrc: ["'self'", 'http://localhost/', 'https://papermc.io/', 'https://hangar.crowdin.com', 'https://www.youtube-nocookie.com'],
|
2021-04-06 02:01:24 +08:00
|
|
|
manifestSrc: ["'self'"],
|
2021-08-05 01:22:13 +08:00
|
|
|
connectSrc: ["'self'", 'https://www.google-analytics.com', 'https://stats.g.doubleclick.net', 'https://hangar.crowdin.com'],
|
2021-04-06 02:01:24 +08:00
|
|
|
mediaSrc: ["'self'"],
|
|
|
|
objectSrc: ["'none'"],
|
|
|
|
baseUri: ["'none'"],
|
2021-04-06 00:49:46 +08:00
|
|
|
},
|
2021-04-06 02:01:24 +08:00
|
|
|
reportOnly: false,
|
2021-04-06 00:49:46 +08:00
|
|
|
},
|
2021-04-06 02:01:24 +08:00
|
|
|
referrer: 'same-origin',
|
|
|
|
additionalHeaders: true,
|
2021-04-06 00:49:46 +08:00
|
|
|
},
|
|
|
|
|
2021-01-22 03:47:58 +08:00
|
|
|
server: {
|
|
|
|
port: 3000,
|
2021-02-08 07:13:42 +08:00
|
|
|
host,
|
2021-01-22 03:47:58 +08:00
|
|
|
},
|
2021-01-31 02:50:12 +08:00
|
|
|
|
|
|
|
loading: {
|
2021-03-28 06:41:20 +08:00
|
|
|
color: colors.blue.lighten2,
|
2021-01-31 02:50:12 +08:00
|
|
|
continuous: true,
|
|
|
|
},
|
2021-03-16 03:31:16 +08:00
|
|
|
|
|
|
|
publicRuntimeConfig: {
|
|
|
|
axios: {
|
|
|
|
browserBaseURL: publicHost,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
privateRuntimeConfig: {
|
|
|
|
axios: {
|
|
|
|
baseURL: proxyHost,
|
|
|
|
},
|
|
|
|
},
|
2021-01-31 10:00:11 +08:00
|
|
|
} as NuxtConfig;
|