Skip to content

Commit bb493ce

Browse files
Merge pull request #1612 from research-software-directory/1605-add-codeberg
Support for Codeberg
2 parents 60d7737 + 987be32 commit bb493ce

File tree

19 files changed

+740
-13
lines changed

19 files changed

+740
-13
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ MAX_REQUESTS_GITLAB=6
167167
# consumed by: scrapers
168168
MAX_REQUESTS_4TU=6
169169

170+
# max request to Codeberg Git API per run, runs 10 times per hour
171+
# optional, comment out if not available, a default of 6 will be used
172+
# consumed by: scrapers
173+
MAX_REQUESTS_CODEBERG=6
174+
170175
# max mentions to scrape per run, runs 10 times per hour
171176
# optional, comment out if not available, a default of 6 will be used
172177
# consumed by: scrapers

database/005-create-relations-for-software.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ CREATE TYPE platform_type AS ENUM (
1515
'gitlab',
1616
'bitbucket',
1717
'4tu',
18+
'codeberg',
1819
'other'
1920
);
2021

deployment/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ services:
154154
- MAX_REQUESTS_GITHUB
155155
- MAX_REQUESTS_GITLAB
156156
- MAX_REQUESTS_4TU
157+
- MAX_REQUESTS_CODEBERG
157158
- MAX_REQUESTS_DOI
158159
- MAX_REQUESTS_OPENALEX
159160
- MAX_REQUESTS_ROR

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ services:
171171
- MAX_REQUESTS_GITHUB
172172
- MAX_REQUESTS_GITLAB
173173
- MAX_REQUESTS_4TU
174+
- MAX_REQUESTS_CODEBERG
174175
- MAX_REQUESTS_DOI
175176
- MAX_REQUESTS_OPENALEX
176177
- MAX_REQUESTS_ROR

frontend/components/software/AboutSourceCode.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all)
22
// SPDX-FileCopyrightText: 2022 dv4all
33
// SPDX-FileCopyrightText: 2025 Dusan Mijatovic (Netherlands eScience Center)
4+
// SPDX-FileCopyrightText: 2025 Ewan Cahen (Netherlands eScience Center) <[email protected]>
45
// SPDX-FileCopyrightText: 2025 Netherlands eScience Center
56
//
67
// SPDX-License-Identifier: Apache-2.0
@@ -9,7 +10,7 @@ import GitHubIcon from '@mui/icons-material/GitHub'
910
import FolderOpenIcon from '@mui/icons-material/FolderOpen'
1011
import {CodePlatform} from '~/types/SoftwareTypes'
1112
import GitlabIcon from '~/assets/logos/gitlab-icon-rgb.svg'
12-
13+
import Image from 'next/image'
1314

1415
export default function AboutSourceCode({repository,platform}: { repository: string | null, platform: CodePlatform}) {
1516
const code = '</>'
@@ -21,7 +22,7 @@ export default function AboutSourceCode({repository,platform}: { repository: str
2122
case 'github':
2223
return (
2324
<a key={repository} href={repository ?? ''}
24-
title="Github repository" target="_blank" rel="noreferrer"
25+
title="GitHub repository" target="_blank" rel="noreferrer"
2526
className="hover:text-base-content"
2627
>
2728
<GitHubIcon sx={{
@@ -33,14 +34,29 @@ export default function AboutSourceCode({repository,platform}: { repository: str
3334
case 'gitlab':
3435
return (
3536
<a key={repository} href={repository ?? ''}
36-
title="Gitlab repository" target="_blank" rel="noreferrer"
37+
title="GitLab repository" target="_blank" rel="noreferrer"
3738
className="hover:text-base-content"
3839
>
3940
<GitlabIcon
4041
className="w-[3rem] h-[3rem]"
4142
/>
4243
</a>
4344
)
45+
case 'codeberg':
46+
return (
47+
<a key={repository} href={repository ?? ''}
48+
title="Codeberg repository" target="_blank" rel="noreferrer"
49+
className="hover:text-base-content"
50+
>
51+
<Image
52+
src="/images/codeberg-logo_vertical_blue.svg"
53+
alt="Codeberg logo"
54+
width={500}
55+
height={500}
56+
style={{width: '5rem'}}
57+
/>
58+
</a>
59+
)
4460
default:
4561
return (
4662
<a key={repository} href={repository ?? ''}

frontend/components/software/edit/links/AutosaveRepositoryUrl.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ async function suggestPlatform(repositoryUrl: string | null): Promise<null | Cod
3838
if (repositoryUrl?.includes('data.4tu.nl')) {
3939
return '4tu'
4040
}
41+
if (repositoryUrl?.includes('codeberg.org')) {
42+
return 'codeberg'
43+
}
4144

4245
try {
4346
const repositoryUrlDomain = new URL(repositoryUrl)

frontend/components/software/edit/links/config.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const config={
4040
{label: 'GitLab', value: 'gitlab'},
4141
{label: 'Bitbucket', value: 'bitbucket'},
4242
{label: '4TU', value: '4tu'},
43+
{label: 'Codeberg', value: 'codeberg'},
4344
{label: 'Other', value: 'other'},
4445
]
4546
},
Lines changed: 147 additions & 0 deletions
Loading

frontend/public/images/github-logo-white.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

frontend/types/SoftwareTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import {AutocompleteOption} from './AutocompleteOptions'
1818
import {CategoryPath} from './Category'
1919
import {OrganisationStatus} from './Organisation'
2020

21-
export type CodePlatform = 'github' | 'gitlab' | 'bitbucket' | '4tu' | 'other'
21+
export type CodePlatform = 'github' | 'gitlab' | 'bitbucket' | '4tu' | 'codeberg' | 'other'
2222

2323
export type RepositoryUrl = {
2424
software: string,
2525
url: string,
2626
// enum based on db enum defined as
27-
// platform_type in 003-create-relations-for-software.sql
27+
// platform_type in 005-create-relations-for-software.sql
2828
code_platform: CodePlatform,
2929
// options fields used to reset values on update
3030
// these are filled by scrapers

0 commit comments

Comments
 (0)