Commit 330cce7a7e

330cce7a7e4591433d343226d713210b00ec069f

parent: fae3013515

Unsigned

Alicia Sykes <alicia@omg.lol> · 2024-02-29 21:52 UTC

Updates service lists props, adds new route for viewing listing

Layout: unified · split

web/src/components/form/Button.astro +6 −2
@@ -1,10 +1,14 @@
11---
22
3const { text, url } = Astro.props;
3const {
4 text,
5 url,
6 className,
7} = Astro.props;
48
59---
610
7<div class="button">
11<div class={`button ${className || ''}`}>
812 <a href={url}>{text}<slot /></a>
913</div>
1014
web/src/components/form/FontAwesome.svelte +11
@@ -18,6 +18,17 @@
1818 owner: solidIcons.faUser,
1919 language: solidIcons.faFileCode,
2020
21 download: solidIcons.faDownload,
22 faceGood: solidIcons.faSmile,
23 faceMeh: solidIcons.faMeh,
24 faceBad: solidIcons.faFrown,
25
26 // Website Detailed Stats
27 blacklistFound: solidIcons.faDoNotEnter,
28 blacklistNotFound: solidIcons.faShieldCheck,
29 redirectFound: solidIcons.faDiamondTurnRight,
30 redirectNotFound: solidIcons.faSquareCheck,
31
2132 // Meta info icons
2233 openSource: brands.faOsi,
2334 closedSource: solidIcons.faHexagonExclamation,
web/src/components/scafold/MainCard.astro +1
@@ -13,5 +13,6 @@
1313 border: 2px solid var(--foreground);
1414 box-shadow: 6px 6px 0 var(--foreground);
1515 background: var(--accent-fg);
16 position: relative;
1617 }
1718</style>
web/src/components/things/Comments.svelte +14 −18
@@ -1,23 +1,19 @@
11<svelte:head>
22 <script async lang="javascript">
3 var remark_config = {
4 host: "https://comments.as93.net",
5 site_id: "awesome-privacy",
6 components: ["embed"],
7 show_rss_subsription: true,
8 theme: "dark",
9 };
10 !(function (e, n) {
11 for (var o = 0; o < e.length; o++) {
12 var r = n.createElement("script"),
13 c = ".js",
14 d = n.head || n.body;
15 "noModule" in r ? ((r.type = "module"), (c = ".mjs")) : (r.async = !0),
16 (r.defer = !0),
17 (r.src = remark_config.host + "/web/" + e[o] + c),
18 d.appendChild(r);
19 }
20 })(remark_config.components || ["embed"], document);
3 var remark_config = {
4 host: 'https://comments.as93.net', site_id: 'awesome-privacy.xyz',
5 components: ['embed'], show_rss_subsription: true, theme: 'light',
6 };
7 !(function (e, n) {
8 for (var o = 0; o < e.length; o++) {
9 var r = n.createElement('script'), d = n.head || n.body;
10 'noModule' in r ?
11 (r.type = 'module', r.src = remark_config.host + '/web/' + e[o] + '.mjs')
12 : ( r.async = !0, r.defer = !0, r.src = remark_config.host + '/web/' + e[o] + '.js'),
13 d.appendChild(r);
14 }
15 })(remark_config.components || ['embed'], document);
16
2117
2218</script>
2319</svelte:head>
web/src/components/things/Search.svelte +1 −1
@@ -23,7 +23,7 @@
2323 if (!cat) return '/'
2424 if (!sec) return `/${slugify(cat)}`
2525 if (!itm) return `/${slugify(cat)}/${slugify(sec)}`
26 return `/${slugify(cat)}/${slugify(sec)}#${slugify(itm)}`;
26 return `/${slugify(cat)}/${slugify(sec)}/${slugify(itm)}`;
2727 };
2828
2929 const makeResultText = (cat?: string, sec?: string, itm?: string) => {
web/src/components/things/ServiceList.astro +36 −3
@@ -8,7 +8,23 @@ import { slugify } from '@utils/fetch-data';
88
99import GitHubMetrics from '@components/things/ItemGitHubMetrics.astro';
1010
11const { services, subHeading, buttonLink, noGitHubMetrics } = Astro.props;
11interface Props {
12 services: Service[];
13 subHeading?: boolean;
14 buttonLink?: string;
15 noGitHubMetrics?: boolean;
16 sectionName: string;
17 categoryName: string;
18}
19
20const {
21 services,
22 subHeading,
23 buttonLink,
24 noGitHubMetrics,
25 sectionName,
26 categoryName,
27} = Astro.props;
1228
1329---
1430
@@ -36,6 +52,9 @@ const { services, subHeading, buttonLink, noGitHubMetrics } = Astro.props;
3652 <ul>
3753 {services.map((service: Service) => (
3854 <li id={slugify(service.name)}>
55 <div class="actions">
56
57 </div>
3958 <div class="service-head">
4059 <img
4160 width="40"
@@ -89,6 +108,9 @@ const { services, subHeading, buttonLink, noGitHubMetrics } = Astro.props;
89108 </a>
90109 </span>
91110 ) }
111 <div class="view-service">
112 <a href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`}>View {service.name} Report</a>
113 </div>
92114 </div>
93115 </div>
94116 </li>
@@ -101,7 +123,7 @@ const { services, subHeading, buttonLink, noGitHubMetrics } = Astro.props;
101123 </p>
102124 )}
103125
104 {buttonLink && ( <Button text="View More..." url={buttonLink} /> )}
126 {buttonLink && ( <Button className="view-all" text="View More..." url={buttonLink} /> )}
105127</section>
106128
107129
@@ -217,7 +239,18 @@ const { services, subHeading, buttonLink, noGitHubMetrics } = Astro.props;
217239 }
218240 }
219241
220section :global(.button) {
242.view-service {
243 a {
244 padding: 0.25rem 0.6rem;
245 color: var(--accent-3);
246 width: fit-content;
247 position: absolute;
248 right: 1rem;
249 transform: scale(0.8);
250 }
251}
252
253section :global(.view-all) {
221254 width: fit-content;
222255 position: absolute;
223256 right: 1rem;
web/src/components/things/SmartSuggestions.svelte +1 −1
@@ -28,7 +28,7 @@
2828 (category.sections || []).forEach((section) => {
2929 (section.services || []).forEach((service) => {
3030 if (fetchedServices.includes(normalize(service.name))) {
31 const path = `/${slugify(category.name)}/${slugify(section.name)}#${slugify(service.name)}`
31 const path = `/${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}`
3232 tmpResults.push({ ...service, path });
3333 return;
3434 }
web/src/layouts/Layout.astro +1 −1
@@ -57,7 +57,7 @@ const {
5757 <meta name="twitter:image" content="/banner.png">
5858
5959 <!-- Non-tracking hit counter -->
60 <script defer
60 <script defer is:inline
6161 type="text/partytown"
6262 data-domain="awesome-privacy.xyz"
6363 src="https://no-track.as93.net/js/script.js">
web/src/pages/[...listing].astro added +352
@@ -0,0 +1,352 @@
1---
2
3import Layout from '@layouts/Layout.astro';
4import Button from '@components/form/Button.astro';
5import Main from '@components/scafold/MainCard.astro';
6import ServiceList from '@components/things/ServiceList.astro';
7import Comments from '@components/things/Comments.svelte';
8import GitHubDetailedInfo from '@components/things/GitHubDetailedInfo.astro';
9import PrivacyPolicyDetails from '@components/things/PrivacyPolicyDetails.astro';
10import WebsiteDetailedInfo from '@components/things/WebsiteDetailedInfo.astro';
11import type { AwesomePrivacy, Section, Service } from '../types/Service';
12import { fetchData, slugify } from '@utils/fetch-data';
13import { fetchGitHubStats } from '@utils/fetch-repo-info';
14import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy';
15import { fetchWebsiteInfo } from '@utils/fetch-website-info';
16import { parseMarkdown, formatLink } from '@utils/parse-markdown';
17
18interface Props extends Service {
19 slug: string;
20 parentSection: Section;
21 categoryName: string;
22}
23
24const {
25 name,
26 description,
27 url,
28 github,
29 tosdrId,
30 icon,
31 followWith,
32 securityAudited,
33 openSource,
34 acceptsCrypto,
35 parentSection,
36 categoryName,
37} = Astro.props;
38
39
40/**
41 * Make a list of keywords, for the <meta keywords> tag
42 */
43const makeKeyWordTag = () => {
44 const keywords = [];
45 // keywords.push(`free and open source ${title} software`);
46 // keywords.push(`private ${title} comparison`);
47 // (alternativeTo || []).forEach((alt: string) => {
48 // keywords.push(`privacy-respecting ${alt} alternative`);
49 // keywords.push(`free open source ${alt} alternative`);
50 // });
51 // (services || []).forEach((serv: Service) => {
52 // keywords.push(serv.name);
53 // });
54 // keywords.push('ad free');
55 // keywords.push('open source software');
56 // keywords.push('privacy respecting apps');
57 return keywords.join(', ');
58};
59
60/**
61 * Make a page title
62 */
63const makePageTitle = () => {
64 return `${name} | ${parentSection.name} | ${categoryName} | Awesome Privacy`;
65};
66
67/**
68 * Make a string page intro, for the description tag
69 */
70const makeDescriptionTag = () => {
71 let description = `A list of privacy respecting ${name}. `;
72 // if (services && services.length > 0) {
73 // const serviceList = services.map((serv: Service) => serv.name);
74 // description += `Compare ${serviceList.join(', ')} and more private apps and services. `
75 // } else {
76 // description += `Find private apps and services. This section is still a work in progress. `;
77 // }
78 // description += 'All this, and much more at Awesome Privacy, '
79 // description += 'the free and open source list of private software alternatives.';
80 return description;
81};
82
83// Return a list of Services, except for the currtent one
84const filterServices = () => {
85 return parentSection.services.filter((service: Service) => service.name !== name);
86};
87
88export async function getStaticPaths() {
89 const pages = await fetchData().then((data) => {
90 const results: Array<Props> = [];
91 if (!data || !data.categories) return results;
92 (data as AwesomePrivacy).categories.forEach((category) => {
93 category.sections.forEach((section) => {
94 const services = (section.services || []).map((service) => {
95 return {
96 slug: `${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}`,
97 parentSection: section,
98 categoryName: category.name,
99 ...service,
100 };
101 });
102 results.push(...services);
103 });
104
105 });
106 return results;
107 });
108
109 return pages.map((props: Props) => {
110 return {params: { listing: props.slug }, props };
111 });
112}
113
114// const makePaginationLinks = () => {
115// const index = otherSections.findIndex(section => section.name === title);
116// const previousSection = index > 0 ? otherSections[index - 1].name : null;
117// const nextSection = index < otherSections.length - 1 ? otherSections[index + 1].name : null;
118// return { previous: previousSection, next: nextSection };
119// };
120
121// const { previous, next } = makePaginationLinks();
122
123
124// Fetch detailed data about the services GitHub repo, privacy policy and website
125const githubData = github ? await fetchGitHubStats(github) : null;
126const privacyData = tosdrId ? await fetchTosdrPrivacy(tosdrId) : null;
127const websiteData = (url && !url.includes('github.com')) ? await fetchWebsiteInfo(url) : null;
128
129---
130
131<Layout title={makePageTitle()} keywords={makeKeyWordTag()} description={makeDescriptionTag()} >
132 <main>
133 <section>
134 <div class="service-head">
135 <h2>{name}</h2>
136 <span class="url-wrap">
137 <a class="service-url" href={url}>{formatLink(url)}</a>
138 <span class="follow-with">{followWith}</span>
139 </span>
140 </div>
141 <div class="breadcrumbs">
142 <span>
143 <a href="/">Awesome Privacy</a>
144 ➔ <a href={`/${slugify(categoryName)}`}>{categoryName}</a>
145 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}>{parentSection.name}</a>
146 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`}>{name}</a>
147 </span>
148 </div>
149 <div class="intro">
150 <img
151 width="60"
152 height="60"
153 loading="lazy"
154 decoding="async"
155 class="service-icon"
156 alt={`${name} Icon`}
157 data-service-url={formatLink(url)}
158 src={icon || `https://icon.horse/icon/${formatLink(url)}`}
159 />
160 <p class="description" set:html={parseMarkdown(description)}></p>
161 </div>
162 </section>
163 { privacyData && (
164 <section>
165 <h3>{name} Privacy Policy</h3>
166 <PrivacyPolicyDetails privacyData={privacyData} />
167 </section>
168 )}
169 { github && githubData && (
170 <section class="github-wrap">
171 <h3>{name} Source Code</h3>
172 <GitHubDetailedInfo gitHubData={githubData} repo={github} />
173 </section>
174 )}
175
176 { websiteData && (
177 <section>
178 <h3>{name} Website</h3>
179 <WebsiteDetailedInfo url={url} websiteInfo={websiteData} />
180 </section>
181 )}
182 <section>
183 <h3>{name} Reviews</h3>
184 <Comments client:visible />
185 </section>
186 <section>
187 <h3>More {parentSection.name}</h3>
188 <ServiceList
189 services={filterServices()}
190 subHeading={true}
191 noGitHubMetrics={true}
192 buttonLink={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}
193 categoryName={categoryName}
194 sectionName={parentSection.name}
195 />
196 </section>
197 </main>
198</Layout>
199
200<style lang="scss">
201
202main {
203 margin: 2rem auto;
204 padding: 1rem;
205 width: 1000px;
206 max-width: calc(100% - 5rem);
207 position: relative;
208}
209
210section {
211 margin: 1rem 0 4rem 0;
212 padding: 1rem;
213 min-height: 8rem;
214 position: relative;
215 border: 2px solid var(--foreground);
216 box-shadow: 6px 6px 0 var(--foreground);
217 background: var(--accent-fg);
218
219}
220
221h3 {
222 font-size: 2rem;
223 margin: -2rem 0 1rem -2rem;
224 box-shadow: 6px 6px 0 var(--foreground);
225 background: var(--accent);
226 color: var(--accent-fg);
227 width: fit-content;
228 padding: 0.25rem 0.5rem;
229 }
230
231.service-head {
232 h2 {
233 font-size: 3rem;
234 margin: 0;
235 }
236 .url-wrap {
237 display: flex;
238 align-items: center;
239 gap: 0.5rem;
240 a {
241 font-size: 1.2rem;
242 }
243 .follow-with {
244 font-style: italic;
245 opacity: 0.6;
246 }
247 }
248
249}
250
251.breadcrumbs {
252 opacity: 0.5;
253 font-size: 0.8rem;
254 position: absolute;
255 right: 1rem;
256 top: 1rem;
257 a {
258 color: var(--foreground);
259 transition: all 0.15s ease-in-out;
260
261 &:hover {
262 color: var(--accent);
263 }
264 }
265}
266
267.intro {
268 font-size: 1.2rem;
269 font-style: italic;
270 opacity: 0.7;
271 display: flex;
272 align-items: center;
273 gap: 0.5rem;
274}
275
276.pagination-navigation {
277 display: flex;
278 justify-content: space-between;
279 align-items: center;
280 padding: 1rem 0;
281 :global(.button) {
282 min-width: 120px;
283 width: fit-content;
284 padding: 0.25rem 1rem;
285 text-align: right;
286 &:first-child { text-align: left; }
287 p {
288 margin: 0;
289 font-weight: normal;
290 font-size: 1rem;
291 }
292 span {
293 font-size: 0.8rem;
294 }
295
296 }
297 .nothing {
298 width: 120px;
299 }
300 .go-to-category {
301 color: var(--foreground);
302 font-size: 0.8rem;
303 opacity: 0.5;
304 @media (max-width: 768px) {
305 display: none;
306 }
307 }
308}
309
310
311
312.further-info, .notable-mentions, .word-of-warning {
313 h3 {
314 font-size: 1.4rem;
315 margin: 1rem 0;
316 }
317 :global(p) {
318 font-size: 0.9rem;
319 opacity: 0.7;
320 :global(strong) {
321 font-weight: 500;
322 }
323 :global(a) {
324 color: var(--foreground);
325 transition: all 0.15s ease-in-out;
326 &:hover {
327 color: var(--accent);
328 }
329 }
330 }
331 :global(strong) {
332 font-weight: 500;
333 }
334 :global(h4) {
335 font-size: 1.2rem;
336 margin: 0.5rem 0 0 0;
337 }
338 :global(ul) {
339 list-style: circle;
340 padding-left: 1rem;
341 font-size: 0.9rem;
342 opacity: 0.7;
343 li {
344 margin-bottom: 0.25rem;
345 :global(p) {
346 display: inline;
347 }
348 }
349 }
350}
351
352</style>
web/src/pages/[...section].astro +1 −1
@@ -119,7 +119,7 @@ const { previous, next } = makePaginationLinks();
119119 </section>
120120 )}
121121
122 <ServiceList title={title} services={services} />
122 <ServiceList services={services} sectionName={title} categoryName={categoryName} />
123123
124124 {notableMentions && (
125125 <section class="notable-mentions">
web/src/pages/about.astro +11 −9
@@ -82,7 +82,7 @@ const projects = [
8282 {
8383 title: 'Web-Check',
8484 description: 'OSINT tool for analysing any website',
85 icon: 'https://icon.horse/icon/web-check.xyz',
85 icon: 'https://web-check.as93.net/web-check.png',
8686 link: 'https://github.com/lissy93/web-check',
8787 },
8888 {
@@ -156,7 +156,7 @@ const description = 'Privacy is a fundamental human right; '
156156<Layout title="About | Awesome Privacy" description={description}>
157157 <div class="about-page">
158158 <Main>
159 <h2>Objective</h2>
159 <h2 id="objective">Objective</h2>
160160 <p>
161161 Large data-hungry corporations dominate the digital world but with little,
162162 or no respect for your privacy.
@@ -172,11 +172,11 @@ const description = 'Privacy is a fundamental human right; '
172172 </p>
173173 <hr />
174174
175 <h2>Software Requirements</h2>
175 <h2 id="creteria">Software Requirements</h2>
176176 <div class="software-requirements"><p set:html={parseMarkdown(projectRequrements)}></p></div>
177177 <hr />
178178
179 <h2>Contributing</h2>
179 <h2 id="contributing">Contributing</h2>
180180 <p>
181181 Awesome Privacy (including all data and code) is fully open source,
182182 maintained by a core group of volenteers, with a lot of help from the community.
@@ -193,8 +193,8 @@ const description = 'Privacy is a fundamental human right; '
193193 </p>
194194 <hr />
195195
196 <h2>Credits</h2>
197 <h3>Sponsors</h3>
196 <h2 id="acknowledgements">Acknowledgements</h2>
197 <h3 id="sponsors">Sponsors</h3>
198198 <p>Huge thanks to the following sponsors, for their ongoing support 💖</p>
199199 <div class="user-list">
200200 {sponsorsResource().then((sponsors) => {
@@ -207,7 +207,7 @@ const description = 'Privacy is a fundamental human right; '
207207 })}
208208 </div>
209209
210 <h3>Contributors</h3>
210 <h3 id="contributors">Contributors</h3>
211211 <p>
212212 This project exists thanks to all the people who've helped build and maintain it.<br />
213213 Special thanks to the below, top-100 contributors 🌟
@@ -225,7 +225,7 @@ const description = 'Privacy is a fundamental human right; '
225225
226226 <hr />
227227
228 <h2>Author</h2>
228 <h2 id="author">Author</h2>
229229 <article class="author">
230230 <p>
231231 This project was originally started by
@@ -283,7 +283,7 @@ const description = 'Privacy is a fundamental human right; '
283283
284284 <hr />
285285
286 <h2>License</h2>
286 <h2 id="license">License</h2>
287287 <p>
288288 All content on Awesome Privacy is freely available, within the public domain,
289289 licensed under Creative Commons Zero v1.0 Universal.
@@ -376,6 +376,8 @@ h3 {
376376 padding: 0.5rem;
377377 font-size: 0.7rem;
378378 font-family: mono;
379 max-width: 100vw;
380 white-space: pre-line;
379381}
380382
381383.author {
web/src/pages/all.astro +2 −1
@@ -47,11 +47,12 @@ const toggleSidebar = () => {
4747 <a href={`/${slugify(category.name)}/${slugify(section.name)}`}>{section.name}</a>
4848 </h3>
4949 <ServiceList
50 title={section.name}
5150 services={section.services}
5251 subHeading={true}
5352 buttonLink={`/${slugify(category.name)}/${slugify(section.name)}`}
5453 noGitHubMetrics={true}
54 sectionName={section.name}
55 categoryName={category.name}
5556 />
5657 </section>
5758 ))}
web/src/pages/search/index.astro +11
@@ -13,6 +13,7 @@ const categories = (await fetchData())?.categories;
1313 <section>
1414 <h1>Search</h1>
1515 <Search client:visible data={categories} />
16 <p class="sitemap-link">Or, view all pages in the <a href="/sitemap">Sitemap</a></p>
1617 </section>
1718</Layout>
1819
@@ -40,5 +41,15 @@ section {
4041 text-align: center;
4142 margin: 1rem 0;
4243 }
44 .sitemap-link {
45 opacity: 0.6;
46 text-align: center;
47 font-size: 0.8rem;
48 margin: 2rem auto;
49 transition: all 0.2s ease-in-out;
50 &:hover {
51 opacity: 0.8;
52 }
53 }
4354}
4455</style>
web/src/styles/values.css +2
@@ -14,4 +14,6 @@
1414
1515 --danger: #ff0048;
1616 --success: #00ff64;
17
18 --transparent-accent: #5f53f482;
1719}
web/src/types/Service.ts +1
@@ -16,6 +16,7 @@ export interface Service {
1616 securityAudited?: boolean;
1717 openSource?: boolean;
1818 acceptsCrypto?: boolean;
19 tosdrId?: string;
1920}
2021
2122export interface Section {
web/src/utils/fetch-data.ts +1 −1
@@ -13,5 +13,5 @@ export const fetchData = async (): Promise<AwesomePrivacy> => {
1313}
1414
1515export const slugify = (title: string) => {
16 return title.toLowerCase().replace(/\s/g, '-');
16 return (title || '').toLowerCase().replace(/\s/g, '-');
1717};