mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-28 04:20:19 +02:00
2.29
Smartproxy (experimental)2
This commit is contained in:
parent
ca260674da
commit
b05a13358b
@ -26,6 +26,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
private final Object _secure_notify_lock;
|
||||
private volatile boolean _error_wait;
|
||||
private boolean _notified;
|
||||
private boolean _error_no_proxy;
|
||||
private String _proxy;
|
||||
|
||||
public ChunkDownloader(int id, Download download) {
|
||||
@ -35,6 +36,15 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
_id = id;
|
||||
_download = download;
|
||||
_error_wait = false;
|
||||
_error_no_proxy = false;
|
||||
}
|
||||
|
||||
public boolean isError_no_proxy() {
|
||||
return _error_no_proxy;
|
||||
}
|
||||
|
||||
public void setError_no_proxy(boolean _error_no_proxy) {
|
||||
this._error_no_proxy = _error_no_proxy;
|
||||
}
|
||||
|
||||
public void setExit(boolean exit) {
|
||||
@ -110,9 +120,13 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
while (!_exit && !_download.isStopped()) {
|
||||
|
||||
if (httpclient == null || error || MainPanel.isUse_smart_proxy()) {
|
||||
if (httpclient == null || error || (MainPanel.isUse_smart_proxy() && _error_no_proxy)) {
|
||||
|
||||
if (MainPanel.isUse_smart_proxy()) {
|
||||
if (error) {
|
||||
_error_no_proxy = true;
|
||||
}
|
||||
|
||||
if (MainPanel.isUse_smart_proxy() && _error_no_proxy) {
|
||||
|
||||
if (error && current_proxy != null) {
|
||||
|
||||
@ -131,7 +145,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
}
|
||||
}
|
||||
|
||||
httpclient = MiscTools.getApacheKissHttpClientSmartProxy(current_proxy);
|
||||
httpclient = current_proxy != null ? MiscTools.getApacheKissHttpClientSmartProxy(current_proxy) : MiscTools.getApacheKissHttpClient();
|
||||
|
||||
} else if (httpclient == null) {
|
||||
|
||||
|
@ -47,9 +47,13 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
||||
|
||||
while (!isExit() && !getDownload().isStopped()) {
|
||||
|
||||
if (httpclient == null || worker_url == null || error || MainPanel.isUse_smart_proxy()) {
|
||||
if (httpclient == null || worker_url == null || error || (MainPanel.isUse_smart_proxy() && this.isError_no_proxy())) {
|
||||
|
||||
if (MainPanel.isUse_smart_proxy()) {
|
||||
if (error) {
|
||||
this.setError_no_proxy(true);
|
||||
}
|
||||
|
||||
if (MainPanel.isUse_smart_proxy() && this.isError_no_proxy()) {
|
||||
|
||||
if (error && current_proxy != null) {
|
||||
|
||||
@ -68,7 +72,7 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
||||
}
|
||||
}
|
||||
|
||||
httpclient = MiscTools.getApacheKissHttpClientSmartProxy(current_proxy);
|
||||
httpclient = current_proxy != null ? MiscTools.getApacheKissHttpClientSmartProxy(current_proxy) : MiscTools.getApacheKissHttpClient();
|
||||
|
||||
} else if (httpclient == null) {
|
||||
|
||||
|
@ -45,7 +45,7 @@ import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "2.28";
|
||||
public static final String VERSION = "2.29";
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||
public static final int STREAMER_PORT = 1337;
|
||||
|
@ -165,7 +165,7 @@
|
||||
</Group>
|
||||
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="79" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="smart_proxy_url_label" min="-2" max="-2" attributes="0"/>
|
||||
@ -483,9 +483,9 @@
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu" size="14" style="2"/>
|
||||
<Font name="Ubuntu" size="12" style="2"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Note: it is recomended to enable MULTI SLOT with enough slots and be patient while MegaBasterd filters down proxies."/>
|
||||
<Property name="text" type="java.lang.String" value="Note: it is recomended to enable MULTI SLOT with enough slots and be patient while MegaBasterd filters down proxies. MegaBasterd will try first to download chunk without proxy. (Use CTRL+V in order to paste URL)"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
@ -532,7 +532,7 @@
|
||||
</Group>
|
||||
<Component id="limit_upload_speed_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="406" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="590" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@ -684,7 +684,7 @@
|
||||
<Component id="delete_all_accounts_button" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="unlock_accounts_button" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="242" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="352" max="32767" attributes="0"/>
|
||||
<Component id="encrypt_pass_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
|
@ -688,8 +688,8 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
smart_proxy_url_text.setFont(new java.awt.Font("Ubuntu", 0, 16)); // NOI18N
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Ubuntu", 2, 14)); // NOI18N
|
||||
jLabel2.setText("Note: it is recomended to enable MULTI SLOT with enough slots and be patient while MegaBasterd filters down proxies.");
|
||||
jLabel2.setFont(new java.awt.Font("Ubuntu", 2, 12)); // NOI18N
|
||||
jLabel2.setText("Note: it is recomended to enable MULTI SLOT with enough slots and be patient while MegaBasterd filters down proxies. MegaBasterd will try first to download chunk without proxy. (Use CTRL+V in order to paste URL)");
|
||||
|
||||
javax.swing.GroupLayout downloads_panelLayout = new javax.swing.GroupLayout(downloads_panel);
|
||||
downloads_panel.setLayout(downloads_panelLayout);
|
||||
@ -746,7 +746,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(megacrypter_reverse_warning_label))
|
||||
.addComponent(jLabel2))
|
||||
.addGap(0, 79, Short.MAX_VALUE))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(downloads_panelLayout.createSequentialGroup()
|
||||
.addComponent(smart_proxy_url_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
@ -891,7 +891,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
.addGap(98, 98, 98)
|
||||
.addComponent(max_up_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(limit_upload_speed_checkbox))
|
||||
.addGap(0, 406, Short.MAX_VALUE)))
|
||||
.addGap(0, 590, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
uploads_panelLayout.setVerticalGroup(
|
||||
@ -1060,7 +1060,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
.addComponent(delete_all_accounts_button)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(unlock_accounts_button)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 242, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 352, Short.MAX_VALUE)
|
||||
.addComponent(encrypt_pass_checkbox))
|
||||
.addGroup(accounts_panelLayout.createSequentialGroup()
|
||||
.addComponent(remove_mega_account_button)
|
||||
|
@ -11,7 +11,7 @@ import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static megabasterd.MiscTools.getApacheKissHttpClientNOProxy;
|
||||
import static megabasterd.MiscTools.getApacheKissHttpClient;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
@ -110,7 +110,7 @@ public class SmartMegaProxyManager implements Runnable {
|
||||
|
||||
String data;
|
||||
|
||||
try (CloseableHttpClient httpclient = getApacheKissHttpClientNOProxy()) {
|
||||
try (CloseableHttpClient httpclient = getApacheKissHttpClient()) {
|
||||
|
||||
HttpGet httpget = new HttpGet(new URI(this._proxy_list_url));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user