Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(QQ): 针对NCqq的图像格式的兼容性改进 #1066

Merged
merged 6 commits into from
Oct 15, 2024

Conversation

PaienNate
Copy link
Contributor

如题,通过GO-CQHTTP的描述:

发送时,file 参数支持:

绝对路径,例如 file:///C:\Users\Alice\Pictures\1.png,格式使用 file URI
网络 URL,例如 https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png
Base64 编码,例如 > >base64://iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAIAAADJt1n/AAAAKElEQVQ4EWPk5+RmIBcwkasRpG9UM4mhNxpgowFG> > MARGEwnBIEJVAAAdBgBNAZf+QAAAAABJRU5ErkJggg==
示例: [CQ:image,file=http://baidu.com/1.jpg,type=show,id=40004]

检查CQ码中file的链接,如果不符合上面的(如nc是xxxxxx.jpg),那么取url字段。原理如此,但是总觉得代码有点问题。

(cherry picked from commit ad3cc2b214c81d34e323893d4aa14052df730dd4)
@PaienNate PaienNate requested a review from a team October 15, 2024 06:44
@Xiangze-Li
Copy link
Member

不处理的问题是什么?海豹核心本身通常不处理图片

@PaienNate
Copy link
Contributor Author

不处理的问题是什么?海豹核心本身通常不处理图片

似乎是海豹在消息段/CQ码里取file那个字段,而file这个字段在GO-CQHTTP的定义里,是“文件名”;而URL才是文件的地址。

但是,似乎有一种用法是,不要URL,而是直接在file里填写URL。

海豹的处理是取出file的字段,而NC恰好将其作为文件名,于是海豹取出了文件名,并在某些情况下(比如复读),发现这个文件名不是文件地址,进而引发“CQ码找不到文件”这类的错误。

这个似乎受影响的还有插件,因为插件解析到的图片地址貌似就是file字段,但实际上应该拿URL字段?这边我不太清楚。

dice/platform_adapter_gocq.go Outdated Show resolved Hide resolved
dice/platform_adapter_gocq.go Outdated Show resolved Hide resolved
dice/platform_adapter_gocq.go Outdated Show resolved Hide resolved
dice/platform_adapter_gocq.go Outdated Show resolved Hide resolved
dice/platform_adapter_gocq.go Outdated Show resolved Hide resolved
@Xiangze-Li Xiangze-Li requested a review from a team October 15, 2024 11:33
@Xiangze-Li Xiangze-Li changed the title fix: 以一种需要推敲的方式修正了NC发送图片的问题(目前包括消息段和CQ码均可用) fix(QQ): 针对NCqq的图像格式的兼容性改进 Oct 15, 2024
@PaienNate PaienNate requested a review from fy0 October 15, 2024 13:51
Copy link
Collaborator

@JustAnotherID JustAnotherID left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JustAnotherID JustAnotherID merged commit d60e757 into sealdice:master Oct 15, 2024
2 checks passed
@PaienNate PaienNate deleted the fix_nc_pic branch October 20, 2024 01:34
PaienNate added a commit to PaienNate/sealdice-core that referenced this pull request Jan 17, 2025
* refactor: 日志模块大一统,提供全局日志 (sealdice#1062)

* fix(CoC): 单项结果文本被格式化两次, 属性表达式文本赋值顺序 (sealdice#1061)

* fix: 修正大一统日志的问题 (sealdice#1065)

* fix: 通过将日志上传改为异步改善竞争问题 (sealdice#1063)

Issue sealdice#1034

* fix(QQ): 针对NCqq的图像格式的兼容性改进 (sealdice#1066)

Co-authored-by: Xiangze Li <[email protected]>

* feat: 重定向输出panic日志到panic.log,并增加用户友好的日志模块提示。 (sealdice#1067)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build: upgrade go version to 1.22 and make lint happy (sealdice#1072)

Co-authored-by: Xiangze Li <[email protected]>

* ci: add review dog (sealdice#1078)

* style: make lint happy (sealdice#1079)

* ci: remove push event for review dog

(cherry picked from commit 3619e98)

* refactor(config): 迁移 Dice 中的设置项至独立的 struct 中 (sealdice#1070)

Co-authored-by: Xiangze Li <[email protected]>
Co-authored-by: PaienNate <[email protected]>
Co-authored-by: Szzrain <[email protected]>

* feat: 向即将不支持的操作系统弹出不兼容警告 (sealdice#1073)

* ci: add go cache step in lint

(cherry picked from commit 8265bab)

* fix(config): 修复部分配置项的保存不生效问题 (sealdice#1082)

* fix: 在解散群聊的时候,同步dismiss的操作去除群账号链接 (sealdice#1081)

Co-authored-by: JustAnotherID <[email protected]>

* feat(database): 为数据库执行输出 DEBUG 日志 (sealdice#1080)

Co-authored-by: JustAnotherID <[email protected]>

* docs: update README

* ci: fix reviewdog exit mode when it fails

* fix: 修正清理备份的按时间模式不正确生效问题 (sealdice#1084)

* fix: 修正windows系统panic日志无法输出到文件 (sealdice#1087)

* feat(api): 网络质量检查进行三次请求以提高结果准确性 (sealdice#1088)

* feat: 增加多个子模块 vm engine 开关 (sealdice#1086)

* fix: 先攻列表无法删除带有空格的名字的角色 (sealdice#1093)

* feat(deck): `draw list` 文案支持自定义 (sealdice#1097)

* fix(platform): 修正sealchat错误注册wss链接的bug (sealdice#1098)

* style: enable linter forbidigo, deal with old code (Cherrypicked sealdice#1094) (sealdice#1095)

* build(deps): 更新 goja 等多个依赖库 (sealdice#1103)

* fix(config): 修复个别配置项的设置在 UI 不生效的问题 (sealdice#1104)

* refactor(IMSession): 重构自动退群逻辑 (sealdice#1100)

* fix: 增强重构自动退群逻辑的判定机制 (sealdice#1105)

* feat: 为 dnd5e 扩展添加 rah/rch 功能 (sealdice#1107)

* refactor(database): 切换后端数据库操作库至gorm (sealdice#1060)

Co-authored-by: JustAnotherID <[email protected]>

* fix(Helpdoc): 使用帮助文档分组的别名时标题搜索失效 (sealdice#1120)

* fix: 将权限调整为0644以适应容器等特殊情况。 (sealdice#1124)

* build: add Taskfile.yml for task automation with go-task (sealdice#1125)

* fix(cmd-ww): 修复 wod 掷骰时设定的默认成功线和面数不生效 (sealdice#1128)

与旧版本仍有区别: 通过 r XaY 调用时, 通过 ww 设定的默认值无法生效. 旧版本中是生效的.

Fix sealdice#1127

* fix: js重载后指令顺序被打乱的问题 (sealdice#1131)

* fix(adapter): 修复了sealchat触发高频率重连的问题,并将重试次数减少到15次 (sealdice#1134)

* fix: 修复了d3 测试的输出异常,st代骰的输出异常,以及dnd rc改为小写以增强视觉一致性 (sealdice#1132)

* fix: 修复因为简化卡兼容而不能正常执行.st X-(1d4+1)的问题 (sealdice#1133)

* fix: 修复启动时数据库迁移和回收导致的过长启动时间,并对log_items做了特殊处理。同时修复jsReload后插件默认关闭的问题 (sealdice#1136)

* fix: 修正 attrs 表的迁移建表SQL (sealdice#1137)

* docs: Fix 404 link in README (sealdice#1141)

* fix: 修复一些情况下可能的 panic 问题 (sealdice#1140)

* fix: 修复 tg SDK` 会向 `stderr` 输出日志的问题 (sealdice#1139)

* fix(Config): 使 `task:cron` 和 `task:daily` 类型的配置能够正常被加载 (sealdice#1142)

* fix: 使注入了客户端私钥时不输出未找到私钥环境变量的Warn日志 (sealdice#1143)

* fix(Log): 修正由于钩子未命中导致的不能骰点统计 (sealdice#1144)

* feat(js&deck): 调整 JS 插件和牌堆接口中依赖 index 的 api (sealdice#1147)

* feat: 公骰列表后端基础功能 (sealdice#1145)

* fix: 解决插件配置项反序列化类型出错问题 (fix sealdice#1142) (sealdice#1150)

* fix: 第一次启动时部分参数无法正确初始化 (sealdice#1153)

* feat: 添加内置gocq(新版) (sealdice#1123)

* feat(DnD): 支持多轮检定 (sealdice#1152)

Co-authored-by: bugtower100 <[email protected]>

* fix: 修复 `.sn` 指令可以修改内部变量的问题 (sealdice#1161)

* refactor(helpdoc): 抽离帮助文档引擎并修正Arm下无法使用Bleve的问题 (sealdice#1158)

Co-authored-by: bugtower100 <[email protected]>

* feat: change link of adapter-lagrange-helper-go (sealdice#1164)

* feat(Adapter):使用适配器方式解析戳一戳CQ码 (sealdice#1169)

* feat(db): 多数据源支持和部分修正 (sealdice#1166)

Co-authored-by: bugtower100 <[email protected]>
Co-authored-by: fy <[email protected]>

* fix(lagrange): 修正Lagrange新签名地址错误添加多个斜杠的问题

* fix: 修正在无.env文件时导致崩溃的问题 (sealdice#1170)

* imp(backup): 优化了备份时的内存占用 (sealdice#1172)

* fix: 修正SQLITE数据库检查会全部异常FALSE的问题 (sealdice#1173)

* fix: 修正JS引擎崩溃时,错误的代码导致JS Panic未能成功捕获的问题 (sealdice#1174)

* refactor: 添加更友好的提示和判断,并在失败时回滚数据库处理 (sealdice#1175)

Co-authored-by: bugtower100 <[email protected]>

* chore: 修改版本号

* fix: 修复了之前PR引起的空数据库启动闪退问题 (sealdice#1176)

* fix(helpdoc): 修正帮助文档分页符无法使用的问题 (sealdice#1177)

Co-authored-by: bugtower100 <[email protected]>

* fix: 修正拷打狗异常 (sealdice#1179)

* fix: 修正群黑名单且未成功退群时,错误认为是用户黑名单导致炸豹的问题 (sealdice#1180)

* feat(lagrange): 动态拉取sign反代 (sealdice#1181)

* feat: 添加"使用者为管理员立即退群,为普通群员仅拒绝回复"后端逻辑 (sealdice#1183)

* feat: 公骰设置的后端API实现 (sealdice#1184)

* fix: 修正PostgreSQL和MySQL的日志不能正确打印到database.log的问题 (sealdice#1186)

Co-authored-by: bugtower100 <[email protected]>

* fix: 修正GroupInfo取RowsAffected逻辑错误导致部分group_player_info读取失败的问题 (sealdice#1188)

Co-authored-by: bugtower100 <[email protected]>

* fix: 修正使用First的情况下,查询会导致提示报错的问题 (sealdice#1190)

* fix: 修正帮助文档无法加载指令相关帮助文档的问题,并补充部分日志 (sealdice#1192)

* fix: 修复SignInfo空切片的问题 (sealdice#1194)

* feat: delete database.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Firewrk <[email protected]>
Co-authored-by: Xiangze Li <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JustAnotherID <[email protected]>
Co-authored-by: Szzrain <[email protected]>
Co-authored-by: JustAnotherID <[email protected]>
Co-authored-by: 暮星 <[email protected]>
Co-authored-by: fy <[email protected]>
Co-authored-by: Mint Cider <[email protected]>
Co-authored-by: Fripine <[email protected]>
Co-authored-by: bugtower100 <[email protected]>
Co-authored-by: kenichiLyon <[email protected]>
Co-authored-by: 炽热 <[email protected]>
Co-authored-by: bugtower <[email protected]>
Co-authored-by: baiyu-yu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants