Compare commits
2 Commits
7c067839af
...
742262b064
| Author | SHA1 | Date | |
|---|---|---|---|
|
742262b064
|
|||
|
67cd6cb3cf
|
68
.gitea/workflows/build.yaml
Normal file
68
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: 1
|
||||||
|
steps:
|
||||||
|
- name: Checkout codebase
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Pre Setup NodeJS
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '18.x'
|
||||||
|
- name: For act to work
|
||||||
|
run: npm -g install yarn
|
||||||
|
- name: Setup NodeJS
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '18.x'
|
||||||
|
cache: 'yarn'
|
||||||
|
cache-dependency-path: frontend
|
||||||
|
- name: Build Frontend
|
||||||
|
run: |
|
||||||
|
make assets
|
||||||
|
rm -rf /host/${{ gitea.workspace }} && mkdir -p /host/${{ gitea.workspace }}
|
||||||
|
cp -a . /host/${{ gitea.workspace }}/
|
||||||
|
- name: Build Yggdrasil Server
|
||||||
|
uses: crazy-max/ghaction-xgo@v2
|
||||||
|
with:
|
||||||
|
xgo_version: latest
|
||||||
|
go_version: 1.24
|
||||||
|
dest: build
|
||||||
|
prefix: yggdrasil
|
||||||
|
targets: linux/amd64,linux/arm64
|
||||||
|
v: true
|
||||||
|
x: false
|
||||||
|
race: false
|
||||||
|
ldflags: -s -w -buildid=
|
||||||
|
tags: nomsgpack sqlite mysql
|
||||||
|
trimpath: true
|
||||||
|
- name: Store Back Binaries
|
||||||
|
run: |
|
||||||
|
cp -a /host/${{ gitea.workspace }}/build/. build
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Login to Docker Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: docker.sunxinao.cn
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
tags: docker.sunxinao.cn/gardel/yggdrasil-go:latest
|
||||||
@@ -80,6 +80,7 @@ func InitRouters(router *gin.Engine, db *gorm.DB, meta *ServerMeta, smtpCfg *ser
|
|||||||
minecraftservices := router.Group("/minecraftservices")
|
minecraftservices := router.Group("/minecraftservices")
|
||||||
{
|
{
|
||||||
minecraftservices.GET("/player/attributes", userRouter.PlayerAttributes)
|
minecraftservices.GET("/player/attributes", userRouter.PlayerAttributes)
|
||||||
|
minecraftservices.GET("/privacy/blocklist", userRouter.PlayerBlockList)
|
||||||
minecraftservices.POST("/player/certificates", userRouter.ProfileKey)
|
minecraftservices.POST("/player/certificates", userRouter.ProfileKey)
|
||||||
minecraftservices.GET("/publickeys", homeRouter.PublicKeys)
|
minecraftservices.GET("/publickeys", homeRouter.PublicKeys)
|
||||||
minecraftservices.GET("/minecraft/profile/lookup/:uuid", userRouter.UUIDToUUID)
|
minecraftservices.GET("/minecraft/profile/lookup/:uuid", userRouter.UUIDToUUID)
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ type UserRouter interface {
|
|||||||
QueryUUIDs(c *gin.Context)
|
QueryUUIDs(c *gin.Context)
|
||||||
QueryProfile(c *gin.Context)
|
QueryProfile(c *gin.Context)
|
||||||
PlayerAttributes(c *gin.Context)
|
PlayerAttributes(c *gin.Context)
|
||||||
|
PlayerBlockList(c *gin.Context)
|
||||||
ProfileKey(c *gin.Context)
|
ProfileKey(c *gin.Context)
|
||||||
SendEmail(c *gin.Context)
|
SendEmail(c *gin.Context)
|
||||||
VerifyEmail(c *gin.Context)
|
VerifyEmail(c *gin.Context)
|
||||||
@@ -315,6 +316,12 @@ func (u *userRouterImpl) PlayerAttributes(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *userRouterImpl) PlayerBlockList(c *gin.Context) {
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"blockedProfiles": []string{},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (u *userRouterImpl) ProfileKey(c *gin.Context) {
|
func (u *userRouterImpl) ProfileKey(c *gin.Context) {
|
||||||
bearerToken := c.GetHeader("Authorization")
|
bearerToken := c.GetHeader("Authorization")
|
||||||
if len(bearerToken) < 8 {
|
if len(bearerToken) < 8 {
|
||||||
|
|||||||
Reference in New Issue
Block a user