From 2bd1c9a510c64f6e9fc813757bf61c1e504e6828 Mon Sep 17 00:00:00 2001 From: ullbergm Date: Sat, 29 Oct 2022 23:28:17 -0400 Subject: [PATCH 01/13] Update apps.go case-insensitive comparison --- internal/handlers/apps.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/handlers/apps.go b/internal/handlers/apps.go index 4bdcd2ba..1f1624f8 100644 --- a/internal/handlers/apps.go +++ b/internal/handlers/apps.go @@ -2,6 +2,7 @@ package handlers import ( "net/http" + "strings" "github.com/go-chi/chi/v5" "github.com/go-chi/render" @@ -52,7 +53,7 @@ func (rs *appResource) ListApps(w http.ResponseWriter, r *http.Request) { for i, ingressAppGroup := range ingressApps { for x, customAppGroup := range customApps { - if customAppGroup.Group == ingressAppGroup.Group { + if strings.EqualFold(customAppGroup.Group, ingressAppGroup.Group) { ingressApps[i].Apps = append(ingressApps[i].Apps, customAppGroup.Apps...) customApps = append(customApps[:x], customApps[x+1:]...) } From e78f0e79f160dc0227f06b827adf99b9fdee432a Mon Sep 17 00:00:00 2001 From: ullbergm Date: Sun, 30 Oct 2022 07:40:52 -0400 Subject: [PATCH 02/13] Fix strings when loaded instead of in the frontend --- internal/hajimari/customapps/customapps.go | 5 ++--- internal/handlers/apps.go | 3 +-- internal/kube/wrappers/ingress.go | 4 ++-- internal/util/strings/strings.go | 5 +++++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/internal/hajimari/customapps/customapps.go b/internal/hajimari/customapps/customapps.go index 380e334c..0fe69cc6 100644 --- a/internal/hajimari/customapps/customapps.go +++ b/internal/hajimari/customapps/customapps.go @@ -1,10 +1,9 @@ package customapps import ( - "strings" - "github.com/toboshii/hajimari/internal/config" "github.com/toboshii/hajimari/internal/models" + utilStrings "github.com/toboshii/hajimari/internal/util/strings" ) // List struct is used for listing hajimari apps @@ -27,7 +26,7 @@ func (al *List) Populate() *List { var customApps []models.AppGroup for _, group := range al.appConfig.CustomApps { - group.Group = strings.ToLower(group.Group) + group.Group = utilStrings.NormalizeString(group.Group) customApps = append(customApps, group) } diff --git a/internal/handlers/apps.go b/internal/handlers/apps.go index 1f1624f8..4bdcd2ba 100644 --- a/internal/handlers/apps.go +++ b/internal/handlers/apps.go @@ -2,7 +2,6 @@ package handlers import ( "net/http" - "strings" "github.com/go-chi/chi/v5" "github.com/go-chi/render" @@ -53,7 +52,7 @@ func (rs *appResource) ListApps(w http.ResponseWriter, r *http.Request) { for i, ingressAppGroup := range ingressApps { for x, customAppGroup := range customApps { - if strings.EqualFold(customAppGroup.Group, ingressAppGroup.Group) { + if customAppGroup.Group == ingressAppGroup.Group { ingressApps[i].Apps = append(ingressApps[i].Apps, customAppGroup.Apps...) customApps = append(customApps[:x], customApps[x+1:]...) } diff --git a/internal/kube/wrappers/ingress.go b/internal/kube/wrappers/ingress.go index 5695b572..d3fc3bb9 100644 --- a/internal/kube/wrappers/ingress.go +++ b/internal/kube/wrappers/ingress.go @@ -50,9 +50,9 @@ func (iw *IngressWrapper) GetNamespace() string { // GetGroup func extracts group name from the ingress func (iw *IngressWrapper) GetGroup() string { if groupFromAnnotation := iw.GetAnnotationValue(annotations.HajimariGroupAnnotation); groupFromAnnotation != "" { - return groupFromAnnotation + return utilStrings.NormalizeString(groupFromAnnotation) } - return iw.GetNamespace() + return utilStrings.NormalizeString(iw.GetNamespace()) } // GetGroup func extracts group name from the ingress diff --git a/internal/util/strings/strings.go b/internal/util/strings/strings.go index 5a0b9d92..25f7f6ea 100644 --- a/internal/util/strings/strings.go +++ b/internal/util/strings/strings.go @@ -23,3 +23,8 @@ func ContainsBetweenDelimiter(fullString string, search string, delimiter string } return false } + +// NormalizeString trims extra spaces and changes the string to lower-case +func NormalizeString(str string) string { + return strings.TrimSpace(strings.ToLower(str)) +} \ No newline at end of file From d21b5019c03340faceee52f7bbf3c3faacbd83a2 Mon Sep 17 00:00:00 2001 From: ullbergm Date: Mon, 31 Oct 2022 08:51:28 -0400 Subject: [PATCH 03/13] Fix app groups (#1) fix: Case-insensitive matching when adding custom apps to the app groups --- internal/hajimari/customapps/customapps.go | 5 ++--- internal/kube/wrappers/ingress.go | 4 ++-- internal/util/strings/strings.go | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/hajimari/customapps/customapps.go b/internal/hajimari/customapps/customapps.go index 380e334c..0fe69cc6 100644 --- a/internal/hajimari/customapps/customapps.go +++ b/internal/hajimari/customapps/customapps.go @@ -1,10 +1,9 @@ package customapps import ( - "strings" - "github.com/toboshii/hajimari/internal/config" "github.com/toboshii/hajimari/internal/models" + utilStrings "github.com/toboshii/hajimari/internal/util/strings" ) // List struct is used for listing hajimari apps @@ -27,7 +26,7 @@ func (al *List) Populate() *List { var customApps []models.AppGroup for _, group := range al.appConfig.CustomApps { - group.Group = strings.ToLower(group.Group) + group.Group = utilStrings.NormalizeString(group.Group) customApps = append(customApps, group) } diff --git a/internal/kube/wrappers/ingress.go b/internal/kube/wrappers/ingress.go index 5695b572..d3fc3bb9 100644 --- a/internal/kube/wrappers/ingress.go +++ b/internal/kube/wrappers/ingress.go @@ -50,9 +50,9 @@ func (iw *IngressWrapper) GetNamespace() string { // GetGroup func extracts group name from the ingress func (iw *IngressWrapper) GetGroup() string { if groupFromAnnotation := iw.GetAnnotationValue(annotations.HajimariGroupAnnotation); groupFromAnnotation != "" { - return groupFromAnnotation + return utilStrings.NormalizeString(groupFromAnnotation) } - return iw.GetNamespace() + return utilStrings.NormalizeString(iw.GetNamespace()) } // GetGroup func extracts group name from the ingress diff --git a/internal/util/strings/strings.go b/internal/util/strings/strings.go index 5a0b9d92..25f7f6ea 100644 --- a/internal/util/strings/strings.go +++ b/internal/util/strings/strings.go @@ -23,3 +23,8 @@ func ContainsBetweenDelimiter(fullString string, search string, delimiter string } return false } + +// NormalizeString trims extra spaces and changes the string to lower-case +func NormalizeString(str string) string { + return strings.TrimSpace(strings.ToLower(str)) +} \ No newline at end of file From 0ce437aa5cf2c36a2837e2ea806eb5f7dad00891 Mon Sep 17 00:00:00 2001 From: ullbergm Date: Mon, 31 Oct 2022 08:52:56 -0400 Subject: [PATCH 04/13] feat: Sort apps alphabetically * Sort apps alphabetically (case-insensitive) --- internal/handlers/apps.go | 7 +++++++ internal/util/strings/strings.go | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/handlers/apps.go b/internal/handlers/apps.go index 4bdcd2ba..9f6f7a2e 100644 --- a/internal/handlers/apps.go +++ b/internal/handlers/apps.go @@ -2,6 +2,7 @@ package handlers import ( "net/http" + "sort" "github.com/go-chi/chi/v5" "github.com/go-chi/render" @@ -9,6 +10,7 @@ import ( "github.com/toboshii/hajimari/internal/hajimari/customapps" "github.com/toboshii/hajimari/internal/models" "github.com/toboshii/hajimari/internal/services" + utilStrings "github.com/toboshii/hajimari/internal/util/strings" ) type appResource struct { @@ -57,6 +59,11 @@ func (rs *appResource) ListApps(w http.ResponseWriter, r *http.Request) { customApps = append(customApps[:x], customApps[x+1:]...) } } + + // Sort ingressApps[i].Apps alphabetically + sort.Slice(ingressApps[i].Apps, func(j, k int) bool { + return utilStrings.CompareNormalized(ingressApps[i].Apps[j].Name, ingressApps[i].Apps[k].Name) == -1 + }) } apps = append(ingressApps, customApps...) diff --git a/internal/util/strings/strings.go b/internal/util/strings/strings.go index 25f7f6ea..94a917cb 100644 --- a/internal/util/strings/strings.go +++ b/internal/util/strings/strings.go @@ -27,4 +27,9 @@ func ContainsBetweenDelimiter(fullString string, search string, delimiter string // NormalizeString trims extra spaces and changes the string to lower-case func NormalizeString(str string) string { return strings.TrimSpace(strings.ToLower(str)) -} \ No newline at end of file +} + +// CompareNormalized compares two strings after normalizing them +func CompareNormalized(a string, b string) int { + return strings.Compare(NormalizeString(a), NormalizeString(b)) +} From 33ec6427495b855d56c56692f9e90bad1a2f43b3 Mon Sep 17 00:00:00 2001 From: ullbergm Date: Mon, 31 Oct 2022 08:58:35 -0400 Subject: [PATCH 05/13] Helm chart config reload (#3) feat(helm): Add a checksum of the config to force a redeployment when the config changes --- charts/hajimari/templates/common.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/hajimari/templates/common.yaml b/charts/hajimari/templates/common.yaml index b22dafeb..8cd20c5a 100644 --- a/charts/hajimari/templates/common.yaml +++ b/charts/hajimari/templates/common.yaml @@ -10,5 +10,6 @@ volumeSpec: name: {{ include "common.names.fullname" . }}-settings {{- end -}} {{- $_ := set .Values.persistence "hajimari-settings" (include "hajimari.settingsVolume" . | fromYaml) -}} +{{- $_ := set .Values.podAnnotations "checksum/config" (.Values.hajimari | toYaml | sha256sum) -}} -{{ include "common.all" . }} \ No newline at end of file +{{ include "common.all" . }} From bbf9d5af3e4f86b29873be9e1e7040ead73a17f2 Mon Sep 17 00:00:00 2001 From: ullbergm Date: Thu, 27 Apr 2023 16:25:48 -0400 Subject: [PATCH 06/13] Update release.yaml --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1ecf788d..2352a386 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,7 +7,7 @@ on: - published env: - REGISTRY_IMAGE: ghcr.io/toboshii/hajimari + REGISTRY_IMAGE: ghcr.io/ullbergm/hajimari jobs: build: From 122db485c8a4739fea532253cb3a8f32dcdbce26 Mon Sep 17 00:00:00 2001 From: ullbergm Date: Thu, 30 May 2024 07:51:02 -0400 Subject: [PATCH 07/13] rename ingressApps -> kubeApps --- internal/handlers/apps.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/handlers/apps.go b/internal/handlers/apps.go index a4b0eb85..40e9bcc1 100644 --- a/internal/handlers/apps.go +++ b/internal/handlers/apps.go @@ -66,9 +66,9 @@ func (rs *appResource) ListApps(w http.ResponseWriter, r *http.Request) { } } - // Sort ingressApps[i].Apps alphabetically - sort.Slice(ingressApps[i].Apps, func(j, k int) bool { - return utilStrings.CompareNormalized(ingressApps[i].Apps[j].Name, ingressApps[i].Apps[k].Name) == -1 + // Sort kubeApps[i].Apps alphabetically + sort.Slice(kubeApps[i].Apps, func(j, k int) bool { + return utilStrings.CompareNormalized(kubeApps[i].Apps[j].Name, kubeApps[i].Apps[k].Name) == -1 }) } From ecb58c7db5550568fc677ffb5828821209935aa4 Mon Sep 17 00:00:00 2001 From: Magnus Ullberg Date: Thu, 30 May 2024 08:07:10 -0400 Subject: [PATCH 08/13] updated to newer base images --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 097a76c7..a157d4bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/node:16.20-alpine AS build-frontend +FROM docker.io/node:22.2-alpine AS build-frontend WORKDIR /build @@ -10,7 +10,7 @@ RUN npm install RUN npm run build -FROM docker.io/golang:1.20.2-alpine as build +FROM docker.io/golang:1.22.3-alpine as build ARG TARGETPLATFORM ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64} @@ -37,7 +37,7 @@ RUN \ && \ chmod +x hajimari -FROM docker.io/alpine:3.17 +FROM docker.io/alpine:3.19 RUN \ apk add --no-cache \ From 985edc0ef22d72313b9a17ca1d5c972f5bb378e7 Mon Sep 17 00:00:00 2001 From: Magnus Ullberg Date: Thu, 30 May 2024 08:08:08 -0400 Subject: [PATCH 09/13] update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8d1a02f8..77573e6f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ _...The beginning of a pleasant experience_ [![Discord](https://img.shields.io/discord/879246010977779753?style=for-the-badge&label=discord&logo=discord&logoColor=white)](https://discord.gg/HWGZSWJsA8) [![Go](https://img.shields.io/badge/go-v1.19-brightgreen?style=for-the-badge&logo=go&logoColor=white)](https://go.dev/) -[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/toboshii/hajimari/ci?label=CI&logo=githubactions&style=for-the-badge)](https://github.com/toboshii/hajimari/actions/workflows/ci.yaml) +[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ullbergm/hajimari/ci?label=CI&logo=githubactions&style=for-the-badge)](https://github.com/ullbergm/hajimari/actions/workflows/ci.yaml) --- @@ -124,7 +124,7 @@ spec: name: Hajimari Issues group: info icon: simple-icons:github - url: https://github.com/toboshii/hajimari/issues + url: https://github.com/ullbergm/hajimari/issues info: Submit issue to this project targetBlank: true ``` From 463253368ca59bc00e6095b3cd2acb48af1cc61d Mon Sep 17 00:00:00 2001 From: Magnus Ullberg Date: Thu, 30 May 2024 08:09:49 -0400 Subject: [PATCH 10/13] update charts --- charts/hajimari/Chart.yaml | 10 +++++----- charts/hajimari/README.md | 8 ++++---- charts/hajimari/templates/app-sample.yaml | 2 +- charts/hajimari/values.yaml | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/charts/hajimari/Chart.yaml b/charts/hajimari/Chart.yaml index 4d21c5fa..edf5ea57 100644 --- a/charts/hajimari/Chart.yaml +++ b/charts/hajimari/Chart.yaml @@ -10,13 +10,13 @@ keywords: - hajimari - startpage - dashboard -home: https://github.com/toboshii/hajimari/tree/master/charts/hajimari -icon: https://raw.githubusercontent.com/toboshii/hajimari/main/assets/logo.png +home: https://github.com/ullbergm/hajimari/tree/master/charts/hajimari +icon: https://raw.githubusercontent.com/ullbergm/hajimari/main/assets/logo.png sources: -- https://github.com/toboshii/hajimari +- https://github.com/ullbergm/hajimari maintainers: -- name: toboshii - email: toboshii@users.noreply.github.com +- name: ullbergm + email: ullbergm@users.noreply.github.com dependencies: - name: common version: 0.2.2 diff --git a/charts/hajimari/README.md b/charts/hajimari/README.md index 1f638132..9dbc79f3 100644 --- a/charts/hajimari/README.md +++ b/charts/hajimari/README.md @@ -5,13 +5,13 @@ Hajimari is a beautiful & customizable browser startpage/dashboard with Kubernetes application discovery -**Homepage:** +**Homepage:** ## Maintainers | Name | Email | Url | | ---- | ------ | --- | -| toboshii | | | +| ullbergm | | | ## Example values to get started @@ -163,7 +163,7 @@ persistence: ## Source Code -* +* ## Requirements @@ -188,7 +188,7 @@ Kubernetes: `>=1.16.0-0` | hajimari.namespaceSelector | object | `{"matchNames":["media"]}` | Namespace selector to use for discovering applications | | hajimari.title | string | `nil` | Override the title of the Hajimari pages | | image.pullPolicy | string | `"IfNotPresent"` | image pull policy | -| image.repository | string | `"ghcr.io/toboshii/hajimari"` | image repository | +| image.repository | string | `"ghcr.io/ullbergm/hajimari"` | image repository | | image.tag | string | `"v0.3.1"` | image tag | | ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. | | persistence | object | See values.yaml | Configure persistence settings for the chart under this key. | diff --git a/charts/hajimari/templates/app-sample.yaml b/charts/hajimari/templates/app-sample.yaml index 7f0ae274..600ed473 100644 --- a/charts/hajimari/templates/app-sample.yaml +++ b/charts/hajimari/templates/app-sample.yaml @@ -8,7 +8,7 @@ spec: name: Hajimari Issues group: info icon: simple-icons:github - url: https://github.com/toboshii/hajimari/issues + url: https://github.com/ullbergm/hajimari/issues info: Submit issue to this project targetBlank: true diff --git a/charts/hajimari/values.yaml b/charts/hajimari/values.yaml index d1eea536..d65370df 100644 --- a/charts/hajimari/values.yaml +++ b/charts/hajimari/values.yaml @@ -7,11 +7,11 @@ image: # -- image repository - repository: ghcr.io/toboshii/hajimari + repository: ghcr.io/ullbergm/hajimari # -- image pull policy pullPolicy: IfNotPresent # -- image tag - tag: v0.3.1 + tag: latest # -- environment variables. # @default -- See below From 00b5f13edf37b2c59a62169d7c435b9494ef9930 Mon Sep 17 00:00:00 2001 From: Magnus Ullberg Date: Thu, 30 May 2024 08:16:00 -0400 Subject: [PATCH 11/13] change references --- .github/CODEOWNERS | 2 +- .github/renovate.json5 | 10 +++++----- .github/workflows/ci.yaml | 2 +- Dockerfile | 2 +- cmd/hajimari/main.go | 6 +++--- frontend/src/lib/Modal/Modal.svelte | 2 +- frontend/src/routes/+error.svelte | 2 +- go.mod | 2 +- internal/config/config.go | 2 +- internal/hajimari/crdapps/apps.go | 14 +++++++------- internal/hajimari/customapps/customapps.go | 6 +++--- internal/hajimari/ingressapps/apps.go | 14 +++++++------- internal/hajimari/ingressapps/filters.go | 6 +++--- internal/handlers/apps.go | 10 +++++----- internal/handlers/bookmarks.go | 4 ++-- internal/handlers/handler.go | 6 +++--- internal/handlers/notfound.go | 2 +- internal/handlers/startpage.go | 6 +++--- internal/kube/client.go | 2 +- internal/kube/lists/crdapps/crdapps.go | 2 +- internal/kube/lists/ingresses/ingresses.go | 2 +- internal/kube/util/namespaces.go | 2 +- internal/kube/util/replicastatusgetter.go | 2 +- internal/kube/wrappers/app.go | 2 +- internal/kube/wrappers/helpers.go | 2 +- internal/kube/wrappers/ingress.go | 4 ++-- internal/services/app.go | 14 +++++++------- internal/services/startpage.go | 6 +++--- internal/stores/file.go | 2 +- internal/stores/memory.go | 4 ++-- internal/stores/startpage.go | 2 +- 31 files changed, 72 insertions(+), 72 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 43db9f6e..6b9a1ce1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,2 @@ # https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners -* @toboshii +* @ullbergm diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 323a0595..79343595 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -8,14 +8,14 @@ ":enablePreCommit", ":automergeDigest", ":automergeBranchPush", - "github>toboshii/home-ops//.github/renovate/commitMessage.json5", - "github>toboshii/home-ops//.github/renovate/labels.json5", - "github>toboshii/home-ops//.github/renovate/semanticCommits.json5", - "github>toboshii/home-ops//.github/renovate/allowedVersions.json5" + "github>ullbergm/home-ops//.github/renovate/commitMessage.json5", + "github>ullbergm/home-ops//.github/renovate/labels.json5", + "github>ullbergm/home-ops//.github/renovate/semanticCommits.json5", + "github>ullbergm/home-ops//.github/renovate/allowedVersions.json5" ], "platform": "github", "username": "chii-bot[bot]", - "repositories": ["toboshii/hajimari"], + "repositories": ["ullbergm/hajimari"], "onboarding": false, "requireConfig": false, "gitAuthor": "chii-bot <109454249+chii-bot[bot]@users.noreply.github.com>", diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2e70696f..a8faccec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,7 +8,7 @@ on: - "charts/hajimari/**" env: - REGISTRY_IMAGE: ghcr.io/toboshii/hajimari + REGISTRY_IMAGE: ghcr.io/ullbergm/hajimari jobs: build: diff --git a/Dockerfile b/Dockerfile index a157d4bc..d1446b10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,4 +54,4 @@ USER hajimari:hajimari ENTRYPOINT [ "/sbin/tini", "--" ] CMD [ "hajimari" ] -LABEL org.opencontainers.image.source https://github.com/toboshii/hajimari +LABEL org.opencontainers.image.source https://github.com/ullbergm/hajimari diff --git a/cmd/hajimari/main.go b/cmd/hajimari/main.go index 8185f062..0a1871fe 100644 --- a/cmd/hajimari/main.go +++ b/cmd/hajimari/main.go @@ -6,9 +6,9 @@ import ( "github.com/fsnotify/fsnotify" "github.com/spf13/viper" - "github.com/toboshii/hajimari/internal/config" - "github.com/toboshii/hajimari/internal/handlers" - "github.com/toboshii/hajimari/internal/log" + "github.com/ullbergm/hajimari/internal/config" + "github.com/ullbergm/hajimari/internal/handlers" + "github.com/ullbergm/hajimari/internal/log" ) var ( diff --git a/frontend/src/lib/Modal/Modal.svelte b/frontend/src/lib/Modal/Modal.svelte index e4f16567..e6e30932 100644 --- a/frontend/src/lib/Modal/Modal.svelte +++ b/frontend/src/lib/Modal/Modal.svelte @@ -147,7 +147,7 @@