Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lambda/admin_portal/portal_page/link_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from util.date_util import get_jst_datetime_now
from util.logger_util import setup_logger
from util.nonce_util import create_nonce
from util.response_util import error_response, success_response
from util.response_util import error_response, success_response, STATIC_FOOTER
from util.static_resource_util import load_function_html

logger = setup_logger("admin_portal.link_list_page")
Expand All @@ -36,7 +36,8 @@ def _get_links_html(cls, domain: str, links: list[DelibirdLink], *, style_nonce:
'inactive_count': inactive_count,
'now': now,
'style_nonce': style_nonce,
'script_nonce': script_nonce
'script_nonce': script_nonce,
"STATIC_FOOTER": STATIC_FOOTER if STATIC_FOOTER else None
})

@classmethod
Expand Down
3 changes: 3 additions & 0 deletions lambda/admin_portal/static/links.html
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ <h5 class="modal-title" id="editLinkModalLabel">
<small>&copy; 2025 Kazuhiro Oka</small>
</footer>
</div>
{%- if (STATIC_FOOTER is defined) and (STATIC_FOOTER is not none) %}
<div class="env-info"><p>{{STATIC_FOOTER}}</p></div>
{%- endif %}

<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
Expand Down
4 changes: 2 additions & 2 deletions lambda/layers/common/python/util/response_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

_IS_DEV = (os.environ.get("DELIBIRD_ENV") == "dev")
_COMMIT_HASH = str(get_env_var("COMMIT_HASH", "")) if _IS_DEV else ""
_STATIC_FOOTER: Optional[str] = html.escape(get_env_var("STATIC_FOOTER", ""))
STATIC_FOOTER: Optional[str] = html.escape(get_env_var("STATIC_FOOTER", ""))


def _load_error_html(status: HTTPStatus) -> tuple[Optional[str], bool]:
Expand All @@ -19,7 +19,7 @@ def _load_error_html(status: HTTPStatus) -> tuple[Optional[str], bool]:
# 該当するステータスコードのHTMLを探す
html_content = load_static_html(
f"error/{status.value}.html",
{"STATIC_FOOTER": _STATIC_FOOTER} if _STATIC_FOOTER else None
{"STATIC_FOOTER": STATIC_FOOTER} if STATIC_FOOTER else None
)
return html_content, html_content is not None

Expand Down
5 changes: 3 additions & 2 deletions lambda/redirect_request/protected_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from models.delibird_nonce import DelibirdNonceTableModel
from util.date_util import get_jst_datetime_now
from util.nonce_util import create_nonce
from util.response_util import success_response
from util.response_util import success_response, STATIC_FOOTER
from util.static_resource_util import load_function_html

NONCE_QUERY_KEY = "n"
Expand All @@ -24,7 +24,8 @@ def protected_response(domain: str, slug: str, error_message: str = ""):
"challenge_query_key": CHALLENGE_QUERY_KEY,
"nonce_query_key": NONCE_QUERY_KEY,
"script_nonce": script_nonce,
"request_nonce": request_nonce
"request_nonce": request_nonce,
"STATIC_FOOTER": STATIC_FOOTER if STATIC_FOOTER else None
})

return success_response(HTTPStatus.UNAUTHORIZED, html_content,
Expand Down
4 changes: 3 additions & 1 deletion lambda/redirect_request/static/protected.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ <h1 class="error-code"><i class="bi bi-lock"></i></h1>
<p>&copy; 2025 Kazuhiro Oka</p>
</footer>
</div>

{%- if (STATIC_FOOTER is defined) and (STATIC_FOOTER is not none) %}
<div class="env-info"><p>{{STATIC_FOOTER}}</p></div>
{%- endif %}

<script {%- if script_nonce %} nonce="{{ script_nonce }}" {%- endif %}>
document.addEventListener('DOMContentLoaded', function () {
Expand Down
14 changes: 14 additions & 0 deletions s3/css/admin-portal.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@
background-color: #0d6efd;
}

.env-info {
position: fixed;
bottom: 0.5rem;
right: 0.5rem;
padding: 0;
}

.env-info p {
margin: 0;
font-size: 0.65rem;
font-family: 'Monaco', 'Courier New', monospace;
color: rgba(165, 165, 165, 0.90);
}

.status-badge {
min-width: 60px;
}
Expand Down