Skip to content
This repository was archived by the owner on Jul 21, 2024. It is now read-only.

Commit ec1d6d5

Browse files
committed
AccessTokenInvalid and TokenExpired
Update QPS for list and downloadurl open.aliyundrive.com => openapi.aliyundrive.com bump version to 3.1.0
1 parent 26fb009 commit ec1d6d5

File tree

18 files changed

+32
-29
lines changed

18 files changed

+32
-29
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,18 @@ implementation "com.squareup.okhttp3:logging-interceptor:3.12.13" //api19
146146
implementation "com.google.code.gson:gson:2.8.9"
147147
148148
//主要
149-
implementation "net.xdow:aliyundrive-sdk-openapi:1.0.5"
150-
implementation "net.xdow:aliyundrive-sdk-webapi:1.0.5"
149+
implementation "net.xdow:aliyundrive-sdk-openapi:1.0.6"
150+
implementation "net.xdow:aliyundrive-sdk-webapi:1.0.6"
151151
152152
//可选
153-
implementation "net.xdow:webdav:1.0.5"
154-
implementation "net.xdow:webdav-jakarta:1.0.5"
155-
implementation "net.xdow:webdav-javax:1.0.5"
156-
implementation "net.xdow:aliyundrive-webdav-internal:1.0.5"
157-
implementation "net.xdow:aliyundrive-android-core:1.0.5"
158-
implementation "net.xdow:jap-http:1.0.5"
159-
implementation "net.xdow:jap-http-jakarta-adapter:1.0.5"
160-
implementation "net.xdow:jap-http-javax-adapter:1.0.5"
153+
implementation "net.xdow:webdav:1.0.6"
154+
implementation "net.xdow:webdav-jakarta:1.0.6"
155+
implementation "net.xdow:webdav-javax:1.0.6"
156+
implementation "net.xdow:aliyundrive-webdav-internal:1.0.6"
157+
implementation "net.xdow:aliyundrive-android-core:1.0.6"
158+
implementation "net.xdow:jap-http:1.0.6"
159+
implementation "net.xdow:jap-http-jakarta-adapter:1.0.6"
160+
implementation "net.xdow:jap-http-javax-adapter:1.0.6"
161161
```
162162
## 基础用法
163163
```java

aliyundrive-android-core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
apply plugin: 'com.android.library'
1616

1717
group 'net.xdow'
18-
version '1.0.5'
18+
version '1.0.6'
1919
description 'AliyunDrive Webdav Android Core'
2020

