diff --git a/Dockerfile.server.dockerignore b/Dockerfile.server.dockerignore index 0528ee4..427fea9 100644 --- a/Dockerfile.server.dockerignore +++ b/Dockerfile.server.dockerignore @@ -1,6 +1,8 @@ * !go/ !go/** +go/.cache/ +go/config.json !versions.json !CHANGELOG.md* !UPDATE_FINGERPRINT.json diff --git a/README.md b/README.md index f8edb3b..f4bc73d 100644 --- a/README.md +++ b/README.md @@ -84,21 +84,24 @@ BD2 Launcher 是使用 Wails 的独立桌面游戏启动器。Windows 使用系 ### 在 Linux 服务器上用 Docker 部署 -[`tools/server/bd2-host.sh`](tools/server/bd2-host.sh) 负责 Docker 主机上的全部工作:准备目录、生成认证主密钥、检出源码、安装更新交接单元,并从已发布的提交构建镜像、切换容器、等待就绪。需要 Docker(含 Compose 插件)、git、jq、curl、flock、nsenter 和 openssl,以 root 运行。一键安装并部署 `main` 的最新提交: +[`tools/server/bd2-host.sh`](tools/server/bd2-host.sh) 负责 Docker 主机上的目录与密钥初始化、更新交接单元安装、镜像构建、容器切换和就绪检查。手动部署直接使用指定目录的当前源码(包括未提交的改动),或指定的 Docker 镜像,与 Git 提交、推送无关。需要 Docker(含 Compose 插件)、jq、curl、flock、nsenter、realpath 和 openssl,以 root 运行。从源码目录安装并部署: ```bash -curl -fsSL https://raw.githubusercontent.com/Flechazo098/bd2/main/tools/server/bd2-host.sh -o bd2-host.sh && sudo sh bd2-host.sh setup +sudo sh tools/server/bd2-host.sh setup "$PWD" ``` 脚本安装到 `/opt/bd2/bd2-host.sh`,数据在 `/opt/bd2/data`,Compose 文件首次从 [模板](tools/server/compose.yaml) 生成为 `/opt/bd2/compose.yaml`(默认只在本机 `8080` 端口提供服务,请放在 HTTPS 反向代理之后)。之后: ```bash -sudo /opt/bd2/bd2-host.sh deploy # 部署 main 的最新提交,或指定完整提交号 +sudo /opt/bd2/bd2-host.sh deploy /path/to/bd2 # 构建该目录当前源码 +sudo /opt/bd2/bd2-host.sh deploy --image bd2server:my-build sudo /opt/bd2/bd2-host.sh status -sudo /opt/bd2/bd2-host.sh rollback # 换回上次切换前的镜像;存档不回滚 +sudo /opt/bd2/bd2-host.sh rollback # 换回上次切换前的镜像;存档不会回滚 ``` -在管理台应用的服务端更新也由同一脚本完成交接。路径、源码地址和 Compose 文件可在 `/etc/bd2/host.conf` 中以 `BD2_DIR=`、`SOURCE_URL=`、`COMPOSE_FILE=`、`SERVICE=`、`READY_PORT=`、`SEED_CONFIG_DIR=` 修改。不用 Docker 时,可使用 [systemd 单元模板](tools/server/bd2server.service)。 +省略源码路径时,`deploy` 使用 `/opt/bd2/source` 中已有的源码。指定镜像时,优先使用本机镜像,不存在则拉取,并以解析出的不可变镜像 ID 切换。首次安装若没有相邻的 Compose 模板和本地源码,脚本会用 Git 从 `SOURCE_URL` 获取初始源码。 + +在管理台应用的服务端更新也由同一脚本完成交接,继续使用经过验证的发布请求;发布提供固定摘要的镜像时无需 Git,按源码更新时才获取对应提交。路径、源码地址和 Compose 文件可在 `/etc/bd2/host.conf` 中以 `BD2_DIR=`、`SOURCE_URL=`、`COMPOSE_FILE=`、`SERVICE=`、`READY_PORT=`、`SEED_CONFIG_DIR=` 修改。不用 Docker 时,可使用 [systemd 单元模板](tools/server/bd2server.service)。 服务端日志默认输出 INFO 及以上级别,仅终端启用颜色:TRACE 灰、DEBUG 青、INFO 绿、WARN 黄、ERROR 红。可用 `serve --log-level debug --log-color auto` 调整。级别支持 `trace/debug/info/warn/error`,颜色支持 `auto/always/never`。`auto` 下文件和重定向保持纯文本,`NO_COLOR` 或 `TERM=dumb` 也会关闭颜色;如需在 Docker 日志流中显示颜色,可显式选择 `always`。 diff --git a/go/build/client_instance.go b/go/build/client_instance.go index 9194d29..becbdba 100644 --- a/go/build/client_instance.go +++ b/go/build/client_instance.go @@ -63,9 +63,14 @@ func (t task) runClient2(args []string) error { return fmt.Errorf("load second client's connection settings: %w", err) } } - if _, err := clientsetup.SaveSettings(instance.GameDirectory, settings, versions); err != nil { + if _, err := clientsetup.SaveSettings(instance.GameDirectory, settings); err != nil { return fmt.Errorf("prepare second client's resources: %w", err) } + if settings.CDNMode == clientconfig.CDNLocal { + if err := clientsetup.InstallLocalCatalog(instance.GameDirectory, settings.LocalResourceDirectory, versions.BundleVersion); err != nil { + return fmt.Errorf("prepare second client's catalog: %w", err) + } + } return nil }}, taskgraph.Task{Name: "instance:plugins", DependsOn: []string{"instance:prepare"}, Run: func(ctx context.Context) error { @@ -78,7 +83,7 @@ func (t task) runClient2(args []string) error { plugins := func(name string) string { return filepath.Join(t.root, "plugins", name, "bin", "Release", "netstandard2.1", "BD2"+name+".dll") } - _, err := clientsetup.InstallPlugins(instance.GameDirectory, settings, versions, plugins("LocalIdentity"), plugins("LoginUI"), plugins("CashShop"), plugins("FChat")) + _, err := clientsetup.InstallPlugins(instance.GameDirectory, plugins("LocalIdentity"), plugins("LoginUI"), plugins("CashShop"), plugins("FChat")) return err }}, taskgraph.Task{Name: "instance:launcher", DependsOn: []string{"instance:plugins"}, Run: func(context.Context) error { diff --git a/go/build/release_pipeline.go b/go/build/release_pipeline.go index 63e3705..ac82c60 100644 --- a/go/build/release_pipeline.go +++ b/go/build/release_pipeline.go @@ -1,6 +1,7 @@ package main import ( + "bd2server/internal/common/util" "bytes" "context" "encoding/json" @@ -240,7 +241,7 @@ func (r *release) writePluginStore() error { byID := versions.Plugins.ByID() store := clientupdate.Store{Version: versions.ClientVersion} for _, spec := range clientplugin.Shipped { - sum, err := releasepkg.HashFile(filepath.Join(r.client, "plugins", spec.FileName())) + sum, err := util.SHA256File(filepath.Join(r.client, "plugins", spec.FileName())) if err != nil { return err } diff --git a/go/build/release_publish.go b/go/build/release_publish.go index 540d045..0a9712e 100644 --- a/go/build/release_publish.go +++ b/go/build/release_publish.go @@ -2,6 +2,7 @@ package main import ( "archive/zip" + "bd2server/internal/common/util" "bytes" "encoding/json" "errors" @@ -279,7 +280,7 @@ func (t task) releasePublish(args []string) error { return err } publish := func(source, name, platform, id, version string) (releasepkg.File, error) { - sum, err := releasepkg.HashFile(source) + sum, err := util.SHA256File(source) if err != nil { return releasepkg.File{}, err } diff --git a/go/build/release_schedules.go b/go/build/release_schedules.go index 96ac667..74ef8d0 100644 --- a/go/build/release_schedules.go +++ b/go/build/release_schedules.go @@ -1,6 +1,7 @@ package main import ( + "bd2server/internal/common/util" "encoding/json" "fmt" "os" @@ -83,7 +84,7 @@ func (t task) stageSchedules(output string, versions versionconfig.Config) (*rel } for _, entry := range entries { file := filepath.Join(source, entry.Name()) - sum, err := releasepkg.HashFile(file) + sum, err := util.SHA256File(file) if err != nil { return nil, err } diff --git a/go/cmd/bd2client/main.go b/go/cmd/bd2client/main.go index d79a3fa..1a0fcab 100644 --- a/go/cmd/bd2client/main.go +++ b/go/cmd/bd2client/main.go @@ -7,6 +7,7 @@ import ( "fmt" "os" "os/signal" + "path/filepath" clientapp "bd2server/internal/client/app" clientconfig "bd2server/internal/client/config" @@ -110,12 +111,19 @@ func runClient(args []string, options clientRunOptions) error { *gameDir = preferences.GameDirectory } } + var packageDirectory, downloadManifest string + if options.versionConfigPath != "" { + packageDirectory = filepath.Dir(options.versionConfigPath) + downloadManifest = filepath.Join(packageDirectory, "tools", "client", "client-download.json") + } if err := clientapp.Run(clientapp.Options{ InitialGameDir: *gameDir, Logger: logger, LogPath: logPath, Versions: versions, Development: options.versionConfigPath != "", + PackageDirectory: packageDirectory, + DownloadManifest: downloadManifest, LocalIdentityPlugin: options.localIdentityPlugin, LoginUIPlugin: options.loginUIPlugin, CashShopPlugin: options.cashShopPlugin, diff --git a/go/cmd/bd2client/prepare.go b/go/cmd/bd2client/prepare.go index 83d3672..5aa600e 100644 --- a/go/cmd/bd2client/prepare.go +++ b/go/cmd/bd2client/prepare.go @@ -7,16 +7,10 @@ import ( "fmt" "os" "os/signal" - "path/filepath" "strings" - "time" clientconfig "bd2server/internal/client/config" - "bd2server/internal/client/download" - clientsetup "bd2server/internal/client/setup" - commonconfig "bd2server/internal/common/config" - "bd2server/internal/common/taskgraph" - "bd2server/internal/common/versionconfig" + "bd2server/internal/client/preparation" ) func prepareClient(args []string) error { @@ -41,126 +35,22 @@ func prepareClient(args []string) error { if fs.NArg() != 0 || *workers < 1 || *workers > 16 { return errors.New("prepare accepts named options and workers must be 1-16") } - if *downloadOnly && *baseOnly { - return errors.New("--download and --base select separate stages; omit both to run all stages") - } - if *baseOnly && *probeOnly { - return errors.New("--probe-only cannot be used with --base") - } - if *packageDir == "" { - executable, err := os.Executable() - if err != nil { - return err - } - *packageDir = filepath.Dir(executable) - } - var err error - *packageDir, err = filepath.Abs(*packageDir) - if err != nil { - return err - } - if *versionPath == "" { - *versionPath = filepath.Join(*packageDir, versionconfig.FileName) - } ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) defer stop() - var versions, downloaded versionconfig.Config - var settings clientconfig.Settings - graph, err := taskgraph.New( - taskgraph.Task{Name: "download", Run: func(ctx context.Context) error { - installed, err := download.Client(ctx, download.Options{ - PackageDir: *packageDir, Manifest: *manifest, - GameDir: *gameDir, ResourceDir: *resources, ServerOrigin: *origin, - Workers: *workers, ProbeOnly: *probeOnly, - }, os.Stdout) - if err != nil { - return err - } - *gameDir, *resources, *origin = installed.GameDir, installed.ResourceDir, installed.ServerOrigin - downloaded = installed.Versions - return nil - }}, - taskgraph.Task{Name: "base:configuration", Run: func(context.Context) error { - if *gameDir == "" { - *gameDir = filepath.Join(*packageDir, "game") - } - if *resources == "" { - *resources = filepath.Join(*packageDir, "resources") - } - if *origin == "" { - manifestPath := *manifest - if manifestPath == "" { - manifestPath = filepath.Join(*packageDir, "client-download.json") - } - defaults, err := commonconfig.Load(manifestPath, struct { - ServerOrigin string `json:"server_origin"` - }{}, commonconfig.DecodeOptions{AllowBOM: true, RejectTrailing: true}) - if err != nil { - return err - } - *origin = defaults.ServerOrigin - } - var err error - versions, err = versionconfig.Load(*versionPath) - if err != nil { - return err - } - if !*baseOnly && (versions.GameVersion != downloaded.GameVersion || versions.GameDataVersion != downloaded.GameDataVersion || versions.BundleVersion != downloaded.BundleVersion) { - return errors.New("client package and download manifest versions differ") - } - return nil - }}, - taskgraph.Task{Name: "base:settings", DependsOn: []string{"base:configuration"}, Run: func(context.Context) error { - var err error - settings, err = clientconfig.Normalize(clientconfig.Settings{ServerOrigin: *origin, CDNMode: clientconfig.CDNLocal, LocalResourceDirectory: *resources}) - return err - }}, - taskgraph.Task{Name: "base:resources", DependsOn: []string{"base:settings"}, Run: func(ctx context.Context) error { - policyContext, cancel := context.WithTimeout(ctx, 30*time.Second) - defer cancel() - _, err := clientsetup.FetchResourcePolicy(policyContext, nil, settings, versions) - return err - }}, - taskgraph.Task{Name: "base:bepinex", DependsOn: []string{"base:resources"}, Run: func(context.Context) error { - return download.InstallBepInEx(*packageDir, *gameDir) - }}, - taskgraph.Task{Name: "base:patch", DependsOn: []string{"base:bepinex"}, Run: func(context.Context) error { - _, err := clientsetup.Patch(*gameDir, settings, versions) - return err - }}, - taskgraph.Task{Name: "base:plugins", DependsOn: []string{"base:patch"}, Run: func(context.Context) error { - plugins := filepath.Join(*packageDir, "plugins") - _, err := clientsetup.InstallPlugins(*gameDir, settings, versions, - filepath.Join(plugins, "BD2LocalIdentity.dll"), filepath.Join(plugins, "BD2LoginUI.dll"), - filepath.Join(plugins, "BD2CashShop.dll"), filepath.Join(plugins, "BD2FChat.dll")) - return err - }}, - taskgraph.Task{Name: "base:preferences", DependsOn: []string{"base:plugins"}, Run: func(context.Context) error { - return clientconfig.SavePreferences(*gameDir) - }}, - taskgraph.Task{Name: "base", DependsOn: []string{"base:preferences"}, Run: func(context.Context) error { - fmt.Println("Client prepared:", versions.GameVersion) - fmt.Println("Server:", settings.ServerOrigin) - return nil - }}, - taskgraph.Task{Name: "prepare", DependsOn: []string{"download", "base"}}, - ) + result, err := preparation.Run(ctx, preparation.Options{ + PackageDirectory: *packageDir, DownloadManifest: *manifest, VersionConfig: *versionPath, + GameDirectory: *gameDir, ResourceDirectory: *resources, + Settings: clientconfig.Settings{ServerOrigin: *origin, CDNMode: clientconfig.CDNLocal, LocalResourceDirectory: *resources}, + Workers: *workers, DownloadOnly: *downloadOnly, BaseOnly: *baseOnly, ProbeOnly: *probeOnly, PlanOnly: *planOnly, + }, os.Stdout) if err != nil { return err } - target := "prepare" - if *downloadOnly || *probeOnly { - target = "download" - } else if *baseOnly { - target = "base" - } if *planOnly { - plan, err := graph.Plan(target) - if err != nil { - return err - } - fmt.Println(strings.Join(plan, " -> ")) - return nil + fmt.Println(strings.Join(result.Plan, " -> ")) + } else if !*downloadOnly && !*probeOnly { + fmt.Println("Client prepared:", result.Versions.GameVersion) + fmt.Println("Server:", result.Settings.ServerOrigin) } - return graph.Run(ctx, target) + return nil } diff --git a/go/internal/client/app/app.go b/go/internal/client/app/app.go index d1f9a7d..d970b89 100644 --- a/go/internal/client/app/app.go +++ b/go/internal/client/app/app.go @@ -14,7 +14,6 @@ import ( "time" clientconfig "bd2server/internal/client/config" - clientdownload "bd2server/internal/client/download" clientlayout "bd2server/internal/client/layout" clientplugin "bd2server/internal/client/plugin" clientsetup "bd2server/internal/client/setup" @@ -33,6 +32,8 @@ type Options struct { LogPath string Versions versionconfig.Config Development bool + PackageDirectory string + DownloadManifest string LocalIdentityPlugin string LoginUIPlugin string CashShopPlugin string @@ -85,7 +86,7 @@ type Studio struct { cancel context.CancelFunc mu sync.Mutex quitOnce sync.Once - launch func(string, string) error + launch func(string, string, *slog.Logger) error savePreferences func(string) error updates *clientupdate.Manager } @@ -153,7 +154,8 @@ func (s *Studio) Initialize() InitialState { s.mu.Lock() defer s.mu.Unlock() state := InitialState{Platform: runtime.GOOS, ClientVersion: s.options.Versions.ClientVersion, GameVersion: s.options.Versions.GameVersion, LogPath: s.options.LogPath, GameDirectory: s.options.InitialGameDir, ServerOrigin: "http://127.0.0.1:8080", CDNMode: clientconfig.CDNOfficial} - if state.GameDirectory == "" { + s.installationDefaults(&state) + if s.options.InitialGameDir == "" { return state } if _, err := clientsetup.Inspect(state.GameDirectory, s.versions(state.GameDirectory)); err != nil { @@ -220,8 +222,7 @@ func (s *Studio) Browse(input Request) (Response, error) { if dir == "" { return success("Selection cancelled", nil), nil } - status, err := clientsetup.Inspect(dir, s.versions(dir)) - return success("Game client found", status), err + return success("Installation directory selected", clientsetup.GameStatus{GameDirectory: dir}), nil }) } @@ -263,7 +264,7 @@ func (s *Studio) Resources(input Request) (Response, error) { func (s *Studio) Save(input Request) (Response, error) { return s.perform("save settings", func() (Response, error) { - settings, err := clientsetup.SaveSettings(input.GameDirectory, input.settings(), s.versions(input.GameDirectory)) + settings, err := clientsetup.SaveSettings(input.GameDirectory, input.settings()) if err != nil { return Response{}, err } @@ -276,7 +277,10 @@ func (s *Studio) Save(input Request) (Response, error) { func (s *Studio) Patch(input Request) (Response, error) { return s.perform("patch client", func() (Response, error) { - result, err := clientsetup.Patch(input.GameDirectory, input.settings(), s.versions(input.GameDirectory)) + if _, err := clientsetup.SaveSettings(input.GameDirectory, input.settings()); err != nil { + return Response{}, err + } + result, err := clientsetup.Patch(input.GameDirectory) if err != nil { return Response{}, err } @@ -293,7 +297,10 @@ func (s *Studio) Patch(input Request) (Response, error) { func (s *Studio) Install(input Request) (Response, error) { return s.perform("install plugins", func() (Response, error) { - result, err := clientsetup.InstallPlugins(input.GameDirectory, input.settings(), s.versions(input.GameDirectory), s.options.LocalIdentityPlugin, s.options.LoginUIPlugin, s.options.CashShopPlugin, s.options.FChatPlugin) + if _, err := clientsetup.SaveSettings(input.GameDirectory, input.settings()); err != nil { + return Response{}, err + } + result, err := clientsetup.InstallPlugins(input.GameDirectory, s.options.LocalIdentityPlugin, s.options.LoginUIPlugin, s.options.CashShopPlugin, s.options.FChatPlugin) if err != nil { return Response{}, err } @@ -326,9 +333,10 @@ func (s *Studio) Launch(input Request) (Response, error) { if !status.BepInEx { return Response{}, errors.New("install BepInEx before launching the game") } - ctx, cancel := context.WithTimeout(s.context(), 12*time.Second) - defer cancel() - if _, err := clientsetup.FetchResourcePolicy(ctx, nil, input.settings(), versions); err != nil { + policyCtx, cancel := context.WithTimeout(s.context(), 12*time.Second) + _, err = clientsetup.FetchResourcePolicy(policyCtx, nil, input.settings(), versions) + cancel() + if err != nil { return Response{}, err } @@ -337,10 +345,15 @@ func (s *Studio) Launch(input Request) (Response, error) { if s.updates != nil { configured.Runtime = s.updates.Runtime(input.GameDirectory) } - settings, err := clientsetup.SaveSettings(input.GameDirectory, configured, versions) + settings, err := clientsetup.SaveSettings(input.GameDirectory, configured) if err != nil { return Response{}, err } + if settings.CDNMode == clientconfig.CDNLocal { + if err := clientsetup.InstallLocalCatalog(input.GameDirectory, settings.LocalResourceDirectory, versions.BundleVersion); err != nil { + return Response{}, err + } + } if err := s.savePreferences(input.GameDirectory); err != nil { return Response{}, err } @@ -357,7 +370,7 @@ func (s *Studio) Launch(input Request) (Response, error) { return Response{}, fmt.Errorf("install or update the client plugins before launching; %s is missing", name) } } - if err := s.launch(installation.LaunchTarget(), settings.ProxyURL); err != nil { + if err := s.launch(installation.LaunchTarget(), settings.ProxyURL, s.log()); err != nil { if errors.Is(err, errGameAlreadyRunning) { return success("Brown Dust II is already running", nil), nil } @@ -370,7 +383,7 @@ func (s *Studio) Launch(input Request) (Response, error) { return launch() } var response Response - err = s.updates.WithLaunch(ctx, nil, status.GameDirectory, input.ServerOrigin, func() error { + err = s.updates.WithLaunch(s.context(), nil, status.GameDirectory, input.ServerOrigin, func() error { var err error response, err = launch() return err @@ -394,6 +407,9 @@ func (s *Studio) CheckUpdates() (Response, error) { return Response{}, errors.New("update service is unavailable") } ctx := s.context() + if err := s.updates.WaitIdle(ctx); err != nil { + return Response{}, err + } if err := s.updates.Check(ctx); err != nil { return Response{}, err } @@ -443,39 +459,3 @@ func (s *Studio) Quit() { } }) } - -// Prepare readies an installation in one step: the required game and resource -// update, BepInEx from the launcher package, the client patch and the plugins. -func (s *Studio) Prepare(input Request) (Response, error) { - return s.perform("prepare client", func() (Response, error) { - if s.updates != nil { - if err := s.updates.PrepareGame(s.context(), input.GameDirectory, input.ServerOrigin); err != nil { - return Response{}, err - } - } - versions := s.versions(input.GameDirectory) - status, err := clientsetup.Inspect(input.GameDirectory, versions) - if err != nil { - return Response{}, err - } - if !status.BepInEx { - executable, err := os.Executable() - if err != nil { - return Response{}, err - } - if err := clientdownload.InstallBepInEx(filepath.Dir(executable), status.GameDirectory); err != nil { - return Response{}, err - } - } - if _, err := clientsetup.Patch(input.GameDirectory, input.settings(), versions); err != nil { - return Response{}, err - } - if _, err := clientsetup.InstallPlugins(input.GameDirectory, input.settings(), versions, s.options.LocalIdentityPlugin, s.options.LoginUIPlugin, s.options.CashShopPlugin, s.options.FChatPlugin); err != nil { - return Response{}, err - } - if err := s.savePreferences(input.GameDirectory); err != nil { - return Response{}, err - } - return success("Client prepared", nil), nil - }) -} diff --git a/go/internal/client/app/platform_darwin.go b/go/internal/client/app/platform_darwin.go index aa84f6d..5fffce8 100644 --- a/go/internal/client/app/platform_darwin.go +++ b/go/internal/client/app/platform_darwin.go @@ -4,6 +4,7 @@ package app import ( "fmt" + "log/slog" "os" "os/exec" "path/filepath" @@ -16,7 +17,7 @@ func ShowFatalError(err error) { } } -func launchGame(target, proxyURL string) error { +func launchGame(target, proxyURL string, _ *slog.Logger) error { info, err := os.Stat(target) if err != nil || !info.IsDir() || !strings.EqualFold(filepath.Ext(target), ".app") { return fmt.Errorf("invalid macOS application bundle %q", target) diff --git a/go/internal/client/app/platform_other.go b/go/internal/client/app/platform_other.go index a41c8c5..f93919b 100644 --- a/go/internal/client/app/platform_other.go +++ b/go/internal/client/app/platform_other.go @@ -5,6 +5,7 @@ package app import ( "errors" "fmt" + "log/slog" "os" ) @@ -14,6 +15,6 @@ func ShowFatalError(err error) { } } -func launchGame(string, string) error { +func launchGame(string, string, *slog.Logger) error { return errors.New("the Brown Dust II client is not supported on Linux") } diff --git a/go/internal/client/app/platform_windows.go b/go/internal/client/app/platform_windows.go index e316c70..b230301 100644 --- a/go/internal/client/app/platform_windows.go +++ b/go/internal/client/app/platform_windows.go @@ -5,6 +5,7 @@ package app import ( "fmt" "log" + "log/slog" "os" "os/exec" "path/filepath" @@ -62,7 +63,7 @@ func visibleCommand(name string, args ...string) *exec.Cmd { return command } -func launchGame(target, proxyURL string) error { +func launchGame(target, proxyURL string, logger *slog.Logger) error { if processID, running, err := windowsExecutableProcessID(filepath.Base(target)); err != nil { return err } else if running { @@ -77,10 +78,32 @@ func launchGame(target, proxyURL string) error { if err := command.Start(); err != nil { return err } - // Unity creates the top-level window asynchronously. Best-effort foreground - // activation prevents the new window from opening behind BD2 Launcher. - activateProcessWindow(uint32(command.Process.Pid), 15*time.Second) - return nil + pid := command.Process.Pid + logger.Info("game process started", "pid", pid, "executable", target) + finished := make(chan error, 1) + go func() { + err := command.Wait() + logger.Info("game process exited", "pid", pid, "exit_code", command.ProcessState.ExitCode(), "error", err) + finished <- err + }() + deadline := time.NewTimer(30 * time.Second) + defer deadline.Stop() + ticker := time.NewTicker(100 * time.Millisecond) + defer ticker.Stop() + for { + select { + case err := <-finished: + return fmt.Errorf("game exited before showing a window: pid=%d exit_code=%d error=%v; see Player.log", pid, command.ProcessState.ExitCode(), err) + case <-deadline.C: + return fmt.Errorf("game process is running without a visible window after 30 seconds: pid=%d; see Player.log", pid) + case <-ticker.C: + if topLevelWindowForProcess(uint32(pid)) != 0 { + activateProcessWindow(uint32(pid), 0) + logger.Info("game window ready", "pid", pid) + return nil + } + } + } } func windowsExecutableProcessID(name string) (uint32, bool, error) { diff --git a/go/internal/client/app/prepare.go b/go/internal/client/app/prepare.go new file mode 100644 index 0000000..a3cd85c --- /dev/null +++ b/go/internal/client/app/prepare.go @@ -0,0 +1,78 @@ +package app + +import ( + "context" + "io" + "os" + "path/filepath" + "runtime" + + clientconfig "bd2server/internal/client/config" + "bd2server/internal/client/preparation" + commonconfig "bd2server/internal/common/config" + "bd2server/internal/common/versionconfig" +) + +func (s *Studio) packageDirectory() (string, error) { + if s.options.PackageDirectory != "" { + return filepath.Abs(s.options.PackageDirectory) + } + executable, err := os.Executable() + return filepath.Dir(executable), err +} + +func (s *Studio) downloadManifest(directory string) string { + if s.options.DownloadManifest != "" { + return s.options.DownloadManifest + } + return filepath.Join(directory, "client-download.json") +} + +func (s *Studio) installationDefaults(state *InitialState) { + directory, err := s.packageDirectory() + if err != nil { + return + } + defaults, err := commonconfig.Load(s.downloadManifest(directory), struct { + ServerOrigin string `json:"server_origin"` + }{}, commonconfig.DecodeOptions{AllowBOM: true, RejectTrailing: true}) + if err == nil { + if origin, err := clientconfig.NormalizeOrigin(defaults.ServerOrigin); err == nil { + state.ServerOrigin = origin + } + } + if runtime.GOOS == "windows" && state.GameDirectory == "" { + state.GameDirectory = filepath.Join(directory, "game") + state.CDNMode = clientconfig.CDNLocal + } + state.LocalResourceDirectory = filepath.Join(directory, "resources") +} + +func (s *Studio) Prepare(input Request) (Response, error) { + return s.perform("prepare client", func() (Response, error) { + directory, err := s.packageDirectory() + if err != nil { + return Response{}, err + } + result, err := preparation.Run(s.context(), preparation.Options{ + PackageDirectory: directory, DownloadManifest: s.downloadManifest(directory), + GameDirectory: input.GameDirectory, Settings: input.settings(), Versions: s.versions(input.GameDirectory), + Workers: 8, DownloadIfMissing: true, + LocalIdentityPlugin: s.options.LocalIdentityPlugin, LoginUIPlugin: s.options.LoginUIPlugin, + CashShopPlugin: s.options.CashShopPlugin, FChatPlugin: s.options.FChatPlugin, + SavePreferences: s.savePreferences, + PrepareGame: func(ctx context.Context, game string, settings clientconfig.Settings) (versionconfig.Config, error) { + if s.updates != nil { + if err := s.updates.PrepareGame(ctx, game, settings.ServerOrigin); err != nil { + return versionconfig.Config{}, err + } + } + return s.versions(game), nil + }, + }, io.Discard) + if err != nil { + return Response{}, err + } + return success("Client prepared", result.Status), nil + }) +} diff --git a/go/internal/client/app/web/index.html b/go/internal/client/app/web/index.html index 85888bf..c9d59ee 100644 --- a/go/internal/client/app/web/index.html +++ b/go/internal/client/app/web/index.html @@ -12,14 +12,14 @@ *{box-sizing:border-box}body{margin:0;background:#e7dcc7;color:var(--ink);font:14px/1.65 var(--sans);overflow-x:hidden}button,input{font:inherit}button{cursor:pointer}button:disabled{cursor:wait;opacity:.5}button,input,a{-webkit-tap-highlight-color:transparent}button:focus-visible,input:focus-visible,summary:focus-visible{outline:2px solid var(--rust);outline-offset:5px}[hidden]{display:none!important}::selection{background:#b9764c;color:#fff9ef} .landscape{position:fixed;inset:0;z-index:-3;background:linear-gradient(130deg,#f1e9d9 0%,#e7d5b6 42%,#bc8665 100%);overflow:hidden}.landscape svg{position:absolute;width:100%;height:100%;transition:transform 2s var(--ease),opacity 1.6s;transform:scale(1.04);opacity:.87}.landscape:after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,rgba(244,237,222,.8),rgba(240,228,207,.2) 65%,transparent),linear-gradient(0deg,rgba(73,48,31,.14),transparent 48%)}body[data-scene=server] .landscape svg{transform:scale(1.14) translateX(-2%)}body[data-scene=desk] .landscape svg{transform:scale(1.2) translateY(-3%);opacity:.27}body[data-scene=desk] .landscape:after{background:rgba(240,234,221,.55)} .grain{position:fixed;inset:0;pointer-events:none;z-index:20;opacity:.038;background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23000' filter='url(%23grain)' d='M0 0h180v180H0z'/%3E%3C/svg%3E")}.sunlight{position:fixed;inset:-40%;pointer-events:none;z-index:-2;background:radial-gradient(ellipse at 70% 23%,#fff7d777,transparent 38%);animation:drift 18s ease-in-out infinite alternate} -.topbar{height:94px;max-width:1440px;margin:auto;padding:0 58px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);gap:24px}.brand{display:flex;gap:13px;align-items:center;flex-shrink:0}.emblem{display:block;width:40px;height:40px;flex-shrink:0}.brand-name{font-size:13px;letter-spacing:.19em;line-height:1.4}.brand-name small{display:block;font-size:9px;letter-spacing:.28em;color:var(--muted);margin-top:4px}.top-note{font-size:11px;color:var(--muted);letter-spacing:.07em}.text-btn{background:none;border:0;color:var(--muted);padding:8px 0;border-bottom:1px solid transparent}.text-btn:hover{color:var(--rust);border-bottom-color:var(--rust)} -main{max-width:1324px;margin:auto;padding:0 58px}.scene{position:relative}.intro-scene{min-height:calc(100svh - 178px);display:grid;grid-template-columns:1.1fr .9fr;align-items:center;gap:8%;padding:66px 0 82px}.eyebrow{font-size:10px;letter-spacing:.22em;text-transform:uppercase;display:flex;align-items:center;gap:12px;color:#81634c;margin-bottom:24px}.eyebrow:before{content:'';height:1px;width:32px;background:currentColor}h1,h2,h3,p{margin:0}h1{font:400 clamp(42px,4.8vw,68px)/1.28 var(--serif);letter-spacing:.035em}.lead{max-width:380px;font-size:14px;color:var(--muted);line-height:1.95;margin-top:26px}.intro-label{display:flex;gap:14px;align-items:center;margin-top:44px;font-size:11px;color:#8a7059}.intro-label i{height:1px;width:30px;background:#987759}.form-card{position:relative;background:linear-gradient(135deg,rgba(250,246,237,.89),rgba(238,225,203,.7));border:1px solid rgba(255,255,255,.6);box-shadow:0 24px 70px -35px #65472c77,inset 0 0 0 1px rgba(116,89,55,.035);backdrop-filter:blur(24px);border-radius:4px;padding:34px 32px}.card-number{font:italic 46px/1 var(--serif);color:#b2997e;opacity:.6;margin-bottom:30px}.form-card h2{font:400 23px var(--serif);margin-bottom:9px}.description{font-size:12px;line-height:1.8;color:var(--muted);margin-bottom:26px}code{font:11px/1.8 Consolas,monospace;overflow-wrap:anywhere}label.field-label{display:block;font-size:11px;margin-bottom:9px;color:#6f5c49}.input-row{display:flex;gap:8px}input[type=text]{width:100%;min-width:0;border:1px solid #aa927755;border-radius:3px;padding:13px 12px;background:#fffcf57d;color:var(--ink);outline:none;transition:background .2s,border-color .2s;font-size:12px}input[type=text]:focus{border-color:var(--rust);background:#fffaf0}.btn{border:1px solid #81664a55;border-radius:3px;padding:11px 18px;display:inline-flex;align-items:center;justify-content:center;gap:12px;min-height:43px;background:#fffcf533;color:var(--ink);transition:background .25s,box-shadow .25s,transform .25s;white-space:nowrap;font-size:12px}.btn:hover:not(:disabled){background:#fff9eb99;transform:translateY(-2px)}.btn.primary{background:#4b3a2c;color:#fff5e4;border-color:#4b3a2c}.btn.primary:hover:not(:disabled){background:#654932;box-shadow:0 6px 17px #4b3a2c24}.btn.rust{background:#985e40;color:#fff6e8;border-color:#985e40}.btn.rust:hover:not(:disabled){background:#ad6c49}.arrow{font-size:20px;font-weight:300;line-height:1}.wide{width:100%;justify-content:space-between;margin-top:28px;padding:14px 18px}.small-note{font-size:11px;color:#877460;margin-top:12px;line-height:1.8}.inline-result{font-size:11px;min-height:22px;margin-top:10px;color:var(--muted)}.inline-result.error{color:var(--bad)}.form-tools{display:flex;align-items:center;justify-content:space-between;margin-top:4px;gap:8px;font-size:11px}.server-back{margin-top:14px;text-align:center}.server-back .text-btn{font-size:11px}.bottom-bar{max-width:1324px;margin:auto;padding:0 58px 28px;display:flex;justify-content:space-between;align-items:center;gap:24px}.steps{display:flex;list-style:none;padding:0;margin:0;gap:26px;font-size:11px;color:#8f7d69}.steps li{display:flex;gap:8px;align-items:center}.steps .num{font:italic 14px var(--serif)}.steps li.active{color:#503b2b}.steps li.active:after{content:'';width:19px;height:1px;background:#86573b}.bottom-note{font-size:10px;color:#897963;letter-spacing:.04em} +.topbar{height:94px;max-width:1440px;margin:auto;padding:0 58px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);gap:24px}.brand{display:flex;gap:13px;align-items:center;flex-shrink:0}.emblem{display:block;width:40px;height:40px;flex-shrink:0}.brand-name{font-size:13px;letter-spacing:.19em;line-height:1.4}.brand-name small{display:block;font-size:9px;letter-spacing:.28em;color:var(--muted);margin-top:4px}.text-btn{background:none;border:0;color:var(--muted);padding:8px 0;border-bottom:1px solid transparent}.text-btn:hover{color:var(--rust);border-bottom-color:var(--rust)} +main{max-width:1324px;margin:auto;padding:0 58px}.scene{position:relative}.intro-scene{min-height:calc(100svh - 178px);display:grid;grid-template-columns:1.1fr .9fr;align-items:center;gap:8%;padding:66px 0 82px}.eyebrow{font-size:10px;letter-spacing:.22em;text-transform:uppercase;display:flex;align-items:center;gap:12px;color:#81634c;margin-bottom:24px}.eyebrow:before{content:'';height:1px;width:32px;background:currentColor}h1,h2,h3,p{margin:0}h1{font:400 clamp(42px,4.8vw,68px)/1.28 var(--serif);letter-spacing:.035em}.lead{max-width:380px;font-size:14px;color:var(--muted);line-height:1.95;margin-top:26px}.intro-label{display:flex;gap:14px;align-items:center;margin-top:44px;font-size:11px;color:#8a7059}.intro-label i{height:1px;width:30px;background:#987759}.form-card{position:relative;background:linear-gradient(135deg,rgba(250,246,237,.89),rgba(238,225,203,.7));border:1px solid rgba(255,255,255,.6);box-shadow:0 24px 70px -35px #65472c77,inset 0 0 0 1px rgba(116,89,55,.035);backdrop-filter:blur(24px);border-radius:4px;padding:34px 32px}.card-number{font:italic 46px/1 var(--serif);color:#b2997e;opacity:.6;margin-bottom:30px}.form-card h2{font:400 23px var(--serif);margin-bottom:9px}.description{font-size:12px;line-height:1.8;color:var(--muted);margin-bottom:26px}code{font:11px/1.8 Consolas,monospace;overflow-wrap:anywhere}label.field-label{display:block;font-size:11px;margin-bottom:9px;color:#6f5c49}.input-row{display:flex;gap:8px}.input-row>.btn{flex-shrink:0}input[type=text]{width:100%;min-width:0;border:1px solid #aa927755;border-radius:3px;padding:13px 12px;background:#fffcf57d;color:var(--ink);outline:none;transition:background .2s,border-color .2s;font-size:12px}input[type=text]:focus{border-color:var(--rust);background:#fffaf0}.btn{border:1px solid #81664a55;border-radius:3px;padding:11px 18px;display:inline-flex;align-items:center;justify-content:center;gap:12px;min-height:43px;background:#fffcf533;color:var(--ink);transition:background .25s,box-shadow .25s,transform .25s;white-space:nowrap;font-size:12px}.btn:hover:not(:disabled){background:#fff9eb99;transform:translateY(-2px)}.btn.primary{background:#4b3a2c;color:#fff5e4;border-color:#4b3a2c}.btn.primary:hover:not(:disabled){background:#654932;box-shadow:0 6px 17px #4b3a2c24}.btn.rust{background:#985e40;color:#fff6e8;border-color:#985e40}.btn.rust:hover:not(:disabled){background:#ad6c49}.arrow{font-size:20px;font-weight:300;line-height:1}.wide{width:100%;justify-content:space-between;margin-top:28px;padding:14px 18px}.small-note{font-size:11px;color:#877460;margin-top:12px;line-height:1.8}.inline-result{font-size:11px;min-height:22px;margin-top:10px;color:var(--muted)}.inline-result.error{color:var(--bad)}.form-tools{display:flex;align-items:center;justify-content:space-between;margin-top:4px;gap:8px;font-size:11px}.server-back{margin-top:14px;text-align:center}.server-back .text-btn{font-size:11px}.bottom-bar{max-width:1324px;margin:auto;padding:0 58px 28px;display:flex;justify-content:space-between;align-items:center;gap:24px}.steps{display:flex;list-style:none;padding:0;margin:0;gap:26px;font-size:11px;color:#8f7d69}.steps li{display:flex;gap:8px;align-items:center}.steps .num{font:italic 14px var(--serif)}.steps li.active{color:#503b2b}.steps li.active:after{content:'';width:19px;height:1px;background:#86573b}.bottom-note{font-size:10px;color:#897963;letter-spacing:.04em} .scene.is-entering .reveal{animation:reveal 1.3s var(--ease) both;animation-delay:calc(var(--i,0)*110ms)}.scene.is-leaving{animation:leave .55s cubic-bezier(.4,0,.6,1) both;pointer-events:none}.transition-veil{position:fixed;inset:0;background:linear-gradient(115deg,#eee4d4ed,#dfc7a8e8);z-index:30;pointer-events:none;opacity:0;backdrop-filter:blur(8px)}.transition-veil.play{animation:veil 1.25s ease-in-out both}.opening-curtain{position:fixed;inset:0;background:#e8decc;pointer-events:none;z-index:40;animation:opening 1.65s ease forwards} .desk-scene{padding:46px 0 34px}.desk-header{display:flex;justify-content:space-between;align-items:end;gap:24px;margin-bottom:30px}.desk-header .eyebrow{margin-bottom:13px}.desk-header h1{font-size:42px}.desk-header p{margin-top:12px;font-size:12px;color:var(--muted)}.connection-chip{display:flex;align-items:center;gap:9px;font-size:11px;color:#74634f;border:1px solid var(--line);padding:8px 13px;border-radius:30px}.dot{width:6px;height:6px;border-radius:50%;background:#a99b85;display:inline-block;flex-shrink:0}.dot.good{background:var(--olive);box-shadow:0 0 0 4px #68744912}.dot.bad{background:var(--bad)}.desk-grid{display:grid;grid-template-columns:minmax(0,1fr) 298px;gap:24px}.main-panel{background:#f9f5ec94;border:1px solid #fff9;border-radius:4px;box-shadow:0 12px 50px -40px #5c412c55}.panel-section{padding:25px 28px;border-bottom:1px solid var(--line)}.panel-section:last-child{border-bottom:0}.section-title{display:flex;align-items:center;gap:11px;margin-bottom:22px}.section-title .index{font:italic 14px var(--serif);color:#a08569}.section-title h2{font-size:15px;font-weight:500}.section-title .end{margin-left:auto;font-size:10px;color:var(--muted)}.setting-row{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:18px}.setting-name{font-size:10px;color:var(--muted);margin-bottom:4px}.setting-value{font-size:12px;overflow-wrap:anywhere}.setting-row>div{min-width:0}.setting-row .text-btn{font-size:11px;flex-shrink:0;color:var(--rust)}.route-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.route{position:relative;cursor:pointer}.route input{position:absolute;opacity:0;inset:0;width:100%;height:100%;margin:0}.route-content{display:block;position:relative;pointer-events:none;min-height:139px;padding:15px 14px;border:1px solid var(--line);border-radius:3px;transition:.25s;background:#f8f3e83d}.route-content .route-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}.route-code{font:10px var(--serif);letter-spacing:.08em;color:#98826b}.radio-dot{width:11px;height:11px;border-radius:50%;border:1px solid #aa9680;display:block}.route-content strong{font-size:12px;font-weight:500;display:block;margin-bottom:5px}.route-content small{font-size:10px;line-height:1.75;display:block;color:var(--muted)}.route input:checked+.route-content{border-color:#9e7551;background:#b9986920;box-shadow:inset 0 0 0 1px #9e755118}.route input:checked+.route-content .radio-dot{background:#916c4a;border:3px solid #e8d9c3;box-shadow:0 0 0 1px #916c4a}.route input:focus-visible+.route-content{outline:2px solid var(--rust);outline-offset:4px}.route input:disabled+.route-content{opacity:.55}.route-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:18px}.route-actions .text-btn{font-size:11px}.route-hint{font-size:10px;color:#927d64;margin-top:13px}.policy{font:11px/1.9 Consolas,monospace;white-space:pre-wrap;overflow-wrap:anywhere;background:#dfd2bc50;border-left:2px solid #a3835e;padding:13px;margin-top:16px}.prepare-note{font-size:11px;color:var(--muted);margin:-8px 0 19px;line-height:1.8}.prepare-actions{display:flex;gap:10px;flex-wrap:wrap}.prepare-actions .btn{flex:1}.status-panel{align-self:start;padding:25px 23px;background:#dfd1ba66;border:1px solid #9875501c;border-radius:4px}.status-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}.status-title h2{font:400 19px var(--serif)}.status-title span{font-size:9px;color:#927d65;letter-spacing:.1em}.check{display:flex;align-items:center;justify-content:space-between;padding:14px 0;border-bottom:1px solid var(--line);font-size:11px;gap:8px}.check span:last-child{color:#948471;font-size:10px}.check span.ok{color:var(--olive)}.check span.warn{color:var(--bad)}.status-foot{font-size:10px;color:#8d7a63;margin-top:14px;line-height:1.8}.log-wrap{border-top:1px solid var(--line);margin-top:24px;padding-top:19px}.log-heading{font-size:10px;color:#8d745b;display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.log{font-size:11px;color:#7e6c56;line-height:1.8;overflow-wrap:anywhere;min-height:65px}.log strong{display:block;color:var(--ink);font-size:12px;font-weight:500;margin-bottom:5px}.history{margin-top:14px;border-top:1px solid var(--line);padding-top:12px;font-size:10px;color:#806e59}.history summary{cursor:pointer}.history ol{list-style:none;padding:0;margin:10px 0 0;max-height:180px;overflow:auto}.history li{padding:7px 0;border-top:1px solid #a487651a;overflow-wrap:anywhere}.history time{display:block;color:#9a876f;font-size:9px}.history li.error{color:var(--bad)}.unsaved{font-size:10px;color:var(--rust);margin-top:12px}.desk-footer{display:flex;justify-content:space-between;gap:20px;margin-top:24px;color:#8a765e;font-size:10px} .desk-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}.desk-actions .btn{min-height:38px;padding:8px 16px}.local-resource{margin-top:14px;padding:14px;border:1px solid var(--line);background:#f8f3e83d;border-radius:3px}.local-resource[hidden]{display:none}.local-resource .small-note{margin:8px 0 0} .update-box{display:grid;gap:4px;margin-top:12px;padding:10px 12px;border:1px solid #c9ac8288;border-radius:3px;background:#fff8ec80;font-size:12px}.update-box span{white-space:pre-line;max-height:120px;overflow:auto;color:#6d5a47}.update-box .text-btn{justify-self:start}.toast{position:fixed;bottom:28px;left:50%;transform:translate(-50%,18px);max-width:min(590px,calc(100% - 32px));width:max-content;padding:13px 21px;background:#483a2e;color:#fff4e0;box-shadow:0 10px 40px #483a2e26;border:1px solid #c9ac82;border-radius:3px;font-size:12px;opacity:0;pointer-events:none;transition:.35s var(--ease);z-index:70}.toast.show{opacity:1;transform:translate(-50%,0)}.toast.error{background:#793e30;color:#fff0e3}dialog{width:min(490px,calc(100% - 32px));padding:30px;border:1px solid #fff9;border-radius:5px;background:#f0e7d7;color:var(--ink);box-shadow:0 30px 140px #37271955}dialog::backdrop{background:#40322266;backdrop-filter:blur(9px)}dialog[open]{animation:reveal .55s var(--ease)}.dialog-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:25px}.dialog-head h2{font:24px var(--serif)}.dialog-close{background:none;border:0;font-size:23px;color:var(--muted);padding:0 7px}.dialog-actions{display:flex;justify-content:flex-end;margin-top:20px}.quit-scene{min-height:65svh;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}.quit-scene h1{font-size:44px}.quit-scene p{color:var(--muted);margin-top:20px;font-size:13px} @keyframes reveal{from{opacity:0;filter:blur(10px);transform:translateY(24px) scale(.986)}to{opacity:1;filter:blur(0);transform:none}}@keyframes leave{to{opacity:0;filter:blur(8px);transform:translateY(-15px) scale(1.014)}}@keyframes veil{0%,100%{opacity:0}45%,58%{opacity:1}}@keyframes opening{0%,15%{opacity:1}100%{opacity:0}}@keyframes drift{to{transform:translate(-4%,3%) scale(1.05)}} -@media(min-width:1500px){.intro-scene{gap:13%}.form-card{padding:40px}.intro-scene h1{font-size:72px}}@media(max-width:1050px){.topbar{padding:0 30px}main,.bottom-bar{padding-left:30px;padding-right:30px}.intro-scene{gap:5%}.form-card{padding:27px 23px}.desk-grid{grid-template-columns:minmax(0,1fr) 250px;gap:16px}.panel-section{padding:23px 20px}.status-panel{padding:23px 18px}.route-content{padding:12px 10px}.top-note{display:none}}@media(max-width:760px){.topbar{height:77px;padding:0 22px}main,.bottom-bar{padding-left:22px;padding-right:22px}.intro-scene{grid-template-columns:1fr;gap:32px;padding:42px 0;min-height:auto}.intro-scene h1{font-size:43px}.eyebrow{margin-bottom:17px}.lead{margin-top:18px;max-width:100%}.intro-label{display:none}.form-card{padding:25px}.card-number{position:absolute;right:25px;top:25px;font-size:31px}.form-card h2{padding-right:45px}.bottom-bar{align-items:start;flex-direction:column;gap:15px}.steps{gap:21px}.desk-scene{padding-top:31px}.desk-header{align-items:start}.desk-header h1{font-size:34px}.connection-chip{font-size:10px;padding:6px 10px;margin-top:4px}.desk-grid{grid-template-columns:1fr}.status-panel{display:grid;grid-template-columns:1fr 1fr;gap:0 30px}.status-title{grid-column:1/-1}.log-wrap{margin-top:10px;border-top:0}.status-foot{margin-bottom:14px}.desk-footer{flex-direction:column;gap:7px}.bottom-note{font-size:9px}.landscape svg{width:180%;left:-60%}.desk-header p{max-width:240px}.route-content{min-height:145px}}@media(max-width:400px){main,.bottom-bar{padding-left:16px;padding-right:16px}.form-card{padding:23px 18px}.route-options{grid-template-columns:1fr}.route-content{min-height:0;padding:12px 14px}.route-content .route-top{float:right;margin:0 0 10px 20px;gap:12px}.route-content small{max-width:90%}.status-panel{display:block}.desk-header{flex-direction:column;gap:14px}.panel-section{padding:22px 16px}.btn{padding-left:13px;padding-right:13px}.steps{gap:15px}.route-actions{align-items:stretch}.prepare-actions{flex-direction:column}} +@media(min-width:1500px){.intro-scene{gap:13%}.form-card{padding:40px}.intro-scene h1{font-size:72px}}@media(max-width:1050px){.topbar{padding:0 30px}main,.bottom-bar{padding-left:30px;padding-right:30px}.intro-scene{gap:5%}.form-card{padding:27px 23px}.desk-grid{grid-template-columns:minmax(0,1fr) 250px;gap:16px}.panel-section{padding:23px 20px}.status-panel{padding:23px 18px}.route-content{padding:12px 10px}}@media(max-width:760px){.topbar{height:77px;padding:0 22px}main,.bottom-bar{padding-left:22px;padding-right:22px}.intro-scene{grid-template-columns:1fr;gap:32px;padding:42px 0;min-height:auto}.intro-scene h1{font-size:43px}.eyebrow{margin-bottom:17px}.lead{margin-top:18px;max-width:100%}.intro-label{display:none}.form-card{padding:25px}.card-number{position:absolute;right:25px;top:25px;font-size:31px}.form-card h2{padding-right:45px}.bottom-bar{align-items:start;flex-direction:column;gap:15px}.steps{gap:21px}.desk-scene{padding-top:31px}.desk-header{align-items:start}.desk-header h1{font-size:34px}.connection-chip{font-size:10px;padding:6px 10px;margin-top:4px}.desk-grid{grid-template-columns:1fr}.status-panel{display:grid;grid-template-columns:1fr 1fr;gap:0 30px}.status-title{grid-column:1/-1}.log-wrap{margin-top:10px;border-top:0}.status-foot{margin-bottom:14px}.desk-footer{flex-direction:column;gap:7px}.bottom-note{font-size:9px}.landscape svg{width:180%;left:-60%}.desk-header p{max-width:240px}.route-content{min-height:145px}}@media(max-width:400px){main,.bottom-bar{padding-left:16px;padding-right:16px}.form-card{padding:23px 18px}.route-options{grid-template-columns:1fr}.route-content{min-height:0;padding:12px 14px}.route-content .route-top{float:right;margin:0 0 10px 20px;gap:12px}.route-content small{max-width:90%}.status-panel{display:block}.desk-header{flex-direction:column;gap:14px}.panel-section{padding:22px 16px}.btn{padding-left:13px;padding-right:13px}.steps{gap:15px}.route-actions{align-items:stretch}.prepare-actions{flex-direction:column}} @media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}.opening-curtain{display:none}} .proxy-select{width:100%;padding:12px 14px;border:1px solid var(--line);border-radius:3px;background:#f8f3e8;color:var(--ink);font:inherit}#proxyURL{width:100%}/* Window chrome belongs to the page; keep scrolling without a visible gutter. */ html,body{scrollbar-width:none}html::-webkit-scrollbar,body::-webkit-scrollbar{display:none} @@ -38,11 +38,11 @@ html:lang(ja){--sans:'Segoe UI','Yu Gothic UI',Meiryo,sans-serif;--serif:Georgia -
+

-

+