mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-06-12 21:37:37 +02:00
1.47
-Fix
This commit is contained in:
@ -301,7 +301,7 @@ public final class CryptTools {
|
||||
HashSet<String> links = new HashSet<>();
|
||||
|
||||
if ((elc = findFirstRegex("mega://elc\\?([0-9a-zA-Z,_-]+)", link, 1)) != null) {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
byte[] elc_byte = UrlBASE642Bin(elc);
|
||||
@ -345,11 +345,11 @@ public final class CryptTools {
|
||||
|
||||
byte[] url_bin = Arrays.copyOfRange(elc_byte, 4 + bin_links_length + 2, 4 + bin_links_length + 2 + url_bin_length);
|
||||
|
||||
if(!new String(url_bin).contains("http")) {
|
||||
|
||||
if (!new String(url_bin).contains("http")) {
|
||||
|
||||
throw new Exception("BAD ELC HOST URL!");
|
||||
}
|
||||
|
||||
|
||||
short pass_bin_length = ByteBuffer.wrap(recReverseArray(Arrays.copyOfRange(elc_byte, 4 + bin_links_length + 2 + url_bin_length, 4 + bin_links_length + 2 + url_bin_length + 2), 0, 1)).getShort();
|
||||
|
||||
byte[] pass_bin = Arrays.copyOfRange(elc_byte, 4 + bin_links_length + 2 + url_bin_length + 2, 4 + bin_links_length + 2 + url_bin_length + 2 + pass_bin_length);
|
||||
@ -357,7 +357,7 @@ public final class CryptTools {
|
||||
try (CloseableHttpClient httpclient = getApacheKissHttpClient()) {
|
||||
|
||||
HttpPost httppost = new HttpPost(new String(url_bin));
|
||||
|
||||
|
||||
httppost.setHeader("Custom-User-Agent", MainPanel.DEFAULT_USER_AGENT);
|
||||
|
||||
ArrayList<NameValuePair> nameValuePairs = new ArrayList<>();
|
||||
|
@ -424,7 +424,6 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
_last_download_url = getMegaFileDownloadUrl(_url);
|
||||
|
||||
if (!_exit) {
|
||||
_retrying_request = false;
|
||||
|
||||
swingReflectionInvoke("setMinimum", getView().getProgress_pbar(), 0);
|
||||
swingReflectionInvoke("setMaximum", getView().getProgress_pbar(), MAX_VALUE);
|
||||
@ -748,15 +747,14 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
String exit_message = null;
|
||||
|
||||
_provision_ok = false;
|
||||
|
||||
try {
|
||||
if (_file_name == null) {
|
||||
|
||||
file_info = getMegaFileMetadata(_url, getMain_panel().getView(), retry);
|
||||
|
||||
if (file_info == null) {
|
||||
|
||||
_provision_ok = false;
|
||||
|
||||
} else {
|
||||
if (file_info != null) {
|
||||
|
||||
_file_name = file_info[0];
|
||||
|
||||
@ -765,6 +763,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
_file_key = file_info[2];
|
||||
|
||||
if (file_info.length == 5) {
|
||||
|
||||
_file_pass = file_info[3];
|
||||
|
||||
_file_noexpire = file_info[4];
|
||||
@ -774,34 +773,38 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
insertDownload(_url, _download_path, _file_name, _file_key, _file_size, _file_pass, _file_noexpire);
|
||||
|
||||
} catch (SQLException ex) {
|
||||
_provision_ok = true;
|
||||
|
||||
_provision_ok = false;
|
||||
} catch (SQLException ex) {
|
||||
|
||||
exit_message = "Error registering download (file " + _download_path + "/" + _file_name + " already downloading)";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (_restart) {
|
||||
|
||||
try {
|
||||
|
||||
insertDownload(_url, _download_path, _file_name, _file_key, _file_size, _file_pass, _file_noexpire);
|
||||
|
||||
} catch (SQLException ex) {
|
||||
_provision_ok = true;
|
||||
|
||||
_provision_ok = false;
|
||||
} catch (SQLException ex) {
|
||||
|
||||
exit_message = "Error registering download (file " + _download_path + "/" + _file_name + " already downloading)";
|
||||
}
|
||||
} else {
|
||||
|
||||
_provision_ok = true;
|
||||
}
|
||||
|
||||
} catch (MegaAPIException | MegaCrypterAPIException ex) {
|
||||
|
||||
throw ex;
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
_provision_ok = false;
|
||||
|
||||
exit_message = ex.getMessage();
|
||||
}
|
||||
|
||||
@ -1086,7 +1089,10 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_running_list().remove(this);
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_finished_queue().add(this);
|
||||
if (_provision_ok) {
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_finished_queue().add(this);
|
||||
}
|
||||
|
||||
getMain_panel().getDownload_manager().getScroll_panel().remove(getView());
|
||||
|
||||
@ -1095,16 +1101,16 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
getMain_panel().getDownload_manager().secureNotify();
|
||||
|
||||
if (isRetrying_request()) {
|
||||
getView().printStatusNormal("Retrying cancelled!");
|
||||
|
||||
swingReflectionInvoke("setEnabled", getView().getStop_button(), false);
|
||||
getView().stop("Retrying cancelled!");
|
||||
|
||||
} else if (isChecking_cbc()) {
|
||||
getView().printStatusNormal("Verification cancelled!");
|
||||
|
||||
swingReflectionInvoke("setEnabled", getView().getStop_button(), false);
|
||||
getView().stop("Verification cancelled!");
|
||||
|
||||
} else {
|
||||
|
||||
getView().stop();
|
||||
getView().stop("Stopping download safely, please wait...");
|
||||
|
||||
for (ChunkDownloader downloader : _chunkworkers) {
|
||||
|
||||
@ -1142,7 +1148,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getMegaFileMetadata(String link, MainPanelView panel, boolean retry_request) throws IOException, InterruptedException, MegaAPIException, MegaCrypterAPIException {
|
||||
public String[] getMegaFileMetadata(String link, MainPanelView panel, boolean retry_request) throws MegaAPIException, MegaCrypterAPIException {
|
||||
|
||||
String[] file_info = null;
|
||||
int retry = 0, error_code;
|
||||
@ -1154,9 +1160,11 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
try {
|
||||
|
||||
if (findFirstRegex("://mega(\\.co)?\\.nz/", link, 0) != null) {
|
||||
|
||||
MegaAPI ma = new MegaAPI();
|
||||
|
||||
file_info = ma.getMegaFileMetadata(link);
|
||||
|
||||
} else {
|
||||
file_info = MegaCrypterAPI.getMegaFileMetadata(link, panel);
|
||||
}
|
||||
@ -1219,13 +1227,17 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
emergencyStopDownloader("Mega link is not valid!");
|
||||
|
||||
if (!(ex instanceof MegaAPIException || ex instanceof MegaCrypterAPIException)) {
|
||||
emergencyStopDownloader("Mega link is not valid!");
|
||||
}
|
||||
}
|
||||
|
||||
} while (!_exit && error);
|
||||
|
||||
if (!error) {
|
||||
if (!_exit && !error) {
|
||||
swingReflectionInvoke("setText", getView().getStop_button(), "CANCEL DOWNLOAD");
|
||||
swingReflectionInvoke("setVisible", getView().getStop_button(), false);
|
||||
}
|
||||
|
@ -386,9 +386,9 @@ public final class DownloadView extends javax.swing.JPanel implements Transferen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
public void stop(String status) {
|
||||
|
||||
printStatusNormal("Stopping download safely, please wait...");
|
||||
printStatusNormal(status);
|
||||
|
||||
swingReflectionInvoke("setEnabled", new Object[]{pause_button, keep_temp_checkbox, stop_button, speed_label, slots_label, slots_spinner}, false);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ import static megabasterd.Transference.MAX_TRANSFERENCE_SPEED_DEFAULT;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "1.46";
|
||||
public static final String VERSION = "1.47";
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int STREAMER_PORT = 1337;
|
||||
public static final int WATCHDOG_PORT = 1338;
|
||||
|
@ -616,7 +616,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
_main_panel.getMega_active_accounts().remove(email);
|
||||
}
|
||||
|
||||
|
||||
for (String host : dialog.getDeleted_elc_accounts()) {
|
||||
|
||||
try {
|
||||
|
@ -893,7 +893,7 @@ public final class MiscTools {
|
||||
|
||||
ArrayList<String> links = findAllRegex("(?:https?|mega)://[^/]*/(#.*?)?!.+![^\r\n]+", data, 0);
|
||||
|
||||
links.addAll(findAllRegex("mega://enc.*?[^\r\n]+", data, 0));
|
||||
links.addAll(findAllRegex("mega://e(n|l)c.*?[^\r\n]+", data, 0));
|
||||
|
||||
if (links.size() > 0) {
|
||||
|
||||
|
@ -58,8 +58,6 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
public Set<String> getDeleted_elc_accounts() {
|
||||
return _deleted_elc_accounts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean isRemember_master_pass() {
|
||||
return _remember_master_pass;
|
||||
@ -979,7 +977,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
for (int i = 0; i < model.getRowCount(); i++) {
|
||||
|
||||
String host_table = ((String)model.getValueAt(i, 0)).trim().replaceAll("^(https?://)?([^/]+).*$", "$2");
|
||||
String host_table = ((String) model.getValueAt(i, 0)).trim().replaceAll("^(https?://)?([^/]+).*$", "$2");
|
||||
|
||||
String user_table = (String) model.getValueAt(i, 1);
|
||||
|
||||
@ -1003,7 +1001,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
HashMap<String, Object> elc_account_data = (HashMap) _main_panel.getElc_accounts().get(host_table);
|
||||
|
||||
String user = (String) elc_account_data.get("user");
|
||||
|
||||
|
||||
String apikey = (String) elc_account_data.get("apikey");
|
||||
|
||||
if (_main_panel.getMaster_pass() != null) {
|
||||
@ -1011,7 +1009,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
try {
|
||||
|
||||
user = new String(CryptTools.aes_cbc_decrypt_pkcs7(BASE642Bin(user), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
|
||||
apikey = new String(CryptTools.aes_cbc_decrypt_pkcs7(BASE642Bin(apikey), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
@ -5,6 +5,7 @@ import java.awt.Font;
|
||||
import java.awt.event.WindowEvent;
|
||||
import static java.awt.event.WindowEvent.WINDOW_CLOSING;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
@ -141,9 +142,24 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
|
||||
try {
|
||||
|
||||
link = CryptTools.decryptMegaDownloaderLink(link);
|
||||
if (MiscTools.findFirstRegex("://enc", link, 0) != null) {
|
||||
|
||||
link = CryptTools.decryptMegaDownloaderLink(link);
|
||||
|
||||
} else if (MiscTools.findFirstRegex("://elc", link, 0) != null) {
|
||||
|
||||
HashSet links = CryptTools.decryptELC(link, ((MainPanelView) tthis.getParent()).getMain_panel());
|
||||
|
||||
if (links != null) {
|
||||
|
||||
link = (String) links.iterator().next();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
error = true;
|
||||
|
||||
getLogger(StreamerDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
@ -172,7 +188,7 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
|
||||
if (error) {
|
||||
|
||||
JOptionPane.showMessageDialog(tthis, "Please, paste a mega/megacrypter link!", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(tthis, "Please, paste a mega/megacrypter/elc link!", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
swingReflectionInvoke("setText", original_link_textfield, "");
|
||||
|
||||
|
@ -8,7 +8,7 @@ public interface TransferenceView {
|
||||
|
||||
void pause();
|
||||
|
||||
void stop();
|
||||
void stop(String status);
|
||||
|
||||
void resume();
|
||||
|
||||
|
@ -375,9 +375,9 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
|
||||
File the_file = new File(_file_name);
|
||||
|
||||
if (!the_file.exists()) {
|
||||
_provision_ok = false;
|
||||
|
||||
_provision_ok = false;
|
||||
if (!the_file.exists()) {
|
||||
|
||||
exit_msg = "ERROR: FILE NOT FOUND -> " + _file_name;
|
||||
|
||||
@ -419,12 +419,16 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
|
||||
DBTools.insertUpload(_file_name, _ma.getEmail(), _parent_node, Bin2BASE64(i32a2bin(_ul_key)), _root_node, Bin2BASE64(_share_key), _folder_link);
|
||||
|
||||
} catch (IOException | SQLException ex) {
|
||||
_provision_ok = true;
|
||||
|
||||
_provision_ok = false;
|
||||
} catch (IOException | SQLException ex) {
|
||||
|
||||
exit_msg = ex.getMessage();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
_provision_ok = true;
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
@ -965,7 +969,10 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
|
||||
getMain_panel().getUpload_manager().getTransference_running_list().remove(this);
|
||||
|
||||
getMain_panel().getUpload_manager().getTransference_finished_queue().add(this);
|
||||
if (_provision_ok) {
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_finished_queue().add(this);
|
||||
}
|
||||
|
||||
getMain_panel().getUpload_manager().getScroll_panel().remove(getView());
|
||||
|
||||
@ -973,7 +980,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
|
||||
getMain_panel().getUpload_manager().secureNotify();
|
||||
|
||||
getView().stop();
|
||||
getView().stop("Stopping upload safely, please wait...");
|
||||
|
||||
for (ChunkUploader uploader : _chunkworkers) {
|
||||
|
||||
|
@ -404,9 +404,9 @@ public final class UploadView extends javax.swing.JPanel implements Transference
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
public void stop(String status) {
|
||||
|
||||
printStatusNormal("Stopping upload safely, please wait...");
|
||||
printStatusNormal(status);
|
||||
|
||||
swingReflectionInvoke("setEnabled", new Object[]{pause_button, stop_button, speed_label, slots_label, slots_spinner}, false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user