Refactor bridge modules: imports & cleanup
Standardize and reorganize imports, type usages and minor formatting across the bridge modules. This commit moves protobuf helpers, makeOidbEnvelope/runOidb, OidbBase and logger imports into consistent places, reorders and groups action/contacts exports in Bridge, removes or trims file-level comments, and fixes whitespace/logic ordering in several highway, element-builder and msg-push files. These are refactors and import/type adjustments across many files under packages/core/src (bridge, highway, msg-push, webui, utils, etc.) with no intended behavioral changes.
This commit is contained in:
1 parent
c49ae1c8d9
commit
b56868878c
83 files changed
+356
-919
No files matched your search
@@ -1,11 +1,6 @@
|
||||
// Tier-2 napcat-parity actions ported as pure oidb calls. Each function
|
||||
// here corresponds to one napcat PacketApi.pkt.operation.* entry; the
|
||||
// schemas live in proto/oidb-action.ts. Nothing in this file touches
|
||||
// the NTQQ NodeIKernel — every wire trip is one runOidb round-trip.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||
import { makeOidbEnvelope, runOidb } from '../bridge-oidb';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
import type {
|
||||
OidbGroupTodo,
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
// Forward-message upload / download via the long-message service.
|
||||
// Uses gzipped protobufs over `trpc.group.long_msg_interface`.
|
||||
// An in-memory cache keeps res_ids stable across rapid re-fetches
|
||||
// from the same OneBot client (avoids re-decoding the same payload).
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
import { gunzipSync, gzipSync } from 'zlib';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { protobuf_encode, protobuf_decode } from '@snowluma/proton';
|
||||
import { buildSendElems } from '../element-builder';
|
||||
import { parseMsgPush } from '../msg-push';
|
||||
import type { ForwardNodePayload, MessageElement } from '../events';
|
||||
import { gunzipSync, gzipSync } from 'zlib';
|
||||
import type { PacketInfo } from '../../protocol/types';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { buildSendElems } from '../element-builder';
|
||||
import type { ForwardNodePayload, MessageElement } from '../events';
|
||||
import { parseMsgPush } from '../msg-push';
|
||||
import type {
|
||||
LongMsgResult,
|
||||
RecvLongMsgReq,
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
// Friend-list operations: accept/reject add request, delete, set the
|
||||
// local remark label. Each one resolves a UID first because the OIDB
|
||||
// protocol uses opaque UIDs rather than QQ uin numbers.
|
||||
|
||||
import { protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||
import { makeOidbEnvelope, runOidb } from '../bridge-oidb';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
import type {
|
||||
OidbDeleteFriend,
|
||||
OidbFriendRequestAction,
|
||||
OidbSetFriendRemark,
|
||||
} from '../proto/proton/oidb-actions/base';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
|
||||
export async function setFriendAddRequest(bridge: Bridge, uidOrFlag: string, approve: boolean): Promise<void> {
|
||||
let targetUid = uidOrFlag;
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
// Group admin actions: mute/kick/leave/role/profile + join-request approval.
|
||||
// Every function ultimately routes through one OIDB schema; the function
|
||||
// names match the OneBot action names (set_group_kick, set_group_ban, ...)
|
||||
// so callers can grep across the two layers.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||
import { makeOidbEnvelope, runOidb } from '../bridge-oidb';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
import type {
|
||||
Oidb0x89a_0AddOption,
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
// Group album actions via TRPC protocol.
|
||||
//
|
||||
// Unlike the OIDB action family, these endpoints speak raw TRPC
|
||||
// (service command `QunAlbum.trpc.qzone.webapp_qun_*`) without an
|
||||
// `OidbBase<T>` envelope. We hit `bridge.sendRawPacket` directly with
|
||||
// proton-encoded bodies and decode the responses through proton's
|
||||
// monomorphized codecs.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { protobuf_encode, protobuf_decode } from '@snowluma/proton';
|
||||
import type {
|
||||
GetMediaListRequest,
|
||||
GetMediaListResponse,
|
||||
DeleteMediasRequest,
|
||||
DeleteMediasResponse,
|
||||
DoQunCommentRequest,
|
||||
DoQunCommentResponse,
|
||||
DoQunLikeRequest,
|
||||
DoQunLikeResponse,
|
||||
DeleteMediasRequest,
|
||||
DeleteMediasResponse,
|
||||
GetMediaListRequest,
|
||||
GetMediaListResponse,
|
||||
} from '../proto/proton/oidb-actions/group-album';
|
||||
|
||||
export interface GroupAlbumMediaResult {
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
// Group + private file operations: upload (with highway fast-path),
|
||||
// folder management, file listing, file/media URL fetch. All upload
|
||||
// paths share the same shape (resolve target → OIDB metadata exchange
|
||||
// → highway HTTP PUT if the server says we must), but the OIDB schemas
|
||||
// and field layouts differ enough between group and private that they
|
||||
// stay as separate functions.
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||
import { toHexUpper } from '../../utils/hex';
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { makeOidbEnvelope, runOidb } from '../bridge-oidb';
|
||||
import { fetchHighwaySession, uploadHighwayHttp } from '../highway/highway-client';
|
||||
import { computeHashes, computeMd5, FILE_UPLOAD_MAX_BYTES, loadBinarySource } from '../highway/utils';
|
||||
import type { FileUploadExt } from '../proto/proton/highway';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
import type {
|
||||
OidbGroupFileCountViewReq,
|
||||
OidbGroupFileCountViewResp,
|
||||
@@ -22,18 +19,14 @@ import type {
|
||||
OidbGroupSendFileReq,
|
||||
} from '../proto/proton/oidb-actions/group-file';
|
||||
import type {
|
||||
NTV2RichMediaReq,
|
||||
NTV2RichMediaResp,
|
||||
OidbPrivateFileDownloadReq,
|
||||
OidbPrivateFileDownloadResp,
|
||||
OidbPrivateFileUploadReq,
|
||||
OidbPrivateFileUploadResp,
|
||||
NTV2RichMediaReq,
|
||||
NTV2RichMediaResp,
|
||||
} from '../proto/proton/oidb-actions/media';
|
||||
import type { FileUploadExt } from '../proto/proton/highway';
|
||||
import { toHexUpper } from '../../utils/hex';
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import { ensureRetCodeZero, resolveSelfUid, toInt, type MediaIndexNode } from './shared';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
|
||||
const log = createLogger('GroupFile');
|
||||
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
// Operations targeting an existing message: recall (group / private),
|
||||
// mark-as-read (group / private), and the "essence" highlight toggle.
|
||||
// All of these take a message identifier and modify server-side state
|
||||
// without producing a downstream observable event.
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||
import type { C2CRecallRequest, GroupRecallRequest, OidbEssence, SsoReadedReportReq } from '../proto/proton/oidb-actions/base';
|
||||
import { protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { makeOidbEnvelope, runOidb } from '../bridge-oidb';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
import type { C2CRecallRequest, GroupRecallRequest, OidbEssence, SsoReadedReportReq } from '../proto/proton/oidb-actions/base';
|
||||
|
||||
export async function recallGroupMessage(bridge: Bridge, groupId: number, sequence: number): Promise<void> {
|
||||
const request = protobuf_encode<GroupRecallRequest>({
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
// Lightweight social-interaction actions: poke, like, emoji reaction,
|
||||
// and the related read-side "who reacted with X" query. None of these
|
||||
// edit message content — they're purely social signals.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||
import { makeOidbEnvelope, runOidb } from '../bridge-oidb';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
import type {
|
||||
Oidb0x9083Req,
|
||||
Oidb0x9083Resp,
|
||||
@@ -12,7 +9,6 @@ import type {
|
||||
OidbLike,
|
||||
OidbPoke,
|
||||
} from '../proto/proton/oidb-actions/base';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
|
||||
export async function sendPoke(bridge: Bridge, isGroup: boolean, peerUin: number, targetUin?: number): Promise<void> {
|
||||
const env = makeOidbEnvelope<OidbPoke>(0xED3, 1, {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// Grab-bag: action verbs that don't share a theme with anything else.
|
||||
// Kept together so the directory stays small; if any of these grow new
|
||||
// related siblings, lift the whole group out into its own file.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||
import { makeOidbEnvelope, runOidb } from '../bridge-oidb';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
import type {
|
||||
MiniAppShareReq,
|
||||
MiniAppShareResp,
|
||||
@@ -14,8 +12,6 @@ import type {
|
||||
Oidb0xeb7Req,
|
||||
Oidb0xeb7Resp,
|
||||
} from '../proto/proton/oidb-actions/base';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
|
||||
export async function translateEn2Zh(
|
||||
bridge: Bridge,
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
// Operations that touch the bot's own profile / status, plus the
|
||||
// related queries about my profile likes and unidirectional friends.
|
||||
// All of these read/write fields on the self-uin via OIDB.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||
import { makeOidbEnvelope, runOidb } from '../bridge-oidb';
|
||||
import { fetchHighwaySession, uploadHighwayHttp } from '../highway/highway-client';
|
||||
import { computeHashes, loadBinarySource } from '../highway/utils';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
import type {
|
||||
FaceroamOpReq,
|
||||
FaceroamOpResp,
|
||||
@@ -23,8 +21,6 @@ import type {
|
||||
SetStatusResp,
|
||||
} from '../proto/proton/oidb-actions/base';
|
||||
import { resolveSelfUid } from './shared';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
|
||||
// ─────────────── status / profile setters ───────────────
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
// Shared private helpers for the action modules. None of this is part
|
||||
// of the public Bridge API; keeping it here avoids re-importing the
|
||||
// same five-line utility from every themed file.
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
// Contact / info-fetching operations extracted from Bridge.
|
||||
|
||||
import type { Bridge } from './bridge';
|
||||
import type { DownloadRKeyInfo } from './bridge';
|
||||
import type { FriendInfo, QQGroupInfo, GroupMemberInfo, UserProfileInfo, GroupRequestInfo } from './qq-info';
|
||||
import { runOidb, makeOidbEnvelope } from './bridge-oidb';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge, DownloadRKeyInfo } from './bridge';
|
||||
import { makeOidbEnvelope, runOidb } from './bridge-oidb';
|
||||
import type {
|
||||
OidbBase,
|
||||
OidbSvcTrpcTcp0x10C0Response,
|
||||
OidbSvcTrpcTcp0xFD4_1Response,
|
||||
OidbSvcTrpcTcp0xFE5_2Response,
|
||||
OidbSvcTrpcTcp0xFE7_3Response,
|
||||
OidbSvcTrpcTcp0x10C0Response,
|
||||
OidbBase,
|
||||
} from './proto/proton/oidb';
|
||||
import type {
|
||||
AvatarInfo,
|
||||
OidbFriendListRequest,
|
||||
OidbGroupListRequest,
|
||||
OidbGroupMemberListRequest,
|
||||
OidbGroupRequestList,
|
||||
OidbUserInfoRequest,
|
||||
OidbUserInfoResponse,
|
||||
OidbGroupRequestList,
|
||||
AvatarInfo,
|
||||
} from './proto/proton/oidb-actions/base';
|
||||
import type {
|
||||
NTV2RichMediaReq,
|
||||
NTV2RichMediaResp,
|
||||
} from './proto/proton/oidb-actions/media';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { FriendInfo, GroupMemberInfo, GroupRequestInfo, QQGroupInfo, UserProfileInfo } from './qq-info';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helpers
|
||||
|
||||
@@ -1,30 +1,23 @@
|
||||
// BridgeInterface — the surface OneBot (and any other external consumer)
|
||||
// is allowed to see. The concrete Bridge class additionally exposes raw
|
||||
// protocol primitives (sendRawPacket, packet dispatch, PID management)
|
||||
// used by the in-tree action / contacts / highway modules; those internal
|
||||
// methods deliberately do NOT appear here so that callers depending on
|
||||
// the interface stay decoupled from the wire format.
|
||||
//
|
||||
// Every method below has a matching signature on Bridge; `Bridge
|
||||
// implements BridgeInterface` is the compile-time enforcement.
|
||||
|
||||
import type { BridgeEventBus } from './event-bus';
|
||||
import type { IdentityService } from './identity-service';
|
||||
import type {
|
||||
FriendInfo, QQGroupInfo, GroupMemberInfo,
|
||||
UserProfileInfo, GroupRequestInfo,
|
||||
} from './qq-info';
|
||||
import type { MessageElement, ForwardNodePayload } from './events';
|
||||
import type { SendPacketResult } from '../protocol/packet-sender';
|
||||
import type { GroupFilesResult } from './actions/group-file';
|
||||
import type { MediaIndexNode } from './actions/shared';
|
||||
import type { WebHonorType } from './web/group-honor';
|
||||
import type {
|
||||
SendMessageReceipt,
|
||||
DownloadRKeyInfo,
|
||||
ClientKeyInfo,
|
||||
DownloadRKeyInfo,
|
||||
SendMessageReceipt,
|
||||
UploadedFileMeta,
|
||||
} from './bridge';
|
||||
import type { SendPacketResult } from '../protocol/packet-sender';
|
||||
import type { BridgeEventBus } from './event-bus';
|
||||
import type { ForwardNodePayload, MessageElement } from './events';
|
||||
import type { IdentityService } from './identity-service';
|
||||
import type {
|
||||
FriendInfo,
|
||||
GroupMemberInfo,
|
||||
GroupRequestInfo,
|
||||
QQGroupInfo,
|
||||
UserProfileInfo,
|
||||
} from './qq-info';
|
||||
import type { WebHonorType } from './web/group-honor';
|
||||
|
||||
export interface BridgeInterface {
|
||||
// ─── Shared state ───
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
// One deep entry point for a single OIDB round-trip: dispatch a
|
||||
// pre-encoded envelope via Bridge.sendRawPacket, validate the envelope
|
||||
// retCode, and return the raw response bytes.
|
||||
//
|
||||
// History note. The legacy implementation used a runtime
|
||||
// `makeOidbBaseSchema(InnerSchema)` factory and ran a runtime
|
||||
// schema-walking encoder. Proton is compile-time, so the envelope is
|
||||
// the generic interface `OidbBase<T>` (proto/proton/oidb.ts). Proton's
|
||||
// wrapper-binding requires *pass-through* wrappers (the wrapper's first
|
||||
// arg must be forwarded unchanged to the inner codec — see
|
||||
// proton/src/transform/replacer.ts), so this file exposes thin
|
||||
// pass-through helpers (`encodeOidbEnv<T>` / `decodeOidbEnv<T>`) that
|
||||
// proton monomorphizes at every call site. `runOidb` itself is
|
||||
// non-generic — it just sends pre-encoded bytes and peeks at the
|
||||
// envelope retCode via the non-generic `OidbBaseMeta` view.
|
||||
|
||||
import type { Bridge } from './bridge';
|
||||
import { protobuf_decode } from '@snowluma/proton';
|
||||
import type { Bridge } from './bridge';
|
||||
import type { OidbBase, OidbBaseMeta } from './proto/proton/oidb';
|
||||
|
||||
/**
|
||||
@@ -35,12 +19,12 @@ export function makeOidbEnvelope<T>(
|
||||
isUid: boolean = false,
|
||||
): OidbBase<T> {
|
||||
return {
|
||||
command: oidbCmd,
|
||||
command: oidbCmd,
|
||||
subCommand: subCmd,
|
||||
errorCode: 0,
|
||||
errorCode: 0,
|
||||
body,
|
||||
errorMsg: '',
|
||||
reserved: isUid ? 1 : 0,
|
||||
errorMsg: '',
|
||||
reserved: isUid ? 1 : 0,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+115
-118
@@ -1,143 +1,140 @@
|
||||
// Bridge — per-UIN session: handler registration, packet dispatch, event routing.
|
||||
// Supports packet sending via native addon.
|
||||
// Heavy OIDB / contact / action logic is split into bridge-oidb, bridge-contacts, bridge-actions.
|
||||
|
||||
import type { PacketInfo } from '../protocol/types';
|
||||
import type { ForwardNodePayload, MessageElement } from './events';
|
||||
import type { FriendInfo, QQGroupInfo, GroupMemberInfo, UserProfileInfo, GroupRequestInfo } from './qq-info';
|
||||
import { MSG_PUSH_CMD, parseMsgPush } from './msg-push';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { PacketSender, SendPacketResult } from '../protocol/packet-sender';
|
||||
import { protobuf_encode, protobuf_decode } from '@snowluma/proton';
|
||||
import { buildSendElems } from './element-builder';
|
||||
import { IdentityService } from './identity-service';
|
||||
import type { PacketInfo } from '../protocol/types';
|
||||
import type { BridgeInterface } from './bridge-interface';
|
||||
import { buildSendElems } from './element-builder';
|
||||
import type { ForwardNodePayload, MessageElement } from './events';
|
||||
import { IdentityService } from './identity-service';
|
||||
import { MSG_PUSH_CMD, parseMsgPush } from './msg-push';
|
||||
import { IncomingPacketPipeline, type CmdParser } from './packet-pipeline';
|
||||
import type {
|
||||
SendMessageRequest,
|
||||
SendMessageResponse,
|
||||
} from './proto/proton/action';
|
||||
import type { FileExtra } from './proto/proton/message';
|
||||
import type { FriendInfo, GroupMemberInfo, GroupRequestInfo, QQGroupInfo, UserProfileInfo } from './qq-info';
|
||||
|
||||
// Delegated modules
|
||||
import {
|
||||
fetchFriendList as fetchFriendList_,
|
||||
fetchGroupList as fetchGroupList_,
|
||||
fetchGroupMemberList as fetchGroupMemberList_,
|
||||
fetchUserProfile as fetchUserProfile_,
|
||||
fetchGroupRequests as fetchGroupRequests_,
|
||||
fetchDownloadRKeys as fetchDownloadRKeys_,
|
||||
} from './bridge-contacts';
|
||||
import type { WebHonorType } from './web/group-honor';
|
||||
import {
|
||||
muteGroupMember as muteGroupMember_,
|
||||
muteGroupAll as muteGroupAll_,
|
||||
setGroupAddOption as setGroupAddOption_,
|
||||
setGroupSearch as setGroupSearch_,
|
||||
setGroupAddRequest as setGroupAddRequest_,
|
||||
kickGroupMember as kickGroupMember_,
|
||||
kickGroupMembers as kickGroupMembers_,
|
||||
leaveGroup as leaveGroup_,
|
||||
setGroupAdmin as setGroupAdmin_,
|
||||
setGroupCard as setGroupCard_,
|
||||
setGroupName as setGroupName_,
|
||||
setGroupSpecialTitle as setGroupSpecialTitle_,
|
||||
setGroupRemark as setGroupRemark_,
|
||||
getGroupAtAllRemain as getGroupAtAllRemain_,
|
||||
} from './actions/group-admin';
|
||||
import {
|
||||
uploadGroupFile as uploadGroupFile_,
|
||||
uploadPrivateFile as uploadPrivateFile_,
|
||||
sendGroupFileMessage as sendGroupFileMessage_,
|
||||
fetchGroupFiles as fetchGroupFiles_,
|
||||
fetchGroupFileUrl as fetchGroupFileUrl_,
|
||||
fetchPrivateFileUrl as fetchPrivateFileUrl_,
|
||||
fetchGroupPttUrlByNode as fetchGroupPttUrlByNode_,
|
||||
fetchPrivatePttUrlByNode as fetchPrivatePttUrlByNode_,
|
||||
fetchGroupVideoUrlByNode as fetchGroupVideoUrlByNode_,
|
||||
fetchPrivateVideoUrlByNode as fetchPrivateVideoUrlByNode_,
|
||||
deleteGroupFile as deleteGroupFile_,
|
||||
moveGroupFile as moveGroupFile_,
|
||||
createGroupFileFolder as createGroupFileFolder_,
|
||||
deleteGroupFileFolder as deleteGroupFileFolder_,
|
||||
renameGroupFileFolder as renameGroupFileFolder_,
|
||||
fetchGroupFileCount as fetchGroupFileCount_,
|
||||
} from './actions/group-file';
|
||||
import {
|
||||
recallGroupMessage as recallGroupMessage_,
|
||||
recallPrivateMessage as recallPrivateMessage_,
|
||||
markPrivateMessageRead as markGroupMsgAsRead_,
|
||||
markGroupMessageRead as markPrivateMsgAsRead_,
|
||||
setGroupEssence as setGroupEssence_,
|
||||
} from './actions/group-message';
|
||||
import {
|
||||
sendPoke as sendPoke_,
|
||||
sendLike as sendLike_,
|
||||
setGroupReaction as setGroupReaction_,
|
||||
getEmojiLikes as getEmojiLikes_,
|
||||
} from './actions/interaction';
|
||||
import {
|
||||
uploadForwardNodes as uploadForwardNodes_,
|
||||
fetchForwardNodes as fetchForwardNodes_,
|
||||
} from './actions/forward';
|
||||
import {
|
||||
setFriendAddRequest as setFriendAddRequest_,
|
||||
deleteFriend as deleteFriend_,
|
||||
setFriendRemark as setFriendRemark_,
|
||||
} from './actions/friend';
|
||||
import {
|
||||
setOnlineStatus as setOnlineStatus_,
|
||||
setDiyOnlineStatus as setDiyOnlineStatus_,
|
||||
setProfile as setProfile_,
|
||||
setSelfLongNick as setSelfLongNick_,
|
||||
setInputStatus as setInputStatus_,
|
||||
setAvatar as setAvatar_,
|
||||
setGroupAvatar as setGroupAvatar_,
|
||||
fetchCustomFace as fetchCustomFace_,
|
||||
getProfileLike as getProfileLike_,
|
||||
getUnidirectionalFriendList as getUnidirectionalFriendList_,
|
||||
} from './actions/profile';
|
||||
import {
|
||||
translateEn2Zh as translateEn2Zh_,
|
||||
getMiniAppArk as getMiniAppArk_,
|
||||
clickInlineKeyboardButton as clickInlineKeyboardButton_,
|
||||
sendGroupSign as sendGroupSign_,
|
||||
} from './actions/misc';
|
||||
import {
|
||||
setGroupTodo as setGroupTodo_,
|
||||
completeGroupTodo as completeGroupTodo_,
|
||||
cancelGroupTodo as cancelGroupTodo_,
|
||||
getStrangerStatus as getStrangerStatus_,
|
||||
fetchAiVoiceList as fetchAiVoiceList_,
|
||||
fetchAiVoice as fetchAiVoice_,
|
||||
AiVoiceChatType,
|
||||
cancelGroupTodo as cancelGroupTodo_,
|
||||
completeGroupTodo as completeGroupTodo_,
|
||||
fetchAiVoice as fetchAiVoice_,
|
||||
fetchAiVoiceList as fetchAiVoiceList_,
|
||||
getStrangerStatus as getStrangerStatus_,
|
||||
setGroupTodo as setGroupTodo_,
|
||||
type AiVoiceCategory,
|
||||
type AiVoiceChatType as AiVoiceChatTypeT,
|
||||
type StrangerStatus,
|
||||
} from './actions/extras';
|
||||
export { AiVoiceChatType };
|
||||
export type { AiVoiceCategory, StrangerStatus };
|
||||
import {
|
||||
getGroupHonorInfo as getGroupHonorInfo_,
|
||||
forceFetchClientKey as forceFetchClientKey_,
|
||||
getGroupEssence as getGroupEssence_,
|
||||
getGroupEssenceAll as getGroupEssenceAll_,
|
||||
sendGroupNotice as sendGroupNotice_,
|
||||
getGroupNotice as getGroupNotice_,
|
||||
deleteGroupNoticeByFid as deleteGroupNotice_,
|
||||
getCookiesStr as getCookiesStr_,
|
||||
getCsrfToken as getCsrfToken_,
|
||||
getCredentials as getCredentials_,
|
||||
getGroupAlbumListWeb as getGroupAlbumListWeb_,
|
||||
uploadImageToGroupAlbumWeb as uploadImageToGroupAlbumWeb_,
|
||||
} from './web-actions';
|
||||
import { getGroupAlbumMediaList as getGroupAlbumMediaList_,
|
||||
fetchForwardNodes as fetchForwardNodes_,
|
||||
uploadForwardNodes as uploadForwardNodes_,
|
||||
} from './actions/forward';
|
||||
import {
|
||||
deleteFriend as deleteFriend_,
|
||||
setFriendAddRequest as setFriendAddRequest_,
|
||||
setFriendRemark as setFriendRemark_,
|
||||
} from './actions/friend';
|
||||
import {
|
||||
getGroupAtAllRemain as getGroupAtAllRemain_,
|
||||
kickGroupMember as kickGroupMember_,
|
||||
kickGroupMembers as kickGroupMembers_,
|
||||
leaveGroup as leaveGroup_,
|
||||
muteGroupAll as muteGroupAll_,
|
||||
muteGroupMember as muteGroupMember_,
|
||||
setGroupAddOption as setGroupAddOption_,
|
||||
setGroupAddRequest as setGroupAddRequest_,
|
||||
setGroupAdmin as setGroupAdmin_,
|
||||
setGroupCard as setGroupCard_,
|
||||
setGroupName as setGroupName_,
|
||||
setGroupRemark as setGroupRemark_,
|
||||
setGroupSearch as setGroupSearch_,
|
||||
setGroupSpecialTitle as setGroupSpecialTitle_,
|
||||
} from './actions/group-admin';
|
||||
import {
|
||||
commentGroupAlbumMedia as commentGroupAlbumMedia_,
|
||||
likeGroupAlbumMedia as likeGroupAlbumMedia_,
|
||||
deleteGroupAlbumMedia as deleteGroupAlbumMedia_,
|
||||
getGroupAlbumMediaList as getGroupAlbumMediaList_,
|
||||
likeGroupAlbumMedia as likeGroupAlbumMedia_,
|
||||
} from './actions/group-album';
|
||||
import type { GroupFilesResult } from './actions/group-file';
|
||||
import {
|
||||
createGroupFileFolder as createGroupFileFolder_,
|
||||
deleteGroupFile as deleteGroupFile_,
|
||||
deleteGroupFileFolder as deleteGroupFileFolder_,
|
||||
fetchGroupFileCount as fetchGroupFileCount_,
|
||||
fetchGroupFiles as fetchGroupFiles_,
|
||||
fetchGroupFileUrl as fetchGroupFileUrl_,
|
||||
fetchGroupPttUrlByNode as fetchGroupPttUrlByNode_,
|
||||
fetchGroupVideoUrlByNode as fetchGroupVideoUrlByNode_,
|
||||
fetchPrivateFileUrl as fetchPrivateFileUrl_,
|
||||
fetchPrivatePttUrlByNode as fetchPrivatePttUrlByNode_,
|
||||
fetchPrivateVideoUrlByNode as fetchPrivateVideoUrlByNode_,
|
||||
moveGroupFile as moveGroupFile_,
|
||||
renameGroupFileFolder as renameGroupFileFolder_,
|
||||
sendGroupFileMessage as sendGroupFileMessage_,
|
||||
uploadGroupFile as uploadGroupFile_,
|
||||
uploadPrivateFile as uploadPrivateFile_,
|
||||
} from './actions/group-file';
|
||||
import {
|
||||
markPrivateMessageRead as markGroupMsgAsRead_,
|
||||
markGroupMessageRead as markPrivateMsgAsRead_,
|
||||
recallGroupMessage as recallGroupMessage_,
|
||||
recallPrivateMessage as recallPrivateMessage_,
|
||||
setGroupEssence as setGroupEssence_,
|
||||
} from './actions/group-message';
|
||||
import {
|
||||
getEmojiLikes as getEmojiLikes_,
|
||||
sendLike as sendLike_,
|
||||
sendPoke as sendPoke_,
|
||||
setGroupReaction as setGroupReaction_,
|
||||
} from './actions/interaction';
|
||||
import {
|
||||
clickInlineKeyboardButton as clickInlineKeyboardButton_,
|
||||
getMiniAppArk as getMiniAppArk_,
|
||||
sendGroupSign as sendGroupSign_,
|
||||
translateEn2Zh as translateEn2Zh_,
|
||||
} from './actions/misc';
|
||||
import {
|
||||
fetchCustomFace as fetchCustomFace_,
|
||||
getProfileLike as getProfileLike_,
|
||||
getUnidirectionalFriendList as getUnidirectionalFriendList_,
|
||||
setAvatar as setAvatar_,
|
||||
setDiyOnlineStatus as setDiyOnlineStatus_,
|
||||
setGroupAvatar as setGroupAvatar_,
|
||||
setInputStatus as setInputStatus_,
|
||||
setOnlineStatus as setOnlineStatus_,
|
||||
setProfile as setProfile_,
|
||||
setSelfLongNick as setSelfLongNick_,
|
||||
} from './actions/profile';
|
||||
import type { MediaIndexNode } from './actions/shared';
|
||||
import {
|
||||
fetchDownloadRKeys as fetchDownloadRKeys_,
|
||||
fetchFriendList as fetchFriendList_,
|
||||
fetchGroupList as fetchGroupList_,
|
||||
fetchGroupMemberList as fetchGroupMemberList_,
|
||||
fetchGroupRequests as fetchGroupRequests_,
|
||||
fetchUserProfile as fetchUserProfile_,
|
||||
} from './bridge-contacts';
|
||||
import { BridgeEventBus } from './event-bus';
|
||||
import {
|
||||
deleteGroupNoticeByFid as deleteGroupNotice_,
|
||||
forceFetchClientKey as forceFetchClientKey_,
|
||||
getCookiesStr as getCookiesStr_,
|
||||
getCredentials as getCredentials_,
|
||||
getCsrfToken as getCsrfToken_,
|
||||
getGroupAlbumListWeb as getGroupAlbumListWeb_,
|
||||
getGroupEssence as getGroupEssence_,
|
||||
getGroupEssenceAll as getGroupEssenceAll_,
|
||||
getGroupHonorInfo as getGroupHonorInfo_,
|
||||
getGroupNotice as getGroupNotice_,
|
||||
sendGroupNotice as sendGroupNotice_,
|
||||
uploadImageToGroupAlbumWeb as uploadImageToGroupAlbumWeb_,
|
||||
} from './web-actions';
|
||||
import type { WebHonorType } from './web/group-honor';
|
||||
export { AiVoiceChatType };
|
||||
export type { AiVoiceCategory, StrangerStatus };
|
||||
|
||||
export interface SendMessageReceipt {
|
||||
messageId: number;
|
||||
@@ -663,7 +660,7 @@ export class Bridge implements BridgeInterface {
|
||||
async getGroupHonorInfo(groupId: number, type: WebHonorType | string): Promise<any> {
|
||||
return getGroupHonorInfo_(this, groupId, type);
|
||||
}
|
||||
async forceFetchClientKey(): Promise<ClientKeyInfo> { return forceFetchClientKey_(this)}
|
||||
async forceFetchClientKey(): Promise<ClientKeyInfo> { return forceFetchClientKey_(this) }
|
||||
async getGroupEssence(groupId: number, pageStart: number = 0, pageLimit: number = 50): Promise<any> {
|
||||
return getGroupEssence_(this, groupId, pageStart, pageLimit);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
// Element Builder — converts internal MessageElement[] into proto Elem objects
|
||||
// for encoding with protobuf_encode<SendMessageRequest>.
|
||||
// Port of src/bridge/src/bridge_messages.cpp build_send_elems()
|
||||
|
||||
import { protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge } from './bridge';
|
||||
import type { MessageElement } from './events';
|
||||
import { protobuf_encode } from '@snowluma/proton';
|
||||
import type {
|
||||
MentionExtraSend,
|
||||
MarkdownData,
|
||||
} from './proto/proton/action';
|
||||
import type { Elem, GroupFileExtra } from './proto/proton/element';
|
||||
import { uploadImageMsgInfo } from './highway/image-upload';
|
||||
import { hexToBytes } from './highway/pipeline';
|
||||
import { uploadPttMsgInfo } from './highway/ptt-upload';
|
||||
import { uploadVideoMsgInfo } from './highway/video-upload';
|
||||
import { hexToBytes } from './highway/pipeline';
|
||||
import type {
|
||||
MarkdownData,
|
||||
MentionExtraSend,
|
||||
} from './proto/proton/action';
|
||||
import type { Elem, GroupFileExtra } from './proto/proton/element';
|
||||
|
||||
type ProtoElem = Partial<Elem>;
|
||||
|
||||
@@ -91,11 +87,11 @@ function makeMentionElem(element: MessageElement, ctx?: SendContext): ProtoElem
|
||||
|
||||
function makeReplyElem(element: MessageElement): ProtoElem {
|
||||
const seq = element.replySeq! & 0xFFFFFFFF;
|
||||
|
||||
|
||||
const srcMsg: any = {
|
||||
origSeqs: [seq],
|
||||
};
|
||||
|
||||
|
||||
// Add additional fields if available for better reply display
|
||||
if (element.replySenderUin) {
|
||||
srcMsg.senderUin = BigInt(element.replySenderUin);
|
||||
@@ -103,7 +99,7 @@ function makeReplyElem(element: MessageElement): ProtoElem {
|
||||
if (element.replyTime) {
|
||||
srcMsg.time = element.replyTime;
|
||||
}
|
||||
|
||||
|
||||
return { srcMsg };
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
// Typed, per-kind pub/sub for bridge-level events.
|
||||
//
|
||||
// Replaces the single-callback firehose where every consumer received every
|
||||
// event variant and had to switch on `event.kind`. Now each downstream
|
||||
// concern (OneBot dispatch, member cache refresh, etc.) registers exactly
|
||||
// the kinds it cares about, much closer to NapCat's per-listener pattern.
|
||||
//
|
||||
// `emit` is fire-and-forget: subscribers can be sync or async; async
|
||||
// rejections are surfaced via `Promise.allSettled` and reported through the
|
||||
// optional `onError` hook so one buggy handler never starves the others.
|
||||
|
||||
import type { QQEventVariant } from './events';
|
||||
import { createLogger } from '../utils/logger';
|
||||
import type { QQEventVariant } from './events';
|
||||
|
||||
type EventKind = QQEventVariant['kind'];
|
||||
type EventOf<K extends EventKind> = Extract<QQEventVariant, { kind: K }>;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// Bridge event types and MessageElement.
|
||||
// Port of src/bridge/include/bridge/events.h
|
||||
|
||||
export interface MessageElement {
|
||||
type: string; // 'text'|'at'|'face'|'mface'|'image'|'video'|'record'|'file'|'json'|'xml'|'reply'|'poke'|'forward'
|
||||
text?: string;
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
// FFmpeg native addon wrapper — port of NapCat's FFmpegAddonAdapter.
|
||||
// No fallback: throws if the addon isn't available on this platform/arch.
|
||||
//
|
||||
// The addon is shipped under `native/ffmpeg/ffmpegAddon.<platform>.<arch>.node`
|
||||
// to match the layout used by the upstream NapCat build so the binaries
|
||||
// can be dropped in as-is.
|
||||
|
||||
import crypto from 'crypto';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import crypto from 'crypto';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
// Highway HTTP client: session fetch and chunked binary upload.
|
||||
// Port of src/bridge/src/highway_client.cpp
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import net from 'net';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { protobuf_encode, protobuf_decode } from '@snowluma/proton';
|
||||
import type {
|
||||
HttpConn0x6FF501Request,
|
||||
HttpConn0x6FF501Response,
|
||||
NTV2RichMediaHighwayExt,
|
||||
ReqDataHighwayHead,
|
||||
RespDataHighwayHead,
|
||||
NTV2RichMediaHighwayExt,
|
||||
} from '../proto/proton/highway';
|
||||
import { packHighwayFrame, unpackHighwayFrame, computeMd5 } from './utils';
|
||||
import { computeMd5, packHighwayFrame, unpackHighwayFrame } from './utils';
|
||||
|
||||
const HIGHWAY_APP_ID = 1600001604;
|
||||
const HIGHWAY_BLOCK_SIZE = 1024 * 1024;
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
// Image upload: load the source, run NTV2 upload + (optional) Highway PUT,
|
||||
// return the encoded MsgInfo for the outgoing commonElem.
|
||||
//
|
||||
// Shared OIDB envelope + response handling + Highway PUT live in
|
||||
// pipeline.ts; this file just supplies the image-specific bits (format
|
||||
// detection, picFormat, bizType, command ids).
|
||||
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import type { Bridge } from '../bridge';
|
||||
import type { MessageElement } from '../events';
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import { GROUP_IMAGE_CMD_ID, PRIVATE_IMAGE_CMD_ID } from './highway-client';
|
||||
import {
|
||||
finalizeMediaMsgInfo,
|
||||
|
||||
@@ -1,32 +1,15 @@
|
||||
// Shared NTV2 rich-media upload pipeline.
|
||||
//
|
||||
// Image, PTT, and video all follow the same three-step shape:
|
||||
// 1. send a NTV2UploadRichMediaReq OIDB packet describing the file(s),
|
||||
// 2. for any sub-file the server signals it wants (uKey present in the
|
||||
// response), do a Highway HTTP PUT of the bytes,
|
||||
// 3. encode the returned msgInfo into the bytes that go inside a
|
||||
// commonElem on the outgoing message.
|
||||
//
|
||||
// The per-format files (image-upload, ptt-upload, video-upload) used to
|
||||
// each implement steps 1 / 2 / 3 inline with subtle drift between them.
|
||||
// This module pulls the envelope, response decoding, error handling, and
|
||||
// the Highway PUT loop into one place, leaving each format file with
|
||||
// only: how to load the file, how to fill the type-specific fileInfo +
|
||||
// extBizInfo, and which command ids to use.
|
||||
|
||||
import crypto from 'crypto';
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import crypto from 'crypto';
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { makeOidbEnvelope } from '../bridge-oidb';
|
||||
import type {
|
||||
EncodableMediaMsgInfo,
|
||||
NTV2UploadRichMediaReq,
|
||||
NTV2UploadRichMediaResp,
|
||||
} from '../proto/proton/highway';
|
||||
import { buildHighwayExtend, fetchHighwaySession, uploadHighwayHttp } from './highway-client';
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
import { buildHighwayExtend, fetchHighwaySession, uploadHighwayHttp } from './highway-client';
|
||||
|
||||
const moduleLog = createLogger('Highway');
|
||||
|
||||
|
||||
@@ -1,26 +1,18 @@
|
||||
// Voice (PTT) upload: stage the audio bytes (convert to NT silk if
|
||||
// necessary), run NTV2 upload + (optional) Highway PUT, return the
|
||||
// encoded MsgInfo for the outgoing commonElem.
|
||||
//
|
||||
// Shared OIDB envelope + response handling + Highway PUT live in
|
||||
// pipeline.ts; this file owns the silk transcoding, the temp-file
|
||||
// cleanup hooks, and the PTT-specific OIDB fields.
|
||||
|
||||
import crypto from 'crypto';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import crypto from 'crypto';
|
||||
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import type { Bridge } from '../bridge';
|
||||
import type { MessageElement } from '../events';
|
||||
import { computeHashes, loadBinarySource, resolveLocalFilePath } from './utils';
|
||||
import { defaultPttTempDir, encodeSilk } from './ffmpeg-addon';
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import {
|
||||
finalizeMediaMsgInfo,
|
||||
hexToBytes,
|
||||
runNtv2Upload,
|
||||
type MediaSubFileUpload,
|
||||
} from './pipeline';
|
||||
import { computeHashes, loadBinarySource, resolveLocalFilePath } from './utils';
|
||||
|
||||
const moduleLog = createLogger('Highway.Ptt');
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// Highway utilities: binary source loading, hashing, image format detection, frame packing.
|
||||
// Port of src/bridge/src/highway_utils.h/.cpp
|
||||
|
||||
import { createHash } from 'crypto';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
@@ -193,7 +190,7 @@ export function detectImageFormat(bytes: Uint8Array): ImageFormat {
|
||||
|
||||
// PNG
|
||||
if (bytes.length >= 24 &&
|
||||
bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4E && bytes[3] === 0x47) {
|
||||
bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4E && bytes[3] === 0x47) {
|
||||
width = readBE32(bytes, 16);
|
||||
height = readBE32(bytes, 20);
|
||||
return { format: 1001, width, height };
|
||||
@@ -201,8 +198,8 @@ export function detectImageFormat(bytes: Uint8Array): ImageFormat {
|
||||
|
||||
// GIF
|
||||
if (bytes.length >= 10 &&
|
||||
bytes[0] === 0x47 && bytes[1] === 0x49 && bytes[2] === 0x46 && bytes[3] === 0x38 &&
|
||||
(bytes[4] === 0x37 || bytes[4] === 0x39) && bytes[5] === 0x61) {
|
||||
bytes[0] === 0x47 && bytes[1] === 0x49 && bytes[2] === 0x46 && bytes[3] === 0x38 &&
|
||||
(bytes[4] === 0x37 || bytes[4] === 0x39) && bytes[5] === 0x61) {
|
||||
width = readLE16(bytes, 6);
|
||||
height = readLE16(bytes, 8);
|
||||
return { format: 2000, width, height };
|
||||
@@ -217,8 +214,8 @@ export function detectImageFormat(bytes: Uint8Array): ImageFormat {
|
||||
|
||||
// WebP
|
||||
if (bytes.length >= 30 &&
|
||||
bytes[0] === 0x52 && bytes[1] === 0x49 && bytes[2] === 0x46 && bytes[3] === 0x46 &&
|
||||
bytes[8] === 0x57 && bytes[9] === 0x45 && bytes[10] === 0x42 && bytes[11] === 0x50) {
|
||||
bytes[0] === 0x52 && bytes[1] === 0x49 && bytes[2] === 0x46 && bytes[3] === 0x46 &&
|
||||
bytes[8] === 0x57 && bytes[9] === 0x45 && bytes[10] === 0x42 && bytes[11] === 0x50) {
|
||||
if (bytes[12] === 0x56 && bytes[13] === 0x50 && bytes[14] === 0x38 && bytes[15] === 0x20) {
|
||||
width = readLE16(bytes, 26);
|
||||
height = readLE16(bytes, 28);
|
||||
@@ -251,7 +248,7 @@ export function detectImageFormat(bytes: Uint8Array): ImageFormat {
|
||||
// (DAC). The previous `(marker & 0xFC) === 0xC0` check accepted DHT
|
||||
// and friends, then misread Huffman table bytes as image dimensions.
|
||||
const isSof = marker >= 0xC0 && marker <= 0xCF
|
||||
&& marker !== 0xC4 && marker !== 0xC8 && marker !== 0xCC;
|
||||
&& marker !== 0xC4 && marker !== 0xC8 && marker !== 0xCC;
|
||||
if (isSof && segLen >= 7 && offset + 9 <= bytes.length) {
|
||||
height = readBE16(bytes, offset + 5);
|
||||
width = readBE16(bytes, offset + 7);
|
||||
|
||||
@@ -1,33 +1,23 @@
|
||||
// Video upload: stage the source video and a thumbnail (extracted via
|
||||
// ffmpeg if not supplied), run NTV2 upload + (optional) Highway PUTs for
|
||||
// both files, return the encoded MsgInfo for the outgoing commonElem.
|
||||
//
|
||||
// Shared OIDB envelope + response handling + Highway PUT loop live in
|
||||
// pipeline.ts; this file owns the ffmpeg thumb extraction, the 1 MB
|
||||
// streaming sha1 used by main-video Highway uploads, and the
|
||||
// video-specific OIDB fields (uploadInfo has TWO entries — main + thumb).
|
||||
|
||||
import crypto from 'crypto';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import crypto from 'crypto';
|
||||
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import type { Bridge } from '../bridge';
|
||||
import type { MessageElement } from '../events';
|
||||
import {
|
||||
computeHashes,
|
||||
detectImageFormat,
|
||||
loadBinarySource,
|
||||
resolveLocalFilePath,
|
||||
} from './utils';
|
||||
import { getFFmpegAddon } from './ffmpeg-addon';
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import {
|
||||
finalizeMediaMsgInfo,
|
||||
hexToBytes,
|
||||
runNtv2Upload,
|
||||
type MediaSubFileUpload,
|
||||
} from './pipeline';
|
||||
import {
|
||||
computeHashes,
|
||||
detectImageFormat,
|
||||
loadBinarySource,
|
||||
resolveLocalFilePath,
|
||||
} from './utils';
|
||||
|
||||
const moduleLog = createLogger('Highway.Video');
|
||||
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
// BridgeManager — manages per-UIN Bridge sessions.
|
||||
// onPacket() is the single entry point for parsed hook packets;
|
||||
// HookManager wires it as the default packet sink for every HookSession.
|
||||
// Port of src/bridge/include/bridge/manager.h + src/bridge/src/manager.cpp
|
||||
|
||||
import type { PacketSender } from '../protocol/packet-sender';
|
||||
import type { PacketInfo } from '../protocol/types';
|
||||
import { createLogger } from '../utils/logger';
|
||||
import { Bridge } from './bridge';
|
||||
import { IdentityService } from './identity-service';
|
||||
import type { PacketSender } from '../protocol/packet-sender';
|
||||
import { createLogger } from '../utils/logger';
|
||||
|
||||
export type SessionStartedCallback = (uin: string, bridge: Bridge) => void;
|
||||
export type SessionClosedCallback = (uin: string) => void;
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
// MsgPushContext — the decoded envelope fields every decoder may need.
|
||||
// One unified shape: notice decoders pick from `content`, message decoders
|
||||
// pick from `body` / `responseHead`. Decoders ignore fields they don't need.
|
||||
|
||||
import { protobuf_decode } from '@snowluma/proton';
|
||||
import type { ContentHead, MessageBody, PushMsg, ResponseHead } from '../proto/proton/message';
|
||||
import type { PacketInfo } from '../../protocol/types';
|
||||
import type { IdentityService } from '../identity-service';
|
||||
import type { ContentHead, MessageBody, PushMsg, ResponseHead } from '../proto/proton/message';
|
||||
|
||||
export type PushMsgBody = MessageBody;
|
||||
export type PushMsgResponseHead = ResponseHead;
|
||||
|
||||
@@ -1,36 +1,27 @@
|
||||
// Handles Event0x210 wrapper (528). Internal switch on subType dispatches
|
||||
// to FriendRequest (35) / FriendRecall (138, 139) / NewFriend
|
||||
// (179, 226) / FriendPoke (290).
|
||||
|
||||
import { protobuf_decode } from '@snowluma/proton';
|
||||
// Proto types imported unaliased — proton's import-resolver registers
|
||||
// `importedTypeSources` keyed on the *imported* name. If we also did
|
||||
// `import type { FriendRecall } from '../../events'` it would shadow
|
||||
// the proto-side mapping (last-write-wins), point the resolver at the
|
||||
// event-side file which has no `pb<>` schema, and the codec would
|
||||
// never get generated — `protobuf_decode<FriendRecall>(...)` then
|
||||
// falls through to the runtime fallback and throws (silently caught
|
||||
// by `MsgPushRegistry.decode`). The event-side colliding names are
|
||||
// re-derived from `QQEventVariant` below via `Extract` instead.
|
||||
import { createLogger } from '../../../utils/logger';
|
||||
import type {
|
||||
FriendAddEvent,
|
||||
FriendPokeEvent,
|
||||
FriendRequestEvent,
|
||||
QQEventVariant,
|
||||
} from '../../events';
|
||||
import type {
|
||||
FriendRequest,
|
||||
FriendRecall,
|
||||
FriendRequest,
|
||||
GeneralGrayTipInfo,
|
||||
NewFriend,
|
||||
} from '../../proto/proton/notify';
|
||||
import type {
|
||||
FriendRequestEvent, FriendPokeEvent,
|
||||
FriendAddEvent, QQEventVariant,
|
||||
} from '../../events';
|
||||
|
||||
type FriendRecallEvent = Extract<QQEventVariant, { kind: 'friend_recall' }>;
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
import type { MsgPushContext } from '../context';
|
||||
import { Event0x210SubType } from '../enums';
|
||||
import {
|
||||
resolveUidToUin, parseU64OrZero, buildTemplateMap, findTemplateValue,
|
||||
buildTemplateMap, findTemplateValue,
|
||||
parseU64OrZero,
|
||||
resolveUidToUin,
|
||||
} from '../helpers';
|
||||
import { createLogger } from '../../../utils/logger';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
|
||||
type FriendRecallEvent = Extract<QQEventVariant, { kind: 'friend_recall' }>;
|
||||
|
||||
const unknownLog = createLogger('MsgPush.Unknown');
|
||||
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
// Handles Event0x2DC wrapper (732). Internal switch on subType dispatches
|
||||
// to GroupMute (12) / GroupMsgEmojiLike (16) / GroupRecall (17) /
|
||||
// GroupGreyTip (20) / GroupEssence (21).
|
||||
|
||||
import { protobuf_decode } from '@snowluma/proton';
|
||||
import { createLogger } from '../../../utils/logger';
|
||||
import type {
|
||||
GroupMute, NotifyMessageBody, GroupReactNotify,
|
||||
} from '../../proto/proton/notify';
|
||||
import type {
|
||||
GroupMuteEvent, GroupRecallEvent, GroupPokeEvent, GroupEssenceEvent,
|
||||
GroupEssenceEvent,
|
||||
GroupMsgEmojiLikeEvent,
|
||||
GroupMuteEvent,
|
||||
GroupPokeEvent,
|
||||
GroupRecallEvent,
|
||||
QQEventVariant,
|
||||
} from '../../events';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
import type {
|
||||
GroupMute,
|
||||
GroupReactNotify,
|
||||
NotifyMessageBody,
|
||||
} from '../../proto/proton/notify';
|
||||
import type { MsgPushContext } from '../context';
|
||||
import { Event0x2DCSubType } from '../enums';
|
||||
import {
|
||||
resolveUidToUin, parseU64OrZero, buildTemplateMap, findTemplateValue,
|
||||
buildTemplateMap, findTemplateValue,
|
||||
parseU64OrZero,
|
||||
resolveUidToUin,
|
||||
unwrapGroupNotifyPayload,
|
||||
} from '../helpers';
|
||||
import { createLogger } from '../../../utils/logger';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
|
||||
const unknownLog = createLogger('MsgPush.Unknown');
|
||||
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
// Handles the four PkgTypes that produce a FriendMessage event:
|
||||
// PrivateMessage (166), ForwardFakePrivateMessage (9),
|
||||
// PrivateRecordMessage (208), PrivateFileMessage (529). The PkgType
|
||||
// difference only affects which proto-level elements show up in the
|
||||
// body — decodeRichBody handles all of them uniformly.
|
||||
|
||||
import type { FriendMessage } from '../../events';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
import { decodeRichBody } from '../rich-body-decoder';
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
// Handles GroupAdminChangedNotice (44). extraEnable / extraDisable
|
||||
// distinguishes set vs. unset.
|
||||
|
||||
import { protobuf_decode } from '@snowluma/proton';
|
||||
import type { GroupAdmin } from '../../proto/proton/notify';
|
||||
import type { GroupAdminEvent } from '../../events';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
import type { GroupAdmin } from '../../proto/proton/notify';
|
||||
import { resolveUidToUin } from '../helpers';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
|
||||
export const decodeGroupAdmin: MsgPushDecoder = (ctx) => {
|
||||
const admin = protobuf_decode<GroupAdmin>(ctx.content);
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
// Handles GroupRequestJoinNotice (84) + GroupRequestInvitationNotice (525)
|
||||
// + GroupInviteNotice (87). All three produce GroupInviteEvent with
|
||||
// different subType ('add' / 'invite') and flag prefixes.
|
||||
|
||||
import { protobuf_decode } from '@snowluma/proton';
|
||||
import type {
|
||||
GroupJoin, GroupInvitation, GroupInvite,
|
||||
} from '../../proto/proton/notify';
|
||||
import type { GroupInviteEvent } from '../../events';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
import type {
|
||||
GroupInvitation, GroupInvite,
|
||||
GroupJoin,
|
||||
} from '../../proto/proton/notify';
|
||||
import { resolveUidToUin } from '../helpers';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
|
||||
export const decodeGroupJoinRequest: MsgPushDecoder = (ctx) => {
|
||||
const join = protobuf_decode<GroupJoin>(ctx.content);
|
||||
|
||||
@@ -1,24 +1,8 @@
|
||||
// Handles GroupMemberIncreaseNotice (33) + GroupMemberDecreaseNotice (34) +
|
||||
// GroupSelfJoinedNotice (85, bot-self admittance).
|
||||
//
|
||||
// 33/34 share GroupChangeSchema; the decreaseType field distinguishes
|
||||
// kick vs voluntary leave (dt != 0 && dt != 130 means kicked).
|
||||
//
|
||||
// 85 carries a different wire shape (`SelfJoinInGroup`) — without it
|
||||
// the bot has no signal that its own `set_group_add_request` was
|
||||
// approved (33 fires only for *other* members joining). We surface
|
||||
// 85 as a regular GroupMemberJoin with `userUin = selfUin` so the
|
||||
// existing OneBot converter naturally produces
|
||||
// `notice.group_increase` with `sub_type: 'approve' | 'invite'`
|
||||
// (the converter compares operator == user to pick the sub_type;
|
||||
// for self-join the operator is the admin/inviter, so 'invite' is
|
||||
// emitted — matching go-cqhttp / NapCat semantics).
|
||||
|
||||
import { protobuf_decode } from '@snowluma/proton';
|
||||
import type { GroupChange, SelfJoinInGroup } from '../../proto/proton/notify';
|
||||
import type { GroupMemberJoin, GroupMemberLeave } from '../../events';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
import type { GroupChange, SelfJoinInGroup } from '../../proto/proton/notify';
|
||||
import { decodeOperatorUid, resolveUidToUin } from '../helpers';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
|
||||
export const decodeGroupMemberJoin: MsgPushDecoder = (ctx) => {
|
||||
const change = protobuf_decode<GroupChange>(ctx.content);
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// Handles GroupMessage (82). Resolves senderCard / senderRole from the
|
||||
// group member roster when present.
|
||||
|
||||
import type { GroupMessage } from '../../events';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
import { decodeRichBody } from '../rich-body-decoder';
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// Handles TempMessage (141). Pulls senderNick from group hint first
|
||||
// then falls back to friend roster.
|
||||
|
||||
import type { TempMessage } from '../../events';
|
||||
import type { MsgPushDecoder } from '../registry';
|
||||
import { decodeRichBody } from '../rich-body-decoder';
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
// MsgPush PkgType taxonomy. The top-level msgType field in PushMsg.contentHead
|
||||
// names a QQ-protocol-defined packet shape; Event0x210 / Event0x2DC are wrapper
|
||||
// PkgTypes whose payload is further dispatched by subType.
|
||||
|
||||
export enum PkgType {
|
||||
ForwardFakePrivateMessage = 9,
|
||||
PrivateMessage = 166,
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
// MsgPush decode helpers — pure functions shared across PkgType decoders
|
||||
// and the rich-body decoder. No state, no I/O.
|
||||
|
||||
import { inflateSync } from 'zlib';
|
||||
import { protobuf_decode } from '@snowluma/proton';
|
||||
import type { OperatorInfo } from '../proto/proton/notify';
|
||||
import { inflateSync } from 'zlib';
|
||||
import type { IdentityService } from '../identity-service';
|
||||
import type { OperatorInfo } from '../proto/proton/notify';
|
||||
|
||||
export function makeImageUrl(origUrl: string): string {
|
||||
if (!origUrl) return '';
|
||||
@@ -57,7 +54,7 @@ export function decodeOperatorUid(bytes: Uint8Array): string {
|
||||
return Buffer.from(bytes).toString('utf8');
|
||||
}
|
||||
|
||||
export function buildTemplateMap(params: Array<{name?: string; value?: string}>): Map<string, string> {
|
||||
export function buildTemplateMap(params: Array<{ name?: string; value?: string }>): Map<string, string> {
|
||||
const map = new Map<string, string>();
|
||||
for (const p of params) {
|
||||
if (p.name !== undefined) map.set(p.name, p.value ?? '');
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
// MsgPush entry point — assembles the PkgType registry and exposes
|
||||
// `parseMsgPush(pkt, identity)` as the single CmdParser registered against
|
||||
// `MSG_PUSH_CMD` on the IncomingPacketPipeline.
|
||||
|
||||
import type { PacketInfo } from '../../protocol/types';
|
||||
import type { IdentityService } from '../identity-service';
|
||||
import type { QQEventVariant } from '../events';
|
||||
import type { IdentityService } from '../identity-service';
|
||||
import { buildContext } from './context';
|
||||
import { MsgPushRegistry } from './registry';
|
||||
import { PkgType } from './enums';
|
||||
import { decodeEvent0x210 } from './decoders/event-0x210';
|
||||
import { decodeEvent0x2DC } from './decoders/event-0x2dc';
|
||||
import { decodeFriendMessage } from './decoders/friend-message';
|
||||
import { decodeGroupAdmin } from './decoders/group-admin';
|
||||
import {
|
||||
decodeGroupInvitation, decodeGroupInvite,
|
||||
decodeGroupJoinRequest,
|
||||
} from './decoders/group-join-request';
|
||||
import {
|
||||
decodeGroupMemberJoin, decodeGroupMemberLeave, decodeGroupSelfJoined,
|
||||
} from './decoders/group-member-change';
|
||||
import { decodeGroupAdmin } from './decoders/group-admin';
|
||||
import {
|
||||
decodeGroupJoinRequest, decodeGroupInvitation, decodeGroupInvite,
|
||||
} from './decoders/group-join-request';
|
||||
import { decodeEvent0x210 } from './decoders/event-0x210';
|
||||
import { decodeEvent0x2DC } from './decoders/event-0x2dc';
|
||||
import { decodeGroupMessage } from './decoders/group-message';
|
||||
import { decodeTempMessage } from './decoders/temp-message';
|
||||
import { decodeFriendMessage } from './decoders/friend-message';
|
||||
import { PkgType } from './enums';
|
||||
import { MsgPushRegistry } from './registry';
|
||||
|
||||
export const MSG_PUSH_CMD = 'trpc.msg.olpush.OlPushService.MsgPush';
|
||||
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
// MsgPushRegistry — per-PkgType dispatch table. Each PkgType maps to a single
|
||||
// decoder; double-registration is a programming error (throws at register time).
|
||||
// Decoder errors are caught and logged with the PkgType so a single bad decoder
|
||||
// can never silently take down sibling decoders sharing the cmd.
|
||||
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import type { QQEventVariant } from '../events';
|
||||
import type { MsgPushContext } from './context';
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
// Rich body decoder — turns the proto MessageBody (richText.elems +
|
||||
// richText.ptt/notOnlineFile + msgContent) of a MsgPush message into
|
||||
// the bridge-internal MessageElement[] sequence. Pure, no identity
|
||||
// lookups, no I/O. The single small interface `decodeRichBody` hides
|
||||
// ~400 lines of per-element-type decoding behind it.
|
||||
|
||||
import { protobuf_decode } from '@snowluma/proton';
|
||||
import { toHexUpper } from '../../utils/hex';
|
||||
import type { MessageElement } from '../events';
|
||||
import type {
|
||||
Elem,
|
||||
GroupFileExtra,
|
||||
@@ -15,8 +11,6 @@ import type {
|
||||
QSmallFaceExtra,
|
||||
} from '../proto/proton/element';
|
||||
import type { FileExtra, MessageBody, RichText } from '../proto/proton/message';
|
||||
import type { MessageElement } from '../events';
|
||||
import { toHexUpper } from '../../utils/hex';
|
||||
import { decompressData, makeImageUrl } from './helpers';
|
||||
|
||||
type ElemDecoded = Elem;
|
||||
|
||||
@@ -1,27 +1,9 @@
|
||||
// Incoming packet pipeline — the chain that turns a single PacketInfo
|
||||
// arriving from the hook layer into a stream of QQEventVariant
|
||||
// emissions on the typed event bus. Replaces the inline orchestration
|
||||
// that previously lived on Bridge.onPacket / triggerMemberCacheRefresh /
|
||||
// rememberEventIdentity / dispatchAfterIdentityRefresh / etc.
|
||||
//
|
||||
// Stage chain per parser output:
|
||||
// parse → enrich identity (sync, or async refresh)
|
||||
// → side-effects (remember UID/UIN + schedule roster refresh)
|
||||
// → log
|
||||
// → emit on bus
|
||||
//
|
||||
// The pipeline owns its cmd handler map and its per-group coalesce table
|
||||
// for background member-list refreshes. It does NOT own protocol calls
|
||||
// — `refreshMemberCache` is injected by Bridge because it ultimately
|
||||
// dispatches OIDB packets through Bridge.fetchGroupList /
|
||||
// Bridge.fetchGroupMemberList.
|
||||
|
||||
import type { PacketInfo } from '../protocol/types';
|
||||
import { formatEvent } from '../utils/event-format';
|
||||
import { createLogger, type Logger } from '../utils/logger';
|
||||
import type { BridgeEventBus } from './event-bus';
|
||||
import type { QQEventVariant } from './events';
|
||||
import type { IdentityService } from './identity-service';
|
||||
import type { BridgeEventBus } from './event-bus';
|
||||
import { createLogger, type Logger } from '../utils/logger';
|
||||
import { formatEvent } from '../utils/event-format';
|
||||
|
||||
const moduleLog = createLogger('Bridge');
|
||||
const moduleEventLog = createLogger('Event');
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
// Domain object shapes shared by IdentityService and its callers. The
|
||||
// concrete state (own UIN, friends list, group rosters, profile cache)
|
||||
// lives inside IdentityService — these interfaces just describe the
|
||||
// records that flow across remember*/refresh* and find* boundaries.
|
||||
|
||||
export interface UserProfileInfo {
|
||||
uin: number;
|
||||
uid: string;
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
// Web-cookie / credential primitives — every other web-action in this
|
||||
// directory builds on these. Each Bridge-level web call ends up doing
|
||||
// roughly: forceFetchClientKey -> ptlogin2 jump -> cookie dict ->
|
||||
// thread the cookies into a qun.qq.com REST endpoint.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { Bridge } from '../bridge';
|
||||
import { runOidb, makeOidbEnvelope } from '../bridge-oidb';
|
||||
import { makeOidbEnvelope, runOidb } from '../bridge-oidb';
|
||||
import { OidbBase } from '../proto/proton/oidb';
|
||||
import type {
|
||||
OidbClientKeyReq,
|
||||
@@ -57,8 +52,8 @@ export async function getCookies(bridge: Bridge, domain: string) {
|
||||
// bot to swap its clientKey for cookie-jar entries on a given
|
||||
// qq.com subdomain.
|
||||
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + bridge.identity.uin +
|
||||
'&clientkey=' + ClientKeyData.clientKey +
|
||||
'&u1=https%3A%2F%2F' + domain + '%2F' + bridge.identity.uin + '%2Finfocenter&keyindex=' + ClientKeyData.keyIndex;
|
||||
'&clientkey=' + ClientKeyData.clientKey +
|
||||
'&u1=https%3A%2F%2F' + domain + '%2F' + bridge.identity.uin + '%2Finfocenter&keyindex=' + ClientKeyData.keyIndex;
|
||||
|
||||
const data = await RequestUtil.HttpsGetCookies(requestUrl);
|
||||
|
||||
@@ -89,10 +84,10 @@ export async function getSKey(bridge: Bridge): Promise<string> {
|
||||
|
||||
const u1 = encodeURIComponent('https://h5.qzone.qq.com/qqnt/qzoneinpcqq/friend?refresh=0&clientuin=0&darkMode=0');
|
||||
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033' +
|
||||
'&clientuin=' + bridge.identity.uin +
|
||||
'&clientkey=' + ClientKeyData.clientKey +
|
||||
'&u1=' + u1 +
|
||||
'&keyindex=' + ClientKeyData.keyIndex;
|
||||
'&clientuin=' + bridge.identity.uin +
|
||||
'&clientkey=' + ClientKeyData.clientKey +
|
||||
'&u1=' + u1 +
|
||||
'&keyindex=' + ClientKeyData.keyIndex;
|
||||
|
||||
const cookies: { [key: string]: string } = await RequestUtil.HttpsGetCookies(requestUrl);
|
||||
const skey = cookies['skey'];
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// Group album actions via web API
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
import { getGroupAlbumList, uploadImageToGroupAlbum } from '../web/group-album';
|
||||
import { getCookies } from './cookies';
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
// `get_essence_msg_list` — group essence (highlighted) messages.
|
||||
// Two flavors: paginated (`getGroupEssence`) and the convenience
|
||||
// fetch-everything (`getGroupEssenceAll`).
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
import { getGroupEssenceMsg, getGroupEssenceMsgAll } from '../web/group-essence';
|
||||
import { getCookies } from './cookies';
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
// `get_group_honor_info` — queries the per-group honor leaderboards
|
||||
// (talkative / performer / legend / emotion / strong_newbie).
|
||||
// Each honor type is a separate web call; ALL fetches all four
|
||||
// non-newbie lists and folds them into one response.
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
import { getHonorListWebAPI, WebHonorType } from '../web/group-honor';
|
||||
import { getCookies } from './cookies';
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
// Group notice (`群公告`) web actions: send / list / delete.
|
||||
// `sendGroupNotice` can attach an optional image; when present it
|
||||
// stages the bytes (HTTP URL or local file) and uploads via the
|
||||
// notice-image endpoint before posting the notice itself.
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
import {
|
||||
setGroupNoticeWebAPI,
|
||||
getGroupNoticeWebAPI,
|
||||
uploadGroupNoticeImage,
|
||||
deleteGroupNotice,
|
||||
getGroupNoticeWebAPI,
|
||||
setGroupNoticeWebAPI,
|
||||
uploadGroupNoticeImage,
|
||||
} from '../web/group-notice';
|
||||
import { getCookies } from './cookies';
|
||||
|
||||
|
||||
@@ -1,32 +1,20 @@
|
||||
// Barrel for the web-action themed split. `bridge.ts` imports
|
||||
// everything from this directory as if it were a single file; the
|
||||
// per-theme files keep the implementation discoverable.
|
||||
|
||||
export {
|
||||
forceFetchClientKey,
|
||||
getPSkey,
|
||||
getCookies,
|
||||
getSKey,
|
||||
getBknFromSKey,
|
||||
getCookiesStr,
|
||||
getCsrfToken,
|
||||
getCredentials,
|
||||
forceFetchClientKey, getBknFromSKey, getCookies, getCookiesStr, getCredentials, getCsrfToken, getPSkey, getSKey
|
||||
} from './cookies';
|
||||
|
||||
export { getGroupHonorInfo } from './group-honor';
|
||||
|
||||
export {
|
||||
getGroupEssence,
|
||||
getGroupEssenceAll,
|
||||
getGroupEssenceAll
|
||||
} from './group-essence';
|
||||
|
||||
export {
|
||||
sendGroupNotice,
|
||||
getGroupNotice,
|
||||
deleteGroupNoticeByFid,
|
||||
deleteGroupNoticeByFid, getGroupNotice, sendGroupNotice
|
||||
} from './group-notice';
|
||||
|
||||
export {
|
||||
getGroupAlbumListWeb,
|
||||
uploadImageToGroupAlbumWeb,
|
||||
uploadImageToGroupAlbumWeb
|
||||
} from './group-album';
|
||||
|
||||
Reference in new issue
Block a user