Commit 2699bbde3c

2699bbde3c0f0959907febea96062fd1f91bb85c

parent: bb48e9eeb6

Unsigned

Alicia Sykes <alicia@omg.lol> ยท 2026-06-05 19:34 UTC

Adds support for CodeBerg and generig git hosts

Layout: unified ยท split

.github/CONTRIBUTING.md +27 โˆ’20
@@ -130,6 +130,8 @@ classDiagram
130 +description: string 130 +description: string
131 +url: string 131 +url: string
132 +github: string? 132 +github: string?
133 +codeberg: string?
134 +git: string?
133 +icon: string? 135 +icon: string?
134 +followWith: string? 136 +followWith: string?
135 +securityAudited: boolean? 137 +securityAudited: boolean?
@@ -155,26 +157,26 @@ At a high-level, the file exports an array of categories, each containing a `nam
155categories: 157categories:
156 - name: Essentials 158 - name: Essentials
157 sections: [] 159 sections: []
158- name: Communication 160 - name: Communication
159 sections: [] 161 sections: []
160 - name: Security Tools 162 - name: Security Tools
161 sections: [] 163 sections: []
162``` 164```
163 165
164Each category contains a `name` an array of `sections` (like sub-categories) 166Each category contains a `name` an array of `sections` (like sub-categories)
165 167
166```yaml 168```yaml
167 - name: Communication 169 - name: Communication
168 sections: 170 sections:
169 - name: Encrypted Messaging 171 - name: Encrypted Messaging
170 services: [] 172 services: []
171 - name: P2P Messaging 173 - name: P2P Messaging
172 intro: ... 174 intro: ...
173 services: [] 175 services: []
174 - name: Encrypted Email 176 - name: Encrypted Email
175 services: [] 177 services: []
176 - name: Email Clients 178 - name: Email Clients
177 services: [] 179 services: []
178``` 180```
179 181
180And within each section, we find a list of `services`, each containing a listing. For example: 182And within each section, we find a list of `services`, each containing a listing. For example:
@@ -213,6 +215,9 @@ Each service (aka an app/website/software) has the following fields:
213| `url` | The fully qualified domain name of the listing's homepage | `string` | Required | 215| `url` | The fully qualified domain name of the listing's homepage | `string` | Required |
214| `icon` | A path to an icon file for the listing's logo. Must be square, no less than 64x64 and no larger than 512x512 pixels | `string` | Required | 216| `icon` | A path to an icon file for the listing's logo. Must be square, no less than 64x64 and no larger than 512x512 pixels | `string` | Required |
215| `github` | The GitHub repository hosting the listing's source code. In the format of `[owner]/[repo]` | `string` | Optional | 217| `github` | The GitHub repository hosting the listing's source code. In the format of `[owner]/[repo]` | `string` | Optional |
218| `codeberg` | The Codeberg repository hosting the listing's source code. In the format of `[owner]/[repo]` | `string` | Optional |
219| `git` | Full URL to the listing's source repository on any other git host (GitLab, Gitea, self-hosted, etc.) | `string` | Optional |
220| `followWith` | Short text shown in parentheses after the listing's name, e.g. its platform, if not cross-platform | `string` | Optional |
216| `securityAudited` | Has the listing been audited by an accredited security researcher, with the report publicly published? | `bool` | Optional | 221| `securityAudited` | Has the listing been audited by an accredited security researcher, with the report publicly published? | `bool` | Optional |
217| `acceptsCrypto` | If payment is required/accepted, do they accept anonymous payments using cryptocurrency, such as Monero? | `bool` | Optional | 222| `acceptsCrypto` | If payment is required/accepted, do they accept anonymous payments using cryptocurrency, such as Monero? | `bool` | Optional |
218| `openSource` | Is the source code in its entirety published somewhere accessible so it can be built-from-source or self-hosted? | `bool` | Optional | 223| `openSource` | Is the source code in its entirety published somewhere accessible so it can be built-from-source or self-hosted? | `bool` | Optional |
@@ -266,9 +271,11 @@ Below is the full list of checks - it's basically the same as what is listed in
266 - ๐ŸŸก **Duplicate name** - Service name must not already exist 271 - ๐ŸŸก **Duplicate name** - Service name must not already exist
267 - ๐ŸŸก **Duplicate URL** - Service URL must not already exist 272 - ๐ŸŸก **Duplicate URL** - Service URL must not already exist
268 - ๐ŸŸก **Description length** - Should be 50โ€“250 characters 273 - ๐ŸŸก **Description length** - Should be 50โ€“250 characters
269 - ๐ŸŸก **Open source + GitHub** - If marked open source, must include `github` field 274 - ๐ŸŸก **Open source + repo** - If marked open source, must include a `github`, `codeberg` or `git` field
270- **Project Health** 275- **Project Health**
271 - ๐ŸŸก **Links reachable** - Service URL and icon must not return 404 276 - ๐ŸŸก **Links reachable** - Service URL and icon must not return 404
277 - ๐ŸŸก **Repo exists** - The linked GitHub repository must not return a 404
278 - ๐ŸŸก **New account** - Flags PRs from very recently created GitHub accounts
272 - ๐ŸŸก **Author disclosure** - If PR author owns the repo, they should disclose it 279 - ๐ŸŸก **Author disclosure** - If PR author owns the repo, they should disclose it
273 - ๐ŸŸก **Not inactive** - Repo should have a push within the last 90 days 280 - ๐ŸŸก **Not inactive** - Repo should have a push within the last 90 days
274 - ๐ŸŸก **Minimum age** - Repo should be โ‰ฅ4 months old 281 - ๐ŸŸก **Minimum age** - Repo should be โ‰ฅ4 months old
@@ -278,13 +285,13 @@ Below is the full list of checks - it's basically the same as what is listed in
278 - ๐ŸŸก **Not archived** - Repo must not be archived 285 - ๐ŸŸก **Not archived** - Repo must not be archived
279 - ๐ŸŸก **No security alerts** - No open critical/high Dependabot alerts 286 - ๐ŸŸก **No security alerts** - No open critical/high Dependabot alerts
280 - ๐ŸŸก **Minimum stars** - Repo should have โ‰ฅ100 stars 287 - ๐ŸŸก **Minimum stars** - Repo should have โ‰ฅ100 stars
281 - ๐ŸŸก **Spam detection** - Flags if user opened โ‰ฅ5 PRs to other awesome-* repos in 24h 288 - ๐ŸŸก **Spam detection** - Flags if the author opened โ‰ฅ3 PRs to other awesome-* repos, or PRs across โ‰ฅ7 distinct repos, in the last 2 days
282- **Addition Info** (fyi only, no pass/fail requirements or warnings) 289- **Addition Info** (fyi only, no pass/fail requirements or warnings)
283 - ๐Ÿ”ต **Website check** (if has `website`) - Quickly checks for basic security requirements for website 290 - ๐Ÿ”ต **Website check** (if has `url`) - Quickly checks for basic security requirements for website
284 - ๐Ÿ”ต **Source check** (if has `github`) - Brief audit of core GitHub metrics from submitted the repo 291 - ๐Ÿ”ต **Source check** (if has `github`) - Brief audit of core GitHub metrics from the submitted repo
285 - ๐Ÿ”ต **Android check** (if has `android`) - Lists the trackers, permissions and stats for the Android app 292 - ๐Ÿ”ต **Android check** (if has `androidApp`) - Lists the trackers, permissions and stats for the Android app
286 - ๐Ÿ”ต **iOS check** (if has `ios`) - Shows average rating, and app stats from the Apple App Store 293 - ๐Ÿ”ต **iOS check** (if has `iosApp`) - Shows average rating, and app stats from the Apple App Store
287 - ๐Ÿ”ต **Privacy Policy check** (if has `tosdr`) - Outputs the privacy score from ToS;DR and links to policy 294 - ๐Ÿ”ต **Privacy Policy check** (if has `tosdrId`) - Outputs the privacy score from ToS;DR and links to policy
288 295
289</details> 296</details>
290 297
api/open-api-spec.yml +4
@@ -152,6 +152,10 @@ components:
152 properties: 152 properties:
153 github: 153 github:
154 type: string 154 type: string
155 codeberg:
156 type: string
157 git:
158 type: string
155 icon: 159 icon:
156 type: string 160 type: string
157 followWith: 161 followWith:
api/src/types.ts +2
@@ -7,6 +7,8 @@ export interface ShortService {
7 7
8export interface Service extends ShortService { 8export interface Service extends ShortService {
9 github?: string; 9 github?: string;
10 codeberg?: string;
11 git?: string;
10 icon?: string; 12 icon?: string;
11 followWith?: string; 13 followWith?: string;
12 securityAudited?: boolean; 14 securityAudited?: boolean;
lib/checks/check-additions.py +10 โˆ’4
@@ -21,6 +21,7 @@ SCHEMA_ERRORS_PATH = "/tmp/schema-errors.json"
21MAX_SCHEMA_ERRORS_SHOWN = 10 21MAX_SCHEMA_ERRORS_SHOWN = 10
22 22
23REQUIRED_FIELDS = ("name", "description", "url", "icon") 23REQUIRED_FIELDS = ("name", "description", "url", "icon")
24REPO_FIELDS = ("github", "codeberg", "git")
24 25
25CONTRIBUTING = "https://github.com/Lissy93/awesome-privacy/blob/main/.github/CONTRIBUTING.md" 26CONTRIBUTING = "https://github.com/Lissy93/awesome-privacy/blob/main/.github/CONTRIBUTING.md"
26 27
@@ -57,11 +58,16 @@ DESC_LENGTH_MSG = (
57 f" character range. Please see our [Contributing Guidelines]({CONTRIBUTING}#description)" 58 f" character range. Please see our [Contributing Guidelines]({CONTRIBUTING}#description)"
58) 59)
59OPENSOURCE_GITHUB_MSG = ( 60OPENSOURCE_GITHUB_MSG = (
60 "You marked this service as open source but didn't include a `github` field." 61 "You marked this service as open source but didn't include a repository link."
61 " Please add the repository link" 62 " Please add a `github`, `codeberg` or `git` field"
62) 63)
63 64
64 65
66def _has_repo(fields):
67 """Return True if a service has any source-repository field set."""
68 return any(fields.get(f) for f in REPO_FIELDS)
69
70
65def load_json(path): 71def load_json(path):
66 """Load JSON from a file, returning None on any error.""" 72 """Load JSON from a file, returning None on any error."""
67 try: 73 try:
@@ -140,7 +146,7 @@ def check_open_source(diff):
140 """Return a finding if an added service has openSource missing or not true.""" 146 """Return a finding if an added service has openSource missing or not true."""
141 for svc in diff.get("services", {}).get("added", []): 147 for svc in diff.get("services", {}).get("added", []):
142 fields = svc.get("fields", {}) 148 fields = svc.get("fields", {})
143 if fields.get("openSource") is not True and not fields.get("github"): 149 if fields.get("openSource") is not True and not _has_repo(fields):
144 return OPENSOURCE_MSG 150 return OPENSOURCE_MSG
145 return None 151 return None
146 152
@@ -239,7 +245,7 @@ def check_opensource_github(diff):
239 """Return a finding if an added service is open source but has no github field.""" 245 """Return a finding if an added service is open source but has no github field."""
240 for svc in diff.get("services", {}).get("added", []): 246 for svc in diff.get("services", {}).get("added", []):
241 fields = svc.get("fields", {}) 247 fields = svc.get("fields", {})
242 if fields.get("openSource") is True and not fields.get("github"): 248 if fields.get("openSource") is True and not _has_repo(fields):
243 return OPENSOURCE_GITHUB_MSG 249 return OPENSOURCE_GITHUB_MSG
244 return None 250 return None
245 251
lib/review-listings.py +9 โˆ’5
@@ -6,7 +6,7 @@ Checks:
6- https-url: homepage URL uses HTTPS 6- https-url: homepage URL uses HTTPS
7- icon-reachable: icon URL does not 404 7- icon-reachable: icon URL does not 404
8- description-len: description is 50 to 280 chars (over 420 escalates to warn) 8- description-len: description is 50 to 280 chars (over 420 escalates to warn)
9- opensource-github: openSource listings include a github field 9- opensource-github: openSource listings include a github, codeberg or git field
10- duplicate-url: no URL appears in more than one listing 10- duplicate-url: no URL appears in more than one listing
11- androidApp-valid: androidApp is a package name, not a URL 11- androidApp-valid: androidApp is a package name, not a URL
12- iosApp-reachable: App Store URL resolves 12- iosApp-reachable: App Store URL resolves
@@ -222,10 +222,14 @@ def _description_len(entry: Entry, ctx: Context) -> Iterable[Finding]:
222 222
223@check("opensource-github") 223@check("opensource-github")
224def _opensource_github(entry: Entry, ctx: Context) -> Iterable[Finding]: 224def _opensource_github(entry: Entry, ctx: Context) -> Iterable[Finding]:
225 """openSource: true services must include a github field.""" 225 """openSource: true services must include a github, codeberg or git field."""
226 if entry.service.get("openSource") is True and not entry.service.get("github"): 226 svc = entry.service
227 yield _finding(entry, "opensource-github", "warn", 227 if svc.get("openSource") is True and not (
228 "marked openSource but missing `github` field") 228 svc.get("github") or svc.get("codeberg") or svc.get("git")
229 ):
230 yield _finding(entry, "opensource-github", "error",
231 "marked openSource but missing a repository link "
232 "(`github`, `codeberg` or `git`)")
229 233
230 234
231@check("androidApp-valid") 235@check("androidApp-valid")
lib/schema.json +8
@@ -32,6 +32,14 @@
32 "type": ["string", "null"], 32 "type": ["string", "null"],
33 "pattern": "^([a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+|https://github\\.com/.+)$" 33 "pattern": "^([a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+|https://github\\.com/.+)$"
34 }, 34 },
35 "codeberg": {
36 "type": ["string", "null"],
37 "pattern": "^([a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+|https://codeberg\\.org/.+)$"
38 },
39 "git": {
40 "type": ["string", "null"],
41 "pattern": "^https?://.+"
42 },
35 "icon": { 43 "icon": {
36 "type": ["string", "null"], 44 "type": ["string", "null"],
37 "pattern": "^https?://.+" 45 "pattern": "^https?://.+"
lib/validate-awesome-privacy.py +3 โˆ’1
@@ -57,7 +57,9 @@ def resolve_path(data, path_parts):
57FIELD_HINTS = { 57FIELD_HINTS = {
58 "url": "must start with http:// or https://", 58 "url": "must start with http:// or https://",
59 "icon": "must start with http:// or https://", 59 "icon": "must start with http:// or https://",
60 "github": "must be `user/repo` or a full https://github.com/... URL", 60 "github": "must be `user/repo`",
61 "codeberg": "must be `user/repo`",
62 "git": "must be a full http(s):// URL to the source repository",
61 "iosApp": "must be a full https://apps.apple.com/... URL", 63 "iosApp": "must be a full https://apps.apple.com/... URL",
62 "androidApp": "must be a package name like `com.example.app`", 64 "androidApp": "must be a package name like `com.example.app`",
63 "discordInvite": "must be a discord invite code or https://discord.gg/... URL", 65 "discordInvite": "must be a discord invite code or https://discord.gg/... URL",
web/src/components/things/ChangelogTimeline.svelte +4 โˆ’4
@@ -611,16 +611,16 @@
611 color: var(--changelog-add); 611 color: var(--changelog-add);
612 } 612 }
613 &.rem { 613 &.rem {
614 background: color-mix(in srgb, var(--changelog-rem) 33%, transparent); 614 background: color-mix(in srgb, var(--changelog-rej) 33%, transparent);
615 color: var(--changelog-rem); 615 color: var(--changelog-rej);
616 } 616 }
617 &.mod { 617 &.mod {
618 background: color-mix(in srgb, var(--changelog-mod) 33%, transparent); 618 background: color-mix(in srgb, var(--changelog-mod) 33%, transparent);
619 color: var(--changelog-mod); 619 color: var(--changelog-mod);
620 } 620 }
621 &.rej { 621 &.rej {
622 background: color-mix(in srgb, var(--changelog-rej) 33%, transparent); 622 background: color-mix(in srgb, var(--changelog-rem) 33%, transparent);
623 color: var(--changelog-rej); 623 color: var(--changelog-rem);
624 } 624 }
625 } 625 }
626 626
web/src/components/things/ListingHero.astro +14 โˆ’2
@@ -1,7 +1,7 @@
1--- 1---
2import type { Section, Service } from '../../types/Service'; 2import type { Section, Service } from '../../types/Service';
3import { slugify } from '@utils/fetch-data'; 3import { slugify } from '@utils/fetch-data';
4import { parseMarkdown, formatLink } from '@utils/parse-markdown'; 4import { parseMarkdown, formatLink, codebergUrl } from '@utils/parse-markdown';
5import FontAwesome from '@components/form/FontAwesome.svelte'; 5import FontAwesome from '@components/form/FontAwesome.svelte';
6import SaveListing from '@components/things/SaveListing.svelte'; 6import SaveListing from '@components/things/SaveListing.svelte';
7import ServiceIcon from '@components/things/ServiceIcon.astro'; 7import ServiceIcon from '@components/things/ServiceIcon.astro';
@@ -19,6 +19,8 @@ const {
19 description, 19 description,
20 url, 20 url,
21 github, 21 github,
22 codeberg,
23 git,
22 tosdrId, 24 tosdrId,
23 iosApp, 25 iosApp,
24 androidApp, 26 androidApp,
@@ -46,6 +48,16 @@ const infoLinks = [
46 href: `https://github.com/${github}`, 48 href: `https://github.com/${github}`,
47 text: `github.com/${github}`, 49 text: `github.com/${github}`,
48 }, 50 },
51 codeberg && {
52 label: 'Codeberg',
53 href: codebergUrl(codeberg),
54 text: formatLink(codebergUrl(codeberg)),
55 },
56 git && {
57 label: 'Source',
58 href: git,
59 text: formatLink(git),
60 },
49 tosdrId && { 61 tosdrId && {
50 label: 'Privacy', 62 label: 'Privacy',
51 href: privacyPolicyLink, 63 href: privacyPolicyLink,
@@ -104,7 +116,7 @@ const highlights = [
104 cls: 'warning', 116 cls: 'warning',
105 title: `${name} is not open source`, 117 title: `${name} is not open source`,
106 }, 118 },
107 (openSource || (github && openSource !== false)) && { 119 (openSource || ((github || codeberg || git) && openSource !== false)) && {
108 icon: 'openSource', 120 icon: 'openSource',
109 text: 'Open Source', 121 text: 'Open Source',
110 cls: 'great', 122 cls: 'great',
web/src/components/things/ServiceCard.astro +15 โˆ’1
@@ -1,5 +1,5 @@
1--- 1---
2import { formatLink } from '@utils/parse-markdown'; 2import { formatLink, codebergUrl } from '@utils/parse-markdown';
3import type { Service } from 'src/types/Service'; 3import type { Service } from 'src/types/Service';
4import FontAwesome from '@components/form/FontAwesome.svelte'; 4import FontAwesome from '@components/form/FontAwesome.svelte';
5import SaveListing from '@components/things/SaveListing.svelte'; 5import SaveListing from '@components/things/SaveListing.svelte';
@@ -54,6 +54,20 @@ const { service, sectionName, categoryName } = Astro.props;
54 </a> 54 </a>
55 ) 55 )
56 } 56 }
57 {
58 service.codeberg && (
59 <a class="link" href={codebergUrl(service.codeberg)}>
60 <FontAwesome iconName="sourceCode" /> Codeberg
61 </a>
62 )
63 }
64 {
65 service.git && (
66 <a class="link" href={service.git}>
67 <FontAwesome iconName="sourceCode" /> Source
68 </a>
69 )
70 }
57 <a 71 <a
58 href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`} 72 href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`}
59 > 73 >
web/src/components/things/ServiceCard.svelte +21 โˆ’1
@@ -2,7 +2,7 @@
2 import FontAwesome from '@components/form/FontAwesome.svelte'; 2 import FontAwesome from '@components/form/FontAwesome.svelte';
3 import SaveListing from '@components/things/SaveListing.svelte'; 3 import SaveListing from '@components/things/SaveListing.svelte';
4 import { slugify } from '@utils/fetch-data'; 4 import { slugify } from '@utils/fetch-data';
5 import { formatLink } from '@utils/parse-markdown'; 5 import { formatLink, codebergUrl } from '@utils/parse-markdown';
6 import type { Service } from 'src/types/Service'; 6 import type { Service } from 'src/types/Service';
7 7
8 interface Props { 8 interface Props {
@@ -70,6 +70,26 @@
70 <FontAwesome iconName="sourceCode" /> GitHub 70 <FontAwesome iconName="sourceCode" /> GitHub
71 </a> 71 </a>
72 {/if} 72 {/if}
73 {#if service.codeberg}
74 <a
75 class="link"
76 href={codebergUrl(service.codeberg)}
77 target="_blank"
78 rel="noopener noreferrer"
79 >
80 <FontAwesome iconName="sourceCode" /> Codeberg
81 </a>
82 {/if}
83 {#if service.git}
84 <a
85 class="link"
86 href={service.git}
87 target="_blank"
88 rel="noopener noreferrer"
89 >
90 <FontAwesome iconName="sourceCode" /> Source
91 </a>
92 {/if}
73 <a href={`/${categorySlug}/${sectionSlug}/${serviceRef}`}> 93 <a href={`/${categorySlug}/${sectionSlug}/${serviceRef}`}>
74 <FontAwesome iconName="viewReport" /> View Report โž” 94 <FontAwesome iconName="viewReport" /> View Report โž”
75 </a> 95 </a>
web/src/components/things/ServiceList.astro +24 โˆ’2
@@ -1,6 +1,6 @@
1--- 1---
2import Button from '@components/form/Button.astro'; 2import Button from '@components/form/Button.astro';
3import { parseMarkdown, formatLink } from '@utils/parse-markdown'; 3import { parseMarkdown, formatLink, codebergUrl } from '@utils/parse-markdown';
4import type { Service } from 'src/types/Service'; 4import type { Service } from 'src/types/Service';
5import FontAwesome from '@components/form/FontAwesome.svelte'; 5import FontAwesome from '@components/form/FontAwesome.svelte';
6import DeleteListing from '@components/things/DeleteListing.svelte'; 6import DeleteListing from '@components/things/DeleteListing.svelte';
@@ -111,7 +111,8 @@ const sortedServices = [...(services || [])].sort((a, b) =>
111 </span> 111 </span>
112 )} 112 )}
113 {service.openSource || 113 {service.openSource ||
114 (service.github && service.openSource !== false) ? ( 114 ((service.github || service.codeberg || service.git) &&
115 service.openSource !== false) ? (
115 <span 116 <span
116 class="meta-item great" 117 class="meta-item great"
117 title={`${service.name} is open source`} 118 title={`${service.name} is open source`}
@@ -135,6 +136,27 @@ const sortedServices = [...(services || [])].sort((a, b) =>
135 </a> 136 </a>
136 </span> 137 </span>
137 )} 138 )}
139 {service.codeberg && (
140 <span
141 class="meta-item"
142 title={`View ${service.name} on Codeberg`}
143 >
144 <a href={codebergUrl(service.codeberg)} target="_blank">
145 <FontAwesome iconName="sourceCode" />{' '}
146 {formatLink(codebergUrl(service.codeberg))}
147 </a>
148 </span>
149 )}
150 {service.git && (
151 <span
152 class="meta-item"
153 title={`View ${service.name} source code`}
154 >
155 <a href={service.git} target="_blank">
156 <FontAwesome iconName="sourceCode" /> Source
157 </a>
158 </span>
159 )}
138 </div> 160 </div>
139 <div class="view-service"> 161 <div class="view-service">
140 <a 162 <a
web/src/pages/[...listing].astro +9 โˆ’1
@@ -15,6 +15,7 @@ import SocialShare from '@components/form/Social.astro';
15import DataActions from '@components/things/DataActions.svelte'; 15import DataActions from '@components/things/DataActions.svelte';
16import type { AwesomePrivacy, Section, Service } from '../types/Service'; 16import type { AwesomePrivacy, Section, Service } from '../types/Service';
17import { fetchData, slugify } from '@utils/fetch-data'; 17import { fetchData, slugify } from '@utils/fetch-data';
18import { codebergUrl } from '@utils/parse-markdown';
18import { fetchChangelog } from '@utils/fetch-changelog'; 19import { fetchChangelog } from '@utils/fetch-changelog';
19import { fetchGitHubStats } from '@utils/fetch-repo-info'; 20import { fetchGitHubStats } from '@utils/fetch-repo-info';
20import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy'; 21import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy';
@@ -39,6 +40,8 @@ const {
39 description, 40 description,
40 url, 41 url,
41 github, 42 github,
43 codeberg,
44 git,
42 tosdrId, 45 tosdrId,
43 discordInvite, 46 discordInvite,
44 subreddit, 47 subreddit,
@@ -235,6 +238,11 @@ const makeSoftwareSchema = () => {
235 .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') 238 .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1')
236 .replace(/[*_`~]/g, '') 239 .replace(/[*_`~]/g, '')
237 .trim(); 240 .trim();
241 const codeRepository = github
242 ? `https://github.com/${github}`
243 : codeberg
244 ? codebergUrl(codeberg)
245 : git || null;
238 return { 246 return {
239 '@context': 'https://schema.org', 247 '@context': 'https://schema.org',
240 '@type': 'SoftwareApplication', 248 '@type': 'SoftwareApplication',
@@ -245,7 +253,7 @@ const makeSoftwareSchema = () => {
245 ...(operatingSystem.length && { 253 ...(operatingSystem.length && {
246 operatingSystem: operatingSystem.join(', '), 254 operatingSystem: operatingSystem.join(', '),
247 }), 255 }),
248 ...(github && { codeRepository: `https://github.com/${github}` }), 256 ...(codeRepository && { codeRepository }),
249 }; 257 };
250}; 258};
251--- 259---
web/src/types/Service.ts +2
@@ -9,6 +9,8 @@ export interface Service {
9 description: string; 9 description: string;
10 url: string; 10 url: string;
11 github?: string; 11 github?: string;
12 codeberg?: string;
13 git?: string;
12 icon?: string; 14 icon?: string;
13 links?: Array<{ 15 links?: Array<{
14 title: string; 16 title: string;
web/src/utils/do-searchy-searchy.ts +6
@@ -9,6 +9,8 @@ export interface SearchItem {
9 name?: string; 9 name?: string;
10 url?: string; 10 url?: string;
11 github?: string; 11 github?: string;
12 codeberg?: string;
13 git?: string;
12 logo?: string; 14 logo?: string;
13} 15}
14 16
@@ -42,6 +44,8 @@ export const prepareSearchItems = (categories: Category[]): SearchItem[] => {
42 description: service.description, 44 description: service.description,
43 url: service.url, 45 url: service.url,
44 github: service.github || '', 46 github: service.github || '',
47 codeberg: service.codeberg || '',
48 git: service.git || '',
45 category: category.name, 49 category: category.name,
46 sectionName: section.name, 50 sectionName: section.name,
47 logo: service.icon || '', 51 logo: service.icon || '',
@@ -61,6 +65,8 @@ export const searchOptions = {
61 { name: 'notableMentions', weight: 0.5 }, 65 { name: 'notableMentions', weight: 0.5 },
62 { name: 'alternativeTo', weight: 0.5 }, 66 { name: 'alternativeTo', weight: 0.5 },
63 { name: 'github', weight: 0.4 }, 67 { name: 'github', weight: 0.4 },
68 { name: 'codeberg', weight: 0.4 },
69 { name: 'git', weight: 0.3 },
64 { name: 'url', weight: 0.2 }, 70 { name: 'url', weight: 0.2 },
65 { name: 'description', weight: 0.1 }, 71 { name: 'description', weight: 0.1 },
66 { name: 'intro', weight: 0.1 }, 72 { name: 'intro', weight: 0.1 },
web/src/utils/parse-markdown.ts +4
@@ -44,3 +44,7 @@ export const formatLink = (link: string) => {
44 .replace(/^(https?:\/\/)?(www\.)?/, '') 44 .replace(/^(https?:\/\/)?(www\.)?/, '')
45 .replace(/\/+$/, ''); 45 .replace(/\/+$/, '');
46}; 46};
47
48// Resolve a `codeberg` field (either `owner/repo` shorthand or a full URL) to a full URL.
49export const codebergUrl = (codeberg: string) =>
50 /^https?:\/\//.test(codeberg) ? codeberg : `https://codeberg.org/${codeberg}`;