-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e66cb3
commit 00d9327
Showing
8 changed files
with
206 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package routes | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/charmbracelet/log" | ||
"github.com/labstack/echo/v4" | ||
|
||
"github.com/damongolding/immich-kiosk/config" | ||
"github.com/damongolding/immich-kiosk/utils" | ||
) | ||
|
||
// RefreshCheck endpoint to check if device requires a refresh | ||
func RefreshCheck(baseConfig *config.Config) echo.HandlerFunc { | ||
return func(c echo.Context) error { | ||
|
||
kioskVersionHeader := c.Request().Header.Get("kiosk-version") | ||
kioskRefreshTimestampHeader := c.Request().Header.Get("kiosk-reload-timestamp") | ||
requestID := utils.ColorizeRequestId(c.Response().Header().Get(echo.HeaderXRequestID)) | ||
|
||
// create a copy of the global config to use with this request | ||
requestConfig := *baseConfig | ||
|
||
// If kiosk version on client and server do not match refresh client. | ||
if KioskVersion != kioskVersionHeader || kioskRefreshTimestampHeader != requestConfig.ReloadTimeStamp { | ||
c.Response().Header().Set("HX-Refresh", "true") | ||
return c.NoContent(http.StatusOK) | ||
} | ||
|
||
log.Debug( | ||
requestID, | ||
"method", c.Request().Method, | ||
"path", c.Request().URL.String(), | ||
) | ||
|
||
return c.NoContent(http.StatusOK) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.