mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-04-29 22:24:32 +02:00
7.93
Improve load time of very big folders
This commit is contained in:
parent
9729a2bcfd
commit
3988eb7f22
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.tonikelope</groupId>
|
<groupId>com.tonikelope</groupId>
|
||||||
<artifactId>MegaBasterd</artifactId>
|
<artifactId>MegaBasterd</artifactId>
|
||||||
<version>7.92</version>
|
<version>7.93</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
@ -607,8 +607,6 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
|||||||
|
|
||||||
if (node.isLeaf() && node != root && ((HashMap<String, Object>) node.getUserObject()).get("size") != null) {
|
if (node.isLeaf() && node != root && ((HashMap<String, Object>) node.getUserObject()).get("size") != null) {
|
||||||
|
|
||||||
System.out.println(((HashMap<String, Object>) node.getUserObject()).get("name"));
|
|
||||||
|
|
||||||
String path = "";
|
String path = "";
|
||||||
|
|
||||||
Object[] object_path = node.getUserObjectPath();
|
Object[] object_path = node.getUserObjectPath();
|
||||||
@ -620,8 +618,6 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
|||||||
|
|
||||||
path = path.replaceAll("^/+", "").replaceAll("^\\+", "").trim();
|
path = path.replaceAll("^/+", "").replaceAll("^\\+", "").trim();
|
||||||
|
|
||||||
System.out.println(path);
|
|
||||||
|
|
||||||
String url = "https://mega.nz/#N!" + ((Map<String, Object>) node.getUserObject()).get("h") + "!" + ((Map<String, Object>) node.getUserObject()).get("key") + "###n=" + folder_id;
|
String url = "https://mega.nz/#N!" + ((Map<String, Object>) node.getUserObject()).get("h") + "!" + ((Map<String, Object>) node.getUserObject()).get("key") + "###n=" + folder_id;
|
||||||
|
|
||||||
HashMap<String, Object> download_link = new HashMap<>();
|
HashMap<String, Object> download_link = new HashMap<>();
|
||||||
|
@ -69,7 +69,7 @@ import javax.swing.UIManager;
|
|||||||
*/
|
*/
|
||||||
public final class MainPanel {
|
public final class MainPanel {
|
||||||
|
|
||||||
public static final String VERSION = "7.92";
|
public static final String VERSION = "7.93";
|
||||||
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
|
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
|
||||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||||
|
@ -35,6 +35,7 @@ import java.util.Random;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
import javax.swing.JProgressBar;
|
import javax.swing.JProgressBar;
|
||||||
@ -367,8 +368,6 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
private String RAW_REQUEST(String request, URL url_api) throws MegaAPIException {
|
private String RAW_REQUEST(String request, URL url_api) throws MegaAPIException {
|
||||||
|
|
||||||
System.out.println(request);
|
|
||||||
|
|
||||||
String response = null, current_smart_proxy = null;
|
String response = null, current_smart_proxy = null;
|
||||||
|
|
||||||
int mega_error = 0, http_error = 0, conta_error = 0, http_status;
|
int mega_error = 0, http_error = 0, conta_error = 0, http_status;
|
||||||
@ -444,6 +443,8 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
con.setRequestProperty("Content-type", "text/plain;charset=UTF-8");
|
con.setRequestProperty("Content-type", "text/plain;charset=UTF-8");
|
||||||
|
|
||||||
|
con.setRequestProperty("Accept-Encoding", "gzip");
|
||||||
|
|
||||||
con.setRequestProperty("User-Agent", MainPanel.DEFAULT_USER_AGENT);
|
con.setRequestProperty("User-Agent", MainPanel.DEFAULT_USER_AGENT);
|
||||||
|
|
||||||
con.setUseCaches(false);
|
con.setUseCaches(false);
|
||||||
@ -468,7 +469,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
try (InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
try (InputStream is = "gzip".equals(con.getContentEncoding()) ? new GZIPInputStream(con.getInputStream()) : con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||||
|
|
||||||
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
|
|
||||||
@ -740,13 +741,10 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
String request = "[{\"a\":\"ufa\", \"s\":" + String.valueOf(file_bytes[0].length) + ", \"ssl\":1}, {\"a\":\"ufa\", \"s\":" + String.valueOf(file_bytes[1].length) + ", \"ssl\":1}]";
|
String request = "[{\"a\":\"ufa\", \"s\":" + String.valueOf(file_bytes[0].length) + ", \"ssl\":1}, {\"a\":\"ufa\", \"s\":" + String.valueOf(file_bytes[1].length) + ", \"ssl\":1}]";
|
||||||
|
|
||||||
System.out.println(request);
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + (_sid != null ? "&sid=" + _sid : ""));
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + (_sid != null ? "&sid=" + _sid : ""));
|
||||||
|
|
||||||
String res = RAW_REQUEST(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
System.out.println(res);
|
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
HashMap[] res_map = objectMapper.readValue(res, HashMap[].class);
|
HashMap[] res_map = objectMapper.readValue(res, HashMap[].class);
|
||||||
@ -794,7 +792,6 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
hash[h] = MiscTools.Bin2UrlBASE64(byte_res.toByteArray());
|
hash[h] = MiscTools.Bin2UrlBASE64(byte_res.toByteArray());
|
||||||
|
|
||||||
System.out.println(hash[h]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h++;
|
h++;
|
||||||
@ -806,14 +803,10 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
res = RAW_REQUEST(request, url_api);
|
res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
System.out.println(request);
|
|
||||||
|
|
||||||
objectMapper = new ObjectMapper();
|
objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
String[] resp = objectMapper.readValue(res, String[].class);
|
String[] resp = objectMapper.readValue(res, String[].class);
|
||||||
|
|
||||||
System.out.println((String) resp[0]);
|
|
||||||
|
|
||||||
return (String) resp[0];
|
return (String) resp[0];
|
||||||
|
|
||||||
} catch (MegaAPIException mae) {
|
} catch (MegaAPIException mae) {
|
||||||
@ -1060,7 +1053,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
HashMap<String, Object> folder_nodes = null;
|
HashMap<String, Object> folder_nodes = null;
|
||||||
|
|
||||||
String request = "[{\"a\":\"f\", \"c\":\"1\", \"r\":\"1\"}]";
|
String request = "[{\"a\":\"f\", \"c\":\"1\", \"r\":\"1\", \"ca\":\"1\"}]";
|
||||||
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + "&n=" + folder_id);
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + "&n=" + folder_id);
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 209 KiB |
Loading…
x
Reference in New Issue
Block a user