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-01-23 06:36:52 +08:00
|
|
|
import en from './locales/en';
|
|
|
|
import fr from './locales/fr';
|
2021-01-21 11:36:18 +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-02-08 06:06:06 +08:00
|
|
|
const authHost = process.env.authHost || '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-02-08 05:32:28 +08:00
|
|
|
|
2021-01-21 11:36:18 +08:00
|
|
|
export default {
|
2021-01-22 00:24:35 +08:00
|
|
|
telemetry: false,
|
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-01-23 06:36:52 +08:00
|
|
|
titleTemplate: (titleChunk: string) => {
|
2021-01-22 04:32:08 +08:00
|
|
|
return titleChunk ? `${titleChunk} | Hangar` : 'Hangar';
|
|
|
|
},
|
2021-01-21 11:36:18 +08:00
|
|
|
meta: [
|
|
|
|
{ charset: 'utf-8' },
|
|
|
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
|
|
{ hid: 'description', name: 'description', content: '' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
2021-03-17 01:43:58 +08:00
|
|
|
env: {
|
|
|
|
proxyHost,
|
|
|
|
authHost,
|
|
|
|
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-03-12 15:59:36 +08:00
|
|
|
plugins: ['~/plugins/api.ts', '~/plugins/utils.ts', '~/plugins/auth.ts', '~/plugins/perms.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
|
|
|
|
|
|
|
// PWA module configuration: https://go.nuxtjs.dev/pwa
|
|
|
|
pwa: {
|
|
|
|
manifest: {
|
2021-02-08 07:43:46 +08:00
|
|
|
name: 'Hangar | PaperMC',
|
|
|
|
short_name: 'Hangar',
|
|
|
|
description: 'Plugin repository for Paper plugins and more!',
|
2021-01-21 11:36:18 +08:00
|
|
|
lang: 'en',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// 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-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-02-05 08:22:22 +08:00
|
|
|
middleware: ['auth', '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
|
|
|
|
authHost + '/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: [
|
|
|
|
{ code: 'fr', iso: 'fr-FR', name: 'Français' },
|
|
|
|
{ code: 'en', iso: 'en-US', name: 'English' },
|
|
|
|
],
|
|
|
|
vueI18n: {
|
|
|
|
locale: 'en',
|
|
|
|
fallbackLocale: 'en',
|
|
|
|
messages: {
|
|
|
|
en,
|
|
|
|
fr,
|
|
|
|
},
|
|
|
|
},
|
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'],
|
|
|
|
styleSrc: ["'self'", 'https://fonts.googleapis.com', 'cdn.jsdelivr.net', "'unsafe-inline'"],
|
|
|
|
fontSrc: ['fonts.gstatic.com', 'cdn.jsdelivr.net'],
|
|
|
|
scriptSrc: ["'self'" /* , "'nonce-{nonce}'" */, "'unsafe-inline'", "'unsafe-eval'"],
|
|
|
|
imgSrc: [
|
2021-04-06 00:49:46 +08:00
|
|
|
"'self'",
|
|
|
|
'https://www.google-analytics.com',
|
|
|
|
'https://www.gravatar.com',
|
|
|
|
authHost,
|
|
|
|
'data: papermc.io paper.readthedocs.io',
|
|
|
|
'https:', // ppl can use images in descriptions, we would need an image proxy or smth
|
|
|
|
],
|
2021-04-14 02:05:20 +08:00
|
|
|
frameSrc: ["'self'", 'http://localhost/', 'https://papermc.io/'],
|
2021-04-06 02:01:24 +08:00
|
|
|
manifestSrc: ["'self'"],
|
|
|
|
connectSrc: ["'self'", 'https://www.google-analytics.com', 'https://stats.g.doubleclick.net'],
|
|
|
|
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;
|