diff --git a/Dockerfile b/Dockerfile index 0a96884..36482f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ # Build stage -FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.21-alpine3.19 AS builder -LABEL maintainer="Khanh Ngo " +FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:tip-alpine3.23 AS builder ARG BUILDPLATFORM ARG TARGETOS @@ -56,7 +55,7 @@ RUN cp -r /build/custom/ assets/ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.appVersion=${APP_VERSION}' -X 'main.buildTime=${BUILD_TIME}' -X 'main.gitCommit=${GIT_COMMIT}'" -a -o wg-ui . # Release stage -FROM alpine:3.19 +FROM alpine:latest RUN addgroup -S wgui && \ adduser -S -D -G wgui wgui diff --git a/telegram/bot.go b/telegram/bot.go index d16e31d..d2e0498 100644 --- a/telegram/bot.go +++ b/telegram/bot.go @@ -22,7 +22,6 @@ var ( Token string AllowConfRequest bool FloodWait int - FloodWaitEnabled bool // Для отключения таймаута в ТГ LogLevel log.Lvl MTProxyLink string // ДОБАВИЛИ НАШУ ССЫЛКУ @@ -88,7 +87,7 @@ func Start(initDeps TgBotInitDependencies) (err error) { } floodMessageSent[userid] = struct{}{} _, err := bot.SendMessage( - fmt.Sprintf("You can only request your configs once per %d minutes", FloodWait), + fmt.Sprintf("Подождите %d секунд, защита от флуда", FloodWait), userid, &echotron.MessageOptions{ ReplyToMessageID: update.Message.ID, @@ -130,7 +129,7 @@ func SendConfig(userid int64, clientName string, confData, qrData []byte, ignore } if _, wait := floodWait[userid]; wait && !ignoreFloodWait { - return fmt.Errorf("this client already got their config less than %d minutes ago", FloodWait) + return fmt.Errorf("Этот клиент будет готов получить конфиг через %d секунд", FloodWait) } if !ignoreFloodWait { @@ -175,7 +174,7 @@ func SendConfig(userid int64, clientName string, confData, qrData []byte, ignore } func updateFloodWait() { - thresholdTS := time.Now().Unix() - 60*int64(FloodWait) + thresholdTS := time.Now().Unix() - int64(FloodWait) for userid, ts := range floodWait { if ts < thresholdTS { delete(floodWait, userid)