Compare commits

..

4 Commits

Author SHA1 Message Date
Deluan
3007ca68d5 fix: disable User.lastAccessAt field for now.
Updating it on every request was cause DB retentions/lock errors
2020-01-28 16:20:59 -05:00
Deluan
d4edff3aaa fix: only add the latest tag to version if the tag is attached to the current commit, or else use the branch name 2020-01-28 15:28:39 -05:00
Deluan
99b1dc1421 feat: upgrade ffmpeg in docker image 2020-01-28 15:01:23 -05:00
dependabot-preview[bot]
37dfe4c092 Bump github.com/mattn/go-sqlite3
Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 2.0.2+incompatible to 2.0.3+incompatible.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](https://github.com/mattn/go-sqlite3/compare/v2.0.2...v2.0.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-28 07:37:40 -05:00
6 changed files with 27 additions and 19 deletions

View File

@@ -18,8 +18,7 @@ RUN apk add -U --no-cache build-base git
RUN go get -u github.com/go-bindata/go-bindata/...
# Download and unpack static ffmpeg
ARG FFMPEG_VERSION=4.1.4
ARG FFMPEG_URL=https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-${FFMPEG_VERSION}-amd64-static.tar.xz
ARG FFMPEG_URL=https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
RUN wget -O /tmp/ffmpeg.tar.xz ${FFMPEG_URL}
RUN cd /tmp && tar xJf ffmpeg.tar.xz && rm ffmpeg.tar.xz
@@ -34,24 +33,32 @@ COPY --from=jsbuilder /src/build/* /src/ui/build/
COPY --from=jsbuilder /src/build/static/css/* /src/ui/build/static/css/
COPY --from=jsbuilder /src/build/static/js/* /src/ui/build/static/js/
RUN rm -rf /src/build/css /src/build/js
RUN GIT_SHA=$(git rev-parse --short HEAD) && \
GIT_TAG=$(git describe --tags --abbrev=0 2> /dev/null) && \
RUN GIT_TAG=$(git name-rev --name-only HEAD) && \
GIT_TAG=${GIT_TAG#"tags/"} && \
GIT_SHA=$(git rev-parse --short HEAD) && \
echo "Building version: ${GIT_TAG} (${GIT_SHA})" && \
go-bindata -fs -prefix ui/build -tags embed -nocompress -pkg assets -o assets/embedded_gen.go ui/build/... && \
go build -ldflags="-X main.gitSha=${GIT_SHA} -X main.gitTag=${GIT_TAG}" -tags=embed
#####################################################
### Build Final Image
FROM alpine
FROM alpine as release
MAINTAINER Deluan Quintao <navidrome@deluan.com>
COPY --from=gobuilder /src/navidrome /app/
COPY --from=gobuilder /tmp/ffmpeg*/ffmpeg /usr/bin/
# Check if ffmpeg runs properly
RUN ffmpeg -buildconf
VOLUME ["/data", "/music"]
ENV ND_MUSICFOLDER /music
ENV ND_DATAFOLDER /data
ENV ND_SCANINTERVAL 1m
ENV ND_LOGLEVEL info
ENV ND_PORT 4533
EXPOSE 4533
EXPOSE 4533
WORKDIR /app
CMD "/app/navidrome"
ENTRYPOINT "/app/navidrome"

View File

@@ -7,7 +7,6 @@ import (
"fmt"
"strings"
"github.com/deluan/navidrome/log"
"github.com/deluan/navidrome/model"
)
@@ -49,11 +48,12 @@ func (u *users) Authenticate(ctx context.Context, username, pass, token, salt st
if !valid {
return nil, model.ErrInvalidAuth
}
go func() {
err := u.ds.User(ctx).UpdateLastAccessAt(user.ID)
if err != nil {
log.Error(ctx, "Could not update user's lastAccessAt", "user", user.UserName)
}
}()
// TODO: Find a way to update LastAccessAt without causing too much retention in the DB
//go func() {
// err := u.ds.User(ctx).UpdateLastAccessAt(user.ID)
// if err != nil {
// log.Error(ctx, "Could not update user's lastAccessAt", "user", user.UserName)
// }
//}()
return user, nil
}

2
go.mod
View File

@@ -21,7 +21,7 @@ require (
github.com/koding/multiconfig v0.0.0-20170327155832-26b6dfd3a84a
github.com/kr/pretty v0.1.0 // indirect
github.com/lib/pq v1.3.0
github.com/mattn/go-sqlite3 v2.0.2+incompatible
github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5
github.com/onsi/ginkgo v1.11.0
github.com/onsi/gomega v1.8.1

2
go.sum
View File

@@ -87,6 +87,8 @@ github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v2.0.2+incompatible h1:qzw9c2GNT8UFrgWNDhCTqRqYUSmu/Dav/9Z58LGpk7U=
github.com/mattn/go-sqlite3 v2.0.2+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5 h1:BvoENQQU+fZ9uukda/RzCAL/191HHwJA5b13R6diVlY=
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=

View File

@@ -23,7 +23,7 @@ const UserEdit = (props) => (
<PasswordInput source="password" validate={[required()]} />
<BooleanInput source="isAdmin" initialValue={false} />
<DateField source="lastLoginAt" showTime />
<DateField source="lastAccessAt" showTime />
{/*<DateField source="lastAccessAt" showTime />*/}
<DateField source="updatedAt" showTime />
<DateField source="createdAt" showTime />
</SimpleForm>

View File

@@ -33,8 +33,7 @@ const UserList = (props) => {
<SimpleList
primaryText={(record) => record.name}
secondaryText={(record) =>
record.lastAccessAt &&
new Date(record.lastAccessAt).toLocaleString()
record.lastLoginAt && new Date(record.lastLoginAt).toLocaleString()
}
tertiaryText={(record) => (record.isAdmin ? '[admin]' : '')}
/>
@@ -42,7 +41,7 @@ const UserList = (props) => {
<Datagrid rowClick="edit">
<TextField source="userName" />
<BooleanField source="isAdmin" />
<DateField source="lastAccessAt" locales="pt-BR" />
<DateField source="lastLoginAt" locales="pt-BR" />
<DateField source="updatedAt" locales="pt-BR" />
</Datagrid>
)}