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

【功能建议】fileStorage改进 #138

Closed
DreamNya opened this issue Jan 18, 2023 · 5 comments · Fixed by #199
Closed

【功能建议】fileStorage改进 #138

DreamNya opened this issue Jan 18, 2023 · 5 comments · Fixed by #199
Labels
enhancement New feature or request

Comments

@DreamNya
Copy link
Contributor

1.死亡嵌套改成async/await(不重要,能跑就行:kissing_heart:)


2.增加自定义存储路径功能
目前只能存在以脚本的uuid为文件夹名的路径中,限制太大
个人觉得可以在参数中加一个可选参数path,path为空则存在默认的uuid中,path不为空则存在脚本自定义的path中
强制uuid可能在实际运用中存在各种问题,比如:删除脚本后又重新安装导致uuid变更则无法获取之前云存储的脚本;不方便管理等……

至于哥哥担心的安全问题,我认为uuid可以作为私密存储的方式,存储一些关键内容比如账号密码、cookies等;
api检索目录返回结果过滤掉其他脚本的uuid目录,且不允许自定义path中出现其他脚本uuid,即禁止B脚本读取或修改A脚本的私密存储uuid目录。
在此基础上允许脚本自定义path路径,可存在任意非uuid目录中,存储在自定义path中的内容为一些非关键内容,即使被其他脚本恶意读取也无伤大雅,比如脚本设置、运行日志等


3.切割fileStorage和脚本猫云同步
目前fileStorage和脚本猫云同步必须同时使用,为了让fileStorage正常运行,就必须打开云同步功能。

建议增加一块fileStorage专属的输入地址、账号、密码区域;
或者在脚本代码中加一个用户可以输入地址、账号、密码的地方,优先使用用户自定义的地址、账号、密码,使不同脚本可以用不同地址、账号、密码进行云存储;
如果上面2个都难以实现也可以在云同步输入地址、账号、密码成功登陆后加一个选项框让用户选择是否自动云同步(关闭则代表不使用脚本猫云同步,但地址、账号、密码可以供脚本fileStorage使用);

如果不切割会导致fileStorage这个api不够独立,受限较大,建议不要和脚本猫插件的云同步混同

@CodFrm CodFrm added the enhancement New feature or request label Jan 18, 2023
@CodFrm
Copy link
Member

CodFrm commented May 4, 2023

这个API确实有点激进,而且没有太多人使用,后续再继续考虑考虑

@DreamNya
Copy link
Contributor Author

DreamNya commented May 9, 2023

这个API确实有点激进,而且没有太多人使用,后续再继续考虑考虑

有没有一种可能,没有太多人使用的原因是这个API不够激进,太平庸了自然用的人就少了🙄
这个api完善一点完全可以给脚本提供一个全自动无缝云同步脚本内配置的功能,我自己用原生方法写了一个WebDAV的全自动方案,我用起来感觉是挺爽的😘,以前同步都是导出→微信文件助手→导入,这个操作看上去简单,但是次数多了也挺麻烦的

@CodFrm
Copy link
Member

CodFrm commented Jun 6, 2023

https://github.com/scriptscat/scriptcat/blob/main/example/cat_file_storage.js

近期准备对上述建议进行调整

@CodFrm
Copy link
Member

CodFrm commented Jun 10, 2023

死亡嵌套改成async/await

这点不打算进行修改,可以作者自行封装

增加自定义存储路径功能

考虑增加一个baseDir的参数来指定文件夹,不知道有没有更好的想法,默认是脚本的uuid

切割fileStorage和脚本猫云同步

在设置模块增加关于fileStorage的配置,当未配置时,调用fileStorage API,弹出页面并定位到此处

@CodFrm
Copy link
Member

CodFrm commented Jun 11, 2023

在beta分支实现了
https://github.com/scriptscat/scriptcat/actions/runs/5235288073

最终实现与上述有些出入的地方:

当未配置时,调用fileStorage API,弹出页面并定位到此处

不弹出页面,返回错误,由作者引导打开

    // 错误码 -1 未知错误 1 用户未配置文件储存源 2 文件储存源配置错误 3 路径不存在
    // 4 上传失败 5 下载失败 6 删除失败 7 不允许的文件路径

@CodFrm CodFrm linked a pull request Jun 12, 2023 that will close this issue
CodFrm added a commit that referenced this issue Jun 13, 2023
* ✨ 优化文件存储API

* 🐛 修复CAT storageFile API与增加baseDir示例

* ✨ CAT fileStorage打开配置页面

* 📝 CAT fileStorage API示例完善
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants