Skip to content

Commit

Permalink
Add filename property to app info
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintPatrck committed Aug 26, 2024
1 parent 81e2b1c commit 1daeb8b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
7 changes: 4 additions & 3 deletions apps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ bitwarden:
git: https://github.com/bitwarden/android
name: "Bitwarden"
description: |
This repo has the new native Android app, currently in Beta. Looking for the legacy .NET MAUI apps? Head on over to bitwarden/mobile.
This repo has the new native Android app. Looking for the legacy .NET MAUI apps? Head on over to bitwarden/mobile.
filename: "com.x8bit.bitwarden-fdroid.apk"
categories:
- Security

bitwarden-beta:
git: https://github.com/bitwarden/android
name: "Bitwarden Beta"
prerelease: true
filename: "com.x8bit.bitwarden.beta-fdroid.apk"
description: |
This repo has the new native Android app. Looking for the legacy .NET MAUI apps? Head on over to bitwarden/mobile.
This repo has the new native Android app Beta version. Looking for the legacy .NET MAUI apps? Head on over to bitwarden/mobile.
categories:
- Security
4 changes: 2 additions & 2 deletions metascoop/apps/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ type AppInfo struct {

AntiFeatures []string `yaml:"anti_features"`

Filename string `yaml:"filename"`

ReleaseDescription string

License string

Prerelease bool `yaml:"prerelease"`
}

func (a AppInfo) Name() string {
Expand Down
12 changes: 2 additions & 10 deletions metascoop/apps/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,13 @@ import (
"golang.org/x/text/unicode/norm"
)

func FindAPKRelease(release *github.RepositoryRelease) *github.ReleaseAsset {
return FindAPK(release, "fdroid.apk")
}

func FindAPKBeta(release* github.RepositoryRelease) *github.ReleaseAsset {
return FindAPK(release, "-fdroid-beta.apk")
}

func FindAPK(release* github.RepositoryRelease, suffix string) *github.ReleaseAsset {
func FindAPK(release* github.RepositoryRelease, fileName string) *github.ReleaseAsset {
for _, asset := range release.Assets {
if asset.State == nil || *asset.State != "uploaded" {
continue
}

if asset.Name != nil && strings.HasSuffix(*asset.Name, suffix) {
if asset.Name != nil && asset.Name == filename {
return asset
}
}
Expand Down
10 changes: 2 additions & 8 deletions metascoop/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,10 @@ func main() {
log.Printf("Working on release with tag name %q", release.GetTagName())
var apk *github.ReleaseAsset

if app.Prerelease {
log.Printf("Looking for pre-release asset %s", release.GetName())
apk = apps.FindAPKBeta(release)
} else {
log.Printf("Looking for production asset %s", release.GetName())
apk = apps.FindAPKRelease(release)
}
apk = apps.FindAPK(app.Filename)

if apk == nil {
log.Printf("Couldn't find any F-Droid assets for application %s in %s", app.FriendlyName, release.GetName())
log.Printf("Couldn't find any F-Droid assets for application %s in %s with file name %s", app.FriendlyName, release.GetName(), app.FileName)
return false
}

Expand Down

0 comments on commit 1daeb8b

Please sign in to comment.