Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
960551ad9b | |||
cfd36220b5 | |||
ddb09068e3 | |||
4ef4ea4668 | |||
9f4abccfeb | |||
80a9c3e5d8 | |||
0d6117c374 | |||
5b10e2fc38 | |||
be4d661fa6 | |||
05a1707eb6 | |||
ef36c82b75 | |||
ff0eea688e | |||
5b673da641 | |||
701794828f | |||
aeba6b1004 | |||
8badf6f62b | |||
54b5641c85 | |||
1ed8b88494 | |||
0b880bece8 |
@ -3,14 +3,19 @@ name: CI
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
pull_request:
|
|
||||||
branches:
|
env:
|
||||||
- master
|
# Use docker.io for Docker Hub if empty
|
||||||
|
REGISTRY: git.thehrz.net
|
||||||
|
# github.repository as <account>/<repo>
|
||||||
|
IMAGE_NAME: H8-Network/TinySkin
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
release-image:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@ -20,6 +25,29 @@ jobs:
|
|||||||
# - name: Install Docker
|
# - name: Install Docker
|
||||||
# run: curl -fsSL https://get.docker.com | sh
|
# run: curl -fsSL https://get.docker.com | sh
|
||||||
|
|
||||||
- name: Deploy with Docker
|
- name: Set up Docker Buildx
|
||||||
run: docker compose up --build --force-recreate -d
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log into registry
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
# labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
# cache-from: type=gha
|
||||||
|
# cache-to: type=gha,mode=max
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,6 +3,7 @@ cmd/authlibskin/config.yaml
|
|||||||
cmd/authlibskin/skin
|
cmd/authlibskin/skin
|
||||||
cmd/authlibskin/authlibskin.exe
|
cmd/authlibskin/authlibskin.exe
|
||||||
server/static/files
|
server/static/files
|
||||||
cmd/authlibskin/config.toml
|
config.toml
|
||||||
out/
|
out/
|
||||||
stats.html
|
stats.html
|
||||||
|
.idea
|
@ -11,7 +11,7 @@ COPY frontend .
|
|||||||
|
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
FROM golang:1.23 AS build-stage
|
FROM golang:1.23-alpine AS build-stage
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV GOPROXY https://goproxy.cn,direct
|
ENV GOPROXY https://goproxy.cn,direct
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# TinySkin
|
# TinySkin
|
||||||
|
|
||||||
Fork from [authlib-skin](https://github.com/xmdhs/authlib-skin).
|
Fork from [authlib-skin](https://tinyskin).
|
||||||
|
|
||||||
轻量级的 Yggdrasil 服务端实现,后端 Go,前端 react。
|
轻量级的 Yggdrasil 服务端实现,后端 Go,前端 react。
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ type Config struct {
|
|||||||
Sql Sql `toml:"sql"`
|
Sql Sql `toml:"sql"`
|
||||||
Debug bool `toml:"debug" comment:"输出每条执行的 sql 语句"`
|
Debug bool `toml:"debug" comment:"输出每条执行的 sql 语句"`
|
||||||
Cache Cache `toml:"cache"`
|
Cache Cache `toml:"cache"`
|
||||||
RaelIP bool `toml:"raelIP" comment:"位于反向代理后启用,用于记录真实 ip\n若直接提供服务,请勿打开,否则会被伪造 ip"`
|
RealIP bool `toml:"realIP" comment:"位于反向代理后启用,用于记录真实 ip\n若直接提供服务,请勿打开,否则会被伪造 ip"`
|
||||||
MaxIpUser int `toml:"maxIpUser" comment:"ip 段最大注册用户,ipv4 为 /24 ipv6 为 /48"`
|
MaxIpUser int `toml:"maxIpUser" comment:"ip 段最大注册用户,ipv4 为 /24 ipv6 为 /48"`
|
||||||
RsaPriKey string `toml:"rsaPriKey,multiline" comment:"运行后勿修改,若为集群需设置为一致"`
|
RsaPriKey string `toml:"rsaPriKey,multiline" comment:"运行后勿修改,若为集群需设置为一致"`
|
||||||
TexturePath string `toml:"texturePath" comment:"材质文件保存路径,如果需要对象存储可以把对象储存挂载到本地目录上"`
|
TexturePath string `toml:"texturePath" comment:"材质文件保存路径,如果需要对象存储可以把对象储存挂载到本地目录上"`
|
||||||
@ -76,7 +76,7 @@ func Default() Config {
|
|||||||
Addr: "",
|
Addr: "",
|
||||||
Password: "",
|
Password: "",
|
||||||
},
|
},
|
||||||
RaelIP: false,
|
RealIP: false,
|
||||||
MaxIpUser: 0,
|
MaxIpUser: 0,
|
||||||
RsaPriKey: "",
|
RsaPriKey: "",
|
||||||
TexturePath: "",
|
TexturePath: "",
|
||||||
|
@ -8,17 +8,17 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/migrate"
|
"tinyskin/db/ent/migrate"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect"
|
"entgo.io/ent/dialect"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client is the client that holds all ent builders.
|
// Client is the client that holds all ent builders.
|
||||||
|
@ -12,11 +12,11 @@ import (
|
|||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ent aliases to avoid import conflicts in user's code.
|
// ent aliases to avoid import conflicts in user's code.
|
||||||
|
@ -5,12 +5,12 @@ package enttest
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
"tinyskin/db/ent"
|
||||||
// required by schema hooks.
|
// required by schema hooks.
|
||||||
_ "github.com/xmdhs/authlib-skin/db/ent/runtime"
|
_ "tinyskin/db/ent/runtime"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/schema"
|
"entgo.io/ent/dialect/sql/schema"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/migrate"
|
"tinyskin/db/ent/migrate"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
"tinyskin/db/ent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The TextureFunc type is an adapter to allow the use of ordinary
|
// The TextureFunc type is an adapter to allow the use of ordinary
|
||||||
|
@ -10,12 +10,12 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
// The schema-stitching logic is generated in github.com/xmdhs/authlib-skin/db/ent/runtime.go
|
// The schema-stitching logic is generated in tinyskin/db/ent/runtime.go
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "(devel)" // Version of ent codegen.
|
Version = "(devel)" // Version of ent codegen.
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Texture is the model entity for the Texture schema.
|
// Texture is the model entity for the Texture schema.
|
||||||
|
@ -5,7 +5,7 @@ package texture
|
|||||||
import (
|
import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
@ -9,10 +9,10 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TextureCreate is the builder for creating a Texture entity.
|
// TextureCreate is the builder for creating a Texture entity.
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TextureDelete is the builder for deleting a Texture entity.
|
// TextureDelete is the builder for deleting a Texture entity.
|
||||||
|
@ -12,11 +12,11 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TextureQuery is the builder for querying Texture entities.
|
// TextureQuery is the builder for querying Texture entities.
|
||||||
|
@ -10,11 +10,11 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TextureUpdate is the builder for updating Texture entities.
|
// TextureUpdate is the builder for updating Texture entities.
|
||||||
|
@ -8,9 +8,9 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// User is the model entity for the User schema.
|
// User is the model entity for the User schema.
|
||||||
|
@ -5,7 +5,7 @@ package user
|
|||||||
import (
|
import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
@ -9,10 +9,10 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserCreate is the builder for creating a User entity.
|
// UserCreate is the builder for creating a User entity.
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserDelete is the builder for deleting a User entity.
|
// UserDelete is the builder for deleting a User entity.
|
||||||
|
@ -12,11 +12,11 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserQuery is the builder for querying User entities.
|
// UserQuery is the builder for querying User entities.
|
||||||
|
@ -10,11 +10,11 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserUpdate is the builder for updating User entities.
|
// UserUpdate is the builder for updating User entities.
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserProfile is the model entity for the UserProfile schema.
|
// UserProfile is the model entity for the UserProfile schema.
|
||||||
|
@ -5,7 +5,7 @@ package userprofile
|
|||||||
import (
|
import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
@ -9,10 +9,10 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserProfileCreate is the builder for creating a UserProfile entity.
|
// UserProfileCreate is the builder for creating a UserProfile entity.
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserProfileDelete is the builder for deleting a UserProfile entity.
|
// UserProfileDelete is the builder for deleting a UserProfile entity.
|
||||||
|
@ -12,11 +12,11 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserProfileQuery is the builder for querying UserProfile entities.
|
// UserProfileQuery is the builder for querying UserProfile entities.
|
||||||
|
@ -10,11 +10,11 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserProfileUpdate is the builder for updating UserProfile entities.
|
// UserProfileUpdate is the builder for updating UserProfile entities.
|
||||||
|
@ -8,9 +8,9 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserTexture is the model entity for the UserTexture schema.
|
// UserTexture is the model entity for the UserTexture schema.
|
||||||
|
@ -5,7 +5,7 @@ package usertexture
|
|||||||
import (
|
import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
@ -9,9 +9,9 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserTextureCreate is the builder for creating a UserTexture entity.
|
// UserTextureCreate is the builder for creating a UserTexture entity.
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserTextureDelete is the builder for deleting a UserTexture entity.
|
// UserTextureDelete is the builder for deleting a UserTexture entity.
|
||||||
|
@ -11,10 +11,10 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserTextureQuery is the builder for querying UserTexture entities.
|
// UserTextureQuery is the builder for querying UserTexture entities.
|
||||||
|
@ -10,10 +10,10 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
"tinyskin/db/ent/usertexture"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserTextureUpdate is the builder for updating UserTexture entities.
|
// UserTextureUpdate is the builder for updating UserTexture entities.
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserToken is the model entity for the UserToken schema.
|
// UserToken is the model entity for the UserToken schema.
|
||||||
|
@ -5,7 +5,7 @@ package usertoken
|
|||||||
import (
|
import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserTokenCreate is the builder for creating a UserToken entity.
|
// UserTokenCreate is the builder for creating a UserToken entity.
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserTokenDelete is the builder for deleting a UserToken entity.
|
// UserTokenDelete is the builder for deleting a UserToken entity.
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserTokenQuery is the builder for querying UserToken entities.
|
// UserTokenQuery is the builder for querying UserToken entities.
|
||||||
|
@ -10,9 +10,9 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserTokenUpdate is the builder for updating UserToken entities.
|
// UserTokenUpdate is the builder for updating UserToken entities.
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
version: "3.9"
|
|
||||||
|
|
||||||
networks:
|
|
||||||
traefik:
|
|
||||||
name: traefik
|
|
||||||
external: true
|
|
||||||
|
|
||||||
|
|
||||||
services:
|
|
||||||
authlib-skin:
|
|
||||||
build: .
|
|
||||||
container_name: authlib-skin
|
|
||||||
volumes:
|
|
||||||
- /srv/server/authlib-skin:/app/config
|
|
||||||
restart: always
|
|
||||||
labels:
|
|
||||||
- traefik.enable=true
|
|
||||||
- traefik.http.routers.authlib-skin.rule=Host(`auth.hfbz.net`)
|
|
||||||
- traefik.http.routers.authlib-skin.entrypoints=web,websecure
|
|
||||||
- traefik.http.routers.authlib-skin.middlewares=CORS@file
|
|
||||||
- traefik.http.services.authlib-skin.loadbalancer.server.port=8080
|
|
||||||
networks:
|
|
||||||
- traefik
|
|
24
frontend/src/components/YggdrasilSetter.tsx
Normal file
24
frontend/src/components/YggdrasilSetter.tsx
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import Button from "@mui/material/Button"
|
||||||
|
import { useCallback } from "react"
|
||||||
|
|
||||||
|
export default function QuickSetter() {
|
||||||
|
const url = "https://auth.hfbz.net/api/yggdrasil"
|
||||||
|
|
||||||
|
const handleDragStart = useCallback(
|
||||||
|
(event: React.DragEvent<HTMLButtonElement>) => {
|
||||||
|
const uri = "authlib-injector:yggdrasil-server:" + encodeURIComponent(url)
|
||||||
|
|
||||||
|
if (event.dataTransfer) {
|
||||||
|
event.dataTransfer.setData("text/plain", uri)
|
||||||
|
event.dataTransfer.dropEffect = "copy"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[url]
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button variant="contained" draggable onDragStart={handleDragStart}>
|
||||||
|
将此按钮拖到启动器
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
@ -165,8 +165,8 @@ export default function SignUp() {
|
|||||||
}}
|
}}
|
||||||
checkList={[
|
checkList={[
|
||||||
{
|
{
|
||||||
errMsg: "长度在 3-16 之间",
|
errMsg: "长度在 3-16 之间,由数字、大小写字母、_构成",
|
||||||
reg: /^.{3,16}$/
|
reg: /^[0-9a-zA-Z_]{3,16}$/
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
required
|
required
|
||||||
|
@ -11,6 +11,7 @@ import Box from '@mui/material/Box';
|
|||||||
import useTitle from '@/hooks/useTitle';
|
import useTitle from '@/hooks/useTitle';
|
||||||
import SkinViewUUID from '@/components/SkinViewUUID';
|
import SkinViewUUID from '@/components/SkinViewUUID';
|
||||||
import root from '@/utils/root';
|
import root from '@/utils/root';
|
||||||
|
import YggdrasilSetter from '@/components/YggdrasilSetter';
|
||||||
|
|
||||||
const Profile = function Profile() {
|
const Profile = function Profile() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -54,6 +55,7 @@ const Profile = function Profile() {
|
|||||||
<Typography>本站 Yggdrasil 认证服务器地址</Typography>
|
<Typography>本站 Yggdrasil 认证服务器地址</Typography>
|
||||||
<code style={{ wordBreak: "break-all" }}>{getYggRoot()}</code>
|
<code style={{ wordBreak: "break-all" }}>{getYggRoot()}</code>
|
||||||
<Typography>点击下方按钮复制 API 地址,或者将按钮拖动至启动器的任意界面即可快速添加认证服务器。</Typography>
|
<Typography>点击下方按钮复制 API 地址,或者将按钮拖动至启动器的任意界面即可快速添加认证服务器。</Typography>
|
||||||
|
<YggdrasilSetter />
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
<Box sx={{ gridArea: "d" }}></Box>
|
<Box sx={{ gridArea: "d" }}></Box>
|
||||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
|||||||
module github.com/xmdhs/authlib-skin
|
module tinyskin
|
||||||
|
|
||||||
go 1.23
|
go 1.23
|
||||||
|
|
||||||
|
@ -7,13 +7,14 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"tinyskin/handle/handelerror"
|
||||||
|
"tinyskin/model"
|
||||||
|
"tinyskin/service"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/xmdhs/authlib-skin/handle/handelerror"
|
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
"github.com/xmdhs/authlib-skin/service"
|
|
||||||
|
|
||||||
U "github.com/xmdhs/authlib-skin/utils"
|
U "tinyskin/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AdminHandel struct {
|
type AdminHandel struct {
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
"tinyskin/model"
|
||||||
"github.com/xmdhs/authlib-skin/service"
|
"tinyskin/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Handel struct {
|
type Handel struct {
|
||||||
|
@ -7,11 +7,11 @@ import (
|
|||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
"tinyskin/model"
|
||||||
"github.com/xmdhs/authlib-skin/service"
|
"tinyskin/service"
|
||||||
"github.com/xmdhs/authlib-skin/service/auth"
|
"tinyskin/service/auth"
|
||||||
"github.com/xmdhs/authlib-skin/service/captcha"
|
"tinyskin/service/captcha"
|
||||||
"github.com/xmdhs/authlib-skin/service/email"
|
"tinyskin/service/email"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HandleError struct {
|
type HandleError struct {
|
||||||
|
@ -6,9 +6,10 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
|
"tinyskin/model"
|
||||||
|
|
||||||
"github.com/google/wire"
|
"github.com/google/wire"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var HandelSet = wire.NewSet(NewUserHandel, NewAdminHandel, NewHandel)
|
var HandelSet = wire.NewSet(NewUserHandel, NewAdminHandel, NewHandel)
|
||||||
|
@ -13,13 +13,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/handle/handelerror"
|
||||||
|
"tinyskin/model"
|
||||||
|
"tinyskin/service"
|
||||||
|
"tinyskin/utils"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/handle/handelerror"
|
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
"github.com/xmdhs/authlib-skin/service"
|
|
||||||
"github.com/xmdhs/authlib-skin/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserHandel struct {
|
type UserHandel struct {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
"tinyskin/model/yggdrasil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func handleYgError(ctx context.Context, w http.ResponseWriter, e yggdrasil.Error, httpcode int) {
|
func handleYgError(ctx context.Context, w http.ResponseWriter, e yggdrasil.Error, httpcode int) {
|
||||||
|
@ -4,10 +4,11 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"tinyskin/model"
|
||||||
|
"tinyskin/model/yggdrasil"
|
||||||
|
"tinyskin/utils"
|
||||||
|
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
|
||||||
"github.com/xmdhs/authlib-skin/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (y *Yggdrasil) SessionJoin() http.HandlerFunc {
|
func (y *Yggdrasil) SessionJoin() http.HandlerFunc {
|
||||||
|
@ -7,11 +7,12 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"tinyskin/model"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
"tinyskin/model/yggdrasil"
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
|
||||||
|
|
||||||
yggdrasilS "github.com/xmdhs/authlib-skin/service/yggdrasil"
|
"github.com/go-chi/chi/v5"
|
||||||
|
|
||||||
|
yggdrasilS "tinyskin/service/yggdrasil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (y *Yggdrasil) getTokenbyAuthorization(ctx context.Context, w http.ResponseWriter, r *http.Request) string {
|
func (y *Yggdrasil) getTokenbyAuthorization(ctx context.Context, w http.ResponseWriter, r *http.Request) string {
|
||||||
|
@ -5,11 +5,12 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"tinyskin/model"
|
||||||
|
"tinyskin/model/yggdrasil"
|
||||||
|
yggdrasilS "tinyskin/service/yggdrasil"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
|
||||||
yggdrasilS "github.com/xmdhs/authlib-skin/service/yggdrasil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (y *Yggdrasil) Authenticate() http.HandlerFunc {
|
func (y *Yggdrasil) Authenticate() http.HandlerFunc {
|
||||||
|
@ -11,13 +11,14 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/model/yggdrasil"
|
||||||
|
"tinyskin/service/auth"
|
||||||
|
yggdrasilS "tinyskin/service/yggdrasil"
|
||||||
|
"tinyskin/utils"
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/auth"
|
|
||||||
yggdrasilS "github.com/xmdhs/authlib-skin/service/yggdrasil"
|
|
||||||
"github.com/xmdhs/authlib-skin/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type PubRsaKey string
|
type PubRsaKey string
|
||||||
|
7
main.go
7
main.go
@ -11,11 +11,12 @@ import (
|
|||||||
|
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/server"
|
||||||
|
"tinyskin/utils/sign"
|
||||||
|
|
||||||
"github.com/pelletier/go-toml/v2"
|
"github.com/pelletier/go-toml/v2"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/server"
|
|
||||||
"github.com/xmdhs/authlib-skin/utils/sign"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var configPath string
|
var configPath string
|
||||||
|
@ -10,16 +10,17 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/db/cache"
|
||||||
|
"tinyskin/db/ent"
|
||||||
|
"tinyskin/db/ent/migrate"
|
||||||
|
"tinyskin/handle/yggdrasil"
|
||||||
|
"tinyskin/utils/sign"
|
||||||
|
|
||||||
entsql "entgo.io/ent/dialect/sql"
|
entsql "entgo.io/ent/dialect/sql"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
"github.com/google/wire"
|
"github.com/google/wire"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/migrate"
|
|
||||||
"github.com/xmdhs/authlib-skin/handle/yggdrasil"
|
|
||||||
"github.com/xmdhs/authlib-skin/utils/sign"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ProvideSlog(c config.Config) slog.Handler {
|
func ProvideSlog(c config.Config) slog.Handler {
|
||||||
|
@ -5,20 +5,21 @@ import (
|
|||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/handle"
|
||||||
|
"tinyskin/handle/yggdrasil"
|
||||||
|
"tinyskin/server/static"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-chi/chi/v5/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
"github.com/go-chi/cors"
|
"github.com/go-chi/cors"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/handle"
|
|
||||||
"github.com/xmdhs/authlib-skin/handle/yggdrasil"
|
|
||||||
"github.com/xmdhs/authlib-skin/server/static"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewRoute(handelY *yggdrasil.Yggdrasil, handel *handle.Handel, c config.Config, sl slog.Handler,
|
func NewRoute(handelY *yggdrasil.Yggdrasil, handel *handle.Handel, c config.Config, sl slog.Handler,
|
||||||
userHandel *handle.UserHandel, adminHandel *handle.AdminHandel) http.Handler {
|
userHandel *handle.UserHandel, adminHandel *handle.AdminHandel) http.Handler {
|
||||||
r := chi.NewRouter()
|
r := chi.NewRouter()
|
||||||
r.Use(middleware.RequestID)
|
r.Use(middleware.RequestID)
|
||||||
if c.RaelIP {
|
if c.RealIP {
|
||||||
r.Use(middleware.RealIP)
|
r.Use(middleware.RealIP)
|
||||||
}
|
}
|
||||||
if sl.Enabled(context.Background(), slog.LevelDebug) {
|
if sl.Enabled(context.Background(), slog.LevelDebug) {
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
"tinyskin/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewServer(c config.Config, route http.Handler) (*http.Server, func()) {
|
func NewServer(c config.Config, route http.Handler) (*http.Server, func()) {
|
||||||
|
@ -6,17 +6,18 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/handle"
|
||||||
|
"tinyskin/handle/handelerror"
|
||||||
|
"tinyskin/handle/yggdrasil"
|
||||||
|
"tinyskin/server/route"
|
||||||
|
"tinyskin/service"
|
||||||
|
"tinyskin/service/auth"
|
||||||
|
"tinyskin/service/captcha"
|
||||||
|
"tinyskin/service/email"
|
||||||
|
yggdrasilS "tinyskin/service/yggdrasil"
|
||||||
|
|
||||||
"github.com/google/wire"
|
"github.com/google/wire"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/handle"
|
|
||||||
"github.com/xmdhs/authlib-skin/handle/handelerror"
|
|
||||||
"github.com/xmdhs/authlib-skin/handle/yggdrasil"
|
|
||||||
"github.com/xmdhs/authlib-skin/server/route"
|
|
||||||
"github.com/xmdhs/authlib-skin/service"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/auth"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/captcha"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/email"
|
|
||||||
yggdrasilS "github.com/xmdhs/authlib-skin/service/yggdrasil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var serviceSet = wire.NewSet(service.Service, yggdrasilS.NewYggdrasil, email.NewEmail, auth.NewAuthService,
|
var serviceSet = wire.NewSet(service.Service, yggdrasilS.NewYggdrasil, email.NewEmail, auth.NewAuthService,
|
||||||
|
@ -9,16 +9,16 @@ package server
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/google/wire"
|
"github.com/google/wire"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
"tinyskin/config"
|
||||||
"github.com/xmdhs/authlib-skin/handle"
|
"tinyskin/handle"
|
||||||
"github.com/xmdhs/authlib-skin/handle/handelerror"
|
"tinyskin/handle/handelerror"
|
||||||
yggdrasil2 "github.com/xmdhs/authlib-skin/handle/yggdrasil"
|
yggdrasil2 "tinyskin/handle/yggdrasil"
|
||||||
"github.com/xmdhs/authlib-skin/server/route"
|
"tinyskin/server/route"
|
||||||
"github.com/xmdhs/authlib-skin/service"
|
"tinyskin/service"
|
||||||
"github.com/xmdhs/authlib-skin/service/auth"
|
"tinyskin/service/auth"
|
||||||
"github.com/xmdhs/authlib-skin/service/captcha"
|
"tinyskin/service/captcha"
|
||||||
"github.com/xmdhs/authlib-skin/service/email"
|
"tinyskin/service/email"
|
||||||
"github.com/xmdhs/authlib-skin/service/yggdrasil"
|
"tinyskin/service/yggdrasil"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,18 +6,18 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
"tinyskin/config"
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
"tinyskin/db/cache"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
"tinyskin/db/ent"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
"tinyskin/db/ent/predicate"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
"tinyskin/db/ent/usertoken"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
"tinyskin/model"
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
"tinyskin/model/yggdrasil"
|
||||||
"github.com/xmdhs/authlib-skin/service/auth"
|
"tinyskin/service/auth"
|
||||||
utilsService "github.com/xmdhs/authlib-skin/service/utils"
|
utilsService "tinyskin/service/utils"
|
||||||
"github.com/xmdhs/authlib-skin/utils"
|
"tinyskin/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AdminService struct {
|
type AdminService struct {
|
||||||
|
@ -4,9 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"tinyskin/model"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAdminSerice_Auth(t *testing.T) {
|
func TestAdminSerice_Auth(t *testing.T) {
|
||||||
|
@ -8,14 +8,15 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"tinyskin/db/cache"
|
||||||
|
"tinyskin/db/ent"
|
||||||
|
"tinyskin/db/ent/user"
|
||||||
|
"tinyskin/db/ent/usertoken"
|
||||||
|
"tinyskin/model"
|
||||||
|
"tinyskin/model/yggdrasil"
|
||||||
|
"tinyskin/utils"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
|
||||||
"github.com/xmdhs/authlib-skin/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AuthService struct {
|
type AuthService struct {
|
||||||
|
@ -5,8 +5,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"tinyskin/model"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func IsAdmin(state int) bool {
|
func IsAdmin(state int) bool {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
"tinyskin/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CaptchaService struct {
|
type CaptchaService struct {
|
||||||
|
@ -11,11 +11,12 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/db/cache"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/wneessen/go-mail"
|
"github.com/wneessen/go-mail"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type EmailConfig struct {
|
type EmailConfig struct {
|
||||||
|
@ -9,15 +9,15 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
"tinyskin/config"
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
"tinyskin/db/cache"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
"tinyskin/db/ent"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"tinyskin/db/ent/texture"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
"tinyskin/model"
|
||||||
utilsService "github.com/xmdhs/authlib-skin/service/utils"
|
utilsService "tinyskin/service/utils"
|
||||||
"github.com/xmdhs/authlib-skin/utils"
|
"tinyskin/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TextureService struct {
|
type TextureService struct {
|
||||||
|
@ -8,17 +8,18 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/db/cache"
|
||||||
|
"tinyskin/db/ent"
|
||||||
|
"tinyskin/db/ent/user"
|
||||||
|
"tinyskin/db/ent/userprofile"
|
||||||
|
"tinyskin/model"
|
||||||
|
"tinyskin/service/auth"
|
||||||
|
"tinyskin/service/captcha"
|
||||||
|
"tinyskin/service/email"
|
||||||
|
"tinyskin/utils"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/auth"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/captcha"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/email"
|
|
||||||
"github.com/xmdhs/authlib-skin/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -8,16 +8,17 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/db/cache"
|
||||||
|
"tinyskin/db/ent"
|
||||||
|
"tinyskin/db/ent/migrate"
|
||||||
|
"tinyskin/model"
|
||||||
|
"tinyskin/service/auth"
|
||||||
|
"tinyskin/service/captcha"
|
||||||
|
"tinyskin/service/email"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/migrate"
|
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/auth"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/captcha"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/email"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -7,10 +7,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"tinyskin/db/ent"
|
||||||
|
"tinyskin/db/ent/texture"
|
||||||
|
"tinyskin/db/ent/usertexture"
|
||||||
|
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func DelTexture(ctx context.Context, userProfileID int, textureType string, client *ent.Client, texturePath string) error {
|
func DelTexture(ctx context.Context, userProfileID int, textureType string, client *ent.Client, texturePath string) error {
|
||||||
|
@ -4,10 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
"tinyskin/config"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
"tinyskin/db/ent"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
"tinyskin/model"
|
||||||
"github.com/xmdhs/authlib-skin/utils"
|
"tinyskin/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type WebService struct {
|
type WebService struct {
|
||||||
|
@ -5,11 +5,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
"tinyskin/db/cache"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
"tinyskin/model"
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
"tinyskin/model/yggdrasil"
|
||||||
"github.com/xmdhs/authlib-skin/service/auth"
|
"tinyskin/service/auth"
|
||||||
)
|
)
|
||||||
|
|
||||||
type sessionWithIP struct {
|
type sessionWithIP struct {
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
"tinyskin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"tinyskin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
"tinyskin/model"
|
||||||
utilsService "github.com/xmdhs/authlib-skin/service/utils"
|
utilsService "tinyskin/service/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -15,18 +15,19 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"tinyskin/db/cache"
|
||||||
|
"tinyskin/db/ent"
|
||||||
|
"tinyskin/db/ent/texture"
|
||||||
|
"tinyskin/db/ent/user"
|
||||||
|
"tinyskin/db/ent/userprofile"
|
||||||
|
"tinyskin/db/ent/usertoken"
|
||||||
|
"tinyskin/model"
|
||||||
|
"tinyskin/model/yggdrasil"
|
||||||
|
"tinyskin/utils"
|
||||||
|
"tinyskin/utils/sign"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/user"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
|
||||||
"github.com/xmdhs/authlib-skin/utils"
|
|
||||||
"github.com/xmdhs/authlib-skin/utils/sign"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -11,13 +11,14 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/db/cache"
|
||||||
|
"tinyskin/db/ent"
|
||||||
|
"tinyskin/model"
|
||||||
|
"tinyskin/model/yggdrasil"
|
||||||
|
"tinyskin/service/auth"
|
||||||
|
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/cache"
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
|
||||||
"github.com/xmdhs/authlib-skin/service/auth"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Yggdrasil struct {
|
type Yggdrasil struct {
|
||||||
|
@ -5,9 +5,10 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"tinyskin/model"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/xmdhs/authlib-skin/model"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAuthMiddleware(t *testing.T) {
|
func TestAuthMiddleware(t *testing.T) {
|
||||||
|
@ -5,10 +5,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"tinyskin/config"
|
||||||
|
"tinyskin/server"
|
||||||
|
|
||||||
"github.com/pelletier/go-toml/v2"
|
"github.com/pelletier/go-toml/v2"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/config"
|
|
||||||
"github.com/xmdhs/authlib-skin/server"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
"tinyskin/db/ent"
|
||||||
)
|
)
|
||||||
|
|
||||||
func WithTx(ctx context.Context, client *ent.Client, fn func(tx *ent.Tx) error) error {
|
func WithTx(ctx context.Context, client *ent.Client, fn func(tx *ent.Tx) error) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user