Archived
Trust reverse proxy client IP headers
This commit is contained in:
1 parent
97a76aa91e
commit
62ccfa3709
10 files changed
+243
-73
No files matched your search
+13
-13
@@ -31,30 +31,30 @@ def _event_label(status: object) -> str:
|
||||
def _copy_row(label: str, value: str, sensitivity: str | None = None, *, mask_secret: bool = True) -> SafeHtml:
|
||||
safe_label = escape(label)
|
||||
safe_value = escape(value)
|
||||
badge = ""
|
||||
attr_label = attr(label)
|
||||
attr_value = attr(value)
|
||||
is_secret = bool(sensitivity and sensitivity.lower() == "secret")
|
||||
if sensitivity:
|
||||
safe_sensitivity = escape(sensitivity)
|
||||
badge_class = "text-bg-warning" if is_secret else "text-bg-secondary"
|
||||
badge = f'<span class="badge {badge_class} rounded-pill">{safe_sensitivity}</span>'
|
||||
should_mask = is_secret and mask_secret
|
||||
value_field = (
|
||||
f'<input class="form-control copy-value text-truncate" type="password" value="{safe_value}" readonly data-secret-input>'
|
||||
f'<input class="copy-pill-value copy-value" type="password" value="{attr_value}" readonly data-secret-input>'
|
||||
if should_mask
|
||||
else f'<code class="form-control copy-value text-truncate">{safe_value}</code>'
|
||||
else f'<code class="copy-pill-value copy-value">{safe_value}</code>'
|
||||
)
|
||||
reveal_button = (
|
||||
f'<button type="button" class="btn btn-outline-secondary" data-secret-toggle aria-label="Show {safe_label}">View</button>'
|
||||
f'<button type="button" class="btn btn-outline-secondary rounded-pill copy-reveal-button" data-secret-toggle aria-label="Show {attr_label}">View</button>'
|
||||
if should_mask
|
||||
else ""
|
||||
)
|
||||
row_class = "copy-field copy-field-secret" if is_secret else "copy-field copy-field-public"
|
||||
return trusted(
|
||||
f"""
|
||||
<div class="input-group copy-field">
|
||||
<span class="input-group-text copy-label"><span>{safe_label}</span>{badge}</span>
|
||||
{value_field}
|
||||
{reveal_button}
|
||||
<button type="button" class="btn btn-outline-secondary copy-button" data-copy="{safe_value}" aria-label="Copy {safe_label}">
|
||||
<div class="{row_class}">
|
||||
<div class="copy-pill">
|
||||
<span class="copy-pill-label">{safe_label}</span>
|
||||
{value_field}
|
||||
{reveal_button}
|
||||
</div>
|
||||
<button type="button" class="btn btn-outline-secondary rounded-pill copy-button" data-copy="{attr_value}" aria-label="Copy {attr_label}">
|
||||
{_svg_icon("clipboard")}<span data-copy-label>Copy</span>{_svg_icon("check", "check-icon")}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user