mirror of
https://github.com/Lissy93/web-check.git
synced 2025-08-12 06:02:46 +02:00
Send user direct to check page, if self-hosted
This commit is contained in:
@ -31,6 +31,9 @@ const site = unwrapEnvVar('SITE_URL', 'https://web-check.xyz');
|
|||||||
// The base URL of the site (if serving from a subdirectory)
|
// The base URL of the site (if serving from a subdirectory)
|
||||||
const base = unwrapEnvVar('BASE_URL', '/');
|
const base = unwrapEnvVar('BASE_URL', '/');
|
||||||
|
|
||||||
|
// Should run the app in boss-mode (requires extra configuration)
|
||||||
|
const isBossServer = unwrapEnvVar('BOSS_SERVER', false);
|
||||||
|
|
||||||
// Initialize Astro integrations
|
// Initialize Astro integrations
|
||||||
const integrations = [react(), partytown(), sitemap()];
|
const integrations = [react(), partytown(), sitemap()];
|
||||||
|
|
||||||
@ -62,17 +65,13 @@ console.log(
|
|||||||
`to help fund maintenance & development.\x1b[0m\n`,
|
`to help fund maintenance & development.\x1b[0m\n`,
|
||||||
);
|
);
|
||||||
|
|
||||||
const buildOptions = {
|
const redirects = {};
|
||||||
output: 'dist',
|
|
||||||
format: 'esm',
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// Skip the marketing homepage for self-hosted users
|
||||||
const redirects = {
|
if (isBossServer && isBossServer === 'true') {
|
||||||
'/': '/test',
|
redirects['/'] = '/check';
|
||||||
// '/results/[...target]': '/check/[...target]', // The old path was /results (redirect to maintain compatibility)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export Astro configuration
|
// Export Astro configuration
|
||||||
export default defineConfig({ output, base, integrations, site, adapter, redirects, buildOptions });
|
export default defineConfig({ output, base, integrations, site, adapter, redirects });
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "web-check",
|
"name": "web-check",
|
||||||
|
"type": "module",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"homepage": ".",
|
"homepage": ".",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -127,6 +127,14 @@ fs.readdirSync(dirPath, { withFileTypes: true })
|
|||||||
res.json(results);
|
res.json(results);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Skip the marketing homepage, for self-hosted users
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
if (req.path === '/' && process.env.BOSS_SERVER !== 'true') {
|
||||||
|
req.url = '/check';
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
// Serve up the GUI - if build dir exists, and GUI feature enabled
|
// Serve up the GUI - if build dir exists, and GUI feature enabled
|
||||||
if (process.env.DISABLE_GUI && process.env.DISABLE_GUI !== 'false') {
|
if (process.env.DISABLE_GUI && process.env.DISABLE_GUI !== 'false') {
|
||||||
app.get('*', async (req, res) => {
|
app.get('*', async (req, res) => {
|
||||||
|
Reference in New Issue
Block a user