Move GitHub token server-side, add privacy note, fix LinkedIn icon

Adds a small server/ proxy so the GitHub token never reaches the
browser (server holds it, client calls /api/contributions), with
rate limiting and response caching. Adds a collapsible UK GDPR
privacy note to the Contact footer. Strips the background badge
from the LinkedIn icon so it matches GitHub's bare-silhouette style.
Removes em dashes and tightens some project copy. Increases the
light-mode contrast between the 0 and 1 commit levels in the
contribution graph.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
bobbertandClaude Sonnet 5 committed 2026-09-27 17:43:50 +01:00
1 parent 655e2cd32c
commit 7d1d2feccb
13 files changed
+1229 -118

No files matched your search

+37 -2
View File
@@ -1,3 +1,4 @@
import { useState } from "react";
import { profile } from "../content.js";
// Monochrome platform glyphs, same pattern as skill-icons.js (simple-icons MIT / lucide ISC).
@@ -15,7 +16,7 @@ const contactIcons = {
linkedin: {
vb: "0 0 24 24",
inner:
'<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.048c.477-.9 1.637-1.85 3.378-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.04 9.429C3.89 9.429 2.967 8.511 2.967 7.365c0-1.154.926-2.074 2.073-2.074 1.146 0 2.074.92 2.074 2.074 0 1.146-.922 2.068-2.075 2.073zm.004 11.02h-3.44V9h3.44v11.45zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/>',
'<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.048c.477-.9 1.637-1.85 3.378-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.04 9.429C3.89 9.429 2.967 8.511 2.967 7.365c0-1.154.926-2.074 2.073-2.074 1.146 0 2.074.92 2.074 2.074 0 1.146-.922 2.068-2.075 2.073zm.004 11.02h-3.44V9h3.44v11.45z"/>',
},
};
@@ -31,6 +32,37 @@ function ContactGlyph({ name }) {
/>
);
}
function PrivacyNote() {
const [open, setOpen] = useState(false);
return (
<div className="privacy-note">
<button
type="button"
className="privacy-toggle"
aria-expanded={open}
aria-controls="privacy-panel"
onClick={() => setOpen((o) => !o)}
>
Privacy
</button>
{open && (
<div id="privacy-panel" className="privacy-panel">
<p>
<strong>{profile.name}</strong> ({profile.email}) is the data controller for this
site. No cookies, analytics, or third-party trackers are used, and nothing you do here
is logged or stored on a server. Your light/dark theme choice is saved in your
browser's local storage only and is never transmitted anywhere. The Contributions
graph above is fetched by this site's own server, not your browser, so GitHub never
sees you as a visitor. If you email me, I'll only use your details to reply. Under UK
GDPR you can request access to or deletion of any data held about you by emailing{" "}
{profile.email}.
</p>
</div>
)}
</div>
);
}
export default function Contact() {
const year = new Date().getFullYear();
return (
@@ -60,7 +92,10 @@ export default function Contact() {
<span>
{profile.name} · {profile.location}
</span>
<span>{year}</span>
<span className="footer-bar-right">
<PrivacyNote />
<span>{year}</span>
</span>
</div>
</footer>
);
+15 -93
View File
@@ -2,7 +2,6 @@ import { useEffect, useState } from "react";
const WEEKS = 53; // trailing year, same span as GitHub's default graph
const MAX_LEVEL = 4;
const TOKEN = import.meta.env.VITE_GITHUB_TOKEN || "";
function addDays(d, n) {
const x = new Date(d);
@@ -40,89 +39,18 @@ function levelMap(counts) {
return levels;
}
async function fetchContributions(fromIso, toIso) {
async function run(from) {
const res = await fetch("https://api.github.com/graphql", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
query: `{
viewer {
contributionsCollection(from: "${from}T00:00:00Z") {
totalCommitContributions
totalPullRequestContributions
totalIssueContributions
totalPullRequestReviewContributions
contributionCalendar {
weeks {
contributionDays {
date
contributionCount
}
}
}
}
}
}`,
}),
});
const json = await res.json();
if (!res.ok || json.errors) {
throw new Error(json.errors?.[0]?.message || `GraphQL ${res.status}`);
}
return json.data.viewer.contributionsCollection;
// Fetched from our own server (server/index.js), which holds the GitHub
// token and calls the GitHub API itself, so the token never reaches the browser.
async function fetchContributions() {
const res = await fetch("/api/contributions");
if (res.status === 501) {
const err = new Error("not_configured");
err.code = "not_configured";
throw err;
}
// GitHub caps contributionCalendar at 366 days from `from`, but the 53-week
// grid spans up to 371 days (Tue-Sat). Fetch the truncated tail separately.
const counts = new Map();
let maxDay = null;
function absorb(cc) {
for (const week of cc.contributionCalendar.weeks) {
for (const day of week.contributionDays) {
if (!maxDay || day.date > maxDay) maxDay = day.date;
if (day.contributionCount > 0) counts.set(day.date, day.contributionCount);
}
}
}
let cc = await run(fromIso);
absorb(cc);
let commits = cc.totalCommitContributions;
let prs = cc.totalPullRequestContributions;
let issues = cc.totalIssueContributions;
let reviews = cc.totalPullRequestReviewContributions;
if (maxDay < toIso) {
const [y, m, d] = maxDay.split("-").map(Number);
const tailFrom = dayKey(addDays(new Date(y, m - 1, d), 1));
const tail = await run(tailFrom);
absorb(tail);
commits += tail.totalCommitContributions;
prs += tail.totalPullRequestContributions;
issues += tail.totalIssueContributions;
reviews += tail.totalPullRequestReviewContributions;
}
let last = null;
for (const day of counts.keys()) if (!last || day > last) last = day;
// Calendar sum matches GitHub's profile number (includes private contributions).
let calendarSum = 0;
for (const n of counts.values()) calendarSum += n;
return {
counts,
total: calendarSum,
commits,
prs,
issues,
reviews,
last,
};
if (!res.ok) throw new Error(`proxy ${res.status}`);
const json = await res.json();
return { ...json, counts: new Map(Object.entries(json.counts)) };
}
export default function PushTracker() {
@@ -130,22 +58,16 @@ export default function PushTracker() {
const [data, setData] = useState(null);
useEffect(() => {
if (!TOKEN) {
setStatus("note");
return;
}
let cancelled = false;
(async () => {
try {
const today = new Date();
const thisSunday = addDays(today, -today.getDay());
const gridStart = addDays(thisSunday, -(WEEKS - 1) * 7);
const result = await fetchContributions(dayKey(gridStart), dayKey(today));
const result = await fetchContributions();
if (cancelled) return;
setData(result);
setStatus("ready");
} catch {
if (!cancelled) setStatus("error");
} catch (e) {
if (cancelled) return;
setStatus(e.code === "not_configured" ? "note" : "error");
}
})();
return () => {
+7 -7
View File
@@ -122,7 +122,7 @@ export const projects = [
"A cross-platform React Native app that aggregates media from device storage, Google Photos, and a home NAS into one timeline view, backed by a RESTful Express.js backend.",
image: "/images/projects/mass.svg",
detail:
"Built as my final-year project, MASS pulls media from three sources — device storage, Google Photos, and a Synology NAS on the home network — and merges them into one chronological timeline. The Express backend sits between the app and each source, normalising metadata so sorting by date, type, or location stays consistent regardless of where the file lives. Most of my engineering time went into the caching layer: repeated timeline fetches hit the cache instead of re-querying all three sources, which is where the 30% latency reduction came from.",
"Built as my final-year project, MASS pulls media from three sources: device storage, Google Photos, and a Synology NAS on the home network, and merges them into one chronological timeline. The Express backend sits between the app and each source, normalising metadata so sorting by date, type, or location stays consistent regardless of where the file lives. Most of my engineering time went into the caching layer: repeated timeline fetches hit the cache instead of re-querying all three sources, which is where the 30% latency reduction came from.",
features: [
"Reduced data retrieval latency 30% through optimized API caching",
"Metadata-driven sorting across diverse media types",
@@ -140,7 +140,7 @@ export const projects = [
"A 240 GHz radio-frequency setup that uses the Doppler effect to track three moving targets, with an Arduino ESP32 board processing the sensor data and serving live results as a website.",
image: "/images/projects/radar.svg",
detail:
"A hardware build around a 240 GHz Doppler radar module and an ESP32. The board samples the RF signal, extracts velocity from the Doppler shift, and keeps track of up to three targets at once. Results stream over Wi-Fi to a small web dashboard I wrote so I could watch the tracking live — half project, half excuse to get comfortable with raw sensor data.",
"A hardware build around a 240 GHz Doppler radar module and an ESP32. The board samples the RF signal, extracts velocity from the Doppler shift, and keeps track of up to three targets at once. Results stream over Wi-Fi to a small web dashboard I wrote so I could watch the tracking live. Half project, half excuse to get comfortable with raw sensor data.",
features: [
"240 GHz RF sensing exploiting the Doppler shift for motion tracking",
"Tracks three moving targets simultaneously",
@@ -174,7 +174,7 @@ export const projects = [
"A full CRUD(L) application built to learn React Native properly: create, read, update, delete, and list flows across screens.",
image: "/images/projects/crudl.svg",
detail:
"A deliberately small React Native app that exists because I wanted to actually understand the framework before building anything big on it. It walks through the full create-read-update-delete-list cycle with separate screens for list, detail, and edit — and the navigation between them is where most of my learning happened.",
"A deliberately small React Native app that exists because I wanted to actually understand the framework before building anything big on it. It walks through the full create-read-update-delete-list cycle with separate screens for list, detail, and edit. The navigation between them is where most of my learning happened.",
features: [
"Complete CRUD(L) flows across multiple screens",
"Navigation between list, detail, and edit views",
@@ -191,7 +191,7 @@ export const projects = [
"A native Android habit tracker built in Kotlin with MVVM architecture and Room Database for offline-first persistence, plus notification-driven reminders and progress visualization.",
image: "/images/projects/routines.svg",
detail:
"A habit tracker I built for myself in native Android. Kotlin with MVVM, Room for offline-first persistence, and system notifications that nudge at set times. The progress view plots completion trends so a broken streak is obvious at a glance — it's the project where I got serious about architecture rather than just making screens work.",
"A habit tracker I built for myself in native Android. Kotlin with MVVM, Room for offline-first persistence, and system notifications that nudge at set times. The progress view plots completion trends so a broken streak is obvious at a glance. It's the project where I got serious about architecture rather than just making screens work.",
features: [
"MVVM architecture with a dedicated ViewModel layer",
"Room database for offline-first local persistence",
@@ -208,7 +208,7 @@ export const projects = [
"A GPS and proximity-driven React Native game where players claim hidden caches based on physical location and device orientation, backed by a RESTful API.",
image: "/images/projects/geo-hunt.svg",
detail:
"The mobile-development coursework project: a game where hidden caches are claimed by being physically near them, with the device's compass giving bearing and distance to guide you in. The UI re-renders as you move so the map feels live rather than polled. The backend was the graded piece — I pushed it to 90% unit-test coverage before submission.",
"The mobile-development coursework project: a game where hidden caches are claimed by being physically near them, with the device's compass giving bearing and distance to guide you in. The UI re-renders as you move so the map feels live rather than polled. The backend was the graded piece, and I pushed it to 90% unit-test coverage before submission.",
features: [
"Geolocation and compass APIs for real-time bearing and distance",
"Responsive UI that updates dynamically as the player moves",
@@ -242,7 +242,7 @@ export const projects = [
"A desktop CV builder written in Java with a Swing interface: form-driven editing that generates a clean, printable CV.",
image: "/images/projects/cv-builder.svg",
detail:
"An early desktop project in Java and Swing — form-driven editing of CV sections with a live preview and printable output. Built long before I had any web experience, and still the reason I understand why most people prefer not building UIs in Swing.",
"An early desktop project in Java and Swing: form-driven editing of CV sections with a live preview and printable output. Built long before I had any web experience, and still the reason I understand why most people prefer not building UIs in Swing.",
features: [
"Form-driven editing of CV sections",
"Live preview before export",
@@ -381,7 +381,7 @@ export const localAI = {
// Self-assessed working proficiency, not a byte share: weighted by how many
// projects were built in each language and current fluency, not raw lines.
// Java leads; C++/Go mid-band; Python eased down (fewer recent projects);
// JS/CSS raised on project count; TypeScript low — known via JavaScript only.
// JS/CSS raised on project count; TypeScript low, known via JavaScript only.
export const languageStats = [
{ name: "Java", pct: 56 },
{ name: "JavaScript", pct: 48 },
+49 -3
View File
@@ -20,7 +20,7 @@
}
:root {
/* light theme (default) — Anthropic cream / orange */
/* light theme (default): Anthropic cream / orange */
--bg: #f5f2ea;
--bg-alt: #ece7da;
--surface: #fbfaf6;
@@ -40,8 +40,8 @@
--panel-muted: #a39b8a;
/* contribution cells (light) */
--pt-empty: #eae4d5;
--pt-l1: #ecd9c4;
--pt-l2: #dfb28f;
--pt-l1: #f0c69a;
--pt-l2: #e2a066;
--pt-l3: #d97757;
--pt-l4: #a84e31;
@@ -1213,6 +1213,52 @@ a {
color: var(--panel-muted);
}
.footer-bar-right {
display: flex;
align-items: center;
gap: 16px;
}
.privacy-note {
position: relative;
}
.privacy-toggle {
background: none;
border: none;
padding: 0;
font: inherit;
font-size: 13px;
color: var(--panel-muted);
text-decoration: underline;
text-underline-offset: 3px;
cursor: pointer;
}
.privacy-toggle:hover {
color: var(--panel-ink);
}
.privacy-panel {
position: absolute;
bottom: calc(100% + 12px);
right: 0;
width: min(340px, 80vw);
padding: 16px 18px;
border-radius: var(--radius);
border: 1px solid color-mix(in srgb, var(--panel-ink) 14%, transparent);
background: var(--bg);
color: var(--ink-soft);
font-size: 12.5px;
line-height: 1.55;
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
z-index: 20;
}
.privacy-panel strong {
color: var(--ink);
}
/* ---------- custom cursor ---------- */
.cursor-dot {