This commit is contained in:
parent
bbfbd4fb35
commit
596d09f5ae
|
@ -5,6 +5,6 @@ RUN cd /tmp/code && mvn clean package -Dmaven.test.skip=true -Dmaven.javadoc.ski
|
|||
|
||||
|
||||
FROM openjdk:11-jdk-oracle
|
||||
COPY --from=maven /tmp/code/target/*.jar /webdav-teambition.jar
|
||||
COPY --from=maven /tmp/code/target/*.jar /webdav.jar
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/webdav-teambition.jar"]
|
||||
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/webdav.jar"]
|
||||
|
|
|
@ -176,7 +176,8 @@ public class AliYunDriverClient {
|
|||
}
|
||||
|
||||
private String readRefreshToken() {
|
||||
Path path = Paths.get(aliYunDriveProperties.getRefreshTokenPath());
|
||||
String refreshTokenPath = aliYunDriveProperties.getWorkDir() + "refresh-token";
|
||||
Path path = Paths.get(refreshTokenPath);
|
||||
|
||||
if (!Files.exists(path, LinkOption.NOFOLLOW_LINKS)) {
|
||||
try {
|
||||
|
@ -192,17 +193,18 @@ public class AliYunDriverClient {
|
|||
return new String(bytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn("读取refreshToken文件 {} 失败: ", aliYunDriveProperties.getRefreshTokenPath(), e);
|
||||
LOGGER.warn("读取refreshToken文件 {} 失败: ", refreshTokenPath, e);
|
||||
}
|
||||
writeRefreshToken(aliYunDriveProperties.getRefreshToken());
|
||||
return aliYunDriveProperties.getRefreshToken();
|
||||
}
|
||||
|
||||
private void writeRefreshToken(String newRefreshToken) {
|
||||
String refreshTokenPath = aliYunDriveProperties.getWorkDir() + "refresh-token";
|
||||
try {
|
||||
Files.write(Paths.get(aliYunDriveProperties.getRefreshTokenPath()), newRefreshToken.getBytes(StandardCharsets.UTF_8));
|
||||
Files.write(Paths.get(refreshTokenPath), newRefreshToken.getBytes(StandardCharsets.UTF_8));
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn("写入refreshToken文件 {} 失败: ", aliYunDriveProperties.getRefreshTokenPath(), e);
|
||||
LOGGER.warn("写入refreshToken文件 {} 失败: ", refreshTokenPath, e);
|
||||
}
|
||||
aliYunDriveProperties.setRefreshToken(newRefreshToken);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ public class AliYunDriveProperties {
|
|||
private String url = "https://api.aliyundrive.com/v2";
|
||||
private String authorization = "";
|
||||
private String refreshToken;
|
||||
private String refreshTokenPath = "/etc/AliYunDriver-RefreshToken";
|
||||
private String workDir = "/etc/aliyun-driver/";
|
||||
private String agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36";
|
||||
private String driveId;
|
||||
|
||||
|
@ -47,12 +47,12 @@ public class AliYunDriveProperties {
|
|||
this.refreshToken = refreshToken;
|
||||
}
|
||||
|
||||
public String getRefreshTokenPath() {
|
||||
return refreshTokenPath;
|
||||
public String getWorkDir() {
|
||||
return workDir;
|
||||
}
|
||||
|
||||
public void setRefreshTokenPath(String refreshTokenPath) {
|
||||
this.refreshTokenPath = refreshTokenPath;
|
||||
public void setWorkDir(String workDir) {
|
||||
this.workDir = workDir;
|
||||
}
|
||||
|
||||
public void setDriveId(String driveId) {
|
||||
|
|
Loading…
Reference in New Issue