mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-06-13 13:57:38 +02:00
1.47
-Fix
This commit is contained in:
@ -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;
|
||||
|
||||
try {
|
||||
if (_file_name == null) {
|
||||
file_info = getMegaFileMetadata(_url, getMain_panel().getView(), retry);
|
||||
|
||||
if (file_info == null) {
|
||||
|
||||
_provision_ok = false;
|
||||
|
||||
} else {
|
||||
try {
|
||||
if (_file_name == null) {
|
||||
|
||||
file_info = getMegaFileMetadata(_url, getMain_panel().getView(), retry);
|
||||
|
||||
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);
|
||||
|
||||
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) {
|
||||
|
||||
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;
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -59,8 +59,6 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
return _deleted_elc_accounts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean isRemember_master_pass() {
|
||||
return _remember_master_pass;
|
||||
}
|
||||
|
@ -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 {
|
||||
|
||||
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,10 +375,10 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
|
||||
File the_file = new File(_file_name);
|
||||
|
||||
if (!the_file.exists()) {
|
||||
|
||||
_provision_ok = false;
|
||||
|
||||
if (!the_file.exists()) {
|
||||
|
||||
exit_msg = "ERROR: FILE NOT FOUND -> " + _file_name;
|
||||
|
||||
} else {
|
||||
@ -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