ework-web 0.10.12 → 0.10.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-web",
3
- "version": "0.10.12",
3
+ "version": "0.10.14",
4
4
  "type": "module",
5
5
  "description": "ework-web — standalone multi-project issue tracker. Local SQLite-backed, no external API dependency. Bun + TypeScript + SSR HTML.",
6
6
  "license": "MIT",
@@ -72,13 +72,18 @@ function parseEnvFile(content: string): Map<string, string> {
72
72
  return out;
73
73
  }
74
74
 
75
- function buildEnvBlock(env: Map<string, string>, target: DeployTarget): string {
75
+ export function buildEnvBlock(env: Map<string, string>, target: DeployTarget): string {
76
76
  const lines: string[] = [];
77
+ const localIP = detectLocalIP();
77
78
  for (const k of FORWARD_KEYS) {
78
79
  const v = env.get(k);
79
80
  if (v === undefined) continue;
80
81
  if (k === "OPENCODE_BINARY") continue;
81
- lines.push(`${k}=${v}`);
82
+ let val = v;
83
+ if (k === "GITEA_URL" && localIP && (val.includes("127.0.0.1") || val.includes("localhost"))) {
84
+ val = val.replace(/127\.0\.0\.1|localhost/g, localIP);
85
+ }
86
+ lines.push(`${k}=${val}`);
82
87
  }
83
88
  const mysqlHost = String(target.mysqlHost).replace(/:\d+$/, "");
84
89
  lines.push(`WORK_DB_HOST=${mysqlHost}`);
@@ -88,6 +93,23 @@ function buildEnvBlock(env: Map<string, string>, target: DeployTarget): string {
88
93
  return lines.join("\n");
89
94
  }
90
95
 
96
+ function detectLocalIP(): string | null {
97
+ try {
98
+ const { networkInterfaces } = require("node:os");
99
+ const nets = networkInterfaces();
100
+ for (const name of Object.keys(nets)) {
101
+ for (const net of nets[name] ?? []) {
102
+ if (net.family === "IPv4" && !net.internal) {
103
+ return net.address;
104
+ }
105
+ }
106
+ }
107
+ } catch {
108
+ // Network detection best-effort
109
+ }
110
+ return null;
111
+ }
112
+
91
113
  function buildSetupScript(envBlock: string, daemonPort: number, mysqlHostRaw: string, mysqlPort: string): string {
92
114
  const mysqlHost = mysqlHostRaw.replace(/:\d+$/, "");
93
115
  return [