Use a proper user agent for downloading

This commit is contained in:
Maschell 2018-12-06 15:28:25 +01:00
parent eaef0fefd1
commit 5603bfb94e
3 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,7 @@ public class Settings {
public static final String WUD_KEY_FILENAME = "game.key";
public static final String WOOMY_METADATA_FILENAME = "metadata.xml";
public static final String H3_EXTENTION = ".h3";
public static final String USER_AGENT = "Mozilla/5.0 (Nintendo WiiU) AppleWebKit/536.28 (KHTML, like Gecko) NX/3.0.3.12.12 NintendoBrowser/3.0.0.9561.US";
public static byte[] commonKey = new byte[0x10];
public static int WIIU_DECRYPTED_AREA_OFFSET = 0x18000;

View File

@ -21,6 +21,7 @@ import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import de.mas.wiiu.jnus.Settings;
import lombok.extern.java.Log;
@Log
@ -33,6 +34,7 @@ public abstract class Downloader {
int BUFFER_SIZE = 0x800;
URL url = new URL(fileURL);
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestProperty("User-Agent", Settings.USER_AGENT);
int responseCode = httpConn.getResponseCode();
byte[] file = null;

View File

@ -85,6 +85,7 @@ public final class NUSDownloadService extends Downloader {
public InputStream getInputStream(String URL, long offset) throws IOException {
URL url_obj = new URL(URL);
HttpURLConnection connection = (HttpURLConnection) url_obj.openConnection();
connection.setRequestProperty("User-Agent", Settings.USER_AGENT);
connection.setRequestProperty("Range", "bytes=" + offset + "-");
try {
connection.connect();