2121
repositories {

aliyundrive-sdk-openapi/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'net.xdow'
6-
version '1.0.5'
6+
version '1.0.6'
77
description 'AliyunDrive OpenApi SDK'
88

99
java {

aliyundrive-sdk-openapi/src/main/java/net/xdow/aliyundrive/AliyunDriveConstant.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class AliyunDriveConstant {
55
public static final int MAX_DOWNLOAD_URL_EXPIRE_TIME_SEC = 115200; //32h
66
public static final int MAX_FILE_CREATE_PART_INFO_LIST_SIZE = 10000;
77
public static final String REFERER = "https://www.aliyundrive.com/";
8-
public static final String API_HOST = "https://open.aliyundrive.com";
8+
public static final String API_HOST = "https://openapi.aliyundrive.com";
99
public static final String API_ACCESS_TOKEN = API_HOST + "/oauth/access_token";
1010
public static final String API_QRCODE_GENERATE = API_HOST + "/oauth/authorize/qrcode";
1111
public static final String API_QRCODE_IMAGE = API_HOST + "/oauth/qrcode/%s";

aliyundrive-sdk-openapi/src/main/java/net/xdow/aliyundrive/impl/AliyunDriveOpenApiImplV1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public Response intercept(Chain chain) throws IOException {
5252
if (code == 401 || code == 400) {
5353
ResponseBody body = response.peekBody(40960);
5454
String res = body.string();
55-
if (res.contains("AccessTokenInvalid")) {
55+
if (res.contains("AccessTokenInvalid") || res.contains("TokenExpired")) {
5656
AliyunDriveOpenApiImplV1.this.requestNewAccessToken();
5757
return chain.proceed(AliyunDriveOpenApiImplV1.this.buildCommonRequestHeader(request));
5858
}

aliyundrive-sdk-openapi/src/main/java/net/xdow/aliyundrive/net/AliyunDriveCall.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ public void checkAuthorize(T t) {
6868
if ("AccessTokenInvalid".equals(t.getCode())) {
6969
throw new NotAuthenticatedException(t.getMessage() + "(" + t.getCode() + ")");
7070
}
71+
if ("TokenExpired".equals(t.getCode())) {
72+
throw new NotAuthenticatedException(t.getMessage() + "(" + t.getCode() + ")");
73+
}
7174
}
7275

7376
public AliyunDriveCall<T> disableAuthorizeCheck() {

aliyundrive-sdk-openapi/src/main/java/net/xdow/aliyundrive/net/interceptor/AccessTokenInvalidInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public Response intercept(Chain chain) throws IOException {
2424
if (code == 401 || code == 400) {
2525
ResponseBody body = response.peekBody(40960);
2626
String res = body.string();
27-
if (res.contains("AccessTokenInvalid")) {
27+
if (res.contains("AccessTokenInvalid") || res.contains("TokenExpired")) {
2828
listener.run();
2929
}
3030
}

aliyundrive-sdk-webapi/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'net.xdow'
6-
version '1.0.5'
6+
version '1.0.6'
77
description 'AliyunDrive WebApi SDK'
88

99
java {

aliyundrive-webdav-internal/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'net.xdow'
6-
version '1.0.5'
6+
version '1.0.6'
77
description 'AliyunDrive Webdav internal'
88

99
java {

aliyundrive-webdav-internal/src/main/java/com/github/zxbu/webdavteambition/config/AliyunDriveProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class AliyunDriveProperties {
3131
private transient String clientId;
3232

3333
private transient String authorizationCode;
34-
private transient String aliyunAccessTokenUrl = "https://adrive.xdow.net/oauth/access_token?code=%s&refresh_token=%s&ver=1.0.5";
34+
private transient String aliyunAccessTokenUrl = "https://adrive.xdow.net/oauth/access_token?code=%s&refresh_token=%s&ver=1.0.6";
3535
private transient String aliyunAuthorizeUrl = "https://adrive.xdow.net/oauth/authorize?redirect_uri=%s";
3636

3737
private transient Auth auth = new Auth();

aliyundrive-webdav-internal/src/main/java/com/github/zxbu/webdavteambition/store/AliyunDriveClientService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private List<AliyunDriveFileInfo> fileListFromApi(String nodeId, String marker,
138138
if (res.isError()) {
139139
if ("TooManyRequests".equals(res.getCode())) {
140140
try {
141-
TimeUnit.SECONDS.sleep(6);
141+
TimeUnit.MILLISECONDS.sleep(300);
142142
} catch (InterruptedException e) {
143143
}
144144
res = this.mAliyunDrive.fileList(query).execute();
@@ -147,7 +147,7 @@ private List<AliyunDriveFileInfo> fileListFromApi(String nodeId, String marker,
147147
if (res.isError()) {
148148
if ("TooManyRequests".equals(res.getCode())) {
149149
try {
150-
TimeUnit.SECONDS.sleep(6);
150+
TimeUnit.MILLISECONDS.sleep(300);
151151
} catch (InterruptedException e) {
152152
}
153153
res = this.mAliyunDrive.fileList(query).execute();
@@ -468,7 +468,7 @@ private synchronized AliyunDriveResponse.FileGetDownloadUrlInfo fileGetDownloadU
468468
if (res.isError()) {
469469
if ("TooManyRequests".equals(res.getCode())) {
470470
try {
471-
TimeUnit.SECONDS.sleep(6);
471+
TimeUnit.SECONDS.sleep(1);
472472
} catch (InterruptedException e) {
473473
}
474474
res = this.mAliyunDrive.fileGetDownloadUrl(query).execute();
@@ -477,7 +477,7 @@ private synchronized AliyunDriveResponse.FileGetDownloadUrlInfo fileGetDownloadU
477477
if (res.isError()) {
478478
if ("TooManyRequests".equals(res.getCode())) {
479479
try {
480-
TimeUnit.SECONDS.sleep(6);
480+
TimeUnit.SECONDS.sleep(1);
481481
} catch (InterruptedException e) {
482482
}
483483
res = this.mAliyunDrive.fileGetDownloadUrl(query).execute();

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group 'com.github'
9-
version '3.0.8'
9+
version '3.1.0'
1010
sourceCompatibility = '17'
1111

1212
configurations {

jap-http-adapter/jap-http-jakarta-adapter/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'net.xdow'
6-
version '1.0.5'
6+
version '1.0.6'
77
description 'jap-http servlet interface jakarta adapter'
88

99
java {

jap-http-adapter/jap-http-javax-adapter/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'net.xdow'
6-
version '1.0.5'
6+
version '1.0.6'
77
description 'jap-http servlet interface javax adapter'
88

99
java {

jap-http/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'net.xdow'
6-
version '1.0.5'
6+
version '1.0.6'
77
description 'jap-http servlet interface'
88

99
java {

webdav-jakarta/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'net.xdow'
6-
version '1.0.5'
6+
version '1.0.6'
77
description 'AliyunDrive Webdav jakarta implement'
88

99
java {

webdav-javax/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'net.xdow'
6-
version '1.0.5'
6+
version '1.0.6'
77
description 'AliyunDrive Webdav javax implement'
88

99
java {

webdav/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'net.xdow'
6-
version '1.0.5'
6+
version '1.0.6'
77
description 'AliyunDrive Webdav core'
88

99
java {

0 commit comments

Comments
 (0)