feat(config): switch webPort to URI-style webListen address

- replace integer webPort with MultiProtocolSocketAddress webListen
  (default: http://0.0.0.0:4665) in controller config
- rename Swing UI item to "Web API 监听地址" and validate as full URI
- update WebServer binding to honor configured host and port
- normalize legacy webPort integers to http://0.0.0.0:<port> on load
  and keep JSON API backward compatibility
- update i18n keys in zh_CN and en_US resource bundles
- update root klalb-config.json and AGENTS.md documentation
This commit was merged in pull request #2.
This commit is contained in:
2026-08-26 19:42:26 +08:00
parent 9cea5ed493
commit 61868fe93e
11 changed files with 99 additions and 84 deletions
@@ -84,18 +84,20 @@ public class KLALBProxySystem {
public KLALBProxySystem() {
}
public void enableWebServer() throws IOException {
int port = 4665;
KLALBControllerConfigItem cci = getControllerConfig();
if (cci != null && cci.getWebPort() > 0) {
port = cci.getWebPort();
}
enableWebServer(port);
}
public void enableWebServer(int port) throws IOException {
if (webServer == null) {
webServer = new KLALBWebServer(this, port);
public void enableWebServer() throws IOException {
KLALBControllerConfigItem cci = getControllerConfig();
MultiProtocolSocketAddress listen = cci == null || cci.getWebListen() == null
? new MultiProtocolSocketAddress("http", "0.0.0.0", 4665) : cci.getWebListen();
enableWebServer(listen);
}
public void enableWebServer(int port) throws IOException {
enableWebServer(new MultiProtocolSocketAddress("http", "0.0.0.0", port));
}
public void enableWebServer(MultiProtocolSocketAddress listen) throws IOException {
if (webServer == null) {
webServer = new KLALBWebServer(this, listen);
webServer.start();
} else {
throw new IllegalStateException("Web server already enabled!");