ccpanel 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +25 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-7ROXP6AO.js";
8
8
 
9
9
  // src/cli.ts
10
- import { homedir } from "os";
10
+ import { homedir, networkInterfaces } from "os";
11
11
  import { join as join6 } from "path";
12
12
  import { createServer } from "net";
13
13
  import { fileURLToPath, pathToFileURL } from "url";
@@ -1037,11 +1037,31 @@ async function main() {
1037
1037
  registryFile,
1038
1038
  webRoot
1039
1039
  });
1040
- const port = await findFreePort(7788);
1041
- serve({ fetch: app.fetch, port });
1040
+ const host = process.env.HOST ?? "0.0.0.0";
1041
+ const desired = process.env.PORT ? Number(process.env.PORT) : 7788;
1042
+ const port = await findFreePort(desired);
1043
+ serve({ fetch: app.fetch, port, hostname: host });
1042
1044
  const url = `http://localhost:${port}`;
1043
1045
  console.log(`ccpanel \u5DF2\u542F\u52A8\uFF1A${url}`);
1044
- await open(url);
1046
+ for (const ip of lanAddresses()) {
1047
+ console.log(` \u5C40\u57DF\u7F51\u8BBF\u95EE\uFF1A http://${ip}:${port}`);
1048
+ }
1049
+ if (!process.argv.includes("--no-open")) {
1050
+ try {
1051
+ await open(url);
1052
+ } catch {
1053
+ console.log("\uFF08\u672A\u80FD\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\u8BF7\u624B\u52A8\u8BBF\u95EE\u4E0A\u9762\u7684\u5730\u5740\uFF09");
1054
+ }
1055
+ }
1056
+ }
1057
+ function lanAddresses() {
1058
+ const out = [];
1059
+ for (const addrs of Object.values(networkInterfaces())) {
1060
+ for (const a of addrs ?? []) {
1061
+ if (a.family === "IPv4" && !a.internal) out.push(a.address);
1062
+ }
1063
+ }
1064
+ return out;
1045
1065
  }
1046
1066
  function isMainModule(argvPath, moduleUrl) {
1047
1067
  return !!argvPath && moduleUrl === pathToFileURL(argvPath).href;
@@ -1052,5 +1072,6 @@ if (isMainModule(process.argv[1], import.meta.url)) {
1052
1072
  export {
1053
1073
  findFreePort,
1054
1074
  isMainModule,
1075
+ lanAddresses,
1055
1076
  main
1056
1077
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccpanel",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "本地图形化管理 Claude Code 配置:MCP、Skills、子 Agent、Commands、配置文件、Memory、Sessions、Plugins",
5
5
  "type": "module",
6
6
  "repository": { "type": "git", "url": "git+https://gitee.com/jerry123456789099/ccpanel.git" },