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

CAT_fileStorage 重置 onedrive #224

Closed
ChitaGideon opened this issue Aug 3, 2023 · 31 comments
Closed

CAT_fileStorage 重置 onedrive #224

ChitaGideon opened this issue Aug 3, 2023 · 31 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@ChitaGideon
Copy link

点重置感觉没啥用;
再点保存显示成功。
但根本没有提示新的auth;不懂成功了啥。
调用api 提示 红色 储存错误

@CodFrm
Copy link
Member

CodFrm commented Aug 15, 2023

如果有网盘的授权信息,点击保存不会再去申请授权,会复用现有的授权

重置就是改为未设置,调用这个API存储时将会提示储存未设置的错误

红色就授权失败了,储存无法连接,和未设置一个效果

@ChitaGideon
Copy link
Author

如果有网盘的授权信息,点击保存不会再去申请授权,会复用现有的授权

重置就是改为未设置,调用这个API存储时将会提示储存未设置的错误

红色就授权失败了,储存无法连接,和未设置一个效果

如果我需要换个onedrive授权怎么办呢?

我这边显示授权成功使用中了,但调用api却显示红色失败,该怎么处理呢

@CodFrm
Copy link
Member

CodFrm commented Aug 15, 2023

@ChitaGideon 这样的话,是有点问题,无法切换,后续版本优化一下这个问题

现在的话,可以去localStorage删除一下数据

调用api却显示红色失败是什么意思?有错误信息吗?

@CodFrm CodFrm added the enhancement New feature or request label Aug 15, 2023
@ChitaGideon
Copy link
Author

现在是显示
image
就是调用api, 这个地方会报错;
今天试了试 好像没变红了;但api也没调用成功,onload一直没执行;

     CAT_fileStorage("list", {
            baseDir: "test-dir",
            onload(list) {
                console.log('CAT_fileStorage!!!',list);
}});
CAT_fileStorage("upload", {
    path: "test.txt",
    data: new Blob(["Hello World"]),
    onload() {
        console.log('success test')
    }})

@ChitaGideon
Copy link
Author

又是这个错误
image

@CodFrm CodFrm added the bug Something isn't working label Aug 16, 2023
@CodFrm
Copy link
Member

CodFrm commented Aug 16, 2023

目前的错误处理有点问题,只要出现了错误就会把这里变为错误状态,不太合理,应该只有token之类的授权错误才这样。下个版本处理一下

@CodFrm
Copy link
Member

CodFrm commented Aug 25, 2023

试试这个包:https://github.com/scriptscat/scriptcat/actions/runs/5972635761/job/16203489052

修复了上面的问题,会返回code=8表示网络之类的错误

@ChitaGideon
Copy link
Author

试试这个包:https://github.com/scriptscat/scriptcat/actions/runs/5972635761/job/16203489052

修复了上面的问题,会返回code=8表示网络之类的错误

账号信息验证失败: Error: {"error":{"code":"invalidRequest","message":"Invalid request","innerError":{"date":"2023-09-01T01:56:27","request-id":"ff1979fb-7c66-4042-a331-584e06a7e087","client-request-id":"ff1979fb-7c66-4042-a331-584e06a7e087"}}}

我用的是onedrive e5账号,是不是因为这个?

@CodFrm
Copy link
Member

CodFrm commented Sep 1, 2023

@ChitaGideon 不太清楚,试试普通的账号呢?

@CodFrm
Copy link
Member

CodFrm commented Sep 1, 2023

@ChitaGideon 另外可以在background.html或者打开开发者工具->network看到具体的请求内容,可以截图看一下

image

@ChitaGideon
Copy link
Author

用普通个人账号好像是没问题的;
用e5账号,或者可能一些onedrive business的账号,请求会出错。
image

@CodFrm
Copy link
Member

CodFrm commented Sep 1, 2023

那这可能得再研究研究了,我没有e5账号

@ChitaGideon
Copy link
Author

那这可能得再研究研究了,我没有e5账号

我可以给你一个子账号,拿去玩,给我个邮箱什么的,我发给你

@CodFrm
Copy link
Member

CodFrm commented Sep 1, 2023

@ChitaGideon 可以试试,邮箱 yz@ggnb.top

@ChitaGideon
Copy link
Author

@ChitaGideon 可以试试,邮箱 yz@ggnb.top

邮件应该发出了,没收到的话,告诉我

@CodFrm
Copy link
Member

CodFrm commented Sep 6, 2023

@ChitaGideon 没有收到

