Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
reruin committed Jun 1, 2020
1 parent d869dc5 commit 0b1cff6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
13 changes: 8 additions & 5 deletions plugins/drive.189cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Manager {
}
}
//create cookies
async create(username , password){
async create(username , password , path = '/'){
//0 准备工作: 获取必要数据
let headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'}
let { body , headers:headers2} = await this.request.get('https://cloud.189.cn/udb/udb_login.jsp?pageId=1&redirectURL=/main.action',{headers})
Expand Down Expand Up @@ -226,11 +226,15 @@ class Manager {
if( resp.body && resp.body.toUrl ){
resp = await this.request.get(resp.body.toUrl , { followRedirect:false, headers })
let cookies = resp.headers['set-cookie'].join('; ')
let client = { username , password , cookies , updated_at: Date.now() }

await this.updateHandle(this.stringify({username , password}))
let client = { username , password , cookies , updated_at: Date.now() , path }
if(this.clientMap[username]){
client.path = this.clientMap[username].path
}

this.clientMap[username] = client

await this.updateHandle(this.stringify({username , password, path:client.path}))

result = true
break;
}else{
Expand All @@ -245,7 +249,6 @@ class Manager {

async update(id){
let data = this.parse(id)

if(data.username){
let hit = this.clientMap[data.username]
if(hit){
Expand Down
5 changes: 4 additions & 1 deletion plugins/drive.caiyun.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,10 @@ class Manager {
}else{
let cookie = resp.headers['set-cookie'].join('; ')
let client = { username , password , cookie , updated_at: Date.now() }
await this.updateHandle(this.stringify({username , password , cookie}))
if(this.clientMap[username]){
client.path = this.clientMap[username].path
}
await this.updateHandle(this.stringify(client))
this.clientMap[username] = client
result = true
break;
Expand Down

0 comments on commit 0b1cff6

Please sign in to comment.