Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9296beb5f | ||
|
|
dd8eab7975 | ||
|
|
3e2f4cf104 | ||
|
|
9d4c816642 | ||
|
|
2a8d343ff4 | ||
|
|
c990d8a335 |
@@ -1,4 +1,4 @@
|
|||||||
iname: Docker Release Build
|
name: Docker Release Build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
@@ -25,6 +25,8 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
# Hier wird die Git-Referenz automatisch als Docker-Tag genutzt
|
# 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 }}
|
||||||
|
build-args: |
|
||||||
|
APP_VERSION=${{ gitea.ref_name }}
|
||||||
tags: |
|
tags: |
|
||||||
gitea.scu.si/florian.walther/password-generator:${{ gitea.ref_name }}
|
gitea.scu.si/florian.walther/password-generator:${{ gitea.ref_name }}
|
||||||
gitea.scu.si/florian.walther/password-generator:latest
|
gitea.scu.si/florian.walther/password-generator:latest
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ WORKDIR /app
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Baue die Anwendung
|
# Baue die Anwendung
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /app/password-generator
|
ARG APP_VERSION=dev
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X 'main.AppVersion=${APP_VERSION}'" -o /app/password-generator
|
||||||
|
|
||||||
# Verwende ein minimales Image für die finale Stage
|
# Verwende ein minimales Image für die finale Stage
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ _a web based password generator, with an API endpoint_
|
|||||||
* generates long and random, secure passwords (read about the [security considerations](SECURITY.md))
|
* generates long and random, secure passwords (read about the [security considerations](SECURITY.md))
|
||||||
* copy to clipboard
|
* copy to clipboard
|
||||||
* very small docker container, that only contains the application and has minimum attack surface
|
* very small docker container, that only contains the application and has minimum attack surface
|
||||||
|
* supports DarkMode and LightMode, you can toggle
|
||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ docker compose up -d
|
|||||||
|
|
||||||
## Docker image
|
## 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)
|
The latest official docker image is at [https://gitea.scu.si/Florian.Walther/-/packages/container/password-generator/latest](https://gitea.scu.si/Florian.Walther/-/packages/container/password-generator/latest)
|
||||||
|
|
||||||
You can pull it like this:
|
You can pull it like this:
|
||||||
```
|
```
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,3 +1,3 @@
|
|||||||
module gitea.scu.si/FlorianWalther/Web-Password
|
module gitea.scu.si/Florian.Walther/Web-Password
|
||||||
|
|
||||||
go 1.24.1
|
go 1.24.1
|
||||||
|
|||||||
25
main.go
25
main.go
@@ -12,13 +12,30 @@ const (
|
|||||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
||||||
)
|
)
|
||||||
|
|
||||||
//var tmpl *template.Template
|
|
||||||
var templates = make(map[string]*template.Template)
|
var templates = make(map[string]*template.Template)
|
||||||
|
var AppVersion = "development"
|
||||||
|
|
||||||
func loadTemplates() {
|
func loadTemplates() {
|
||||||
templates["index.html"] = template.Must(template.ParseFiles("templates/base.html", "templates/index.html"))
|
// 1. FuncMap definieren
|
||||||
templates["help.html"] = template.Must(template.ParseFiles("templates/base.html", "templates/help.html"))
|
funcMap := template.FuncMap{
|
||||||
log.Printf("Alle Templates erfolgreich geladen")
|
"getAppVersion": func() string {
|
||||||
|
return AppVersion
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Templates mit FuncMap laden
|
||||||
|
// Wir nutzen New("base.html"), da base.html meist das Haupt-Layout definiert
|
||||||
|
templates["index.html"] = template.Must(template.New("base.html").Funcs(funcMap).ParseFiles(
|
||||||
|
"templates/base.html",
|
||||||
|
"templates/index.html",
|
||||||
|
))
|
||||||
|
|
||||||
|
templates["help.html"] = template.Must(template.New("base.html").Funcs(funcMap).ParseFiles(
|
||||||
|
"templates/base.html",
|
||||||
|
"templates/help.html",
|
||||||
|
))
|
||||||
|
|
||||||
|
log.Printf("Alle Templates erfolgreich geladen")
|
||||||
}
|
}
|
||||||
|
|
||||||
func generatePassword() string {
|
func generatePassword() string {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
password-generator:
|
password-generator:
|
||||||
image: gitea.scu.si/florianwalther/password-generator:latest
|
image: gitea.scu.si/florian.walther/password-generator:latest
|
||||||
container_name: password-generator
|
container_name: password-generator
|
||||||
restart: always
|
restart: always
|
||||||
expose:
|
expose:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
password-generator:
|
password-generator:
|
||||||
image: gitea.scu.si/florianwalther/password-generator:latest
|
image: gitea.scu.si/florian.walther/password-generator:latest
|
||||||
container_name: password-generator
|
container_name: password-generator
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -47,6 +47,33 @@ body {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
/* Fixierung am unteren Rand */
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
|
||||||
|
/* Ausdehnung */
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
/* Design & Abstände */
|
||||||
|
background: var(--password-bg);
|
||||||
|
border-top: 1px solid #e0e0e0;
|
||||||
|
padding: 8px 16px;
|
||||||
|
|
||||||
|
/* Text-Ausrichtung */
|
||||||
|
text-align: left;
|
||||||
|
font-family: monospace; /* Monospace sieht für Versionen oft "technischer" aus */
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-color);
|
||||||
|
|
||||||
|
/* Sicherstellen, dass nichts drüber liegt */
|
||||||
|
z-index: 9999;
|
||||||
|
|
||||||
|
/* Padding in die Breite einrechnen */
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
#password {
|
#password {
|
||||||
font-family: 'Courier New', Courier, monospace;
|
font-family: 'Courier New', Courier, monospace;
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
|
|||||||
@@ -45,5 +45,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<button id="theme-toggle">🌓</button>
|
<button id="theme-toggle">🌓</button>
|
||||||
{{ block "body" . }}{{end}}
|
{{ block "body" . }}{{end}}
|
||||||
|
|
||||||
|
<footer>Version: {{getAppVersion}} | made with golang and ♥️ {{ block "footer" . }}{{ end }}</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user