You've already forked caddy-opnsense-blocker
Fix IP details page JavaScript quoting
This commit is contained in:
@@ -601,7 +601,7 @@ const ipDetailsHTML = `<!doctype html>
|
||||
.hint { font-size: .9rem; color: #94a3b8; margin-top: .75rem; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<body data-ip="{{ .IP }}">
|
||||
<header>
|
||||
<div><a href="/">← Back</a></div>
|
||||
<h1 class="mono">{{ .IP }}</h1>
|
||||
@@ -646,7 +646,7 @@ const ipDetailsHTML = `<!doctype html>
|
||||
</section>
|
||||
</main>
|
||||
<script>
|
||||
const ip = {{ printf "%q" .IP }};
|
||||
const ip = document.body.dataset.ip || '';
|
||||
|
||||
function escapeHtml(value) {
|
||||
return String(value ?? '').replace(/[&<>"']/g, character => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[character]));
|
||||
|
||||
Reference in New Issue
Block a user