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

editor/ui: support non-number error_code

This commit is contained in:
Anthony Donlon
2025-11-22 03:20:24 +08:00
parent 3c039efcd9
commit 7759df6077

View File

@@ -60,7 +60,7 @@
// can be changed if specified by '?from=<name>' // can be changed if specified by '?from=<name>'
let initialConfig = { let initialConfig = {
"title": "Internal server error", "title": "Internal server error",
"error_code": 500, "error_code": '500',
"more_information": { "more_information": {
"hidden": false, "hidden": false,
"text": "cloudflare.com", "text": "cloudflare.com",
@@ -92,11 +92,11 @@
const PRESETS = { const PRESETS = {
"default": structuredClone(initialConfig), "default": structuredClone(initialConfig),
"empty": { "empty": {
"error_code": 500, "error_code": '500',
}, },
"catastrophic": { "catastrophic": {
"title": "Catastrophic infrastructure failure", "title": "Catastrophic infrastructure failure",
"error_code": 500, "error_code": '500',
"browser_status": { "browser_status": {
"status": "error", "status": "error",
"status_text": "Out of Memory" "status_text": "Out of Memory"
@@ -117,7 +117,7 @@
}, },
"working": { "working": {
"title": "Web server is working", "title": "Web server is working",
"error_code": 200, "error_code": '200',
"more_information": { "more_information": {
"hidden": true "hidden": true
}, },
@@ -216,7 +216,7 @@
function readConfig() { function readConfig() {
return { return {
title: $('title').value, title: $('title').value,
error_code: Number($('error_code').value) || 500, error_code: $('error_code').value,
more_information: { more_information: {
hidden: !!$('more_hidden').checked, hidden: !!$('more_hidden').checked,
text: $('more_text').value, text: $('more_text').value,
@@ -562,7 +562,7 @@
<div class="form-row"> <div class="form-row">
<label for="error_code">Error Code</label> <label for="error_code">Error Code</label>
<div class="control"> <div class="control">
<input id="error_code" type="number" class="form-control form-control-sm" /> <input id="error_code" class="form-control form-control-sm" placeholder="500" />
</div> </div>
</div> </div>
</div> </div>