A self-hosted dashboard that puts all your feeds in one place
Go aggregatordashboarddockerfeed-readergohomelabhomepagemonitoringredditrssrss-readerself-hostedstartpageyoutube
add codeberg releases
micash60f4183057f7
diff --git a/docs/configuration.md b/docs/configuration.mdindex 944019e..fb119a5 100644--- a/docs/configuration.md+++ b/docs/configuration.md@@ -1114,7 +1114,7 @@ Whether to ignore invalid/self-signed certificates.Whether to open the link in the same or a new tab.### Releases-Display a list of latest releases for specific repositories on Github, GitLab or Docker Hub.+Display a list of latest releases for specific repositories on Github, GitLab, Codeberg or Docker Hub.Example:@@ -1125,6 +1125,7 @@ Example:- go-gitea/gitea- jellyfin/jellyfin- glanceapp/glance+ - codeberg:redict/redict- gitlab:fdroid/fdroidclient- dockerhub:gotify/server```@@ -1145,12 +1146,13 @@ Preview:| collapse-after | integer | no | 5 |##### `repositories`-A list of repositores to fetch the latest release for. Only the name/repo is required, not the full URL. A prefix can be specified for repositories hosted elsewhere such as GitLab and Docker Hub. Example:+A list of repositores to fetch the latest release for. Only the name/repo is required, not the full URL. A prefix can be specified for repositories hosted elsewhere such as GitLab, Codeberg and Docker Hub. Example:```yamlrepositories:- gitlab:inkscape/inkscape- dockerhub:glanceapp/glance+ - codeberg:redict/redict```Official images on Docker Hub can be specified by ommiting the owner:@@ -1172,7 +1174,7 @@ repositories:##### `show-source-icon`-Shows an icon of the source (GitHub/GitLab/Docker Hub) next to the repository name when set to `true`.+Shows an icon of the source (GitHub/GitLab/Codeberg/Docker Hub) next to the repository name when set to `true`.##### `token`Without authentication Github allows for up to 60 requests per hour. You can easily exceed this limit and start seeing errors if you're tracking lots of repositories or your cache time is low. To circumvent this you can [create a read only token from your Github account](https://github.com/settings/personal-access-tokens/new) and provide it here.diff --git a/internal/assets/static/icons/codeberg.svg b/internal/assets/static/icons/codeberg.svgnew file mode 100644index 0000000..a87790e--- /dev/null+++ b/internal/assets/static/icons/codeberg.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233"><g style="opacity:1"><path d="M46.984 76.122a2.117 2.117 0 0 0-1.793 3.242l1.764-2.281c.013-.017.045-.017.057 0l.737.952h-.527l.011.042h.55l.155.201h-.648l.018.066h.68l.138.177h-.769l.024.085h.81l.123.158h-.889l.03.104h.938l.108.138h-1.009l.033.115h1.065l.099.128H47.56l.033.115h1.184a2.117 2.117 0 0 0-1.793-3.242m.644 3.37.033.115h.939q.047-.056.09-.115zm.068.243.032.115h.629a3 3 0 0 0 .125-.115zm.068.243.032.114h.212c.063-.036.121-.072.184-.114z" style="fill-opacity:1;stroke:none;stroke-width:.0660874;paint-order:markers fill stroke;stop-color:#000" transform="translate(-44.867 -75.99)"/></g></svg>\ No newline at end of filediff --git a/internal/feed/codeberg.go b/internal/feed/codeberg.gonew file mode 100644index 0000000..edd83d7--- /dev/null+++ b/internal/feed/codeberg.go@@ -0,0 +1,39 @@+package feed++import (+ "fmt"+ "net/http"+)++type codebergReleaseResponseJson struct {+ TagName string `json:"tag_name"`+ PublishedAt string `json:"published_at"`+ HtmlUrl string `json:"html_url"`+}++func FetchLatestCodebergRelease(request *ReleaseRequest) (*AppRelease, error) {+ httpRequest, err := http.NewRequest(+ "GET",+ fmt.Sprintf(+ "https://codeberg.org/api/v1/repos/%s/releases/latest",+ request.Repository,+ ),+ nil,+ )+ if err != nil {+ return nil, err+ }++ response, err := decodeJsonFromRequest[codebergReleaseResponseJson](defaultClient, httpRequest)++ if err != nil {+ return nil, err+ }+ return &AppRelease{+ Source: ReleaseSourceCodeberg,+ Name: request.Repository,+ Version: normalizeVersionFormat(response.TagName),+ NotesUrl: response.HtmlUrl,+ TimeReleased: parseRFC3339Time(response.PublishedAt),+ }, nil+}diff --git a/internal/feed/releases.go b/internal/feed/releases.goindex 516801e..596d1be 100644--- a/internal/feed/releases.go+++ b/internal/feed/releases.go@@ -9,6 +9,7 @@ import (type ReleaseSource stringconst (+ ReleaseSourceCodeberg ReleaseSource = "codeberg"ReleaseSourceGithub ReleaseSource = "github"ReleaseSourceGitlab ReleaseSource = "gitlab"ReleaseSourceDockerHub ReleaseSource = "dockerhub"@@ -57,6 +58,8 @@ func FetchLatestReleases(requests []*ReleaseRequest) (AppReleases, error) {func fetchLatestReleaseTask(request *ReleaseRequest) (*AppRelease, error) {switch request.Source {+ case ReleaseSourceCodeberg:+ return FetchLatestCodebergRelease(request)case ReleaseSourceGithub:return fetchLatestGithubRelease(request)case ReleaseSourceGitlab:diff --git a/internal/widget/releases.go b/internal/widget/releases.goindex c7831cb..74b5af7 100644--- a/internal/widget/releases.go+++ b/internal/widget/releases.go@@ -40,7 +40,6 @@ func (widget *Releases) Initialize() error {for _, repository := range widget.Repositories {parts := strings.SplitN(repository, ":", 2)var request *feed.ReleaseRequest-if len(parts) == 1 {request = &feed.ReleaseRequest{Source: feed.ReleaseSourceGithub,@@ -65,6 +64,11 @@ func (widget *Releases) Initialize() error {Source: feed.ReleaseSourceDockerHub,Repository: parts[1],}+ } else if parts[0] == string(feed.ReleaseSourceCodeberg) {+ request = &feed.ReleaseRequest{+ Source: feed.ReleaseSourceCodeberg,+ Repository: parts[1],+ }} else {return errors.New("invalid repository source " + parts[0])}