Commit Graph

4789 Commits

Author SHA1 Message Date
手瓜一十雪
37fb2d68d7 Prefer QQAppId/ marker when parsing AppID
Some checks failed
Build NapCat Artifacts / Build-Framework (push) Has been cancelled
Build NapCat Artifacts / Build-Shell (push) Has been cancelled
Add parseAppidFromMajorV2 to napcat-common to scan a Major file for the "QQAppId/" marker and extract a null-terminated numeric AppID. Update qq-basic-info to import and prefer this new parser (falling back to the existing parseAppidFromMajor). Also correct the getMajorPath argument order when obtaining the major file path. This enables detection of AppID from a newer Major format while preserving legacy fallback behavior.
2026-02-08 09:55:31 +08:00
手瓜一十雪
a240f93784 Add appid entry for 9.9.27-45758
Add a new mapping to packages/napcat-core/external/appid.json for version 9.9.27-45758 (Windows). The entry sets appid to 537340213 and qua to "V1_WIN_NQ_9.9.27_45758_GW_B".
v4.15.18
2026-02-08 09:41:14 +08:00
时瑾
172a75b514 fix(webui-backend): sanitize plugin ID to prevent path injection (CodeQL js/path-injection)
Some checks failed
Build NapCat Artifacts / Build-Framework (push) Has been cancelled
Build NapCat Artifacts / Build-Shell (push) Has been cancelled
v4.15.17
2026-02-07 13:52:15 +08:00
时瑾
beef1233fa fix(ci): 修复 Update apifox 步骤中因 OpenAPI 文件过大导致的参数列表过长错误 v4.15.16 2026-02-07 13:44:25 +08:00
时瑾
8f69e2424a fix(backend): 修复插件列表接口新增字段导致的类型错误 v4.15.15 2026-02-07 13:38:53 +08:00
时瑾
f3156b1843 Merge branch 'main' of https://github.com/NapNeko/NapCatQQ v4.15.14 2026-02-07 13:32:58 +08:00
时瑾
61a16b44a4 style(webui): 优化插件商店与插件管理界面 UI/UX
- 重构插件卡片样式,采用毛玻璃效果与主题色交互
- 优化插件商店搜索栏布局,增加对顶部搜索及 Ctrl+F 快捷键的支持
- 实现智能头像提取逻辑,支持从 GitHub、自定义域名(Favicon)及 Vercel 自动生成
- 增加插件描述溢出预览(悬停提示及点击展开功能)
- 修复标签溢出处理,支持 Tooltip 完整显示
- 增强后端插件列表 API,支持返回主页及仓库信息
- 修复部分类型错误与代码规范问题
2026-02-07 13:30:50 +08:00
Nepenthe
7b17ef44dd Merge pull request #1598 from faithleysath/feat/schema-enhancement-refactor
refactor(schema): 重构 schema 组件引用与 OpenAPI 生成流程,并补齐消息 union 类型
2026-02-07 13:27:58 +08:00
吴天一
2c166299a3 fix(schema): 添加 data 字段描述到 BaseResponseSchema 2026-02-07 13:21:06 +08:00
吴天一
75d2611eda fix(schema): 将响应 data 字段标记为必填 2026-02-07 09:27:47 +08:00
吴天一
e2d2e65620 fix(schema): 修复 properties 容器误判导致错误注入 type 2026-02-06 21:37:50 +08:00
吴天一
f479fccf3e refactor(schema): 提取并复用 OpenAPI 响应示例,减少重复定义
在 napcat-schema 中引入 ActionExamples,统一复用公共错误示例定义。

新增默认成功示例 Success_Default,并注册到 components.examples。

将公共错误示例(1400/1401/1404)集中注册到 components.examples,统一响应示例来源。

优化 buildResponseExamples:当 returnExample 为 null、空对象或空数组时,自动引用默认成功示例;当错误示例命中公共定义时,优先使用  引用组件示例,未命中时保持内联示例。

未提供 errorExamples 时,默认引用 #/components/examples/Error_1400,减少重复定义并提升文档一致性。

