Skip to content

Commit 7ef4cea

Browse files
committed
Merge branch 'dev'
2 parents 050d2eb + 2957ea9 commit 7ef4cea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+48274
-47158
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.dem.gz filter=lfs diff=lfs merge=lfs -text

.github/workflows/go.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
pull_request:
1010
branches: [ "master", "dev" ]
1111

12+
env:
13+
GOLANG_PROTOBUF_REGISTRATION_CONFLICT: warn
14+
1215
jobs:
1316

1417
build:
@@ -19,7 +22,7 @@ jobs:
1922
- name: Set up Go
2023
uses: actions/setup-go@v3
2124
with:
22-
go-version: 1.19
25+
go-version: 1.21
2326

2427
- name: Build
2528
run: go build -v main.go

.github/workflows/golangci-lint.yml

+42-42
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
name: golangci-lint
2-
on:
3-
push:
4-
branches: [ "master", "dev" ]
5-
pull_request:
6-
branches: [ "master", "dev" ]
7-
permissions:
8-
contents: read
9-
# Optional: allow read access to pull request. Use with `only-new-issues` option.
10-
# pull-requests: read
11-
jobs:
12-
golangci:
13-
name: lint
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/setup-go@v3
17-
with:
18-
go-version: '1.19'
19-
- uses: actions/checkout@v3
20-
- name: golangci-lint
21-
uses: golangci/golangci-lint-action@v3
22-
with:
23-
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
24-
version: latest
25-
26-
# Optional: working directory, useful for monorepos
27-
# working-directory: somedir
28-
29-
# Optional: golangci-lint command line arguments.
30-
# args: --out-format=colored-line-number # can't do that in github actions :(
31-
32-
# Optional: show only new issues if it's a pull request. The default value is `false`.
33-
# only-new-issues: true
34-
35-
# Optional: if set to true then the all caching functionality will be complete disabled,
36-
# takes precedence over all other caching options.
37-
# skip-cache: true
38-
39-
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
40-
# skip-pkg-cache: true
41-
42-
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
1+
name: golangci-lint
2+
on:
3+
push:
4+
branches: [ "master", "dev" ]
5+
pull_request:
6+
branches: [ "master", "dev" ]
7+
permissions:
8+
contents: read
9+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
10+
# pull-requests: read
11+
jobs:
12+
golangci:
13+
name: lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/setup-go@v5
17+
with:
18+
go-version: '1.21'
19+
- uses: actions/checkout@v4
20+
- name: golangci-lint
21+
uses: golangci/golangci-lint-action@v6
22+
with:
23+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
24+
version: latest
25+
26+
# Optional: working directory, useful for monorepos
27+
# working-directory: somedir
28+
29+
# Optional: golangci-lint command line arguments.
30+
# args: --out-format=colored-line-number # can't do that in github actions :(
31+
32+
# Optional: show only new issues if it's a pull request. The default value is `false`.
33+
# only-new-issues: true
34+
35+
# Optional: if set to true then the all caching functionality will be complete disabled,
36+
# takes precedence over all other caching options.
37+
# skip-cache: true
38+
39+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
40+
# skip-pkg-cache: true
41+
42+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
4343
# skip-build-cache: true

