This commit is contained in:
Evan Goode 2026-07-11 22:23:45 -04:00
parent cf75bd250c
commit 65ff07e8f7
19 changed files with 119 additions and 91 deletions

2
.gitignore vendored
View file

@ -7,4 +7,4 @@
/public/bundle.js
/swagger
result
pre-commit-config.yaml
.pre-commit-config.yaml

View file

@ -1 +0,0 @@
/nix/store/kdk9m3f87rpdhpgdxs0aayckx5rdxgmd-pre-commit-config.json

View file

@ -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

View file

@ -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
View file

@ -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

View file

@ -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"
)
/*

View file

@ -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 {

View file

@ -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

View file

@ -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
View file

@ -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

View file

@ -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

View file

@ -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
View file

@ -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 {

View file

@ -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 (

View file

@ -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(

View file

@ -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

View file

@ -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 {

View file

@ -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

View file

@ -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