本次变更不改变接口响应结构,主要改进 OpenAPI 示例复用策略与文档可维护性。
2026-02-06 17:07:24 +08:00
吴天一
45652612b4 refactor(schema): 重构消息 schema 与 OpenAPI 生成流程
- 为 OneBot action 相关对象补充稳定 $id,提升 schema 复用与组件引用能力
- 补齐消息联合类型,纳入 location/xml/miniapp 等消息段定义
- 重构 napcat-schema 中 OpenAPI 生成逻辑,优化组件注册与缺失项报告
- openapi schema 文件行数从 36433 缩减到 23137(减少 13296 行,约 36.5%)
- 统一 schema 结构与描述,降低后续扩展与文档生成维护成本
2026-02-06 16:12:34 +08:00
pohgxz
54266f97f8 fix: 尝试修复 Update apifox 错误
Some checks failed
Build NapCat Artifacts / Build-Framework (push) Has been cancelled
Build NapCat Artifacts / Build-Shell (push) Has been cancelled
2026-02-05 22:47:02 +08:00
手瓜一十雪
687a5f5708 Update ffmpeg native addon binaries
feat: ogg opus格式支持 fix #1593
v4.15.13
2026-02-05 22:00:12 +08:00
手瓜一十雪
3dab2b4361 Update appid for 3.2.25-45758
Correct the appid entry in packages/napcat-core/external/appid.json for version 3.2.25-45758, changing it from 537314197 to 537340249 to ensure the build is identified correctly. (File now lacks a trailing newline.)
v4.15.12
2026-02-05 20:28:11 +08:00
006lp
74be268dbe Update appid and qua for version 3.2.25-45758 (#1596)
Signed-off-by: 006lp <144674902+006lp@users.noreply.github.com>
2026-02-05 20:27:53 +08:00
手瓜一十雪
8b3f60628e Bump appid entry to 3.2.25-45758
Rename the object key in packages/napcat-core/external/appid.json from "3.2.25-45627" to "3.2.25-45758" to register the new build. The appid (537340249) and qua string were not modified in this change; please verify whether the qua should also be updated to match the new build identifier.
v4.15.11 v4.14.9
2026-02-05 20:13:48 +08:00
手瓜一十雪
f0eb6379c1 Add Linux appid 3.2.25-45627
Add a new entry to packages/napcat-core/external/appid.json for version 3.2.25-45627 with appid 537340249 and qua "V1_LNX_NQ_3.2.25_45627_GW_B". This registers the Linux build identifier in the appid mapping.
v4.15.8
2026-02-05 20:05:35 +08:00
手瓜一十雪
f3e24811ad Simplify QQ/Node download in release workflow
Merge and simplify the QQ and Node.js download steps in .github/workflows/release.yml: remove the actions/cache step and related QQ cache logic, always download the QQ x64 installer directly, and assemble/extract using a single temporary directory (TMPDIR). Also rename the step to "Download and Assemble NapCat.Shell.Windows.Node.zip" and switch NODE_EXTRACT to use TMPDIR instead of WORK_TMPDIR. This reduces workflow complexity and avoids maintaining a local cache for the QQ installer.
2026-02-05 18:40:47 +08:00
Qiao
ecbac2b782 fix(webui): 修复 Toast 提示信息过长导致 UI 溢出的问题 (#1595)
- 新增路径截断工具函数,支持 Windows/Linux 长路径处理

- 创建 toast 包装器,自动截断错误信息中的长路径

- 为 Toaster 组件添加 maxWidth 和 word-break 样式防止溢出

- 更新插件配置弹窗使用新的 toast 工具
v4.15.6
2026-02-05 18:22:25 +08:00
手瓜一十雪
49b5496406 Revert "Lower NTQQ build check from 41679 to 39038"
This reverts commit 280aac5c75.
v4.15.5
2026-02-05 18:03:29 +08:00
pohgxz
dc8b85da1c feat: 自动更新apifox
Some checks are pending
Build NapCat Artifacts / Build-Framework (push) Waiting to run
Build NapCat Artifacts / Build-Shell (push) Waiting to run
2026-02-05 12:56:53 +08:00
手瓜一十雪
b862b2fa1c Add mappings for 3.2.25 and 9.9.27 builds
Update external mapping files to include new build entries. Added send/recv addresses for 3.2.25-45758 (x64 and arm64) and 9.9.27-45758-x64 in packages/napcat-core/external/napi2native.json and packages/napcat-core/external/packet.json. No functional code changes — just registry updates for new builds.
2026-02-05 11:29:49 +08:00
Qiao
39a2a4028b feat(webui): 添加QQ掉线时重启进程提示
- 后端 CheckLoginStatus API 新增 isOffline 字段区分掉线与未登录状态
- 后端 GetQQLoginInfo API 新增返回 online 和 avatarUrl 字段
- 前端掉线时弹窗提示用户是否重启进程
- 修正 isLogin 类型从 string 改为 boolean
2026-02-05 11:07:02 +08:00
手瓜一十雪
29d7b95d05 Add codeString prop to Snippet for formatted JSON
Pass JSON.stringify(...) as the codeString prop to Snippet so structured message/response objects are rendered as pretty-printed JSON and can be copied via the tooltip. Changes applied in show_structed_message.tsx, display_card/render.tsx, and display_card/response.tsx.
2026-02-04 12:33:18 +08:00
手瓜一十雪
280aac5c75 Lower NTQQ build check from 41679 to 39038
Update NTQQFriendApi to use a lower minimum NTQQ build threshold (39038) when deciding which buddyListV2 API path to call. The change replaces occurrences of '41679' with '39038' in packages/napcat-core/apis/friend.ts (affecting getBuddyV2SimpleInfoMap and the buddyListV2 retrieval logic) to broaden compatibility with older NTQQ builds.
2026-02-03 22:56:12 +08:00
手瓜一十雪
67dc41bbd2 Improve extension tab UI and add /plugin proxy
Update dashboard extension UI to prevent title overflow: add truncate and max-width to the tab title, include the plugin name in the title tooltip, and hide the plugin-name label on small screens (visible from md+). Also add a '/plugin' proxy entry to the Vite dev server config so plugin requests are forwarded to the backend debug URL.
2026-02-03 18:58:40 +08:00
手瓜一十雪
24c832be16 refactor: serviceworker
重构sw.js,实现更智能的缓存,根据路由设计缓存
2026-02-03 18:09:12 +08:00
手瓜一十雪
2fcc5c74d3 Add externalVersion and refine API types
Add externalVersion boolean to LoginInitConfig and pass false at initialization; bump appid qua for 9.9.27 entry. Refine several IPC/wrapper typings to use Promise return types, adjust pathIsReadableAndWriteable signature to accept a type and return Promise<number>, and update NodeIKernelNodeMiscService method signatures (styling) while adding getQimei36WithNewSdk(). These changes improve type accuracy for async/native calls and add a new SDK helper.
2026-02-03 15:59:31 +08:00
手瓜一十雪
029feaa51a Cache QQ installer and handle win64 files
Update GitHub Actions release workflow to use a cached QQ x64 installer (updated NT_URL), add cache key generation and actions/cache usage, and implement a download-and-extract step that reuses the cache. Adjust temporary directory usage (WORK_TMPDIR/NODE_EXTRACT), add LightQuic.dll to copy targets, and copy specific win64 files into an OUT_DIR/win64 folder.

Update packages/napcat-develop/loadNapCat.cjs to recognize and copy win64 artifacts: add TARGET_WIN64_DIR, include LightQuic.dll, define win64ItemsToCopy (SSOShareInfoHelper64.dll, parent-ipc-core-x64.dll), validate their presence, ensure target directories, and copy win64 files into dist/win64. These changes speed CI by caching the installer and ensure required win64 DLLs are packaged alongside the main distribution.
2026-02-03 15:28:13 +08:00
Qiao
d2734234e8 style(webui): 优化插件商店样式,使用固定头部 (#1585)
* fix: 修复 qq_login.tsx 类型错误

- onSelectionChange 的 key 参数可能为 null,添加空值检查

* style(webui): refactor plugin store layout with sticky header
2026-02-03 14:23:13 +08:00
Qiao
21d5652924 fix: 插件更新时保留 data 文件夹 (#1584)
* fix: 修复 qq_login.tsx 类型错误

- onSelectionChange 的 key 参数可能为 null,添加空值检查

* fix: 插件更新时保留 data 文件夹

- 更新插件时备份 data 文件夹,解压后恢复

- 添加异常处理,确保解压失败时也能恢复 data 文件夹
2026-02-03 09:55:21 +08:00
手瓜一十雪
168447dcbc Add password login support to web UI and backend
Implement password-based QQ login across the stack: add a PasswordLogin React component, integrate it into the QQ login page, and add a frontend controller method to call a new /QQLogin/PasswordLogin API. On the backend, add QQPasswordLoginHandler, router entry, and WebUiDataRuntime hooks (setPasswordLoginCall / requestPasswordLogin) plus a default handler. Register a password login callback in the shell (base.ts) that calls the kernel login service, handles common error cases and falls back to QR code when needed. Update types to include onPasswordLoginRequested and adjust NodeIKernelLoginService method signatures (including passwordLogin return type changed to Promise<QuickLoginResult>) and minor formatting fixes.
2026-02-02 19:48:31 +08:00
手瓜一十雪
0fd1a32293 Add plugin no-auth API routes and WebUI handling
Introduce support for plugin API routes that do not require WebUI authentication. Updates include:

- napcat-onebot: Add apiNoAuth route storage and helpers (apiNoAuth, getNoAuth, postNoAuth, putNoAuth, deleteNoAuth), hasApiNoAuthRoutes, buildApiNoAuthRouter, and clear handling in PluginRouterRegistryImpl.
- napcat-onebot types: Extend PluginRouterRegistry interface with no-auth API methods and document that authenticated APIs remain separate.
- napcat-webui-backend: Mount a new unauthenticated plugin route handler at /plugin/:pluginId/api that looks up the plugin router and dispatches requests to the plugin's no-auth router, returning appropriate errors when context or routes are missing.
- napcat-plugin-builtin: Add example no-auth endpoints (public/info and health) and update logger messages to reflect both auth and no-auth API paths.
- Bump napcat-types version to 0.0.16 and update napcat-plugin-builtin dependency accordingly.

These changes enable plugins to expose public endpoints (e.g. health checks or public metadata) under /plugin/{pluginId}/api/ while keeping existing authenticated APIs under /api/Plugin/ext/{pluginId}/.
2026-02-02 19:13:01 +08:00
手瓜一十雪
ba473d57f0 Cache object properties to avoid extra RPC
Serialize non-function properties of server-side objects as cachedProps so simple property reads don't require additional RPCs. Added cachedProps to SerializedValue, have RpcServer.storeObjectRef serialize and attach cachedProps (skipping functions), updated serializer to deserialize cachedProps and pass them to proxyCreator, and updated client proxy creation to accept cachedProps and return cached top-level properties directly. Tests updated to expect direct property access for serialized/simple objects and arrays.
2026-02-02 18:59:23 +08:00
手瓜一十雪
a27df71f5d Support object references and deep proxying
Introduce remote object references (refId) and deep proxy support across client, server, serializer and types. Key changes:

- Add refId propagation in client proxies so child proxies inherit and include refId on RPC requests.
- Extend serializer to handle a new SerializedValueType.OBJECT_REF, add refResolver and pass refId to proxyCreator.
- Server: store object references in a Map with generated ref IDs, resolve paths with optional refId, serialize results to OBJECT_REF when shouldProxyResult returns true, and release cleans up references. Add defaultShouldProxyResult heuristic to decide which return values should remain proxied (class instances and objects with methods).
- Types: add refId fields and ObjectRef shape, expose shouldProxyResult option on RpcServerOptions, and include refId in ProxyMeta and serialized values.
- Tests updated across the suite to expect proxied return values (arrays/objects/class instances) and to await property access or method calls; add comprehensive tests for deep return value proxying, chained calls, callbacks, constructors on returned proxies, and lifecycle of remote object proxies.

These changes enable returning live/proxied remote objects (including class instances and objects with methods) from RPC calls, preserving remote behavior and allowing subsequent operations to target the same server-side object.
2026-02-02 18:43:37 +08:00
手瓜一十雪
fa74176160 Add napcat-rpc package with deep RPC
Introduce a new napcat-rpc package implementing a deep-proxy RPC system. Adds client (createDeepProxy, proxy helpers), server (RpcServer, createRpcServer), serializer (serialize/deserialize, callback registry), and transport layers (LocalTransport, MessageTransport, message server handler), plus an easy API (createRpcPair, mockRemote, createServer, createClient). Includes TypeScript types, tsconfig and package.json. Wire-up: add package alias in napcat-schema vite config and add napcat-rpc dependency to napcat-test along with comprehensive rpc tests.
2026-02-02 17:12:05 +08:00
手瓜一十雪
bcf985f92c Validate pluginId and use localStorage token
Return a 400 error when the /call-plugin/:pluginId route is requested without a pluginId to avoid calling getPluginExports with an undefined id (packages/napcat-plugin-builtin/index.ts).

Update the dashboard UI to read the auth token from localStorage (same-origin) instead of relying on a URL parameter; a comment about legacy webui_token in the URL was added while the implementation currently prefers localStorage.getItem('token') (packages/napcat-plugin-builtin/webui/dashboard.html).
2026-02-02 16:17:03 +08:00
手瓜一十雪
f6cca2b858 Expose plugin pages at /plugin/:id/page/:path
Add a public route to serve plugin extension pages without auth and update related pieces accordingly. Backend: register GET /plugin/:pluginId/page/:pagePath to locate the plugin router, validate page and HTML file existence, and send the file (returns appropriate 4xx/5xx errors). Frontend: switch iframe and new-window URLs to the new unauthenticated route (remove webui_token usage). Builtin plugin: clarify page registration comment and add a log line for the extension page URL. Minor formatting whitespace tweaks in plugin manager type annotations.
2026-02-02 15:40:18 +08:00
手瓜一十雪
e7e31972e5 Bump napcat-types & add plugin static/memory tests
Upgrade napcat-types to v0.0.15 and update the built-in plugin UI to test both filesystem and in-memory static resources. dashboard.html: clarify which plugin endpoints require auth, add buttons and a testMemoryResource() function that fetches an in-memory JSON resource, and add staticBase/memBase variables for non-auth static routes. napcat-webui-backend: return after 404 for missing memory files to stop further handling. (Lockfile updated accordingly.)
2026-02-02 15:35:26 +08:00
手瓜一十雪
610e19e34c Support memory static files and plugin APIs
Introduce in-memory static file support and inter-plugin exports. Add MemoryStaticFile/MemoryFileGenerator types and expose staticOnMem in PluginRouterRegistry; router registry now tracks memory routes and exposes getters. Add getPluginExports to plugin manager adapters to allow plugins to call each other's exported modules. WebUI backend gains routes to serve /plugin/:pluginId/mem/* (memory files) and /plugin/:pluginId/files/* (plugin filesystem static) without auth. Update builtin plugin to demonstrate staticOnMem and inter-plugin call, and add frontend UI to open extension pages in a new window. Note: API router no longer mounts static filesystem routes — those are handled by webui-backend.
2026-02-02 15:01:26 +08:00
手瓜一十雪
3a841ed0f1 Add image-size alias to napcat-schema vite config
Add a new Vite path alias '@/napcat-image-size' in packages/napcat-schema/vite.config.ts pointing to ../napcat-image-size. This enables cleaner imports of the napcat-image-size package from within napcat-schema source files.
2026-02-02 14:15:27 +08:00
手瓜一十雪
5fac30afd8 fix: #1574 & Clear CJS cache and reload plugins on install
Add support for clearing CommonJS module cache when unloading plugins and reload plugins on install. PluginLoader now uses createRequire to access require.cache and exposes clearCache(pluginPath) to remove cached modules under the plugin directory; plugin manager calls this when unloading. Web UI backend install handlers now reload an existing plugin (with progress updates) instead of skipping registration, ensuring updated code/metadata take effect.
2026-02-02 14:14:06 +08:00
手瓜一十雪
d4fee6798c Ignore env file and db-shm in .gitignore
Add packages/napcat-develop/config/.env to .gitignore to prevent committing environment configuration, and restore the guild1.db-shm entry (fix EOF/newline).
2026-02-02 13:22:29 +08:00
手瓜一十雪
08ff669042 Rename .env to .env.example
Rename the tracked dotenv file to .env.example (identical content) to avoid committing environment secrets and provide a template/example for project configuration.
2026-02-02 13:21:34 +08:00
手瓜一十雪
41bab4fabb Replace Type.Void() with Type.Object({})
Replace Type.Void() payload/return schemas with Type.Object({}) in several OneBot action extensions to represent empty object schemas and avoid void-type validation issues. Updated files: BotExit (payload & return), GetClientkey, GetFriendWithCategory, GetGroupAddRequest, GetRkey, GetRobotUinRange, GetUnidirectionalFriendList.
2026-02-02 13:17:06 +08:00
手瓜一十雪
870db6c4ce Rename image-size alias to napcat-image-size
Update Vite path alias from '@/image-size' to '@/napcat-image-size' in napcat-framework and napcat-shell vite.config.ts files to match the package directory ../napcat-image-size and ensure consistent import paths.
2026-02-01 17:46:40 +08:00
手瓜一十雪
b8c8df8a45 Add TIFF parser and buffer-based image size APIs
Introduce a TIFF parser and integrate it into the image detection/size parsing pipeline. Add buffer-based APIs (detectImageTypeFromBuffer, imageSizeFromBuffer, imageSizeFromBufferFallBack) and a helper to convert Buffer to a Readable stream; refactor parser registry into a type-to-parser map and a first-byte fast-path map for quicker detection. Harden WebP parsing with safer length checks. Add sample image resources and a comprehensive Vitest test suite (packages/napcat-test) with updated package dependency and resolve aliases. pnpm-lock updated to link the new package.
2026-02-01 17:42:58 +08:00
手瓜一十雪
7bc3b3cc46 Split image parsers into separate files
Move PNG/JPEG/BMP/GIF/WEBP parser implementations out of index.ts into dedicated files under packages/napcat-image-size/src/parser. Export ImageParser and matchMagic from index.ts, import the new BmpParser, GifParser, JpegParser, PngParser and WebpParser classes, and update the parsers array to instantiate those classes. Keeps existing parsing logic and stream-based size detection while cleaning up index.ts for modularity.
2026-02-01 17:13:19 +08:00