REQUIRED UPGRADE

Fix -> https://github.com/tonikelope/megabasterd/issues/588
This commit is contained in:
tonikelope 2023-10-20 16:12:34 +02:00
parent fc4830c60d
commit adb742d543
11 changed files with 57 additions and 54 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId>
<version>7.99</version>
<version>8.0</version>
<packaging>jar</packaging>
<repositories>
<repository>

View File

@ -204,10 +204,6 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
} else if (_current_smart_proxy == null) {
if (!getDownload().isTurbo()) {
getDownload().enableTurboMode();
}
String[] smart_proxy = proxy_manager.getProxy(_excluded_proxy_list);
_current_smart_proxy = smart_proxy[0];
@ -218,6 +214,10 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
if (_current_smart_proxy != null) {
if (!getDownload().isTurbo()) {
getDownload().enableTurboMode();
}
String[] proxy_info = _current_smart_proxy.split(":");
Proxy proxy = new Proxy(smart_proxy_socks ? Proxy.Type.SOCKS : Proxy.Type.HTTP, new InetSocketAddress(proxy_info[0], Integer.parseInt(proxy_info[1])));

View File

@ -256,7 +256,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
_turbo = false;
MiscTools.GUIRun(() -> {
getView().getSpeed_label().setForeground(Color.BLACK);
getView().getSpeed_label().setForeground(new Color(0, 128, 255));
});
}
@ -1353,8 +1353,6 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
int old_thread_priority = Thread.currentThread().getPriority();
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
int[] int_key = bin2i32a(UrlBASE642Bin(_file_key));
int[] iv = new int[]{int_key[4], int_key[5]};
int[] meta_mac = new int[]{int_key[6], int_key[7]};
@ -1430,8 +1428,6 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
int[] cbc = {file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3]};
Thread.currentThread().setPriority(old_thread_priority);
return (cbc[0] == meta_mac[0] && cbc[1] == meta_mac[1]);
}
}
@ -1519,7 +1515,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
error_code = ex.getCode();
if (error_code == -16) {
_status_error = "ERROR: MEGA LINK BLOCKED/DELETED";
_status_error = "ERROR: MEGA FILE BLOCKED/DELETED";
}
if (Arrays.asList(FATAL_API_ERROR_CODES).contains(error_code)) {
@ -1608,11 +1604,15 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
error_code = ex.getCode();
if (error_code == -16) {
_status_error = "ERROR: MEGA FILE BLOCKED/DELETED";
}
if (Arrays.asList(FATAL_API_ERROR_CODES).contains(error_code)) {
_auto_retry_on_error = Arrays.asList(FATAL_API_ERROR_CODES_WITH_RETRY).contains(error_code);
stopDownloader(ex.getMessage() + " " + truncateText(link, 80));
stopDownloader(error_code == -16 ? _status_error : ex.getMessage() + " " + truncateText(link, 80));
} else {

View File

@ -63,7 +63,7 @@
<Component id="restore_button" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="file_tree_scrollpane" pref="295" max="32767" attributes="0"/>
<Component id="file_tree_scrollpane" pref="289" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="node_bar" min="-2" pref="14" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
@ -210,9 +210,12 @@
<Component class="javax.swing.JLabel" name="total_space_label">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="28" style="1"/>
<Font name="Dialog" size="32" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="[0 B]"/>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="33" red="0" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="[---]"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>

View File

@ -83,6 +83,8 @@ public class FolderLinkDialog extends javax.swing.JDialog {
translateLabels(this);
file_tree.setRootVisible(false);
node_bar.setIndeterminate(true);
folder_link_label.setText(link);
@ -108,7 +110,15 @@ public class FolderLinkDialog extends javax.swing.JDialog {
} else if (_mega_error == -18) {
MiscTools.GUIRun(() -> {
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("MEGA LINK TEMPORARILY UNAVAILABLE!"), "Error", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("MEGA FOLDER TEMPORARILY UNAVAILABLE!"), "Error", JOptionPane.ERROR_MESSAGE);
setVisible(false);
});
} else if (_mega_error == -16) {
MiscTools.GUIRun(() -> {
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("MEGA FOLDER BLOCKED/DELETED"), "Error", JOptionPane.ERROR_MESSAGE);
setVisible(false);
});
@ -116,7 +126,7 @@ public class FolderLinkDialog extends javax.swing.JDialog {
} else {
MiscTools.GUIRun(() -> {
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("MEGA LINK ERROR!"), "Error", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("MEGA FOLDER LINK ERROR!"), "Error", JOptionPane.ERROR_MESSAGE);
setVisible(false);
});
@ -221,8 +231,9 @@ public class FolderLinkDialog extends javax.swing.JDialog {
}
});
total_space_label.setFont(new java.awt.Font("Dialog", 1, 28)); // NOI18N
total_space_label.setText("[0 B]");
total_space_label.setFont(new java.awt.Font("Dialog", 1, 32)); // NOI18N
total_space_label.setForeground(new java.awt.Color(0, 51, 255));
total_space_label.setText("[---]");
total_space_label.setDoubleBuffered(true);
total_space_label.setEnabled(false);
@ -260,7 +271,7 @@ public class FolderLinkDialog extends javax.swing.JDialog {
.addComponent(folder_link_label)
.addComponent(restore_button))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(file_tree_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 295, Short.MAX_VALUE)
.addComponent(file_tree_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(node_bar, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -589,6 +600,8 @@ public class FolderLinkDialog extends javax.swing.JDialog {
Enumeration files_tree = root.depthFirstEnumeration();
total_space_label.setText("[---]");
THREAD_POOL.execute(() -> {
String folder_id = findFirstRegex("#F!([^!]+)", _link, 1);

View File

@ -70,7 +70,7 @@ import javax.swing.UIManager;
*/
public final class MainPanel {
public static final String VERSION = "7.99";
public static final String VERSION = "8.0";
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 DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;

View File

@ -235,8 +235,6 @@ public final class MainPanelView extends javax.swing.JFrame {
Runnable run = () -> {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
MegaAPI ma = getMain_panel().getMega_active_accounts().get(mega_account);
try {
@ -1042,8 +1040,6 @@ public final class MainPanelView extends javax.swing.JFrame {
Runnable run = () -> {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
//Convert to legacy link format
String link_data = MiscTools.newMegaLinks2Legacy(dialog.getLinks_textarea().getText());

View File

@ -162,7 +162,7 @@ public class MegaAPI implements Serializable {
request = "[{\"a\":\"us\",\"user\":\"" + _email + "\",\"uh\":\"" + _user_hash + "\"}]";
}
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=");
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno));
String res = RAW_REQUEST(request, url_api);
@ -198,7 +198,7 @@ public class MegaAPI implements Serializable {
String request = "[{\"a\":\"us0\",\"user\":\"" + _email + "\"}]";
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=");
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno));
String res = RAW_REQUEST(request, url_api);
@ -216,7 +216,7 @@ public class MegaAPI implements Serializable {
String request = "[{\"a\":\"mfag\",\"e\":\"" + email + "\"}]";
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=");
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno));
String res = RAW_REQUEST(request, url_api);
@ -286,7 +286,7 @@ public class MegaAPI implements Serializable {
URL url_api;
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + (_sid != null ? "&sid=" + _sid : ""));
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : ""));
String res = RAW_REQUEST(request, url_api);
@ -330,7 +330,7 @@ public class MegaAPI implements Serializable {
try {
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + (_sid != null ? "&sid=" + _sid : ""));
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : ""));
String res = RAW_REQUEST(request, url_api);
@ -551,12 +551,12 @@ public class MegaAPI implements Serializable {
request = "[{\"a\":\"g\", \"g\":\"1\", \"n\":\"" + file_id + "\"}]";
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + (_sid != null ? "&sid=" + _sid : "") + "&n=" + folder_id);
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + "&n=" + folder_id);
} else {
request = "[{\"a\":\"g\", \"g\":\"1\", \"p\":\"" + file_id + "\"}]";
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + (_sid != null ? "&sid=" + _sid : ""));
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : ""));
}
String data = RAW_REQUEST(request, url_api);
@ -589,13 +589,13 @@ public class MegaAPI implements Serializable {
request = "[{\"a\":\"g\", \"g\":\"1\", \"n\":\"" + file_id + "\"}]";
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + (_sid != null ? "&sid=" + _sid : "") + "&n=" + folder_id);
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + "&n=" + folder_id);
} else {
request = "[{\"a\":\"g\", \"p\":\"" + file_id + "\"}]";
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + (_sid != null ? "&sid=" + _sid : ""));
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : ""));
}
String data = RAW_REQUEST(request, url_api);
@ -698,7 +698,7 @@ public class MegaAPI implements Serializable {
String request = "[{\"a\":\"u\", \"s\":" + String.valueOf(f.length()) + "}]";
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) + (_sid != null ? "&sid=" + _sid : ""));
String res = RAW_REQUEST(request, url_api);
@ -741,7 +741,7 @@ 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}]";
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) + (_sid != null ? "&sid=" + _sid : ""));
String res = RAW_REQUEST(request, url_api);
@ -799,7 +799,7 @@ public class MegaAPI implements Serializable {
request = "[{\"a\":\"pfa\", \"fa\":\"0*" + hash[0] + "/1*" + hash[1] + "\", \"n\":\"" + node_handle + "\"}]";
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&v=3&lang=es&domain=meganz&ec=" + (_sid != null ? "&sid=" + _sid : ""));
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : ""));
res = RAW_REQUEST(request, url_api);
@ -828,7 +828,7 @@ public class MegaAPI implements Serializable {
byte[] enc_att = _encAttr("{\"n\":\"" + fbasename + "\"}", i32a2bin(Arrays.copyOfRange(ul_key, 0, 4)));
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) + (_sid != null ? "&sid=" + _sid : ""));
String request = "[{\"a\":\"p\", \"t\":\"" + mega_parent + "\", \"n\":[{\"h\":\"" + completion_handle + "\", \"t\":0, \"a\":\"" + Bin2UrlBASE64(enc_att) + "\", \"k\":\"" + Bin2UrlBASE64(encryptKey(i32a2bin(fkey), master_key)) + "\"}], \"i\":\"" + _req_id + "\", \"cr\" : [ [\"" + root_node + "\"] , [\"" + completion_handle + "\"] , [0,0, \"" + Bin2UrlBASE64(encryptKey(i32a2bin(fkey), share_key)) + "\"]]}]";
@ -885,7 +885,7 @@ public class MegaAPI implements Serializable {
byte[] enc_node_key = encryptKey(node_key, master_key);
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) + (_sid != null ? "&sid=" + _sid : ""));
String request = "[{\"a\":\"p\", \"t\":\"" + parent_node + "\", \"n\":[{\"h\":\"xxxxxxxx\",\"t\":1,\"a\":\"" + Bin2UrlBASE64(enc_att) + "\",\"k\":\"" + Bin2UrlBASE64(enc_node_key) + "\"}],\"i\":\"" + _req_id + "\"}]";
@ -915,7 +915,7 @@ public class MegaAPI implements Serializable {
byte[] enc_node_key_s = encryptKey(node_key, share_key);
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) + (_sid != null ? "&sid=" + _sid : ""));
String request = "[{\"a\":\"p\", \"t\":\"" + parent_node + "\", \"n\":[{\"h\":\"xxxxxxxx\",\"t\":1,\"a\":\"" + Bin2UrlBASE64(enc_att) + "\",\"k\":\"" + Bin2UrlBASE64(enc_node_key) + "\"}],\"i\":\"" + _req_id + "\", \"cr\" : [ [\"" + root_node + "\"] , [\"xxxxxxxx\"] , [0,0, \"" + Bin2UrlBASE64(enc_node_key_s) + "\"]]}]";
@ -945,7 +945,7 @@ public class MegaAPI implements Serializable {
String request = "[{\"a\":\"l\", \"n\":\"" + node + "\"}]";
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) + (_sid != null ? "&sid=" + _sid : ""));
String res = RAW_REQUEST(request, url_api);
@ -976,7 +976,7 @@ public class MegaAPI implements Serializable {
String request = "[{\"a\":\"l\", \"n\":\"" + node + "\", \"i\":\"" + _req_id + "\"}]";
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) + (_sid != null ? "&sid=" + _sid : ""));
String res = RAW_REQUEST(request, url_api);
@ -1023,7 +1023,7 @@ public class MegaAPI implements Serializable {
//OJO
String request = "[{\"a\":\"s2\",\"n\":\"" + node + "\",\"s\":[{\"u\":\"EXP\",\"r\":0}],\"i\":\"" + _req_id + "\",\"ok\":\"AAAAAAAAAAAAAAAAAAAAAA\",\"ha\":\"AAAAAAAAAAAAAAAAAAAAAA\",\"cr\":[[\"" + node + "\"],[\"" + node + "\"],[0,0,\"" + enc_nk + "\"]]}]";
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) + (_sid != null ? "&sid=" + _sid : ""));
return RAW_REQUEST(request, url_api);
@ -1055,7 +1055,7 @@ public class MegaAPI implements Serializable {
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) + "&n=" + folder_id);
String res = RAW_REQUEST(request, url_api);
@ -1202,7 +1202,7 @@ public class MegaAPI implements Serializable {
String request = "[{\"a\":\"f\", \"c\":\"1\", \"r\":\"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) + "&n=" + folder_id);
String res = RAW_REQUEST(request, url_api);

View File

@ -727,8 +727,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
THREAD_POOL.execute(() -> {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
if (!getTransference_remove_queue().isEmpty()) {
ArrayList<Transference> transferences = new ArrayList(getTransference_remove_queue());
@ -755,8 +753,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
THREAD_POOL.execute(() -> {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
while (!getTransference_preprocess_queue().isEmpty()) {
Runnable run = getTransference_preprocess_queue().poll();
@ -794,7 +790,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
_tray_icon_finish = false;
THREAD_POOL.execute(() -> {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
ExecutorService executor = Executors.newFixedThreadPool(MAX_PROVISION_WORKERS);
@ -898,8 +893,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
THREAD_POOL.execute(() -> {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
while (!_frozen && !_main_panel.isExit() && !_paused_all && (!getTransference_waitstart_queue().isEmpty() || !getTransference_waitstart_aux_queue().isEmpty()) && getTransference_running_list().size() < _max_running_trans) {
synchronized (_transference_queue_sort_lock) {

View File

@ -85,8 +85,6 @@ public class UploadMACGenerator implements Runnable, SecureSingleThreadNotifiabl
@Override
public void run() {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
LOG.log(Level.INFO, "{0} MAC GENERATOR {1} Hello!", new Object[]{Thread.currentThread().getName(), getUpload().getFile_name()});
try {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

After

Width:  |  Height:  |  Size: 205 KiB