-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add frontend visualization panel
- Loading branch information
Showing
13 changed files
with
241 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: build | ||
|
||
on: | ||
release: | ||
types: [created, published] # 表示在创建新的 Release 时触发 | ||
|
||
jobs: | ||
build-go-binary: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
goos: [linux, windows, darwin] # 需要打包的系统 | ||
goarch: [amd64, arm64] # 需要打包的架构 | ||
exclude: # 排除某些平台和架构 | ||
- goarch: arm64 | ||
goos: windows | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: wangyoucao577/go-release-action@v1.30 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} # 一个默认的变量,用来实现往 Release 中添加文件 | ||
goos: ${{ matrix.goos }} | ||
goarch: ${{ matrix.goarch }} | ||
goversion: 1.21 # 可以指定编译使用的 Golang 版本 | ||
binary_name: "palworld-admin" # 可以指定二进制文件的名称 | ||
extra_files: LICENSE README.md # 需要包含的额外文件 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName="Default Palworld Server",ServerDescription="",AdminPassword="Admin",ServerPassword="",PublicPort=8211,PublicIP="",RCONEnabled=True,RCONPort=25575,Region="",bUseAuth=True,BanListURL="https://api.palworldgame.com/api/banlist.txt") | ||
OptionSettings = (Difficulty=1,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaseRate=1.000000,PlayerStaminaDecreaseRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaseRate=1.000000,PalStaminaDecreaseRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=100,DropItemMaxNum_UNKO=100,BaseCampMaxNum=100,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=1.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName="Palworld-Admin",ServerDescription="PalWorld-Admin 是一个用于管理 PalWorld 游戏配置文件和进行存档备份的可视化工具。",AdminPassword="Palworld-Admin",ServerPassword="",PublicPort=0,PublicIP="",RCONEnabled=True,RCONPort=0,Region="",bUseAuth=True,BanListURL="https://api.palworldgame.com/api/banlist.txt") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package middleware | ||
|
||
import ( | ||
"embed" | ||
"io/fs" | ||
"net/http" | ||
"os" | ||
"path" | ||
"strings" | ||
|
||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
const INDEX = "index.html" | ||
|
||
type ServeFileSystem interface { | ||
http.FileSystem | ||
Exists(prefix string, path string) bool | ||
} | ||
|
||
type localFileSystem struct { | ||
http.FileSystem | ||
root string | ||
indexes bool | ||
} | ||
|
||
func LocalFile(root string, indexes bool) *localFileSystem { | ||
return &localFileSystem{ | ||
FileSystem: gin.Dir(root, indexes), | ||
root: root, | ||
indexes: indexes, | ||
} | ||
} | ||
|
||
func (l *localFileSystem) Exists(prefix string, filepath string) bool { | ||
if p := strings.TrimPrefix(filepath, prefix); len(p) < len(filepath) { | ||
name := path.Join(l.root, p) | ||
stats, err := os.Stat(name) | ||
if err != nil { | ||
return false | ||
} | ||
if stats.IsDir() { | ||
if !l.indexes { | ||
index := path.Join(name, INDEX) | ||
_, err := os.Stat(index) | ||
if err != nil { | ||
return false | ||
} | ||
} | ||
} | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
func ServeRoot(urlPrefix, root string) gin.HandlerFunc { | ||
return Serve(urlPrefix, LocalFile(root, false)) | ||
} | ||
|
||
// Static returns a middleware handler that serves static files in the given directory. | ||
func Serve(urlPrefix string, fs ServeFileSystem) gin.HandlerFunc { | ||
fileserver := http.FileServer(fs) | ||
if urlPrefix != "" { | ||
fileserver = http.StripPrefix(urlPrefix, fileserver) | ||
} | ||
return func(c *gin.Context) { | ||
if fs.Exists(urlPrefix, c.Request.URL.Path) { | ||
fileserver.ServeHTTP(c.Writer, c.Request) | ||
c.Abort() | ||
} | ||
} | ||
} | ||
|
||
type embedFileSystem struct { | ||
http.FileSystem | ||
} | ||
|
||
func (e embedFileSystem) Exists(prefix string, path string) bool { | ||
_, err := e.Open(path) | ||
if err != nil { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
func EmbedFolder(fsEmbed embed.FS, targetPath string) ServeFileSystem { | ||
fsys, err := fs.Sub(fsEmbed, targetPath) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return embedFileSystem{ | ||
FileSystem: http.FS(fsys), | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@media (min-width: 1024px){.about{min-height:100vh;display:flex;align-items:center}} |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.