9
0
mirror of https://github.com/donlon/cloudflare-error-page.git synced 2025-12-19 14:59:28 +00:00

Node ver.

This commit is contained in:
Jun
2025-12-10 13:02:21 +10:30
parent 94c3c4ddbe
commit 744ae19f09
11 changed files with 668 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import { render } from '../dist/index.js';
import * as fs from 'fs';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Generate an error page
const errorPage = render({
browser_status: {
status: 'ok',
},
cloudflare_status: {
status: 'error',
status_text: 'Error',
},
host_status: {
status: 'ok',
location: 'example.com',
},
error_source: 'cloudflare',
what_happened: '<p>There is an internal server error on Cloudflare\'s network.</p>',
what_can_i_do: '<p>Please try again in a few minutes.</p>',
});
const outputPath = join(__dirname, 'error.html');
fs.writeFileSync(outputPath, errorPage);
console.log(`Error page generated: ${outputPath}`);
console.log('Open the file in your browser to view it.');