Server: - Add castle and total war battles, IB battles, roguelike runs with castle and roguelike rankings, cafeteria and dating, life content, spine interactions and recordings, popularity rankings, gacha history and selection draws, map exploration, quest previews and completion, passes, rhythm events, quick battles, achievement progress, resource items, prestige illustrations and community notices. - Report structured request errors from the gateway, validate avatars, and extend settlement evidence and existing domain handlers. - Let bd2-host.sh deploy from a source directory or a prebuilt image and update the deployment docs and Docker ignore list. Launcher: - Prepare a new installation directly from the launcher (download, BepInEx, catalog, patch, plugins) through a shared preparation package also used by bd2client prepare. - Launching and preparing now wait for a running background update instead of failing with "Another update operation is in progress"; manual update checks wait as well, and launch downloads no longer use the 12-second resource-policy timeout. - Log what each update check found, every downloaded file, the server requirement, the game resource decision and installed plugins; skip warnings caused by closing the launcher. Shared: - Move file hashing and atomic replacement into common/util and use it from the build, release, launcher and server code.
41 lines
1.5 KiB
Go
41 lines
1.5 KiB
Go
package setup
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
clientconfig "bd2server/internal/client/config"
|
|
)
|
|
|
|
func TestSaveLocalSettingsBeforeGameAndResourcesAreInstalled(t *testing.T) {
|
|
root := t.TempDir()
|
|
game, resources := filepath.Join(root, "game"), filepath.Join(root, "resources")
|
|
input := clientconfig.Settings{ServerOrigin: "https://play.example.com", CDNMode: clientconfig.CDNLocal, LocalResourceDirectory: resources}
|
|
if _, err := SaveSettings(game, input); err != nil {
|
|
t.Fatal("saving an installation location depended on game or resource preparation", err)
|
|
}
|
|
saved, err := clientconfig.Load(game)
|
|
if err != nil || saved.ServerOrigin != input.ServerOrigin || saved.CDNMode != input.CDNMode || saved.LocalResourceDirectory != resources {
|
|
t.Fatalf("saved settings could not be restored for preparation: %+v, %v", saved, err)
|
|
}
|
|
if _, err := os.Stat(resources); !os.IsNotExist(err) {
|
|
t.Fatal("saving settings tried to create the resource installation", err)
|
|
}
|
|
if _, err := os.Stat(filepath.Join(game, "BrownDust II_Data")); !os.IsNotExist(err) {
|
|
t.Fatal("saving settings tried to prepare the game", err)
|
|
}
|
|
configPath := clientconfig.Path(game)
|
|
before, err := os.Stat(configPath)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, err := SaveSettings(game, input); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
after, err := os.Stat(configPath)
|
|
if err != nil || !os.SameFile(before, after) || !before.ModTime().Equal(after.ModTime()) {
|
|
t.Fatal("saving unchanged settings rewrote the configuration", err)
|
|
}
|
|
}
|