Commit e1c0318d9b

e1c0318d9b1a246898a0339252fa41a98c7373b3

parent: 19ae398e7f

Unsigned

Alicia Sykes <alicia@omg.lol> · 2026-02-26 14:36 UTC

Fixes remaining lint issues, updates footer date

Layout: unified · split

web/src/components/scafold/Footer.astro +7 −2
@@ -1,8 +1,13 @@
1---
2const year = new Date().getFullYear();
3---
4
15<footer>
26 <a href="/about">Awesome Privacy</a> is licensed under <a
3 href="https://github.com/Lissy93/awesome-privacy/blob/main/LICENSE">MIT</a
7 href="https://github.com/Lissy93/awesome-privacy/blob/main/LICENSE"
8 >CC0 1.0 Universal</a
49 >
5 © <a href="https://aliciasykes.com">Alicia Sykes</a> 2024 | Source code available
10 © <a href="https://aliciasykes.com">Alicia Sykes</a> 2018 - {year || 'Present'} | Source code available
611 on <a href="https://github.com/Lissy93/awesome-privacy">GitHub</a>
712</footer>
813
web/src/components/things/AddNewService.svelte +13 −5
@@ -20,24 +20,31 @@
2020 const serviceCrypto = writable(false);
2121 const additionalInfo = writable('');
2222
23 let codeBlock: any;
23 let codeBlock: HTMLElement | undefined;
2424 let interactiveActivated = false;
2525
2626 $: (yamlText, updateHighlighting());
2727
28 /* eslint-disable svelte/no-dom-manipulating -- hljs requires direct DOM access for syntax highlighting */
2829 function updateHighlighting() {
2930 if (codeBlock) {
3031 codeBlock.textContent = yamlText;
3132 codeBlock.dataset.highlighted && delete codeBlock.dataset.highlighted;
32 if (window && (window as any).hljs) {
33 (window as any).hljs.highlightElement(codeBlock);
33 const hljs = (
34 window as Window & {
35 hljs?: { highlightElement: (el: HTMLElement) => void };
36 }
37 ).hljs;
38 if (hljs) {
39 hljs.highlightElement(codeBlock);
3440 interactiveActivated = true;
3541 }
3642 }
3743 }
44 /* eslint-enable svelte/no-dom-manipulating */
3845
39 const filterEmptyValues = (obj: Record<string, any>) => {
40 const filteredObj: Record<string, any> = {};
46 const filterEmptyValues = (obj: Record<string, unknown>) => {
47 const filteredObj: Record<string, unknown> = {};
4148 Object.keys(obj).forEach((key) => {
4249 if (obj[key] || ['name', 'url', 'icon', 'description'].includes(key)) {
4350 filteredObj[key] = obj[key];
@@ -397,6 +404,7 @@
397404 upon approval.
398405 </p>
399406 {#if !interactiveActivated || !codeBlock}
407 <!-- eslint-disable-next-line svelte/no-at-html-tags -- yamlText is generated from user form input via yaml.dump, not arbitrary HTML -->
400408 <pre><code class="language-yaml">{@html yamlText}</code></pre>
401409 {/if}
402410 <pre><code bind:this={codeBlock} class="language-yaml"></code></pre>
web/src/components/things/AndroidDetailedInfo.astro +1 −1
@@ -1,6 +1,6 @@
11---
22import type { AndroidInfo } from '@utils/fetch-android-info';
3import { formatDate, timeAgo } from '@utils/dates-n-stuff';
3import { formatDate } from '@utils/dates-n-stuff';
44import FontAwesome from '@components/form/FontAwesome.svelte';
55
66interface Props {
web/src/components/things/DiscordDetailedInfo.astro −2
@@ -1,7 +1,5 @@
11---
22import type { DiscordInfo } from '@utils/fetch-discord-info';
3import { formatDate, timeAgo } from '@utils/dates-n-stuff';
4import FontAwesome from '@components/form/FontAwesome.svelte';
53
64interface Props {
75 discordData: DiscordInfo;
web/src/components/things/IosAppDetailedInfo.astro +2 −2
@@ -1,7 +1,7 @@
11---
22
33import type { IoSApiResponse } from '@utils/fetch-ios-info';
4import { formatDate, timeAgo } from '@utils/dates-n-stuff';
4import { formatDate } from '@utils/dates-n-stuff';
55import FontAwesome from "@components/form/FontAwesome.svelte"
66
77
@@ -18,7 +18,7 @@ const makeRatingPercentage = (rating: number) => (rating / 5) * 100;
1818
1919const roundRatings = (rating: number) => Math.round(rating * 100) / 100;
2020
21const putCommaInNumber = (num: number | any) => {
21const putCommaInNumber = (num: number | string | undefined) => {
2222 if (!num) return 'Unknown';
2323 return typeof num === 'number' ? num.toLocaleString() : num;
2424}
web/src/components/things/ItemGitHubMetrics.astro +14 −7
@@ -2,13 +2,19 @@
22import FontAwesome from "@components/form/FontAwesome.svelte";
33const { github } = Astro.props;
44
5// const [user, repo] = github.split("/");
5interface GitHubRepoData {
6 stargazers_count?: number;
7 forks_count?: number;
8 open_issues_count?: number;
9 language?: string;
10 license?: { spdx_id?: string; name?: string };
11}
612
713/**
814 * For a given `user/repo` fetch repository stats from the GitHub API data
915 * If API key is available through env var, use it to increase rate limit
1016 * Returns the response data and status code (200 == success)
11 * @param repo
17 * @param repo
1218 */
1319const fetchGitHubData = async (repo: string) => {
1420 const apiKey = import.meta.env.GITHUB_API_KEY;
@@ -17,8 +23,8 @@ const fetchGitHubData = async (repo: string) => {
1723 headers.append("Authorization", `token ${apiKey}`);
1824 }
1925
20 let data = {};
21 let statusCode = 0;
26 let data: GitHubRepoData = {};
27 let statusCode;
2228
2329 const response = await fetch(`https://api.github.com/repos/${repo}`, {
2430 headers: headers,
@@ -50,7 +56,7 @@ const fetchGitHubData = async (repo: string) => {
5056 * Given a license object, return SPDX ID, or a formatted name
5157 * @param license
5258 */
53const formatLicense = (license: { spdx_id?: string, name?: string }) => {
59const formatLicense = (license?: { spdx_id?: string, name?: string }) => {
5460 if (!license) {
5561 return "Unknown";
5662 }
@@ -65,7 +71,8 @@ const formatLicense = (license: { spdx_id?: string, name?: string }) => {
6571 * E.g. If greater than thousand, then return in k format
6672 * @param num
6773 */
68const formatBigNumber = (num: number) => {
74const formatBigNumber = (num: number | undefined) => {
75 if (num == null) return 0;
6976 if (num > 1000) {
7077 return `${(num / 1000).toFixed(1)}k`;
7178 }
@@ -73,7 +80,7 @@ const formatBigNumber = (num: number) => {
7380}
7481
7582// Initiate GitHub fetch, and make available to the component
76const stats = (await fetchGitHubData(github)) as any;
83const stats = await fetchGitHubData(github);
7784
7885const {
7986 stargazers_count, forks_count, open_issues_count, language, license,
web/src/components/things/RedditDetailedInfo.astro +1 −2
@@ -1,7 +1,6 @@
11---
22import type { RedditData } from '@utils/fetch-reddit-info';
3import { timestampToDate, timeAgo } from '@utils/dates-n-stuff';
4import FontAwesome from '@components/form/FontAwesome.svelte';
3import { timestampToDate } from '@utils/dates-n-stuff';
54
65interface Props {
76 redditData: RedditData;
web/src/components/things/SavedServices.svelte +1 −1
@@ -48,7 +48,7 @@
4848<div>
4949 {#if $savedServices.length > 0}
5050 <div class="saved-services">
51 {#each $savedServices as thingy}
51 {#each $savedServices as thingy (thingy.service.name + thingy.section)}
5252 <ServiceCard
5353 categoryName={thingy.category}
5454 sectionName={thingy.section}
web/src/components/things/Search.svelte +5 −9
@@ -2,21 +2,17 @@
22 import { onMount } from 'svelte';
33 import Fuse from 'fuse.js';
44 import { slugify } from '@utils/fetch-data';
5 import type {
6 Category,
7 Section,
8 Service,
9 ShortService,
10 } from '../../types/Service';
5 import type { Category } from '../../types/Service';
116 import { formatLink } from '@utils/parse-markdown';
127 import { prepareSearchItems, searchOptions } from '@utils/do-searchy-searchy';
8 import type { SearchItem } from '@utils/do-searchy-searchy';
139
1410 export let data: Category[];
1511 export let previousSearch: string | undefined = undefined;
1612
17 let fuse: Fuse<any>;
13 let fuse: Fuse<SearchItem>;
1814 let searchQuery = '';
19 let results: any[] = [];
15 let results: SearchItem[];
2016
2117 // Initialize Fuse.js
2218 onMount(() => {
@@ -91,7 +87,7 @@
9187 {#if searchQuery.length > 0}
9288 <div class="suggestions">
9389 <ul>
94 {#each results as result}
90 {#each results as result (result.name + result.category + result.sectionName)}
9591 <li class="result-row">
9692 <a
9793 href={makeResultLink(
web/src/components/things/ServiceCard.astro +1 −1
@@ -92,5 +92,5 @@ const { service, sectionName, categoryName } = Astro.props;
9292</div>
9393
9494<style lang="scss">
95 @import './service-card.scss';
95 @use './service-card.scss';
9696</style>
web/src/components/things/ServiceCard.svelte +2 −1
@@ -44,6 +44,7 @@
4444 src={service.icon || `https://icon.horse/icon/${formatLink(service.url)}`}
4545 />
4646 <div class="service-body">
47 <!-- eslint-disable-next-line svelte/no-at-html-tags -- description is from curated YAML data, not user input -->
4748 <p>{@html service.description}</p>
4849 </div>
4950 </div>
@@ -64,5 +65,5 @@
6465</div>
6566
6667<style lang="scss">
67 @import './service-card.scss';
68 @use './service-card.scss';
6869</style>
web/src/layouts/Layout.astro +4 −1
@@ -10,7 +10,7 @@ interface Props {
1010 keywords?: string; // Overide keywords tag
1111 hideNav?: boolean; // Don't show the navbar (just homepage)
1212 author?: string; // Author of the content
13 customSchemaJson?: any; // Custom schema item
13 customSchemaJson?: Record<string, unknown>; // Custom schema item
1414 breadcrumbs?: Array<{
1515 name: string;
1616 item: string;
@@ -121,6 +121,7 @@ const makeSearchLd = () => {
121121 {
122122 breadcrumbs && (
123123 <script
124 is:inline
124125 type="application/ld+json"
125126 set:html={JSON.stringify(makeBreadcrumbs())}
126127 />
@@ -129,12 +130,14 @@ const makeSearchLd = () => {
129130 {
130131 customSchemaJson && (
131132 <script
133 is:inline
132134 type="application/ld+json"
133135 set:html={JSON.stringify(customSchemaJson)}
134136 />
135137 )
136138 }
137139 <script
140 is:inline
138141 type="application/ld+json"
139142 set:html={JSON.stringify(makeSearchLd)}
140143 />
web/src/pages/about.astro +75 −31
@@ -12,25 +12,44 @@ import {
1212 appDescription,
1313} from '../site-config';
1414
15const contributorsResource = async () => {
15interface GitHubContributor {
16 login: string;
17 avatar_url: string;
18 html_url: string;
19}
20
21interface Sponsor {
22 login: string;
23 avatarUrl: string;
24 name?: string;
25}
26
27const githubHeaders: Record<string, string> = {
28 'User-Agent': 'awesome-privacy',
29};
30const apiKey = import.meta.env.GITHUB_API_KEY;
31if (apiKey) {
32 githubHeaders['Authorization'] = `Bearer ${apiKey}`;
33}
34
35const contributorsResource = async (): Promise<GitHubContributor[] | null> => {
1636 const url =
1737 'https://api.github.com/repos/lissy93/personal-security-checklist/contributors?per_page=100';
18 const response = await fetch(url);
19 if (!response.ok) {
20 throw new Error('Failed to fetch contributors');
21 }
38 const response = await fetch(url, { headers: githubHeaders });
39 if (!response.ok) return null;
2240 return await response.json();
2341};
2442
25const sponsorsResource = async () => {
43const sponsorsResource = async (): Promise<Sponsor[] | null> => {
2644 const url = 'https://github-sponsors.as93.workers.dev/lissy93';
2745 const response = await fetch(url);
28 if (!response.ok) {
29 throw new Error('Failed to fetch sponsors');
30 }
46 if (!response.ok) return null;
3147 return await response.json();
3248};
3349
50const contributors = await contributorsResource();
51const sponsors = await sponsorsResource();
52
3453const licenseContent = async () => {
3554 const url =
3655 'https://raw.githubusercontent.com/Lissy93/awesome-privacy/HEAD/LICENSE';
@@ -98,10 +117,10 @@ const licenseContent = async () => {
98117 <h2 id="acknowledgements">Acknowledgements</h2>
99118 <h3 id="sponsors">Sponsors</h3>
100119 <p>Huge thanks to the following sponsors, for their ongoing support 💖</p>
101 <div class="user-list">
102 {
103 sponsorsResource().then((sponsors) => {
104 return sponsors.map((sponsor: any) => (
120 {
121 sponsors ? (
122 <div class="user-list">
123 {sponsors.map((sponsor) => (
105124 <a
106125 class="user"
107126 href={`https://github.com/${sponsor.login}`}
@@ -111,10 +130,16 @@ const licenseContent = async () => {
111130 <img src={sponsor.avatarUrl} alt={sponsor.login} />
112131 <p>{sponsor.name || sponsor.login}</p>
113132 </a>
114 ));
115 })
116 }
117 </div>
133 ))}
134 </div>
135 ) : (
136 <img
137 class="fallback-img"
138 src="https://readme-contribs.as93.net/sponsors/lissy93?perRow=12&shape=squircle&textColor=ffffff&limit=96"
139 alt="Sponsors"
140 />
141 )
142 }
118143
119144 <h3 id="contributors">Contributors</h3>
120145 <p>
@@ -122,23 +147,29 @@ const licenseContent = async () => {
122147 maintain it.<br />
123148 Special thanks to the below, top-100 contributors 🌟
124149 </p>
125 <div class="user-list">
126 {
127 contributorsResource().then((sponsors) => {
128 return sponsors.map((sponsor: any) => (
150 {
151 contributors ? (
152 <div class="user-list">
153 {contributors.map((contributor) => (
129154 <a
130155 class="user"
131 href={sponsor.html_url}
156 href={contributor.html_url}
132157 target="_blank"
133158 rel="noreferrer"
134159 >
135 <img src={sponsor.avatar_url} alt={sponsor.login} />
136 <p>{sponsor.login}</p>
160 <img src={contributor.avatar_url} alt={contributor.login} />
161 <p>{contributor.login}</p>
137162 </a>
138 ));
139 })
140 }
141 </div>
163 ))}
164 </div>
165 ) : (
166 <img
167 class="fallback-img"
168 src="https://readme-contribs.as93.net/contributors/lissy93/awesome-privacy?perRow=12&shape=squircle&textColor=ffffff&limit=96"
169 alt="Contributors"
170 />
171 )
172 }
142173
143174 <hr />
144175
@@ -281,7 +312,7 @@ const licenseContent = async () => {
281312<style lang="scss">
282313 h2 {
283314 font-size: 2rem;
284 margin: 2rem 0 1rem 0;
315 margin: 1rem 0 0.5rem 0;
285316 }
286317 p {
287318 font-size: 1.2rem;
@@ -343,18 +374,25 @@ const licenseContent = async () => {
343374 .user-list {
344375 display: flex;
345376 flex-wrap: wrap;
346 gap: 1rem;
377 gap: 0.25rem;
347378 margin: 2rem 0;
348379 .user {
349380 width: 6rem;
350381 overflow: hidden;
351382 text-align: center;
383 padding: 0.5rem;
384 border-radius: var(--curve-sm);
385 transition: background 0.2s ease-in-out;
386 &:hover {
387 background: var(--background-form);
388 }
352389 img {
353390 width: 5rem;
354391 height: 5rem;
355392 border-radius: var(--curve-md);
356393 }
357394 p {
395 margin: 0.5rem auto 0 auto;
358396 font-size: 1rem;
359397 display: -webkit-box;
360398 -webkit-line-clamp: 1;
@@ -364,6 +402,12 @@ const licenseContent = async () => {
364402 }
365403 }
366404
405 .fallback-img {
406 max-width: 100%;
407 margin: 2rem 0;
408 border-radius: var(--curve-sm);
409 }
410
367411 .license-content {
368412 max-height: 500px;
369413 overflow: scroll;
@@ -372,7 +416,7 @@ const licenseContent = async () => {
372416 border-radius: var(--curve-sm);
373417 padding: 0.5rem;
374418 font-size: 0.7rem;
375 font-family: mono;
419 font-family: 'Lekton', monospace;
376420 max-width: 100vw;
377421 white-space: pre-line;
378422 }
web/src/pages/inventory/[...inventoryId].astro −2
@@ -1,11 +1,9 @@
11---
22import Layout from '@layouts/Layout.astro';
33import SavedServices from '@components/things/SavedServices.svelte';
4import GetSharableLink from '@components/things/GetSharableLink.svelte';
54
65import { fetchData } from '@utils/fetch-data';
76import Button from '@components/form/Button.astro';
8import EditableTitle from '@components/form/EditableTitle.svelte';
97import type { Category } from '../../types/Service';
108
119const categories = (await fetchData())?.categories || ([] as Category[]);
web/src/pages/search/[...searchTerm].astro +27 −19
@@ -4,15 +4,14 @@ import Fuse from 'fuse.js';
44import Layout from '@layouts/Layout.astro';
55import { fetchData, slugify } from '@utils/fetch-data';
66import { prepareSearchItems, searchOptions } from '@utils/do-searchy-searchy';
7import type { SearchItem } from '@utils/do-searchy-searchy';
78import Search from '@components/things/Search.svelte';
89import SmartSuggestions from '@components/things/SmartSuggestions.svelte';
910import FontAwesome from '@components/form/FontAwesome.svelte';
1011
11import type { Service } from '../../types/Service';
12
1312export const prerender = false;
1413
15let fuse: Fuse<any>;
14let fuse: Fuse<SearchItem>;
1615
1716const categories = (await fetchData())?.categories;
1817
@@ -28,26 +27,35 @@ const searchResults = fuse
2827
2928const services = searchResults.filter((result) => result.type === 'Service');
3029
30interface GroupedSection {
31 sectionName: string;
32 items: SearchItem[];
33}
34
35interface GroupedCategory {
36 categoryName: string;
37 sections: Record<string, GroupedSection>;
38}
39
3140const putResultsIntoGroups = () => {
32 const grouped = services.reduce((acc, item) => {
33 const { category: categoryName, sectionName, ...service } = item;
41 const grouped: Record<string, GroupedCategory> = {};
3442
35 if (!acc[categoryName]) {
36 acc[categoryName] = { categoryName, sections: {} };
37 }
43 for (const item of services) {
44 const categoryName = item.category;
45 const sectionName = item.sectionName || '';
3846
39 if (!acc[categoryName].sections[sectionName]) {
40 acc[categoryName].sections[sectionName] = { sectionName, items: [] };
47 if (!grouped[categoryName]) {
48 grouped[categoryName] = { categoryName, sections: {} };
4149 }
4250
43 acc[categoryName].sections[sectionName].items.push(service);
51 if (!grouped[categoryName].sections[sectionName]) {
52 grouped[categoryName].sections[sectionName] = { sectionName, items: [] };
53 }
4454
45 return acc;
46 }, {});
55 grouped[categoryName].sections[sectionName].items.push(item);
56 }
4757
48 // Convert the grouped object into the desired array structure.
49 // And fuck it, let's use `any`
50 return Object.values(grouped).map((category: any) => ({
58 return Object.values(grouped).map((category) => ({
5159 categoryName: category.categoryName,
5260 sections: Object.values(category.sections),
5361 }));
@@ -74,7 +82,7 @@ const beer = putResultsIntoGroups();
7482 </section>
7583 <div class="results">
7684 {
77 beer.map((category: any) => (
85 beer.map((category) => (
7886 <div class="category">
7987 <a class="category-title" href={`/${slugify(category.categoryName)}`}>
8088 <h3>{category.categoryName}</h3>
@@ -83,11 +91,11 @@ const beer = putResultsIntoGroups();
8391 <FontAwesome iconName={slugify(category.categoryName)} />
8492 </span>
8593 <ul class="section-list">
86 {category.sections.map((section: any) => (
94 {category.sections.map((section) => (
8795 <li class="section-item">
8896 <h4>{section.sectionName}</h4>
8997 <ul class="service-list">
90 {section.items.map((item: Service) => (
98 {section.items.map((item) => (
9199 <li>
92100 <a href={item.url}>{item.name}</a>
93101 </li>
web/src/utils/do-searchy-searchy.test.ts +5 −4
@@ -1,5 +1,6 @@
11import { describe, it, expect } from 'vitest';
22import { prepareSearchItems } from './do-searchy-searchy';
3import type { SearchItem } from './do-searchy-searchy';
34import type { Category } from '../types/Service';
45
56const makeCategory = (overrides: Partial<Category> = {}): Category =>
@@ -35,7 +36,7 @@ describe('prepareSearchItems', () => {
3536 }),
3637 ] as Category[];
3738 const items = prepareSearchItems(categories);
38 const section = items.find((i: { type: string }) => i.type === 'Section');
39 const section = items.find((i: SearchItem) => i.type === 'Section');
3940 expect(section).toMatchObject({
4041 type: 'Section',
4142 sectionName: 'Messaging',
@@ -66,7 +67,7 @@ describe('prepareSearchItems', () => {
6667 }),
6768 ] as Category[];
6869 const items = prepareSearchItems(categories);
69 const service = items.find((i: { type: string }) => i.type === 'Service');
70 const service = items.find((i: SearchItem) => i.type === 'Service');
7071 expect(service).toMatchObject({
7172 type: 'Service',
7273 name: 'Signal',
@@ -99,7 +100,7 @@ describe('prepareSearchItems', () => {
99100 }),
100101 ] as Category[];
101102 const items = prepareSearchItems(categories);
102 const cat = items.find((i: { type: string }) => i.type === 'Category');
103 expect(cat.itemCount).toBe(3);
103 const cat = items.find((i: SearchItem) => i.type === 'Category');
104 expect(cat?.itemCount).toBe(3);
104105 });
105106});
web/src/utils/do-searchy-searchy.ts +14 −2
@@ -1,7 +1,19 @@
11import type { Category } from '../types/Service';
22
3export const prepareSearchItems = (categories: Category[]) => {
4 const items: any = [];
3export interface SearchItem {
4 type: 'Category' | 'Section' | 'Service';
5 category: string;
6 itemCount?: number;
7 sectionName?: string;
8 description?: string;
9 name?: string;
10 url?: string;
11 github?: string;
12 logo?: string;
13}
14
15export const prepareSearchItems = (categories: Category[]): SearchItem[] => {
16 const items: SearchItem[] = [];
517 // Add each category
618 categories.forEach((category) => {
719 items.push({
web/src/utils/fetch-website-info.ts +1 −1
@@ -61,7 +61,7 @@ interface Redirection {
6161 found: boolean;
6262 external: boolean;
6363 url: string;
64 redirects: any[];
64 redirects: string[];
6565}
6666
6767interface ResponseHeaders {