Skip to content

Serve tip of the week data locally - #149

Merged
adulau merged 1 commit into
newfrom
codex/fix-tip-of-the-week-functionality
Sep 29, 2026
Merged

adulau merged 1 commit into
newfrom
codex/fix-tip-of-the-week-functionality

Conversation

@adulau

@adulau adulau commented Sep 29, 2026

Copy link
Copy Markdown
Member

Motivation

  • The tip widget recently failed to load the upstream GitHub-hosted JSON feed, leaving the UI stuck on "Loading a tip…" and relying on a cross-origin resource that can be blocked.
  • Providing a same-origin feed ensures the widget can always load tips even when external requests to the GitHub raw endpoint are blocked or rate-limited.

Description

  • Add a local JSON feed at static/data/misp-tip-of-the-week.json containing ten example community tips for the widget to consume.
  • Modify the Hugo partial layouts/partials/tip-of-the-week.html to pass the resolved feed URL into the deferred script via a data-tips-url attribute.
  • Update static/js/tip-of-the-week.js to read the feed URL from the script dataset and to fall back to the root-relative path /data/misp-tip-of-the-week.json when no URL is provided.

Testing

  • Run python3 -m json.tool static/data/misp-tip-of-the-week.json to validate the JSON and it succeeded.
  • Run node --check static/js/tip-of-the-week.js to validate JS syntax and it succeeded.
  • Execute a Node-based DOM/fetch smoke test that simulates document.currentScript, intercepts fetch, and confirms the local feed is requested and a tip is rendered; the test succeeded.
  • Run git diff --check (style/whitespace checks) which passed; a full Hugo site build with hugo --minify --destination /tmp/misp-site could not be performed because hugo is not installed in the environment.

Codex Task

@adulau
adulau merged commit b0d7535 into new Sep 29, 2026
1 check passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T13:19:54.132858Z 0b925e9 PR opened
🔒 Security Review ✅ Completed 2026-09-29T13:20:51.722539Z 0b925e9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant