-
Notifications
You must be signed in to change notification settings - Fork 6
/
nuxt.config.js
171 lines (152 loc) · 3.67 KB
/
nuxt.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import axios from 'axios';
import {createProxyMiddleware} from 'http-proxy-middleware';
const proxy = createProxyMiddleware({
target: 'https://localhost:8000',
});
const isStatic = process.env.NUXT_ENV_STATIC === 'true';
const staticBase = (process.env.NODE_ENV === 'development' || isStatic) ? '' : '/themes/tsgctf/static';
export default {
ssr: isStatic,
target: 'static',
head: {
title: 'TSG CTF',
meta: [
{charset: 'utf-8'},
{name: 'viewport', content: 'width=device-width, initial-scale=1'},
{
name: 'description',
hid: 'description',
content: 'TSG CTF is an on-line CTF organized by TSG, the official computer society of The University of Tokyo',
},
{name: 'apple-mobile-web-app-title', content: 'TSG CTF 2023'},
{name: 'og:title', content: 'TSG CTF 2023'},
{name: 'og:site_name', content: 'TSG CTF 2023'},
{name: 'og:description', content: 'TSG CTF is an on-line CTF organized by TSG, the official computer society of The University of Tokyo'},
{name: 'og:type', content: 'website'},
{name: 'og:url', content: 'https://score.ctf.tsg.ne.jp'},
{name: 'og:image', content: `${staticBase}/ogimage.jpg`},
{name: 'twitter:card', content: 'summary_large_image'},
{name: 'twitter:site', content: '@tsgctf'},
{name: 'twitter:site', content: '@tsgctf'},
{name: 'twitter:title', content: 'TSG CTF 2023'},
{
name: 'twitter:description',
content: 'TSG CTF is an on-line CTF organized by TSG, the official computer society of The University of Tokyo',
},
{name: 'twitter:image', content: `${staticBase}/ogimage.jpg`},
{name: 'twitter:image:alt', content: 'TSG CTF'},
],
link: [{rel: 'icon', type: 'image/png', href: `${staticBase}/favicon.png`}],
},
loading: {color: '#fff'},
css: [],
plugins: ['~/plugins/axios', '~/plugins/vue-timeago', '~/plugins/inject-is-static'],
modules: [
...(isStatic ? [] : [
'nuxt-client-init-module',
]),
'@nuxtjs/axios',
'@nuxtjs/markdownit',
'@nuxtjs/pwa',
...(isStatic ? [] : [
'@nuxtjs/onesignal',
]),
],
generate: {
fallback: '404.html',
routes: async () => {
if (!isStatic) {
return [];
}
const teams = [];
let page = 1;
while (true) {
const {data} = await axios.get('https://score.ctf.tsg.ne.jp/api/v1/teams', {params: {page}});
teams.push(...data.data);
if (data.meta.pagination.next === null) {
break;
}
page++;
}
return teams.map(({id}) => `/teams/${id}`);
},
concurrency: 5,
},
axios: {
baseURL: 'https://score.ctf.tsg.ne.jp/',
browserBaseURL: '/',
},
oneSignal: {
init: {
appId: '6acee8f3-7842-4a55-91f6-b63ac21a667d', // public token
allowLocalhostAsSecureOrigin: true,
},
},
markdownit: {
injected: true,
},
build: {
postcss: {
plugins: {
precss: {},
'postcss-import-url': {},
},
preset: {
features: {
customProperties: false,
},
},
},
publicPath: `${staticBase}/_nuxt/`,
},
router: {},
serverMiddleware: [
...(process.env.NODE_ENV === 'development'
? [
{
path: '/oauth',
handler: proxy,
},
{
path: '/api',
handler: proxy,
},
{
path: '/login',
handler: proxy,
},
{
path: '/logout',
handler: proxy,
},
{
path: '/register',
handler: proxy,
},
{
path: '/teams/join',
handler: proxy,
},
{
path: '/teams/new',
handler: proxy,
},
]
: []),
],
env: {
session: process.env.SESSION || '',
},
pwa: {
icon: {
source: 'static/favicon.png',
},
manifest: {
name: 'TSG CTF 2023',
short_name: 'TSG CTF',
start_url: 'https://score.ctf.tsg.ne.jp/?standalone=true',
theme_color: '#47e543',
lang: 'en',
},
},
};