-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hhr87
committed
Jan 30, 2024
0 parents
commit c5f0f89
Showing
136 changed files
with
3,617 additions
and
0 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,32 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
paths: # 这里是用来指定哪个文件更改,才会触发的 | ||
- 'data/version.git' | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: # 这里是用来指定哪个文件更改,才会触发的 | ||
- 'data/version.git' | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Test | ||
run: go test -v ./... |
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,22 @@ | ||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
/tests/show_player_test.go |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 LunacyZeus | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,69 @@ | ||
**帕鲁酱(pal-chan)**\ | ||
游戏幻兽帕鲁(Palworld)服务端面板(windows/linux) 服务端存档备份/上传云存储/RCON服务器管理 | ||
|
||
本工具基于golang+vue3+vant+wails开发 支持多个平台(windows/linux) | ||
接入前端中... | ||
|
||
**目前功能**\ | ||
1、命令行设置服务器目录 并自动备份 打包并保存为时间格式的zip文件\ | ||
2、自动备份到七牛存储空间 防止炸服找不到存档 | ||
|
||
**使用方法**\ | ||
上传二进制文件(palworld\_chan\_amd64\_linux)到服务器并给到权限 | ||
|
||
```bash | ||
chmod 755 palworld_chan_amd64_linux | ||
``` | ||
|
||
**本地备份** | ||
|
||
```bash | ||
./palworld_chan_amd64_linux backup --source /home/docker-palworld-dedicated-server/game/Pal/Saved --dest /root/backup/ | ||
./palworld_chan_amd64_linux backup --source 需要备份的服务器目录 --dest 保存备份文件目录 | ||
#备份滚动功能 默认保存200个 | ||
./palworld_chan_amd64_linux backup --source 需要备份的服务器目录 --dest 保存备份文件目录 --backupCount 保留备份数 | ||
#建议配合定时任务一起使用 暂时仅支持linux | ||
``` | ||
|
||
**使用七牛备份** | ||
|
||
```bash | ||
./palworld_chan_amd64_linux 7backup --source /home/docker-palworld-dedicated-server/game/Pal/Saved --dest /root/backup/ --ak accessToken --sk secretKey --bucket bucket存储空间 | ||
./palworld_chan_amd64_linux 7backup --source 需要备份的服务器目录 --dest 保存备份文件目录 --ak accessToken --sk secretKey --bucket bucket存储空间 | ||
#建议配合定时任务一起使用 暂时仅支持linux | ||
``` | ||
|
||
**使用linux crontab自动备份**\ | ||
进入到服务器新建文件夹输入backup.sh的内容\ | ||
使用crontab -e\ | ||
进行计划任务编辑 输入 | ||
|
||
```bash | ||
0 * * * * /脚本路径/backup.sh | ||
``` | ||
|
||
\:wq!\ | ||
保存并退出 | ||
|
||
**Todo:** | ||
|
||
* 上传到七牛备份 √ | ||
* RCON操作服务器 | ||
* 服务器内存过大自动重启 并发送公告 | ||
* WEB GUI支持(选择性开启) | ||
* 存档管理 | ||
* 定时功能 | ||
* 接口账号密码认证 | ||
|
||
|
||
**软件截图** | ||
![image](https://github.com/LunacyZeus/palworld-chan/blob/main/screenshots/index.png) | ||
首页 | ||
![image](https://github.com/LunacyZeus/palworld-chan/blob/main/screenshots/tool.png) | ||
工具 | ||
![image](https://github.com/LunacyZeus/palworld-chan/blob/main/screenshots/setting.png?raw=true) | ||
设置 | ||
![image](https://github.com/LunacyZeus/palworld-chan/blob/main/screenshots/backup.png?raw=true) | ||
备份页 | ||
![image](https://github.com/LunacyZeus/palworld-chan/blob/main/screenshots/server_setting.png?raw=true) | ||
服务器设定 |
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,9 @@ | ||
#!/bin/bash | ||
|
||
# 设置备份源和目标路径 | ||
SOURCE_PATH="/home/docker-palworld-dedicated-server/game/Pal/Saved" | ||
DEST_PATH="/root/backup/" | ||
|
||
# 执行备份命令 | ||
/root/palworld_chan_amd64_linux backup --source "$SOURCE_PATH" --dest "$DEST_PATH" | ||
|
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,29 @@ | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleName</key> | ||
<string>palworld-chan</string> | ||
<key>CFBundleExecutable</key> | ||
<string>palworld-chan</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.wails.palworld-chan</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0.0</string> | ||
<key>CFBundleGetInfoString</key> | ||
<string>Built using Wails (https://wails.io)</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0.0</string> | ||
<key>CFBundleIconFile</key> | ||
<string>iconfile</string> | ||
<key>LSMinimumSystemVersion</key> | ||
<string>10.13.0</string> | ||
<key>NSHighResolutionCapable</key> | ||
<string>true</string> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>Copyright.........</string> | ||
|
||
|
||
</dict> | ||
</plist> |
Binary file not shown.
Binary file not shown.
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,63 @@ | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleName</key> | ||
<string>{{.Info.ProductName}}</string> | ||
<key>CFBundleExecutable</key> | ||
<string>{{.Name}}</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.wails.{{.Name}}</string> | ||
<key>CFBundleVersion</key> | ||
<string>{{.Info.ProductVersion}}</string> | ||
<key>CFBundleGetInfoString</key> | ||
<string>{{.Info.Comments}}</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>{{.Info.ProductVersion}}</string> | ||
<key>CFBundleIconFile</key> | ||
<string>iconfile</string> | ||
<key>LSMinimumSystemVersion</key> | ||
<string>10.13.0</string> | ||
<key>NSHighResolutionCapable</key> | ||
<string>true</string> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>{{.Info.Copyright}}</string> | ||
{{if .Info.FileAssociations}} | ||
<key>CFBundleDocumentTypes</key> | ||
<array> | ||
{{range .Info.FileAssociations}} | ||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>{{.Ext}}</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>{{.Name}}</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>{{.Role}}</string> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>{{.IconName}}</string> | ||
</dict> | ||
{{end}} | ||
</array> | ||
{{end}} | ||
{{if .Info.Protocols}} | ||
<key>CFBundleURLTypes</key> | ||
<array> | ||
{{range .Info.Protocols}} | ||
<dict> | ||
<key>CFBundleURLName</key> | ||
<string>com.wails.{{.Scheme}}</string> | ||
<key>CFBundleURLSchemes</key> | ||
<array> | ||
<string>{{.Scheme}}</string> | ||
</array> | ||
<key>CFBundleTypeRole</key> | ||
<string>{{.Role}}</string> | ||
</dict> | ||
{{end}} | ||
</array> | ||
{{end}} | ||
</dict> | ||
</plist> |
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,25 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"palworld-chan/internal/service/api" | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(apiCMD) | ||
} | ||
|
||
var apiCMD = &cobra.Command{ | ||
Use: "api", | ||
Short: "Launch Server API", | ||
Long: "Launch Server API", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
LaunchServerAPI() | ||
}, | ||
} | ||
|
||
func LaunchServerAPI() { | ||
port := ":3000" | ||
api.Init(port) | ||
return | ||
} |
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,52 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
"palworld-chan/internal/service/backup" | ||
) | ||
|
||
var backupCmd = &cobra.Command{ | ||
Use: "backup", | ||
Short: "local backup", | ||
Long: "local backup", | ||
RunE: func(command *cobra.Command, args []string) error { | ||
setups := []func() error{} | ||
for _, setup := range setups { | ||
if err := setup(); err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
//读取参数 | ||
source := viper.GetString("source") | ||
dest := viper.GetString("dest") | ||
backupCount := viper.GetInt("backupCount") | ||
|
||
backup.LocalBackUp(source, dest, backupCount) | ||
|
||
return nil | ||
}, | ||
PreRunE: func(cmd *cobra.Command, args []string) error { | ||
return nil | ||
}, | ||
|
||
PersistentPreRun: func(cmd *cobra.Command, args []string) { | ||
viper.BindPFlag("source", cmd.Flags().Lookup("source")) | ||
viper.BindPFlag("dest", cmd.Flags().Lookup("dest")) | ||
viper.BindPFlag("backupCount", cmd.Flags().Lookup("backupCount")) | ||
|
||
viper.AutomaticEnv() | ||
}, | ||
|
||
//serverCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file") | ||
|
||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(backupCmd) | ||
|
||
backupCmd.Flags().String("source", "", "save file path") | ||
backupCmd.Flags().String("dest", "", "backup file path") | ||
backupCmd.Flags().Int("backupCount", 200, "max backup file count default is 200") | ||
} |
Oops, something went wrong.