diff --git a/Dockerfile b/Dockerfile index 4256162..5b44376 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Use this instead if hrfee/jfa-go-build-docker doesn't support your architecture # FROM --platform=$BUILDPLATFORM golang:latest AS support -FROM --platform=$BUILDPLATFORM hrfee/jfa-go-build-docker AS support +FROM --platform=$BUILDPLATFORM docker.io/hrfee/jfa-go-build-docker:latest AS support COPY . /opt/build @@ -9,10 +9,10 @@ COPY . /opt/build # && apt-get install build-essential python3-pip -y \ # && (curl -sL https://deb.nodesource.com/setup_current.x | bash -) \ # && apt-get install nodejs -RUN (cd /opt/build; make configuration npm email typescript variants-html bundle-css inline-css swagger copy INTERNAL=off GOESBUILD=on) \ +RUN (cd /opt/build; npm i; make precompile INTERNAL=off GOESBUILD=on) \ && sed -i 's#id="password_resets-watch_directory" placeholder="/config/jellyfin"#id="password_resets-watch_directory" value="/jf" disabled#g' /opt/build/build/data/html/setup.html -FROM --platform=$BUILDPLATFORM golang:latest AS build +FROM --platform=$BUILDPLATFORM docker.io/golang:latest AS build ARG TARGETARCH ENV GOARCH=$TARGETARCH ARG BUILT_BY @@ -30,5 +30,3 @@ EXPOSE 8056 EXPOSE 8057 CMD [ "/opt/jfa-go/jfa-go", "-data", "/data" ] - - diff --git a/Makefile b/Makefile index fde2fe4..d6c0d2d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: configuration email typescript swagger copy compile compress tailwind bundle-css inline-css variants-html install clean npm config-description config-default +.PHONY: configuration email typescript swagger copy compile compress tailwind bundle-css inline-css variants-html install clean npm config-description config-default precompile all: compile @@ -209,6 +209,8 @@ $(COPY_TARGET): $(INLINE_TARGET) $(STATIC_SRC) cp -r lang $(DATA)/ cp LICENSE $(DATA)/ +precompile: $(CONFIG_DESCRIPTION) $(CONFIG_DEFAULT) $(EMAIL_TARGET) $(COPY_TARGET) $(SWAGGER_TARGET) + GO_SRC = $(shell find ./ -name "*.go") GO_TARGET = build/jfa-go $(GO_TARGET): $(CONFIG_DESCRIPTION) $(CONFIG_DEFAULT) $(EMAIL_TARGET) $(COPY_TARGET) $(SWAGGER_TARGET) $(GO_SRC) go.mod go.sum diff --git a/api-users.go b/api-users.go index ae0c458..74ecda1 100644 --- a/api-users.go +++ b/api-users.go @@ -499,7 +499,6 @@ func (app *appContext) DeleteUsers(gc *gin.Context) { func (app *appContext) ExtendExpiry(gc *gin.Context) { var req extendExpiryDTO gc.BindJSON(&req) - app.info.Printf("Expiry extension requested for %d user(s)", len(req.Users)) if req.Months <= 0 && req.Days <= 0 && req.Hours <= 0 && req.Minutes <= 0 && req.Timestamp <= 0 { respondBool(400, false, gc) return diff --git a/views.go b/views.go index bb0a1e7..4e36901 100644 --- a/views.go +++ b/views.go @@ -17,6 +17,7 @@ import ( "github.com/gin-gonic/gin" "github.com/golang-jwt/jwt" "github.com/gomarkdown/markdown" + "github.com/hrfee/jfa-go/common" lm "github.com/hrfee/jfa-go/logmessages" "github.com/hrfee/mediabrowser" "github.com/lithammer/shortuuid/v3" @@ -538,9 +539,7 @@ func (app *appContext) verifyCaptcha(code, id, text string, isPWR bool) bool { req.Header.Add("Content-Type", "application/x-www-form-urlencoded") resp, err := http.DefaultClient.Do(req) - if err == nil && resp.StatusCode != 200 { - err = fmt.Errorf("failed (error %d)", resp.StatusCode) - } + err = common.GenericErr(resp.StatusCode, err) if err != nil { app.err.Printf(lm.FailedVerifyReCAPTCHA, err) return false