Commit e1bf34dab0
Unsigned
Layout: unified · split
web/src/components/scafold/Footer.astro +1 −1
| @@ -3,7 +3,7 @@ const year = new Date().getFullYear(); | |||
| 3 | --- | 3 | --- |
| 4 | 4 | ||
| 5 | <footer> | 5 | <footer> |
| 6 | <a href="/about">Awesome Privacy</a> is licensed under <a | 6 | <a href="/about/">Awesome Privacy</a> is licensed under <a |
| 7 | href="https://github.com/Lissy93/awesome-privacy/blob/main/LICENSE" | 7 | href="https://github.com/Lissy93/awesome-privacy/blob/main/LICENSE" |
| 8 | target="_blank" | 8 | target="_blank" |
| 9 | rel="noopener noreferrer">CC0 1.0 Universal</a | 9 | rel="noopener noreferrer">CC0 1.0 Universal</a |
web/src/components/scafold/NavBar.astro +6 −7
| @@ -3,12 +3,12 @@ import FontAwesome from '@components/form/FontAwesome.svelte'; | |||
| 3 | import ThemeSwitcher from '@components/form/ThemeSwitcher.svelte'; | 3 | import ThemeSwitcher from '@components/form/ThemeSwitcher.svelte'; |
| 4 | 4 | ||
| 5 | const navLinks = [ | 5 | const navLinks = [ |
| 6 | { label: 'View All', href: '/all' }, | 6 | { label: 'View All', href: '/all/' }, |
| 7 | { label: 'Search', href: '/search' }, | 7 | { label: 'Search', href: '/search/' }, |
| 8 | { label: 'Changelog', href: '/changelog' }, | 8 | { label: 'Changelog', href: '/changelog/' }, |
| 9 | // { label: 'API', href: '/api' }, // TODO: restore once API is built out | 9 | // { label: 'API', href: '/api/' }, // TODO: restore once API is built out |
| 10 | { label: 'Saved', href: '/inventory', id: 'saved-nav-link', hidden: true }, | 10 | { label: 'Saved', href: '/inventory/', id: 'saved-nav-link', hidden: true }, |
| 11 | { label: 'About', href: '/about' }, | 11 | { label: 'About', href: '/about/' }, |
| 12 | { | 12 | { |
| 13 | label: 'GitHub', | 13 | label: 'GitHub', |
| 14 | href: 'https://github.com/lissy93/awesome-privacy', | 14 | href: 'https://github.com/lissy93/awesome-privacy', |
| @@ -253,5 +253,4 @@ const navLinks = [ | |||
| 253 | } | 253 | } |
| 254 | } | 254 | } |
| 255 | } | 255 | } |
| 256 | |||
| 257 | </style> | 256 | </style> |
web/src/components/things/AddNewService.svelte +2 −2
| @@ -117,7 +117,7 @@ | |||
| 117 | 117 | ||
| 118 | <p> | 118 | <p> |
| 119 | Before completing this form, you must ensure that the service you are adding | 119 | Before completing this form, you must ensure that the service you are adding |
| 120 | aligns with the <a href="/about#creteria">Requirements</a> for Awesome | 120 | aligns with the <a href="/about/#creteria">Requirements</a> for Awesome |
| 121 | Privacy. | 121 | Privacy. |
| 122 | <br /> | 122 | <br /> |
| 123 | You'll need a GitHub account in order to submit this form. | 123 | You'll need a GitHub account in order to submit this form. |
| @@ -174,7 +174,7 @@ | |||
| 174 | </select> | 174 | </select> |
| 175 | <p> | 175 | <p> |
| 176 | Choose the top-level category, which should align with the <a | 176 | Choose the top-level category, which should align with the <a |
| 177 | href="/browse">one of these</a | 177 | href="/browse/">one of these</a |
| 178 | >. | 178 | >. |
| 179 | </p> | 179 | </p> |
| 180 | </div> | 180 | </div> |
web/src/components/things/ChangelogTimeline.svelte +3 −3
| @@ -160,7 +160,7 @@ | |||
| 160 | function serviceLink(s: ServiceChange, isRemoval: boolean): string { | 160 | function serviceLink(s: ServiceChange, isRemoval: boolean): string { |
| 161 | const c = slugify(s.category), | 161 | const c = slugify(s.category), |
| 162 | sc = slugify(s.section); | 162 | sc = slugify(s.section); |
| 163 | return isRemoval ? `/${c}/${sc}` : `/${c}/${sc}/${slugify(s.name)}`; | 163 | return isRemoval ? `/${c}/${sc}/` : `/${c}/${sc}/${slugify(s.name)}/`; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | type ChangeRow = { | 166 | type ChangeRow = { |
| @@ -229,7 +229,7 @@ | |||
| 229 | badge: 'New Section', | 229 | badge: 'New Section', |
| 230 | cls: 'add', | 230 | cls: 'add', |
| 231 | name: v.name, | 231 | name: v.name, |
| 232 | href: `/${slugify(v.category)}/${slugify(v.name)}`, | 232 | href: `/${slugify(v.category)}/${slugify(v.name)}/`, |
| 233 | })), | 233 | })), |
| 234 | ...sc.removed.map((v) => ({ | 234 | ...sc.removed.map((v) => ({ |
| 235 | badge: 'Section Removed', | 235 | badge: 'Section Removed', |
| @@ -241,7 +241,7 @@ | |||
| 241 | badge: 'Section Renamed', | 241 | badge: 'Section Renamed', |
| 242 | cls: 'mod', | 242 | cls: 'mod', |
| 243 | name: `${v.from.section} → ${v.to.section}`, | 243 | name: `${v.from.section} → ${v.to.section}`, |
| 244 | href: `/${slugify(v.to.category)}/${slugify(v.to.section)}`, | 244 | href: `/${slugify(v.to.category)}/${slugify(v.to.section)}/`, |
| 245 | path: | 245 | path: |
| 246 | v.from.category === v.to.category | 246 | v.from.category === v.to.category |
| 247 | ? `in ${v.to.category}` | 247 | ? `in ${v.to.category}` |
web/src/components/things/DataActions.svelte +2 −2
| @@ -118,7 +118,7 @@ | |||
| 118 | /> | 118 | /> |
| 119 | Note that some of the information shown above has been aggregated from external | 119 | Note that some of the information shown above has been aggregated from external |
| 120 | sources, a list of these can be found | 120 | sources, a list of these can be found |
| 121 | <a href="/about#our-data">data documentation</a>. | 121 | <a href="/about/#our-data">data documentation</a>. |
| 122 | </p> | 122 | </p> |
| 123 | 123 | ||
| 124 | <h4>Origin Data</h4> | 124 | <h4>Origin Data</h4> |
| @@ -157,7 +157,7 @@ | |||
| 157 | > | 157 | > |
| 158 | <FontAwesome iconName="edit" /> Submit Edit to {serviceName} | 158 | <FontAwesome iconName="edit" /> Submit Edit to {serviceName} |
| 159 | </a> | 159 | </a> |
| 160 | <a class="button-link" href="/submit"> | 160 | <a class="button-link" href="/submit/"> |
| 161 | <FontAwesome iconName="add" /> Add alternative | 161 | <FontAwesome iconName="add" /> Add alternative |
| 162 | </a> | 162 | </a> |
| 163 | </div> | 163 | </div> |
web/src/components/things/LatestUpdates.astro +3 −3
| @@ -59,7 +59,7 @@ const formatDate = (iso: string) => | |||
| 59 | <li> | 59 | <li> |
| 60 | <a | 60 | <a |
| 61 | class="service-link" | 61 | class="service-link" |
| 62 | href={`/${slugify(a.category)}/${slugify(a.section)}/${slugify(a.name)}`} | 62 | href={`/${slugify(a.category)}/${slugify(a.section)}/${slugify(a.name)}/`} |
| 63 | > | 63 | > |
| 64 | {a.service && ( | 64 | {a.service && ( |
| 65 | <ServiceIcon | 65 | <ServiceIcon |
| @@ -76,7 +76,7 @@ const formatDate = (iso: string) => | |||
| 76 | title={`In ${a.category}${a.author ? ` submitted by @${a.author}` : ''} on ${formatDate(a.date)}`} | 76 | title={`In ${a.category}${a.author ? ` submitted by @${a.author}` : ''} on ${formatDate(a.date)}`} |
| 77 | > | 77 | > |
| 78 | In{' '} | 78 | In{' '} |
| 79 | <a class="inline" href={`/${slugify(a.category)}`}> | 79 | <a class="inline" href={`/${slugify(a.category)}/`}> |
| 80 | {a.category} | 80 | {a.category} |
| 81 | </a> | 81 | </a> |
| 82 | {a.author && ( | 82 | {a.author && ( |
| @@ -99,7 +99,7 @@ const formatDate = (iso: string) => | |||
| 99 | ))} | 99 | ))} |
| 100 | </ul> | 100 | </ul> |
| 101 | <div class="footer"> | 101 | <div class="footer"> |
| 102 | <a class="small-button" href="/changelog"> | 102 | <a class="small-button" href="/changelog/"> |
| 103 | View full changelog → | 103 | View full changelog → |
| 104 | </a> | 104 | </a> |
| 105 | </div> | 105 | </div> |
web/src/components/things/ListingHero.astro +4 −4
| @@ -141,9 +141,9 @@ const highlights = [ | |||
| 141 | <div class="breadcrumbs"> | 141 | <div class="breadcrumbs"> |
| 142 | <span> | 142 | <span> |
| 143 | <a href="/">Awesome Privacy</a> | 143 | <a href="/">Awesome Privacy</a> |
| 144 | ➔ <a href={`/${catSlug}`}>{categoryName}</a> | 144 | ➔ <a href={`/${catSlug}/`}>{categoryName}</a> |
| 145 | ➔ <a href={`/${catSlug}/${secSlug}`}>{parentSection.name}</a> | 145 | ➔ <a href={`/${catSlug}/${secSlug}/`}>{parentSection.name}</a> |
| 146 | ➔ <a href={`/${catSlug}/${secSlug}/${slugify(name)}`}>{name}</a> | 146 | ➔ <a href={`/${catSlug}/${secSlug}/${slugify(name)}/`}>{name}</a> |
| 147 | </span> | 147 | </span> |
| 148 | </div> | 148 | </div> |
| 149 | <div class="save-listing"> | 149 | <div class="save-listing"> |
| @@ -197,7 +197,7 @@ const highlights = [ | |||
| 197 | <ul> | 197 | <ul> |
| 198 | {otherServices.map((s: Service) => ( | 198 | {otherServices.map((s: Service) => ( |
| 199 | <li> | 199 | <li> |
| 200 | <a href={`/${catSlug}/${secSlug}/${slugify(s.name)}`}> | 200 | <a href={`/${catSlug}/${secSlug}/${slugify(s.name)}/`}> |
| 201 | {s.name} | 201 | {s.name} |
| 202 | </a> | 202 | </a> |
| 203 | </li> | 203 | </li> |
web/src/components/things/SaveListing.svelte +1 −1
| @@ -59,7 +59,7 @@ | |||
| 59 | 59 | ||
| 60 | {#if showLabel && isSaved} | 60 | {#if showLabel && isSaved} |
| 61 | <div class="done-msg"> | 61 | <div class="done-msg"> |
| 62 | You can view all saved items in your <a href="/inventory">Inventory</a> | 62 | You can view all saved items in your <a href="/inventory/">Inventory</a> |
| 63 | </div> | 63 | </div> |
| 64 | {/if} | 64 | {/if} |
| 65 | </div> | 65 | </div> |
web/src/components/things/SavedServices.svelte +8 −6
| @@ -1,15 +1,14 @@ | |||
| 1 | <script lang="ts"> | 1 | <script lang="ts"> |
| 2 | import { onMount } from 'svelte'; | 2 | import { onMount } from 'svelte'; |
| 3 | 3 | ||
| 4 | import type { Category, Service } from '../../types/Service'; | 4 | import type { Service } from '../../types/Service'; |
| 5 | import { slugify } from '@utils/fetch-data'; | 5 | import { fetchCategories, slugify } from '@utils/fetch-data'; |
| 6 | import ServiceCard from './ServiceCard.svelte'; | 6 | import ServiceCard from './ServiceCard.svelte'; |
| 7 | 7 | ||
| 8 | interface Props { | 8 | interface Props { |
| 9 | allData: Category[]; | ||
| 10 | serviceList?: string[] | null; | 9 | serviceList?: string[] | null; |
| 11 | } | 10 | } |
| 12 | const { allData, serviceList = null }: Props = $props(); | 11 | const { serviceList = null }: Props = $props(); |
| 13 | 12 | ||
| 14 | interface SavedServices { | 13 | interface SavedServices { |
| 15 | category: string; | 14 | category: string; |
| @@ -20,9 +19,12 @@ | |||
| 20 | let savedServices: SavedServices[] = $state([]); | 19 | let savedServices: SavedServices[] = $state([]); |
| 21 | 20 | ||
| 22 | onMount(async () => { | 21 | onMount(async () => { |
| 23 | const results: SavedServices[] = []; | ||
| 24 | const saved = | 22 | const saved = |
| 25 | serviceList || JSON.parse(localStorage.getItem('savedServices') || '[]'); | 23 | serviceList || JSON.parse(localStorage.getItem('savedServices') || '[]'); |
| 24 | if (!saved.length) return; | ||
| 25 | |||
| 26 | const results: SavedServices[] = []; | ||
| 27 | const allData = await fetchCategories(); | ||
| 26 | saved.forEach((serviceId: string) => { | 28 | saved.forEach((serviceId: string) => { |
| 27 | const parts = serviceId.split('/'); | 29 | const parts = serviceId.split('/'); |
| 28 | const categoryName = parts[0]; | 30 | const categoryName = parts[0]; |
| @@ -70,7 +72,7 @@ | |||
| 70 | </small> | 72 | </small> |
| 71 | <p class="nope">Nothing saved yet!</p> | 73 | <p class="nope">Nothing saved yet!</p> |
| 72 | <div class="footer"> | 74 | <div class="footer"> |
| 73 | <a class="small-button" href="/all">Browse all entries →</a> | 75 | <a class="small-button" href="/all/">Browse all entries →</a> |
| 74 | </div> | 76 | </div> |
| 75 | </div> | 77 | </div> |
| 76 | {/if} | 78 | {/if} |
web/src/components/things/Search.svelte +11 −11
| @@ -1,32 +1,30 @@ | |||
| 1 | <script lang="ts"> | 1 | <script lang="ts"> |
| 2 | import { onMount } from 'svelte'; | 2 | import { onMount } from 'svelte'; |
| 3 | import Fuse from 'fuse.js'; | 3 | import Fuse from 'fuse.js'; |
| 4 | import { slugify } from '@utils/fetch-data'; | 4 | import { fetchCategories, slugify } from '@utils/fetch-data'; |
| 5 | import type { Category } from '../../types/Service'; | ||
| 6 | import { formatLink } from '@utils/parse-markdown'; | 5 | import { formatLink } from '@utils/parse-markdown'; |
| 7 | import { prepareSearchItems, searchOptions } from '@utils/do-searchy-searchy'; | 6 | import { prepareSearchItems, searchOptions } from '@utils/do-searchy-searchy'; |
| 8 | import type { SearchItem } from '@utils/do-searchy-searchy'; | 7 | import type { SearchItem } from '@utils/do-searchy-searchy'; |
| 9 | 8 | ||
| 10 | interface Props { | 9 | interface Props { |
| 11 | data: Category[]; | ||
| 12 | previousSearch?: string | undefined; | 10 | previousSearch?: string | undefined; |
| 13 | } | 11 | } |
| 14 | const { data, previousSearch = undefined }: Props = $props(); | 12 | const { previousSearch = undefined }: Props = $props(); |
| 15 | 13 | ||
| 16 | let fuse: Fuse<SearchItem> | null = $state(null); | 14 | let fuse: Fuse<SearchItem> | null = $state(null); |
| 17 | let searchQuery = $state(''); | 15 | let searchQuery = $state(''); |
| 18 | 16 | ||
| 19 | // Initialize Fuse.js | 17 | // Initialize Fuse.js |
| 20 | onMount(() => { | 18 | onMount(async () => { |
| 21 | const items = prepareSearchItems(data); | 19 | const items = prepareSearchItems(await fetchCategories()); |
| 22 | fuse = new Fuse(items, searchOptions); | 20 | fuse = new Fuse(items, searchOptions); |
| 23 | }); | 21 | }); |
| 24 | 22 | ||
| 25 | const makeResultLink = (cat?: string, sec?: string, itm?: string) => { | 23 | const makeResultLink = (cat?: string, sec?: string, itm?: string) => { |
| 26 | if (!cat) return '/'; | 24 | if (!cat) return '/'; |
| 27 | if (!sec) return `/${slugify(cat)}`; | 25 | if (!sec) return `/${slugify(cat)}/`; |
| 28 | if (!itm) return `/${slugify(cat)}/${slugify(sec)}`; | 26 | if (!itm) return `/${slugify(cat)}/${slugify(sec)}/`; |
| 29 | return `/${slugify(cat)}/${slugify(sec)}/${slugify(itm)}`; | 27 | return `/${slugify(cat)}/${slugify(sec)}/${slugify(itm)}/`; |
| 30 | }; | 28 | }; |
| 31 | 29 | ||
| 32 | const makeResultText = (cat?: string, sec?: string, itm?: string) => { | 30 | const makeResultText = (cat?: string, sec?: string, itm?: string) => { |
| @@ -71,7 +69,7 @@ | |||
| 71 | const active = results[activeIndex]; | 69 | const active = results[activeIndex]; |
| 72 | window.location.href = active | 70 | window.location.href = active |
| 73 | ? makeResultLink(active.category, active.sectionName, active.name) | 71 | ? makeResultLink(active.category, active.sectionName, active.name) |
| 74 | : `/search/${encodeURIComponent(searchQuery)}`; | 72 | : `/search/${encodeURIComponent(searchQuery)}/`; |
| 75 | } | 73 | } |
| 76 | if (event.key === 'Escape') { | 74 | if (event.key === 'Escape') { |
| 77 | searchQuery = ''; | 75 | searchQuery = ''; |
| @@ -100,7 +98,9 @@ | |||
| 100 | aria-expanded={results.length > 0} | 98 | aria-expanded={results.length > 0} |
| 101 | aria-controls="search-results" | 99 | aria-controls="search-results" |
| 102 | aria-autocomplete="list" | 100 | aria-autocomplete="list" |
| 103 | aria-activedescendant={activeIndex >= 0 ? `search-result-${activeIndex}` : undefined} | 101 | aria-activedescendant={activeIndex >= 0 |
| 102 | ? `search-result-${activeIndex}` | ||
| 103 | : undefined} | ||
| 104 | bind:value={searchQuery} | 104 | bind:value={searchQuery} |
| 105 | onkeydown={handleKeyDown} | 105 | onkeydown={handleKeyDown} |
| 106 | /> | 106 | /> |
web/src/components/things/SectionList.astro +2 −2
| @@ -23,7 +23,7 @@ const Heading = `h${headingLevel}` as 'h2' | 'h3'; | |||
| 23 | {title}{' '} | 23 | {title}{' '} |
| 24 | </h1> | 24 | </h1> |
| 25 | ) : ( | 25 | ) : ( |
| 26 | <a class="category-title" href={`/${slugify(title)}`}> | 26 | <a class="category-title" href={`/${slugify(title)}/`}> |
| 27 | <Heading>{title}</Heading> | 27 | <Heading>{title}</Heading> |
| 28 | </a> | 28 | </a> |
| 29 | ) | 29 | ) |
| @@ -41,7 +41,7 @@ const Heading = `h${headingLevel}` as 'h2' | 'h3'; | |||
| 41 | { | 41 | { |
| 42 | sections.map((section) => ( | 42 | sections.map((section) => ( |
| 43 | <li class="section"> | 43 | <li class="section"> |
| 44 | <a href={`/${slugify(title)}/${slugify(section.name)}`}> | 44 | <a href={`/${slugify(title)}/${slugify(section.name)}/`}> |
| 45 | <span>{section.name}</span> | 45 | <span>{section.name}</span> |
| 46 | <span class="service-count"> | 46 | <span class="service-count"> |
| 47 | ({section.services ? section.services.length : 0}) | 47 | ({section.services ? section.services.length : 0}) |
web/src/components/things/ServiceCard.astro +2 −2
| @@ -19,7 +19,7 @@ const { service, sectionName, categoryName } = Astro.props; | |||
| 19 | <div class="service-head"> | 19 | <div class="service-head"> |
| 20 | <a | 20 | <a |
| 21 | class="service-title" | 21 | class="service-title" |
| 22 | href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`} | 22 | href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}/`} |
| 23 | > | 23 | > |
| 24 | <h4>{service.name}</h4> | 24 | <h4>{service.name}</h4> |
| 25 | </a> | 25 | </a> |
| @@ -69,7 +69,7 @@ const { service, sectionName, categoryName } = Astro.props; | |||
| 69 | ) | 69 | ) |
| 70 | } | 70 | } |
| 71 | <a | 71 | <a |
| 72 | href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`} | 72 | href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}/`} |
| 73 | > | 73 | > |
| 74 | <FontAwesome iconName="viewReport" /> View Report ➔ | 74 | <FontAwesome iconName="viewReport" /> View Report ➔ |
| 75 | </a> | 75 | </a> |
web/src/components/things/ServiceCard.svelte +2 −2
| @@ -21,7 +21,7 @@ | |||
| 21 | <div class="service-head"> | 21 | <div class="service-head"> |
| 22 | <a | 22 | <a |
| 23 | class="service-title" | 23 | class="service-title" |
| 24 | href={`/${categorySlug}/${sectionSlug}/${serviceRef}`} | 24 | href={`/${categorySlug}/${sectionSlug}/${serviceRef}/`} |
| 25 | > | 25 | > |
| 26 | <h4>{service.name}</h4> | 26 | <h4>{service.name}</h4> |
| 27 | </a> | 27 | </a> |
| @@ -90,7 +90,7 @@ | |||
| 90 | <FontAwesome iconName="sourceCode" /> Source | 90 | <FontAwesome iconName="sourceCode" /> Source |
| 91 | </a> | 91 | </a> |
| 92 | {/if} | 92 | {/if} |
| 93 | <a href={`/${categorySlug}/${sectionSlug}/${serviceRef}`}> | 93 | <a href={`/${categorySlug}/${sectionSlug}/${serviceRef}/`}> |
| 94 | <FontAwesome iconName="viewReport" /> View Report ➔ | 94 | <FontAwesome iconName="viewReport" /> View Report ➔ |
| 95 | </a> | 95 | </a> |
| 96 | </div> | 96 | </div> |
web/src/components/things/ServiceList.astro +3 −3
| @@ -62,7 +62,7 @@ const sortedServices = [...(services || [])].sort((a, b) => | |||
| 62 | 62 | ||
| 63 | <a | 63 | <a |
| 64 | class="service-title" | 64 | class="service-title" |
| 65 | href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`} | 65 | href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}/`} |
| 66 | > | 66 | > |
| 67 | {subHeading ? <h3>{service.name}</h3> : <h2>{service.name}</h2>} | 67 | {subHeading ? <h3>{service.name}</h3> : <h2>{service.name}</h2>} |
| 68 | </a> | 68 | </a> |
| @@ -160,7 +160,7 @@ const sortedServices = [...(services || [])].sort((a, b) => | |||
| 160 | </div> | 160 | </div> |
| 161 | <div class="view-service"> | 161 | <div class="view-service"> |
| 162 | <a | 162 | <a |
| 163 | href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`} | 163 | href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}/`} |
| 164 | > | 164 | > |
| 165 | View {service.name} Report | 165 | View {service.name} Report |
| 166 | </a> | 166 | </a> |
| @@ -180,7 +180,7 @@ const sortedServices = [...(services || [])].sort((a, b) => | |||
| 180 | GitHub. | 180 | GitHub. |
| 181 | <br /> | 181 | <br /> |
| 182 | <span class="quick-submit"> | 182 | <span class="quick-submit"> |
| 183 | Or submit an entry <a href="/submit">here</a> | 183 | Or submit an entry <a href="/submit/">here</a> |
| 184 | </span> | 184 | </span> |
| 185 | </p> | 185 | </p> |
| 186 | ) | 186 | ) |
web/src/components/things/SmartSuggestions.svelte +5 −5
| @@ -1,8 +1,8 @@ | |||
| 1 | <script lang="ts"> | 1 | <script lang="ts"> |
| 2 | import { onMount } from 'svelte'; | 2 | import { onMount } from 'svelte'; |
| 3 | import type { Category, Service } from '../../types/Service'; | 3 | import type { Service } from '../../types/Service'; |
| 4 | import { formatLink } from '@utils/parse-markdown'; | 4 | import { formatLink } from '@utils/parse-markdown'; |
| 5 | import { slugify } from '@utils/fetch-data'; | 5 | import { fetchCategories, slugify } from '@utils/fetch-data'; |
| 6 | import { apiBase } from '@utils/api-config'; | 6 | import { apiBase } from '@utils/api-config'; |
| 7 | 7 | ||
| 8 | interface ServiceResult extends Service { | 8 | interface ServiceResult extends Service { |
| @@ -10,10 +10,9 @@ | |||
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | interface Props { | 12 | interface Props { |
| 13 | categories: Category[]; | ||
| 14 | searchTerm: string; | 13 | searchTerm: string; |
| 15 | } | 14 | } |
| 16 | const { categories, searchTerm }: Props = $props(); | 15 | const { searchTerm }: Props = $props(); |
| 17 | 16 | ||
| 18 | let results: ServiceResult[] = $state([]); | 17 | let results: ServiceResult[] = $state([]); |
| 19 | 18 | ||
| @@ -29,11 +28,12 @@ | |||
| 29 | ); | 28 | ); |
| 30 | 29 | ||
| 31 | const tmpResults: ServiceResult[] = []; | 30 | const tmpResults: ServiceResult[] = []; |
| 31 | const categories = await fetchCategories(); | ||
| 32 | categories.forEach((category) => { | 32 | categories.forEach((category) => { |
| 33 | (category.sections || []).forEach((section) => { | 33 | (category.sections || []).forEach((section) => { |
| 34 | (section.services || []).forEach((service) => { | 34 | (section.services || []).forEach((service) => { |
| 35 | if (fetchedServices.includes(normalize(service.name))) { | 35 | if (fetchedServices.includes(normalize(service.name))) { |
| 36 | const path = `/${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}`; | 36 | const path = `/${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}/`; |
| 37 | tmpResults.push({ ...service, path }); | 37 | tmpResults.push({ ...service, path }); |
| 38 | return; | 38 | return; |
| 39 | } | 39 | } |
web/src/layouts/Layout.astro +18 −13
| @@ -27,6 +27,15 @@ const { | |||
| 27 | customSchemaJson, | 27 | customSchemaJson, |
| 28 | } = Astro.props; | 28 | } = Astro.props; |
| 29 | 29 | ||
| 30 | // Crumbs arrive as '/', 'api' or 'category/section', so normalise to a canonical URL | ||
| 31 | const crumbUrl = (item: string) => { | ||
| 32 | const path = item.replace(/^\/+|\/+$/g, ''); | ||
| 33 | return `https://awesome-privacy.xyz/${path && `${path}/`}`; | ||
| 34 | }; | ||
| 35 | |||
| 36 | // Always advertise the trailing-slash form, so server-rendered routes agree with the sitemap | ||
| 37 | const canonical = crumbUrl(Astro.url.pathname); | ||
| 38 | |||
| 30 | const makeBreadcrumbs = () => { | 39 | const makeBreadcrumbs = () => { |
| 31 | if (!breadcrumbs) return null; | 40 | if (!breadcrumbs) return null; |
| 32 | return { | 41 | return { |
| @@ -36,7 +45,7 @@ const makeBreadcrumbs = () => { | |||
| 36 | '@type': 'ListItem', | 45 | '@type': 'ListItem', |
| 37 | position: index + 1, | 46 | position: index + 1, |
| 38 | name: breadcrumb.name, | 47 | name: breadcrumb.name, |
| 39 | item: `https://awesome-privacy.xyz/${breadcrumb.item}`, | 48 | item: crumbUrl(breadcrumb.item), |
| 40 | })), | 49 | })), |
| 41 | }; | 50 | }; |
| 42 | }; | 51 | }; |
| @@ -52,7 +61,7 @@ const makeSearchLd = () => { | |||
| 52 | target: { | 61 | target: { |
| 53 | '@type': 'EntryPoint', | 62 | '@type': 'EntryPoint', |
| 54 | urlTemplate: | 63 | urlTemplate: |
| 55 | 'https://awesome-privacy.xyz/search?q={search_term_string}', | 64 | 'https://awesome-privacy.xyz/search/{search_term_string}/', |
| 56 | }, | 65 | }, |
| 57 | 'query-input': 'required name=search_term_string', | 66 | 'query-input': 'required name=search_term_string', |
| 58 | }, | 67 | }, |
| @@ -67,7 +76,9 @@ const makeSearchLd = () => { | |||
| 67 | <script is:inline> | 76 | <script is:inline> |
| 68 | const setTheme = () => { | 77 | const setTheme = () => { |
| 69 | const stored = localStorage.getItem('theme'); | 78 | const stored = localStorage.getItem('theme'); |
| 70 | const prefersLight = matchMedia('(prefers-color-scheme: light)').matches; | 79 | const prefersLight = matchMedia( |
| 80 | '(prefers-color-scheme: light)', | ||
| 81 | ).matches; | ||
| 71 | document.documentElement.dataset.theme = | 82 | document.documentElement.dataset.theme = |
| 72 | stored || (prefersLight ? 'light' : 'dark'); | 83 | stored || (prefersLight ? 'light' : 'dark'); |
| 73 | }; | 84 | }; |
| @@ -90,10 +101,7 @@ const makeSearchLd = () => { | |||
| 90 | content={`Built by an actual human, in Astro. ${Astro.generator}`} | 101 | content={`Built by an actual human, in Astro. ${Astro.generator}`} |
| 91 | /> | 102 | /> |
| 92 | <meta name="robots" content="index, follow" /> | 103 | <meta name="robots" content="index, follow" /> |
| 93 | <link | 104 | <link rel="canonical" href={canonical} /> |
| 94 | rel="canonical" | ||
| 95 | href={`https://awesome-privacy.xyz${Astro.url.pathname}`} | ||
| 96 | /> | ||
| 97 | <link | 105 | <link |
| 98 | rel="alternate" | 106 | rel="alternate" |
| 99 | type="application/rss+xml" | 107 | type="application/rss+xml" |
| @@ -125,10 +133,7 @@ const makeSearchLd = () => { | |||
| 125 | <!-- Social media meta tags (Open Graphh + Twitter) --> | 133 | <!-- Social media meta tags (Open Graphh + Twitter) --> |
| 126 | <meta property="og:site_name" content="Awesome Privacy" /> | 134 | <meta property="og:site_name" content="Awesome Privacy" /> |
| 127 | <meta property="og:type" content="website" /> | 135 | <meta property="og:type" content="website" /> |
| 128 | <meta | 136 | <meta property="og:url" content={canonical} /> |
| 129 | property="og:url" | ||
| 130 | content={`https://awesome-privacy.xyz${Astro.url.pathname}`} | ||
| 131 | /> | ||
| 132 | <meta property="og:title" content={title} /> | 137 | <meta property="og:title" content={title} /> |
| 133 | <meta property="og:description" content={description} /> | 138 | <meta property="og:description" content={description} /> |
| 134 | <meta | 139 | <meta |
| @@ -252,8 +257,8 @@ const makeSearchLd = () => { | |||
| 252 | ::after { | 257 | ::after { |
| 253 | animation-duration: 0.01ms !important; | 258 | animation-duration: 0.01ms !important; |
| 254 | animation-iteration-count: 1 !important; | 259 | animation-iteration-count: 1 !important; |
| 255 | transition-property: color, background-color, border-color, box-shadow, | 260 | transition-property: |
| 256 | opacity !important; | 261 | color, background-color, border-color, box-shadow, opacity !important; |
| 257 | } | 262 | } |
| 258 | } | 263 | } |
| 259 | 264 | ||
web/src/pages/404.astro +3 −3
| @@ -16,13 +16,13 @@ import Buton from '@components/form/Button.astro'; | |||
| 16 | Looking for somewhere else? | 16 | Looking for somewhere else? |
| 17 | <ul> | 17 | <ul> |
| 18 | <li> | 18 | <li> |
| 19 | <a href="/search">Search</a> | 19 | <a href="/search/">Search</a> |
| 20 | </li> | 20 | </li> |
| 21 | <li> | 21 | <li> |
| 22 | <a href="/browse">Browse</a> | 22 | <a href="/browse/">Browse</a> |
| 23 | </li> | 23 | </li> |
| 24 | <li> | 24 | <li> |
| 25 | <a href="/about">About</a> | 25 | <a href="/about/">About</a> |
| 26 | </li> | 26 | </li> |
| 27 | <li> | 27 | <li> |
| 28 | <a href="https://github.com/lissy93/awesome-privacy">Source</a> | 28 | <a href="https://github.com/lissy93/awesome-privacy">Source</a> |
web/src/pages/[...listing].astro +14 −19
| @@ -17,6 +17,7 @@ import DataActions from '@components/things/DataActions.svelte'; | |||
| 17 | import type { AwesomePrivacy, Section, Service } from '../types/Service'; | 17 | import type { AwesomePrivacy, Section, Service } from '../types/Service'; |
| 18 | import { fetchData, slugify } from '@utils/fetch-data'; | 18 | import { fetchData, slugify } from '@utils/fetch-data'; |
| 19 | import { codebergUrl } from '@utils/parse-markdown'; | 19 | import { codebergUrl } from '@utils/parse-markdown'; |
| 20 | import { plainText, truncate } from '@utils/meta-tags'; | ||
| 20 | import { fetchChangelog } from '@utils/fetch-changelog'; | 21 | import { fetchChangelog } from '@utils/fetch-changelog'; |
| 21 | import { fetchGitHubStats } from '@utils/fetch-repo-info'; | 22 | import { fetchGitHubStats } from '@utils/fetch-repo-info'; |
| 22 | import { fetchSecurityReport } from '@utils/fetch-security-info'; | 23 | import { fetchSecurityReport } from '@utils/fetch-security-info'; |
| @@ -91,16 +92,14 @@ const makeBreadcrumbs = () => { | |||
| 91 | ]; | 92 | ]; |
| 92 | }; | 93 | }; |
| 93 | 94 | ||
| 95 | const plainDescription = plainText(description); | ||
| 96 | |||
| 94 | const makeDescriptionTag = () => { | 97 | const makeDescriptionTag = () => { |
| 95 | let desc = `Analysis of ${name}, and other privacy-respecting ${parentSection.name} `; | 98 | const summary = `${name}: ${plainDescription}`.replace(/([^.!?])$/, '$1.'); |
| 96 | if (parentSection.services) { | 99 | if (summary.length >= 120) return truncate(summary); |
| 97 | desc += `Compare ${parentSection.services.map((s: Service) => s.name).join(' vs ')} more apps. `; | 100 | return truncate( |
| 98 | } | 101 | `${summary} Compare it with other private ${parentSection.name.toLowerCase()} on Awesome Privacy.`, |
| 99 | if (parentSection.alternativeTo && parentSection.alternativeTo.length > 0) { | 102 | ); |
| 100 | desc += `The best secure encrypted alternatives to ${parentSection.alternativeTo.join(', ')}. `; | ||
| 101 | } | ||
| 102 | desc += 'All this, and many more free and awesome tools and software.'; | ||
| 103 | return desc; | ||
| 104 | }; | 103 | }; |
| 105 | 104 | ||
| 106 | const filterServices = () => { | 105 | const filterServices = () => { |
| @@ -243,10 +242,6 @@ const makeSoftwareSchema = () => { | |||
| 243 | androidApp && 'Android', | 242 | androidApp && 'Android', |
| 244 | url && 'Web', | 243 | url && 'Web', |
| 245 | ].filter(Boolean); | 244 | ].filter(Boolean); |
| 246 | const plainDescription = (description || '') | ||
| 247 | .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') | ||
| 248 | .replace(/[*_`~]/g, '') | ||
| 249 | .trim(); | ||
| 250 | const codeRepository = github | 245 | const codeRepository = github |
| 251 | ? `https://github.com/${github}` | 246 | ? `https://github.com/${github}` |
| 252 | : codeberg | 247 | : codeberg |
| @@ -365,7 +360,7 @@ const makeSoftwareSchema = () => { | |||
| 365 | services={filterServices()} | 360 | services={filterServices()} |
| 366 | subHeading={true} | 361 | subHeading={true} |
| 367 | noGitHubMetrics={true} | 362 | noGitHubMetrics={true} |
| 368 | buttonLink={`/${catSlug}/${secSlug}`} | 363 | buttonLink={`/${catSlug}/${secSlug}/`} |
| 369 | categoryName={categoryName} | 364 | categoryName={categoryName} |
| 370 | sectionName={parentSection.name} | 365 | sectionName={parentSection.name} |
| 371 | /> | 366 | /> |
| @@ -389,7 +384,7 @@ const makeSoftwareSchema = () => { | |||
| 389 | <p> | 384 | <p> |
| 390 | The REST API is free, no-auth and CORS-enabled. To learn more, view the <a | 385 | The REST API is free, no-auth and CORS-enabled. To learn more, view the <a |
| 391 | href={`${apiBase}/docs`}>API Docs</a | 386 | href={`${apiBase}/docs`}>API Docs</a |
| 392 | > or read the <a href="/about#api">API Usage Guide</a>. | 387 | > or read the <a href="/about/#api">API Usage Guide</a>. |
| 393 | </p> | 388 | </p> |
| 394 | </section> | 389 | </section> |
| 395 | 390 | ||
| @@ -401,7 +396,7 @@ const makeSoftwareSchema = () => { | |||
| 401 | Share {name} and Awesome Privacy with your network! | 396 | Share {name} and Awesome Privacy with your network! |
| 402 | <div> | 397 | <div> |
| 403 | <SocialShare | 398 | <SocialShare |
| 404 | url={`${site}/${catSlug}/${secSlug}/${slugify(name)} `} | 399 | url={`${site}/${catSlug}/${secSlug}/${slugify(name)}/`} |
| 405 | title={`Checkout ${name}! \n`} | 400 | title={`Checkout ${name}! \n`} |
| 406 | description={`Compare #${name} and other privacy-respecting ${parentSection.name} at ` + | 401 | description={`Compare #${name} and other privacy-respecting ${parentSection.name} at ` + |
| 407 | `Awesome-Privacy.xyz, the free and open source list of private software alternatives. ` + | 402 | `Awesome-Privacy.xyz, the free and open source list of private software alternatives. ` + |
| @@ -414,7 +409,7 @@ const makeSoftwareSchema = () => { | |||
| 414 | <div class="pagination-navigation"> | 409 | <div class="pagination-navigation"> |
| 415 | { | 410 | { |
| 416 | previous ? ( | 411 | previous ? ( |
| 417 | <Button url={`/${catSlug}/${secSlug}/${slugify(previous)}`}> | 412 | <Button url={`/${catSlug}/${secSlug}/${slugify(previous)}/`}> |
| 418 | <span>← Previous</span> | 413 | <span>← Previous</span> |
| 419 | <p>{previous}</p> | 414 | <p>{previous}</p> |
| 420 | </Button> | 415 | </Button> |
| @@ -422,12 +417,12 @@ const makeSoftwareSchema = () => { | |||
| 422 | <p class="nothing" /> | 417 | <p class="nothing" /> |
| 423 | ) | 418 | ) |
| 424 | } | 419 | } |
| 425 | <a href={`/${catSlug}/${secSlug}`} class="go-to-category"> | 420 | <a href={`/${catSlug}/${secSlug}/`} class="go-to-category"> |
| 426 | View {parentSection.name} ({(parentSection.services || []).length}) | 421 | View {parentSection.name} ({(parentSection.services || []).length}) |
| 427 | </a> | 422 | </a> |
| 428 | { | 423 | { |
| 429 | next && ( | 424 | next && ( |
| 430 | <Button url={`/${catSlug}/${secSlug}/${slugify(next)}`}> | 425 | <Button url={`/${catSlug}/${secSlug}/${slugify(next)}/`}> |
| 431 | <span>Next →</span> | 426 | <span>Next →</span> |
| 432 | <p>{next}</p> | 427 | <p>{next}</p> |
| 433 | </Button> | 428 | </Button> |
web/src/pages/[...section].astro +24 −27
| @@ -8,6 +8,7 @@ import ServiceList from '@components/things/ServiceList.astro'; | |||
| 8 | import type { AwesomePrivacy, Section, Service, ShortService } from '../types/Service'; | 8 | import type { AwesomePrivacy, Section, Service, ShortService } from '../types/Service'; |
| 9 | import { fetchData, slugify } from '@utils/fetch-data'; | 9 | import { fetchData, slugify } from '@utils/fetch-data'; |
| 10 | import { parseMarkdown } from '@utils/parse-markdown'; | 10 | import { parseMarkdown } from '@utils/parse-markdown'; |
| 11 | import { truncate } from '@utils/meta-tags'; | ||
| 11 | 12 | ||
| 12 | interface Props { | 13 | interface Props { |
| 13 | slug: string, | 14 | slug: string, |
| @@ -66,38 +67,34 @@ const makeBreadcrumbs = () => { | |||
| 66 | * Make a string page intro, for the description tag | 67 | * Make a string page intro, for the description tag |
| 67 | */ | 68 | */ |
| 68 | const makeDescriptionTag = () => { | 69 | const makeDescriptionTag = () => { |
| 69 | let description = `Privacy respecting ${title}. `; | 70 | let description = `Privacy-respecting ${title}. `; |
| 70 | if (services && services.length > 0) { | 71 | if (services && services.length > 0) { |
| 71 | const serviceList = services.map((serv: Service) => serv.name); | 72 | description += `Compare ${services.map((serv: Service) => serv.name).join(', ')}. `; |
| 72 | description += `Compare ${serviceList.join(' vs ')} and more private, open source apps and services now. ` | ||
| 73 | } else { | 73 | } else { |
| 74 | description += `Find private apps and services. This section is still a work in progress. `; | 74 | description += `Find private apps and services. This section is still a work in progress. `; |
| 75 | } | 75 | } |
| 76 | if (alternativeTo && alternativeTo.length > 0) { | 76 | if (alternativeTo && alternativeTo.length > 0) { |
| 77 | description += `The best secure encrypted alternatives to ${alternativeTo.join(', ')} in 2024. `; | 77 | description += `The best secure, encrypted alternatives to ${alternativeTo.join(', ')}.`; |
| 78 | } | 78 | } |
| 79 | description += 'All this, and many more free and awesome tools and software.' | 79 | return truncate(description.trim()); |
| 80 | return description; | ||
| 81 | }; | 80 | }; |
| 82 | 81 | ||
| 83 | const makeCarasolData = () => { | 82 | const makeCarasolData = () => { |
| 84 | return { | 83 | return { |
| 85 | "@context": "https://schema.org", | 84 | "@context": "https://schema.org", |
| 86 | "@type": "ItemList", | 85 | "@type": "ItemList", |
| 87 | "itemListElement": [ | 86 | "itemListElement": services.map((service, index) => ({ |
| 88 | services.map((service, index) => ({ | 87 | "@type": "ListItem", |
| 89 | "@type": "ListItem", | 88 | "position": index + 1, |
| 90 | "position": index + 1, | 89 | "url": `https://awesome-privacy.xyz/${slugify(categoryName)}/${slugify(title)}/${slugify(service.name)}/`, |
| 91 | "url": `https://awesome-privacy.xyz/${slugify(categoryName)}/${slugify(title)}/${slugify(service.name)}`, | 90 | "item": { |
| 92 | "item": { | 91 | "@type": "Service", |
| 93 | "@type": "Service", | 92 | "name": service.name, |
| 94 | "name": service.name, | 93 | "description": service.description, |
| 95 | "description": service.description, | 94 | "image": service.icon, |
| 96 | "image": service.icon, | 95 | "url": `https://awesome-privacy.xyz/${slugify(categoryName)}/${slugify(title)}/${slugify(service.name)}/` |
| 97 | "url": `https://awesome-privacy.xyz/${slugify(categoryName)}/${slugify(title)}/${slugify(service.name)}` | 96 | } |
| 98 | } | 97 | })) |
| 99 | })), | ||
| 100 | ] | ||
| 101 | } | 98 | } |
| 102 | }; | 99 | }; |
| 103 | 100 | ||
| @@ -151,8 +148,8 @@ const { previous, next } = makePaginationLinks(); | |||
| 151 | <div class="breadcrumbs"> | 148 | <div class="breadcrumbs"> |
| 152 | <span> | 149 | <span> |
| 153 | <a href="/">Awesome Privacy</a> | 150 | <a href="/">Awesome Privacy</a> |
| 154 | ➔ <a href={`/${slugify(categoryName)}`}>{categoryName}</a> | 151 | ➔ <a href={`/${slugify(categoryName)}/`}>{categoryName}</a> |
| 155 | ➔ <a href={`/${slugify(categoryName)}/${slugify(title)}`}>{title}</a> | 152 | ➔ <a href={`/${slugify(categoryName)}/${slugify(title)}/`}>{title}</a> |
| 156 | </span> | 153 | </span> |
| 157 | </div> | 154 | </div> |
| 158 | 155 | ||
| @@ -177,7 +174,7 @@ const { previous, next } = makePaginationLinks(); | |||
| 177 | </p> | 174 | </p> |
| 178 | <p> | 175 | <p> |
| 179 | Discover the best {title} tools for Android, iPhone, Linux, PC and Chrome to download now. | 176 | Discover the best {title} tools for Android, iPhone, Linux, PC and Chrome to download now. |
| 180 | And choose secure, self-hosted, peer-to-peer and independant alternatives in 2024 | 177 | And choose secure, self-hosted, peer-to-peer and independant alternatives |
| 181 | </p> | 178 | </p> |
| 182 | <p> | 179 | <p> |
| 183 | <b>Stop the invasion of privacy from big tech, improve data security stay safe.</b> | 180 | <b>Stop the invasion of privacy from big tech, improve data security stay safe.</b> |
| @@ -223,23 +220,23 @@ const { previous, next } = makePaginationLinks(); | |||
| 223 | <h2>Submit New Entry</h2> | 220 | <h2>Submit New Entry</h2> |
| 224 | <p> | 221 | <p> |
| 225 | Are we missing anything? | 222 | Are we missing anything? |
| 226 | You can help us improve this page, by <a href="/submit">submitting a new entry</a> | 223 | You can help us improve this page, by <a href="/submit/">submitting a new entry</a> |
| 227 | </p> | 224 | </p> |
| 228 | </section> | 225 | </section> |
| 229 | )} | 226 | )} |
| 230 | 227 | ||
| 231 | <div class="pagination-navigation"> | 228 | <div class="pagination-navigation"> |
| 232 | { previous ? ( | 229 | { previous ? ( |
| 233 | <Button url={`/${slugify(categoryName)}/${slugify(previous)}`}> | 230 | <Button url={`/${slugify(categoryName)}/${slugify(previous)}/`}> |
| 234 | <span>← Previous</span> | 231 | <span>← Previous</span> |
| 235 | <p>{previous}</p> | 232 | <p>{previous}</p> |
| 236 | </Button> | 233 | </Button> |
| 237 | ) : <p class="nothing"></p>} | 234 | ) : <p class="nothing"></p>} |
| 238 | <a href={`/${slugify(categoryName)}`} class="go-to-category"> | 235 | <a href={`/${slugify(categoryName)}/`} class="go-to-category"> |
| 239 | View all in {categoryName} ({otherSections.length}) | 236 | View all in {categoryName} ({otherSections.length}) |
| 240 | </a> | 237 | </a> |
| 241 | { next && ( | 238 | { next && ( |
| 242 | <Button url={`/${slugify(categoryName)}/${slugify(next)}`}> | 239 | <Button url={`/${slugify(categoryName)}/${slugify(next)}/`}> |
| 243 | <span>Next →</span> | 240 | <span>Next →</span> |
| 244 | <p>{next}</p> | 241 | <p>{next}</p> |
| 245 | </Button> | 242 | </Button> |
web/src/pages/[category].astro +14 −16
| @@ -40,18 +40,16 @@ const makeCarasolData = () => { | |||
| 40 | return { | 40 | return { |
| 41 | '@context': 'https://schema.org', | 41 | '@context': 'https://schema.org', |
| 42 | '@type': 'ItemList', | 42 | '@type': 'ItemList', |
| 43 | itemListElement: [ | 43 | itemListElement: sections.map((section, index) => ({ |
| 44 | sections.map((section, index) => ({ | 44 | '@type': 'ListItem', |
| 45 | '@type': 'ListItem', | 45 | position: index + 1, |
| 46 | position: index + 1, | 46 | url: `https://awesome-privacy.xyz/${slugify(title)}/${slugify(section.name)}/`, |
| 47 | url: `https://awesome-privacy.xyz/${slugify(title)}/${slugify(section.name)}`, | 47 | item: { |
| 48 | item: { | 48 | '@type': 'Service', |
| 49 | '@type': 'Service', | 49 | name: section.name, |
| 50 | name: section.name, | 50 | url: `https://awesome-privacy.xyz/${slugify(title)}/${slugify(section.name)}/`, |
| 51 | url: `https://awesome-privacy.xyz/${slugify(title)}/${slugify(section.name)}`, | 51 | }, |
| 52 | }, | 52 | })), |
| 53 | })), | ||
| 54 | ], | ||
| 55 | }; | 53 | }; |
| 56 | }; | 54 | }; |
| 57 | 55 | ||
| @@ -82,15 +80,15 @@ const { previous, next } = makePaginationLinks(); | |||
| 82 | <div class="breadcrumbs"> | 80 | <div class="breadcrumbs"> |
| 83 | <span> | 81 | <span> |
| 84 | <a href="/">Awesome Privacy</a> | 82 | <a href="/">Awesome Privacy</a> |
| 85 | ➔ <a href={`/${slugify(title)}`}>{title}</a> | 83 | ➔ <a href={`/${slugify(title)}/`}>{title}</a> |
| 86 | </span> | 84 | </span> |
| 87 | </div> | 85 | </div> |
| 88 | <SectionList title={title} sections={sections} bigTitle={true} /> | 86 | <SectionList title={title} sections={sections} bigTitle={true} /> |
| 89 | Or, <a href={`/all#${slugify(title)}`}>Browse All {title}</a> | 87 | Or, <a href={`/all/#${slugify(title)}`}>Browse All {title}</a> |
| 90 | <div class="pagination-navigation"> | 88 | <div class="pagination-navigation"> |
| 91 | { | 89 | { |
| 92 | previous ? ( | 90 | previous ? ( |
| 93 | <Button url={`/${slugify(previous)}`}> | 91 | <Button url={`/${slugify(previous)}/`}> |
| 94 | <span>← Previous</span> | 92 | <span>← Previous</span> |
| 95 | <p>{previous}</p> | 93 | <p>{previous}</p> |
| 96 | </Button> | 94 | </Button> |
| @@ -100,7 +98,7 @@ const { previous, next } = makePaginationLinks(); | |||
| 100 | } | 98 | } |
| 101 | { | 99 | { |
| 102 | next && ( | 100 | next && ( |
| 103 | <Button url={`/${slugify(next)}`}> | 101 | <Button url={`/${slugify(next)}/`}> |
| 104 | <span>Next →</span> | 102 | <span>Next →</span> |
| 105 | <p>{next}</p> | 103 | <p>{next}</p> |
| 106 | </Button> | 104 | </Button> |
web/src/pages/all.astro +3 −3
| @@ -49,13 +49,13 @@ const categories = (await fetchData() as AwesomePrivacy)?.categories || []; | |||
| 49 | <Fragment> | 49 | <Fragment> |
| 50 | <h2 id={slugify(category.name)}> | 50 | <h2 id={slugify(category.name)}> |
| 51 | <FontAwesome iconName={slugify(category.name)} /> | 51 | <FontAwesome iconName={slugify(category.name)} /> |
| 52 | <a href={`/${slugify(category.name)}`}>{category.name}</a> | 52 | <a href={`/${slugify(category.name)}/`}>{category.name}</a> |
| 53 | </h2> | 53 | </h2> |
| 54 | <article> | 54 | <article> |
| 55 | {category.sections.map((section: Section) => ( | 55 | {category.sections.map((section: Section) => ( |
| 56 | <Fragment> | 56 | <Fragment> |
| 57 | <h3 id={`${slugify(category.name)}-${slugify(section.name)}`}> | 57 | <h3 id={`${slugify(category.name)}-${slugify(section.name)}`}> |
| 58 | <a href={`/${slugify(category.name)}/${slugify(section.name)}`}> | 58 | <a href={`/${slugify(category.name)}/${slugify(section.name)}/`}> |
| 59 | {section.name} | 59 | {section.name} |
| 60 | </a> | 60 | </a> |
| 61 | </h3> | 61 | </h3> |
| @@ -74,7 +74,7 @@ const categories = (await fetchData() as AwesomePrivacy)?.categories || []; | |||
| 74 | <strong>This section is still a work in progress</strong><br /> | 74 | <strong>This section is still a work in progress</strong><br /> |
| 75 | Check back soon, or help us complete it by submitting a | 75 | Check back soon, or help us complete it by submitting a |
| 76 | <a href="https://github.com/lissy93/awesome-privacy">pull request</a> | 76 | <a href="https://github.com/lissy93/awesome-privacy">pull request</a> |
| 77 | or <a href="/submit">entry</a>. | 77 | or <a href="/submit/">entry</a>. |
| 78 | </p> | 78 | </p> |
| 79 | </div> | 79 | </div> |
| 80 | )} | 80 | )} |
web/src/pages/browse.astro +8 −4
| @@ -23,7 +23,7 @@ const categories: Category[] = (await fetchData())?.categories; | |||
| 23 | </span> | 23 | </span> |
| 24 | </div> | 24 | </div> |
| 25 | <p class="sitemap-link"> | 25 | <p class="sitemap-link"> |
| 26 | Not sure what you're looking for? Take a look through <a href="/all" | 26 | Not sure what you're looking for? Take a look through <a href="/all/" |
| 27 | >all listings</a | 27 | >all listings</a |
| 28 | > | 28 | > |
| 29 | </p> | 29 | </p> |
| @@ -32,7 +32,11 @@ const categories: Category[] = (await fetchData())?.categories; | |||
| 32 | { | 32 | { |
| 33 | categories.map((category) => ( | 33 | categories.map((category) => ( |
| 34 | <li class="category"> | 34 | <li class="category"> |
| 35 | <SectionList title={category.name} sections={category.sections} headingLevel={2} /> | 35 | <SectionList |
| 36 | title={category.name} | ||
| 37 | sections={category.sections} | ||
| 38 | headingLevel={2} | ||
| 39 | /> | ||
| 36 | </li> | 40 | </li> |
| 37 | )) | 41 | )) |
| 38 | } | 42 | } |
| @@ -40,7 +44,7 @@ const categories: Category[] = (await fetchData())?.categories; | |||
| 40 | 44 | ||
| 41 | <div class="no-results"> | 45 | <div class="no-results"> |
| 42 | <p class="zilch">Nothing found 😢</p> | 46 | <p class="zilch">Nothing found 😢</p> |
| 43 | <p>Try a <a href="/search">deep search</a> instead</p> | 47 | <p>Try a <a href="/search/">deep search</a> instead</p> |
| 44 | </div> | 48 | </div> |
| 45 | </Layout> | 49 | </Layout> |
| 46 | 50 | ||
| @@ -100,7 +104,7 @@ const categories: Category[] = (await fetchData())?.categories; | |||
| 100 | searchInput.addEventListener('keydown', function (event) { | 104 | searchInput.addEventListener('keydown', function (event) { |
| 101 | if (event.key === 'Enter') { | 105 | if (event.key === 'Enter') { |
| 102 | event.preventDefault(); | 106 | event.preventDefault(); |
| 103 | window.location.href = `/search/${encodeURIComponent(searchInput.value.trim())}`; | 107 | window.location.href = `/search/${encodeURIComponent(searchInput.value.trim())}/`; |
| 104 | } | 108 | } |
| 105 | if (event.key === 'Escape') { | 109 | if (event.key === 'Escape') { |
| 106 | searchInput.value = ''; | 110 | searchInput.value = ''; |
web/src/pages/index.astro +12 −15
| @@ -12,22 +12,19 @@ import type { Category } from 'src/types/Service'; | |||
| 12 | const categories = (await fetchData())?.categories || ([] as Category[]); | 12 | const categories = (await fetchData())?.categories || ([] as Category[]); |
| 13 | 13 | ||
| 14 | const description = | 14 | const description = |
| 15 | 'Privacy is a fundamental human right; ' + | 15 | 'Find privacy-respecting alternatives to the apps and services you use every day. ' + |
| 16 | "without it, we're just open books in a world where everyone's " + | 16 | 'A curated directory of open source, secure and ad-free software.'; |
| 17 | "watching. Let's take control back.\n" + | ||
| 18 | 'Migrating open-source applications which do not collect, sell or log your data is a great first step.' + | ||
| 19 | 'Awesome Privacy is a directory of alternative privacy-respecting software and services.'; | ||
| 20 | --- | 17 | --- |
| 21 | 18 | ||
| 22 | <Layout title="Home | Awesome Privacy" description={description}> | 19 | <Layout description={description}> |
| 23 | <Hero /> | 20 | <Hero /> |
| 24 | <main> | 21 | <main> |
| 25 | <div class="action-card"> | 22 | <div class="action-card"> |
| 26 | <Search client:visible data={categories} /> | 23 | <Search client:visible /> |
| 27 | <span class="action-divider">or</span> | 24 | <span class="action-divider">or</span> |
| 28 | <a href="/all" class="browse-cta"> Browse All Listings → </a> | 25 | <a href="/all/" class="browse-cta"> Browse All Listings → </a> |
| 29 | </div> | 26 | </div> |
| 30 | <h2 class="browse-title"><a href="/all">Categories</a></h2> | 27 | <h2 class="browse-title"><a href="/all/">Categories</a></h2> |
| 31 | <ul class="categories"> | 28 | <ul class="categories"> |
| 32 | { | 29 | { |
| 33 | categories.map((category) => ( | 30 | categories.map((category) => ( |
| @@ -38,17 +35,17 @@ const description = | |||
| 38 | } | 35 | } |
| 39 | </ul> | 36 | </ul> |
| 40 | <div class="categories-footer"> | 37 | <div class="categories-footer"> |
| 41 | <a class="small-button" href="/all">View everything →</a> | 38 | <a class="small-button" href="/all/">View everything →</a> |
| 42 | </div> | 39 | </div> |
| 43 | 40 | ||
| 44 | <h2><a href="/changelog">Latest Updates</a></h2> | 41 | <h2><a href="/changelog/">Latest Updates</a></h2> |
| 45 | <LatestUpdates categories={categories} /> | 42 | <LatestUpdates categories={categories} /> |
| 46 | 43 | ||
| 47 | <h2><a href="/inventory">Saved Items</a></h2> | 44 | <h2><a href="/inventory/">Saved Items</a></h2> |
| 48 | <SavedServices allData={categories} client:load /> | 45 | <SavedServices client:load /> |
| 49 | 46 | ||
| 50 | <h2> | 47 | <h2> |
| 51 | <a href="/about">About</a> | 48 | <a href="/about/">About</a> |
| 52 | </h2> | 49 | </h2> |
| 53 | <div class="about-summary"> | 50 | <div class="about-summary"> |
| 54 | <p> | 51 | <p> |
| @@ -75,7 +72,7 @@ const description = | |||
| 75 | > on GitHub. | 72 | > on GitHub. |
| 76 | </p> | 73 | </p> |
| 77 | <div class="about-footer"> | 74 | <div class="about-footer"> |
| 78 | <a class="small-button" href="/about">Keep reading →</a> | 75 | <a class="small-button" href="/about/">Keep reading →</a> |
| 79 | </div> | 76 | </div> |
| 80 | </div> | 77 | </div> |
| 81 | </main> | 78 | </main> |
web/src/pages/inventory/[...inventoryId].astro +2 −6
| @@ -2,11 +2,7 @@ | |||
| 2 | import Layout from '@layouts/Layout.astro'; | 2 | import Layout from '@layouts/Layout.astro'; |
| 3 | import SavedServices from '@components/things/SavedServices.svelte'; | 3 | import SavedServices from '@components/things/SavedServices.svelte'; |
| 4 | 4 | ||
| 5 | import { fetchData } from '@utils/fetch-data'; | ||
| 6 | import Button from '@components/form/Button.astro'; | 5 | import Button from '@components/form/Button.astro'; |
| 7 | import type { Category } from '../../types/Service'; | ||
| 8 | |||
| 9 | const categories = (await fetchData())?.categories || ([] as Category[]); | ||
| 10 | 6 | ||
| 11 | export const prerender = false; | 7 | export const prerender = false; |
| 12 | 8 | ||
| @@ -50,10 +46,10 @@ if (serviceList.error) { | |||
| 50 | </div> | 46 | </div> |
| 51 | ) | 47 | ) |
| 52 | } | 48 | } |
| 53 | <SavedServices allData={categories} serviceList={serviceList} client:load /> | 49 | <SavedServices serviceList={serviceList} client:load /> |
| 54 | <div class="buttons"> | 50 | <div class="buttons"> |
| 55 | <p>Not found what you're looking for?</p> | 51 | <p>Not found what you're looking for?</p> |
| 56 | <Button url="/all">Browse Services</Button> | 52 | <Button url="/all/">Browse Services</Button> |
| 57 | </div> | 53 | </div> |
| 58 | </main> | 54 | </main> |
| 59 | </Layout> | 55 | </Layout> |
web/src/pages/inventory/index.astro +2 −6
| @@ -3,12 +3,8 @@ import Layout from '@layouts/Layout.astro'; | |||
| 3 | import SavedServices from '@components/things/SavedServices.svelte'; | 3 | import SavedServices from '@components/things/SavedServices.svelte'; |
| 4 | import GetSharableLink from '@components/things/GetSharableLink.svelte'; | 4 | import GetSharableLink from '@components/things/GetSharableLink.svelte'; |
| 5 | 5 | ||
| 6 | import { fetchData } from '@utils/fetch-data'; | ||
| 7 | import Button from '@components/form/Button.astro'; | 6 | import Button from '@components/form/Button.astro'; |
| 8 | import EditableTitle from '@components/form/EditableTitle.svelte'; | 7 | import EditableTitle from '@components/form/EditableTitle.svelte'; |
| 9 | import type { Category } from '../../types/Service'; | ||
| 10 | |||
| 11 | const categories = (await fetchData())?.categories || ([] as Category[]); | ||
| 12 | --- | 8 | --- |
| 13 | 9 | ||
| 14 | <Layout title="Saved Services"> | 10 | <Layout title="Saved Services"> |
| @@ -18,10 +14,10 @@ const categories = (await fetchData())?.categories || ([] as Category[]); | |||
| 18 | <EditableTitle client:load /> | 14 | <EditableTitle client:load /> |
| 19 | <GetSharableLink client:load /> | 15 | <GetSharableLink client:load /> |
| 20 | </div> | 16 | </div> |
| 21 | <SavedServices allData={categories} client:load /> | 17 | <SavedServices client:load /> |
| 22 | <div class="buttons"> | 18 | <div class="buttons"> |
| 23 | <p>Not found what you're looking for?</p> | 19 | <p>Not found what you're looking for?</p> |
| 24 | <Button url="/all">Browse Services</Button> | 20 | <Button url="/all/">Browse Services</Button> |
| 25 | </div> | 21 | </div> |
| 26 | </main> | 22 | </main> |
| 27 | </Layout> | 23 | </Layout> |
web/src/pages/search/[...searchTerm].astro +6 −7
| @@ -67,13 +67,9 @@ const beer = putResultsIntoGroups(); | |||
| 67 | <Layout title="Search | Awesome Privacy"> | 67 | <Layout title="Search | Awesome Privacy"> |
| 68 | <section> | 68 | <section> |
| 69 | <h1>Search</h1> | 69 | <h1>Search</h1> |
| 70 | <Search client:visible data={categories} previousSearch={searchTerm} /> | 70 | <Search client:visible previousSearch={searchTerm} /> |
| 71 | </section> | 71 | </section> |
| 72 | <SmartSuggestions | 72 | <SmartSuggestions client:visible searchTerm={searchTerm || ''} /> |
| 73 | client:visible | ||
| 74 | searchTerm={searchTerm || ''} | ||
| 75 | categories={categories} | ||
| 76 | /> | ||
| 77 | <section class="result-count"> | 73 | <section class="result-count"> |
| 78 | <h3>Deep Search</h3> | 74 | <h3>Deep Search</h3> |
| 79 | <p> | 75 | <p> |
| @@ -84,7 +80,10 @@ const beer = putResultsIntoGroups(); | |||
| 84 | { | 80 | { |
| 85 | beer.map((category) => ( | 81 | beer.map((category) => ( |
| 86 | <div class="category"> | 82 | <div class="category"> |
| 87 | <a class="category-title" href={`/${slugify(category.categoryName)}`}> | 83 | <a |
| 84 | class="category-title" | ||
| 85 | href={`/${slugify(category.categoryName)}/`} | ||
| 86 | > | ||
| 88 | <h3>{category.categoryName}</h3> | 87 | <h3>{category.categoryName}</h3> |
| 89 | </a> | 88 | </a> |
| 90 | <span class="section-icon"> | 89 | <span class="section-icon"> |
web/src/pages/search/index.astro +3 −6
| @@ -1,19 +1,16 @@ | |||
| 1 | --- | 1 | --- |
| 2 | import Layout from '@layouts/Layout.astro'; | 2 | import Layout from '@layouts/Layout.astro'; |
| 3 | import { fetchData } from '@utils/fetch-data'; | ||
| 4 | 3 | ||
| 5 | import Search from '@components/things/Search.svelte'; | 4 | import Search from '@components/things/Search.svelte'; |
| 6 | |||
| 7 | const categories = (await fetchData())?.categories; | ||
| 8 | --- | 5 | --- |
| 9 | 6 | ||
| 10 | <Layout title="Search | Awesome Privacy"> | 7 | <Layout title="Search | Awesome Privacy"> |
| 11 | <section> | 8 | <section> |
| 12 | <h1>Search</h1> | 9 | <h1>Search</h1> |
| 13 | <Search client:visible data={categories} /> | 10 | <Search client:visible /> |
| 14 | <p class="sitemap-link"> | 11 | <p class="sitemap-link"> |
| 15 | Browse <a href="/all">all listings</a>, or see all pages in the <a | 12 | Browse <a href="/all/">all listings</a>, or see all pages in the <a |
| 16 | href="/sitemap">Sitemap</a | 13 | href="/sitemap/">Sitemap</a |
| 17 | > | 14 | > |
| 18 | </p> | 15 | </p> |
| 19 | </section> | 16 | </section> |
web/src/pages/sitemap.astro +21 −21
| @@ -30,35 +30,35 @@ const categories = ((await fetchData()) as AwesomePrivacy)?.categories || []; | |||
| 30 | <a href="/">Home</a> | 30 | <a href="/">Home</a> |
| 31 | </li> | 31 | </li> |
| 32 | <li> | 32 | <li> |
| 33 | <a href="/search">Search</a> | 33 | <a href="/search/">Search</a> |
| 34 | </li> | 34 | </li> |
| 35 | <li> | 35 | <li> |
| 36 | <a href="/all">View All</a> | 36 | <a href="/all/">View All</a> |
| 37 | </li> | 37 | </li> |
| 38 | <li> | 38 | <li> |
| 39 | <a href="/changelog">Changelog</a> | 39 | <a href="/changelog/">Changelog</a> |
| 40 | </li> | 40 | </li> |
| 41 | <li> | 41 | <li> |
| 42 | <a href="/inventory">My Inventory</a> | 42 | <a href="/inventory/">My Inventory</a> |
| 43 | </li> | 43 | </li> |
| 44 | <li> | 44 | <li> |
| 45 | <a href="/submit">Submit Listing</a> | 45 | <a href="/submit/">Submit Listing</a> |
| 46 | </li> | 46 | </li> |
| 47 | <li> | 47 | <li> |
| 48 | <a href="/api">API</a> | 48 | <a href="/api/">API</a> |
| 49 | </li> | 49 | </li> |
| 50 | <li> | 50 | <li> |
| 51 | <a href="/browse">Categories</a> | 51 | <a href="/browse/">Categories</a> |
| 52 | <ul> | 52 | <ul> |
| 53 | { | 53 | { |
| 54 | categories.map((category) => ( | 54 | categories.map((category) => ( |
| 55 | <li> | 55 | <li> |
| 56 | <a href={`/${slugify(category.name)}`}>{category.name}</a> | 56 | <a href={`/${slugify(category.name)}/`}>{category.name}</a> |
| 57 | <ul> | 57 | <ul> |
| 58 | {category.sections.map((section) => ( | 58 | {category.sections.map((section) => ( |
| 59 | <li> | 59 | <li> |
| 60 | <a | 60 | <a |
| 61 | href={`/${slugify(category.name)}/${slugify(section.name)}`} | 61 | href={`/${slugify(category.name)}/${slugify(section.name)}/`} |
| 62 | > | 62 | > |
| 63 | {section.name} | 63 | {section.name} |
| 64 | </a> | 64 | </a> |
| @@ -66,7 +66,7 @@ const categories = ((await fetchData()) as AwesomePrivacy)?.categories || []; | |||
| 66 | {(section.services || []).map((service) => ( | 66 | {(section.services || []).map((service) => ( |
| 67 | <li title={service.description || ''}> | 67 | <li title={service.description || ''}> |
| 68 | <a | 68 | <a |
| 69 | href={`/${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}`} | 69 | href={`/${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}/`} |
| 70 | > | 70 | > |
| 71 | {service.name} | 71 | {service.name} |
| 72 | </a> | 72 | </a> |
| @@ -82,24 +82,24 @@ const categories = ((await fetchData()) as AwesomePrivacy)?.categories || []; | |||
| 82 | </ul> | 82 | </ul> |
| 83 | </li> | 83 | </li> |
| 84 | <li> | 84 | <li> |
| 85 | <a href="/about">About</a> | 85 | <a href="/about/">About</a> |
| 86 | <ul> | 86 | <ul> |
| 87 | <li><a href="/about#objective">Objective</a></li> | 87 | <li><a href="/about/#objective">Objective</a></li> |
| 88 | <li><a href="/about#criteria">Listing Criteria</a></li> | 88 | <li><a href="/about/#criteria">Listing Criteria</a></li> |
| 89 | <li><a href="/about#contributing">Contributing</a></li> | 89 | <li><a href="/about/#contributing">Contributing</a></li> |
| 90 | <li> | 90 | <li> |
| 91 | <a href="/about#acknowledgements">Acknowledgements</a> | 91 | <a href="/about/#acknowledgements">Acknowledgements</a> |
| 92 | <ul> | 92 | <ul> |
| 93 | <li><a href="/about#contributors">Contributors</a></li> | 93 | <li><a href="/about/#contributors">Contributors</a></li> |
| 94 | <li><a href="/about#sponsors">Sponsors</a></li> | 94 | <li><a href="/about/#sponsors">Sponsors</a></li> |
| 95 | </ul> | 95 | </ul> |
| 96 | </li> | 96 | </li> |
| 97 | <li><a href="/about#author">Author</a></li> | 97 | <li><a href="/about/#author">Author</a></li> |
| 98 | <li><a href="/about#license">License</a></li> | 98 | <li><a href="/about/#license">License</a></li> |
| 99 | </ul> | 99 | </ul> |
| 100 | </li> | 100 | </li> |
| 101 | <li> | 101 | <li> |
| 102 | <a href="/sitemap">Sitemap</a> | 102 | <a href="/sitemap/">Sitemap</a> |
| 103 | </li> | 103 | </li> |
| 104 | </ul> | 104 | </ul> |
| 105 | </main> | 105 | </main> |
| @@ -130,7 +130,7 @@ const categories = ((await fetchData()) as AwesomePrivacy)?.categories || []; | |||
| 130 | case 'Enter': | 130 | case 'Enter': |
| 131 | event.preventDefault(); | 131 | event.preventDefault(); |
| 132 | const searchTerm = encodeURIComponent(filterInput.value); | 132 | const searchTerm = encodeURIComponent(filterInput.value); |
| 133 | window.location.href = `/search/${searchTerm}`; | 133 | window.location.href = `/search/${searchTerm}/`; |
| 134 | break; | 134 | break; |
| 135 | case 'Escape': | 135 | case 'Escape': |
| 136 | filterInput.value = ''; | 136 | filterInput.value = ''; |
web/src/pages/submit.astro +2 −2
| @@ -18,7 +18,7 @@ const isDisabled = true; // will set this back to false if/when we have better w | |||
| 18 | <p class="about-data"> | 18 | <p class="about-data"> |
| 19 | All data on Awesome Privacy is community maintained via Git, this keeps | 19 | All data on Awesome Privacy is community maintained via Git, this keeps |
| 20 | everything transparent, and means anyone can submit edits. You can learn | 20 | everything transparent, and means anyone can submit edits. You can learn |
| 21 | more about how our data is managed on our <a href="/about#our-data" | 21 | more about how our data is managed on our <a href="/about/#our-data" |
| 22 | >about page</a | 22 | >about page</a |
| 23 | >. | 23 | >. |
| 24 | <br /><br /> | 24 | <br /><br /> |
| @@ -77,7 +77,7 @@ const isDisabled = true; // will set this back to false if/when we have better w | |||
| 77 | > guidelines before proceeding | 77 | > guidelines before proceeding |
| 78 | </li> | 78 | </li> |
| 79 | <li> | 79 | <li> |
| 80 | All listing must meed our <a href="/about#creteria">Criteria</a> to be considered | 80 | All listing must meed our <a href="/about/#creteria">Criteria</a> to be considered |
| 81 | privacy-respecting | 81 | privacy-respecting |
| 82 | </li> | 82 | </li> |
| 83 | <li>Double check that your changes haven't already been proposed</li> | 83 | <li>Double check that your changes haven't already been proposed</li> |
web/src/utils/fetch-data.ts +14 −1
| @@ -2,7 +2,7 @@ import yaml from 'js-yaml'; | |||
| 2 | import { error } from './logger'; | 2 | import { error } from './logger'; |
| 3 | import { safeFetch } from './safe-fetch'; | 3 | import { safeFetch } from './safe-fetch'; |
| 4 | 4 | ||
| 5 | import type { AwesomePrivacy } from '../types/Service'; | 5 | import type { AwesomePrivacy, Category } from '../types/Service'; |
| 6 | 6 | ||
| 7 | const awesomePrivacyData = | 7 | const awesomePrivacyData = |
| 8 | 'https://raw.githubusercontent.com/Lissy93/awesome-privacy/main/awesome-privacy.yml'; | 8 | 'https://raw.githubusercontent.com/Lissy93/awesome-privacy/main/awesome-privacy.yml'; |
| @@ -25,6 +25,19 @@ export const fetchData = async (): Promise<AwesomePrivacy> => { | |||
| 25 | } | 25 | } |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | /** | ||
| 29 | * Loads the dataset from the browser, ready for the islands who need it | ||
| 30 | */ | ||
| 31 | export const fetchCategories = async (): Promise<Category[]> => { | ||
| 32 | try { | ||
| 33 | const res = await fetch('/api/awesome-privacy.json'); | ||
| 34 | return (await res.json())?.categories || []; | ||
| 35 | } catch (err) { | ||
| 36 | error('Data', `Failed to fetch dataset: ${err}`); | ||
| 37 | return []; | ||
| 38 | } | ||
| 39 | }; | ||
| 40 | |||
| 28 | export const slugify = (title: string) => { | 41 | export const slugify = (title: string) => { |
| 29 | return (title || '') | 42 | return (title || '') |
| 30 | .toLowerCase() | 43 | .toLowerCase() |
web/src/utils/meta-tags.ts added +11
| @@ -0,0 +1,11 @@ | |||
| 1 | /** Strip markdown and collapse wrapped lines, so prose is safe to use in a meta tag */ | ||
| 2 | export const plainText = (markdown?: string) => | ||
| 3 | (markdown || '') | ||
| 4 | .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') | ||
| 5 | .replace(/[*_`~]/g, '') | ||
| 6 | .replace(/\s+/g, ' ') | ||
| 7 | .trim(); | ||
| 8 | |||
| 9 | /** Cut sentance off after 155 chars rounded to nearest next word */ | ||
| 10 | export const truncate = (text: string, max = 155) => | ||
| 11 | text.length <= max ? text : `${text.slice(0, text.lastIndexOf(' ', max))}…`; | ||