Skip to content

Commit

Permalink
Merge pull request #16 from diogomartino/2-feature-request-use-for-ot…
Browse files Browse the repository at this point in the history
…her-server

FEATURE: remote server support
  • Loading branch information
diogomartino authored Feb 15, 2024
2 parents a628138 + 466912e commit 4d17245
Show file tree
Hide file tree
Showing 148 changed files with 3,917 additions and 1,458 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/wails-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
id: extract_version
shell: bash
run: |
version=$(jq -r '.info.productVersion' ./wails.json)
version=$(jq -r '.info.productVersion' ./app/wails.json)
echo "Version extracted from wails.json: $version"
echo "CURRENT_VERSION=$version" >> "$GITHUB_OUTPUT"
Expand All @@ -53,12 +53,16 @@ jobs:
echo "Bumped version to: $new_version"
echo "BUILD_VERSION=$new_version" >> "$GITHUB_OUTPUT"
jq --arg new_version "$new_version" '.info.productVersion = $new_version' ./wails.json > temp_wails.json
mv temp_wails.json ./wails.json
jq --arg new_version "$new_version" '.info.productVersion = $new_version' ./app/wails.json > temp_wails.json
mv temp_wails.json ./app/wails.json
jq --arg new_version "$new_version" '.productVersion = $new_version' ./server/server.json > temp_wails.json
mv temp_wails.json ./server/server.json
- name: Commit and Push bump
run: |
git add wails.json
git add ./app/wails.json
git add ./server/server.json
git commit -m "Bump version to v${{ steps.bump_version.outputs.BUILD_VERSION }}"
git push
Expand All @@ -73,23 +77,38 @@ jobs:
shell: bash

- name: Build Windows App
working-directory: .
working-directory: ./app
run: wails build --clean --platform windows/amd64 -o PalworldDSGui.exe
shell: bash

- name: Build Windows Server
working-directory: ./server
run: go build -o PalworldDSGUI_WinServer.exe
shell: bash

# - name: Build Linux Server
# working-directory: ./server
# run: GOOS=linux GOARCH=amd64 go build -o PalworldDSGUI_LinuxServer
# shell: bash

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: PalworldDSGui.exe
path: ./build/bin/PalworldDSGui.exe
path: |
./app/build/bin/PalworldDSGui.exe
./server/PalworldDSGUI_WinServer.exe
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: ./build/bin/PalworldDSGui.exe
files: |
./app/build/bin/PalworldDSGui.exe
./server/PalworldDSGUI_WinServer.exe
tag_name: v${{ steps.bump_version.outputs.BUILD_VERSION }}
name: Release v${{ steps.bump_version.outputs.BUILD_VERSION }}
draft: true
body: |
## Changelog
No changelog available yet.
42 changes: 42 additions & 0 deletions HOW_TO_USE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## Quick Start Guide