.github/workflows/nodejs_player.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [18.x, 19.x]
19+
node-version: [lts/*]
2020
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2121

2222
steps:

.github/workflows/nodejx_index.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [18.x, 19.x]
19+
node-version: [lts/*]
2020
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2121

2222
steps:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
assets/icons/shapes
55
.vscode/
66
*.exe
7+
.secret/

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19 as builderGo
1+
FROM golang:1.21 as builderGo
22

33
USER root
44
WORKDIR /csgo-2d-demo-player

cmd/steamsvc.go

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package main
2+
3+
import (
4+
"csgo-2d-demo-player/conf"
5+
"csgo-2d-demo-player/pkg/log"
6+
"csgo-2d-demo-player/pkg/steamsvc"
7+
"fmt"
8+
"net/http"
9+
10+
"github.com/alexflint/go-arg"
11+
"go.uber.org/zap"
12+
)
13+
14+
var config *conf.ConfSteamSvc
15+
16+
func main() {
17+
config = &conf.ConfSteamSvc{}
18+
arg.MustParse(config)
19+
20+
log.Init(config.Mode)
21+
defer log.Close()
22+
log.L().Debug("using config", zap.Any("config", config))
23+
24+
client, err := steamsvc.NewSteamClient(config)
25+
26+
log.L().Debug("hmm, steam", zap.Any("client", client), zap.Error(err))
27+
28+
server()
29+
}
30+
31+
func server() {
32+
mux := http.NewServeMux()
33+
34+
log.L().Info("HTTP server listening on ...", zap.String("listen", config.Listen), zap.Int("port", config.Port))
35+
// log.Println("Listening on ", config.Port, " ...")
36+
listenErr := http.ListenAndServe(fmt.Sprintf("%s:%d", config.Listen, config.Port), mux)
37+
log.L().Fatal("failed to listen", zap.Error(listenErr))
38+
}

conf/conf.go

+12-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,21 @@ const MODE_DEV Mode = "dev"
66
const MODE_PROD Mode = "prod"
77

88
type Conf struct {
9-
Demodir string `arg:"--demodir, env:DEMODIR" default:"" help:"Path to directory with demos."`
10-
FaceitApiKey string `arg:"--faceitApiKey, required, env:FACEIT_APIKEY" help:"Faceit Server API key. Get it at https://developers.faceit.com/docs/auth/api-keys"`
9+
// Demodir string `arg:"--demodir, env:DEMODIR" default:"" help:"Path to directory with demos."`
10+
FaceitApiKey string `arg:"--faceitApiKey, env:FACEIT_APIKEY" help:"Faceit Server API key. Get it at https://developers.faceit.com/docs/auth/api-keys"`
1111
FaceitOAuthClientId string `arg:"--faceitOAuthClientId, env:FACEIT_OAUTH_CLIENT_ID"`
1212
FaceitOAuthClientSecret string `arg:"--faceitOAuthClientSecret, env:FACEIT_OAUTH_CLIENT_SECRET"`
13-
SteamWebApiKey string `arg:"--steamWebApiKey, required, env:STEAM_WEB_APIKEY"`
13+
SteamWebApiKey string `arg:"--steamWebApiKey, env:STEAM_WEB_APIKEY"`
1414
Listen string `arg:"--listen, env:LISTEN" default:"127.0.0.1"`
1515
Port int `arg:"--port, env:PORT" default:"8080" help:"Server port"`
1616
Mode Mode `arg:"--mode, env:MODE" default:"dev" help:"Runtime environment mode, one of 'dev', 'prod'"`
1717
}
18+
19+
type ConfSteamSvc struct {
20+
SteamWebApiKey string `arg:"--steamWebApiKey, required, env:STEAM_WEB_APIKEY"`
21+
SteamUsername string `arg:"--steamUsername, required, env:STEAM_USERNAME"`
22+
SteamPassword string `arg:"--steamPassword, required, env:STEAM_PASSWORD"`
23+
Listen string `arg:"--listen, env:LISTEN" default:"127.0.0.1"`
24+
Port int `arg:"--port, env:PORT" default:"8081" help:"Server port"`
25+
Mode Mode `arg:"--mode, env:MODE" default:"dev" help:"Runtime environment mode, one of 'dev', 'prod'"`
26+
}

go.mod

+26-33
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,40 @@
11
module csgo-2d-demo-player
22

3-
go 1.19
3+
go 1.21
44

5-
require (
6-
github.com/alexflint/go-arg v1.4.3
7-
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551
8-
github.com/gorilla/websocket v1.5.0
9-
github.com/markus-wa/demoinfocs-golang/v3 v3.1.0
10-
go.uber.org/zap v1.23.0
11-
golang.org/x/oauth2 v0.6.0
12-
google.golang.org/protobuf v1.30.0
13-
)
5+
toolchain go1.21.4
146

157
require (
16-
github.com/davecgh/go-spew v1.1.1 // indirect
17-
github.com/gorilla/schema v1.2.0 // indirect
18-
github.com/gorilla/securecookie v1.1.1 // indirect
19-
github.com/muhlemmer/gu v0.3.1 // indirect
20-
github.com/pmezard/go-difflib v1.0.0 // indirect
21-
golang.org/x/crypto v0.7.0 // indirect
22-
golang.org/x/text v0.8.0 // indirect
23-
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
24-
gopkg.in/yaml.v3 v3.0.1 // indirect
8+
github.com/alexflint/go-arg v1.5.1
9+
github.com/golang/geo v0.0.0-20230421003525-6adc56603217
10+
github.com/gorilla/websocket v1.5.3
11+
github.com/markus-wa/demoinfocs-golang/v4 v4.2.6
12+
github.com/sparkoo/go-steam v0.0.0-20231112203532-968479d66868
13+
github.com/stretchr/testify v1.8.4
14+
github.com/yohcop/openid-go v1.0.1
15+
go.uber.org/zap v1.27.0
16+
golang.org/x/oauth2 v0.22.0
17+
google.golang.org/protobuf v1.34.2
2518
)
2619

2720
require (
28-
github.com/alexflint/go-scalar v1.1.0 // indirect
29-
github.com/golang/protobuf v1.5.3 // indirect
21+
github.com/alexflint/go-scalar v1.2.0 // indirect
22+
github.com/davecgh/go-spew v1.1.1 // indirect
23+
github.com/golang/protobuf v1.5.4 // indirect
24+
github.com/golang/snappy v0.0.4 // indirect
3025
github.com/google/go-cmp v0.5.9 // indirect
31-
github.com/google/uuid v1.3.0
32-
github.com/markus-wa/go-unassert v0.1.2 // indirect
26+
github.com/markus-wa/go-unassert v0.1.3 // indirect
3327
github.com/markus-wa/gobitread v0.2.3 // indirect
3428
github.com/markus-wa/godispatch v1.4.1 // indirect
35-
github.com/markus-wa/ice-cipher-go v0.0.0-20220126215401-a6adadccc817 // indirect
36-
github.com/markus-wa/quickhull-go/v2 v2.1.0 // indirect
29+
github.com/markus-wa/ice-cipher-go v0.0.0-20230901094113-348096939ba7 // indirect
30+
github.com/markus-wa/quickhull-go/v2 v2.2.0 // indirect
3731
github.com/oklog/ulid/v2 v2.1.0 // indirect
3832
github.com/pkg/errors v0.9.1 // indirect
39-
github.com/stretchr/testify v1.8.2 // indirect
40-
github.com/yohcop/openid-go v1.0.1
41-
github.com/zitadel/oidc v1.13.4
42-
github.com/zitadel/oidc/v2 v2.2.6
43-
go.uber.org/atomic v1.7.0 // indirect
44-
go.uber.org/multierr v1.6.0 // indirect
45-
golang.org/x/net v0.8.0 // indirect
46-
google.golang.org/appengine v1.6.7 // indirect
33+
github.com/pmezard/go-difflib v1.0.0 // indirect
34+
go.uber.org/atomic v1.11.0 // indirect
35+
go.uber.org/multierr v1.11.0 // indirect
36+
golang.org/x/net v0.28.0 // indirect
37+
google.golang.org/appengine v1.6.8 // indirect
38+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
39+
gopkg.in/yaml.v3 v3.0.1 // indirect
4740
)

0 commit comments

Comments
 (0)