Compare commits

...
7 Commits
Author SHA1 Message Date
手瓜一十雪 484c181050 Set rootDir in package tsconfigs
Release Tag / validate-version (push) Canceled after 0s
Release Tag / trigger-release (push) Canceled after 0s
Add compilerOptions.rootDir = ".." to tsconfig.json for napcat-onebot, napcat-shell, and napcat-webui-backend to ensure the TypeScript compiler uses the monorepo package root for source resolution. Also remove an extraneous blank line in theme.tsx near FileManager.uploadWebUIFont (minor formatting cleanup).
2026-05-22 22:31:11 +08:00
手瓜一十雪 9d652be35d fix: #1774 2026-05-22 22:27:19 +08:00
手瓜一十雪 f226c83595 Skip pnpm install scripts; defer QR code fetch & fix #1804
CI: use `pnpm i --ignore-scripts` in release-publish workflow to avoid running package install scripts during CI.

Shell: defer showing the QR code until after attempting WebUi quick-login/password fallback. Adds checks for NAPCAT_QUICK_ACCOUNT and quick-password env vars (and WebUi quick-login list), runs WebUi quick config, and only calls getQRCodePicture() if no fallback was attempted and the user is not logged in. Includes error handling for the quick-login attempt.
2026-05-22 22:23:45 +08:00
手瓜一十雪 b565f876c5 Merge branch 'main' of https://github.com/NapNeko/NapCatQQ 2026-05-22 22:12:05 +08:00
手瓜一十雪 19a5febb1a fix: #1827 2026-05-22 22:06:00 +08:00
Copilotandsj817 bbf822035f fix: restart HTTP server when host changes (#1836)
* Initial plan

* fix: restart HTTP server when host changes

Agent-Logs-Url: https://github.com/NapNeko/NapCatQQ/sessions/0ead0c47-df0d-4666-8877-775c9c641ed8

Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
2026-05-22 22:05:23 +08:00
手瓜一十雪 a2b0ac10a0 fix: #1843 2026-05-22 22:02:38 +08:00
12 changed files with 73 additions and 17 deletions

No files matched your search

+1 -1
View File
@@ -419,7 +419,7 @@ jobs:
APIFOX_TOKEN: ${{ secrets.APIFOX_TOKEN }}
run: |
npm i -g pnpm
pnpm i
pnpm i --ignore-scripts
pnpm run build:openapi
jq -n --rawfile input packages/napcat-schema/dist/openapi.json \
@@ -373,8 +373,19 @@ export class PacketOperationContext {
return element;
})
);
const isGroup = msg?.responseHead.grp !== undefined;
const peerUin = isGroup
? String(msg?.responseHead.grp?.groupUin ?? 0)
: String(msg?.responseHead.fromUin ?? 0);
const peerUid = isGroup
? String(msg?.responseHead.grp?.groupUin ?? 0)
: String(msg?.responseHead.fromUid ?? '');
const sendNickName = isGroup
? (msg?.responseHead.grp?.memberName ?? '')
: (msg?.responseHead.forward?.friendName ?? '');
return {
chatType: ChatType.KCHATTYPEGROUP,
chatType: isGroup ? ChatType.KCHATTYPEGROUP : ChatType.KCHATTYPEC2C,
elements,
guildId: '',
isOnlineMsg: false,
@@ -385,18 +396,18 @@ export class PacketOperationContext {
msgType: NTMsgType.KMSGTYPEMIX,
parentMsgIdList: [],
parentMsgPeer: {
chatType: ChatType.KCHATTYPEGROUP,
peerUid: String(msg?.responseHead.grp?.groupUin ?? 0),
chatType: isGroup ? ChatType.KCHATTYPEGROUP : ChatType.KCHATTYPEC2C,
peerUid,
},
peerName: '',
peerUid: '1094950020',
peerUin: '1094950020',
peerUid,
peerUin,
recallTime: '0',
records: [],
sendNickName: msg?.responseHead.grp?.memberName ?? '',
sendRemarkName: msg?.responseHead.grp?.memberName ?? '',
senderUid: '',
senderUin: '1094950020',
sendNickName,
sendRemarkName: sendNickName,
senderUid: msg?.responseHead.fromUid ?? '',
senderUin: String(msg?.responseHead.fromUin ?? 0),
sourceType: MsgSourceType.K_DOWN_SOURCETYPE_UNKNOWN,
subMsgType: 1,
};
+3
View File
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".."
},
"include": [
"*.ts",
"**/*.ts"
+3
View File
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".."
},
"include": [
"*.ts",
"**/*.ts"
@@ -307,6 +307,7 @@ export class OB11HttpServerAdapter extends IOB11NetworkAdapter<HttpServerConfig>
async reload (newConfig: HttpServerConfig) {
const wasEnabled = this.isEnable;
const oldPort = this.config.port;
const oldHost = this.config.host;
const oldEnableWebsocket = this.config.enableWebsocket;
this.config = newConfig;
@@ -318,7 +319,7 @@ export class OB11HttpServerAdapter extends IOB11NetworkAdapter<HttpServerConfig>
return OB11NetworkReloadType.NetWorkClose;
}
if (oldPort !== newConfig.port || oldEnableWebsocket !== newConfig.enableWebsocket) {
if (oldPort !== newConfig.port || oldHost !== newConfig.host || oldEnableWebsocket !== newConfig.enableWebsocket) {
this.close();
if (newConfig.enable) {
this.open();
+3
View File
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "../../packages"
},
"include": [
"*.ts",
"**/*.ts"
+12 -2
View File
@@ -483,17 +483,27 @@ async function handleLoginInner (context: { isLogined: boolean; }, logger: LogWr
} else {
logger.log('没有 -q 指令指定快速登录,将使用二维码登录方式');
if (historyLoginList.length > 0) {
logger.log(`可用于快速登录的 QQ:\n${historyLoginList
logger.log(`可用于快速登录 of QQ:\n${historyLoginList
.map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`)
.join('\n')
}`);
}
loginService.getQRCodePicture();
let hasAttemptedFallback = false;
try {
// 检查是否配置了自动登录账号,并尝试 WebUi 快速/密码回退登录。
// 这可以避免在已经有自动登录配置的情况下过早输出二维码。
const quickLoginList = WebUiDataRuntime.getQQQuickLoginList() || [];
const hasAutoLogin = process.env['NAPCAT_QUICK_ACCOUNT'] || (quickLoginList.length > 0); // 假如有历史登录列表
if (hasAutoLogin || process.env['NAPCAT_QUICK_PASSWORD'] || process.env['NAPCAT_QUICK_PASSWORD_MD5']) {
hasAttemptedFallback = true;
}
await WebUiDataRuntime.runWebUiConfigQuickFunction();
} catch (error) {
logger.logError('WebUi 快速登录失败 执行失败', error);
}
if (!hasAttemptedFallback && !context.isLogined) {
loginService.getQRCodePicture();
}
}
loginService.getLoginList().then((res) => {
+3
View File
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".."
},
"include": [
"*.ts",
"**/*.ts"
@@ -40,6 +40,7 @@ interface UpdateConfig {
const SKIP_UPDATE_FILES = [
'NapCatWinBootMain.exe',
'NapCatWinBootHook.dll',
'quickLoginExample.bat',
];
// 更新时若文件已存在则保留(不覆盖)的用户配置文件(使用相对路径精确匹配)
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".."
},
"include": [
"*.ts",
"src/**/*.ts",
@@ -92,7 +92,7 @@ const BackupConfigCard: React.FC = () => {
onPress={handleExportConfig}
title='导出配置'
>
<LuDownload size={20} />
<LuUpload size={20} />
</Button>
<label className='cursor-pointer'>
<input
@@ -108,7 +108,7 @@ const BackupConfigCard: React.FC = () => {
as='span'
title='导入配置'
>
<LuUpload size={20} />
<LuDownload size={20} />
</Button>
</label>
</div>
@@ -436,15 +436,33 @@ const ThemeConfigCard = () => {
}
}
await FileManager.uploadWebUIFont(file);
toast.success('上传成功,即将刷新页面');
// 先自动把选择的字体模式设置为 custom,并保存配置,避免刷新后又变成了旧的/没保存的模式
const updatedTheme = { ...theme, fontMode: 'custom' };
await WebUIManager.setThemeConfig(updatedTheme);
originalDataRef.current = updatedTheme;
updateFontCache('custom');
setHasUnsavedChanges(false);
loadTheme();
toast.success('上传并保存成功,即将刷新页面');
setTimeout(() => window.location.reload(), 1000);
} catch (error) {
toast.error('上传失败: ' + (error as Error).message);
toast.error('上传或保存失败: ' + (error as Error).message);
}
}}
onDelete={async () => {
try {
await FileManager.deleteWebUIFont();
// 删除字体后,若当前选中的是自定义字体,则将其重置为系统默认(或其它)并保存,以防页面报错
if (theme.fontMode === 'custom') {
const updatedTheme = { ...theme, fontMode: 'system' };
await WebUIManager.setThemeConfig(updatedTheme);
originalDataRef.current = updatedTheme;
updateFontCache('system');
setHasUnsavedChanges(false);
loadTheme();
}
toast.success('删除成功,即将刷新页面');
setTimeout(() => window.location.reload(), 1000);
} catch (error) {