@zhin.js/console 1.0.56 → 1.0.58

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @zhin.js/console
2
2
 
3
+ ## 1.0.58
4
+
5
+ ### Patch Changes
6
+
7
+ - zhin.js@1.0.56
8
+ - @zhin.js/core@1.0.56
9
+ - @zhin.js/http@1.0.51
10
+
11
+ ## 1.0.57
12
+
13
+ ### Patch Changes
14
+
15
+ - a4e3559: fix: 客户端 err
16
+
3
17
  ## 1.0.56
4
18
 
5
19
  ### Patch Changes
@@ -52,9 +52,9 @@ function App() {
52
52
  function RouteInitializer() {
53
53
  useWebSocket()
54
54
 
55
- const entries = useSelector(state => state.script.entries)
56
- const loadedScripts = useSelector(state => state.script.loadedScripts)
57
- const synced = useSelector(state => state.script.synced)
55
+ const entries = useSelector(state => state.script?.entries || [])
56
+ const loadedScripts = useSelector(state => state.script?.loadedScripts || [])
57
+ const synced = useSelector(state => state.script?.synced ?? false)
58
58
  const [initialized, setInitialized] = useState(false)
59
59
 
60
60
  useEffect(() => {
@@ -121,4 +121,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
121
121
  group w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left
122
122
  hover:bg-accent transition-colors rounded-sm
123
123
  ${v===e.name?`bg-accent text-accent-foreground font-medium`:``}
124
- `,onClick:()=>y(e.name),children:[F(x===`keyvalue`?me:Ie,{className:`w-3.5 h-3.5 text-muted-foreground shrink-0`}),F(`span`,{className:`truncate flex-1`,children:e.name}),e.columns&&F(H,{variant:`secondary`,className:`ml-auto text-[10px] px-1 py-0`,children:Object.keys(e.columns).length}),F(R,{size:`sm`,variant:`ghost`,className:`h-5 w-5 p-0 opacity-0 group-hover:opacity-100 text-destructive shrink-0`,onClick:t=>{t.stopPropagation();let n=x===`related`?`表`:x===`document`?`集合`:`桶`;confirm(`确定要删除${n} "${e.name}" 吗?此操作不可撤销!`)&&s(e.name).then(()=>{v===e.name&&y(null)}).catch(()=>{})},children:F(Re,{className:`w-3 h-3`})})]},e.name)):F(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:`暂无数据`})})})]}),F(`div`,{className:`flex-1 min-w-0 p-4`,children:v?I(P,{children:[I(`div`,{className:`flex items-center gap-2 mb-4`,children:[F(Ie,{className:`w-5 h-5 text-muted-foreground`}),F(`h2`,{className:`text-lg font-semibold`,children:v}),b?.columns&&I(`div`,{className:`flex gap-1 ml-2 flex-wrap`,children:[Object.entries(b.columns).slice(0,8).map(([e,t])=>I(H,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[e,t.primary?` 🔑`:``,`: `,t.type]},e)),Object.keys(b.columns).length>8&&I(H,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[`+`,Object.keys(b.columns).length-8]})]})]}),x===`keyvalue`?F(Ls,{tableName:v,kvGet:m,kvSet:h,kvDelete:g,kvEntries:_},v):x===`document`?F(Is,{tableName:v,select:l,insert:u,update:f,remove:p},v):F(Fs,{tableName:v,tableInfo:b,select:l,insert:u,update:f,remove:p},v)]}):F(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:I(`div`,{className:`text-center`,children:[F(O,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),I(`p`,{className:`text-sm`,children:[`在左侧选择`,x===`related`?`一个表`:x===`document`?`一个集合`:`一个桶`,`开始管理`]})]})})})]})})})]})}function zs({onSuccess:e}){let[t,n]=c(``),[r,a]=c(``),[o,s]=c(!1),l=i(async()=>{let n=t.trim();if(!n){a(`请输入 Token`);return}s(!0),a(``);try{let t=await fetch(`/api/system/status`,{headers:{Authorization:`Bearer ${n}`}});t.ok?(an(n),e()):t.status===401?a(`Token 无效,请检查后重试`):a(`验证失败 (HTTP ${t.status})`)}catch{a(`无法连接到服务器`)}finally{s(!1)}},[t,e]);return F(`div`,{className:`flex items-center justify-center min-h-screen bg-background`,children:I(B,{className:N(`w-full max-w-md mx-4`),children:[I(pn,{className:`text-center space-y-2`,children:[F(`div`,{className:`flex items-center justify-center mx-auto w-12 h-12 rounded-xl bg-foreground text-background font-bold text-xl`,children:`Z`}),F(mn,{className:`text-xl`,children:`Zhin.js 控制台`}),F(hn,{children:`请输入 API Token 以访问管理面板`})]}),F(V,{children:I(`form`,{onSubmit:e=>{e.preventDefault(),l()},className:`space-y-4`,children:[I(`div`,{className:`space-y-2`,children:[F(z,{type:`password`,placeholder:`API Token`,value:t,onChange:e=>{n(e.target.value),r&&a(``)},autoFocus:!0}),r&&F(`p`,{className:`text-sm text-destructive`,children:r})]}),F(R,{type:`submit`,className:`w-full`,disabled:o,children:o?`验证中...`:`登录`}),I(`p`,{className:`text-xs text-center text-muted-foreground`,children:[`Token 位于 `,F(`code`,{className:`text-xs bg-muted px-1 rounded`,children:`.env`}),` 文件的`,` `,F(`code`,{className:`text-xs bg-muted px-1 rounded`,children:`HTTP_TOKEN`}),` 中`]})]})})]})})}function Bs(e){return Bs=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Bs(e)}function Vs(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Hs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Us(e,t,n){return t&&Hs(e.prototype,t),n&&Hs(e,n),e}function Ws(e,t){return t&&(Bs(t)===`object`||typeof t==`function`)?t:Ks(e)}function Gs(e){return Gs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Gs(e)}function Ks(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function qs(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Js(e,t)}function Js(e,t){return Js=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Js(e,t)}function Ys(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xs=function(e){qs(t,e);function t(){var e,n;Vs(this,t);var r=[...arguments];return n=Ws(this,(e=Gs(t)).call.apply(e,[this].concat(r))),Ys(Ks(n),`state`,{bootstrapped:!1}),Ys(Ks(n),`_unsubscribe`,void 0),Ys(Ks(n),`handlePersistorState`,function(){n.props.persistor.getState().bootstrapped&&(n.props.onBeforeLift?Promise.resolve(n.props.onBeforeLift()).finally(function(){return n.setState({bootstrapped:!0})}):n.setState({bootstrapped:!0}),n._unsubscribe&&n._unsubscribe())}),n}return Us(t,[{key:`componentDidMount`,value:function(){this._unsubscribe=this.props.persistor.subscribe(this.handlePersistorState),this.handlePersistorState()}},{key:`componentWillUnmount`,value:function(){this._unsubscribe&&this._unsubscribe()}},{key:`render`,value:function(){return typeof this.props.children==`function`?this.props.children(this.state.bootstrapped):this.state.bootstrapped?this.props.children:this.props.loading}}]),t}(n);Ys(Xs,`defaultProps`,{children:null,loading:null});var Zs=kt.Provider;kt.Root,kt.Trigger;var Qs=e.forwardRef(({className:e,sideOffset:t=4,...n},r)=>F(kt.Portal,{children:F(kt.Content,{ref:r,sideOffset:t,className:N(`z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));Qs.displayName=`TooltipContent`,Yt();function $s(){let[e,t]=c(sn()),n=i(()=>t(!0),[]);return a(()=>{let e=()=>t(!1);return window.addEventListener(`zhin:auth-required`,e),()=>window.removeEventListener(`zhin:auth-required`,e)},[]),e?F(Xs,{loading:null,persistor:tt,children:F(Gt,{store:ot,children:F(ec,{})})}):F(zs,{onSuccess:n})}function ec(){ht();let e=mt(e=>e.script.entries),t=mt(e=>e.script.loadedScripts),n=mt(e=>e.script.synced),[r,i]=c(!1);a(()=>{[{key:`dashboardLayout`,path:`/`,title:`Dashboard`,element:F(fn,{}),meta:{order:0},children:[{key:`homePage`,path:`/dashboard`,title:`系统概览`,icon:F(de,{className:`w-4 h-4`}),element:F(bn,{}),meta:{group:`系统`,order:0}},{key:`botManagePage`,path:`/bots`,title:`机器人`,icon:F(h,{className:`w-4 h-4`}),element:F(ar,{}),meta:{group:`系统`,order:1}},{key:`logsPage`,path:`/logs`,title:`系统日志`,icon:F(ae,{className:`w-4 h-4`}),element:F(br,{}),meta:{group:`系统`,order:2,fullWidth:!0}},{key:`pluginsPage`,path:`/plugins`,title:`插件管理`,icon:F(j,{className:`w-4 h-4`}),element:F(Cn,{}),meta:{group:`扩展`,order:3}},{key:`pluginDetailPage`,title:`插件详情`,path:`/plugins/:name`,element:F(rr,{}),meta:{hideInMenu:!0}},{key:`configPage`,path:`/config`,title:`配置管理`,icon:F(Ne,{className:`w-4 h-4`}),element:F(ls,{}),meta:{group:`配置与数据`,order:4}},{key:`envManagePage`,path:`/env`,title:`环境变量`,icon:F(he,{className:`w-4 h-4`}),element:F(ps,{}),meta:{group:`配置与数据`,order:5}},{key:`fileManagePage`,path:`/files`,title:`文件管理`,icon:F(se,{className:`w-4 h-4`}),element:F(Ss,{}),meta:{group:`配置与数据`,order:6}},{key:`databasePage`,path:`/database`,title:`数据库`,icon:F(O,{className:`w-4 h-4`}),element:F(Rs,{}),meta:{group:`配置与数据`,order:7,fullWidth:!0}},{key:`botDetailPage`,path:`/bots/:adapter/:botId`,title:`机器人详情`,element:F(_r,{}),meta:{hideInMenu:!0,fullWidth:!0}}]}].forEach(e=>{et(e)}),i(!0)},[]);let o=n&&(e.length===0||e.length===t.length);return!r||!o?F(`div`,{className:`flex items-center justify-center h-screen bg-background`,children:I(`div`,{className:`text-center`,children:[F(`div`,{className:`inline-block animate-spin rounded-full h-8 w-8 border-2 border-muted-foreground border-t-foreground`}),I(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:[`加载中... (`,t.length,`/`,e.length,`)`]})]})}):F(Ze,{})}l(document.getElementById(`root`)).render(F(r,{children:F(Zs,{children:F($s,{})})}));
124
+ `,onClick:()=>y(e.name),children:[F(x===`keyvalue`?me:Ie,{className:`w-3.5 h-3.5 text-muted-foreground shrink-0`}),F(`span`,{className:`truncate flex-1`,children:e.name}),e.columns&&F(H,{variant:`secondary`,className:`ml-auto text-[10px] px-1 py-0`,children:Object.keys(e.columns).length}),F(R,{size:`sm`,variant:`ghost`,className:`h-5 w-5 p-0 opacity-0 group-hover:opacity-100 text-destructive shrink-0`,onClick:t=>{t.stopPropagation();let n=x===`related`?`表`:x===`document`?`集合`:`桶`;confirm(`确定要删除${n} "${e.name}" 吗?此操作不可撤销!`)&&s(e.name).then(()=>{v===e.name&&y(null)}).catch(()=>{})},children:F(Re,{className:`w-3 h-3`})})]},e.name)):F(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:`暂无数据`})})})]}),F(`div`,{className:`flex-1 min-w-0 p-4`,children:v?I(P,{children:[I(`div`,{className:`flex items-center gap-2 mb-4`,children:[F(Ie,{className:`w-5 h-5 text-muted-foreground`}),F(`h2`,{className:`text-lg font-semibold`,children:v}),b?.columns&&I(`div`,{className:`flex gap-1 ml-2 flex-wrap`,children:[Object.entries(b.columns).slice(0,8).map(([e,t])=>I(H,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[e,t.primary?` 🔑`:``,`: `,t.type]},e)),Object.keys(b.columns).length>8&&I(H,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[`+`,Object.keys(b.columns).length-8]})]})]}),x===`keyvalue`?F(Ls,{tableName:v,kvGet:m,kvSet:h,kvDelete:g,kvEntries:_},v):x===`document`?F(Is,{tableName:v,select:l,insert:u,update:f,remove:p},v):F(Fs,{tableName:v,tableInfo:b,select:l,insert:u,update:f,remove:p},v)]}):F(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:I(`div`,{className:`text-center`,children:[F(O,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),I(`p`,{className:`text-sm`,children:[`在左侧选择`,x===`related`?`一个表`:x===`document`?`一个集合`:`一个桶`,`开始管理`]})]})})})]})})})]})}function zs({onSuccess:e}){let[t,n]=c(``),[r,a]=c(``),[o,s]=c(!1),l=i(async()=>{let n=t.trim();if(!n){a(`请输入 Token`);return}s(!0),a(``);try{let t=await fetch(`/api/system/status`,{headers:{Authorization:`Bearer ${n}`}});t.ok?(an(n),e()):t.status===401?a(`Token 无效,请检查后重试`):a(`验证失败 (HTTP ${t.status})`)}catch{a(`无法连接到服务器`)}finally{s(!1)}},[t,e]);return F(`div`,{className:`flex items-center justify-center min-h-screen bg-background`,children:I(B,{className:N(`w-full max-w-md mx-4`),children:[I(pn,{className:`text-center space-y-2`,children:[F(`div`,{className:`flex items-center justify-center mx-auto w-12 h-12 rounded-xl bg-foreground text-background font-bold text-xl`,children:`Z`}),F(mn,{className:`text-xl`,children:`Zhin.js 控制台`}),F(hn,{children:`请输入 API Token 以访问管理面板`})]}),F(V,{children:I(`form`,{onSubmit:e=>{e.preventDefault(),l()},className:`space-y-4`,children:[I(`div`,{className:`space-y-2`,children:[F(z,{type:`password`,placeholder:`API Token`,value:t,onChange:e=>{n(e.target.value),r&&a(``)},autoFocus:!0}),r&&F(`p`,{className:`text-sm text-destructive`,children:r})]}),F(R,{type:`submit`,className:`w-full`,disabled:o,children:o?`验证中...`:`登录`}),I(`p`,{className:`text-xs text-center text-muted-foreground`,children:[`Token 位于 `,F(`code`,{className:`text-xs bg-muted px-1 rounded`,children:`.env`}),` 文件的`,` `,F(`code`,{className:`text-xs bg-muted px-1 rounded`,children:`HTTP_TOKEN`}),` 中`]})]})})]})})}function Bs(e){return Bs=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Bs(e)}function Vs(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Hs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Us(e,t,n){return t&&Hs(e.prototype,t),n&&Hs(e,n),e}function Ws(e,t){return t&&(Bs(t)===`object`||typeof t==`function`)?t:Ks(e)}function Gs(e){return Gs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Gs(e)}function Ks(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function qs(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Js(e,t)}function Js(e,t){return Js=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Js(e,t)}function Ys(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xs=function(e){qs(t,e);function t(){var e,n;Vs(this,t);var r=[...arguments];return n=Ws(this,(e=Gs(t)).call.apply(e,[this].concat(r))),Ys(Ks(n),`state`,{bootstrapped:!1}),Ys(Ks(n),`_unsubscribe`,void 0),Ys(Ks(n),`handlePersistorState`,function(){n.props.persistor.getState().bootstrapped&&(n.props.onBeforeLift?Promise.resolve(n.props.onBeforeLift()).finally(function(){return n.setState({bootstrapped:!0})}):n.setState({bootstrapped:!0}),n._unsubscribe&&n._unsubscribe())}),n}return Us(t,[{key:`componentDidMount`,value:function(){this._unsubscribe=this.props.persistor.subscribe(this.handlePersistorState),this.handlePersistorState()}},{key:`componentWillUnmount`,value:function(){this._unsubscribe&&this._unsubscribe()}},{key:`render`,value:function(){return typeof this.props.children==`function`?this.props.children(this.state.bootstrapped):this.state.bootstrapped?this.props.children:this.props.loading}}]),t}(n);Ys(Xs,`defaultProps`,{children:null,loading:null});var Zs=kt.Provider;kt.Root,kt.Trigger;var Qs=e.forwardRef(({className:e,sideOffset:t=4,...n},r)=>F(kt.Portal,{children:F(kt.Content,{ref:r,sideOffset:t,className:N(`z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));Qs.displayName=`TooltipContent`,Yt();function $s(){let[e,t]=c(sn()),n=i(()=>t(!0),[]);return a(()=>{let e=()=>t(!1);return window.addEventListener(`zhin:auth-required`,e),()=>window.removeEventListener(`zhin:auth-required`,e)},[]),e?F(Xs,{loading:null,persistor:tt,children:F(Gt,{store:ot,children:F(ec,{})})}):F(zs,{onSuccess:n})}function ec(){ht();let e=mt(e=>e.script?.entries||[]),t=mt(e=>e.script?.loadedScripts||[]),n=mt(e=>e.script?.synced??!1),[r,i]=c(!1);a(()=>{[{key:`dashboardLayout`,path:`/`,title:`Dashboard`,element:F(fn,{}),meta:{order:0},children:[{key:`homePage`,path:`/dashboard`,title:`系统概览`,icon:F(de,{className:`w-4 h-4`}),element:F(bn,{}),meta:{group:`系统`,order:0}},{key:`botManagePage`,path:`/bots`,title:`机器人`,icon:F(h,{className:`w-4 h-4`}),element:F(ar,{}),meta:{group:`系统`,order:1}},{key:`logsPage`,path:`/logs`,title:`系统日志`,icon:F(ae,{className:`w-4 h-4`}),element:F(br,{}),meta:{group:`系统`,order:2,fullWidth:!0}},{key:`pluginsPage`,path:`/plugins`,title:`插件管理`,icon:F(j,{className:`w-4 h-4`}),element:F(Cn,{}),meta:{group:`扩展`,order:3}},{key:`pluginDetailPage`,title:`插件详情`,path:`/plugins/:name`,element:F(rr,{}),meta:{hideInMenu:!0}},{key:`configPage`,path:`/config`,title:`配置管理`,icon:F(Ne,{className:`w-4 h-4`}),element:F(ls,{}),meta:{group:`配置与数据`,order:4}},{key:`envManagePage`,path:`/env`,title:`环境变量`,icon:F(he,{className:`w-4 h-4`}),element:F(ps,{}),meta:{group:`配置与数据`,order:5}},{key:`fileManagePage`,path:`/files`,title:`文件管理`,icon:F(se,{className:`w-4 h-4`}),element:F(Ss,{}),meta:{group:`配置与数据`,order:6}},{key:`databasePage`,path:`/database`,title:`数据库`,icon:F(O,{className:`w-4 h-4`}),element:F(Rs,{}),meta:{group:`配置与数据`,order:7,fullWidth:!0}},{key:`botDetailPage`,path:`/bots/:adapter/:botId`,title:`机器人详情`,element:F(_r,{}),meta:{hideInMenu:!0,fullWidth:!0}}]}].forEach(e=>{et(e)}),i(!0)},[]);let o=n&&(e.length===0||e.length===t.length);return!r||!o?F(`div`,{className:`flex items-center justify-center h-screen bg-background`,children:I(`div`,{className:`text-center`,children:[F(`div`,{className:`inline-block animate-spin rounded-full h-8 w-8 border-2 border-muted-foreground border-t-foreground`}),I(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:[`加载中... (`,t.length,`/`,e.length,`)`]})]})}):F(Ze,{})}l(document.getElementById(`root`)).render(F(r,{children:F(Zs,{children:F($s,{})})}));
package/dist/index.html CHANGED
@@ -23,7 +23,7 @@
23
23
  }
