Commit 0c4ac37ece
Unsigned
Layout: unified · split
lib/generate-changelog.py +119 −33
| @@ -10,6 +10,7 @@ import re | ||
| 10 | 10 | import subprocess |
| 11 | 11 | import sys |
| 12 | 12 | import time |
| 13 | from typing import Any | |
| 13 | 14 | |
| 14 | 15 | import requests |
| 15 | 16 | |
| @@ -79,7 +80,7 @@ def extract_pr_from_message(message): | ||
| 79 | 80 | return None |
| 80 | 81 | |
| 81 | 82 | |
| 82 | def _compact(d): | |
| 83 | def _compact(d: Any) -> Any: | |
| 83 | 84 | """Recursively remove empty lists, empty dicts, and None values.""" |
| 84 | 85 | if isinstance(d, dict): |
| 85 | 86 | return {k: _compact(v) for k, v in d.items() if v is not None and v != [] and v != {}} |
| @@ -100,20 +101,90 @@ def diff_commits(newer_sha, older_sha): | ||
| 100 | 101 | sec_added, sec_removed, _ = diff_index(build_index(base_data, 2), build_index(head_data, 2)) |
| 101 | 102 | cat_added, cat_removed, _ = diff_index(build_index(base_data, 1), build_index(head_data, 1)) |
| 102 | 103 | |
| 103 | if not any([svc_added, svc_removed, svc_modified, | |
| 104 | sec_added, sec_removed, cat_added, cat_removed]): | |
| 104 | # Cross-match services by name across added/removed → moved (e.g. section rename) | |
| 105 | add_by_name, rem_by_name = {}, {} | |
| 106 | for k in svc_added: | |
| 107 | add_by_name.setdefault(k[2], []).append(k) | |
| 108 | for k in svc_removed: | |
| 109 | rem_by_name.setdefault(k[2], []).append(k) | |
| 110 | svc_moved, matched = [], set() | |
| 111 | for name in sorted(add_by_name.keys() & rem_by_name.keys()): | |
| 112 | if len(add_by_name[name]) == 1 == len(rem_by_name[name]): | |
| 113 | r, a = rem_by_name[name][0], add_by_name[name][0] | |
| 114 | svc_moved.append({"name": name, | |
| 115 | "from": {"category": r[0], "section": r[1]}, | |
| 116 | "to": {"category": a[0], "section": a[1]}}) | |
| 117 | matched |= {a, r} | |
| 118 | svc_added = [k for k in svc_added if k not in matched] | |
| 119 | svc_removed = [k for k in svc_removed if k not in matched] | |
| 120 | ||
| 121 | # Cross-match remaining services by url → renamed (same service, new name). | |
| 122 | add_by_url, rem_by_url = {}, {} | |
| 123 | for k in svc_added: | |
| 124 | u = (head_svc[k].get("url") or "").strip() | |
| 125 | if u: | |
| 126 | add_by_url.setdefault(u, []).append(k) | |
| 127 | for k in svc_removed: | |
| 128 | u = (base_svc[k].get("url") or "").strip() | |
| 129 | if u: | |
| 130 | rem_by_url.setdefault(u, []).append(k) | |
| 131 | svc_renamed, matched_rn = [], set() | |
| 132 | def mk_rn(r, a): | |
| 133 | return {"previousName": r[2], "name": a[2], | |
| 134 | "from": {"category": r[0], "section": r[1]}, | |
| 135 | "to": {"category": a[0], "section": a[1]}} | |
| 136 | for url in sorted(add_by_url.keys() & rem_by_url.keys()): | |
| 137 | a_keys, r_keys = list(add_by_url[url]), list(rem_by_url[url]) | |
| 138 | a_loc = {(k[0], k[1]): k for k in a_keys} | |
| 139 | r_loc = {(k[0], k[1]): k for k in r_keys} | |
| 140 | for loc in sorted(a_loc.keys() & r_loc.keys()): | |
| 141 | a, r = a_loc[loc], r_loc[loc] | |
| 142 | svc_renamed.append(mk_rn(r, a)) | |
| 143 | matched_rn |= {a, r} | |
| 144 | a_keys.remove(a) | |
| 145 | r_keys.remove(r) | |
| 146 | if len(a_keys) == 1 == len(r_keys): | |
| 147 | svc_renamed.append(mk_rn(r_keys[0], a_keys[0])) | |
| 148 | matched_rn |= {a_keys[0], r_keys[0]} | |
| 149 | svc_added = [k for k in svc_added if k not in matched_rn] | |
| 150 | svc_removed = [k for k in svc_removed if k not in matched_rn] | |
| 151 | ||
| 152 | # Detect section renames: a removed section whose services all moved to one added section | |
| 153 | moves_from = {} | |
| 154 | for m in svc_moved + svc_renamed: | |
| 155 | src = (m["from"]["category"], m["from"]["section"]) | |
| 156 | moves_from.setdefault(src, []).append((m["to"]["category"], m["to"]["section"])) | |
| 157 | sec_added_set, sec_moved, matched_sec = set(sec_added), [], set() | |
| 158 | for r in sec_removed: | |
| 159 | dests = moves_from.get(r, []) | |
| 160 | base_count = sum(1 for k in base_svc if k[0] == r[0] and k[1] == r[1]) | |
| 161 | if (dests and len(set(dests)) == 1 | |
| 162 | and len(dests) == base_count | |
| 163 | and dests[0] in sec_added_set): | |
| 164 | sec_moved.append({"from": {"category": r[0], "section": r[1]}, | |
| 165 | "to": {"category": dests[0][0], "section": dests[0][1]}}) | |
| 166 | matched_sec |= {r, dests[0]} | |
| 167 | sec_added = [k for k in sec_added if k not in matched_sec] | |
| 168 | sec_removed = [k for k in sec_removed if k not in matched_sec] | |
| 169 | ||
| 170 | if not any([svc_added, svc_removed, svc_modified, svc_moved, svc_renamed, | |
| 171 | sec_added, sec_removed, sec_moved, cat_added, cat_removed]): | |
| 105 | 172 | return None |
| 106 | 173 | |
| 107 | svc = lambda k: {"name": k[2], "category": k[0], "section": k[1]} | |
| 174 | def svc(k): | |
| 175 | return {"name": k[2], "category": k[0], "section": k[1]} | |
| 108 | 176 | return _compact({ |
| 109 | 177 | "services": { |
| 110 | 178 | "added": [svc(k) for k in svc_added], |
| 111 | 179 | "removed": [svc(k) for k in svc_removed], |
| 112 | 180 | "modified": [{**svc(k), "fields": fields} for k, fields in svc_modified], |
| 181 | "moved": svc_moved, | |
| 182 | "renamed": svc_renamed, | |
| 113 | 183 | }, |
| 114 | 184 | "sections": { |
| 115 | 185 | "added": [{"name": k[1], "category": k[0]} for k in sec_added], |
| 116 | 186 | "removed": [{"name": k[1], "category": k[0]} for k in sec_removed], |
| 187 | "moved": sec_moved, | |
| 117 | 188 | }, |
| 118 | 189 | "categories": { |
| 119 | 190 | "added": list(cat_added), |
| @@ -159,9 +230,15 @@ def fetch_pr_metadata(pr_numbers): | ||
| 159 | 230 | return metadata |
| 160 | 231 | |
| 161 | 232 | |
| 162 | def fetch_rejections(headers): | |
| 163 | """Fetch closed-without-merge PRs that touched awesome-privacy.yml (since 2026).""" | |
| 164 | rejections = [] | |
| 233 | def fetch_rejections(headers, cached_rejections, checked_prs): | |
| 234 | """Fetch closed-without-merge PRs that touched awesome-privacy.yml (since 2026). | |
| 235 | ||
| 236 | Reuses cached classifications: any PR number in `checked_prs` skips the /files | |
| 237 | call. On any API failure, returns the cached state unchanged (never wipes). | |
| 238 | Returns (rejections, updated checked_prs). | |
| 239 | """ | |
| 240 | cached_by_num = {r["pr"]["number"]: r for r in cached_rejections} | |
| 241 | rejections, checked, reused, new_calls = [], set(checked_prs), 0, 0 | |
| 165 | 242 | page = 1 |
| 166 | 243 | while True: |
| 167 | 244 | try: |
| @@ -171,28 +248,28 @@ def fetch_rejections(headers): | ||
| 171 | 248 | params={"state": "closed", "sort": "created", "direction": "desc", |
| 172 | 249 | "per_page": 100, "page": page}, |
| 173 | 250 | ) |
| 174 | if resp.status_code == 403: | |
| 175 | print(" Rate limited fetching rejections, stopping", file=sys.stderr) | |
| 176 | break | |
| 177 | 251 | if resp.status_code != 200: |
| 178 | print(f" Rejections page {page}: HTTP {resp.status_code}", file=sys.stderr) | |
| 179 | break | |
| 252 | print(f" Rejections page {page}: HTTP {resp.status_code} — keeping cache", | |
| 253 | file=sys.stderr) | |
| 254 | return cached_rejections, checked_prs | |
| 180 | 255 | prs = resp.json() |
| 181 | 256 | if not prs: |
| 182 | 257 | break |
| 183 | 258 | |
| 184 | 259 | for pr in prs: |
| 185 | # Stop if we've gone before Jan 2026 | |
| 186 | created = pr.get("created_at", "") | |
| 187 | if created < REJECTIONS_SINCE: | |
| 188 | return rejections | |
| 189 | ||
| 190 | # Skip merged PRs | |
| 260 | if pr.get("created_at", "") < REJECTIONS_SINCE: | |
| 261 | print(f" Reused {reused} cached, checked {new_calls} new PR(s)") | |
| 262 | return rejections, checked | |
| 191 | 263 | if pr.get("merged_at"): |
| 192 | 264 | continue |
| 193 | 265 | |
| 194 | # Only include PRs that touched awesome-privacy.yml (check via files endpoint) | |
| 195 | 266 | pr_num = pr["number"] |
| 267 | if pr_num in checked: | |
| 268 | if pr_num in cached_by_num: | |
| 269 | rejections.append(cached_by_num[pr_num]) | |
| 270 | reused += 1 | |
| 271 | continue | |
| 272 | ||
| 196 | 273 | files_resp = requests.get( |
| 197 | 274 | f"https://api.github.com/repos/{REPO}/pulls/{pr_num}/files", |
| 198 | 275 | headers=headers, timeout=10, |
| @@ -200,14 +277,16 @@ def fetch_rejections(headers): | ||
| 200 | 277 | ) |
| 201 | 278 | if files_resp.status_code != 200: |
| 202 | 279 | continue |
| 203 | filenames = [f.get("filename", "") for f in files_resp.json()] | |
| 204 | if "awesome-privacy.yml" not in filenames: | |
| 280 | checked.add(pr_num) | |
| 281 | new_calls += 1 | |
| 282 | if "awesome-privacy.yml" not in [ | |
| 283 | f.get("filename", "") for f in files_resp.json() | |
| 284 | ]: | |
| 205 | 285 | continue |
| 206 | 286 | |
| 207 | closed_at = pr.get("closed_at", "")[:10] | |
| 208 | 287 | user = pr.get("user", {}) |
| 209 | 288 | rejections.append({ |
| 210 | "date": closed_at, | |
| 289 | "date": pr.get("closed_at", "")[:10], | |
| 211 | 290 | "title": pr.get("title", ""), |
| 212 | 291 | "pr": { |
| 213 | 292 | "number": pr_num, |
| @@ -221,31 +300,35 @@ def fetch_rejections(headers): | ||
| 221 | 300 | page += 1 |
| 222 | 301 | time.sleep(0.1) |
| 223 | 302 | except requests.RequestException as e: |
| 224 | print(f" Rejections: {e}", file=sys.stderr) | |
| 225 | break | |
| 303 | print(f" Rejections: {e} — keeping cache", file=sys.stderr) | |
| 304 | return cached_rejections, checked_prs | |
| 226 | 305 | |
| 227 | return rejections | |
| 306 | print(f" Reused {reused} cached, checked {new_calls} new PR(s)") | |
| 307 | return rejections, checked | |
| 228 | 308 | |
| 229 | 309 | |
| 230 | 310 | def load_existing(): |
| 231 | """Load existing changelog.json. Returns (entries, processed_shas).""" | |
| 311 | """Load existing changelog.json. Returns (entries, processed_shas, rejections, checked_prs).""" | |
| 232 | 312 | if not os.path.exists(OUTPUT_PATH): |
| 233 | return [], set() | |
| 313 | return [], set(), [], set() | |
| 234 | 314 | try: |
| 235 | 315 | with open(OUTPUT_PATH) as f: |
| 236 | 316 | data = json.load(f) |
| 237 | 317 | entries = data.get("entries", []) |
| 238 | 318 | processed = set(data.get("processedShas", [])) |
| 239 | 319 | processed.update(e["sha"] for e in entries) |
| 240 | return entries, processed | |
| 320 | rejections = data.get("rejections", []) | |
| 321 | checked_prs = set(data.get("checkedRejectionPrs", [])) | |
| 322 | checked_prs.update(r["pr"]["number"] for r in rejections) | |
| 323 | return entries, processed, rejections, checked_prs | |
| 241 | 324 | except (json.JSONDecodeError, KeyError, TypeError): |
| 242 | return [], set() | |
| 325 | return [], set(), [], set() | |
| 243 | 326 | |
| 244 | 327 | |
| 245 | 328 | def main(): |
| 246 | 329 | print("Generating changelog from git history...") |
| 247 | 330 | |
| 248 | existing_entries, processed_shas = load_existing() | |
| 331 | existing_entries, processed_shas, existing_rejections, checked_prs = load_existing() | |
| 249 | 332 | commits = get_commits() |
| 250 | 333 | |
| 251 | 334 | # Trim to commits at or after FIRST_COMMIT (newest-first order) |
| @@ -282,7 +365,9 @@ def main(): | ||
| 282 | 365 | continue |
| 283 | 366 | |
| 284 | 367 | sv = changes.get("services", {}) |
| 285 | counts = f"+{len(sv.get('added', []))} -{len(sv.get('removed', []))} ~{len(sv.get('modified', []))}" | |
| 368 | counts = (f"+{len(sv.get('added', []))} -{len(sv.get('removed', []))} " | |
| 369 | f"~{len(sv.get('modified', []))} »{len(sv.get('moved', []))} " | |
| 370 | f"≈{len(sv.get('renamed', []))}") | |
| 286 | 371 | print(f" [{i}/{len(new_commits)}] {c['date'][:10]} {counts} {c['message'][:60]}", flush=True) |
| 287 | 372 | |
| 288 | 373 | pr = extract_pr_from_message(c["message"]) |
| @@ -314,7 +399,7 @@ def main(): | ||
| 314 | 399 | if token: |
| 315 | 400 | api_headers["Authorization"] = f"token {token}" |
| 316 | 401 | print("Fetching rejected PRs...") |
| 317 | rejections = fetch_rejections(api_headers) | |
| 402 | rejections, checked_prs = fetch_rejections(api_headers, existing_rejections, checked_prs) | |
| 318 | 403 | print(f" Found {len(rejections)} rejection(s)") |
| 319 | 404 | |
| 320 | 405 | os.makedirs(os.path.dirname(OUTPUT_PATH), exist_ok=True) |
| @@ -322,6 +407,7 @@ def main(): | ||
| 322 | 407 | json.dump({ |
| 323 | 408 | "generatedAt": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), |
| 324 | 409 | "processedShas": sorted(processed_shas | new_processed), |
| 410 | "checkedRejectionPrs": sorted(checked_prs), | |
| 325 | 411 | "entries": all_entries, |
| 326 | 412 | "rejections": rejections, |
| 327 | 413 | }, f, indent=2, ensure_ascii=False) |
web/src/components/things/ChangelogTimeline.svelte +68 −9
| @@ -53,11 +53,17 @@ | ||
| 53 | 53 | added: s?.added || [], |
| 54 | 54 | removed: s?.removed || [], |
| 55 | 55 | modified: s?.modified || [], |
| 56 | moved: s?.moved || [], | |
| 57 | renamed: s?.renamed || [], | |
| 56 | 58 | }; |
| 57 | 59 | }; |
| 58 | 60 | const sec = (e: ChangelogEntry) => { |
| 59 | 61 | const s = e.changes?.sections; |
| 60 | return { added: s?.added || [], removed: s?.removed || [] }; | |
| 62 | return { | |
| 63 | added: s?.added || [], | |
| 64 | removed: s?.removed || [], | |
| 65 | moved: s?.moved || [], | |
| 66 | }; | |
| 61 | 67 | }; |
| 62 | 68 | const cat = (e: ChangelogEntry) => { |
| 63 | 69 | const c = e.changes?.categories; |
| @@ -79,7 +85,11 @@ | ||
| 79 | 85 | (s.removed.length > 0 || |
| 80 | 86 | sc.removed.length > 0 || |
| 81 | 87 | ct.removed.length > 0)) || |
| 82 | (f.modified && s.modified.length > 0) | |
| 88 | (f.modified && | |
| 89 | (s.modified.length > 0 || | |
| 90 | s.moved.length > 0 || | |
| 91 | s.renamed.length > 0 || | |
| 92 | sc.moved.length > 0)) | |
| 83 | 93 | ); |
| 84 | 94 | } |
| 85 | 95 | |
| @@ -92,10 +102,19 @@ | ||
| 92 | 102 | (item.pr.author?.toLowerCase().includes(q) ?? false) |
| 93 | 103 | ); |
| 94 | 104 | } |
| 105 | const s = svc(item.data); | |
| 95 | 106 | const all = [ |
| 96 | ...svc(item.data).added, | |
| 97 | ...svc(item.data).removed, | |
| 98 | ...svc(item.data).modified, | |
| 107 | ...s.added, | |
| 108 | ...s.removed, | |
| 109 | ...s.modified, | |
| 110 | ...s.moved.flatMap((m) => [ | |
| 111 | { name: m.name, category: m.from.category, section: m.from.section }, | |
| 112 | { name: m.name, category: m.to.category, section: m.to.section }, | |
| 113 | ]), | |
| 114 | ...s.renamed.flatMap((m) => [ | |
| 115 | { name: m.previousName, category: m.from.category, section: m.from.section }, | |
| 116 | { name: m.name, category: m.to.category, section: m.to.section }, | |
| 117 | ]), | |
| 99 | 118 | ]; |
| 100 | 119 | return ( |
| 101 | 120 | all.some( |
| @@ -116,8 +135,11 @@ | ||
| 116 | 135 | if (s.added.length) parts.push(pl(s.added.length, 'addition')); |
| 117 | 136 | if (s.removed.length) parts.push(pl(s.removed.length, 'removal')); |
| 118 | 137 | if (s.modified.length) parts.push(pl(s.modified.length, 'amendment')); |
| 138 | if (s.moved.length) parts.push(pl(s.moved.length, 'move')); | |
| 139 | if (s.renamed.length) parts.push(pl(s.renamed.length, 'rename')); | |
| 119 | 140 | if (sc.added.length) parts.push(pl(sc.added.length, 'new section')); |
| 120 | 141 | if (sc.removed.length) parts.push(pl(sc.removed.length, 'section removal')); |
| 142 | if (sc.moved.length) parts.push(pl(sc.moved.length, 'section rename')); | |
| 121 | 143 | return parts.join(', ') || 'Changes'; |
| 122 | 144 | } |
| 123 | 145 | |
| @@ -132,7 +154,7 @@ | ||
| 132 | 154 | cls: string; |
| 133 | 155 | name: string; |
| 134 | 156 | href: string; |
| 135 | path: string; | |
| 157 | path?: string; | |
| 136 | 158 | fields?: string[]; |
| 137 | 159 | }; |
| 138 | 160 | |
| @@ -163,6 +185,33 @@ | ||
| 163 | 185 | path: `in ${v.category} › ${v.section}`, |
| 164 | 186 | fields: v.fields, |
| 165 | 187 | })), |
| 188 | ...s.moved.map((v) => ({ | |
| 189 | badge: 'Moved', | |
| 190 | cls: 'mod', | |
| 191 | name: v.name, | |
| 192 | href: serviceLink( | |
| 193 | { name: v.name, category: v.to.category, section: v.to.section }, | |
| 194 | false, | |
| 195 | ), | |
| 196 | path: `from ${v.from.category} › ${v.from.section} → ${v.to.category} › ${v.to.section}`, | |
| 197 | })), | |
| 198 | ...s.renamed.map((v) => { | |
| 199 | const sameLoc = | |
| 200 | v.from.category === v.to.category && | |
| 201 | v.from.section === v.to.section; | |
| 202 | return { | |
| 203 | badge: 'Renamed', | |
| 204 | cls: 'mod', | |
| 205 | name: `${v.previousName} → ${v.name}`, | |
| 206 | href: serviceLink( | |
| 207 | { name: v.name, category: v.to.category, section: v.to.section }, | |
| 208 | false, | |
| 209 | ), | |
| 210 | path: sameLoc | |
| 211 | ? `in ${v.to.category} › ${v.to.section}` | |
| 212 | : `from ${v.from.category} › ${v.from.section} → ${v.to.category} › ${v.to.section}`, | |
| 213 | }; | |
| 214 | }), | |
| 166 | 215 | ...sc.added.map((v) => ({ |
| 167 | 216 | badge: 'New Section', |
| 168 | 217 | cls: 'add', |
| @@ -175,6 +224,16 @@ | ||
| 175 | 224 | name: v.name, |
| 176 | 225 | href: '', |
| 177 | 226 | })), |
| 227 | ...sc.moved.map((v) => ({ | |
| 228 | badge: 'Section Renamed', | |
| 229 | cls: 'mod', | |
| 230 | name: `${v.from.section} → ${v.to.section}`, | |
| 231 | href: `/${slugify(v.to.category)}/${slugify(v.to.section)}`, | |
| 232 | path: | |
| 233 | v.from.category === v.to.category | |
| 234 | ? `in ${v.to.category}` | |
| 235 | : `from ${v.from.category} to ${v.to.category}`, | |
| 236 | })), | |
| 178 | 237 | ...ct.added.map((v) => ({ |
| 179 | 238 | badge: 'New Category', |
| 180 | 239 | cls: 'add', |
| @@ -242,7 +301,7 @@ | ||
| 242 | 301 | <input |
| 243 | 302 | class="search" |
| 244 | 303 | type="text" |
| 245 | placeholder="Search..." | |
| 304 | placeholder="Filter by service, category, user.." | |
| 246 | 305 | bind:value={searchQuery} |
| 247 | 306 | /> |
| 248 | 307 | <div class="filters"> |
| @@ -473,7 +532,7 @@ | ||
| 473 | 532 | display: flex; |
| 474 | 533 | gap: var(--space-md); |
| 475 | 534 | padding: 0.6rem 0; |
| 476 | border-bottom: 1px solid rgba(255, 255, 255, 0.05); | |
| 535 | border-bottom: 1px solid var(--background-hr-color); | |
| 477 | 536 | &:last-child { |
| 478 | 537 | border-bottom: none; |
| 479 | 538 | } |
| @@ -512,7 +571,7 @@ | ||
| 512 | 571 | padding: 0 0.4rem; |
| 513 | 572 | border-radius: var(--curve-sm); |
| 514 | 573 | background: var(--accent-3); |
| 515 | color: var(--foreground); | |
| 574 | color: var(--bright); | |
| 516 | 575 | text-decoration: none; |
| 517 | 576 | font-family: var(--font-subtitle); |
| 518 | 577 | &:hover { |
web/src/components/things/DataActions.svelte +17 −3
| @@ -14,8 +14,10 @@ | ||
| 14 | 14 | export let serviceName: string; |
| 15 | 15 | export let history: Array<{ |
| 16 | 16 | date: string; |
| 17 | type: 'added' | 'removed' | 'modified'; | |
| 17 | type: 'added' | 'removed' | 'modified' | 'moved' | 'renamed'; | |
| 18 | 18 | fields?: string[]; |
| 19 | from?: { category: string; section: string }; | |
| 20 | previousName?: string; | |
| 19 | 21 | pr?: ChangelogPr | null; |
| 20 | 22 | }> = []; |
| 21 | 23 | |
| @@ -56,7 +58,11 @@ | ||
| 56 | 58 | ? 'Added' |
| 57 | 59 | : h.type === 'removed' |
| 58 | 60 | ? 'Removed' |
| 59 | : 'Amended'} | |
| 61 | : h.type === 'moved' | |
| 62 | ? 'Moved' | |
| 63 | : h.type === 'renamed' | |
| 64 | ? 'Renamed' | |
| 65 | : 'Amended'} | |
| 60 | 66 | </span> |
| 61 | 67 | <time |
| 62 | 68 | >{new Date(h.date + 'T00:00:00Z').toLocaleDateString('en-US', { |
| @@ -68,6 +74,12 @@ | ||
| 68 | 74 | > |
| 69 | 75 | {#if h.fields}<span class="history-fields">({h.fields.join(', ')})</span |
| 70 | 76 | >{/if} |
| 77 | {#if h.previousName}<span class="history-fields" | |
| 78 | >previously: {h.previousName}</span | |
| 79 | >{/if} | |
| 80 | {#if h.from}<span class="history-fields" | |
| 81 | >from {h.from.category} › {h.from.section}</span | |
| 82 | >{/if} | |
| 71 | 83 | {#if h.pr?.author} |
| 72 | 84 | <span class="history-author" |
| 73 | 85 | >by |
| @@ -214,7 +226,9 @@ | ||
| 214 | 226 | background: color-mix(in srgb, var(--changelog-rem) 33%, transparent); |
| 215 | 227 | color: var(--changelog-rem); |
| 216 | 228 | } |
| 217 | &.modified { | |
| 229 | &.modified, | |
| 230 | &.moved, | |
| 231 | &.renamed { | |
| 218 | 232 | background: color-mix(in srgb, var(--changelog-mod) 33%, transparent); |
| 219 | 233 | color: var(--changelog-mod); |
| 220 | 234 | } |
web/src/pages/[...listing].astro +19 −1
| @@ -156,10 +156,16 @@ const serviceHistory = await fetchChangelog().then(({ entries }) => { | ||
| 156 | 156 | c.name === name && |
| 157 | 157 | c.category === categoryName && |
| 158 | 158 | c.section === parentSection.name; |
| 159 | const isHere = (m: { name: string; to: { category: string; section: string } }) => | |
| 160 | m.name === name && | |
| 161 | m.to.category === categoryName && | |
| 162 | m.to.section === parentSection.name; | |
| 159 | 163 | const results: Array<{ |
| 160 | 164 | date: string; |
| 161 | type: 'added' | 'removed' | 'modified'; | |
| 165 | type: 'added' | 'removed' | 'modified' | 'moved' | 'renamed'; | |
| 162 | 166 | fields?: string[]; |
| 167 | from?: { category: string; section: string }; | |
| 168 | previousName?: string; | |
| 163 | 169 | pr?: import('@utils/fetch-changelog').ChangelogPr | null; |
| 164 | 170 | }> = []; |
| 165 | 171 | for (const e of entries) { |
| @@ -167,6 +173,8 @@ const serviceHistory = await fetchChangelog().then(({ entries }) => { | ||
| 167 | 173 | const added = (s?.added || []).find(isMatch); |
| 168 | 174 | const removed = (s?.removed || []).find(isMatch); |
| 169 | 175 | const modified = (s?.modified || []).find(isMatch); |
| 176 | const moved = (s?.moved || []).find(isHere); | |
| 177 | const renamed = (s?.renamed || []).find(isHere); | |
| 170 | 178 | if (added) results.push({ date: e.date, type: 'added', pr: e.pr }); |
| 171 | 179 | else if (removed) results.push({ date: e.date, type: 'removed', pr: e.pr }); |
| 172 | 180 | else if (modified) |
| @@ -176,6 +184,16 @@ const serviceHistory = await fetchChangelog().then(({ entries }) => { | ||
| 176 | 184 | fields: modified.fields, |
| 177 | 185 | pr: e.pr, |
| 178 | 186 | }); |
| 187 | else if (renamed) | |
| 188 | results.push({ | |
| 189 | date: e.date, | |
| 190 | type: 'renamed', | |
| 191 | previousName: renamed.previousName, | |
| 192 | from: renamed.from, | |
| 193 | pr: e.pr, | |
| 194 | }); | |
| 195 | else if (moved) | |
| 196 | results.push({ date: e.date, type: 'moved', from: moved.from, pr: e.pr }); | |
| 179 | 197 | } |
| 180 | 198 | return results; |
| 181 | 199 | }); |
web/src/styles/values.css +9
| @@ -6,7 +6,10 @@ html { | ||
| 6 | 6 | --accent-3: #5f53f4; |
| 7 | 7 | --accent-4: #28dffd; |
| 8 | 8 | |
| 9 | --bright: #fff; | |
| 10 | ||
| 9 | 11 | --foreground: #fff; |
| 12 | --background-hr-color: #2f2f2f; | |
| 10 | 13 | |
| 11 | 14 | --curve-sm: 4px; |
| 12 | 15 | --curve-md: 6px; |
| @@ -99,5 +102,11 @@ html { | ||
| 99 | 102 | --bg-gradient-comp-1: #feecff; |
| 100 | 103 | --bg-gradient-comp-2: #e1e4fb; |
| 101 | 104 | --background-form: #fff; |
| 105 | --background-hr-color: #ececec; | |
| 106 | ||
| 107 | --changelog-rem: #b59207; | |
| 108 | --changelog-rej: #d71e41; | |
| 109 | --changelog-mod: #2e89b5; | |
| 110 | --changelog-add: #509762; | |
| 102 | 111 | } |
| 103 | 112 | } |
web/src/utils/fetch-changelog.ts +23 −2
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | import { error } from './logger'; |
| 2 | 2 | |
| 3 | 3 | const changelogUrl = |
| 4 | 'https://raw.githubusercontent.com/Lissy93/awesome-privacy/main/.github/changelog.json'; | |
| 5 | // 'https://gist.githubusercontent.com/Lissy93/ddae176f3f21a0d3c0251f5f6cbd3b09/raw/7c6ec883ae70cb8b7a88f3c0babd67f719f59f65/changelog.json'; | |
| 4 | // 'https://raw.githubusercontent.com/Lissy93/awesome-privacy/main/.github/changelog.json'; | |
| 5 | 'https://gist.githubusercontent.com/Lissy93/ddae176f3f21a0d3c0251f5f6cbd3b09/raw/5fb0fe42a54a9395a988f7875e88a484769ea6dd/changelog.json'; | |
| 6 | 6 | |
| 7 | 7 | export interface ChangelogPr { |
| 8 | 8 | number: number; |
| @@ -18,6 +18,24 @@ export interface ServiceChange { | ||
| 18 | 18 | fields?: string[]; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | export interface ServiceMoved { | |
| 22 | name: string; | |
| 23 | from: { category: string; section: string }; | |
| 24 | to: { category: string; section: string }; | |
| 25 | } | |
| 26 | ||
| 27 | export interface SectionMoved { | |
| 28 | from: { category: string; section: string }; | |
| 29 | to: { category: string; section: string }; | |
| 30 | } | |
| 31 | ||
| 32 | export interface ServiceRenamed { | |
| 33 | previousName: string; | |
| 34 | name: string; | |
| 35 | from: { category: string; section: string }; | |
| 36 | to: { category: string; section: string }; | |
| 37 | } | |
| 38 | ||
| 21 | 39 | export interface ChangelogEntry { |
| 22 | 40 | date: string; |
| 23 | 41 | sha: string; |
| @@ -27,10 +45,13 @@ export interface ChangelogEntry { | ||
| 27 | 45 | added?: ServiceChange[]; |
| 28 | 46 | removed?: ServiceChange[]; |
| 29 | 47 | modified?: ServiceChange[]; |
| 48 | moved?: ServiceMoved[]; | |
| 49 | renamed?: ServiceRenamed[]; | |
| 30 | 50 | }; |
| 31 | 51 | sections?: { |
| 32 | 52 | added?: { name: string; category: string }[]; |
| 33 | 53 | removed?: { name: string; category: string }[]; |
| 54 | moved?: SectionMoved[]; | |
| 34 | 55 | }; |
| 35 | 56 | categories?: { |
| 36 | 57 | added?: string[]; |