mirror of
https://github.com/Rogiel/httpchannel
synced 2025-12-06 07:32:50 +00:00
Adds -SNAPSHOT to Maven version parameter and few modifications to API
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>httpchannel-service</artifactId>
|
||||
<groupId>com.rogiel.httpchannel</groupId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>httpchannel-service-depositfiles</artifactId>
|
||||
|
||||
@@ -43,16 +43,16 @@ public class DepositFilesService extends AbstractHttpService implements
|
||||
*/
|
||||
public static final ServiceID SERVICE_ID = ServiceID.create("depositfiles");
|
||||
|
||||
private static final Pattern UPLOAD_URL_PATTERN = Pattern
|
||||
private static final Pattern UPLOAD_URI_PATTERN = Pattern
|
||||
.compile("http://fileshare([0-9]*)\\.depositfiles\\.com/(.*)/\\?X-Progress-ID=(.*)");
|
||||
private static final Pattern DOWNLOAD_URL_PATTERN = Pattern
|
||||
private static final Pattern DOWNLOAD_URI_PATTERN = Pattern
|
||||
.compile("http://(www\\.)?depositfiles\\.com/files/([0-9A-z]*)");
|
||||
|
||||
private static final Pattern VALID_LOGIN_REDIRECT = Pattern
|
||||
.compile("window.location.href");
|
||||
|
||||
@Override
|
||||
public ServiceID getID() {
|
||||
public ServiceID getServiceID() {
|
||||
return SERVICE_ID;
|
||||
}
|
||||
|
||||
@@ -139,14 +139,14 @@ public class DepositFilesService extends AbstractHttpService implements
|
||||
logger.debug("Starting upload to depositfiles.com");
|
||||
final HTMLPage page = get("http://www.depositfiles.com/").asPage();
|
||||
|
||||
final String url = page.findFormAction(UPLOAD_URL_PATTERN);
|
||||
final String uri = page.findFormAction(UPLOAD_URI_PATTERN);
|
||||
final String uploadID = page.getInputValue("UPLOAD_IDENTIFIER");
|
||||
final String maxFileSize = page.getInputValue("MAX_FILE_SIZE");
|
||||
|
||||
logger.debug("Upload URL: {}, ID: {}", url, uploadID);
|
||||
logger.debug("Upload URI: {}, ID: {}", uri, uploadID);
|
||||
|
||||
final LinkedUploadChannel channel = createLinkedChannel(this);
|
||||
uploadFuture = multipartPost(url).parameter("files", channel)
|
||||
uploadFuture = multipartPost(uri).parameter("files", channel)
|
||||
.parameter("go", true)
|
||||
.parameter("UPLOAD_IDENTIFIER", uploadID)
|
||||
.parameter("agree", true)
|
||||
@@ -158,7 +158,7 @@ public class DepositFilesService extends AbstractHttpService implements
|
||||
public String finish() throws IOException {
|
||||
try {
|
||||
final String link = uploadFuture.get().findScript(
|
||||
DOWNLOAD_URL_PATTERN, 0);
|
||||
DOWNLOAD_URI_PATTERN, 0);
|
||||
if (link == null)
|
||||
return null;
|
||||
return link;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.rogiel.httpchannel.service.impl;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
@@ -31,9 +31,9 @@ public class DepositFilesServiceTest {
|
||||
UploaderCapability.UNAUTHENTICATED_UPLOAD));
|
||||
|
||||
final Path path = Paths.get("src/test/resources/upload-test-file.txt");
|
||||
final URL url = ChannelUtils.upload(service, path);
|
||||
final URI uri = ChannelUtils.upload(service, path);
|
||||
|
||||
Assert.assertNotNull(url);
|
||||
System.out.println(url);
|
||||
Assert.assertNotNull(uri);
|
||||
System.out.println(uri);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user