24
24
  }
25
25
  </script>
26
- <script type="module" crossorigin src="/assets/index-COKXlFo2.js"></script>
26
+ <script type="module" crossorigin src="/assets/index-B1ihXBk4.js"></script>
27
27
  <link rel="stylesheet" crossorigin href="/assets/style-kkLO-vsa.css">
28
28
  </head>
29
29
  <body>
package/lib/index.js CHANGED
@@ -518,14 +518,14 @@ function setupWebSocket(webServer) {
518
518
  const message = JSON.parse(data.toString());
519
519
  await handleWebSocketMessage(ws, message, webServer);
520
520
  } catch (error) {
521
- console.error("WebSocket \u6D88\u606F\u5904\u7406\u9519\u8BEF:", error);
521
+ logger.error("WebSocket \u6D88\u606F\u5904\u7406\u9519\u8BEF:", error);
522
522
  ws.send(JSON.stringify({ error: "Invalid message format" }));
523
523
  }
524
524
  });
525
525
  ws.on("close", () => {
526
526
  });
527
527
  ws.on("error", (error) => {
528
- console.error("WebSocket \u9519\u8BEF:", error);
528
+ logger.error("WebSocket \u9519\u8BEF:", error);
529
529
  });
530
530
  });
531
531
  }
package/lib/websocket.js CHANGED
@@ -391,14 +391,14 @@ function setupWebSocket(webServer) {
391
391
  const message = JSON.parse(data.toString());
392
392
  await handleWebSocketMessage(ws, message, webServer);
393
393
  } catch (error) {
394
- console.error("WebSocket \u6D88\u606F\u5904\u7406\u9519\u8BEF:", error);
394
+ logger.error("WebSocket \u6D88\u606F\u5904\u7406\u9519\u8BEF:", error);
395
395
  ws.send(JSON.stringify({ error: "Invalid message format" }));
396
396
  }
