-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #379 from FuelRats/develop
- Loading branch information
Showing
319 changed files
with
9,791 additions
and
10,431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const COMMIT_HASH_LENGTH = 10 | ||
|
||
const ciEnv = Object.freeze({ | ||
isCi: process.env.CI, | ||
ciId: process.env.GITHUB_RUN_ID, | ||
server: process.env.GITHUB_SERVER_URL ?? 'https://github.com', | ||
repository: process.env.GITHUB_REPOSITORY ?? 'fuelrats/fuelrats.com', | ||
branch: process.env.GITHUB_REF?.replace(/^refs\/heads\//u, '')?.replace(/\//gu, '-') ?? 'develop', | ||
commit: process.env.GITHUB_SHA?.toLowerCase(), | ||
commitShort: process.env.GITHUB_SHA?.slice(0, COMMIT_HASH_LENGTH)?.toLowerCase(), | ||
}) | ||
|
||
|
||
|
||
|
||
|
||
module.exports = ciEnv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const DEFAULT_PORT = 3000 | ||
|
||
const env = Object.freeze({ | ||
appUrl: process.env.APP_URL, | ||
proxied: process.env.APP_PROXIED, | ||
isDev: process.env.NODE_ENV !== 'production', | ||
port: process.env.PORT ?? DEFAULT_PORT, | ||
fallbackUrl: process.env.FR_FALLBACK_URL ?? 'https://fallback.fuelrats.com/', | ||
frapi: { | ||
url: process.env.FR_API_URL ?? 'https://dev.api.fuelrats.com', | ||
proxy: `${process.env.APP_URL}/api/fr`, | ||
socket: process.env.FR_SOCKET_URL ?? 'wss://dev.api.fuelrats.com', | ||
clientId: process.env.FR_API_KEY, | ||
clientSecret: process.env.FR_API_SECRET, | ||
}, | ||
edsm: { | ||
url: process.env.FR_EDSM_API_URL ?? 'https://www.edsm.net', | ||
proxy: `${process.env.APP_URL}/api/edsm`, | ||
}, | ||
wordpress: { | ||
url: process.env.FR_WORDPRESS_URL ?? 'https://wordpress.fuelrats.com', | ||
proxy: `${process.env.APP_URL}/api/wp`, | ||
}, | ||
stripe: { | ||
url: `${process.env.APP_URL}/api/stripe`, | ||
public: process.env.FR_STRIPE_API_PK, | ||
secret: process.env.FR_STRIPE_API_SK, | ||
bansFile: process.env.FR_STRIPE_BANS_FILE, | ||
}, | ||
qms: { | ||
url: process.env.QMS_API_URL ?? 'https://api.qms.fuelrats.dev', | ||
token: process.env.QMS_API_TOKEN, | ||
}, | ||
irc: { | ||
client: process.env.FR_CLIENT_IRC_URL ?? 'https://qms.fuelrats.dev', | ||
rat: process.env.FR_RAT_IRC_URL ?? 'https://kiwi.fuelrats.com', | ||
}, | ||
}) | ||
|
||
module.exports = env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const nextSafe = require('next-safe') | ||
|
||
|
||
module.exports = ({ isDev, frapi, appUrl }) => { | ||
// Some headers are set by our reverse proxy in prod, so they should be disabled ouside of dev environments. | ||
const defaultIfDev = isDev ? undefined : false | ||
return () => { | ||
return [ | ||
{ | ||
source: '/:path*', | ||
headers: nextSafe({ | ||
isDev, | ||
contentSecurityPolicy: { | ||
'default-src': ["'self'", '*.fuelrats.com'], | ||
'script-src': ["'self'", '*.stripe.com'], | ||
'connect-src': ["'self'", 'wss://*.fuelrats.com', frapi.url, appUrl], | ||
'object-src': ["'self'", 'data:'], | ||
'font-src': ["'self'", 'fonts.gstatic.com'], | ||
'style-src': ["'self'", "'unsafe-inline'", 'fonts.googleapis.com'], | ||
'img-src': ["'self'", '*.wp.com', 'blob:', 'data:'], | ||
'frame-src': ['https://js.stripe.com'], | ||
'child-src': false, | ||
'prefetch-src': false, | ||
'worker-src': false, | ||
}, | ||
frameOptions: defaultIfDev, | ||
contentTypeOptions: defaultIfDev, | ||
referrerPolicy: defaultIfDev, | ||
xssProtection: defaultIfDev, | ||
}), | ||
}, | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// This information is PUBLIC. all env values are explicitly defined to prevent secret leakage. | ||
// DO NOT BLINDLY DEFINE OBJECTS! I.E. `frapi: env.frapi,` | ||
module.exports = (env) => { | ||
return { | ||
appUrl: env.appUrl, | ||
frapi: { | ||
url: env.frapi.proxy, | ||
server: env.frapi.url, | ||
socket: env.frapi.socket, | ||
}, | ||
edsm: { | ||
url: env.edsm.proxy, | ||
}, | ||
wordpress: { | ||
url: env.wordpress.proxy, | ||
}, | ||
stripe: { | ||
url: env.stripe.url, | ||
public: env.stripe.public, | ||
}, | ||
irc: { | ||
client: env.irc.client, | ||
rat: env.irc.rat, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
module.exports = (env) => { | ||
return () => { | ||
return ([ | ||
{ | ||
// All IE traffic should go to fallbackUrl. | ||
source: '/:path*', | ||
destination: env.fallbackUrl, | ||
permanent: false, | ||
basePath: false, | ||
has: [ | ||
{ | ||
type: 'header', | ||
key: 'User-Agent', | ||
value: '(.*Trident.*)', | ||
}, | ||
], | ||
}, | ||
{ | ||
// Temporary workaround so canceled donations return to donate screen | ||
source: '/donate/cancel', | ||
destination: '/donate', | ||
permanent: false, | ||
}, | ||
{ | ||
// Profile page requires a tab name in the path | ||
source: '/profile', | ||
destination: '/profile/overview', | ||
permanent: true, | ||
}, | ||
{ | ||
// Old blog used to exist at /blogs | ||
source: '/blogs', | ||
destination: '/blog', | ||
permanent: true, | ||
}, | ||
{ | ||
// get-help was used at launch of the website, but has since been changed back. | ||
source: '/get-help', | ||
destination: '/i-need-fuel', | ||
permanent: true, | ||
}, | ||
{ | ||
// Common endpoint for privacy policies | ||
source: '/privacy', | ||
destination: '/privacy-policy', | ||
permanent: true, | ||
}, | ||
{ | ||
// Lexicon is no longer local | ||
source: '/fuel-rats-lexicon', | ||
destination: 'https://confluence.fuelrats.com/pages/viewpage.action?pageId=3637257', | ||
permanent: true, | ||
basePath: false, | ||
}, | ||
{ | ||
// statistics are no longer local | ||
source: '/statistics', | ||
destination: 'https://grafana.fuelrats.com', | ||
permanent: true, | ||
basePath: false, | ||
}, | ||
{ | ||
// People often type this one manually into their URL bar to get to the helpdesk | ||
source: '/help', | ||
destination: 'https://t.fuelr.at/help', | ||
permanent: true, | ||
basePath: false, | ||
}, | ||
]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = (env) => { | ||
return () => { | ||
return { | ||
beforeFiles: [ | ||
{ | ||
// Apple demands this be on the site root, but all api routes must be in /api. oof. | ||
source: '/apple-app-site-association', | ||
destination: '/api/apple-app-site-association', | ||
}, | ||
{ | ||
// Blog content dir. | ||
source: '/wp-content/:path*', | ||
destination: `${env.wordpress.url}/wp-content/:path*`, | ||
}, | ||
], | ||
fallback: [ | ||
{ | ||
// Old blog links. yikes. | ||
source: '/:year/:month/:day/:slug', | ||
destination: '/blog/:slug', | ||
}, | ||
], | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* eslint-disable import/no-extraneous-dependencies -- required dev dependencies are only loaded in development context */ | ||
/* eslint-disable no-param-reassign -- reassign is intended for changing configs */ | ||
const { DefinePlugin } = require('webpack') | ||
|
||
const ciEnv = require('./ciEnv') | ||
|
||
|
||
|
||
|
||
|
||
module.exports = () => { | ||
return (config, opt) => { | ||
/* Define Plugin */ | ||
config.plugins.push(new DefinePlugin({ | ||
'$$BUILD.isDev': JSON.stringify(opt.dev), | ||
'$$BUILD.isProduction': JSON.stringify(!opt.dev && ciEnv.branch === 'release'), | ||
'$$BUILD.branch': JSON.stringify(ciEnv.branch ?? null), | ||
'$$BUILD.commit': JSON.stringify(ciEnv.commit ?? null), | ||
'$$BUILD.commitShort': JSON.stringify(ciEnv.commitShort ?? ciEnv.branch), | ||
'$$BUILD.date': JSON.stringify((new Date()).toISOString()), | ||
'$$BUILD.url': JSON.stringify(`${ciEnv.server}/${ciEnv.repository}${ciEnv.ciId ? `/actions/runs/${ciEnv.ciId}` : ''}`), | ||
'$$BUILD.id': JSON.stringify(opt.buildId), | ||
'$$BUILD.nodeVersion': JSON.stringify(process.version), | ||
})) | ||
|
||
// Workaround to fix dev warning: https://github.com/vercel/next.js/issues/19865 | ||
config.output.hotUpdateMainFilename = 'static/webpack/[fullhash].[runtime].hot-update.json' | ||
|
||
/* SVGR */ | ||
config.module.rules.push({ | ||
exclude: /node_modules/u, | ||
test: /\.svg$/u, | ||
loader: require.resolve('@svgr/webpack'), | ||
}) | ||
|
||
return config | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.