From b331dc56862f91fd016092723d83412ce6681032 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 7 Nov 2021 09:53:35 +0100 Subject: [PATCH] web client: show share last use and used tokens --- dataprovider/share.go | 6 ++++++ go.mod | 2 +- go.sum | 4 ++-- pkgs/build.sh | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dataprovider/share.go b/dataprovider/share.go index cf6592b3..9b07ba80 100644 --- a/dataprovider/share.go +++ b/dataprovider/share.go @@ -74,8 +74,14 @@ func (s *Share) GetInfoString() string { t := util.GetTimeFromMsecSinceEpoch(s.ExpiresAt) result.WriteString(fmt.Sprintf("Expiration: %v. ", t.Format("2006-01-02 15:04"))) // YYYY-MM-DD HH:MM } + if s.LastUseAt > 0 { + t := util.GetTimeFromMsecSinceEpoch(s.LastUseAt) + result.WriteString(fmt.Sprintf("Last use: %v. ", t.Format("2006-01-02 15:04"))) + } if s.MaxTokens > 0 { result.WriteString(fmt.Sprintf("Usage: %v/%v. ", s.UsedTokens, s.MaxTokens)) + } else { + result.WriteString(fmt.Sprintf("Used tokens: %v. ", s.UsedTokens)) } if len(s.AllowFrom) > 0 { result.WriteString(fmt.Sprintf("Allowed IP/Mask: %v. ", len(s.AllowFrom))) diff --git a/go.mod b/go.mod index b21389b2..599f9199 100644 --- a/go.mod +++ b/go.mod @@ -53,7 +53,7 @@ require ( gocloud.dev v0.24.0 golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 golang.org/x/net v0.0.0-20211105192438-b53810dc28af - golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c + golang.org/x/sys v0.0.0-20211106132015-ebca88c72f68 golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac google.golang.org/api v0.60.0 google.golang.org/grpc v1.42.0 diff --git a/go.sum b/go.sum index 69b627ef..9e89dcf2 100644 --- a/go.sum +++ b/go.sum @@ -985,8 +985,8 @@ golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c h1:+8miTPjMCTXwih7BQmvWwd0PjdBZq2MKp/qQaahSzEM= -golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211106132015-ebca88c72f68 h1:Ywe/f3fNleF8I6F6qv3MeFoSZ6CTf2zBMMa/7qVML8M= +golang.org/x/sys v0.0.0-20211106132015-ebca88c72f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/pkgs/build.sh b/pkgs/build.sh index c7bbec81..c889a420 100755 --- a/pkgs/build.sh +++ b/pkgs/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -NFPM_VERSION=2.7.1 +NFPM_VERSION=2.8.0 NFPM_ARCH=${NFPM_ARCH:-amd64} if [ -z ${SFTPGO_VERSION} ] then