Skip to content

Commit

Permalink
Update to 4.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
theotherp committed Jun 15, 2022
1 parent 4aaafe0 commit 6fa54f3
Show file tree
Hide file tree
Showing 12 changed files with 3,560 additions and 4,816 deletions.
14 changes: 14 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
### v4.3.3 (2022-06-15)

**Fix** Fix error when using an HTTP proxy without username / password.

**Fix** Use API hit information from indexer request when no download information was provided. In that case calculate the downloads from the history. See <a href="https://github.com/theotherp/nzbhydra2/issues/778">#778</a>

**Fix** Fix API hit and download detection for DogNZB.

**Fix** Add the current API hit to the number of reported API hits in response.

**Fix** Fix name of logging marker "Custom mapping" (was "Config mapping").



### v4.3.2 (2022-06-13)

**Fix** Fix use of groups in custom search request mapping. See <a href="https://github.com/theotherp/nzbhydra2/issues/700">#700</a>
Expand Down
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.nzbhydra</groupId>
<artifactId>nzbhydra2</artifactId>
<version>4.3.3-SNAPSHOT</version>
<version>4.3.3</version>
</parent>

<artifactId>core</artifactId>
Expand Down Expand Up @@ -91,7 +91,7 @@
<dependency>
<groupId>org.nzbhydra</groupId>
<artifactId>mapping</artifactId>
<version>4.3.3-SNAPSHOT</version>
<version>4.3.3</version>
</dependency>

<!-- spring (boot) -->
Expand Down
17 changes: 13 additions & 4 deletions core/src/main/java/org/nzbhydra/debuginfos/UfileUploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.apache.commons.lang3.StringUtils;
import org.nzbhydra.Jackson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -36,6 +37,7 @@
public class UfileUploader {

private static final Logger logger = LoggerFactory.getLogger(UfileUploader.class);
private static final String UFILE_UP_API_PATH = "https://ufile.io/v1";

public static String upload(File file) throws IOException {
final OkHttpClient httpClient = new OkHttpClient();
Expand All @@ -56,8 +58,10 @@ public static String upload(File file) throws IOException {
}

private static String getToken(OkHttpClient httpClient, File file) throws IOException {
final String url = UFILE_UP_API_PATH + "/upload/create_session";
logger.debug("Sending token POST to {}", url);
final Response post = httpClient.newCall(new Request.Builder()
.url("https://up.ufile.io/v1/upload/create_session")
.url(url)
.method("POST",
new FormBody.Builder()
.add("file_size", String.valueOf(file.length()))
Expand All @@ -77,8 +81,10 @@ private static String getToken(OkHttpClient httpClient, File file) throws IOExce
}

private static void uploadFile(File file, OkHttpClient httpClient, String token) throws IOException {
final String url = UFILE_UP_API_PATH + "/upload/chunk";
logger.debug("Sending upload POST to {}", url);
final Response post = httpClient.newCall(new Request.Builder()
.url("https://up.ufile.io/v1/upload/chunk")
.url(url)
.method("POST",
new MultipartBody.Builder()
.setType(MultipartBody.FORM)
Expand All @@ -95,8 +101,10 @@ private static void uploadFile(File file, OkHttpClient httpClient, String token)
}

private static String finalize(File file, OkHttpClient httpClient, String token) throws IOException {
final String url = UFILE_UP_API_PATH + "/upload/finalise";
logger.debug("Sending finalise POST to {}", url);
final Response post = httpClient.newCall(new Request.Builder()
.url("https://up.ufile.io/v1/upload/finalise")
.url(url)
.method("POST",
new FormBody.Builder()
.add("fuid", token)
Expand All @@ -121,7 +129,8 @@ private static String createErrorFromResponse(Response post, ResponseBody body,
message += ". Message: " + post.message();
}
if (post.body() != null) {
message += ". Body: " + post.body().string();
final String bodyString = post.body().string();
message += ". Body: " + StringUtils.abbreviate(bodyString, 500);
post.body().close();
}
logger.error(message);
Expand Down
Loading

0 comments on commit 6fa54f3

Please sign in to comment.