Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkoo committed Aug 27, 2024
2 parents 050d2eb + 2957ea9 commit 7ef4cea
Show file tree
Hide file tree
Showing 50 changed files with 48,274 additions and 47,158 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.dem.gz filter=lfs diff=lfs merge=lfs -text
5 changes: 4 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
pull_request:
branches: [ "master", "dev" ]

env:
GOLANG_PROTOBUF_REGISTRATION_CONFLICT: warn

jobs:

build:
Expand All @@ -19,7 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21

- name: Build
run: go build -v main.go
Expand Down
84 changes: 42 additions & 42 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
name: golangci-lint
on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master", "dev" ]
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.19'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --out-format=colored-line-number # can't do that in github actions :(

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
name: golangci-lint
on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master", "dev" ]
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --out-format=colored-line-number # can't do that in github actions :(

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
2 changes: 1 addition & 1 deletion .github/workflows/nodejs_player.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

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

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nodejx_index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

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

steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
assets/icons/shapes
.vscode/
*.exe
.secret/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19 as builderGo
FROM golang:1.21 as builderGo

USER root
WORKDIR /csgo-2d-demo-player
Expand Down
38 changes: 38 additions & 0 deletions cmd/steamsvc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package main

import (
"csgo-2d-demo-player/conf"
"csgo-2d-demo-player/pkg/log"
"csgo-2d-demo-player/pkg/steamsvc"
"fmt"
"net/http"

"github.com/alexflint/go-arg"
"go.uber.org/zap"
)

var config *conf.ConfSteamSvc

func main() {
config = &conf.ConfSteamSvc{}
arg.MustParse(config)

log.Init(config.Mode)
defer log.Close()
log.L().Debug("using config", zap.Any("config", config))

client, err := steamsvc.NewSteamClient(config)

log.L().Debug("hmm, steam", zap.Any("client", client), zap.Error(err))

server()
}

func server() {
mux := http.NewServeMux()

log.L().Info("HTTP server listening on ...", zap.String("listen", config.Listen), zap.Int("port", config.Port))
// log.Println("Listening on ", config.Port, " ...")
listenErr := http.ListenAndServe(fmt.Sprintf("%s:%d", config.Listen, config.Port), mux)
log.L().Fatal("failed to listen", zap.Error(listenErr))
}
15 changes: 12 additions & 3 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ const MODE_DEV Mode = "dev"
const MODE_PROD Mode = "prod"

type Conf struct {
Demodir string `arg:"--demodir, env:DEMODIR" default:"" help:"Path to directory with demos."`
FaceitApiKey string `arg:"--faceitApiKey, required, env:FACEIT_APIKEY" help:"Faceit Server API key. Get it at https://developers.faceit.com/docs/auth/api-keys"`
// Demodir string `arg:"--demodir, env:DEMODIR" default:"" help:"Path to directory with demos."`
FaceitApiKey string `arg:"--faceitApiKey, env:FACEIT_APIKEY" help:"Faceit Server API key. Get it at https://developers.faceit.com/docs/auth/api-keys"`
FaceitOAuthClientId string `arg:"--faceitOAuthClientId, env:FACEIT_OAUTH_CLIENT_ID"`
FaceitOAuthClientSecret string `arg:"--faceitOAuthClientSecret, env:FACEIT_OAUTH_CLIENT_SECRET"`
SteamWebApiKey string `arg:"--steamWebApiKey, required, env:STEAM_WEB_APIKEY"`
SteamWebApiKey string `arg:"--steamWebApiKey, env:STEAM_WEB_APIKEY"`
Listen string `arg:"--listen, env:LISTEN" default:"127.0.0.1"`
Port int `arg:"--port, env:PORT" default:"8080" help:"Server port"`
Mode Mode `arg:"--mode, env:MODE" default:"dev" help:"Runtime environment mode, one of 'dev', 'prod'"`
}

type ConfSteamSvc struct {
SteamWebApiKey string `arg:"--steamWebApiKey, required, env:STEAM_WEB_APIKEY"`
SteamUsername string `arg:"--steamUsername, required, env:STEAM_USERNAME"`
SteamPassword string `arg:"--steamPassword, required, env:STEAM_PASSWORD"`
Listen string `arg:"--listen, env:LISTEN" default:"127.0.0.1"`
Port int `arg:"--port, env:PORT" default:"8081" help:"Server port"`
Mode Mode `arg:"--mode, env:MODE" default:"dev" help:"Runtime environment mode, one of 'dev', 'prod'"`
}
59 changes: 26 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,47 +1,40 @@
module csgo-2d-demo-player

go 1.19
go 1.21

require (
github.com/alexflint/go-arg v1.4.3
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551
github.com/gorilla/websocket v1.5.0
github.com/markus-wa/demoinfocs-golang/v3 v3.1.0
go.uber.org/zap v1.23.0
golang.org/x/oauth2 v0.6.0
google.golang.org/protobuf v1.30.0
)
toolchain go1.21.4

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gorilla/schema v1.2.0 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/muhlemmer/gu v0.3.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/text v0.8.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
github.com/alexflint/go-arg v1.5.1
github.com/golang/geo v0.0.0-20230421003525-6adc56603217
github.com/gorilla/websocket v1.5.3
github.com/markus-wa/demoinfocs-golang/v4 v4.2.6
github.com/sparkoo/go-steam v0.0.0-20231112203532-968479d66868
github.com/stretchr/testify v1.8.4
github.com/yohcop/openid-go v1.0.1
go.uber.org/zap v1.27.0
golang.org/x/oauth2 v0.22.0
google.golang.org/protobuf v1.34.2
)

require (
github.com/alexflint/go-scalar v1.1.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/alexflint/go-scalar v1.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0
github.com/markus-wa/go-unassert v0.1.2 // indirect
github.com/markus-wa/go-unassert v0.1.3 // indirect
github.com/markus-wa/gobitread v0.2.3 // indirect
github.com/markus-wa/godispatch v1.4.1 // indirect
github.com/markus-wa/ice-cipher-go v0.0.0-20220126215401-a6adadccc817 // indirect
github.com/markus-wa/quickhull-go/v2 v2.1.0 // indirect
github.com/markus-wa/ice-cipher-go v0.0.0-20230901094113-348096939ba7 // indirect
github.com/markus-wa/quickhull-go/v2 v2.2.0 // indirect
github.com/oklog/ulid/v2 v2.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/stretchr/testify v1.8.2 // indirect
github.com/yohcop/openid-go v1.0.1
github.com/zitadel/oidc v1.13.4
github.com/zitadel/oidc/v2 v2.2.6
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/net v0.8.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.28.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 7ef4cea

Please sign in to comment.