@ChitaGideon
Copy link
Author

@ChitaGideon 没有收到

我单独又发了一次,再看看

@CodFrm
Copy link
Member

CodFrm commented Sep 6, 2023

@ChitaGideon 收到了,谢谢哥哥,我周末看看

@ChitaGideon
Copy link
Author

@CodFrm 这个部分有进展没,还是有什么太麻烦的问题?

@CodFrm
Copy link
Member

CodFrm commented Nov 27, 2023

忘记了,不好意思,我明天看看,尴尬,最近在完善脚本猫其它的东西

@CodFrm
Copy link
Member

CodFrm commented Nov 28, 2023

@ChitaGideon approot 应用文件夹,脚本猫的数据是存在这个目录下的,不知道是无权限还是什么问题,这个请求得到的是400,后面一个请求得到的是403,应该是无权限(不知道是否和我使用的是me有关)

我找到了其他软件的相关内容,可能需要哥哥参考设置一下权限,另外尝试一下请求能否成功:remotely-save/remotely-save#11

curl --location 'https://graph.microsoft.com/v1.0/me/drive/special/approot::/children' \
--header 'authorization: Bearer onedrive的token,localStorage中有存储'

curl --location 'https://graph.microsoft.com/v1.0/drive/special/approot/children' \
--header 'authorization: Bearer onedrive的token,localStorage中有存储'

@ChitaGideon
Copy link
Author

@CodFrm 权限么,之前只有两个;
现在已经授权这些了: 看对不对
QQ20231128-112834@2x

我试了 第二个

curl --location 'https://graph.microsoft.com/v1.0/drive/special/approot/children' \
--header 'authorization: Bearer onedrive的token,localStorage中有存储'

没有报错了

{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('70124245-51bc-46f1-b8a9-d93c827f34c9')/drive/special('approot')/children","value":[]}%

@CodFrm
Copy link
Member

CodFrm commented Nov 28, 2023

@ChitaGideon 创建文件上传会话400了,通过上传会话上传大文件,不知道是否是需要应用程序 | Sites.ReadWrite.All这个权限

curl --location 'https://graph.microsoft.com/v1.0/drive/special/approot:/scriptcat-backup.zip:/createUploadSession' \
--header 'content-type: application/json' \
--header 'authorization: Bearer xxxxx' \
--data-raw '{
    "item": {
        "@microsoft.graph.conflictBehavior": "replace",
        "description": "description",
        "fileSystemInfo": {
            "@odata.type": "microsoft.graph.fileSystemInfo"
        },
        "name": "scriptcat-backup.zip"
    }
}'

参数问题,应该是:

{
    "item": {
        "@microsoft.graph.conflictBehavior": "replace"
    }
}

@CodFrm
Copy link
Member

CodFrm commented Nov 28, 2023

@ChitaGideon 我这边成功上传了,但是没有看见文件,不知道管理员可以看见么?scriptcat-backup-2023-11-28T13-56-44.zip

image

一个文件都没有,但是这个文件夹是API创建的

@ChitaGideon
Copy link
Author

@CodFrm 管理员看不到,看看返回啥信息?

@CodFrm
Copy link
Member

CodFrm commented Nov 28, 2023

@ChitaGideon 成功上传了,也能下载和读取到,但是我到网页上看不见文件,哥哥可以试试这个版本:https://github.com/scriptscat/scriptcat/actions/runs/7014891823

@ChitaGideon
Copy link
Author

@CodFrm 找到你的文件了;你上传的地方有问题;好像上传到一个组织下共享的地方了,没上传到用户自己的文件夹中;现在组织下每个用户都能看到我们备份的文件;
https://25f8xj.sharepoint.com/Shared%20Documents/Forms/AllItems.aspx 我备份的文件的也在那里;
image

@CodFrm
Copy link
Member

CodFrm commented Nov 28, 2023

@ChitaGideon 好像是如此了,没有找到其它相关资料说明

@CodFrm
Copy link
Member

CodFrm commented Nov 28, 2023

CodFrm added a commit that referenced this issue Nov 28, 2023
@CodFrm
Copy link
Member

CodFrm commented Nov 28, 2023

是我调用API的问题,切换成 https://graph.microsoft.com/v1.0/me/drive/special/approot 可以了

哥哥可以再试试这个版本:https://github.com/scriptscat/scriptcat/actions/runs/7016763000

@ChitaGideon
Copy link
Author

@CodFrm 嗯,我试了下, 没发现啥问题 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants