@zhangferry-dev/tokendash 1.6.0 → 1.6.1

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.
@@ -553,7 +553,8 @@
553
553
  .drawer-overlay {
554
554
  position: absolute;
555
555
  inset: 0;
556
- background: rgba(255, 255, 255, 0.76);
556
+ z-index: 20;
557
+ background: rgba(250, 252, 251, 0.96);
557
558
  border: 1px solid rgba(255, 255, 255, 0.72);
558
559
  border-radius: var(--radius-shell);
559
560
  opacity: 0;
@@ -569,7 +570,7 @@
569
570
  flex-direction: column;
570
571
  padding: 0 24px;
571
572
  border-radius: var(--radius-shell);
572
- background: linear-gradient(180deg, rgba(250, 252, 251, 0.85), rgba(244, 247, 245, 0.7));
573
+ background: linear-gradient(180deg, rgba(250, 252, 251, 0.98), rgba(244, 247, 245, 0.96));
573
574
  border: none;
574
575
  box-shadow: none;
575
576
  transform: translateY(10px);
@@ -1246,7 +1247,7 @@
1246
1247
  var label = document.createElement('span');
1247
1248
  label.className = 'x-axis-label' + (shouldLabel ? '' : ' is-unlabeled');
1248
1249
  label.style.gridColumn = String(entry.hour + 1);
1249
- label.textContent = String(entry.hour).padStart(2, '0') + ':00';
1250
+ label.textContent = String(entry.hour).padStart(2, '0');
1250
1251
  xAxis.appendChild(label);
1251
1252
  });
1252
1253
  }
@@ -2103,7 +2103,17 @@ function getAgents(_req, res) {
2103
2103
  res.status(500).json({ error: "Failed to detect agents", hint: message });
2104
2104
  }
2105
2105
  }
2106
- function registerApiRoutes(router) {
2106
+ function getAppInfo(info) {
2107
+ return (req, res) => {
2108
+ const host = req.get("host");
2109
+ res.json({
2110
+ ...info,
2111
+ dashboardUrl: host ? `${req.protocol}://${host}` : info.dashboardUrl
2112
+ });
2113
+ };
2114
+ }
2115
+ function registerApiRoutes(router, appInfo) {
2116
+ router.get("/app-info", getAppInfo(appInfo));
2107
2117
  router.get("/agents", getAgents);
2108
2118
  router.get("/daily", getDaily);
2109
2119
  router.get("/monthly", getMonthly);
@@ -2122,11 +2132,22 @@ var CLI_USAGE = [
2122
2132
  " tokendash --port <number> [--no-open]",
2123
2133
  " tokendash --tray [--port <number>]"
2124
2134
  ].join("\n");
2135
+ var PACKAGE_NAME = "@zhangferry-dev/tokendash";
2125
2136
  function getPackageVersion() {
2126
2137
  const __filename = (0, import_node_url.fileURLToPath)(__esbuild_import_meta_url);
2127
2138
  const __dirname = (0, import_node_path8.dirname)(__filename);
2128
- const packageJson = JSON.parse((0, import_node_fs8.readFileSync)((0, import_node_path8.join)(__dirname, "..", "..", "package.json"), "utf8"));
2129
- return packageJson.version ?? "unknown";
2139
+ const packageJsonPaths = [
2140
+ (0, import_node_path8.join)(__dirname, "..", "..", "package.json"),
2141
+ // dist/server/index.js
2142
+ (0, import_node_path8.join)(__dirname, "..", "package.json")
2143
+ // dist/electron-server.cjs
2144
+ ];
2145
+ for (const packageJsonPath of packageJsonPaths) {
2146
+ if (!(0, import_node_fs8.existsSync)(packageJsonPath)) continue;
2147
+ const packageJson = JSON.parse((0, import_node_fs8.readFileSync)(packageJsonPath, "utf8"));
2148
+ if (packageJson.version) return packageJson.version;
2149
+ }
2150
+ return "unknown";
2130
2151
  }
2131
2152
  function exitWithCliError(message) {
2132
2153
  console.error(message);
@@ -2234,7 +2255,11 @@ function resolveStaticAssetBaseDir(moduleUrl = __esbuild_import_meta_url, baseDi
2234
2255
  function createApp(_port, baseDir) {
2235
2256
  const app = (0, import_express.default)();
2236
2257
  const router = import_express.default.Router();
2237
- registerApiRoutes(router);
2258
+ registerApiRoutes(router, {
2259
+ packageName: PACKAGE_NAME,
2260
+ version: getPackageVersion(),
2261
+ dashboardUrl: `http://localhost:${resolvePort(_port)}`
2262
+ });
2238
2263
  app.use("/api", router);
2239
2264
  const { baseDir: _baseDir, isProduction } = resolveStaticAssetBaseDir(__esbuild_import_meta_url, baseDir);
2240
2265
  const popoverPath = isProduction ? (0, import_node_path8.join)(_baseDir, "client", "popover.html") : (0, import_node_path8.join)(_baseDir, "..", "..", "public", "popover.html");