Skip to content

feat: publish Mac Pulse live GitHub app - #37

Merged
xudaniel merged 1 commit into
mainfrom
codex/github-pages-live-app
Aug 22, 2026
Merged

feat: publish Mac Pulse live GitHub app#37
xudaniel merged 1 commit into
mainfrom
codex/github-pages-live-app

Conversation

@xudaniel

Copy link
Copy Markdown
Owner

Summary

  • publish a bilingual, mobile-first Mac Pulse application through GitHub Pages
  • default to a conspicuously labelled synthetic demo while allowing an operator to connect a private Mac Pulse API
  • keep view and optional hosting credentials in per-tab sessionStorage, never in Git, URLs, cookies, analytics, or persistent browser storage
  • add exact-origin, read-only CORS support for status and history while keeping cross-origin mutation blocked
  • add an installable PWA shell, offline static assets, pinned Pages deployment actions, security documentation, and English/Chinese product documentation

Verification

  • Pages application tests: 5 passed
  • dashboard build and tests: 18 passed
  • dashboard lint: passed
  • reliability suite: passed
  • heartbeat suite: passed
  • bilingual documentation suite: passed
  • dependency audit: 0 vulnerabilities
  • desktop and narrow-screen visual rendering: passed
  • local HTTP asset checks: HTML, CSS, JavaScript, and web manifest returned 200

Privacy boundary

The public page never publishes live Mac data by default. Connected mode requires the separate dashboard view token and a backend configured with PUBLIC_VIEWER_ORIGIN=https://xudaniel.github.io. The heartbeat ingest/signing key must never be entered into the viewer.

@xudaniel
xudaniel merged commit d8d09d4 into main Aug 22, 2026
10 checks passed
@xudaniel
xudaniel deleted the codex/github-pages-live-app branch August 22, 2026 05:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 594f116613

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pages/app.js
async function livePayload() {
const [status, history] = await Promise.all([
apiRequest("/api/status"),
apiRequest("/api/history?range=24h&limit=120"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Load enough samples for the 24-hour chart

At the standard 60-second heartbeat cadence, this request retrieves only the newest 120 samples—about two hours—and renderChart subsequently keeps only the newest 60, so the panel labelled “Last 24 hours” normally plots roughly one hour of data. Paginate through the full 24-hour range and downsample across that range rather than truncating its newest samples.

Useful? React with 👍 / 👎.

Comment thread pages/app.js
setText("hardware-state", batteryHealth === null ? tr("unavailable") : tr("healthValue", { value: number(batteryHealth, 1) }));
setText("hardware-detail", tr("hardwareDetail", { cycles: number(latest.batteryCycleCount), thermal: latest.thermalState || tr("unknown") }));

const speedAvailable = Number.isFinite(Number(latest.internetDownloadMbps));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat null speed measurements as unavailable

When the opt-in internet-speed test is disabled, the status API returns internetDownloadMbps: null; Number(null) is 0 and is finite, so connected mode reports a 0 Mbps measurement as “Excellent” instead of unavailable. Check for null/undefined before numeric coercion, including the related upload and latency fields.

Useful? React with 👍 / 👎.

Comment thread pages/index.html

<section class="content-grid lower-grid">
<article class="panel diagnostics-panel">
<div class="panel-heading"><div><p class="eyebrow" data-i18n="faultIsolation">Fault isolation</p><h2 data-i18n="diagnostics">Network diagnostics</h2></div><span class="health-pill">5 / 5</span></div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Derive the diagnostics score from the live result

In connected mode this badge remains 5 / 5 even when one or more diagnostics are false or all five are unknown because diagnostics collection is disabled. Although the individual rows are updated, the headline therefore presents a contradictory healthy score; give the badge an update path and calculate it from the five returned diagnostic values.

Useful? React with 👍 / 👎.

Comment thread pages/app.js
Comment on lines +494 to +495
const payload = connection ? await livePayload() : demoPayload();
render(payload);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Discard responses from a disconnected session

If the user disconnects while a private status/history request is still in flight, disconnect() renders the demo immediately, but the older request can later reach this unconditional render(payload) and put private readings back on screen under the now-public-demo banner until the next refresh. Abort outstanding requests or associate each refresh with a connection generation and ignore results from obsolete sessions.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant