mirror of
https://github.com/unmojang/drasl
synced 2026-08-18 02:32:04 -04:00
Fix prek
This commit is contained in:
parent
cf75bd250c
commit
65ff07e8f7
19 changed files with 119 additions and 91 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -7,4 +7,4 @@
|
|||
/public/bundle.js
|
||||
/swagger
|
||||
result
|
||||
pre-commit-config.yaml
|
||||
.pre-commit-config.yaml
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
/nix/store/kdk9m3f87rpdhpgdxs0aayckx5rdxgmd-pre-commit-config.json
|
||||
2
Makefile
2
Makefile
|
|
@ -1,7 +1,7 @@
|
|||
prefix ?= /usr
|
||||
.DEFAULT_GOAL := build
|
||||
|
||||
SWAG := go tool swag
|
||||
SWAG := $(shell command -v swag || echo 'go tool swag')
|
||||
|
||||
node_modules: package.json
|
||||
npm install
|
||||
|
|
|
|||
|
|
@ -5,14 +5,15 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type PlayerNameToIDResponse struct {
|
||||
|
|
|
|||
9
api.go
9
api.go
|
|
@ -4,10 +4,6 @@ import (
|
|||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
|
|
@ -16,6 +12,11 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const API_MAJOR_VERSION = 2
|
||||
|
|
|
|||
3
auth.go
3
auth.go
|
|
@ -4,10 +4,11 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ import (
|
|||
"encoding/json"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
)
|
||||
|
||||
type authlibInjectorLinks struct {
|
||||
|
|
|
|||
17
common.go
17
common.go
|
|
@ -9,17 +9,9 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
"github.com/samber/mo"
|
||||
"github.com/zitadel/oidc/v3/pkg/client/rp"
|
||||
"image/png"
|
||||
"io"
|
||||
"log"
|
||||
"lukechampine.com/blake3"
|
||||
mathRand "math/rand"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
|
@ -29,6 +21,15 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
"github.com/samber/mo"
|
||||
"github.com/zitadel/oidc/v3/pkg/client/rp"
|
||||
"lukechampine.com/blake3"
|
||||
)
|
||||
|
||||
const MAX_PLAYER_NAMES_TO_IDS = 10
|
||||
|
|
|
|||
11
config.go
11
config.go
|
|
@ -6,17 +6,18 @@ import (
|
|||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/BurntSushi/toml"
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/samber/mo"
|
||||
"golang.org/x/net/idna"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/samber/mo"
|
||||
"golang.org/x/net/idna"
|
||||
)
|
||||
|
||||
type rateLimitConfig struct {
|
||||
|
|
|
|||
11
db.go
11
db.go
|
|
@ -4,17 +4,18 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/google/uuid"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
const CURRENT_USER_VERSION = 5
|
||||
|
|
|
|||
58
flake.nix
58
flake.nix
|
|
@ -62,30 +62,44 @@
|
|||
in
|
||||
pkgs.writeShellScriptBin "prek" script
|
||||
);
|
||||
checks = forEachSystem (system: {
|
||||
pre-commit-check = git-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
nixfmt.enable = true;
|
||||
trim-trailing-whitespace.enable = true;
|
||||
gofmt.enable = true;
|
||||
swag = {
|
||||
enable = true;
|
||||
name = "Generate Swagger/OpenAPI documentation";
|
||||
entry = "make swag";
|
||||
files = "\\.go$";
|
||||
pass_filenames = false;
|
||||
};
|
||||
swag-fmt = {
|
||||
enable = true;
|
||||
name = "format swag comments";
|
||||
entry = "go tool swag fmt";
|
||||
files = "\\.go$";
|
||||
pass_filenames = false;
|
||||
checks = forEachSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
pre-commit-check = git-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
package = pkgs.prek;
|
||||
hooks = {
|
||||
nixfmt.enable = true;
|
||||
trim-trailing-whitespace.enable = true;
|
||||
gofmt.enable = true;
|
||||
swag = {
|
||||
enable = true;
|
||||
name = "Generate Swagger/OpenAPI documentation";
|
||||
extraPackages = [
|
||||
pkgs.go
|
||||
pkgs.go-swag
|
||||
];
|
||||
entry = "make swag";
|
||||
files = "\\.go$";
|
||||
pass_filenames = false;
|
||||
};
|
||||
swag-fmt = {
|
||||
enable = true;
|
||||
name = "format swag comments";
|
||||
extraPackages = [
|
||||
pkgs.go-swag
|
||||
];
|
||||
entry = "swag fmt";
|
||||
files = "\\.go$";
|
||||
pass_filenames = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
packages = forEachSystem (
|
||||
system:
|
||||
let
|
||||
|
|
|
|||
17
front.go
17
front.go
|
|
@ -7,6 +7,15 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jxskiss/base62"
|
||||
|
|
@ -17,14 +26,6 @@ import (
|
|||
"github.com/zitadel/oidc/v3/pkg/oidc"
|
||||
"golang.org/x/text/language"
|
||||
"gorm.io/gorm"
|
||||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
/*
|
||||
|
|
|
|||
21
main.go
21
main.go
|
|
@ -11,19 +11,9 @@ import (
|
|||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/labstack/echo/v5/middleware"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
"github.com/samber/mo"
|
||||
"github.com/zitadel/oidc/v3/pkg/client/rp"
|
||||
httphelper "github.com/zitadel/oidc/v3/pkg/http"
|
||||
"golang.org/x/text/language"
|
||||
"gorm.io/gorm"
|
||||
"image"
|
||||
"image/png"
|
||||
"log"
|
||||
"lukechampine.com/blake3"
|
||||
"math"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
|
@ -36,6 +26,17 @@ import (
|
|||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/labstack/echo/v5/middleware"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
"github.com/samber/mo"
|
||||
"github.com/zitadel/oidc/v3/pkg/client/rp"
|
||||
httphelper "github.com/zitadel/oidc/v3/pkg/http"
|
||||
"golang.org/x/text/language"
|
||||
"gorm.io/gorm"
|
||||
"lukechampine.com/blake3"
|
||||
)
|
||||
|
||||
func DRASL_DEBUG() bool {
|
||||
|
|
|
|||
9
model.go
9
model.go
|
|
@ -4,16 +4,17 @@ import (
|
|||
"crypto/md5"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"net/mail"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
"github.com/google/uuid"
|
||||
"github.com/samber/mo"
|
||||
"golang.org/x/crypto/scrypt"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"net/mail"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -6,18 +6,19 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/google/uuid"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/png"
|
||||
"io"
|
||||
"log"
|
||||
"lukechampine.com/blake3"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
"lukechampine.com/blake3"
|
||||
)
|
||||
|
||||
func (app *App) getTexture(
|
||||
|
|
|
|||
|
|
@ -10,9 +10,6 @@ import (
|
|||
"encoding/pem"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
"log"
|
||||
"math/big"
|
||||
"net/http"
|
||||
|
|
@ -20,6 +17,10 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// Authenticate a user using a bearer token
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ import (
|
|||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
|
|
@ -16,6 +13,10 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/samber/mo"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type sessionJoinRequest struct {
|
||||
|
|
|
|||
9
user.go
9
user.go
|
|
@ -6,15 +6,16 @@ import (
|
|||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/samber/mo"
|
||||
"github.com/zitadel/oidc/v3/pkg/client/rp"
|
||||
"github.com/zitadel/oidc/v3/pkg/oidc"
|
||||
"gorm.io/gorm"
|
||||
"io"
|
||||
"net/http"
|
||||
"slices"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Must be in a region of the skin that supports translucency
|
||||
|
|
|
|||
3
util.go
3
util.go
|
|
@ -7,12 +7,13 @@ import (
|
|||
"crypto/sha1"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"github.com/jxskiss/base62"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/jxskiss/base62"
|
||||
)
|
||||
|
||||
// Wrap arguments that may introduce security issues so the caller is aware to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue