This commit is contained in:
tonikelope 2018-01-01 14:09:09 +01:00
parent cb242c116d
commit db05ac4fef
24 changed files with 203 additions and 82 deletions

View File

@ -110,15 +110,10 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
while (!_exit && !_download.isStopped()) {
if (_download.getMain_panel().isUse_smart_proxy() && _download.getMain_panel().getProxy_manager().isEnabled() && !_download.getMain_panel().isUse_smart_proxy()) {
_download.getMain_panel().getProxy_manager().setUse_smart_proxy(false);
}
if (httpclient == null || error || _download.getMain_panel().isUse_smart_proxy()) {
if (error509 && _download.getMain_panel().isUse_smart_proxy() && !_download.getMain_panel().getProxy_manager().isEnabled()) {
_download.getMain_panel().getProxy_manager().setUse_smart_proxy(true);
_download.getMain_panel().getProxy_manager().setEnabled(true);
}
if (_download.getMain_panel().isUse_smart_proxy() && _download.getMain_panel().getProxy_manager().isEnabled() && !MainPanel.isUse_proxy()) {
@ -147,7 +142,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
} else {
httpclient = MiscTools.getApacheKissHttpClient();
_download.getMain_panel().getProxy_manager().setUse_smart_proxy(false);
_download.getMain_panel().getProxy_manager().setEnabled(false);
}
} else if (httpclient == null) {

View File

@ -1,8 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package megabasterd;
import java.io.ByteArrayOutputStream;

View File

@ -12,6 +12,10 @@ import javax.crypto.CipherInputStream;
import javax.crypto.NoSuchPaddingException;
import static megabasterd.CryptTools.*;
/**
*
* @author tonikelope
*/
public final class ChunkWriter implements Runnable, SecureSingleThreadNotifiable {
private long _last_chunk_id_written;

View File

@ -10,6 +10,10 @@ import java.util.logging.Level;
import static java.util.logging.Level.SEVERE;
import java.util.logging.Logger;
/**
*
* @author tonikelope
*/
public final class ClipboardSpy implements Runnable, ClipboardOwner, SecureSingleThreadNotifiable, ClipboardChangeObservable {
private static final int SLEEP = 250;

View File

@ -2,6 +2,10 @@ package megabasterd;
import java.util.HashMap;
/**
*
* @author tonikelope
*/
public final class ContentType {
private final HashMap<String, String> _content_type;

View File

@ -11,6 +11,10 @@ import javax.swing.Action;
import javax.swing.JPopupMenu;
import javax.swing.text.JTextComponent;
/**
*
* @author tonikelope
*/
public final class ContextMenuMouseListener extends MouseAdapter {
private final JPopupMenu _popup;

View File

@ -39,6 +39,10 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.codehaus.jackson.map.ObjectMapper;
/**
*
* @author tonikelope
*/
public final class CryptTools {
public static final int[] AES_ZERO_IV_I32A = {0, 0, 0, 0};

View File

@ -9,6 +9,10 @@ import java.util.logging.Logger;
import static megabasterd.DBTools.*;
import static megabasterd.MainPanel.*;
/**
*
* @author tonikelope
*/
public final class DownloadManager extends TransferenceManager {
public DownloadManager(MainPanel main_panel) {

View File

@ -17,6 +17,10 @@ import javax.swing.SpinnerNumberModel;
import static megabasterd.MainPanel.*;
import static megabasterd.MiscTools.*;
/**
*
* @author tonikelope
*/
public final class DownloadView extends javax.swing.JPanel implements TransferenceView {
private final Download _download;

View File

@ -9,6 +9,10 @@ import java.util.logging.Logger;
import javax.swing.JLabel;
import static megabasterd.MiscTools.*;
/**
*
* @author tonikelope
*/
public final class GlobalSpeedMeter implements Runnable {
public static final int SLEEP = 3000;

View File

@ -4,7 +4,6 @@ import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import java.awt.Color;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -30,6 +29,10 @@ import org.apache.http.HttpStatus;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
/**
*
* @author tonikelope
*/
public final class KissVideoStreamServer implements HttpHandler, SecureSingleThreadNotifiable {
public static final int THREAD_START = 0x01;
@ -98,15 +101,7 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
public void start(int port, String context) throws IOException {
swingInvoke(
new Runnable() {
@Override
public void run() {
_main_panel.getView().getKiss_server_status().setForeground(new Color(0, 128, 0));
_main_panel.getView().getKiss_server_status().setText("Stream server running on localhost:" + STREAMER_PORT + " (Waiting for request...)");
}
});
_main_panel.getView().updateKissStreamServerStatus("Stream server running on port: " + STREAMER_PORT);
HttpServer httpserver = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), port), 0);
@ -130,24 +125,18 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
private void _updateStatusView() {
swingInvoke(
new Runnable() {
@Override
public void run() {
String status;
if (getWorking_threads().size() > 0) {
status = "Stream server running on localhost:" + STREAMER_PORT + " Connections: " + getWorking_threads().size();
status = "Stream server running on port: " + STREAMER_PORT + " (" + getWorking_threads().size() + ")";
} else {
status = "Stream server running on localhost:" + STREAMER_PORT + " (Waiting for request...)";
status = "Stream server running on port: " + STREAMER_PORT;
}
_main_panel.getView().getKiss_server_status().setText(status);
}
});
_main_panel.getView().updateKissStreamServerStatus(status);
}

View File

@ -17,6 +17,10 @@ import javax.swing.filechooser.FileNameExtensionFilter;
import static megabasterd.MainPanel.*;
import static megabasterd.MiscTools.*;
/**
*
* @author tonikelope
*/
public final class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardChangeObserver {
private boolean _download;

View File

@ -34,6 +34,7 @@ import javax.swing.JOptionPane;
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
import static javax.swing.JOptionPane.showOptionDialog;
import javax.swing.UIManager;
import static megabasterd.DBTools.*;
import static megabasterd.MiscTools.*;
import static megabasterd.Transference.*;
@ -46,7 +47,7 @@ import org.apache.http.auth.UsernamePasswordCredentials;
*/
public final class MainPanel {
public static final String VERSION = "2.64";
public static final String VERSION = "2.65";
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;
@ -66,6 +67,9 @@ public final class MainPanel {
setNimbusLookAndFeel();
UIManager.put("OptionPane.messageFont", DEFAULT_FONT.deriveFont(15f * ZOOM_FACTOR));
UIManager.put("OptionPane.buttonFont", DEFAULT_FONT.deriveFont(13f * ZOOM_FACTOR));
if (args.length > 0) {
try {
@ -193,8 +197,8 @@ public final class MainPanel {
});
if (_megacrypter_reverse) {
_mega_proxy_server = new MegaProxyServer(UUID.randomUUID().toString(), _megacrypter_reverse_port);
_mega_proxy_server.start();
_mega_proxy_server = new MegaProxyServer(this, UUID.randomUUID().toString(), _megacrypter_reverse_port);
THREAD_POOL.execute(_mega_proxy_server);
} else {
_mega_proxy_server = null;
}

View File

@ -173,6 +173,8 @@
<Group type="102" attributes="0">
<Component id="kiss_server_status" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="mc_reverse_status" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="smart_proxy_status" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="logo_label" min="-2" max="-2" attributes="0"/>
@ -191,7 +193,10 @@
<Group type="103" groupAlignment="1" attributes="0">
<Component id="logo_label" min="-2" max="-2" attributes="0"/>
<Component id="smart_proxy_status" alignment="1" min="-2" pref="24" max="-2" attributes="0"/>
<Component id="kiss_server_status" alignment="1" min="-2" pref="24" max="-2" attributes="0"/>
<Group type="103" alignment="1" groupAlignment="0" attributes="0">
<Component id="mc_reverse_status" min="-2" pref="24" max="-2" attributes="0"/>
<Component id="kiss_server_status" min="-2" pref="24" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group>
@ -212,15 +217,30 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="2"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="66" red="66" type="rgb"/>
</Property>
<Property name="doubleBuffered" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="mc_reverse_status">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="2"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="66" red="66" type="rgb"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="smart_proxy_status">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="2"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="66" red="66" type="rgb"/>
</Property>
<Property name="doubleBuffered" type="boolean" value="true"/>
</Properties>
</Component>
@ -253,7 +273,7 @@
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="status_down_label" pref="679" max="32767" attributes="0"/>
<Component id="status_down_label" pref="699" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="close_all_finished_down_button" min="-2" max="-2" attributes="0"/>
</Group>
@ -297,6 +317,9 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="16" style="2"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="66" red="66" type="rgb"/>
</Property>
<Property name="doubleBuffered" type="boolean" value="true"/>
</Properties>
</Component>
@ -376,7 +399,7 @@
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="status_up_label" pref="679" max="32767" attributes="0"/>
<Component id="status_up_label" pref="699" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="close_all_finished_up_button" min="-2" max="-2" attributes="0"/>
</Group>
@ -420,6 +443,9 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="16" style="2"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="66" red="66" type="rgb"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="close_all_finished_up_button">

View File

@ -31,6 +31,10 @@ import static megabasterd.DBTools.*;
import static megabasterd.MainPanel.*;
import static megabasterd.MiscTools.*;
/**
*
* @author tonikelope
*/
public final class MainPanelView extends javax.swing.JFrame {
private final MainPanel _main_panel;
@ -115,6 +119,49 @@ public final class MainPanelView extends javax.swing.JFrame {
return smart_proxy_status;
}
public JLabel getMc_reverse_status() {
return mc_reverse_status;
}
public void updateKissStreamServerStatus(final String status) {
swingInvoke(
new Runnable() {
@Override
public void run() {
getKiss_server_status().setText(status);
}
});
}
public void updateSmartProxyStatus(final String status) {
swingInvoke(
new Runnable() {
@Override
public void run() {
getSmart_proxy_status().setText(status);
}
});
}
public void updateMCReverseStatus(final String status) {
swingInvoke(
new Runnable() {
@Override
public void run() {
getMc_reverse_status().setText(status);
}
});
}
public MainPanelView(MainPanel main_panel) {
_main_panel = main_panel;
@ -152,6 +199,7 @@ public final class MainPanelView extends javax.swing.JFrame {
logo_label = new javax.swing.JLabel();
kiss_server_status = new javax.swing.JLabel();
mc_reverse_status = new javax.swing.JLabel();
smart_proxy_status = new javax.swing.JLabel();
jTabbedPane1 = new javax.swing.JTabbedPane();
downloads_panel = new javax.swing.JPanel();
@ -192,10 +240,14 @@ public final class MainPanelView extends javax.swing.JFrame {
logo_label.setDoubleBuffered(true);
kiss_server_status.setFont(new java.awt.Font("Dialog", 2, 14)); // NOI18N
kiss_server_status.setForeground(new java.awt.Color(102, 102, 102));
kiss_server_status.setDoubleBuffered(true);
mc_reverse_status.setFont(new java.awt.Font("Dialog", 2, 14)); // NOI18N
mc_reverse_status.setForeground(new java.awt.Color(102, 102, 102));
smart_proxy_status.setFont(new java.awt.Font("Dialog", 2, 14)); // NOI18N
smart_proxy_status.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
smart_proxy_status.setForeground(new java.awt.Color(102, 102, 102));
smart_proxy_status.setDoubleBuffered(true);
jTabbedPane1.setDoubleBuffered(true);
@ -206,6 +258,7 @@ public final class MainPanelView extends javax.swing.JFrame {
global_speed_down_label.setDoubleBuffered(true);
status_down_label.setFont(new java.awt.Font("Dialog", 2, 16)); // NOI18N
status_down_label.setForeground(new java.awt.Color(102, 102, 102));
status_down_label.setDoubleBuffered(true);
close_all_finished_down_button.setBackground(new java.awt.Color(0, 153, 51));
@ -245,7 +298,7 @@ public final class MainPanelView extends javax.swing.JFrame {
.addComponent(pause_all_down_button))
.addGroup(downloads_panelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(status_down_label, javax.swing.GroupLayout.DEFAULT_SIZE, 679, Short.MAX_VALUE)
.addComponent(status_down_label, javax.swing.GroupLayout.DEFAULT_SIZE, 699, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(close_all_finished_down_button))
.addComponent(jScrollPane_down)
@ -275,6 +328,7 @@ public final class MainPanelView extends javax.swing.JFrame {
global_speed_up_label.setDoubleBuffered(true);
status_up_label.setFont(new java.awt.Font("Dialog", 2, 16)); // NOI18N
status_up_label.setForeground(new java.awt.Color(102, 102, 102));
close_all_finished_up_button.setBackground(new java.awt.Color(0, 153, 51));
close_all_finished_up_button.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
@ -313,7 +367,7 @@ public final class MainPanelView extends javax.swing.JFrame {
.addComponent(pause_all_up_button))
.addGroup(uploads_panelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(status_up_label, javax.swing.GroupLayout.DEFAULT_SIZE, 679, Short.MAX_VALUE)
.addComponent(status_up_label, javax.swing.GroupLayout.DEFAULT_SIZE, 699, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(close_all_finished_up_button))
.addComponent(jScrollPane_up)
@ -452,6 +506,8 @@ public final class MainPanelView extends javax.swing.JFrame {
.addGroup(layout.createSequentialGroup()
.addComponent(kiss_server_status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(mc_reverse_status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(smart_proxy_status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(logo_label)))
@ -466,7 +522,9 @@ public final class MainPanelView extends javax.swing.JFrame {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(logo_label)
.addComponent(smart_proxy_status, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(kiss_server_status, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mc_reverse_status, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(kiss_server_status, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(2, 2, 2))
);
@ -713,16 +771,17 @@ public final class MainPanelView extends javax.swing.JFrame {
if (_main_panel.getMega_proxy_server() == null) {
_main_panel.setMega_proxy_server(new MegaProxyServer(UUID.randomUUID().toString(), _main_panel.getMegacrypter_reverse_port()));
_main_panel.getMega_proxy_server().start();
_main_panel.setMega_proxy_server(new MegaProxyServer(_main_panel, UUID.randomUUID().toString(), _main_panel.getMegacrypter_reverse_port()));
THREAD_POOL.execute(_main_panel.getMega_proxy_server());
} else if (_main_panel.getMega_proxy_server().getPort() != _main_panel.getMegacrypter_reverse_port()) {
try {
_main_panel.getMega_proxy_server().stopServer();
_main_panel.setMega_proxy_server(new MegaProxyServer(UUID.randomUUID().toString(), _main_panel.getMegacrypter_reverse_port()));
_main_panel.getMega_proxy_server().start();
_main_panel.setMega_proxy_server(new MegaProxyServer(_main_panel, UUID.randomUUID().toString(), _main_panel.getMegacrypter_reverse_port()));
THREAD_POOL.execute(_main_panel.getMega_proxy_server());
} catch (IOException ex) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
@ -1016,6 +1075,7 @@ public final class MainPanelView extends javax.swing.JFrame {
private javax.swing.JLabel kiss_server_status;
private javax.swing.JLabel logo_label;
private javax.swing.JMenuBar main_menubar;
private javax.swing.JLabel mc_reverse_status;
private javax.swing.JMenuItem new_download_menu;
private javax.swing.JMenuItem new_stream_menu;
private javax.swing.JMenuItem new_upload_menu;

View File

@ -24,6 +24,10 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.codehaus.jackson.map.ObjectMapper;
/**
*
* @author tonikelope
*/
public final class MegaAPI {
public static final String API_URL = "https://g.api.mega.co.nz";

View File

@ -1,5 +1,9 @@
package megabasterd;
/**
*
* @author tonikelope
*/
public final class MegaAPIException extends Exception {
public MegaAPIException(String message) {

View File

@ -1,5 +1,9 @@
package megabasterd;
/**
*
* @author tonikelope
*/
public final class MegaCrypterAPIException extends Exception {
public MegaCrypterAPIException(String message) {

View File

@ -9,18 +9,23 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static megabasterd.MiscTools.*;
/**
*
* @author tonikelope
*/
/**
* Thanks to -> https://stackoverflow.com/users/6477541/sarvesh-agarwal
*/
public class MegaProxyServer extends Thread {
public class MegaProxyServer implements Runnable {
private final String _password;
private final int _port;
private ServerSocket _serverSocket;
private final MainPanel _main_panel;
public MegaProxyServer(String password, int port) {
public MegaProxyServer(MainPanel main_panel, String password, int port) {
super("Server Thread");
_main_panel = main_panel;
_password = password;
_port = port;
@ -42,6 +47,8 @@ public class MegaProxyServer extends Thread {
@Override
public void run() {
_main_panel.getView().updateMCReverseStatus("MCReverse running on port: " + _port);
try {
_serverSocket = new ServerSocket(_port);
@ -54,7 +61,6 @@ public class MegaProxyServer extends Thread {
(new Handler(socket, _password)).start();
}
} catch (IOException e) {
// TODO: implement catch
}
@ -70,6 +76,8 @@ public class MegaProxyServer extends Thread {
}
}
}
_main_panel.getView().updateMCReverseStatus("");
}
public static class Handler extends Thread {
@ -105,7 +113,6 @@ public class MegaProxyServer extends Thread {
}
}
} catch (IOException e) {
// TODO: implement catch
}
}
@ -156,8 +163,8 @@ public class MegaProxyServer extends Thread {
try {
forwardSocket = new Socket(matcher.group(1), Integer.parseInt(matcher.group(2)));
} catch (IOException | NumberFormatException e) { // TODO: implement catch
// TODO: implement catch
} catch (IOException | NumberFormatException e) {
outputStreamWriter.write("HTTP/" + matcher.group(3) + " 502 Bad Gateway\r\n");
outputStreamWriter.write("Proxy-agent: MegaBasterd/0.1\r\n");
outputStreamWriter.write("\r\n");
@ -200,7 +207,6 @@ public class MegaProxyServer extends Thread {
try {
remoteToClient.join();
} catch (InterruptedException e) {
// TODO: implement catch
}
}
@ -225,14 +231,12 @@ public class MegaProxyServer extends Thread {
}
} catch (IOException e) {
// TODO: implement catch
} finally {
try {
_clientSocket.close();
} catch (IOException e) {
// TODO: implement catch
}
}

View File

@ -78,6 +78,10 @@ import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.RequestContent;
import org.apache.http.protocol.RequestTargetHost;
/**
*
* @author tonikelope
*/
public final class MiscTools {
public static final int EXP_BACKOFF_BASE = 2;

View File

@ -4,6 +4,10 @@ import java.util.logging.Level;
import static java.util.logging.Level.SEVERE;
import java.util.logging.Logger;
/**
*
* @author tonikelope
*/
public final class ProgressMeter implements Runnable, SecureSingleThreadNotifiable {
private final Transference _transference;

View File

@ -34,6 +34,10 @@ import static megabasterd.DBTools.*;
import static megabasterd.MainPanel.*;
import static megabasterd.MiscTools.*;
/**
*
* @author tonikelope
*/
public final class SettingsDialog extends javax.swing.JDialog {
private String _download_path;

View File

@ -45,18 +45,18 @@ public class SmartMegaProxyManager implements Runnable {
return _enabled;
}
public void setUse_smart_proxy(boolean use_smart_proxy) {
public void setEnabled(boolean enabled) {
if (!_main_panel.isLimit_download_speed()) {
if (!_enabled && use_smart_proxy) {
if (!_enabled && enabled) {
_main_panel.getView().getGlobal_speed_down_label().setForeground(Color.BLACK);
} else if (_enabled && !use_smart_proxy) {
} else if (_enabled && !enabled) {
_main_panel.getView().getGlobal_speed_down_label().setForeground(new Color(0, 128, 255));
}
}
_enabled = use_smart_proxy;
_enabled = enabled;
}
public void setExit(boolean exit) {
@ -104,7 +104,7 @@ public class SmartMegaProxyManager implements Runnable {
_proxy_list.remove(proxy);
}
_main_panel.getView().getSmart_proxy_status().setText("SmartProxy: " + _proxy_list.size() + " ");
_main_panel.getView().updateSmartProxyStatus("SmartProxy: " + _proxy_list.size());
if (_proxy_list.isEmpty()) {
@ -172,7 +172,7 @@ public class SmartMegaProxyManager implements Runnable {
_enabled = false;
}
_main_panel.getView().getSmart_proxy_status().setText("SmartProxy: " + _proxy_list.size() + " ");
_main_panel.getView().updateSmartProxyStatus("SmartProxy: " + _proxy_list.size());
}
} catch (MalformedURLException ex) {
@ -187,7 +187,7 @@ public class SmartMegaProxyManager implements Runnable {
Logger.getLogger(SmartMegaProxyManager.class.getName()).log(Level.INFO, "{0} Smart Proxy Manager: hello!", new Object[]{Thread.currentThread().getName()});
_main_panel.getView().getSmart_proxy_status().setVisible(true);
_main_panel.getView().updateSmartProxyStatus("");
while (!_exit) {
@ -203,9 +203,7 @@ public class SmartMegaProxyManager implements Runnable {
}
}
_main_panel.getView().getSmart_proxy_status().setText("");
_main_panel.getView().getSmart_proxy_status().setVisible(false);
_main_panel.getView().updateSmartProxyStatus("");
Logger.getLogger(SmartMegaProxyManager.class.getName()).log(Level.INFO, "{0} Smart Proxy Manager: bye bye", new Object[]{Thread.currentThread().getName()});

View File

@ -1,8 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package megabasterd;
import java.io.IOException;
@ -63,15 +58,10 @@ public class StreamChunkDownloader implements Runnable {
_chunkwriter.secureWait();
}
if (_chunkwriter.getServer().getMain_panel().isUse_smart_proxy() && _chunkwriter.getServer().getMain_panel().getProxy_manager().isEnabled() && !_chunkwriter.getServer().getMain_panel().isUse_smart_proxy()) {
_chunkwriter.getServer().getMain_panel().getProxy_manager().setUse_smart_proxy(false);
}
if (httpclient == null || error || _chunkwriter.getServer().getMain_panel().getProxy_manager().isEnabled()) {
if (error509 && _chunkwriter.getServer().getMain_panel().isUse_smart_proxy() && !_chunkwriter.getServer().getMain_panel().getProxy_manager().isEnabled()) {
_chunkwriter.getServer().getMain_panel().getProxy_manager().setUse_smart_proxy(true);
_chunkwriter.getServer().getMain_panel().getProxy_manager().setEnabled(true);
}
if (_chunkwriter.getServer().getMain_panel().isUse_smart_proxy() && _chunkwriter.getServer().getMain_panel().getProxy_manager().isEnabled() && !MainPanel.isUse_proxy()) {
@ -100,7 +90,7 @@ public class StreamChunkDownloader implements Runnable {
} else {
httpclient = MiscTools.getApacheKissHttpClient();
_chunkwriter.getServer().getMain_panel().getProxy_manager().setUse_smart_proxy(false);
_chunkwriter.getServer().getMain_panel().getProxy_manager().setEnabled(false);
}
} else if (httpclient == null) {