This commit is contained in:
parent
145bb045e9
commit
0b880bece8
5
.gitignore
vendored
5
.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
|
@ -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。
|
||||||
|
|
||||||
|
@ -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.
|
||||||
|
@ -7,17 +7,17 @@ networks:
|
|||||||
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
authlib-skin:
|
tinyskin:
|
||||||
build: .
|
build: .
|
||||||
container_name: authlib-skin
|
container_name: tinyskin
|
||||||
volumes:
|
volumes:
|
||||||
- /srv/server/authlib-skin:/app/config
|
- /srv/server/tinyskin:/app/config
|
||||||
restart: always
|
restart: always
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.authlib-skin.rule=Host(`auth.hfbz.net`)
|
- traefik.http.routers.tinyskin.rule=Host(`auth.hfbz.net`)
|
||||||
- traefik.http.routers.authlib-skin.entrypoints=web,websecure
|
- traefik.http.routers.tinyskin.entrypoints=web,websecure
|
||||||
- traefik.http.routers.authlib-skin.middlewares=CORS@file
|
- traefik.http.routers.tinyskin.middlewares=CORS@file
|
||||||
- traefik.http.services.authlib-skin.loadbalancer.server.port=8080
|
- traefik.http.services.tinyskin.loadbalancer.server.port=8080
|
||||||
networks:
|
networks:
|
||||||
- traefik
|
- traefik
|
||||||
|
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,13 +5,14 @@ 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,
|
||||||
|
@ -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