Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af8005dd6f | ||
|
|
6e8adad7ca | ||
|
|
0f8584b8e1 | ||
|
|
37f40a2635 | ||
|
|
1b4d604e32 | ||
|
|
81a0c07922 | ||
|
|
a8cb6b5865 | ||
|
|
d25bd65b2d | ||
|
|
e510a75f0c | ||
|
|
e3c6048a7f | ||
|
|
789c72d4cf | ||
|
|
711a060dd9 | ||
|
|
6268923f01 | ||
|
|
f6b9017429 |
No files matched your search
@@ -80,4 +80,17 @@ jobs:
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $GH_TOKEN" \
|
||||
https://api.github.com/repos/NapNeko/NapCatLinuxNodeLoader/actions/workflows/release.yml/dispatches \
|
||||
-d "{\"ref\":\"main\",\"inputs\":{\"napcat_version\":\"${NAPCAT_VERSION}\",\"qq_url_amd64\":\"${QQ_VERSION_X86_64}\",\"qq_url_arm64\":\"${QQ_VERSION_ARM64}\"}}"
|
||||
- name: Trigger Release NapCat AppImage Workflow
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.NAPCAT_BUILD }}
|
||||
NAPCAT_VERSION: ${{ env.latest_tag }}
|
||||
QQ_VERSION_X86_64: 'https://dldir1v6.qq.com/qqfile/qq/QQNT/94704804/linuxqq_3.2.23-44343_x86_64.AppImage' # 写死 QQ 版本
|
||||
QQ_VERSION_ARM64: 'https://dldir1v6.qq.com/qqfile/qq/QQNT/94704804/linuxqq_3.2.23-44343_arm64.AppImage' # 写死 QQ 版本
|
||||
run: |
|
||||
echo "Debug: Triggering Release NapCat AppImage with napcat_version=${NAPCAT_VERSION}, qq_url_amd64=${QQ_VERSION_X86_64}, qq_url_arm64=${QQ_VERSION_ARM64}"
|
||||
curl -X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $GH_TOKEN" \
|
||||
https://api.github.com/repos/NapNeko/NapCatLinuxNodeLoader/actions/workflows/docker-publish.yml/dispatches \
|
||||
-d "{\"ref\":\"main\",\"inputs\":{\"napcat_version\":\"${NAPCAT_VERSION}\",\"qq_url_amd64\":\"${QQ_VERSION_X86_64}\",\"qq_url_arm64\":\"${QQ_VERSION_ARM64}\"}}"
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -587,15 +587,33 @@ export class OneBotMsgApi {
|
||||
return at(atQQ, uid, NTMsgAtType.ATTYPEONE, info.nick || '');
|
||||
},
|
||||
|
||||
[OB11MessageDataType.reply]: async ({ data: { id } }) => {
|
||||
const replyMsgM = MessageUnique.getMsgIdAndPeerByShortId(parseInt(id));
|
||||
if (!replyMsgM) {
|
||||
this.core.context.logger.logWarn('回复消息不存在', id);
|
||||
[OB11MessageDataType.reply]: async ({ data: { id, seq } }, context) => {
|
||||
let replyMsg: RawMessage | undefined;
|
||||
let replyMsgPeer: Peer | undefined;
|
||||
|
||||
// 优先使用 seq
|
||||
if (seq) {
|
||||
const msgList = (await this.core.apis.MsgApi.getMsgsBySeqAndCount(
|
||||
context.peer, seq.toString(), 1, true, true
|
||||
)).msgList;
|
||||
replyMsg = msgList[0];
|
||||
replyMsgPeer = context.peer;
|
||||
} else if (id) {
|
||||
// 降级使用 id
|
||||
const replyMsgM = MessageUnique.getMsgIdAndPeerByShortId(parseInt(id));
|
||||
if (!replyMsgM) {
|
||||
this.core.context.logger.logWarn('回复消息不存在', id);
|
||||
return undefined;
|
||||
}
|
||||
replyMsg = (await this.core.apis.MsgApi.getMsgsByMsgId(
|
||||
replyMsgM.Peer, [replyMsgM.MsgId])).msgList[0];
|
||||
replyMsgPeer = replyMsgM.Peer;
|
||||
} else {
|
||||
this.core.context.logger.logWarn('回复消息缺少id或seq参数');
|
||||
return undefined;
|
||||
}
|
||||
const replyMsg = (await this.core.apis.MsgApi.getMsgsByMsgId(
|
||||
replyMsgM.Peer, [replyMsgM.MsgId])).msgList[0];
|
||||
return replyMsg
|
||||
|
||||
return replyMsg && replyMsgPeer
|
||||
? {
|
||||
elementType: ElementType.REPLY,
|
||||
elementId: '',
|
||||
@@ -605,7 +623,7 @@ export class OneBotMsgApi {
|
||||
senderUin: replyMsg.senderUin,
|
||||
senderUinStr: replyMsg.senderUin,
|
||||
replyMsgClientSeq: replyMsg.clientSeq,
|
||||
_replyMsgPeer: replyMsgM.Peer,
|
||||
_replyMsgPeer: replyMsgPeer,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
|
||||
@@ -103,7 +103,7 @@ export interface OB11MessageText {
|
||||
}
|
||||
|
||||
// 联系人消息接口定义
|
||||
export interface OB11MessageContext {
|
||||
export interface OB11MessageContact {
|
||||
type: OB11MessageDataType.contact;
|
||||
data: {
|
||||
type: 'qq' | 'group';
|
||||
@@ -159,7 +159,8 @@ export interface OB11MessageAt {
|
||||
export interface OB11MessageReply {
|
||||
type: OB11MessageDataType.reply;
|
||||
data: {
|
||||
id: string;
|
||||
id?: string; // msg_id 的短ID映射
|
||||
seq?: number; // msg_seq,优先使用
|
||||
};
|
||||
}
|
||||
|
||||
@@ -260,7 +261,7 @@ export type OB11MessageData =
|
||||
OB11MessageAt | OB11MessageReply |
|
||||
OB11MessageImage | OB11MessageRecord | OB11MessageFile | OB11MessageVideo |
|
||||
OB11MessageNode | OB11MessageIdMusic | OB11MessageCustomMusic | OB11MessageJson |
|
||||
OB11MessageDice | OB11MessageRPS | OB11MessageMarkdown | OB11MessageForward | OB11MessageContext | OB11MessagePoke;
|
||||
OB11MessageDice | OB11MessageRPS | OB11MessageMarkdown | OB11MessageForward | OB11MessageContact | OB11MessagePoke;
|
||||
|
||||
// 发送消息接口定义
|
||||
export interface OB11PostSendMsg {
|
||||
|
||||
@@ -35,6 +35,7 @@ import { proxiedListenerOf } from '@/napcat-core/helper/proxy-handler';
|
||||
import { QQBasicInfoWrapper } from '@/napcat-core/helper/qq-basic-info';
|
||||
import { statusHelperSubscription } from '@/napcat-core/helper/status';
|
||||
import { applyPendingUpdates } from '@/napcat-webui-backend/src/api/UpdateNapCat';
|
||||
import { connectToNamedPipe } from './pipe';
|
||||
// NapCat Shell App ES 入口文件
|
||||
async function handleUncaughtExceptions (logger: LogWrapper) {
|
||||
process.on('uncaughtException', (err) => {
|
||||
@@ -342,9 +343,9 @@ export async function NCoreInitShell () {
|
||||
// 初始化 FFmpeg 服务
|
||||
await FFmpegService.init(pathWrapper.binaryPath, logger);
|
||||
|
||||
// if (process.env['NAPCAT_DISABLE_PIPE'] !== '1') {
|
||||
// await connectToNamedPipe(logger).catch(e => logger.logError('命名管道连接失败', e));
|
||||
// }
|
||||
if (!(process.env['NAPCAT_DISABLE_PIPE'] == '1' || process.env['NAPCAT_WORKER_PROCESS'] == '1')) {
|
||||
await connectToNamedPipe(logger).catch(e => logger.logError('命名管道连接失败', e));
|
||||
}
|
||||
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
|
||||
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVersion());
|
||||
const nativePacketHandler = new NativePacketHandler({ logger }); // 初始化 NativePacketHandler 用于后续使用
|
||||
|
||||
@@ -281,6 +281,18 @@ async function startWorkerProcess (): Promise<void> {
|
||||
throw new Error('进程管理器未初始化');
|
||||
}
|
||||
|
||||
// 预加载 Node Addon(如果设置了环境变量)
|
||||
const preloadAddonPath = process.env['NAPCAT_PRELOAD_NODE_ADDON_PATH'];
|
||||
if (preloadAddonPath) {
|
||||
try {
|
||||
const os = await import('os');
|
||||
process.dlopen({ exports: {} }, preloadAddonPath, os.constants.dlopen.RTLD_NOW | os.constants.dlopen.RTLD_GLOBAL);
|
||||
logger.log(`[NapCat] [Worker] 已预加载 Node Addon: ${preloadAddonPath}`);
|
||||
} catch (error) {
|
||||
logger.logError(`[NapCat] [Worker] 预加载 Node Addon 失败: ${preloadAddonPath}`, error);
|
||||
}
|
||||
}
|
||||
|
||||
// 监听来自父进程的消息
|
||||
processManager.onParentMessage((msg: unknown) => {
|
||||
if (typeof msg === 'object' && msg !== null && 'type' in msg) {
|
||||
|
||||
@@ -93,7 +93,7 @@ const NetworkDisplayCard = <T extends keyof NetworkType> ({
|
||||
onPress={handleEnableDebug}
|
||||
isDisabled={editing}
|
||||
>
|
||||
{debug ? '关闭调试' : '开启调试'}
|
||||
{debug ? '默认' : '调试'}
|
||||
</Button>
|
||||
<Button
|
||||
fullWidth
|
||||
|
||||
@@ -253,17 +253,17 @@ const NewVersionTip = (props: NewVersionTipProps) => {
|
||||
|
||||
return (
|
||||
<Tooltip content='有新版本可用'>
|
||||
<div className="cursor-pointer" onClick={updateStatus === 'updating' ? undefined : showUpdateDialog}>
|
||||
<div className="cursor-pointer flex items-center justify-center" onClick={updateStatus === 'updating' ? undefined : showUpdateDialog}>
|
||||
<Chip
|
||||
size="sm"
|
||||
color="danger"
|
||||
variant="flat"
|
||||
classNames={{
|
||||
content: "font-bold text-[10px] px-1",
|
||||
base: "h-5 min-h-5"
|
||||
content: "font-bold text-[10px] px-1 flex items-center justify-center",
|
||||
base: "h-5 min-h-5 min-w-[42px]"
|
||||
}}
|
||||
>
|
||||
{updateStatus === 'updating' ? <Spinner size="sm" color="danger" /> : 'New'}
|
||||
{updateStatus === 'updating' ? <Spinner size="sm" color="danger" classNames={{ wrapper: "w-3 h-3" }} /> : 'New'}
|
||||
</Chip>
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
@@ -61,7 +61,8 @@ const messageNode = z.union([
|
||||
.object({
|
||||
type: z.literal('reply'),
|
||||
data: z.object({
|
||||
id: z.number(),
|
||||
id: z.number().optional(),
|
||||
seq: z.number().optional(),
|
||||
}),
|
||||
})
|
||||
.describe('回复消息'),
|
||||
|
||||
@@ -24,196 +24,197 @@ export type OB11SegmentType =
|
||||
| 'file';
|
||||
|
||||
export interface Segment {
|
||||
type: OB11SegmentType
|
||||
type: OB11SegmentType;
|
||||
}
|
||||
|
||||
/** 纯文本 */
|
||||
export interface TextSegment extends Segment {
|
||||
type: 'text'
|
||||
type: 'text';
|
||||
data: {
|
||||
text: string
|
||||
}
|
||||
text: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** QQ表情 */
|
||||
export interface FaceSegment extends Segment {
|
||||
type: 'face'
|
||||
type: 'face';
|
||||
data: {
|
||||
id: string
|
||||
}
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 图片消息段 */
|
||||
export interface ImageSegment extends Segment {
|
||||
type: 'image'
|
||||
type: 'image';
|
||||
data: {
|
||||
file: string
|
||||
type?: 'flash'
|
||||
url?: string
|
||||
cache?: 0 | 1
|
||||
proxy?: 0 | 1
|
||||
timeout?: number
|
||||
}
|
||||
file: string;
|
||||
type?: 'flash';
|
||||
url?: string;
|
||||
cache?: 0 | 1;
|
||||
proxy?: 0 | 1;
|
||||
timeout?: number;
|
||||
};
|
||||
}
|
||||
|
||||
/** 语音消息段 */
|
||||
export interface RecordSegment extends Segment {
|
||||
type: 'record'
|
||||
type: 'record';
|
||||
data: {
|
||||
file: string
|
||||
magic?: 0 | 1
|
||||
url?: string
|
||||
cache?: 0 | 1
|
||||
proxy?: 0 | 1
|
||||
timeout?: number
|
||||
}
|
||||
file: string;
|
||||
magic?: 0 | 1;
|
||||
url?: string;
|
||||
cache?: 0 | 1;
|
||||
proxy?: 0 | 1;
|
||||
timeout?: number;
|
||||
};
|
||||
}
|
||||
|
||||
/** 短视频消息段 */
|
||||
export interface VideoSegment extends Segment {
|
||||
type: 'video'
|
||||
type: 'video';
|
||||
data: {
|
||||
file: string
|
||||
url?: string
|
||||
cache?: 0 | 1
|
||||
proxy?: 0 | 1
|
||||
timeout?: number
|
||||
}
|
||||
file: string;
|
||||
url?: string;
|
||||
cache?: 0 | 1;
|
||||
proxy?: 0 | 1;
|
||||
timeout?: number;
|
||||
};
|
||||
}
|
||||
|
||||
/** @某人消息段 */
|
||||
export interface AtSegment extends Segment {
|
||||
type: 'at'
|
||||
type: 'at';
|
||||
data: {
|
||||
qq: string | 'all'
|
||||
name?: string
|
||||
}
|
||||
qq: string | 'all';
|
||||
name?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 猜拳魔法表情消息段 */
|
||||
export interface RpsSegment extends Segment {
|
||||
type: 'rps'
|
||||
type: 'rps';
|
||||
}
|
||||
|
||||
/** 掷骰子魔法表情消息段 */
|
||||
export interface DiceSegment extends Segment {
|
||||
type: 'dice'
|
||||
type: 'dice';
|
||||
}
|
||||
|
||||
/** 窗口抖动(戳一戳)消息段 */
|
||||
export interface ShakeSegment extends Segment {
|
||||
type: 'shake'
|
||||
data: object
|
||||
type: 'shake';
|
||||
data: object;
|
||||
}
|
||||
|
||||
/** 戳一戳消息段 */
|
||||
export interface PokeSegment extends Segment {
|
||||
type: 'poke'
|
||||
type: 'poke';
|
||||
data: {
|
||||
type: string
|
||||
id: string
|
||||
name?: string
|
||||
}
|
||||
type: string;
|
||||
id: string;
|
||||
name?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 匿名发消息消息段 */
|
||||
export interface AnonymousSegment extends Segment {
|
||||
type: 'anonymous'
|
||||
type: 'anonymous';
|
||||
data: {
|
||||
ignore?: 0 | 1
|
||||
}
|
||||
ignore?: 0 | 1;
|
||||
};
|
||||
}
|
||||
|
||||
/** 链接分享消息段 */
|
||||
export interface ShareSegment extends Segment {
|
||||
type: 'share'
|
||||
type: 'share';
|
||||
data: {
|
||||
url: string
|
||||
title: string
|
||||
content?: string
|
||||
image?: string
|
||||
}
|
||||
url: string;
|
||||
title: string;
|
||||
content?: string;
|
||||
image?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 推荐好友/群消息段 */
|
||||
export interface ContactSegment extends Segment {
|
||||
type: 'contact'
|
||||
type: 'contact';
|
||||
data: {
|
||||
type: 'qq' | 'group'
|
||||
id: string
|
||||
}
|
||||
type: 'qq' | 'group';
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 位置消息段 */
|
||||
export interface LocationSegment extends Segment {
|
||||
type: 'location'
|
||||
type: 'location';
|
||||
data: {
|
||||
lat: string
|
||||
lon: string
|
||||
title?: string
|
||||
content?: string
|
||||
}
|
||||
lat: string;
|
||||
lon: string;
|
||||
title?: string;
|
||||
content?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 音乐分享消息段 */
|
||||
export interface MusicSegment extends Segment {
|
||||
type: 'music'
|
||||
type: 'music';
|
||||
data: {
|
||||
type: 'qq' | '163' | 'xm'
|
||||
id: string
|
||||
}
|
||||
type: 'qq' | '163' | 'xm';
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 音乐自定义分享消息段 */
|
||||
export interface CustomMusicSegment extends Segment {
|
||||
type: 'music'
|
||||
type: 'music';
|
||||
data: {
|
||||
type: 'custom'
|
||||
url: string
|
||||
audio: string
|
||||
title: string
|
||||
content?: string
|
||||
image?: string
|
||||
}
|
||||
type: 'custom';
|
||||
url: string;
|
||||
audio: string;
|
||||
title: string;
|
||||
content?: string;
|
||||
image?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 回复消息段 */
|
||||
export interface ReplySegment extends Segment {
|
||||
type: 'reply'
|
||||
type: 'reply';
|
||||
data: {
|
||||
id: string
|
||||
}
|
||||
id?: string; // msg_id 的短ID映射
|
||||
seq?: number; // msg_seq,优先使用
|
||||
};
|
||||
}
|
||||
|
||||
export interface FileSegment extends Segment {
|
||||
type: 'file'
|
||||
type: 'file';
|
||||
data: {
|
||||
file: string
|
||||
}
|
||||
file: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 合并转发消息段 */
|
||||
export interface ForwardSegment extends Segment {
|
||||
type: 'forward'
|
||||
type: 'forward';
|
||||
data: {
|
||||
id: string
|
||||
}
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** XML消息段 */
|
||||
export interface XmlSegment extends Segment {
|
||||
type: 'xml'
|
||||
type: 'xml';
|
||||
data: {
|
||||
data: string
|
||||
}
|
||||
data: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** JSON消息段 */
|
||||
export interface JsonSegment extends Segment {
|
||||
type: 'json'
|
||||
type: 'json';
|
||||
data: {
|
||||
data: string
|
||||
}
|
||||
data: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** OneBot11消息段 */
|
||||
@@ -242,23 +243,23 @@ export type OB11SegmentBase =
|
||||
|
||||
/** 合并转发已有消息节点消息段 */
|
||||
export interface DirectNodeSegment extends Segment {
|
||||
type: 'node'
|
||||
type: 'node';
|
||||
data: {
|
||||
id: string
|
||||
}
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 合并转发自定义节点消息段 */
|
||||
export interface CustomNodeSegments extends Segment {
|
||||
type: 'node'
|
||||
type: 'node';
|
||||
data: {
|
||||
user_id: string
|
||||
nickname: string
|
||||
content: OB11Segment[]
|
||||
prompt?: string
|
||||
summary?: string
|
||||
source?: string
|
||||
}
|
||||
user_id: string;
|
||||
nickname: string;
|
||||
content: OB11Segment[];
|
||||
prompt?: string;
|
||||
summary?: string;
|
||||
source?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** 合并转发消息段 */
|
||||
|
||||
Reference in new issue
Block a user