mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-04-30 14:44:33 +02:00
7.78
Fix trayicon popupmenu on multi screen (linux) RUN EXTERNAL COMMAND TIMEOUT CHANGED FROM 10 minutes -> 2 minutes Max slots changed from 20 -> 30 (useful for smartproxy auto turbo mode)
This commit is contained in:
parent
ea50cfdc16
commit
689a98dda5
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.tonikelope</groupId>
|
||||
<artifactId>MegaBasterd</artifactId>
|
||||
<version>7.77</version>
|
||||
<version>7.78</version>
|
||||
<packaging>jar</packaging>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -31,7 +31,6 @@ import java.util.logging.Logger;
|
||||
*/
|
||||
public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
public static final double SLOW_PROXY_PERC = 0.5;
|
||||
private static final Logger LOG = Logger.getLogger(ChunkDownloader.class.getName());
|
||||
private final int _id;
|
||||
private final Download _download;
|
||||
@ -184,6 +183,8 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
MainPanel.run_external_command();
|
||||
|
||||
} else if (http_error != 509 && MainPanel.isRun_command() && MainPanel.LAST_TIMESTAMP_EXTERNAL_COMMAND != -1) {
|
||||
MainPanel.LAST_TIMESTAMP_EXTERNAL_COMMAND = -1;
|
||||
}
|
||||
|
||||
if ((_current_smart_proxy != null || http_error == 509) && MainPanel.isUse_smart_proxy() && !MainPanel.isUse_proxy()) {
|
||||
|
@ -1512,6 +1512,10 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
error_code = ex.getCode();
|
||||
|
||||
if (error_code == -11) {
|
||||
_status_error = "ERROR: MEGA LINK BLOCKED/DELETED!";
|
||||
}
|
||||
|
||||
if (Arrays.asList(FATAL_API_ERROR_CODES).contains(error_code)) {
|
||||
|
||||
_auto_retry_on_error = Arrays.asList(FATAL_API_ERROR_CODES_WITH_RETRY).contains(error_code);
|
||||
|
@ -18,13 +18,12 @@ import java.awt.Color;
|
||||
import static java.awt.EventQueue.invokeLater;
|
||||
import java.awt.Font;
|
||||
import static java.awt.Frame.NORMAL;
|
||||
import java.awt.MenuItem;
|
||||
import java.awt.PopupMenu;
|
||||
import static java.awt.SystemTray.getSystemTray;
|
||||
import static java.awt.Toolkit.getDefaultToolkit;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.WindowEvent;
|
||||
import static java.awt.event.WindowEvent.WINDOW_CLOSING;
|
||||
import java.io.File;
|
||||
@ -53,11 +52,14 @@ import static java.util.concurrent.Executors.newCachedThreadPool;
|
||||
import java.util.logging.Level;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
|
||||
import static javax.swing.JOptionPane.WARNING_MESSAGE;
|
||||
import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
|
||||
import static javax.swing.JOptionPane.showOptionDialog;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIDefaults;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
@ -67,14 +69,14 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "7.77";
|
||||
public static final String VERSION = "7.78";
|
||||
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 DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||
public static final int STREAMER_PORT = 1337;
|
||||
public static final int WATCHDOG_PORT = 1338;
|
||||
public static final int DEFAULT_MEGA_PROXY_PORT = 9999;
|
||||
public static final int RUN_COMMAND_TIME = 600;
|
||||
public static final int RUN_COMMAND_TIME = 120;
|
||||
public static final String DEFAULT_LANGUAGE = "EN";
|
||||
public static final boolean DEFAULT_SMART_PROXY = false;
|
||||
public static final double FORCE_GARBAGE_COLLECTION_MAX_MEMORY_PERCENT = 0.7;
|
||||
@ -98,7 +100,7 @@ public final class MainPanel {
|
||||
private static String _new_version;
|
||||
private static Boolean _resume_uploads;
|
||||
private static Boolean _resume_downloads;
|
||||
private static long _last_run_command;
|
||||
public static volatile long LAST_TIMESTAMP_EXTERNAL_COMMAND;
|
||||
private static final Logger LOG = Logger.getLogger(MainPanel.class.getName());
|
||||
private static volatile boolean CHECK_RUNNING = true;
|
||||
|
||||
@ -225,7 +227,7 @@ public final class MainPanel {
|
||||
|
||||
_exit = false;
|
||||
|
||||
_last_run_command = -1;
|
||||
LAST_TIMESTAMP_EXTERNAL_COMMAND = -1;
|
||||
|
||||
_restart = false;
|
||||
|
||||
@ -812,7 +814,7 @@ public final class MainPanel {
|
||||
_run_command_path = DBTools.selectSettingValue("run_command_path");
|
||||
|
||||
if (_run_command && old_run_command_path != null && !old_run_command_path.equals(_run_command_path)) {
|
||||
_last_run_command = -1;
|
||||
LAST_TIMESTAMP_EXTERNAL_COMMAND = -1;
|
||||
}
|
||||
|
||||
String use_megacrypter_reverse = selectSettingValue("megacrypter_reverse");
|
||||
@ -866,7 +868,7 @@ public final class MainPanel {
|
||||
|
||||
public static synchronized void run_external_command() {
|
||||
|
||||
if (_run_command && (_last_run_command == -1 || _last_run_command + RUN_COMMAND_TIME * 1000 < System.currentTimeMillis())) {
|
||||
if (_run_command && (LAST_TIMESTAMP_EXTERNAL_COMMAND == -1 || LAST_TIMESTAMP_EXTERNAL_COMMAND + RUN_COMMAND_TIME * 1000 < System.currentTimeMillis())) {
|
||||
|
||||
if (_run_command_path != null && !_run_command_path.equals("")) {
|
||||
try {
|
||||
@ -875,7 +877,7 @@ public final class MainPanel {
|
||||
Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, ex.getMessage());
|
||||
}
|
||||
|
||||
_last_run_command = System.currentTimeMillis();
|
||||
LAST_TIMESTAMP_EXTERNAL_COMMAND = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1355,16 +1357,16 @@ public final class MainPanel {
|
||||
|
||||
if (java.awt.SystemTray.isSupported()) {
|
||||
|
||||
PopupMenu menu = new PopupMenu();
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
|
||||
Font new_font = GUI_FONT;
|
||||
|
||||
menu.setFont(new_font.deriveFont(Font.BOLD, Math.round(14 * ZOOM_FACTOR)));
|
||||
|
||||
MenuItem messageItem = new MenuItem(LabelTranslatorSingleton.getInstance().translate("Restore window"));
|
||||
JMenuItem messageItem = new JMenuItem(LabelTranslatorSingleton.getInstance().translate("Restore window"));
|
||||
|
||||
messageItem.addActionListener((ActionEvent e) -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
|
||||
getView().setExtendedState(NORMAL);
|
||||
|
||||
getView().setVisible(true);
|
||||
@ -1372,12 +1374,12 @@ public final class MainPanel {
|
||||
getView().revalidate();
|
||||
|
||||
getView().repaint();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
menu.add(messageItem);
|
||||
|
||||
MenuItem closeItem = new MenuItem(LabelTranslatorSingleton.getInstance().translate("EXIT"));
|
||||
JMenuItem closeItem = new JMenuItem(LabelTranslatorSingleton.getInstance().translate("EXIT"));
|
||||
|
||||
closeItem.addActionListener((ActionEvent e) -> {
|
||||
if (!getView().isVisible()) {
|
||||
@ -1394,8 +1396,20 @@ public final class MainPanel {
|
||||
|
||||
menu.add(closeItem);
|
||||
|
||||
ActionListener actionListener = (ActionEvent e) -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
_trayicon = new TrayIcon(getDefaultToolkit().getImage(getClass().getResource(ICON_FILE)), "MegaBasterd", null);
|
||||
|
||||
_trayicon.setToolTip("MegaBasterd " + VERSION);
|
||||
|
||||
_trayicon.setImageAutoSize(true);
|
||||
|
||||
_trayicon.addMouseListener(new MouseAdapter() {
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
|
||||
if (SwingUtilities.isRightMouseButton(e)) {
|
||||
menu.setLocation(e.getX(), e.getY());
|
||||
menu.setInvoker(menu);
|
||||
menu.setVisible(true);
|
||||
} else {
|
||||
if (!getView().isVisible()) {
|
||||
getView().setExtendedState(NORMAL);
|
||||
getView().setVisible(true);
|
||||
@ -1406,16 +1420,10 @@ public final class MainPanel {
|
||||
|
||||
getView().dispatchEvent(new WindowEvent(getView(), WINDOW_CLOSING));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_trayicon = new TrayIcon(getDefaultToolkit().getImage(getClass().getResource(ICON_FILE)), "MegaBasterd", menu);
|
||||
|
||||
_trayicon.setToolTip("MegaBasterd " + VERSION);
|
||||
|
||||
_trayicon.setImageAutoSize(true);
|
||||
|
||||
_trayicon.addActionListener(actionListener);
|
||||
|
||||
getSystemTray().add(_trayicon);
|
||||
|
||||
|
@ -435,6 +435,8 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
initComponents();
|
||||
|
||||
unfreeze_transferences_button.setBackground(Color.WHITE);
|
||||
|
||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
@ -18,14 +18,14 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
public interface Transference {
|
||||
|
||||
int MIN_WORKERS = 1;
|
||||
int MAX_WORKERS = 20;
|
||||
int MAX_WORKERS = 30;
|
||||
int HTTP_PROXY_CONNECT_TIMEOUT = 20000;
|
||||
int HTTP_PROXY_READ_TIMEOUT = 20000;
|
||||
int HTTP_CONNECT_TIMEOUT = 60000;
|
||||
int HTTP_READ_TIMEOUT = 60000;
|
||||
int MAX_SIM_TRANSFERENCES = 50;
|
||||
int SIM_TRANSFERENCES_DEFAULT = 4;
|
||||
int PROGRESS_WATCHDOG_TIMEOUT = 600;
|
||||
int PROGRESS_WATCHDOG_TIMEOUT = 300;
|
||||
boolean LIMIT_TRANSFERENCE_SPEED_DEFAULT = false;
|
||||
int MAX_TRANSFERENCE_SPEED_DEFAULT = 5;
|
||||
int MAX_WAIT_WORKERS_SHUTDOWN = 15;
|
||||
|
Loading…
x
Reference in New Issue
Block a user