Skip to content

Commit

Permalink
chore: fix website
Browse files Browse the repository at this point in the history
Signed-off-by: Manfred Touron <[email protected]>
  • Loading branch information
moul committed Oct 16, 2022
1 parent 8e808cf commit 07f4fda
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM golang:1.13-alpine as builder
FROM golang:1.19-alpine as builder
WORKDIR /go/src/ultre.me/calcbiz
RUN apk --no-cache --update add nodejs-npm make gcc g++ musl-dev openssl-dev git
RUN go get -u github.com/gobuffalo/packr/packr
RUN apk --no-cache --update add npm make gcc g++ musl-dev openssl-dev git
ENV GO111MODULE=on
COPY go.* /go/src/ultre.me/calcbiz/
RUN go mod download
RUN go install github.com/gobuffalo/packr/packr
COPY . /go/src/ultre.me/calcbiz/
RUN make packr
RUN make install

FROM alpine:3.10
FROM alpine:3.13
RUN apk --no-cache --update add ca-certificates && update-ca-certificates
COPY --from=builder /go/bin/calcbiz /bin/calcbiz
#COPY ./static .
Expand Down
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me
github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
github.com/gobuffalo/envy v1.8.1 h1:RUr68liRvs0TS1D5qdW3mQv2SjAsu1QWMCx1tG4kDjs=
github.com/gobuffalo/envy v1.8.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w=
github.com/gobuffalo/logger v1.0.0 h1:xw9Ko9EcC5iAFprrjJ6oZco9UpzS5MQ4jAwghsLHdy4=
github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=
github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4=
github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=
github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg=
github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk=
github.com/gobuffalo/packr/v2 v2.5.1 h1:TFOeY2VoGamPjQLiNDT3mn//ytzk236VMO2j7iHxJR4=
github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw=
github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0=
github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic=
Expand Down Expand Up @@ -135,6 +137,7 @@ github.com/huandu/xstrings v1.2.1 h1:v6IdmkCnDhJG/S0ivr58PeIfg+tyhqQYy4YsCsQ0Pdc
github.com/huandu/xstrings v1.2.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ=
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
github.com/jinzhu/gorm v1.9.11 h1:gaHGvE+UnWGlbWG4Y3FUwY1EcZ5n6S9WtqBA/uySMLE=
Expand All @@ -149,6 +152,7 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/karrick/godirwalk v1.10.12 h1:BqUm+LuJcXjGv1d2mj3gBiQyrQ57a0rYoAmhvJQ7RDU=
github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
Expand Down Expand Up @@ -262,8 +266,10 @@ github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:Udh
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down Expand Up @@ -359,6 +365,7 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down
20 changes: 20 additions & 0 deletions pkg/calcapi/api_calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ func (svc *svc) AlternateLogo(_ context.Context, input *AlternateLogo_Input) (*A
}

func (svc *svc) SoundcloudMe(_ context.Context, input *SoundcloudMe_Input) (*SoundcloudMe_Output, error) {
if svc.soundcloud == nil {
return nil, fmt.Errorf("soundcloud API is disconnected")
}

me, err := svc.soundcloud.Me()
if err != nil {
return nil, err
Expand All @@ -166,6 +170,10 @@ func (svc *svc) SoundcloudMe(_ context.Context, input *SoundcloudMe_Input) (*Sou
}

func (svc *svc) SoundcloudPlaylists(_ context.Context, input *SoundcloudPlaylists_Input) (*SoundcloudPlaylists_Output, error) {
if svc.soundcloud == nil {
return nil, fmt.Errorf("soundcloud API is disconnected")
}

playlists, err := svc.soundcloud.GetPlaylists()
if err != nil {
return nil, err
Expand All @@ -174,6 +182,10 @@ func (svc *svc) SoundcloudPlaylists(_ context.Context, input *SoundcloudPlaylist
}

func (svc *svc) SoundcloudPlaylist(_ context.Context, input *SoundcloudPlaylist_Input) (*SoundcloudPlaylist_Output, error) {
if svc.soundcloud == nil {
return nil, fmt.Errorf("soundcloud API is disconnected")
}

if input.PlaylistId < 1 { // pick random
playlist, err := svc.soundcloud.GetRandomPlaylist()
if err != nil {
Expand All @@ -189,6 +201,10 @@ func (svc *svc) SoundcloudPlaylist(_ context.Context, input *SoundcloudPlaylist_
}

func (svc *svc) SoundcloudTracks(_ context.Context, input *SoundcloudTracks_Input) (*SoundcloudTracks_Output, error) {
if svc.soundcloud == nil {
return nil, fmt.Errorf("soundcloud API is disconnected")
}

tracks, err := svc.soundcloud.GetTracks()
if err != nil {
return nil, err
Expand All @@ -197,6 +213,10 @@ func (svc *svc) SoundcloudTracks(_ context.Context, input *SoundcloudTracks_Inpu
}

func (svc *svc) SoundcloudTrack(_ context.Context, input *SoundcloudTrack_Input) (*SoundcloudTrack_Output, error) {
if svc.soundcloud == nil {
return nil, fmt.Errorf("soundcloud API is disconnected")
}

if input.TrackId < 1 { // pick random
track, err := svc.soundcloud.GetRandomTrack()
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion pkg/calcapi/svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ func New(db *gorm.DB, opts Options) (Service, error) {
}

svc := &svc{opts: opts, startTime: time.Now(), db: db}
svc.soundcloud = soundcloud.New(opts.SoundcloudClientID, uint64(opts.SoundcloudUserID))
if opts.SoundcloudClientID != "" {
svc.soundcloud = soundcloud.New(opts.SoundcloudClientID, uint64(opts.SoundcloudUserID))
}
svc.dashboard = dashboard.New(&dashboard.Options{Soundcloud: svc.soundcloud})
// svc.dashboard.SetSoundCloud(&soundcloud)
return svc, nil
Expand Down
4 changes: 4 additions & 0 deletions pkg/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ func (d *Dashboard) hackEntries(limit int) (*Entries, error) {
func (d *Dashboard) trackEntries(limit int) (*Entries, error) {
entries := newEntries()

if d.opts.Soundcloud == nil {
return entries, nil
}

tracks, err := d.opts.Soundcloud.GetTracks()
if err != nil {
return entries, err
Expand Down
8 changes: 8 additions & 0 deletions tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build tools
// +build tools

package calcbiz

import (
_ "github.com/gobuffalo/packr/packr" // packr
)

0 comments on commit 07f4fda

Please sign in to comment.