397
397
  });
398
398
  ws.on("close", () => {
399
399
  });
400
400
  ws.on("error", (error) => {
401
- console.error("WebSocket \u9519\u8BEF:", error);
401
+ logger.error("WebSocket \u9519\u8BEF:", error);
402
402
  });
403
403
  });
404
404
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/console",
3
- "version": "1.0.56",
3
+ "version": "1.0.58",
4
4
  "description": "Web console service for Zhin.js with real-time monitoring",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -65,14 +65,14 @@
65
65
  "rolldown": "^1.0.0-rc.9",
66
66
  "vite": "8.0.0",
67
67
  "yaml": "^2.8.2",
68
- "zhin.js": "1.0.55"
68
+ "zhin.js": "1.0.56"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@types/ws": "^8.18.1",
72
72
  "@zhin.js/client": "^1.0.14",
73
- "@zhin.js/core": "^1.0.55",
74
- "@zhin.js/http": "^1.0.50",
75
- "zhin.js": "1.0.55"
73
+ "@zhin.js/core": "^1.0.56",
74
+ "@zhin.js/http": "^1.0.51",
75
+ "zhin.js": "1.0.56"
76
76
  },
77
77
  "files": [
78
78
  "src",
package/src/websocket.ts CHANGED
@@ -160,12 +160,12 @@ export function setupWebSocket(webServer: WebServer) {
160
160
  const message = JSON.parse(data.toString());
161
161
  await handleWebSocketMessage(ws, message, webServer);
162
162
  } catch (error) {
163
- console.error("WebSocket 消息处理错误:", error);
163
+ logger.error("WebSocket 消息处理错误:", error);
164
164
  ws.send(JSON.stringify({ error: "Invalid message format" }));
165
165
  }
166
166
  });
167
167
  ws.on("close", () => {});
168
- ws.on("error", (error) => { console.error("WebSocket 错误:", error); });
168
+ ws.on("error", (error) => { logger.error("WebSocket 错误:", error); });
169
169
  });
170
170
  }
171
171