mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-04-06 07:25:51 +00:00
Compare commits
1 Commits
nightly-de
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e35ee2d60 |
9
.github/workflows/dev-daily-fixed.yml
vendored
9
.github/workflows/dev-daily-fixed.yml
vendored
@@ -55,8 +55,6 @@ jobs:
|
|||||||
gh release delete "$FIXED_DEV_TAG" --repo "$GITHUB_REPOSITORY" --yes --cleanup-tag
|
gh release delete "$FIXED_DEV_TAG" --repo "$GITHUB_REPOSITORY" --yes --cleanup-tag
|
||||||
fi
|
fi
|
||||||
gh release create "$FIXED_DEV_TAG" --repo "$GITHUB_REPOSITORY" --title "Daily Dev Build" --notes "开发版发布页" --prerelease --target "$TARGET_BRANCH"
|
gh release create "$FIXED_DEV_TAG" --repo "$GITHUB_REPOSITORY" --title "Daily Dev Build" --notes "开发版发布页" --prerelease --target "$TARGET_BRANCH"
|
||||||
RELEASE_REST_ID="$(gh api "repos/$GITHUB_REPOSITORY/releases/tags/$FIXED_DEV_TAG" --jq '.id')"
|
|
||||||
gh api --method PATCH "repos/$GITHUB_REPOSITORY/releases/$RELEASE_REST_ID" -f draft=false -f prerelease=true >/dev/null
|
|
||||||
|
|
||||||
dev-mac-arm64:
|
dev-mac-arm64:
|
||||||
needs: prepare
|
needs: prepare
|
||||||
@@ -329,9 +327,4 @@ jobs:
|
|||||||
- 如某个平台资源暂未生成,请进入[发布页]($RELEASE_PAGE)查看最新状态
|
- 如某个平台资源暂未生成,请进入[发布页]($RELEASE_PAGE)查看最新状态
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
RELEASE_REST_ID="$(gh api "repos/$REPO/releases/tags/$TAG" --jq '.id')"
|
gh release edit "$TAG" --repo "$REPO" --title "Daily Dev Build" --notes-file dev_release_notes.md --prerelease
|
||||||
jq -n --rawfile body dev_release_notes.md \
|
|
||||||
'{name:"Daily Dev Build", body:$body, draft:false, prerelease:true}' \
|
|
||||||
> release_update_payload.json
|
|
||||||
gh api --method PATCH "repos/$REPO/releases/$RELEASE_REST_ID" --input release_update_payload.json >/dev/null
|
|
||||||
gh release view "$TAG" --repo "$REPO" --json isDraft,isPrerelease,url
|
|
||||||
|
|||||||
9
.github/workflows/preview-nightly-main.yml
vendored
9
.github/workflows/preview-nightly-main.yml
vendored
@@ -81,8 +81,6 @@ jobs:
|
|||||||
gh release delete "$FIXED_PREVIEW_TAG" --repo "$GITHUB_REPOSITORY" --yes --cleanup-tag
|
gh release delete "$FIXED_PREVIEW_TAG" --repo "$GITHUB_REPOSITORY" --yes --cleanup-tag
|
||||||
fi
|
fi
|
||||||
gh release create "$FIXED_PREVIEW_TAG" --repo "$GITHUB_REPOSITORY" --title "Preview Nightly Build" --notes "预览版发布页" --prerelease --target "$TARGET_BRANCH"
|
gh release create "$FIXED_PREVIEW_TAG" --repo "$GITHUB_REPOSITORY" --title "Preview Nightly Build" --notes "预览版发布页" --prerelease --target "$TARGET_BRANCH"
|
||||||
RELEASE_REST_ID="$(gh api "repos/$GITHUB_REPOSITORY/releases/tags/$FIXED_PREVIEW_TAG" --jq '.id')"
|
|
||||||
gh api --method PATCH "repos/$GITHUB_REPOSITORY/releases/$RELEASE_REST_ID" -f draft=false -f prerelease=true >/dev/null
|
|
||||||
|
|
||||||
preview-mac-arm64:
|
preview-mac-arm64:
|
||||||
needs: prepare
|
needs: prepare
|
||||||
@@ -371,9 +369,4 @@ jobs:
|
|||||||
> 如某个平台链接暂未生成,请前往[发布页]($RELEASE_PAGE)查看最新资源
|
> 如某个平台链接暂未生成,请前往[发布页]($RELEASE_PAGE)查看最新资源
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
RELEASE_REST_ID="$(gh api "repos/$REPO/releases/tags/$TAG" --jq '.id')"
|
gh release edit "$TAG" --repo "$REPO" --title "Preview Nightly Build" --notes-file preview_release_notes.md --prerelease
|
||||||
jq -n --rawfile body preview_release_notes.md \
|
|
||||||
'{name:"Preview Nightly Build", body:$body, draft:false, prerelease:true}' \
|
|
||||||
> release_update_payload.json
|
|
||||||
gh api --method PATCH "repos/$REPO/releases/$RELEASE_REST_ID" --input release_update_payload.json >/dev/null
|
|
||||||
gh release view "$TAG" --repo "$REPO" --json isDraft,isPrerelease,url
|
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -73,4 +73,3 @@ pnpm-lock.yaml
|
|||||||
wechat-research-site
|
wechat-research-site
|
||||||
.codex
|
.codex
|
||||||
weflow-web-offical
|
weflow-web-offical
|
||||||
Insight
|
|
||||||
@@ -5,9 +5,6 @@ interface ExportWorkerConfig {
|
|||||||
sessionIds: string[]
|
sessionIds: string[]
|
||||||
outputDir: string
|
outputDir: string
|
||||||
options: ExportOptions
|
options: ExportOptions
|
||||||
dbPath?: string
|
|
||||||
decryptKey?: string
|
|
||||||
myWxid?: string
|
|
||||||
resourcesPath?: string
|
resourcesPath?: string
|
||||||
userDataPath?: string
|
userDataPath?: string
|
||||||
logEnabled?: boolean
|
logEnabled?: boolean
|
||||||
@@ -32,11 +29,6 @@ async function run() {
|
|||||||
|
|
||||||
wcdbService.setPaths(config.resourcesPath || '', config.userDataPath || '')
|
wcdbService.setPaths(config.resourcesPath || '', config.userDataPath || '')
|
||||||
wcdbService.setLogEnabled(config.logEnabled === true)
|
wcdbService.setLogEnabled(config.logEnabled === true)
|
||||||
exportService.setRuntimeConfig({
|
|
||||||
dbPath: config.dbPath,
|
|
||||||
decryptKey: config.decryptKey,
|
|
||||||
myWxid: config.myWxid
|
|
||||||
})
|
|
||||||
|
|
||||||
const result = await exportService.exportSessions(
|
const result = await exportService.exportSessions(
|
||||||
Array.isArray(config.sessionIds) ? config.sessionIds : [],
|
Array.isArray(config.sessionIds) ? config.sessionIds : [],
|
||||||
|
|||||||
@@ -2362,9 +2362,6 @@ function registerIpcHandlers() {
|
|||||||
const cfg = configService || new ConfigService()
|
const cfg = configService || new ConfigService()
|
||||||
configService = cfg
|
configService = cfg
|
||||||
const logEnabled = cfg.get('logEnabled')
|
const logEnabled = cfg.get('logEnabled')
|
||||||
const dbPath = String(cfg.get('dbPath') || '').trim()
|
|
||||||
const decryptKey = String(cfg.get('decryptKey') || '').trim()
|
|
||||||
const myWxid = String(cfg.get('myWxid') || '').trim()
|
|
||||||
const resourcesPath = app.isPackaged
|
const resourcesPath = app.isPackaged
|
||||||
? join(process.resourcesPath, 'resources')
|
? join(process.resourcesPath, 'resources')
|
||||||
: join(app.getAppPath(), 'resources')
|
: join(app.getAppPath(), 'resources')
|
||||||
@@ -2378,9 +2375,6 @@ function registerIpcHandlers() {
|
|||||||
sessionIds,
|
sessionIds,
|
||||||
outputDir,
|
outputDir,
|
||||||
options,
|
options,
|
||||||
dbPath,
|
|
||||||
decryptKey,
|
|
||||||
myWxid,
|
|
||||||
resourcesPath,
|
resourcesPath,
|
||||||
userDataPath,
|
userDataPath,
|
||||||
logEnabled
|
logEnabled
|
||||||
|
|||||||
@@ -4486,16 +4486,15 @@ class ChatService {
|
|||||||
*/
|
*/
|
||||||
private parseQuoteMessage(content: string): { content?: string; sender?: string } {
|
private parseQuoteMessage(content: string): { content?: string; sender?: string } {
|
||||||
try {
|
try {
|
||||||
const normalizedContent = this.decodeHtmlEntities(content || '')
|
|
||||||
// 提取 refermsg 部分
|
// 提取 refermsg 部分
|
||||||
const referMsgStart = normalizedContent.indexOf('<refermsg>')
|
const referMsgStart = content.indexOf('<refermsg>')
|
||||||
const referMsgEnd = normalizedContent.indexOf('</refermsg>')
|
const referMsgEnd = content.indexOf('</refermsg>')
|
||||||
|
|
||||||
if (referMsgStart === -1 || referMsgEnd === -1) {
|
if (referMsgStart === -1 || referMsgEnd === -1) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const referMsgXml = normalizedContent.substring(referMsgStart, referMsgEnd + 11)
|
const referMsgXml = content.substring(referMsgStart, referMsgEnd + 11)
|
||||||
|
|
||||||
// 提取发送者名称
|
// 提取发送者名称
|
||||||
let displayName = this.extractXmlValue(referMsgXml, 'displayname')
|
let displayName = this.extractXmlValue(referMsgXml, 'displayname')
|
||||||
@@ -4512,8 +4511,8 @@ class ChatService {
|
|||||||
let displayContent = referContent
|
let displayContent = referContent
|
||||||
switch (referType) {
|
switch (referType) {
|
||||||
case '1':
|
case '1':
|
||||||
// 文本消息优先取“部分引用”字段,缺失时再回退到完整 content
|
// 文本消息,清理可能的 wxid
|
||||||
displayContent = this.extractPreferredQuotedText(referMsgXml)
|
displayContent = this.sanitizeQuotedContent(referContent)
|
||||||
break
|
break
|
||||||
case '3':
|
case '3':
|
||||||
displayContent = '[图片]'
|
displayContent = '[图片]'
|
||||||
@@ -4553,76 +4552,6 @@ class ChatService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private extractPreferredQuotedText(referMsgXml: string): string {
|
|
||||||
if (!referMsgXml) return ''
|
|
||||||
|
|
||||||
const sources = [this.decodeHtmlEntities(referMsgXml)]
|
|
||||||
const rawMsgSource = this.extractXmlValue(referMsgXml, 'msgsource')
|
|
||||||
if (rawMsgSource) {
|
|
||||||
const decodedMsgSource = this.decodeHtmlEntities(rawMsgSource)
|
|
||||||
if (decodedMsgSource) {
|
|
||||||
sources.push(decodedMsgSource)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fullContent = this.sanitizeQuotedContent(this.extractXmlValue(sources[0] || referMsgXml, 'content'))
|
|
||||||
const partialText = this.extractPartialQuotedText(sources[0] || referMsgXml, fullContent)
|
|
||||||
if (partialText) return partialText
|
|
||||||
|
|
||||||
const candidateTags = [
|
|
||||||
'selectedcontent',
|
|
||||||
'selectedtext',
|
|
||||||
'selectcontent',
|
|
||||||
'selecttext',
|
|
||||||
'quotecontent',
|
|
||||||
'quotetext',
|
|
||||||
'partcontent',
|
|
||||||
'parttext',
|
|
||||||
'excerpt',
|
|
||||||
'summary',
|
|
||||||
'preview'
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const source of sources) {
|
|
||||||
for (const tag of candidateTags) {
|
|
||||||
const value = this.sanitizeQuotedContent(this.extractXmlValue(source, tag))
|
|
||||||
if (value) return value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fullContent
|
|
||||||
}
|
|
||||||
|
|
||||||
private extractPartialQuotedText(xml: string, fullContent: string): string {
|
|
||||||
if (!xml || !fullContent) return ''
|
|
||||||
|
|
||||||
const startChar = this.extractXmlValue(xml, 'start')
|
|
||||||
const endChar = this.extractXmlValue(xml, 'end')
|
|
||||||
const startIndexRaw = this.extractXmlValue(xml, 'startindex')
|
|
||||||
const endIndexRaw = this.extractXmlValue(xml, 'endindex')
|
|
||||||
const startIndex = Number.parseInt(startIndexRaw, 10)
|
|
||||||
const endIndex = Number.parseInt(endIndexRaw, 10)
|
|
||||||
|
|
||||||
if (startChar && endChar) {
|
|
||||||
const startPos = fullContent.indexOf(startChar)
|
|
||||||
if (startPos !== -1) {
|
|
||||||
const endPos = fullContent.indexOf(endChar, startPos + startChar.length - 1)
|
|
||||||
if (endPos !== -1 && endPos >= startPos) {
|
|
||||||
const sliced = fullContent.slice(startPos, endPos + endChar.length).trim()
|
|
||||||
if (sliced) return sliced
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Number.isFinite(startIndex) && Number.isFinite(endIndex) && endIndex >= startIndex) {
|
|
||||||
const chars = Array.from(fullContent)
|
|
||||||
const sliced = chars.slice(startIndex, endIndex + 1).join('').trim()
|
|
||||||
if (sliced) return sliced
|
|
||||||
}
|
|
||||||
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析名片消息
|
* 解析名片消息
|
||||||
* 格式: <msg username="wxid_xxx" nickname="昵称" ... />
|
* 格式: <msg username="wxid_xxx" nickname="昵称" ... />
|
||||||
|
|||||||
@@ -5,13 +5,6 @@ import Store from 'electron-store'
|
|||||||
|
|
||||||
// 加密前缀标记
|
// 加密前缀标记
|
||||||
const SAFE_PREFIX = 'safe:' // safeStorage 加密(普通模式)
|
const SAFE_PREFIX = 'safe:' // safeStorage 加密(普通模式)
|
||||||
const isSafeStorageAvailable = (): boolean => {
|
|
||||||
try {
|
|
||||||
return typeof safeStorage?.isEncryptionAvailable === 'function' && safeStorage.isEncryptionAvailable()
|
|
||||||
} catch {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const LOCK_PREFIX = 'lock:' // 密码派生密钥加密(锁定模式)
|
const LOCK_PREFIX = 'lock:' // 密码派生密钥加密(锁定模式)
|
||||||
|
|
||||||
interface ConfigSchema {
|
interface ConfigSchema {
|
||||||
@@ -264,7 +257,7 @@ export class ConfigService {
|
|||||||
private safeEncrypt(plaintext: string): string {
|
private safeEncrypt(plaintext: string): string {
|
||||||
if (!plaintext) return ''
|
if (!plaintext) return ''
|
||||||
if (plaintext.startsWith(SAFE_PREFIX)) return plaintext
|
if (plaintext.startsWith(SAFE_PREFIX)) return plaintext
|
||||||
if (!isSafeStorageAvailable()) return plaintext
|
if (!safeStorage.isEncryptionAvailable()) return plaintext
|
||||||
const encrypted = safeStorage.encryptString(plaintext)
|
const encrypted = safeStorage.encryptString(plaintext)
|
||||||
return SAFE_PREFIX + encrypted.toString('base64')
|
return SAFE_PREFIX + encrypted.toString('base64')
|
||||||
}
|
}
|
||||||
@@ -272,7 +265,7 @@ export class ConfigService {
|
|||||||
private safeDecrypt(stored: string): string {
|
private safeDecrypt(stored: string): string {
|
||||||
if (!stored) return ''
|
if (!stored) return ''
|
||||||
if (!stored.startsWith(SAFE_PREFIX)) return stored
|
if (!stored.startsWith(SAFE_PREFIX)) return stored
|
||||||
if (!isSafeStorageAvailable()) return ''
|
if (!safeStorage.isEncryptionAvailable()) return ''
|
||||||
try {
|
try {
|
||||||
const buf = Buffer.from(stored.slice(SAFE_PREFIX.length), 'base64')
|
const buf = Buffer.from(stored.slice(SAFE_PREFIX.length), 'base64')
|
||||||
return safeStorage.decryptString(buf)
|
return safeStorage.decryptString(buf)
|
||||||
|
|||||||
@@ -254,7 +254,6 @@ async function parallelLimit<T, R>(
|
|||||||
|
|
||||||
class ExportService {
|
class ExportService {
|
||||||
private configService: ConfigService
|
private configService: ConfigService
|
||||||
private runtimeConfig: { dbPath?: string; decryptKey?: string; myWxid?: string } | null = null
|
|
||||||
private contactCache: LRUCache<string, { displayName: string; avatarUrl?: string }>
|
private contactCache: LRUCache<string, { displayName: string; avatarUrl?: string }>
|
||||||
private inlineEmojiCache: LRUCache<string, string>
|
private inlineEmojiCache: LRUCache<string, string>
|
||||||
private htmlStyleCache: string | null = null
|
private htmlStyleCache: string | null = null
|
||||||
@@ -296,10 +295,6 @@ class ExportService {
|
|||||||
return error
|
return error
|
||||||
}
|
}
|
||||||
|
|
||||||
setRuntimeConfig(config: { dbPath?: string; decryptKey?: string; myWxid?: string } | null): void {
|
|
||||||
this.runtimeConfig = config
|
|
||||||
}
|
|
||||||
|
|
||||||
private normalizeSessionIds(sessionIds: string[]): string[] {
|
private normalizeSessionIds(sessionIds: string[]): string[] {
|
||||||
return Array.from(
|
return Array.from(
|
||||||
new Set((sessionIds || []).map((id) => String(id || '').trim()).filter(Boolean))
|
new Set((sessionIds || []).map((id) => String(id || '').trim()).filter(Boolean))
|
||||||
@@ -1321,9 +1316,9 @@ class ExportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async ensureConnected(): Promise<{ success: boolean; cleanedWxid?: string; error?: string }> {
|
private async ensureConnected(): Promise<{ success: boolean; cleanedWxid?: string; error?: string }> {
|
||||||
const wxid = String(this.runtimeConfig?.myWxid || this.configService.get('myWxid') || '').trim()
|
const wxid = this.configService.get('myWxid')
|
||||||
const dbPath = String(this.runtimeConfig?.dbPath || this.configService.get('dbPath') || '').trim()
|
const dbPath = this.configService.get('dbPath')
|
||||||
const decryptKey = String(this.runtimeConfig?.decryptKey || this.configService.get('decryptKey') || '').trim()
|
const decryptKey = this.configService.get('decryptKey')
|
||||||
if (!wxid) return { success: false, error: '请先在设置页面配置微信ID' }
|
if (!wxid) return { success: false, error: '请先在设置页面配置微信ID' }
|
||||||
if (!dbPath) return { success: false, error: '请先在设置页面配置数据库路径' }
|
if (!dbPath) return { success: false, error: '请先在设置页面配置数据库路径' }
|
||||||
if (!decryptKey) return { success: false, error: '请先在设置页面配置解密密钥' }
|
if (!decryptKey) return { success: false, error: '请先在设置页面配置解密密钥' }
|
||||||
@@ -2259,7 +2254,7 @@ class ExportService {
|
|||||||
const referMsgXml = normalized.substring(referMsgStart, referMsgEnd + 11)
|
const referMsgXml = normalized.substring(referMsgStart, referMsgEnd + 11)
|
||||||
const quoteInfo = this.parseQuoteMessage(normalized)
|
const quoteInfo = this.parseQuoteMessage(normalized)
|
||||||
const replyText = this.stripSenderPrefix(this.extractXmlValue(normalized, 'title') || '')
|
const replyText = this.stripSenderPrefix(this.extractXmlValue(normalized, 'title') || '')
|
||||||
const quotedPreview = quoteInfo.content || this.formatQuotedReferencePreview(
|
const quotedPreview = this.formatQuotedReferencePreview(
|
||||||
this.extractXmlValue(referMsgXml, 'content'),
|
this.extractXmlValue(referMsgXml, 'content'),
|
||||||
this.extractXmlValue(referMsgXml, 'type')
|
this.extractXmlValue(referMsgXml, 'type')
|
||||||
)
|
)
|
||||||
@@ -2965,7 +2960,7 @@ class ExportService {
|
|||||||
|
|
||||||
switch (referType) {
|
switch (referType) {
|
||||||
case '1':
|
case '1':
|
||||||
displayContent = this.extractPreferredQuotedText(referMsgXml)
|
displayContent = this.sanitizeQuotedContent(referContent)
|
||||||
break
|
break
|
||||||
case '3':
|
case '3':
|
||||||
displayContent = '[图片]'
|
displayContent = '[图片]'
|
||||||
@@ -3006,76 +3001,6 @@ class ExportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private extractPreferredQuotedText(referMsgXml: string): string {
|
|
||||||
if (!referMsgXml) return ''
|
|
||||||
|
|
||||||
const sources = [this.decodeHtmlEntities(referMsgXml)]
|
|
||||||
const rawMsgSource = this.extractXmlValue(referMsgXml, 'msgsource')
|
|
||||||
if (rawMsgSource) {
|
|
||||||
const decodedMsgSource = this.decodeHtmlEntities(rawMsgSource)
|
|
||||||
if (decodedMsgSource) {
|
|
||||||
sources.push(decodedMsgSource)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fullContent = this.sanitizeQuotedContent(this.extractXmlValue(sources[0] || referMsgXml, 'content'))
|
|
||||||
const partialText = this.extractPartialQuotedText(sources[0] || referMsgXml, fullContent)
|
|
||||||
if (partialText) return partialText
|
|
||||||
|
|
||||||
const candidateTags = [
|
|
||||||
'selectedcontent',
|
|
||||||
'selectedtext',
|
|
||||||
'selectcontent',
|
|
||||||
'selecttext',
|
|
||||||
'quotecontent',
|
|
||||||
'quotetext',
|
|
||||||
'partcontent',
|
|
||||||
'parttext',
|
|
||||||
'excerpt',
|
|
||||||
'summary',
|
|
||||||
'preview'
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const source of sources) {
|
|
||||||
for (const tag of candidateTags) {
|
|
||||||
const value = this.sanitizeQuotedContent(this.extractXmlValue(source, tag))
|
|
||||||
if (value) return value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fullContent
|
|
||||||
}
|
|
||||||
|
|
||||||
private extractPartialQuotedText(xml: string, fullContent: string): string {
|
|
||||||
if (!xml || !fullContent) return ''
|
|
||||||
|
|
||||||
const startChar = this.extractXmlValue(xml, 'start')
|
|
||||||
const endChar = this.extractXmlValue(xml, 'end')
|
|
||||||
const startIndexRaw = this.extractXmlValue(xml, 'startindex')
|
|
||||||
const endIndexRaw = this.extractXmlValue(xml, 'endindex')
|
|
||||||
const startIndex = Number.parseInt(startIndexRaw, 10)
|
|
||||||
const endIndex = Number.parseInt(endIndexRaw, 10)
|
|
||||||
|
|
||||||
if (startChar && endChar) {
|
|
||||||
const startPos = fullContent.indexOf(startChar)
|
|
||||||
if (startPos !== -1) {
|
|
||||||
const endPos = fullContent.indexOf(endChar, startPos + startChar.length - 1)
|
|
||||||
if (endPos !== -1 && endPos >= startPos) {
|
|
||||||
const sliced = fullContent.slice(startPos, endPos + endChar.length).trim()
|
|
||||||
if (sliced) return sliced
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Number.isFinite(startIndex) && Number.isFinite(endIndex) && endIndex >= startIndex) {
|
|
||||||
const chars = Array.from(fullContent)
|
|
||||||
const sliced = chars.slice(startIndex, endIndex + 1).join('').trim()
|
|
||||||
if (sliced) return sliced
|
|
||||||
}
|
|
||||||
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
private extractChatLabReplyToMessageId(content: string): string | undefined {
|
private extractChatLabReplyToMessageId(content: string): string | undefined {
|
||||||
try {
|
try {
|
||||||
const normalized = this.normalizeAppMessageContent(content || '')
|
const normalized = this.normalizeAppMessageContent(content || '')
|
||||||
|
|||||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -19,7 +19,7 @@
|
|||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
"jieba-wasm": "^2.2.0",
|
"jieba-wasm": "^2.2.0",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"koffi": "^2.9.0",
|
"koffi": "^2.15.5",
|
||||||
"lucide-react": "^1.7.0",
|
"lucide-react": "^1.7.0",
|
||||||
"react": "^19.2.3",
|
"react": "^19.2.3",
|
||||||
"react-dom": "^19.2.3",
|
"react-dom": "^19.2.3",
|
||||||
@@ -6531,9 +6531,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/koffi": {
|
"node_modules/koffi": {
|
||||||
"version": "2.15.2",
|
"version": "2.15.5",
|
||||||
"resolved": "https://registry.npmjs.org/koffi/-/koffi-2.15.2.tgz",
|
"resolved": "https://registry.npmjs.org/koffi/-/koffi-2.15.5.tgz",
|
||||||
"integrity": "sha512-r9tjJLVRSOhCRWdVyQlF3/Ugzeg13jlzS4czS82MAgLff4W+BcYOW7g8Y62t9O5JYjYOLAjAovAZDNlDfZNu+g==",
|
"integrity": "sha512-4/35/oOpnH9tzrpWAC3ObjAERBSe0Q0Dh2NP1eBBPRGpohEj4vFw2+7tej9W9MTExvk0vtF0PjMqIGG4rf6feQ==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"funding": {
|
"funding": {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
"jieba-wasm": "^2.2.0",
|
"jieba-wasm": "^2.2.0",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"koffi": "^2.9.0",
|
"koffi": "^2.15.5",
|
||||||
"lucide-react": "^1.7.0",
|
"lucide-react": "^1.7.0",
|
||||||
"react": "^19.2.3",
|
"react": "^19.2.3",
|
||||||
"react-dom": "^19.2.3",
|
"react-dom": "^19.2.3",
|
||||||
|
|||||||
@@ -8695,28 +8695,6 @@ function MessageBubble({
|
|||||||
appMsgTextCache.set(selector, value)
|
appMsgTextCache.set(selector, value)
|
||||||
return value
|
return value
|
||||||
}, [appMsgDoc, appMsgTextCache])
|
}, [appMsgDoc, appMsgTextCache])
|
||||||
const queryPreferredQuotedContent = useCallback((): string => {
|
|
||||||
if (message.quotedContent) return message.quotedContent
|
|
||||||
const candidates = [
|
|
||||||
'refermsg > selectedcontent',
|
|
||||||
'refermsg > selectedtext',
|
|
||||||
'refermsg > selectcontent',
|
|
||||||
'refermsg > selecttext',
|
|
||||||
'refermsg > quotecontent',
|
|
||||||
'refermsg > quotetext',
|
|
||||||
'refermsg > partcontent',
|
|
||||||
'refermsg > parttext',
|
|
||||||
'refermsg > excerpt',
|
|
||||||
'refermsg > summary',
|
|
||||||
'refermsg > preview',
|
|
||||||
'refermsg > content'
|
|
||||||
]
|
|
||||||
for (const selector of candidates) {
|
|
||||||
const value = queryAppMsgText(selector)
|
|
||||||
if (value) return value
|
|
||||||
}
|
|
||||||
return ''
|
|
||||||
}, [message.quotedContent, queryAppMsgText])
|
|
||||||
const appMsgThumbRawCandidate = useMemo(() => (
|
const appMsgThumbRawCandidate = useMemo(() => (
|
||||||
message.linkThumb ||
|
message.linkThumb ||
|
||||||
message.appMsgThumbUrl ||
|
message.appMsgThumbUrl ||
|
||||||
@@ -8734,7 +8712,7 @@ function MessageBubble({
|
|||||||
queryAppMsgText('refermsg > fromusr'),
|
queryAppMsgText('refermsg > fromusr'),
|
||||||
queryAppMsgText('refermsg > chatusr')
|
queryAppMsgText('refermsg > chatusr')
|
||||||
)
|
)
|
||||||
const quotedContent = queryPreferredQuotedContent()
|
const quotedContent = message.quotedContent || queryAppMsgText('refermsg > content') || ''
|
||||||
const quotedSenderFallbackName = useMemo(
|
const quotedSenderFallbackName = useMemo(
|
||||||
() => resolveQuotedSenderFallbackDisplayName(
|
() => resolveQuotedSenderFallbackDisplayName(
|
||||||
session.username,
|
session.username,
|
||||||
@@ -9284,7 +9262,7 @@ function MessageBubble({
|
|||||||
// type 57: 引用回复消息,解析 refermsg 渲染为引用样式
|
// type 57: 引用回复消息,解析 refermsg 渲染为引用样式
|
||||||
if (xmlType === '57') {
|
if (xmlType === '57') {
|
||||||
const replyText = q('title') || cleanedParsedContent || ''
|
const replyText = q('title') || cleanedParsedContent || ''
|
||||||
const referContent = queryPreferredQuotedContent()
|
const referContent = q('refermsg > content') || ''
|
||||||
const referType = q('refermsg > type') || ''
|
const referType = q('refermsg > type') || ''
|
||||||
|
|
||||||
// 根据被引用消息类型渲染对应内容
|
// 根据被引用消息类型渲染对应内容
|
||||||
@@ -9407,7 +9385,7 @@ function MessageBubble({
|
|||||||
if (kind === 'quote') {
|
if (kind === 'quote') {
|
||||||
// 引用回复消息(appMsgKind='quote',xmlType=57)
|
// 引用回复消息(appMsgKind='quote',xmlType=57)
|
||||||
const replyText = message.linkTitle || q('title') || cleanedParsedContent || ''
|
const replyText = message.linkTitle || q('title') || cleanedParsedContent || ''
|
||||||
const referContent = queryPreferredQuotedContent()
|
const referContent = message.quotedContent || q('refermsg > content') || ''
|
||||||
return (
|
return (
|
||||||
renderBubbleWithQuote(
|
renderBubbleWithQuote(
|
||||||
renderQuotedMessageBlock(renderTextWithEmoji(cleanMessageContent(referContent))),
|
renderQuotedMessageBlock(renderTextWithEmoji(cleanMessageContent(referContent))),
|
||||||
@@ -9598,7 +9576,7 @@ function MessageBubble({
|
|||||||
// 引用回复消息 (type=57),防止被误判为链接
|
// 引用回复消息 (type=57),防止被误判为链接
|
||||||
if (appMsgType === '57') {
|
if (appMsgType === '57') {
|
||||||
const replyText = parsedDoc?.querySelector('title')?.textContent?.trim() || cleanedParsedContent || ''
|
const replyText = parsedDoc?.querySelector('title')?.textContent?.trim() || cleanedParsedContent || ''
|
||||||
const referContent = queryPreferredQuotedContent()
|
const referContent = parsedDoc?.querySelector('refermsg > content')?.textContent?.trim() || ''
|
||||||
const referType = parsedDoc?.querySelector('refermsg > type')?.textContent?.trim() || ''
|
const referType = parsedDoc?.querySelector('refermsg > type')?.textContent?.trim() || ''
|
||||||
|
|
||||||
const renderReferContent2 = () => {
|
const renderReferContent2 = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user