Skip to content

Commit eae1816

Browse files
authored
Merge pull request #497 from damongolding/task/release
Task/release
2 parents 3bda3f6 + b2eed78 commit eae1816

File tree

11 files changed

+210
-182
lines changed

11 files changed

+210
-182
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ENV TERM=xterm-256color
4343
ENV DEBUG_COLORS=true
4444
ENV COLORTERM=truecolor
4545

46-
RUN apk update && apk add --no-cache tzdata ca-certificates && update-ca-certificates
46+
RUN apk add --no-cache tzdata ca-certificates curl && update-ca-certificates
4747

4848
WORKDIR /
4949

config.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@
128128
"type": "string"
129129
},
130130
"sleep_start": {
131-
"type": "string"
131+
"type": ["string", "integer"]
132132
},
133133
"sleep_end": {
134-
"type": "string"
134+
"type": ["string", "integer"]
135135
},
136136
"sleep_dim_screen": {
137137
"type": "boolean"

docker-compose-env.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,9 @@ services:
9999
ports:
100100
- 3000:3000
101101
restart: always
102+
healthcheck:
103+
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
104+
interval: 30s
105+
timeout: 5s
106+
retries: 3
107+
start_period: 10s

docker-compose.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ services:
1313
# - ./custom.css:/custom.css
1414
# - ./offline-assets:/offline-assets
1515
restart: always
16+
healthcheck:
17+
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
18+
interval: 30s
19+
timeout: 5s
20+
retries: 3
21+
start_period: 10s

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
"node": "22.17.0"
1919
},
2020
"devDependencies": {
21-
"@biomejs/biome": "2.1.1",
21+
"@biomejs/biome": "2.1.3",
2222
"autoprefixer": "^10.4.21",
2323
"date-fns": "^4.1.0",
2424
"dompurify": "^3.2.6",
25-
"esbuild": "^0.25.6",
25+
"esbuild": "^0.25.8",
2626
"htmx.org": "^2.0.6",
2727
"postcss": "^8.5.6",
2828
"postcss-cli": "^11.0.1",

frontend/pnpm-lock.yaml

Lines changed: 162 additions & 162 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.24.4
44

55
require (
66
github.com/EdlinOrg/prominentcolor v1.0.0
7-
github.com/a-h/templ v0.3.920
7+
github.com/a-h/templ v0.3.924
88
github.com/charmbracelet/lipgloss v1.1.0
99
github.com/charmbracelet/log v0.4.2
1010
github.com/disintegration/imaging v1.6.2

go.sum

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ github.com/EdlinOrg/prominentcolor v1.0.0/go.mod h1:mYmDsxfcmBz6izH/SqtSzfsUiZdP
33
github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=
44
github.com/a-h/parse v0.0.0-20250122154542-74294addb73e h1:HjVbSQHy+dnlS6C3XajZ69NYAb5jbGNfHanvm1+iYlo=
55
github.com/a-h/parse v0.0.0-20250122154542-74294addb73e/go.mod h1:3mnrkvGpurZ4ZrTDbYU84xhwXW2TjTKShSwjRi2ihfQ=
6-
github.com/a-h/templ v0.3.906 h1:ZUThc8Q9n04UATaCwaG60pB1AqbulLmYEAMnWV63svg=
7-
github.com/a-h/templ v0.3.906/go.mod h1:FFAu4dI//ESmEN7PQkJ7E7QfnSEMdcnu7QrAY8Dn334=
8-
github.com/a-h/templ v0.3.920 h1:IQjjTu4KGrYreHo/ewzSeS8uefecisPayIIc9VflLSE=
9-
github.com/a-h/templ v0.3.920/go.mod h1:FFAu4dI//ESmEN7PQkJ7E7QfnSEMdcnu7QrAY8Dn334=
6+
github.com/a-h/templ v0.3.924 h1:t5gZqTneXqvehpNZsgtnlOscnBboNh9aASBH2MgV/0k=
7+
github.com/a-h/templ v0.3.924/go.mod h1:FFAu4dI//ESmEN7PQkJ7E7QfnSEMdcnu7QrAY8Dn334=
108
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
119
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
1210
github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ=
@@ -159,8 +157,6 @@ github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
159157
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
160158
github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE=
161159
github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
162-
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
163-
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
164160
github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M=
165161
github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
166162
github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4=
@@ -201,8 +197,6 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
201197
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
202198
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
203199
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
204-
golang.org/x/exp v0.0.0-20250711185948-6ae5c78190dc h1:TS73t7x3KarrNd5qAipmspBDS1rkMcgVG/fS1aRb4Rc=
205-
golang.org/x/exp v0.0.0-20250711185948-6ae5c78190dc/go.mod h1:A+z0yzpGtvnG90cToK5n2tu8UJVP2XUATh+r+sfOOOc=
206200
golang.org/x/exp v0.0.0-20250718183923-645b1fa84792 h1:R9PFI6EUdfVKgwKjZef7QIwGcBKu86OEFpJ9nUEP2l4=
207201
golang.org/x/exp v0.0.0-20250718183923-645b1fa84792/go.mod h1:A+z0yzpGtvnG90cToK5n2tu8UJVP2XUATh+r+sfOOOc=
208202
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=

main.go

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ func main() {
131131
if baseConfig.Kiosk.Password != "" {
132132
e.Use(middleware.KeyAuthWithConfig(middleware.KeyAuthConfig{
133133
Skipper: func(c echo.Context) bool {
134-
// skip auth for assets
135-
return strings.HasPrefix(c.Request().URL.String(), "/assets")
134+
// skip auth for assets and /health endpoint
135+
url := c.Request().URL.String()
136+
return strings.HasPrefix(url, "/assets") || url == "/health"
136137
},
137138
KeyLookup: "header:Authorization,header:X-Api-Key,query:authsecret,query:password,form:authsecret,form:password",
138139
Validator: func(queryPassword string, _ echo.Context) (bool, error) {
@@ -161,14 +162,18 @@ func main() {
161162

162163
e.GET("/", routes.Home(baseConfig, c))
163164

165+
e.GET("/health", func(c echo.Context) error {
166+
return c.String(http.StatusOK, "OK")
167+
})
168+
164169
e.GET("/about", routes.About(baseConfig))
165170

166171
e.GET("/assets/manifest.json", routes.Manifest)
167172

168173
e.GET("/image", routes.Image(baseConfig, c))
169174
e.GET("/image/reload", routes.ImageWithReload(baseConfig))
170175

171-
e.GET("/image/:imageID", routes.ImageWithID(baseConfig, c), StaticCacheMiddlewareWithConfig(baseConfig))
176+
e.GET("/image/:imageID", routes.ImageWithID(baseConfig, c), AssetCacheMiddlewareWithConfig(baseConfig))
172177

173178
e.POST("/asset/new", routes.NewAsset(baseConfig, c))
174179

@@ -199,7 +204,7 @@ func main() {
199204

200205
e.GET("/live/:liveID", routes.LivePhoto(baseConfig.Kiosk.DemoMode))
201206

202-
e.GET("/video/:videoID", routes.NewVideo(baseConfig.Kiosk.DemoMode), StaticCacheMiddlewareWithConfig(baseConfig))
207+
e.GET("/video/:videoID", routes.NewVideo(baseConfig.Kiosk.DemoMode), AssetCacheMiddlewareWithConfig(baseConfig))
203208

204209
e.GET("/:redirect", routes.Redirect(baseConfig, c))
205210

@@ -249,7 +254,22 @@ func StaticCacheMiddlewareWithConfig(baseConfig *config.Config) echo.MiddlewareF
249254
}
250255

251256
return func(c echo.Context) error {
252-
c.Response().Header().Set("Cache-Control", "public, max-age=86400, immutable")
257+
c.Response().Header().Set("Cache-Control", "public, max-age=31536000, immutable")
258+
return next(c)
259+
}
260+
}
261+
}
262+
263+
// Middleware for asset(s) routes with access to baseConfig
264+
func AssetCacheMiddlewareWithConfig(baseConfig *config.Config) echo.MiddlewareFunc {
265+
return func(next echo.HandlerFunc) echo.HandlerFunc {
266+
267+
if baseConfig.Kiosk.Debug || baseConfig.Kiosk.DebugVerbose {
268+
return NoCacheMiddleware(next)
269+
}
270+
271+
return func(c echo.Context) error {
272+
c.Response().Header().Set("Cache-Control", "private, max-age=86400, no-transform")
253273
return next(c)
254274
}
255275
}

taskfile.docker.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ tasks:
66
desc: Build docker image locally
77
deps: [build]
88
cmds:
9+
- orb start
910
- docker build --no-cache --build-arg VERSION={{.VERSION}} --load -t damongolding/immich-kiosk:{{.VERSION}} -t damongolding/immich-kiosk:latest .
11+
- orb stop
1012

1113
docker-buildx:
1214
desc: Create and install docker buildx builder

0 commit comments

Comments
 (0)