Compare commits
No commits in common. "master" and "test" have entirely different histories.
@ -3,19 +3,14 @@ name: CI
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- master
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
|
pull_request:
|
||||||
env:
|
branches:
|
||||||
# Use docker.io for Docker Hub if empty
|
- master
|
||||||
REGISTRY: git.thehrz.net
|
|
||||||
# github.repository as <account>/<repo>
|
|
||||||
IMAGE_NAME: H8-Network/TinySkin
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-image:
|
deploy:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@ -25,29 +20,6 @@ jobs:
|
|||||||
# - name: Install Docker
|
# - name: Install Docker
|
||||||
# run: curl -fsSL https://get.docker.com | sh
|
# run: curl -fsSL https://get.docker.com | sh
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Deploy with Docker
|
||||||
uses: docker/setup-buildx-action@v3
|
run: docker compose up --build --force-recreate -d
|
||||||
|
|
||||||
- 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
|
|
||||||
|
42
.github/workflows/ci.yaml
vendored
Normal file
42
.github/workflows/ci.yaml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: Go
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set up Go 1.x
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: ^1.21
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
bash build.sh
|
||||||
|
|
||||||
|
- name: start mysql / redis
|
||||||
|
run: |
|
||||||
|
sudo systemctl start mysql.service
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install redis
|
||||||
|
sudo mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS test;"
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: go test -tags="redis,sqlite" -race -v ./...
|
||||||
|
|
||||||
|
- name: Upload a Build Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
# A file, directory or wildcard pattern that describes what to upload
|
||||||
|
path: cmd/authlibskin/out/*
|
||||||
|
name: ${{ github.run_number }}
|
54
.github/workflows/release.yaml
vendored
Normal file
54
.github/workflows/release.yaml
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
name: Build And Publish Releases
|
||||||
|
|
||||||
|
# https://github.com/softprops/action-gh-release/issues/236#issuecomment-1150530128
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Allow mannual trigger
|
||||||
|
workflow_dispatch:
|
||||||
|
# Trigger on push new tag
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Build Frontend
|
||||||
|
run: |
|
||||||
|
bash build_frontend.sh
|
||||||
|
- name: Compile
|
||||||
|
uses: crazy-max/ghaction-xgo@v3
|
||||||
|
with:
|
||||||
|
xgo_version: latest
|
||||||
|
go_version: 1.21.x
|
||||||
|
dest: dist
|
||||||
|
prefix: authlibskin
|
||||||
|
targets: windows/386,windows/amd64,linux/386,linux/amd64,linux/arm,linux/arm64,darwin/arm64,darwin/amd64
|
||||||
|
# Show less information
|
||||||
|
v: false
|
||||||
|
x: false
|
||||||
|
race: false
|
||||||
|
ldflags: -s -w
|
||||||
|
tags: redis,sqlite
|
||||||
|
pkg: cmd/authlibskin
|
||||||
|
buildmode: default
|
||||||
|
trimpath: true
|
||||||
|
- name: upx
|
||||||
|
run: |
|
||||||
|
upx ./dist/*
|
||||||
|
- name: Print sha256
|
||||||
|
run : |
|
||||||
|
sha256sum ./dist/*
|
||||||
|
sha256sum ./dist/* > ./dist/sha256
|
||||||
|
- name: Publish GitHub Releases
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
name: "authlibskin ${{ github.ref_name }}"
|
||||||
|
files: |
|
||||||
|
./dist/*
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -3,7 +3,6 @@ cmd/authlibskin/config.yaml
|
|||||||
cmd/authlibskin/skin
|
cmd/authlibskin/skin
|
||||||
cmd/authlibskin/authlibskin.exe
|
cmd/authlibskin/authlibskin.exe
|
||||||
server/static/files
|
server/static/files
|
||||||
config.toml
|
cmd/authlibskin/config.toml
|
||||||
out/
|
out/
|
||||||
stats.html
|
stats.html
|
||||||
.idea
|
|
16
Dockerfile
16
Dockerfile
@ -3,15 +3,17 @@ FROM node:20-alpine AS frontend-stage
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
|
||||||
COPY frontend/package.json frontend/pnpm-lock.yaml ./
|
# COPY frontend/package.json frontend/pnpm-lock.yaml ./
|
||||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
|
# RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
|
||||||
pnpm install --frozen-lockfile
|
# pnpm install --frozen-lockfile
|
||||||
|
|
||||||
COPY frontend .
|
COPY frontend .
|
||||||
|
|
||||||
|
|
||||||
|
RUN pnpm install
|
||||||
|
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
FROM golang:1.23-alpine AS build-stage
|
FROM golang:1.23 AS build-stage
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV GOPROXY https://goproxy.cn,direct
|
ENV GOPROXY https://goproxy.cn,direct
|
||||||
@ -21,6 +23,4 @@ COPY . .
|
|||||||
|
|
||||||
RUN go build -o app .
|
RUN go build -o app .
|
||||||
|
|
||||||
VOLUME /app/config
|
CMD ["/app/app"]
|
||||||
|
|
||||||
ENTRYPOINT ["/app/app", "-c", "./config/config.toml"]
|
|
19
README.md
19
README.md
@ -1,7 +1,4 @@
|
|||||||
# TinySkin
|
# authlib-skin
|
||||||
|
|
||||||
Fork from [authlib-skin](https://tinyskin).
|
|
||||||
|
|
||||||
轻量级的 Yggdrasil 服务端实现,后端 Go,前端 react。
|
轻量级的 Yggdrasil 服务端实现,后端 Go,前端 react。
|
||||||
|
|
||||||
适合于只需要用于 [authlib-injector](https://github.com/yushijinhun/authlib-injector) 的验证服务器的情况,部署简单。
|
适合于只需要用于 [authlib-injector](https://github.com/yushijinhun/authlib-injector) 的验证服务器的情况,部署简单。
|
||||||
@ -9,8 +6,20 @@ Fork from [authlib-skin](https://tinyskin).
|
|||||||
实现了 [Yggdrasil](https://github.com/yushijinhun/authlib-injector/wiki/Yggdrasil-%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%8A%80%E6%9C%AF%E8%A7%84%E8%8C%83) 规范,可用于一些启动器中的外置登录,和服务器的外置登录。
|
实现了 [Yggdrasil](https://github.com/yushijinhun/authlib-injector/wiki/Yggdrasil-%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%8A%80%E6%9C%AF%E8%A7%84%E8%8C%83) 规范,可用于一些启动器中的外置登录,和服务器的外置登录。
|
||||||
|
|
||||||
## 特性
|
## 特性
|
||||||
|
|
||||||
- 支持用于聊天签名的 /player/certificates 接口
|
- 支持用于聊天签名的 /player/certificates 接口
|
||||||
- 支持于离线模式相同的方式生成用户 uuid(开启后不可更改用户名)
|
- 支持于离线模式相同的方式生成用户 uuid(开启后不可更改用户名)
|
||||||
- 基本的用户管理
|
- 基本的用户管理
|
||||||
- Cloudflare Turnstile 支持
|
- Cloudflare Turnstile 支持
|
||||||
|
|
||||||
|
## 运行
|
||||||
|
`./authlibskin` 运行,`-c` 指定配置文件位置,若找不到配置文件,则会生成示例配置文件,其中带有注释。
|
||||||
|
|
||||||
|
## 编译
|
||||||
|
`redis` 和 `sqlite` tag 控制是否开启 redis 和 sqlite 支持,使用 `sqlite` tag 需要 c 语言工具链。
|
||||||
|
|
||||||
|
请使用 build.sh 编译,会依次对前端和后端源码进行编译打包。
|
||||||
|
## 下载
|
||||||
|
https://github.com/xmdhs/authlib-skin/releases
|
||||||
|
|
||||||
|
## demo
|
||||||
|
https://skin.xmdhs.com
|
||||||
|
5
build.sh
Normal file
5
build.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
bash ./build_frontend.sh
|
||||||
|
|
||||||
|
cd cmd/authlibskin
|
||||||
|
go build -trimpath -ldflags "-w -s" -tags="redis,sqlite" -o out/authlibskin
|
6
build_frontend.sh
Normal file
6
build_frontend.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd frontend
|
||||||
|
npm install -g pnpm
|
||||||
|
pnpm install
|
||||||
|
pnpm build
|
||||||
|
cp -r dist ../server/static/files
|
@ -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"`
|
||||||
RealIP bool `toml:"realIP" comment:"位于反向代理后启用,用于记录真实 ip\n若直接提供服务,请勿打开,否则会被伪造 ip"`
|
RaelIP bool `toml:"raelIP" 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: "",
|
||||||
},
|
},
|
||||||
RealIP: false,
|
RaelIP: false,
|
||||||
MaxIpUser: 0,
|
MaxIpUser: 0,
|
||||||
RsaPriKey: "",
|
RsaPriKey: "",
|
||||||
TexturePath: "",
|
TexturePath: "",
|
||||||
|
@ -8,17 +8,17 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"tinyskin/db/ent/migrate"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
|
|
||||||
"tinyskin/db/ent"
|
"github.com/xmdhs/authlib-skin/db/ent"
|
||||||
// required by schema hooks.
|
// required by schema hooks.
|
||||||
_ "tinyskin/db/ent/runtime"
|
_ "github.com/xmdhs/authlib-skin/db/ent/runtime"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/schema"
|
"entgo.io/ent/dialect/sql/schema"
|
||||||
"tinyskin/db/ent/migrate"
|
"github.com/xmdhs/authlib-skin/db/ent/migrate"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"tinyskin/db/ent"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/db/ent/usertexture"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
// The schema-stitching logic is generated in tinyskin/db/ent/runtime.go
|
// The schema-stitching logic is generated in github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertexture"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/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"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserTokenUpdate is the builder for updating UserToken entities.
|
// UserTokenUpdate is the builder for updating UserToken entities.
|
||||||
|
21
docker-compose.yml
Normal file
21
docker-compose.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
name: traefik
|
||||||
|
external: true
|
||||||
|
authlib-skin:
|
||||||
|
name: authlib-skin
|
||||||
|
|
||||||
|
services:
|
||||||
|
authlib-skin:
|
||||||
|
build: .
|
||||||
|
container_name: authlib-skin
|
||||||
|
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
|
||||||
|
networks:
|
||||||
|
- authlib-skin
|
@ -1 +0,0 @@
|
|||||||
VITE_APIADDR = ''
|
|
@ -1 +0,0 @@
|
|||||||
VITE_APIADDR = 'http://127.0.0.1:8080'
|
|
@ -1,18 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
env: { browser: true, es2020: true },
|
|
||||||
extends: [
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
'plugin:react-hooks/recommended',
|
|
||||||
],
|
|
||||||
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
plugins: ['react-refresh'],
|
|
||||||
rules: {
|
|
||||||
'react-refresh/only-export-components': [
|
|
||||||
'warn',
|
|
||||||
{ allowConstantExport: true },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
@ -14,14 +14,37 @@ If you are developing a production application, we recommend updating the config
|
|||||||
- Configure the top-level `parserOptions` property like this:
|
- Configure the top-level `parserOptions` property like this:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
parserOptions: {
|
export default tseslint.config({
|
||||||
ecmaVersion: 'latest',
|
languageOptions: {
|
||||||
sourceType: 'module',
|
// other options...
|
||||||
project: ['./tsconfig.json', './tsconfig.node.json'],
|
parserOptions: {
|
||||||
tsconfigRootDir: __dirname,
|
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||||
},
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
|
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
|
||||||
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
|
- Optionally add `...tseslint.configs.stylisticTypeChecked`
|
||||||
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
|
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// eslint.config.js
|
||||||
|
import react from 'eslint-plugin-react'
|
||||||
|
|
||||||
|
export default tseslint.config({
|
||||||
|
// Set the react version
|
||||||
|
settings: { react: { version: '18.3' } },
|
||||||
|
plugins: {
|
||||||
|
// Add the react plugin
|
||||||
|
react,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
// other rules...
|
||||||
|
// Enable its recommended rules
|
||||||
|
...react.configs.recommended.rules,
|
||||||
|
...react.configs['jsx-runtime'].rules,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
28
frontend/eslint.config.js
Normal file
28
frontend/eslint.config.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import js from '@eslint/js'
|
||||||
|
import globals from 'globals'
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||||
|
import tseslint from 'typescript-eslint'
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
{ ignores: ['dist'] },
|
||||||
|
{
|
||||||
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
||||||
|
files: ['**/*.{ts,tsx}'],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
globals: globals.browser,
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
'react-hooks': reactHooks,
|
||||||
|
'react-refresh': reactRefresh,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...reactHooks.configs.recommended.rules,
|
||||||
|
'react-refresh/only-export-components': [
|
||||||
|
'warn',
|
||||||
|
{ allowConstantExport: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
@ -1,10 +1,10 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="zh-CN">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>皮肤站</title>
|
<title>Vite + React + TS</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@xmdhs/authlib-skin",
|
"name": "authlib-skin",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@ -12,13 +12,13 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
"@marsidev/react-turnstile": "^1.0.2",
|
"@marsidev/react-turnstile": "^0.3.2",
|
||||||
"@mui/icons-material": "^6.1.7",
|
"@mui/icons-material": "^5.16.7",
|
||||||
"@mui/material": "^6.1.7",
|
"@mui/material": "^5.16.7",
|
||||||
"ahooks": "^3.8.1",
|
"ahooks": "^3.8.1",
|
||||||
"immer": "^10.1.1",
|
"immer": "^10.1.1",
|
||||||
"jotai": "^2.10.2",
|
"jotai": "^2.10.1",
|
||||||
"mui-file-input": "^6.0.0",
|
"mui-file-input": "^3.0.2",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-router-dom": "^6.28.0",
|
"react-router-dom": "^6.28.0",
|
||||||
@ -29,10 +29,14 @@
|
|||||||
"@types/node": "^20.17.6",
|
"@types/node": "^20.17.6",
|
||||||
"@types/react": "^18.3.12",
|
"@types/react": "^18.3.12",
|
||||||
"@types/react-dom": "^18.3.1",
|
"@types/react-dom": "^18.3.1",
|
||||||
"@vitejs/plugin-legacy": "^5.4.3",
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||||
"@vitejs/plugin-react": "^4.3.3",
|
"@typescript-eslint/parser": "^6.21.0",
|
||||||
"@vitejs/plugin-react-swc": "^3.7.1",
|
"@vitejs/plugin-react-swc": "^3.7.1",
|
||||||
"terser": "^5.36.0",
|
"eslint": "^8.57.1",
|
||||||
|
"eslint-config-prettier": "^9.1.0",
|
||||||
|
"eslint-plugin-react-hooks": "^4.6.2",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.14",
|
||||||
|
"rollup-plugin-visualizer": "^5.12.0",
|
||||||
"typescript": "^5.6.3",
|
"typescript": "^5.6.3",
|
||||||
"vite": "^5.4.11"
|
"vite": "^5.4.11"
|
||||||
}
|
}
|
||||||
|
2761
frontend/pnpm-lock.yaml
generated
2761
frontend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,24 +0,0 @@
|
|||||||
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: /^[0-9a-zA-Z_]{3,16}$/
|
reg: /^.{3,16}$/
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
required
|
required
|
||||||
|
@ -76,8 +76,8 @@ export default function UserAdmin() {
|
|||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell>邮箱</TableCell>
|
<TableCell>邮箱</TableCell>
|
||||||
<TableCell>用户名</TableCell>
|
<TableCell>用户名</TableCell>
|
||||||
<TableCell>注册 IP</TableCell>
|
<TableCell>注册 ip</TableCell>
|
||||||
<TableCell>UUID</TableCell>
|
<TableCell>uuid</TableCell>
|
||||||
<TableCell></TableCell>
|
<TableCell></TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
|
@ -11,7 +11,6 @@ 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();
|
||||||
@ -29,11 +28,11 @@ const Profile = function Profile() {
|
|||||||
}, gridTemplateColumns: { lg: "1fr 1fr auto" }
|
}, gridTemplateColumns: { lg: "1fr 1fr auto" }
|
||||||
}}>
|
}}>
|
||||||
<Card sx={{ gridArea: "a" }}>
|
<Card sx={{ gridArea: "a" }}>
|
||||||
<CardHeader title="游戏信息" />
|
<CardHeader title="信息" />
|
||||||
<CardContent sx={{ display: "grid", gridTemplateColumns: "4em auto" }}>
|
<CardContent sx={{ display: "grid", gridTemplateColumns: "4em auto" }}>
|
||||||
<Typography>用户名</Typography>
|
<Typography>name</Typography>
|
||||||
<Typography>{userinfo.name}</Typography>
|
<Typography>{userinfo.name}</Typography>
|
||||||
<Typography>UUID</Typography>
|
<Typography>uuid</Typography>
|
||||||
<Typography sx={{ wordBreak: 'break-all' }}>{userinfo.uuid}</Typography>
|
<Typography sx={{ wordBreak: 'break-all' }}>{userinfo.uuid}</Typography>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
{/* <CardActions>
|
{/* <CardActions>
|
||||||
@ -52,10 +51,8 @@ const Profile = function Profile() {
|
|||||||
<Card sx={{ gridArea: "c" }}>
|
<Card sx={{ gridArea: "c" }}>
|
||||||
<CardHeader title="启动器设置" />
|
<CardHeader title="启动器设置" />
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Typography>本站 Yggdrasil 认证服务器地址</Typography>
|
<Typography>本站 Yggdrasil API 地址</Typography>
|
||||||
<code style={{ wordBreak: "break-all" }}>{getYggRoot()}</code>
|
<code style={{ wordBreak: "break-all" }}>{getYggRoot()}</code>
|
||||||
<Typography>点击下方按钮复制 API 地址,或者将按钮拖动至启动器的任意界面即可快速添加认证服务器。</Typography>
|
|
||||||
<YggdrasilSetter />
|
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
<Box sx={{ gridArea: "d" }}></Box>
|
<Box sx={{ gridArea: "d" }}></Box>
|
||||||
|
26
frontend/tsconfig.app.json
Normal file
26
frontend/tsconfig.app.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
"target": "ES2020",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
@ -1,39 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"files": [],
|
||||||
"target": "ES2020",
|
|
||||||
"useDefineForClassFields": true,
|
|
||||||
"lib": [
|
|
||||||
"ES2020",
|
|
||||||
"DOM",
|
|
||||||
"DOM.Iterable"
|
|
||||||
],
|
|
||||||
"module": "ESNext",
|
|
||||||
"skipLibCheck": true,
|
|
||||||
/* Bundler mode */
|
|
||||||
"moduleResolution": "bundler",
|
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"noEmit": true,
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
/* Linting */
|
|
||||||
"strict": true,
|
|
||||||
"noUnusedLocals": true,
|
|
||||||
"noUnusedParameters": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"baseUrl": ".",
|
|
||||||
"paths": {
|
|
||||||
"@/*": [
|
|
||||||
"src/*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{ "path": "./tsconfig.app.json" },
|
||||||
"path": "./tsconfig.node.json"
|
{ "path": "./tsconfig.node.json" }
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,24 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
"skipLibCheck": true,
|
"target": "ES2022",
|
||||||
|
"lib": ["ES2023"],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "bundler",
|
"skipLibCheck": true,
|
||||||
"allowSyntheticDefaultImports": true
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
},
|
},
|
||||||
"include": ["vite.config.ts"]
|
"include": ["vite.config.ts"]
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,28 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig, type PluginOption } from 'vite'
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react-swc'
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import legacy from '@vitejs/plugin-legacy'
|
import { visualizer } from "rollup-plugin-visualizer";
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
|
visualizer() as PluginOption,
|
||||||
|
|
||||||
react(),
|
react(),
|
||||||
legacy()
|
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': join(__dirname, "src")
|
'@': join(__dirname, "src")
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
manualChunks: {
|
||||||
|
['skinview3d']: ['skinview3d'],
|
||||||
|
['@mui/material']: ['@mui/material']
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
|||||||
module tinyskin
|
module github.com/xmdhs/authlib-skin
|
||||||
|
|
||||||
go 1.23
|
go 1.23
|
||||||
|
|
||||||
|
@ -7,14 +7,13 @@ 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 "tinyskin/utils"
|
U "github.com/xmdhs/authlib-skin/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AdminHandel struct {
|
type AdminHandel struct {
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"tinyskin/model"
|
"github.com/xmdhs/authlib-skin/model"
|
||||||
"tinyskin/service"
|
"github.com/xmdhs/authlib-skin/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Handel struct {
|
type Handel struct {
|
||||||
|
@ -7,11 +7,11 @@ import (
|
|||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"tinyskin/model"
|
"github.com/xmdhs/authlib-skin/model"
|
||||||
"tinyskin/service"
|
"github.com/xmdhs/authlib-skin/service"
|
||||||
"tinyskin/service/auth"
|
"github.com/xmdhs/authlib-skin/service/auth"
|
||||||
"tinyskin/service/captcha"
|
"github.com/xmdhs/authlib-skin/service/captcha"
|
||||||
"tinyskin/service/email"
|
"github.com/xmdhs/authlib-skin/service/email"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HandleError struct {
|
type HandleError struct {
|
||||||
|
@ -6,10 +6,9 @@ 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,14 +13,13 @@ 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"
|
||||||
|
|
||||||
"tinyskin/model/yggdrasil"
|
"github.com/xmdhs/authlib-skin/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,11 +4,10 @@ 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,12 +7,11 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"tinyskin/model"
|
|
||||||
"tinyskin/model/yggdrasil"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
|
"github.com/xmdhs/authlib-skin/model"
|
||||||
|
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
||||||
|
|
||||||
yggdrasilS "tinyskin/service/yggdrasil"
|
yggdrasilS "github.com/xmdhs/authlib-skin/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,12 +5,11 @@ 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,14 +11,13 @@ 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
|
||||||
|
30
main.go
30
main.go
@ -11,12 +11,11 @@ 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
|
||||||
@ -28,20 +27,19 @@ func init() {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
if _, err := os.Stat(configPath); errors.Is(err, os.ErrNotExist) {
|
|
||||||
rsa2048 := lo.Must(rsa.GenerateKey(rand.Reader, 4096))
|
|
||||||
as := sign.NewAuthlibSignWithKey(rsa2048)
|
|
||||||
|
|
||||||
c := config.Default()
|
|
||||||
c.RsaPriKey = lo.Must(as.GetPriKey())
|
|
||||||
|
|
||||||
lo.Must0(os.WriteFile(configPath, lo.Must(toml.Marshal(c)), 0600))
|
|
||||||
fmt.Println("未找到配置文件,已写入模板配置文件")
|
|
||||||
}
|
|
||||||
|
|
||||||
b, err := os.ReadFile(configPath)
|
b, err := os.ReadFile(configPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if errors.Is(err, os.ErrNotExist) {
|
||||||
|
rsa2048 := lo.Must(rsa.GenerateKey(rand.Reader, 4096))
|
||||||
|
as := sign.NewAuthlibSignWithKey(rsa2048)
|
||||||
|
|
||||||
|
c := config.Default()
|
||||||
|
c.RsaPriKey = lo.Must(as.GetPriKey())
|
||||||
|
|
||||||
|
lo.Must0(os.WriteFile(configPath, lo.Must(toml.Marshal(c)), 0600))
|
||||||
|
fmt.Println("未找到配置文件,已写入模板配置文件")
|
||||||
|
return
|
||||||
|
}
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
var config config.Config
|
var config config.Config
|
||||||
|
@ -10,17 +10,16 @@ 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,21 +5,20 @@ 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.RealIP {
|
if c.RaelIP {
|
||||||
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"
|
||||||
|
|
||||||
"tinyskin/config"
|
"github.com/xmdhs/authlib-skin/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewServer(c config.Config, route http.Handler) (*http.Server, func()) {
|
func NewServer(c config.Config, route http.Handler) (*http.Server, func()) {
|
||||||
|
@ -6,18 +6,17 @@ 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"
|
||||||
"tinyskin/config"
|
"github.com/xmdhs/authlib-skin/config"
|
||||||
"tinyskin/handle"
|
"github.com/xmdhs/authlib-skin/handle"
|
||||||
"tinyskin/handle/handelerror"
|
"github.com/xmdhs/authlib-skin/handle/handelerror"
|
||||||
yggdrasil2 "tinyskin/handle/yggdrasil"
|
yggdrasil2 "github.com/xmdhs/authlib-skin/handle/yggdrasil"
|
||||||
"tinyskin/server/route"
|
"github.com/xmdhs/authlib-skin/server/route"
|
||||||
"tinyskin/service"
|
"github.com/xmdhs/authlib-skin/service"
|
||||||
"tinyskin/service/auth"
|
"github.com/xmdhs/authlib-skin/service/auth"
|
||||||
"tinyskin/service/captcha"
|
"github.com/xmdhs/authlib-skin/service/captcha"
|
||||||
"tinyskin/service/email"
|
"github.com/xmdhs/authlib-skin/service/email"
|
||||||
"tinyskin/service/yggdrasil"
|
"github.com/xmdhs/authlib-skin/service/yggdrasil"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,18 +6,18 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"tinyskin/config"
|
"github.com/xmdhs/authlib-skin/config"
|
||||||
"tinyskin/db/cache"
|
"github.com/xmdhs/authlib-skin/db/cache"
|
||||||
"tinyskin/db/ent"
|
"github.com/xmdhs/authlib-skin/db/ent"
|
||||||
"tinyskin/db/ent/predicate"
|
"github.com/xmdhs/authlib-skin/db/ent/predicate"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/db/ent/usertoken"
|
"github.com/xmdhs/authlib-skin/db/ent/usertoken"
|
||||||
"tinyskin/model"
|
"github.com/xmdhs/authlib-skin/model"
|
||||||
"tinyskin/model/yggdrasil"
|
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
||||||
"tinyskin/service/auth"
|
"github.com/xmdhs/authlib-skin/service/auth"
|
||||||
utilsService "tinyskin/service/utils"
|
utilsService "github.com/xmdhs/authlib-skin/service/utils"
|
||||||
"tinyskin/utils"
|
"github.com/xmdhs/authlib-skin/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AdminService struct {
|
type AdminService struct {
|
||||||
|
@ -4,10 +4,9 @@ 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,15 +8,14 @@ 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,9 +5,8 @@ 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"
|
||||||
|
|
||||||
"tinyskin/config"
|
"github.com/xmdhs/authlib-skin/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CaptchaService struct {
|
type CaptchaService struct {
|
||||||
|
@ -11,12 +11,11 @@ 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"
|
||||||
|
|
||||||
"tinyskin/config"
|
"github.com/xmdhs/authlib-skin/config"
|
||||||
"tinyskin/db/cache"
|
"github.com/xmdhs/authlib-skin/db/cache"
|
||||||
"tinyskin/db/ent"
|
"github.com/xmdhs/authlib-skin/db/ent"
|
||||||
"tinyskin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/model"
|
"github.com/xmdhs/authlib-skin/model"
|
||||||
utilsService "tinyskin/service/utils"
|
utilsService "github.com/xmdhs/authlib-skin/service/utils"
|
||||||
"tinyskin/utils"
|
"github.com/xmdhs/authlib-skin/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TextureService struct {
|
type TextureService struct {
|
||||||
|
@ -8,18 +8,17 @@ 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,17 +8,16 @@ 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,11 +7,10 @@ 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"
|
||||||
|
|
||||||
"tinyskin/config"
|
"github.com/xmdhs/authlib-skin/config"
|
||||||
"tinyskin/db/ent"
|
"github.com/xmdhs/authlib-skin/db/ent"
|
||||||
"tinyskin/model"
|
"github.com/xmdhs/authlib-skin/model"
|
||||||
"tinyskin/utils"
|
"github.com/xmdhs/authlib-skin/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type WebService struct {
|
type WebService struct {
|
||||||
|
@ -5,11 +5,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"tinyskin/db/cache"
|
"github.com/xmdhs/authlib-skin/db/cache"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/model"
|
"github.com/xmdhs/authlib-skin/model"
|
||||||
"tinyskin/model/yggdrasil"
|
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
||||||
"tinyskin/service/auth"
|
"github.com/xmdhs/authlib-skin/service/auth"
|
||||||
)
|
)
|
||||||
|
|
||||||
type sessionWithIP struct {
|
type sessionWithIP struct {
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"tinyskin/db/ent/user"
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"tinyskin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"tinyskin/model"
|
"github.com/xmdhs/authlib-skin/model"
|
||||||
utilsService "tinyskin/service/utils"
|
utilsService "github.com/xmdhs/authlib-skin/service/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -15,19 +15,18 @@ 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,14 +11,13 @@ 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,10 +5,9 @@ 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,11 +5,10 @@ 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"
|
||||||
|
|
||||||
"tinyskin/db/ent"
|
"github.com/xmdhs/authlib-skin/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