You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---Original---
From: "Howcanoe ***@***.***>
Date: Sun, Aug 27, 2023 15:00 PM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [siyuan-note/siyuan] Add kernel API `/api/archive/zip` and`/api/archive/unzip` (Issue #9028)
额,macos上更新了dev之后,就开始报错获取内核服务端口失败,给了防火墙权限还是没有用。重启也不行,回退到旧版也不行了
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
---Original---
From: "Howcanoe ***@***.***>
Date: Sun, Aug 27, 2023 15:53 PM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [siyuan-note/siyuan] Add kernel API `/api/archive/zip` and`/api/archive/unzip` (Issue #9028)
Win / macOS / Linux 均测试通过,解压速度很快,也能正常使用
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
Activity
88250 commentedon Aug 22, 2023
通过内核 API 提供如何?
HowcanoeWang commentedon Aug 22, 2023
刚刚在折腾群群主的帮助下,用一个纯前端的库实现了,自己手撸了文件遍历解压,还是挺麻烦的。
有的内核API能提供这个功能的话,就更好不过了
[-]插件系统有可能把node的第三方库也打包进去吗[/-][+]Add kernel API `/api/archive/zip` and `/api/archive/unzip`[/+]88250 commentedon Aug 23, 2023
既然你已经实现了,内核的实现就先缓缓……
HowcanoeWang commentedon Aug 23, 2023
同样的解压代码在MacOS上跑,会报OOM(out of memory?)错误,还是期待一下官方的API实现,先在windows端把主要功能实现了再看看全平台的问题
88250 commentedon Aug 25, 2023
麻烦给出参数和返回值,我参考一下,谢谢。
HowcanoeWang commentedon Aug 25, 2023
自己随手撸的渣代码,感觉没啥参考价值
引入部分:https://github.com/HowcanoeWang/sython/blob/7151b311cc255c5f5ddeacd88ddcb7661b92b9f5/src/constants.ts#L3-L16
功能实现部分:https://github.com/HowcanoeWang/sython/blob/7151b311cc255c5f5ddeacd88ddcb7661b92b9f5/src/fileTool.ts#L70C2-L161
真就不如直接打包一个unzipper到思源内核里,比较省心
以及提供一个可以用来测试解压性能的zip包:https://gitee.com/HowcanoeWang/python3-embeddable/releases/download/v1.0.0/python3-windows-3.10.4-amd64.zip
🎨 Add kernel API `/api/archive/zip` and `/api/archive/unzip` Fix #9028
88250 commentedon Aug 26, 2023
HowcanoeWang commentedon Aug 26, 2023
优雅,太优雅了🐮
88250 commentedon Aug 27, 2023
稍后发布一个 dev 版,请帮忙测试看看。
HowcanoeWang commentedon Aug 27, 2023
尝试用这个方法来调用,遇到了
400 (Bad Request)
错误,不确定是我写的问题还是api的问题其中,console.log 出来的
zipFilePath
和extractToPath
值分别如下:报错的log:
88250 commentedon Aug 27, 2023
HowcanoeWang commentedon Aug 27, 2023
改成这样的代码就成功了
下午去实验室测试一下macos和linux上面的效果
HowcanoeWang commentedon Aug 27, 2023
额,macos上更新了dev之后,就开始报错获取内核服务端口失败,给了防火墙权限还是没有用。重启也不行,回退到旧版也不行了
#7001
重装+重启,然后拼手速点弹出来的允许网络访问,正常了=_=
88250 commentedon Aug 27, 2023
HowcanoeWang commentedon Aug 27, 2023
Win / macOS / Linux 均测试通过,解压速度很快,也能正常使用
88250 commentedon Aug 27, 2023
Zuoqiu-Yingyi commentedon Aug 27, 2023
@88250 这里的路径使用绝对路径有绕过访问控制的安全风险, 建议使用相对于工作空间目录的相对路径作为路径
88250 commentedon Aug 28, 2023
@Zuoqiu-Yingyi 考虑到有的场景可能需要全局路径所以就这样吧。
Zuoqiu-Yingyi commentedon Aug 28, 2023
有那哪些场景需要全局路径❓
HowcanoeWang commentedon Aug 28, 2023
比如导出插件,导出整个笔记为zip然后指定桌面为保存目录?
Zuoqiu-Yingyi commentedon Aug 28, 2023
桌面端有 Electron 的
globalThis.require("@electron/remote").dialog.showSaveDialog
web 端没啥意义
Zuoqiu-Yingyi commentedon Nov 22, 2023
@88250 该 API 可以通过覆盖原文件的方式篡改 可执行程序/shell脚本 实现远程代码执行, 最好还是限制一下其访问目录的范围
88250 commentedon Nov 22, 2023
@Zuoqiu-Yingyi 方便的话你 PR 吧,谢谢。