Skip to content

Commit

Permalink
fixes title
Browse files Browse the repository at this point in the history
  • Loading branch information
joestr committed Apr 23, 2020
1 parent 4eade91 commit 991636a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class AcronisCredentials {
private String password;
private String accessToken;
private String idToken;
private LocalDateTime expiry;
private long expiry = 0;

public AcronisCredentials(String username, String password) throws IOException, InterruptedException {
this.username = username;
Expand All @@ -40,11 +40,11 @@ public AcronisCredentials(String username, String password) throws IOException,

public String getValidAccessToken() throws IOException, InterruptedException {

if (this.expiry == null) {
this.obtainTokens();
}
long now = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC);

if (this.expiry.isBefore(LocalDateTime.now())) {
if (this.expiry == 0) {
this.obtainTokens();
} else if (this.expiry <= now) {
this.obtainTokens();
}

Expand All @@ -71,7 +71,7 @@ private void obtainTokens() throws IOException, InterruptedException {
JsonObject root = JsonParser.parseString(response.body()).getAsJsonObject();

this.accessToken = root.get("access_token").getAsString();
this.expiry = LocalDateTime.ofEpochSecond( root.get("expires_on").getAsLong(), 0, ZoneOffset.UTC);
this.expiry = root.get("expires_on").getAsLong();
this.idToken = root.get("id_token").getAsString();
//root.get("token_type").getAsString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void handle(String target,
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.setContentType("text/html; charset=utf-8");
PrintWriter out = response.getWriter();
out.println("<!doctype html><head><title>" + splittedPath[0] + "/contents</title></head>");
out.println("<!doctype html><head><title>contents/" + splittedPath[1] + "</title></head>");
out.println("<body><table><thead><th>name</th><th>date</th><th>size</th></thead><tbody>");

if (!isRoot) {
Expand Down

0 comments on commit 991636a

Please sign in to comment.