nonebot-plugin-htmlrender
nonebot-plugin-htmlrender copied to clipboard
`*_to_pic` 工具函数不支持远程连接浏览器的场景
这些*_to_pic 的函数都会指定 html_to_pic 函数的 template_path 参数为某个文件 file://xxx
https://github.com/kexue-z/nonebot-plugin-htmlrender/blob/aabe39299cb4e9023e8f943db3854d2723d8f668/nonebot_plugin_htmlrender/data_source.py#L127
而 html_to_pic 会让浏览器 goto 这个文件
https://github.com/kexue-z/nonebot-plugin-htmlrender/blob/aabe39299cb4e9023e8f943db3854d2723d8f668/nonebot_plugin_htmlrender/data_source.py#L211-L215
但是在浏览器和nb分离部署的时候(HTMLRENDER_CONNECT=xxx),浏览器那边可能不会存在这个路径,导致爆炸。
可以考虑
- 添加参数
goto_url="about:blank"默认跳转到goto_url - template_path默认值改为"about:blank",但是
html_to_pic里会检查url是否以"file://"开头,并且语义不是很明确(
发现这个的原因是 bison 想分离浏览器,但是测试炸掉了: failed test
可以让分开后的两个目录一样可访问就行(
可以让分开后的两个目录一样可访问就行(
要是出现两个容器分属不同机器的情况呢,这样保持一致会很麻烦吧