1. Download the **GUI Server** `PalworldDSGUI_Server.exe` from the [releases page](https://github.com/diogomartino/palworld-ds-gui/releases).
2. Place the executable in a folder of your choice.
3. Run the executable.
4. Wait until the server is downloaded from the Steam servers.
5. An API key will be shown on the console. Save it, you will need it to connect to the server.
6. Download the **GUI Client** `PalworldDSGui.exe` from the [releases page](https://github.com/diogomartino/palworld-ds-gui/releases).
7. Open the client and use the API key to connect to the server.

## Remote Server

If you want to run the server on a remote machine (eg: a VPS), the steps are the same as above, you just need to download and execute the server on the remote machine, and then use the client to connect to it. You may need to open the port **21577** on the remote machine to be able to access it from the client.

## Using an existing server

If you already have a Palworld server, you can still use this tool, you just need to make sure that the folder structure is correct, which should look like this:

```plaintext
SomeRandomFolder/
├── server/ <------- This is your existing server folder (the one with the **PalServer.exe** executable)
├── PalworldDSGUI_Server.ex
```

The `server` folder should contain the `PalServer.exe` executable and all the other files that come with the server. The `PalworldDSGUI_Server.exe` should be in the same folder as the `server` folder. Then you can run the `PalworldDSGUI_Server.exe` and it will detect the existing server.

## GUI server parameters

| Param | Description | Default |
| -------- | ------------------------- | ------- |
| -newkey | Generate a new API key |
| -showkey | Show the current API key |
| -help | Show help |
| -port | Port to run the server on | 21577 |

## Running the server on Linux

Coming soon.

## Running it in Docker

Coming soon.
29 changes: 5 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,24 @@ This is a GUI for the Palworld Dedicated Server. Configure and manage your serve

## Download

You can download the latest version from the [releases page](https://github.com/diogomartino/palworld-ds-gui/releases).
You can downloads the latest versions from the [releases page](https://github.com/diogomartino/palworld-ds-gui/releases).

[WebView2](https://developer.microsoft.com/en-us/microsoft-edge/webview2/) is required. You most likely already have it installed, so you don't need to worry.

### [How To Use - Click here](HOW_TO_USE.md)

> [!WARNING]
> Be aware that this software is still in early development and may contain bugs. Please report any issues you find.
## Screenshots

![Connecting](https://i.imgur.com/e5rSvBE.png)
![Home](https://i.imgur.com/157panY.png)
![Settings](https://i.imgur.com/gu0x0PS.png)
![Admin](https://i.imgur.com/49giAIK.png)
![Backups](https://i.imgur.com/3IboT0o.png)

## Instructions

1. Open the app
2. Wait for the dedicated server to be downloaded from Steam
3. Configure your server
4. Hit the "Start" button

The default settings mirror the official configurations, but users have the flexibility to customize them according to their preferences.

## Development

### Future plans

- Add support for Linux and macOS
- Create RCON management interface
- Automated backups (both local and remote)
- Automatic server updates
- Multiple map management
- User profiles management
- Automated imports of local worlds
- Resource usage graphs (CPU, RAM, etc)
## Developmen

### Requirements

Expand All @@ -51,8 +34,6 @@ The default settings mirror the official configurations, but users have the flex
wails dev -s
```

This will launch the application in development mode. The interface will also run on http://localhost:34115 in case you want to run it in a browser.

## Building

```
Expand Down
File renamed without changes.
76 changes: 54 additions & 22 deletions app.go → app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,26 @@ package main
import (
"context"
"fmt"
backupsmanager "palword-ds-gui/backups-manager"
dedicatedserver "palword-ds-gui/dedicated-server"
"io"
"net/http"
"os"
rconclient "palword-ds-gui/rcon-client"
"palword-ds-gui/steamcmd"
"palword-ds-gui/utils"
"path"

"github.com/gocolly/colly/v2"
"github.com/wailsapp/wails/v2/pkg/runtime"
)

type App struct {
ctx context.Context
steamCmd *steamcmd.SteamCMD
dedicatedServer *dedicatedserver.DedicatedServer
backupsManager *backupsmanager.BackupManager
rconClient *rconclient.RconClient
reactReady bool
ctx context.Context
rconClient *rconclient.RconClient
reactReady bool
}

func NewApp(server *dedicatedserver.DedicatedServer, cmd *steamcmd.SteamCMD, backupManager *backupsmanager.BackupManager, rconClient *rconclient.RconClient) *App {
func NewApp(rconClient *rconclient.RconClient) *App {
return &App{
steamCmd: cmd,
dedicatedServer: server,
backupsManager: backupManager,
rconClient: rconClient,
rconClient: rconClient,
}
}

Expand All @@ -48,19 +43,11 @@ func (a *App) InitApp() {
return
}

a.steamCmd.Init(a.ctx)
a.dedicatedServer.Init(a.ctx)
a.backupsManager.Init(a.ctx)
a.reactReady = true

runtime.EventsEmit(a.ctx, "SET_LOADING_STATUS", "DONE")
utils.LogToFile("app.go: initApp()")
}

func (a *App) beforeClose(ctx context.Context) (prevent bool) {
a.dedicatedServer.Dispose()
a.backupsManager.Dispose()

utils.LogToFile("app.go: beforeClose()")
return false
}
Expand Down Expand Up @@ -90,3 +77,48 @@ func (a *App) GetSteamProfileURL(steamid string) {
return
}
}

func (a *App) SaveLog(log string) {
utils.LogToFile(log)
}

func (a *App) OpenLogs() {
utils.OpenExplorerWithFile(utils.Config.AppDataDir, "logs.txt")
}

func (a *App) DownloadFile(url string, filename string, authToken string) error {
path := path.Join(utils.GetCurrentDir(), filename)
utils.LogToFile(fmt.Sprintf("Downloading %s to %s", url, path))

req, err := http.NewRequest("GET", url, nil)
if err != nil {
return err
}

req.Header.Set("Authorization", authToken)

resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return fmt.Errorf("server returned non-200 status: %d %s", resp.StatusCode, resp.Status)
}

out, err := os.Create(path)
if err != nil {
return err
}
defer out.Close()

_, err = io.Copy(out, resp.Body)
if err != nil {
return err
}

utils.OpenExplorerWithFile(utils.GetCurrentDir(), filename)

return nil
}
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion frontend/package.json → app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@
"framer-motion": "^10.16.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12",
"react-redux": "^8.1.3",
"react-router": "^6.21.3",
"react-router-dom": "^6.21.3",
"redux": "^4.2.1"
"react-toastify": "^10.0.4",
"redux": "^4.2.1",
"ws": "^8.16.0"
},
"devDependencies": {
"@types/node": "^20.11.17",
"@types/react": "^18.2.34",
"@types/react-dom": "^18.2.14",
"@typescript-eslint/eslint-plugin": "^6.9.1",
Expand Down
1 change: 1 addition & 0 deletions app/frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5a84e7b692d7b7a616c13967a1f63bfe
Loading

0 comments on commit 4d17245

Please sign in to comment.