From 36ce60aa28daad69f335a6e7dbab8792cea38e32 Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 17 Jan 2026 21:44:01 +0100 Subject: [PATCH 01/19] container sized down to 500px width --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index ba33966..56d7949 100644 --- a/main.go +++ b/main.go @@ -72,7 +72,7 @@ func helpHandler(w http.ResponseWriter, r *http.Request) { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); max-width: 800px; width: 90%; - min-width: 600px; + min-width: 500px; } h1 { font-size: 1.5rem; @@ -148,7 +148,7 @@ html := fmt.Sprintf( border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); width: 90%%; - min-width: 600px; + min-width: 500px; position: relative; } h1 { From 0a3f4ab5ef4934021bf7812559243fcd561c6875 Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 17 Jan 2026 21:59:54 +0100 Subject: [PATCH 02/19] added dynamic hostname to helpHandler --- main.go | 159 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 86 insertions(+), 73 deletions(-) diff --git a/main.go b/main.go index 56d7949..2dc114b 100644 --- a/main.go +++ b/main.go @@ -46,82 +46,95 @@ func passwordHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, password) } +// new help handler func helpHandler(w http.ResponseWriter, r *http.Request) { - helpHTML := ` - - - - Hilfe - - - - -
-

Hilfe: API-Endpunkt

-

- Diese Anwendung bietet einen API-Endpunkt, um Passwörter direkt über die Kommandozeile abzurufen. - Der Endpunkt gibt das Passwort im Plain-Text-Format zurück. -

-

Endpunkt:

-

http://localhost:8080/api/password

-

Beispiele:

-

Mac/Linux (Terminal):

