mirror of
https://github.com/dalbodeule/hop-gate.git
synced 2025-12-08 04:45:43 +09:00
[fix](errorpages): refine error page handling and resolve template issues
- Replaced unused `logo.svg` reference with `hop-gate.png` in embedded assets. - Fixed redundant code for reading files from the error page directory. - Updated 400 error template to properly reference external Tailwind CSS. - Corrected invalid DOCTYPE declaration in 525 error template.
This commit is contained in:
@@ -22,7 +22,8 @@ var embeddedTemplatesFS embed.FS
|
||||
//
|
||||
// Expected files (by convention):
|
||||
// - assets/errors.css
|
||||
// - assets/logo.svg
|
||||
// - assets/hop-gate.png
|
||||
//
|
||||
//go:embed assets/*
|
||||
var AssetsFS embed.FS
|
||||
|
||||
@@ -67,16 +68,14 @@ func Load(status int) ([]byte, bool) {
|
||||
if dir == "" {
|
||||
dir = "./errors"
|
||||
}
|
||||
if dir != "" {
|
||||
p := filepath.Join(dir, name)
|
||||
if data, err := os.ReadFile(p); err == nil {
|
||||
return data, true
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Embedded default templates.
|
||||
// 2. 내장 기본 템플릿.
|
||||
p := filepath.Join("templates", name)
|
||||
p = filepath.Join("templates", name)
|
||||
if data, err := embeddedTemplatesFS.ReadFile(p); err == nil {
|
||||
return data, true
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<title>400 Bad Request - HopGate</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- Tailwind build output should be bundled into this file -->
|
||||
<!-- Tailwind CSS is served separately from /__hopgate_assets__/errors.css -->
|
||||
<link rel="stylesheet" href="/__hopgate_assets__/errors.css">
|
||||
</head>
|
||||
<body class="min-h-screen bg-slate-950 text-slate-50 flex items-center justify-center px-4">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ㄱ<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
Reference in New Issue
Block a user