2020-09-28 08:51:26 -07:00
|
|
|
import translations from './server/translations';
|
2020-09-28 10:22:36 -07:00
|
|
|
import config from './server/config';
|
2020-10-13 12:49:08 -07:00
|
|
|
import fs from 'fs';
|
2020-10-26 16:42:42 -07:00
|
|
|
import {buildDict} from "./src/helpers";
|
2020-09-28 08:51:26 -07:00
|
|
|
|
2020-10-12 07:41:25 -07:00
|
|
|
const locale = config.locale;
|
2020-09-28 08:51:26 -07:00
|
|
|
const title = translations.title;
|
|
|
|
const description = translations.description;
|
2020-07-22 13:19:23 -07:00
|
|
|
const banner = process.env.BASE_URL + '/banner/zaimki.png';
|
2020-07-24 12:15:33 -07:00
|
|
|
const colour = '#C71585';
|
2020-07-22 13:19:23 -07:00
|
|
|
|
2020-08-04 07:15:41 -07:00
|
|
|
const bodyParser = require('body-parser');
|
|
|
|
|
2020-07-22 13:19:23 -07:00
|
|
|
export default {
|
|
|
|
target: 'server',
|
|
|
|
head: {
|
|
|
|
title: title,
|
|
|
|
meta: [
|
|
|
|
{ charset: 'utf-8' },
|
|
|
|
|
|
|
|
{ hid: 'description', name: 'description', content: description },
|
|
|
|
|
|
|
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
|
|
{ hid: 'apple-mobile-web-app-title', name: 'apple-mobile-web-app-title', content: title },
|
2020-07-24 12:15:33 -07:00
|
|
|
{ hid: 'theme-color', name: 'theme-color', content: colour },
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
|
|
{ hid: 'og:type', property: 'og:type', content: 'article' },
|
|
|
|
{ hid: 'og:title', property: 'og:title', content: title },
|
|
|
|
{ hid: 'og:description', property: 'og:description', content: description },
|
|
|
|
{ hid: 'og:site_name', property: 'og:site_name', content: title },
|
|
|
|
{ hid: 'og:logo', property: 'og:logo', content: banner },
|
|
|
|
|
|
|
|
{ hid: 'twitter:card', property: 'twitter:card', content: 'summary_large_image' },
|
|
|
|
{ hid: 'twitter:title', property: 'twitter:title', content: title },
|
|
|
|
{ hid: 'twitter:description', property: 'twitter:description', content: description },
|
|
|
|
{ hid: 'twitter:site', property: 'twitter:site', content: process.env.BASE_URL },
|
|
|
|
{ hid: 'twitter:image', property: 'twitter:image', content: banner },
|
|
|
|
],
|
|
|
|
link: [
|
|
|
|
{ rel: 'icon', type: 'image/svg', href: '/favicon.svg' }
|
|
|
|
],
|
|
|
|
},
|
|
|
|
css: [],
|
|
|
|
plugins: [
|
|
|
|
{ src: '~/plugins/vue-matomo.js', ssr: false },
|
2020-09-28 09:29:13 -07:00
|
|
|
{ src: '~/plugins/globals.js' },
|
2020-10-15 09:50:32 -07:00
|
|
|
{ src: '~/plugins/auth.js' },
|
2020-07-22 13:19:23 -07:00
|
|
|
],
|
|
|
|
components: true,
|
|
|
|
buildModules: [],
|
|
|
|
modules: [
|
|
|
|
'@nuxtjs/pwa',
|
2020-08-04 07:15:41 -07:00
|
|
|
'@nuxtjs/axios',
|
2020-10-12 07:41:25 -07:00
|
|
|
['@nuxtjs/redirect-module', {
|
|
|
|
rules: config.redirects,
|
2020-10-15 10:23:53 -07:00
|
|
|
}],
|
|
|
|
'cookie-universal-nuxt',
|
2020-07-22 13:19:23 -07:00
|
|
|
],
|
2020-07-24 12:15:33 -07:00
|
|
|
pwa: {
|
|
|
|
manifest: {
|
|
|
|
name: title,
|
|
|
|
short_name: title,
|
|
|
|
description: description,
|
|
|
|
background_color: '#ffffff',
|
|
|
|
theme_color: colour,
|
2020-10-12 07:41:25 -07:00
|
|
|
lang: locale,
|
2020-07-24 12:15:33 -07:00
|
|
|
}
|
|
|
|
},
|
2020-07-25 10:21:52 -07:00
|
|
|
build: {
|
|
|
|
extend (config, ctx) {
|
|
|
|
config.module.rules.push({
|
|
|
|
test: /\.csv|\.tsv$/,
|
|
|
|
loader: 'csv-loader',
|
|
|
|
options: {
|
|
|
|
dynamicTyping: true,
|
|
|
|
header: true,
|
|
|
|
skipEmptyLines: true,
|
2020-08-25 05:58:11 -07:00
|
|
|
delimiter: '\t',
|
2020-07-25 10:21:52 -07:00
|
|
|
}
|
2020-09-28 05:12:20 -07:00
|
|
|
});
|
|
|
|
config.module.rules.push({
|
|
|
|
test: /\.suml$/,
|
|
|
|
loader: 'suml-loader',
|
|
|
|
});
|
2020-07-25 10:21:52 -07:00
|
|
|
},
|
|
|
|
},
|
2020-07-22 13:19:23 -07:00
|
|
|
env: {
|
2020-10-13 12:49:08 -07:00
|
|
|
BASE_URL: process.env.BASE_URL,
|
|
|
|
PUBLIC_KEY: fs.readFileSync(__dirname + '/keys/public.pem').toString(),
|
2020-10-24 12:50:08 -07:00
|
|
|
LOCALE: config.locale,
|
2020-10-26 16:42:42 -07:00
|
|
|
FLAGS: buildDict(function *() {
|
|
|
|
for (let flag of fs.readdirSync(__dirname + '/static/flags/')) {
|
|
|
|
yield [
|
|
|
|
flag.replace(new RegExp('\.png$'), ''),
|
|
|
|
flag.replace(new RegExp('\.png$'), '')
|
|
|
|
.replace(new RegExp('_', 'g'), '')
|
|
|
|
.trim()
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}),
|
2020-07-22 13:19:23 -07:00
|
|
|
},
|
|
|
|
serverMiddleware: {
|
2020-08-04 07:15:41 -07:00
|
|
|
'/': bodyParser.json(),
|
2020-07-22 13:19:23 -07:00
|
|
|
'/banner': '~/server/banner.js',
|
2020-10-13 12:49:08 -07:00
|
|
|
'/api/nouns': '~/server/nouns.js',
|
|
|
|
'/api/user': '~/server/user.js',
|
2020-10-16 11:17:50 -07:00
|
|
|
'/api/profile': '~/server/profile.js',
|
2020-07-22 13:19:23 -07:00
|
|
|
},
|
2020-08-04 07:15:41 -07:00
|
|
|
axios: {
|
2020-10-13 12:49:08 -07:00
|
|
|
baseURL: process.env.BASE_URL + '/api',
|
2020-09-28 05:12:20 -07:00
|
|
|
},
|
2020-09-28 10:22:36 -07:00
|
|
|
router: {
|
|
|
|
extendRoutes(routes, resolve) {
|
|
|
|
if (config.sources.enabled) {
|
|
|
|
routes.push({ path: '/' + config.sources.route, component: resolve(__dirname, 'routes/sources.vue') });
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config.nouns.enabled) {
|
|
|
|
routes.push({ path: '/' + config.nouns.route, component: resolve(__dirname, 'routes/nouns.vue') });
|
|
|
|
}
|
|
|
|
|
2020-09-29 08:59:23 -07:00
|
|
|
if (config.names.enabled) {
|
|
|
|
routes.push({ path: '/' + config.names.route, component: resolve(__dirname, 'routes/names.vue') });
|
|
|
|
}
|
|
|
|
|
2020-10-10 09:31:31 -07:00
|
|
|
if (config.faq.enabled) {
|
|
|
|
routes.push({ path: '/' + config.faq.route, component: resolve(__dirname, 'routes/faq.vue') });
|
|
|
|
}
|
|
|
|
|
2020-09-28 10:22:36 -07:00
|
|
|
if (config.links.enabled) {
|
|
|
|
routes.push({ path: '/' + config.links.route, component: resolve(__dirname, 'routes/links.vue') });
|
|
|
|
}
|
|
|
|
|
2020-09-29 10:11:46 -07:00
|
|
|
if (config.people.enabled) {
|
|
|
|
routes.push({ path: '/' + config.people.route, component: resolve(__dirname, 'routes/people.vue') });
|
|
|
|
}
|
|
|
|
|
2020-09-29 09:34:47 -07:00
|
|
|
if (config.english.enabled) {
|
|
|
|
routes.push({ path: '/' + config.english.route, component: resolve(__dirname, 'routes/english.vue') });
|
|
|
|
}
|
|
|
|
|
2020-09-28 10:22:36 -07:00
|
|
|
if (config.contact.enabled) {
|
|
|
|
routes.push({ path: '/' + config.contact.route, component: resolve(__dirname, 'routes/contact.vue') });
|
|
|
|
}
|
|
|
|
|
2020-10-13 12:49:08 -07:00
|
|
|
if (config.user.enabled) {
|
|
|
|
routes.push({path: '/' + config.user.route, component: resolve(__dirname, 'routes/user.vue')});
|
2020-10-24 12:50:08 -07:00
|
|
|
routes.push({path: '/' + config.user.profileEditorRoute, component: resolve(__dirname, 'routes/profileEditor.vue')});
|
2020-10-27 00:52:11 -07:00
|
|
|
routes.push({path: '/' + config.user.termsRoute, component: resolve(__dirname, 'routes/terms.vue')});
|
2020-10-13 12:49:08 -07:00
|
|
|
}
|
2020-09-28 10:22:36 -07:00
|
|
|
routes.push({ path: '/' + config.template.any.route, component: resolve(__dirname, 'routes/any.vue') });
|
|
|
|
|
2020-10-16 11:17:50 -07:00
|
|
|
routes.push({ path: '/@*', component: resolve(__dirname, 'routes/profile.vue') });
|
|
|
|
|
2020-09-29 06:36:49 -07:00
|
|
|
routes.push({ name: 'all', path: '*', component: resolve(__dirname, 'routes/template.vue') });
|
2020-09-28 10:22:36 -07:00
|
|
|
},
|
|
|
|
},
|
2020-07-22 13:19:23 -07:00
|
|
|
}
|