-
echo $(curl -s http://localhost:8080/api/password)
-

Windows (PowerShell):

-
Invoke-RestMethod -Uri http://localhost:8080/api/password
-

Windows (cmd):

-
curl http://localhost:8080/api/password
-

- Zurück zur Passwort-Generierung -

-
- - - ` - w.Header().Set("Content-Type", "text/html; charset=utf-8") - fmt.Fprint(w, helpHTML) + helpHTML := ` + + + + Hilfe + + + + +
+

Hilfe: API-Endpunkt

+

+ Diese Anwendung bietet einen API-Endpunkt, um Passwörter direkt über die Kommandozeile abzurufen. + Der Endpunkt gibt das Passwort im Plain-Text-Format zurück. +

+

Endpunkt:

+

+

Beispiele:

+

Mac/Linux (Terminal):

+

+            

Windows (PowerShell):

+

+            

Windows (cmd):

+

+            

+ Zurück zur Passwort-Generierung +

+
+ + + + ` + w.Header().Set("Content-Type", "text/html; charset=utf-8") + fmt.Fprint(w, helpHTML) } + func webHandler(w http.ResponseWriter, r *http.Request) { password := generatePassword() html := fmt.Sprintf( From 1be4aeb6b8ef92f324441146878231cc509de128 Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 17 Jan 2026 22:24:16 +0100 Subject: [PATCH 03/19] updated MoreUsage.md --- misc/MoreUsage.md | 49 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/misc/MoreUsage.md b/misc/MoreUsage.md index b61e3da..fc20fbc 100644 --- a/misc/MoreUsage.md +++ b/misc/MoreUsage.md @@ -1,31 +1,60 @@ +## bash alias +You can configure an bash alias in your `~/.bashrc` like this: -# Baue die Go-Anwendung +``` +## genpasswd alias +alias genpasswd='echo $(curl -s https://passwd.scu.si/api/password)' +``` + +After making above changes you have to reload your ~/bashrc, in order to activate your changes. +``` +. ~/.bashrc +``` + +Now you can enter `genpasswd` and get a fresh password from the API Endpoint. + +# building the app + +you can build the app yourself like this: ``` go build -o password-generator ./ ``` -# Baue das Docker-Image + + +# build a docker container ``` docker build -t password-generator . ``` -# Starte den Docker Container +# start the docker container ``` docker run -p 8080:8080 password-generator ``` -## mit docker-compose +## docker-compose -Ein `docker-compose.yml` wird mitgeliefert. +There are two example docker-compose files in the [misc](./) directory. + +### docker-compose.yml + +A basic variant that just brings up the container and export port 8080. +The basic variant can be used without modifications. + +### docker-compose.traefik.yml + +The other one is meant to be used behind a traefik reverse proxy. +This variant has lables to configure traefik accordingly. +The traefik variant needs to be adjusted to your environment before +you can use it successfully. ### initial pull ``` -docker compose login gitea.scu.si docker compose pull ``` @@ -41,5 +70,13 @@ docker compose up -d docker compose down ``` +### update container + +In order to update your container to the current version, do this: +``` +docker compose pull +docker compose down +docker compose up -d +``` From d673b97b4bc89757e2604b475b5f9181dddc94f1 Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 17 Jan 2026 22:26:58 +0100 Subject: [PATCH 04/19] deleted obsolete lines in misc/docker-compose.traefik.yml --- misc/docker-compose.traefik.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/misc/docker-compose.traefik.yml b/misc/docker-compose.traefik.yml index 9ffd3c5..9afa81c 100644 --- a/misc/docker-compose.traefik.yml +++ b/misc/docker-compose.traefik.yml @@ -5,8 +5,6 @@ services: restart: always expose: - "8080:8080" - # Falls die Registry privat ist, muss der Host zuvor mit - # 'docker login gitea.scu.si' angemeldet worden sein. labels: - "traefik.enable=true" - "traefik.docker.network=traefik_backend" From cb3545f261198e626078991afba0a9c6fccd8230 Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 17 Jan 2026 22:29:08 +0100 Subject: [PATCH 05/19] updated claim in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb2fa5a..fce95d9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Web-Password -_a web based password generator_ +_a web based password generator, with an API endpoint_ ![App Screenshot](img/screenshot.png) From 2b505b0d9d8b9ee7f9040fb1a985a65e82e3fba9 Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 17 Jan 2026 22:30:00 +0100 Subject: [PATCH 06/19] centered image --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fce95d9..e68baca 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ _a web based password generator, with an API endpoint_ +
![App Screenshot](img/screenshot.png) +
## Features From 0251b9dc69bacd9ba9a2be9a8e19f591074a7bbd Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 17 Jan 2026 22:30:58 +0100 Subject: [PATCH 07/19] undo centered image, did not work --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index e68baca..fce95d9 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,7 @@ _a web based password generator, with an API endpoint_ -
![App Screenshot](img/screenshot.png) -
## Features From fb55f47e5c87592f867e0b559873c085fbe4c435 Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 17 Jan 2026 22:32:35 +0100 Subject: [PATCH 08/19] fixed spelling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fce95d9..b0c277c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ There is a demo at [https://passwd.scu.si](https://passwd.scu.si) ## Usage -The follwoing example shows how to get up your own instance with `docker compose`. +The following example shows how to get up your own instance with `docker compose`. ``` git clone https://gitea.scu.si/FlorianWalther/Web-Password.git From 4a8f7525e7f3f3ad922fa4ab046a2f87d1514196 Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 17 Jan 2026 22:54:57 +0100 Subject: [PATCH 09/19] updated README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index b0c277c..60464cd 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,10 @@ docker compose pull docker compose up -d ``` +## Docker image + +The latest official docker image is at [https://gitea.scu.si/FlorianWalther/-/packages/container/password-generator/latest](https://gitea.scu.si/FlorianWalther/-/packages/container/password-generator/latest) + +## more usage examples + There are some more usage example in [misc/MoreUsage.md](misc/MoreUsage.md) From d7678274be0e7536ca5d8346ab1b6ed563f12ffc Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 17 Jan 2026 22:57:04 +0100 Subject: [PATCH 10/19] added pull info --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 60464cd..84c0de9 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ docker compose up -d The latest official docker image is at [https://gitea.scu.si/FlorianWalther/-/packages/container/password-generator/latest](https://gitea.scu.si/FlorianWalther/-/packages/container/password-generator/latest) +You can pull it like this: +``` +docker pull gitea.scu.si/florianwalther/password-generator:latest +``` + ## more usage examples There are some more usage example in [misc/MoreUsage.md](misc/MoreUsage.md) From 59dd16d4ac1d5a037d7c992bcdac7334be2be1ad Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 24 Jan 2026 17:42:32 +0100 Subject: [PATCH 11/19] fixed code URL --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 2dc114b..0681ed5 100644 --- a/main.go +++ b/main.go @@ -256,7 +256,7 @@ html := fmt.Sprintf(
API - code + code

Generiertes Passwort

%s
From 8b93585422ac2645613dab1381289eb428de3b7e Mon Sep 17 00:00:00 2001 From: Florian Walther Date: Sat, 24 Jan 2026 17:52:15 +0100 Subject: [PATCH 12/19] workflow angepasst --- .gitea/workflows/docker-release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/docker-release.yml b/.gitea/workflows/docker-release.yml index 86b34fa..9d73912 100644 --- a/.gitea/workflows/docker-release.yml +++ b/.gitea/workflows/docker-release.yml @@ -14,8 +14,8 @@ jobs: - name: Login to Gitea uses: docker/login-action@v3 with: - registry: ${{ secrets.REGISTRY_URL }} # gitea.scu.si - username: ${{ gitea.actor }} + registry: ${{ vars.REGISTRY_URL }} # gitea.scu.si + username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_PASSWORD }} - name: Build and push @@ -26,5 +26,5 @@ jobs: # Hier wird die Git-Referenz automatisch als Docker-Tag genutzt #tags: gitea.scu.si/florianwalther/password-generator:${{ gitea.ref_name }} tags: | - gitea.scu.si/florianwalther/password-generator:${{ gitea.ref_name }} - gitea.scu.si/florianwalther/password-generator:latest + gitea.scu.si/florian.walther/password-generator:${{ gitea.ref_name }} + gitea.scu.si/florian.walther/password-generator:latest From 9a906ec55cc341ac401d6b0617478f2ed01eb113 Mon Sep 17 00:00:00 2001 From: "Florian.Walther" Date: Mon, 2 Feb 2026 21:32:30 +0100 Subject: [PATCH 13/19] http to https changed in API page --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 0681ed5..55e6ba5 100644 --- a/main.go +++ b/main.go @@ -119,7 +119,7 @@ func helpHandler(w http.ResponseWriter, r *http.Request) {