mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-20 08:17:11 +02:00
7.88
Smart Proxy PErfomance improve Some GUI tunning
This commit is contained in:
parent
e3d38566c9
commit
d1e1982aeb
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.87</version>
|
<version>7.88</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
@ -156,7 +156,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
SmartMegaProxyManager proxy_manager = MainPanel.getProxy_manager();
|
SmartMegaProxyManager proxy_manager = MainPanel.getProxy_manager();
|
||||||
|
|
||||||
if (MainPanel.isUse_smart_proxy() && proxy_manager.isForce_smart_proxy()) {
|
if (MainPanel.isUse_smart_proxy() && proxy_manager != null && proxy_manager.isForce_smart_proxy()) {
|
||||||
|
|
||||||
String[] smart_proxy = proxy_manager.getProxy(_excluded_proxy_list);
|
String[] smart_proxy = proxy_manager.getProxy(_excluded_proxy_list);
|
||||||
|
|
||||||
@ -270,9 +270,9 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_current_smart_proxy != null) {
|
if (_current_smart_proxy != null && proxy_manager != null) {
|
||||||
con.setConnectTimeout(MainPanel.getProxy_manager().getProxy_timeout());
|
con.setConnectTimeout(proxy_manager.getProxy_timeout());
|
||||||
con.setReadTimeout(MainPanel.getProxy_manager().getProxy_timeout() * 2);
|
con.setReadTimeout(proxy_manager.getProxy_timeout() * 2);
|
||||||
} else {
|
} else {
|
||||||
con.setConnectTimeout(Transference.HTTP_CONNECT_TIMEOUT);
|
con.setConnectTimeout(Transference.HTTP_CONNECT_TIMEOUT);
|
||||||
con.setReadTimeout(Transference.HTTP_READ_TIMEOUT);
|
con.setReadTimeout(Transference.HTTP_READ_TIMEOUT);
|
||||||
|
@ -715,12 +715,6 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
|||||||
|
|
||||||
if (!isExit() && !_thread_pool.isShutdown() && _status_error == null && progress < getFile_size() && progress <= last_progress) {
|
if (!isExit() && !_thread_pool.isShutdown() && _status_error == null && progress < getFile_size() && progress <= last_progress) {
|
||||||
stopDownloader("PROGRESS WATCHDOG TIMEOUT!");
|
stopDownloader("PROGRESS WATCHDOG TIMEOUT!");
|
||||||
|
|
||||||
if (MainPanel.isUse_smart_proxy()) {
|
|
||||||
String lista_proxy = DBTools.selectSettingValue("custom_proxy_list");
|
|
||||||
String url_list = MiscTools.findFirstRegex("^#(http.+)$", lista_proxy.trim(), 1);
|
|
||||||
MainPanel.getProxy_manager().refreshProxyList(url_list); //Force SmartProxy proxy list refresh
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.log(Level.INFO, "{0} PROGRESS WATCHDOG BYE BYE!", Thread.currentThread().getName());
|
LOG.log(Level.INFO, "{0} PROGRESS WATCHDOG BYE BYE!", Thread.currentThread().getName());
|
||||||
|
@ -37,6 +37,7 @@ public class DownloadManager extends TransferenceManager {
|
|||||||
|
|
||||||
ConcurrentLinkedQueue<Transference> transference_running_list = getMain_panel().getDownload_manager().getTransference_running_list();
|
ConcurrentLinkedQueue<Transference> transference_running_list = getMain_panel().getDownload_manager().getTransference_running_list();
|
||||||
|
|
||||||
|
if (!transference_running_list.isEmpty()) {
|
||||||
transference_running_list.forEach((transference) -> {
|
transference_running_list.forEach((transference) -> {
|
||||||
|
|
||||||
ArrayList<ChunkDownloader> chunkworkers = ((Download) transference).getChunkworkers();
|
ArrayList<ChunkDownloader> chunkworkers = ((Download) transference).getChunkworkers();
|
||||||
@ -51,7 +52,8 @@ public class DownloadManager extends TransferenceManager {
|
|||||||
getMain_panel().getView().getForce_chunk_reset_button().setEnabled(true);
|
getMain_panel().getView().getForce_chunk_reset_button().setEnabled(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(getMain_panel().getView(), LabelTranslatorSingleton.getInstance().translate("DONE"));
|
JOptionPane.showMessageDialog(getMain_panel().getView(), LabelTranslatorSingleton.getInstance().translate("CURRENT DOWNLOAD CHUNKS RESET!"));
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -69,7 +71,9 @@ public class DownloadManager extends TransferenceManager {
|
|||||||
secureNotify();
|
secureNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyAllLinksToClipboard() {
|
public int copyAllLinksToClipboard() {
|
||||||
|
|
||||||
|
int total = 0;
|
||||||
|
|
||||||
ArrayList<String> links = new ArrayList<>();
|
ArrayList<String> links = new ArrayList<>();
|
||||||
|
|
||||||
@ -82,6 +86,8 @@ public class DownloadManager extends TransferenceManager {
|
|||||||
|
|
||||||
out += String.join("\r\n", links);
|
out += String.join("\r\n", links);
|
||||||
|
|
||||||
|
total += links.size();
|
||||||
|
|
||||||
links.clear();
|
links.clear();
|
||||||
|
|
||||||
out += "\r\n\r\n***WAITING DOWNLOADS***\r\n\r\n";
|
out += "\r\n\r\n***WAITING DOWNLOADS***\r\n\r\n";
|
||||||
@ -98,6 +104,8 @@ public class DownloadManager extends TransferenceManager {
|
|||||||
|
|
||||||
out += String.join("\r\n", links);
|
out += String.join("\r\n", links);
|
||||||
|
|
||||||
|
total += links.size();
|
||||||
|
|
||||||
links.clear();
|
links.clear();
|
||||||
|
|
||||||
out += "\r\n\r\n***RUNNING DOWNLOADS***\r\n\r\n";
|
out += "\r\n\r\n***RUNNING DOWNLOADS***\r\n\r\n";
|
||||||
@ -109,6 +117,8 @@ public class DownloadManager extends TransferenceManager {
|
|||||||
|
|
||||||
out += String.join("\r\n", links);
|
out += String.join("\r\n", links);
|
||||||
|
|
||||||
|
total += links.size();
|
||||||
|
|
||||||
links.clear();
|
links.clear();
|
||||||
|
|
||||||
out += "\r\n\r\n***FINISHED DOWNLOADS***\r\n\r\n";
|
out += "\r\n\r\n***FINISHED DOWNLOADS***\r\n\r\n";
|
||||||
@ -120,8 +130,12 @@ public class DownloadManager extends TransferenceManager {
|
|||||||
|
|
||||||
out += String.join("\r\n", links);
|
out += String.join("\r\n", links);
|
||||||
|
|
||||||
|
total += links.size();
|
||||||
|
|
||||||
MiscTools.copyTextToClipboard(out);
|
MiscTools.copyTextToClipboard(out);
|
||||||
|
|
||||||
|
return total;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,7 +69,7 @@ import javax.swing.UIManager;
|
|||||||
*/
|
*/
|
||||||
public final class MainPanel {
|
public final class MainPanel {
|
||||||
|
|
||||||
public static final String VERSION = "7.87";
|
public static final String VERSION = "7.88";
|
||||||
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;
|
||||||
|
@ -517,7 +517,7 @@
|
|||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||||
<Image iconType="3" name="/images/icons8-copy-to-clipboard-30.png"/>
|
<Image iconType="3" name="/images/icons8-copy-to-clipboard-30.png"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="COPY ALL"/>
|
<Property name="text" type="java.lang.String" value="COPY ALL DOWNLOAD LINKS"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||||
@ -535,6 +535,7 @@
|
|||||||
<Color blue="ff" green="ff" red="ff" type="rgb"/>
|
<Color blue="ff" green="ff" red="ff" type="rgb"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="FORCE ALL CURRENT CHUNKS RESET"/>
|
<Property name="text" type="java.lang.String" value="FORCE ALL CURRENT CHUNKS RESET"/>
|
||||||
|
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="force_chunk_reset_buttonActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="force_chunk_reset_buttonActionPerformed"/>
|
||||||
|
@ -472,13 +472,11 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
|
|
||||||
translateLabels(this);
|
translateLabels(this);
|
||||||
|
|
||||||
for (JComponent c : new JComponent[]{unfreeze_transferences_button, global_speed_down_label, global_speed_up_label, down_remtime_label, up_remtime_label, close_all_finished_down_button, close_all_finished_up_button, pause_all_down_button, pause_all_up_button}) {
|
for (JComponent c : new JComponent[]{force_chunk_reset_button, unfreeze_transferences_button, global_speed_down_label, global_speed_up_label, down_remtime_label, up_remtime_label, close_all_finished_down_button, close_all_finished_up_button, pause_all_down_button, pause_all_up_button}) {
|
||||||
|
|
||||||
c.setVisible(false);
|
c.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
force_chunk_reset_button.setVisible(MainPanel.isUse_smart_proxy());
|
|
||||||
|
|
||||||
clean_all_down_menu.setEnabled(false);
|
clean_all_down_menu.setEnabled(false);
|
||||||
clean_all_up_menu.setEnabled(false);
|
clean_all_up_menu.setEnabled(false);
|
||||||
|
|
||||||
@ -674,7 +672,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
|
|
||||||
jButton1.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
|
jButton1.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
|
||||||
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8-copy-to-clipboard-30.png"))); // NOI18N
|
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8-copy-to-clipboard-30.png"))); // NOI18N
|
||||||
jButton1.setText("COPY ALL");
|
jButton1.setText("COPY ALL DOWNLOAD LINKS");
|
||||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
jButton1ActionPerformed(evt);
|
jButton1ActionPerformed(evt);
|
||||||
@ -685,6 +683,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
force_chunk_reset_button.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
|
force_chunk_reset_button.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
|
||||||
force_chunk_reset_button.setForeground(new java.awt.Color(255, 255, 255));
|
force_chunk_reset_button.setForeground(new java.awt.Color(255, 255, 255));
|
||||||
force_chunk_reset_button.setText("FORCE ALL CURRENT CHUNKS RESET");
|
force_chunk_reset_button.setText("FORCE ALL CURRENT CHUNKS RESET");
|
||||||
|
force_chunk_reset_button.setDoubleBuffered(true);
|
||||||
force_chunk_reset_button.addActionListener(new java.awt.event.ActionListener() {
|
force_chunk_reset_button.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
force_chunk_reset_buttonActionPerformed(evt);
|
force_chunk_reset_buttonActionPerformed(evt);
|
||||||
@ -1375,7 +1374,6 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
MainPanel.setProxy_manager(new SmartMegaProxyManager(url_list, _main_panel));
|
MainPanel.setProxy_manager(new SmartMegaProxyManager(url_list, _main_panel));
|
||||||
} else {
|
} else {
|
||||||
String lista_proxy = DBTools.selectSettingValue("custom_proxy_list");
|
String lista_proxy = DBTools.selectSettingValue("custom_proxy_list");
|
||||||
|
|
||||||
String url_list = MiscTools.findFirstRegex("^#(http.+)$", lista_proxy.trim(), 1);
|
String url_list = MiscTools.findFirstRegex("^#(http.+)$", lista_proxy.trim(), 1);
|
||||||
MainPanel.getProxy_manager().refreshProxyList(url_list);
|
MainPanel.getProxy_manager().refreshProxyList(url_list);
|
||||||
}
|
}
|
||||||
@ -1550,9 +1548,9 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
|
|
||||||
_main_panel.getDownload_manager().copyAllLinksToClipboard();
|
int total = _main_panel.getDownload_manager().copyAllLinksToClipboard();
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(this, LabelTranslatorSingleton.getInstance().translate("ALL COPIED!"));
|
JOptionPane.showMessageDialog(this, LabelTranslatorSingleton.getInstance().translate(total > 0 ? "ALL DOWNLOAD LINKS COPIED!" : "NO DOWNLOAD LINKS TO COPY"));
|
||||||
}//GEN-LAST:event_jButton1ActionPerformed
|
}//GEN-LAST:event_jButton1ActionPerformed
|
||||||
|
|
||||||
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
|
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
|
||||||
|
@ -163,7 +163,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -331,7 +331,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String _rawRequest(String request, URL url_api) throws MegaAPIException {
|
private String RAW_REQUEST(String request, URL url_api) throws MegaAPIException {
|
||||||
|
|
||||||
System.out.println(request);
|
System.out.println(request);
|
||||||
|
|
||||||
@ -379,23 +379,13 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
ArrayList<String> excluded_proxy_list = new ArrayList<>();
|
ArrayList<String> excluded_proxy_list = new ArrayList<>();
|
||||||
|
|
||||||
SmartMegaProxyManager proxy_manager = MainPanel.getProxy_manager();
|
|
||||||
|
|
||||||
if (MainPanel.isUse_smart_proxy() && proxy_manager.isForce_smart_proxy()) {
|
|
||||||
|
|
||||||
String[] smart_proxy = proxy_manager.getProxy(excluded_proxy_list);
|
|
||||||
|
|
||||||
current_smart_proxy = smart_proxy[0];
|
|
||||||
|
|
||||||
smart_proxy_socks = smart_proxy[1].equals("socks");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
|
SmartMegaProxyManager proxy_manager = MainPanel.getProxy_manager();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if ((current_smart_proxy != null || http_error == 509) && MainPanel.isUse_smart_proxy() && !MainPanel.isUse_proxy()) {
|
if ((current_smart_proxy != null || http_error == 509) && MainPanel.isUse_smart_proxy() && proxy_manager != null && !MainPanel.isUse_proxy()) {
|
||||||
|
|
||||||
if (current_smart_proxy != null && (http_error != 0 || empty_response)) {
|
if (current_smart_proxy != null && (http_error != 0 || empty_response)) {
|
||||||
|
|
||||||
@ -568,7 +558,7 @@ public class MegaAPI implements Serializable {
|
|||||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
String data = _rawRequest(request, url_api);
|
String data = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -607,7 +597,7 @@ public class MegaAPI implements Serializable {
|
|||||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
String data = _rawRequest(request, url_api);
|
String data = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -709,7 +699,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -753,7 +743,7 @@ public class MegaAPI implements Serializable {
|
|||||||
System.out.println(request);
|
System.out.println(request);
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
System.out.println(res);
|
System.out.println(res);
|
||||||
|
|
||||||
@ -814,7 +804,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
res = _rawRequest(request, url_api);
|
res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
System.out.println(request);
|
System.out.println(request);
|
||||||
|
|
||||||
@ -849,7 +839,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
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)) + "\"]]}]";
|
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)) + "\"]]}]";
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -906,7 +896,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
String request = "[{\"a\":\"p\", \"t\":\"" + parent_node + "\", \"n\":[{\"h\":\"xxxxxxxx\",\"t\":1,\"a\":\"" + Bin2UrlBASE64(enc_att) + "\",\"k\":\"" + Bin2UrlBASE64(enc_node_key) + "\"}],\"i\":\"" + _req_id + "\"}]";
|
String request = "[{\"a\":\"p\", \"t\":\"" + parent_node + "\", \"n\":[{\"h\":\"xxxxxxxx\",\"t\":1,\"a\":\"" + Bin2UrlBASE64(enc_att) + "\",\"k\":\"" + Bin2UrlBASE64(enc_node_key) + "\"}],\"i\":\"" + _req_id + "\"}]";
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -936,7 +926,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
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) + "\"]]}]";
|
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) + "\"]]}]";
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -964,7 +954,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -995,7 +985,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -1042,7 +1032,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (_sid != null ? "&sid=" + _sid : "") + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||||
|
|
||||||
return _rawRequest(request, url_api);
|
return RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LOG.log(Level.SEVERE, ex.getMessage());
|
LOG.log(Level.SEVERE, ex.getMessage());
|
||||||
@ -1074,7 +1064,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : "") + "&n=" + folder_id);
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : "") + "&n=" + folder_id);
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
|
|
||||||
@ -1218,7 +1208,7 @@ public class MegaAPI implements Serializable {
|
|||||||
|
|
||||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : "") + "&n=" + folder_id);
|
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : "") + "&n=" + folder_id);
|
||||||
|
|
||||||
String res = _rawRequest(request, url_api);
|
String res = RAW_REQUEST(request, url_api);
|
||||||
|
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
|
|
||||||
|
@ -1003,15 +1003,17 @@ public class MiscTools {
|
|||||||
|
|
||||||
int http_status = 0, http_error = 0;
|
int http_status = 0, http_error = 0;
|
||||||
|
|
||||||
SmartMegaProxyManager proxy_manager = MainPanel.getProxy_manager();
|
|
||||||
|
|
||||||
String current_smart_proxy = null;
|
String current_smart_proxy = null;
|
||||||
|
|
||||||
boolean smart_proxy_socks = false;
|
boolean smart_proxy_socks = false;
|
||||||
|
|
||||||
ArrayList<String> excluded_proxy_list = new ArrayList<>();
|
ArrayList<String> excluded_proxy_list = new ArrayList<>();
|
||||||
|
|
||||||
if (MainPanel.isUse_smart_proxy() && proxy_manager.isForce_smart_proxy()) {
|
do {
|
||||||
|
|
||||||
|
SmartMegaProxyManager proxy_manager = MainPanel.getProxy_manager();
|
||||||
|
|
||||||
|
if (MainPanel.isUse_smart_proxy() && proxy_manager != null && proxy_manager.isForce_smart_proxy()) {
|
||||||
|
|
||||||
String[] smart_proxy = proxy_manager.getProxy(excluded_proxy_list);
|
String[] smart_proxy = proxy_manager.getProxy(excluded_proxy_list);
|
||||||
|
|
||||||
@ -1021,13 +1023,11 @@ public class MiscTools {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
URL url = new URL(string_url + "/0-0");
|
URL url = new URL(string_url + "/0-0");
|
||||||
|
|
||||||
if ((current_smart_proxy != null || http_error == 509) && MainPanel.isUse_smart_proxy() && !MainPanel.isUse_proxy()) {
|
if ((current_smart_proxy != null || http_error == 509) && MainPanel.isUse_smart_proxy() && proxy_manager != null && !MainPanel.isUse_proxy()) {
|
||||||
|
|
||||||
if (current_smart_proxy != null && http_error != 0) {
|
if (current_smart_proxy != null && http_error != 0) {
|
||||||
|
|
||||||
@ -1088,9 +1088,9 @@ public class MiscTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_smart_proxy != null) {
|
if (current_smart_proxy != null && proxy_manager != null) {
|
||||||
con.setConnectTimeout(MainPanel.getProxy_manager().getProxy_timeout());
|
con.setConnectTimeout(proxy_manager.getProxy_timeout());
|
||||||
con.setReadTimeout(MainPanel.getProxy_manager().getProxy_timeout() * 2);
|
con.setReadTimeout(proxy_manager.getProxy_timeout() * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
con.setUseCaches(false);
|
con.setUseCaches(false);
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.tonikelope.megabasterd;
|
package com.tonikelope.megabasterd;
|
||||||
|
|
||||||
|
import static com.tonikelope.megabasterd.MainPanel.THREAD_POOL;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -171,7 +172,11 @@ public final class SmartMegaProxyManager {
|
|||||||
refreshProxyList();
|
refreshProxyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void refreshProxyList() {
|
public void refreshProxyList() {
|
||||||
|
|
||||||
|
THREAD_POOL.execute(() -> {
|
||||||
|
|
||||||
|
synchronized (this) {
|
||||||
|
|
||||||
String data;
|
String data;
|
||||||
|
|
||||||
@ -300,17 +305,17 @@ public final class SmartMegaProxyManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_main_panel.getView().updateSmartProxyStatus("SmartProxy: ON (" + String.valueOf(getProxyCount()) + ")");
|
_main_panel.getView().updateSmartProxyStatus("SmartProxy: ON (" + String.valueOf(getProxyCount()) + ")" + (this.isForce_smart_proxy() ? " F!" : ""));
|
||||||
|
|
||||||
LOG.log(Level.INFO, "{0} Smart Proxy Manager: proxy list refreshed ({1})", new Object[]{Thread.currentThread().getName(), _proxy_list.size()});
|
LOG.log(Level.INFO, "{0} Smart Proxy Manager: proxy list refreshed ({1})", new Object[]{Thread.currentThread().getName(), _proxy_list.size()});
|
||||||
|
|
||||||
} else if (!custom_clean_list.isEmpty()) {
|
} else if (!custom_clean_list.isEmpty()) {
|
||||||
|
|
||||||
_main_panel.getView().updateSmartProxyStatus("SmartProxy: ON (" + String.valueOf(getProxyCount()) + ")*");
|
_main_panel.getView().updateSmartProxyStatus("SmartProxy: ON (" + String.valueOf(getProxyCount()) + ")" + (this.isForce_smart_proxy() ? " F!" : ""));
|
||||||
|
|
||||||
LOG.log(Level.INFO, "{0} Smart Proxy Manager: proxy list refreshed ({1})", new Object[]{Thread.currentThread().getName(), _proxy_list.size()});
|
LOG.log(Level.INFO, "{0} Smart Proxy Manager: proxy list refreshed ({1})", new Object[]{Thread.currentThread().getName(), _proxy_list.size()});
|
||||||
} else {
|
} else {
|
||||||
_main_panel.getView().updateSmartProxyStatus("SmartProxy: ON (0)");
|
_main_panel.getView().updateSmartProxyStatus("SmartProxy: ON (0 proxies!)" + (this.isForce_smart_proxy() ? " F!" : ""));
|
||||||
LOG.log(Level.INFO, "{0} Smart Proxy Manager: NO PROXYS");
|
LOG.log(Level.INFO, "{0} Smart Proxy Manager: NO PROXYS");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +330,9 @@ public final class SmartMegaProxyManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static class SmartProxyAuthenticator extends Authenticator {
|
public static class SmartProxyAuthenticator extends Authenticator {
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public class StreamChunkDownloader implements Runnable {
|
|||||||
|
|
||||||
ArrayList<String> excluded_proxy_list = new ArrayList<>();
|
ArrayList<String> excluded_proxy_list = new ArrayList<>();
|
||||||
|
|
||||||
if (proxy_manager.isForce_smart_proxy()) {
|
if (MainPanel.isUse_smart_proxy() && proxy_manager != null && proxy_manager.isForce_smart_proxy()) {
|
||||||
|
|
||||||
String[] smart_proxy = proxy_manager.getProxy(excluded_proxy_list);
|
String[] smart_proxy = proxy_manager.getProxy(excluded_proxy_list);
|
||||||
|
|
||||||
@ -164,9 +164,9 @@ public class StreamChunkDownloader implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_smart_proxy != null) {
|
if (current_smart_proxy != null && proxy_manager != null) {
|
||||||
con.setConnectTimeout(MainPanel.getProxy_manager().getProxy_timeout());
|
con.setConnectTimeout(proxy_manager.getProxy_timeout());
|
||||||
con.setReadTimeout(MainPanel.getProxy_manager().getProxy_timeout() * 2);
|
con.setReadTimeout(proxy_manager.getProxy_timeout() * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
con.setUseCaches(false);
|
con.setUseCaches(false);
|
||||||
|
@ -649,6 +649,12 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
|||||||
private void _updateView() {
|
private void _updateView() {
|
||||||
|
|
||||||
MiscTools.GUIRun(() -> {
|
MiscTools.GUIRun(() -> {
|
||||||
|
|
||||||
|
if (this instanceof DownloadManager) {
|
||||||
|
|
||||||
|
this._main_panel.getView().getForce_chunk_reset_button().setVisible(MainPanel.isUse_smart_proxy() && !getTransference_running_list().isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
if (_paused_all) {
|
if (_paused_all) {
|
||||||
_pause_all_button.setText(LabelTranslatorSingleton.getInstance().translate("RESUME ALL"));
|
_pause_all_button.setText(LabelTranslatorSingleton.getInstance().translate("RESUME ALL"));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user