From 78b50004b2eb4183ef1028a262414bb5f5000329 Mon Sep 17 00:00:00 2001 From: Bogdan Brinza Date: Thu, 14 Nov 2024 16:33:57 -0800 Subject: [PATCH] Breaking change: Renaming parameters operating-system, language-code to use property names (os and lang-code), also renaming exclude-patches to no-patches Removing external-url parameter --- README.md | 8 ++--- cli-commands.txt | 57 ++++++++++++++++------------------ cli/cleanup.go | 4 +-- cli/get_downloads.go | 4 +-- cli/get_purchases.go | 8 ++--- cli/serve.go | 17 +++++----- cli/size.go | 4 +-- cli/summarize.go | 16 ++++------ cli/sync.go | 15 ++++----- cli/update_downloads.go | 6 ++-- cli/validate.go | 4 +-- cli/vet.go | 4 +-- go.mod | 4 +-- go.sum | 4 +++ rest/get_downloads.go | 2 +- rest/get_downloads_metadata.go | 2 +- rest/init.go | 6 ++-- 17 files changed, 77 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index e77fdabb..25b53b3c 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,9 @@ services: image: ghcr.io/arelate/vangogh:latest environment: # Download lists filters - # - VG_OPERATING-SYSTEM=Windows,macOS - # - VG_LANGUAGE-CODE=en,fr - # - VG_EXCLUDE-PATCHES=true - # External URL for Atom feed - # - VG_EXTERNAL-URL=https://vangogh.arles + # - VG_OS=Windows,macOS + # - VG_LANG-CODE=en,fr + # - VG_NO-PATCHES=true # debug # - VG_SYNC_DEBUG=true volumes: diff --git a/cli-commands.txt b/cli-commands.txt index a59e625f..d6181022 100644 --- a/cli-commands.txt +++ b/cli-commands.txt @@ -13,10 +13,10 @@ cascade-validation cleanup id^& slug& - operating-system&$={operating-systems^} + os&$={operating-systems^} download-type&$={download-types^} - language-code&$={language-codes^} - exclude-patches$ + lang-code&$={language-codes^} + no-patches$ all test delete @@ -39,10 +39,10 @@ get-data get-downloads id^& slug& - operating-system&$={operating-systems^} + os&$={operating-systems^} download-type&$={download-types^} - language-code&$={language-codes^} - exclude-patches$ + lang-code&$={language-codes^} + no-patches$ missing force @@ -59,11 +59,10 @@ get-items get-purchases id^& since-hours-ago - operating-system&$={operating-systems^} + os&$={operating-systems^} download-type&$={download-types^} - language-code&$={language-codes^} - exclude-patches$ - external-url + lang-code&$={language-codes^} + no-patches$ force get-summary @@ -112,9 +111,9 @@ search serve port$* stderr$ - operating-system$ - language-code$ - exclude-patches$ + os$ + lang-code$ + no-patches$ admin-username$ admin-password$ shared-username$ @@ -123,24 +122,22 @@ serve size id^& slug& - operating-system&$={operating-systems^} + os&$={operating-systems^} download-type&$={download-types^} - language-code&$={language-codes^} - exclude-patches$ + lang-code&$={language-codes^} + no-patches$ missing all summarize since-hours-ago - external-url$ sync since-hours-ago - operating-system&$={operating-systems^} + os&$={operating-systems^} download-type&$={download-types^} - language-code&$={language-codes^} - exclude-patches$ - external-url$ + lang-code&$={language-codes^} + no-patches$ debug$ {sync-options^&} @@ -151,30 +148,30 @@ tag tag-name update-downloads - operating-system&$={operating-systems^} + os&$={operating-systems^} download-type&$={download-types^} - language-code&$={language-codes^} - exclude-patches$ + lang-code&$={language-codes^} + no-patches$ since-hours-ago updates-only validate id^& slug& - operating-system&$={operating-systems^} + os&$={operating-systems^} download-type&$={download-types^} - language-code&$={language-codes^} - exclude-patches$ + lang-code&$={language-codes^} + no-patches$ all skip-valid version vet - operating-system&$={operating-systems^} + os&$={operating-systems^} download-type&$={download-types^} - language-code&$={language-codes^} - exclude-patches$ + lang-code&$={language-codes^} + no-patches$ fix {vet-options^&} diff --git a/cli/cleanup.go b/cli/cleanup.go index e0397b00..49fa5db0 100644 --- a/cli/cleanup.go +++ b/cli/cleanup.go @@ -25,8 +25,8 @@ func CleanupHandler(u *url.URL) error { idSet, vangogh_local_data.OperatingSystemsFromUrl(u), vangogh_local_data.DownloadTypesFromUrl(u), - vangogh_local_data.ValuesFromUrl(u, "language-code"), - vangogh_local_data.FlagFromUrl(u, "exclude-patches"), + vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty), + vangogh_local_data.FlagFromUrl(u, "no-patches"), vangogh_local_data.FlagFromUrl(u, "all"), vangogh_local_data.FlagFromUrl(u, "test"), vangogh_local_data.FlagFromUrl(u, "delete")) diff --git a/cli/get_downloads.go b/cli/get_downloads.go index 1dc06bb4..fa58e2eb 100644 --- a/cli/get_downloads.go +++ b/cli/get_downloads.go @@ -28,8 +28,8 @@ func GetDownloadsHandler(u *url.URL) error { idSet, vangogh_local_data.OperatingSystemsFromUrl(u), vangogh_local_data.DownloadTypesFromUrl(u), - vangogh_local_data.ValuesFromUrl(u, "language-code"), - vangogh_local_data.FlagFromUrl(u, "exclude-patches"), + vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty), + vangogh_local_data.FlagFromUrl(u, "no-patches"), vangogh_local_data.FlagFromUrl(u, "missing"), vangogh_local_data.FlagFromUrl(u, "force")) } diff --git a/cli/get_purchases.go b/cli/get_purchases.go index 87ef948b..5e9055ab 100644 --- a/cli/get_purchases.go +++ b/cli/get_purchases.go @@ -22,9 +22,8 @@ func GetPurchasesHandler(u *url.URL) error { idSet, vangogh_local_data.OperatingSystemsFromUrl(u), vangogh_local_data.DownloadTypesFromUrl(u), - vangogh_local_data.ValuesFromUrl(u, "language-code"), - vangogh_local_data.FlagFromUrl(u, "exclude-patches"), - vangogh_local_data.ValueFromUrl(u, "external-url"), + vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty), + vangogh_local_data.FlagFromUrl(u, "no-patches"), vangogh_local_data.FlagFromUrl(u, "force")) } @@ -35,7 +34,6 @@ func GetPurchases( downloadTypes []vangogh_local_data.DownloadType, langCodes []string, excludePatches bool, - externalUrl string, force bool) error { productTypes := []vangogh_local_data.ProductType{ @@ -67,7 +65,7 @@ func GetPurchases( return err } - if err := Summarize(since, externalUrl); err != nil { + if err := Summarize(since); err != nil { return err } diff --git a/cli/serve.go b/cli/serve.go index 6835a82b..a2005664 100644 --- a/cli/serve.go +++ b/cli/serve.go @@ -17,20 +17,19 @@ func ServeHandler(u *url.URL) error { return err } - osStrings := vangogh_local_data.ValuesFromUrl(u, "operating-system") - os := vangogh_local_data.ParseManyOperatingSystems(osStrings) - lc := vangogh_local_data.ValuesFromUrl(u, "language-code") + oses := vangogh_local_data.OperatingSystemsFromUrl(u) + langCode := vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty) - if len(os) == 0 { - os = []vangogh_local_data.OperatingSystem{vangogh_local_data.AnyOperatingSystem} + if len(oses) == 0 { + oses = []vangogh_local_data.OperatingSystem{vangogh_local_data.AnyOperatingSystem} } - if len(lc) == 0 { - lc = []string{"en"} + if len(langCode) == 0 { + langCode = []string{"en"} } - excludePatches := vangogh_local_data.FlagFromUrl(u, "exclude-patches") + noPatches := vangogh_local_data.FlagFromUrl(u, "no-patches") - rest.SetDefaultDownloadsFilters(os, lc, excludePatches) + rest.SetDefaultDownloadsFilters(oses, langCode, noPatches) sharedUsername := vangogh_local_data.ValueFromUrl(u, "shared-username") sharedPassword := vangogh_local_data.ValueFromUrl(u, "shared-password") diff --git a/cli/size.go b/cli/size.go index 595f164b..28a2c3f7 100644 --- a/cli/size.go +++ b/cli/size.go @@ -17,8 +17,8 @@ func SizeHandler(u *url.URL) error { idSet, vangogh_local_data.OperatingSystemsFromUrl(u), vangogh_local_data.DownloadTypesFromUrl(u), - vangogh_local_data.ValuesFromUrl(u, "language-code"), - vangogh_local_data.FlagFromUrl(u, "exclude-patches"), + vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty), + vangogh_local_data.FlagFromUrl(u, "no-patches"), vangogh_local_data.FlagFromUrl(u, "missing"), vangogh_local_data.FlagFromUrl(u, "all")) } diff --git a/cli/summarize.go b/cli/summarize.go index 74f02e59..d3a8257d 100644 --- a/cli/summarize.go +++ b/cli/summarize.go @@ -28,14 +28,10 @@ func SummarizeHandler(u *url.URL) error { return err } - externalUrl := vangogh_local_data.ValueFromUrl(u, "external-url") - - return Summarize( - since, - externalUrl) + return Summarize(since) } -func Summarize(since int64, externalUrl string) error { +func Summarize(since int64) error { sa := nod.Begin("summarizing updates...") defer sa.End() @@ -91,7 +87,7 @@ func Summarize(since int64, externalUrl string) error { was := nod.Begin("publishing atom...") defer was.End() - if err := publishAtom(externalUrl, rdx, summary); err != nil { + if err := publishAtom(rdx, summary); err != nil { return was.EndWithError(err) } @@ -121,7 +117,7 @@ func releasedToday(rdx kevlar.ReadableRedux) ([]string, error) { return rdx.Sort(ids, vangogh_local_data.DefaultDesc, vangogh_local_data.DefaultSort) } -func publishAtom(externalUrl string, rdx kevlar.ReadableRedux, summary map[string][]string) error { +func publishAtom(rdx kevlar.ReadableRedux, summary map[string][]string) error { afp, err := vangogh_local_data.AbsAtomFeedPath() if err != nil { @@ -133,8 +129,8 @@ func publishAtom(externalUrl string, rdx kevlar.ReadableRedux, summary map[strin return err } - af := atomus.NewFeed(atomFeedTitle, externalUrl) - af.SetEntry(atomEntryTitle, atomEntryAuthor, externalUrl, NewAtomFeedContent(rdx, summary)) + af := atomus.NewFeed(atomFeedTitle, "") + af.SetEntry(atomEntryTitle, atomEntryAuthor, "", NewAtomFeedContent(rdx, summary)) return af.Encode(atomFile) } diff --git a/cli/sync.go b/cli/sync.go index ce44ee40..cf136cab 100644 --- a/cli/sync.go +++ b/cli/sync.go @@ -70,7 +70,6 @@ func SyncHandler(u *url.URL) error { return err } - externalUrl := vangogh_local_data.ValueFromUrl(u, "external-url") debug := vangogh_local_data.FlagFromUrl(u, "debug") return Sync( @@ -78,9 +77,8 @@ func SyncHandler(u *url.URL) error { syncOpts, vangogh_local_data.OperatingSystemsFromUrl(u), vangogh_local_data.DownloadTypesFromUrl(u), - vangogh_local_data.ValuesFromUrl(u, "language-code"), - vangogh_local_data.FlagFromUrl(u, "exclude-patches"), - externalUrl, + vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty), + vangogh_local_data.FlagFromUrl(u, "no-patches"), debug) } @@ -90,8 +88,7 @@ func Sync( operatingSystems []vangogh_local_data.OperatingSystem, downloadTypes []vangogh_local_data.DownloadType, langCodes []string, - excludePatches bool, - gauginUrl string, + noPatches bool, debug bool) error { if debug { @@ -200,7 +197,7 @@ func Sync( // summarize sync updates now, since other updates are digital artifacts // and won't affect the summaries - if err := Summarize(syncStart, gauginUrl); err != nil { + if err := Summarize(syncStart); err != nil { return sa.EndWithError(err) } @@ -241,7 +238,7 @@ func Sync( operatingSystems, downloadTypes, langCodes, - excludePatches, + noPatches, since, false); err != nil { return sa.EndWithError(err) @@ -252,7 +249,7 @@ func Sync( operatingSystems, downloadTypes, langCodes, - excludePatches); err != nil { + noPatches); err != nil { return sa.EndWithError(err) } diff --git a/cli/update_downloads.go b/cli/update_downloads.go index 939a1a63..c4f2f411 100644 --- a/cli/update_downloads.go +++ b/cli/update_downloads.go @@ -17,10 +17,10 @@ func UpdateDownloadsHandler(u *url.URL) error { return UpdateDownloads( vangogh_local_data.OperatingSystemsFromUrl(u), vangogh_local_data.DownloadTypesFromUrl(u), - vangogh_local_data.ValuesFromUrl(u, "language-code"), - vangogh_local_data.FlagFromUrl(u, "exclude-patches"), + vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty), + vangogh_local_data.FlagFromUrl(u, "no-patches"), since, - vangogh_local_data.FlagFromUrl(u, "Updates-only")) + vangogh_local_data.FlagFromUrl(u, "updates-only")) } func UpdateDownloads( diff --git a/cli/validate.go b/cli/validate.go index ad64067f..de2dd72f 100644 --- a/cli/validate.go +++ b/cli/validate.go @@ -34,8 +34,8 @@ func ValidateHandler(u *url.URL) error { idSet, vangogh_local_data.OperatingSystemsFromUrl(u), vangogh_local_data.DownloadTypesFromUrl(u), - vangogh_local_data.ValuesFromUrl(u, "language-code"), - vangogh_local_data.FlagFromUrl(u, "exclude-patches"), + vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty), + vangogh_local_data.FlagFromUrl(u, "no-patches"), vangogh_local_data.FlagFromUrl(u, "all"), vangogh_local_data.FlagFromUrl(u, "skip-valid")) } diff --git a/cli/vet.go b/cli/vet.go index c66623f5..5c0cd21b 100644 --- a/cli/vet.go +++ b/cli/vet.go @@ -72,8 +72,8 @@ func VetHandler(u *url.URL) error { vetOpts, vangogh_local_data.OperatingSystemsFromUrl(u), vangogh_local_data.DownloadTypesFromUrl(u), - vangogh_local_data.ValuesFromUrl(u, "language-code"), - vangogh_local_data.FlagFromUrl(u, "exclude-patches"), + vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty), + vangogh_local_data.FlagFromUrl(u, "no-patches"), vangogh_local_data.FlagFromUrl(u, "fix")) } diff --git a/go.mod b/go.mod index a3e532c5..68ce6c18 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,8 @@ go 1.23.3 require ( github.com/arelate/southern_light v0.1.51 - github.com/arelate/vangogh_local_data v0.4.33 - github.com/boggydigital/atomus v0.1.9 + github.com/arelate/vangogh_local_data v0.4.34 + github.com/boggydigital/atomus v0.1.10 github.com/boggydigital/backups v0.1.3 github.com/boggydigital/clo v1.0.4 github.com/boggydigital/compton v0.2.23 diff --git a/go.sum b/go.sum index 7a6cb549..b7081c9b 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,12 @@ github.com/arelate/vangogh_local_data v0.4.32 h1:2hP3oQrFyr+OjfUoBwyKWnF3hv9o2CT github.com/arelate/vangogh_local_data v0.4.32/go.mod h1:hXcjRAhGb6tjpOuSc7kN94kZANnybUVZALXfYstrjfw= github.com/arelate/vangogh_local_data v0.4.33 h1:Dgjjhp710QZplTlzqzBautjGVF2CIR2PY6SnI7YgYMs= github.com/arelate/vangogh_local_data v0.4.33/go.mod h1:hXcjRAhGb6tjpOuSc7kN94kZANnybUVZALXfYstrjfw= +github.com/arelate/vangogh_local_data v0.4.34 h1:DRHk2vH0n2fIdQ7ZydGm1vw7/u2G+HKYybMo0Ny4Ud0= +github.com/arelate/vangogh_local_data v0.4.34/go.mod h1:hXcjRAhGb6tjpOuSc7kN94kZANnybUVZALXfYstrjfw= github.com/boggydigital/atomus v0.1.9 h1:zAmXtAAXtBzMfz/83nEO4x8/uSLlPOq5wynW1jR/rbk= github.com/boggydigital/atomus v0.1.9/go.mod h1:mvPDNDMrpFZ7RHbyMrt30hVXFU+VoeCvHnT83Zhj91I= +github.com/boggydigital/atomus v0.1.10 h1:ERmg6ncLOJ/y0B13SSRAIpjDgWQfEqfeQwFBSYgrjg0= +github.com/boggydigital/atomus v0.1.10/go.mod h1:YK4iAWR9/+2rFhfaGLjkfoFiCPY5QNu8d23I/8wuWSY= github.com/boggydigital/backups v0.1.3 h1:Yq4/2kVxpexc0bAVA5tQPgdcKXPWsqihzgI759VPgVM= github.com/boggydigital/backups v0.1.3/go.mod h1:xIV5pr0U178hTV3mHfStSU+s1IOJUH4fOU81ad4Cq7Y= github.com/boggydigital/busan v0.1.0 h1:mUpe4b3vdt9Kcf4Z/C2YSuX5L7ru+J/iZW+IcSfW0cM= diff --git a/rest/get_downloads.go b/rest/get_downloads.go index a1b65c6e..d9dfccee 100644 --- a/rest/get_downloads.go +++ b/rest/get_downloads.go @@ -19,7 +19,7 @@ func GetDownloads(w http.ResponseWriter, r *http.Request) { id := r.URL.Query().Get("id") - dls, err := getDownloads(id, operatingSystems, languageCodes, excludePatches, rdx) + dls, err := getDownloads(id, operatingSystems, languageCodes, noPatches, rdx) if err != nil { http.Error(w, nod.Error(err).Error(), http.StatusInternalServerError) return diff --git a/rest/get_downloads_metadata.go b/rest/get_downloads_metadata.go index 6f80df7e..825eadd7 100644 --- a/rest/get_downloads_metadata.go +++ b/rest/get_downloads_metadata.go @@ -44,7 +44,7 @@ func GetDownloadsMetadata(w http.ResponseWriter, r *http.Request) { langCodes = languageCodes } - dls, err := getDownloads(id, oses, langCodes, excludePatches, rdx) + dls, err := getDownloads(id, oses, langCodes, noPatches, rdx) if err != nil { http.Error(w, nod.Error(err).Error(), http.StatusInternalServerError) return diff --git a/rest/init.go b/rest/init.go index a8f48c2c..e83efc73 100644 --- a/rest/init.go +++ b/rest/init.go @@ -17,7 +17,7 @@ const ( var ( operatingSystems []vangogh_local_data.OperatingSystem languageCodes []string - excludePatches bool + noPatches bool rdx kevlar.ReadableRedux ) @@ -25,10 +25,10 @@ var ( func SetDefaultDownloadsFilters( os []vangogh_local_data.OperatingSystem, lc []string, - ep bool) { + np bool) { operatingSystems = os languageCodes = lc - excludePatches = ep + noPatches = np } func SetUsername(role, u string) {