Update ali delete by auth
This commit is contained in:
parent
3574b0ef56
commit
ca8f7ef682
|
|
@ -351,10 +351,11 @@ public class API {
|
||||||
body.put("drive_id", user.getDriveId());
|
body.put("drive_id", user.getDriveId());
|
||||||
return new JSONObject(oauth("openFile/getDownloadUrl", body.toString(), true)).getString("url");
|
return new JSONObject(oauth("openFile/getDownloadUrl", body.toString(), true)).getString("url");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Init.execute(this::deleteAll);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return "";
|
return "";
|
||||||
} finally {
|
} finally {
|
||||||
deleteAll();
|
Init.execute(this::deleteAll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -370,10 +371,11 @@ public class API {
|
||||||
JSONArray taskList = new JSONObject(json).getJSONObject("video_preview_play_info").getJSONArray("live_transcoding_task_list");
|
JSONArray taskList = new JSONObject(json).getJSONObject("video_preview_play_info").getJSONArray("live_transcoding_task_list");
|
||||||
return getPreviewQuality(taskList, flag);
|
return getPreviewQuality(taskList, flag);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Init.execute(this::deleteAll);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return "";
|
return "";
|
||||||
} finally {
|
} finally {
|
||||||
deleteAll();
|
Init.execute(this::deleteAll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -396,21 +398,15 @@ public class API {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteAll() {
|
private void deleteAll() {
|
||||||
for (String tempId : tempIds) if (!TextUtils.isEmpty(tempId)) delete(tempId);
|
for (String tempId : tempIds) delete(tempId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void delete(String fileId) {
|
private void delete(String fileId) {
|
||||||
try {
|
SpiderDebug.log("Delete..." + fileId);
|
||||||
SpiderDebug.log("Delete..." + fileId);
|
String json = "{\"requests\":[{\"body\":{\"drive_id\":\"%s\",\"file_id\":\"%s\"},\"headers\":{\"Content-Type\":\"application/json\"},\"id\":\"%s\",\"method\":\"POST\",\"url\":\"/file/delete\"}],\"resource\":\"file\"}";
|
||||||
JSONObject body = new JSONObject();
|
json = String.format(json, user.getDriveId(), fileId, fileId);
|
||||||
body.put("file_id", fileId);
|
String result = auth("adrive/v2/batch", json, true);
|
||||||
body.put("drive_id", user.getDriveId());
|
if (result.length() == 211) tempIds.remove(fileId);
|
||||||
String result = oauth("openFile/delete", body.toString(), true);
|
|
||||||
SpiderDebug.log(result + "," + result.length());
|
|
||||||
if (result.length() == 125) tempIds.remove(fileId);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] proxySub(Map<String, String> params) {
|
public Object[] proxySub(Map<String, String> params) {
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
be4d70b1bec4f2c930972aa6685ffe19
|
130be941d3dc5eace206287935bd5ccd
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue