Smart Proxy refresh time in settings (default 60 minutes)
Default upload folder name timestamp remove
This commit is contained in:
tonikelope 2023-11-01 18:08:09 +01:00
parent e255bf2d11
commit 52d5ae66c8
8 changed files with 146 additions and 68 deletions

View File

@ -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>8.13</version> <version>8.14</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<repositories> <repositories>
<repository> <repository>

View File

@ -537,7 +537,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
_base_path = files_selected[0].getParentFile().getAbsolutePath(); _base_path = files_selected[0].getParentFile().getAbsolutePath();
dir_name_textfield.setText(files_selected[0].getParentFile().getName() + "_" + String.valueOf(System.currentTimeMillis() / 1000)); dir_name_textfield.setText(files_selected[0].getParentFile().getName());
dir_name_textfield.setEnabled(true); dir_name_textfield.setEnabled(true);
@ -639,7 +639,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
_base_path = filechooser.getSelectedFile().getAbsolutePath(); _base_path = filechooser.getSelectedFile().getAbsolutePath();
dir_name_textfield.setText(filechooser.getSelectedFile().getName() + "_" + String.valueOf(System.currentTimeMillis() / 1000)); dir_name_textfield.setText(filechooser.getSelectedFile().getName());
dir_name_textfield.setEnabled(true); dir_name_textfield.setEnabled(true);
@ -1022,7 +1022,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
_base_path = (files.size() == 1 && files.get(0).isDirectory()) ? files.get(0).getAbsolutePath() : files.get(0).getParentFile().getAbsolutePath(); _base_path = (files.size() == 1 && files.get(0).isDirectory()) ? files.get(0).getAbsolutePath() : files.get(0).getParentFile().getAbsolutePath();
MiscTools.GUIRunAndWait(() -> { MiscTools.GUIRunAndWait(() -> {
dir_name_textfield.setText(((files.size() == 1 && files.get(0).isDirectory()) ? files.get(0).getName() : files.get(0).getParentFile().getName()) + "_" + String.valueOf(System.currentTimeMillis() / 1000)); dir_name_textfield.setText(((files.size() == 1 && files.get(0).isDirectory()) ? files.get(0).getName() : files.get(0).getParentFile().getName()));
dir_name_textfield.setEnabled(true); dir_name_textfield.setEnabled(true);

View File

@ -70,7 +70,7 @@ import javax.swing.UIManager;
*/ */
public final class MainPanel { public final class MainPanel {
public static final String VERSION = "8.13"; public static final String VERSION = "8.14";
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;

View File

@ -252,7 +252,9 @@ public final class MainPanelView extends javax.swing.JFrame {
byte[] share_key = ma.genShareKey(); byte[] share_key = ma.genShareKey();
HashMap<String, Object> res = ma.createDir(dir_name != null ? dir_name : dialog.getFiles().get(0).getName() + "_" + genID(10), ma.getRoot_id(), parent_key, i32a2bin(ma.getMaster_key())); String root_name = dir_name != null ? dir_name : dialog.getFiles().get(0).getName() + "_" + genID(10);
HashMap<String, Object> res = ma.createDir(root_name, ma.getRoot_id(), parent_key, i32a2bin(ma.getMaster_key()));
String parent_node = (String) ((Map) ((List) res.get("f")).get(0)).get("h"); String parent_node = (String) ((Map) ((List) res.get("f")).get(0)).get("h");
@ -291,9 +293,9 @@ public final class MainPanelView extends javax.swing.JFrame {
} }
if (folder_share) { if (folder_share) {
res = ma.createDirInsideAnotherSharedDir("MEGABASTERD", parent_node, ma.genFolderKey(), i32a2bin(ma.getMaster_key()), parent_node, share_key); res = ma.createDirInsideAnotherSharedDir(root_name, parent_node, ma.genFolderKey(), i32a2bin(ma.getMaster_key()), parent_node, share_key);
} else { } else {
res = ma.createDir("MEGABASTERD", parent_node, ma.genFolderKey(), i32a2bin(ma.getMaster_key())); res = ma.createDir(root_name, parent_node, ma.genFolderKey(), i32a2bin(ma.getMaster_key()));
} }
@ -303,7 +305,7 @@ public final class MainPanelView extends javax.swing.JFrame {
MegaDirNode file_paths_2 = new MegaDirNode(file_paths_2_node); MegaDirNode file_paths_2 = new MegaDirNode(file_paths_2_node);
file_paths.getChildren().put("MEGABASTERD", file_paths_2); file_paths.getChildren().put(root_name, file_paths_2);
file_paths = file_paths_2; file_paths = file_paths_2;

View File

@ -486,14 +486,16 @@
<Component id="rec_smart_proxy_label1" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="rec_smart_proxy_label1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="rec_smart_proxy_label" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="rec_smart_proxy_label" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="rec_smart_proxy_label2" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="rec_smart_proxy_label2" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="jLabel5" max="32767" attributes="0"/>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="jLabel3" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel8" alignment="1" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="bad_proxy_time_spinner" max="32767" attributes="0"/> <Component id="bad_proxy_time_spinner" alignment="0" pref="150" max="32767" attributes="0"/>
<Component id="auto_refresh_proxy_time_spinner" alignment="0" max="32767" attributes="0"/>
<Component id="proxy_timeout_spinner" max="32767" attributes="0"/> <Component id="proxy_timeout_spinner" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
@ -526,6 +528,11 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="rec_smart_proxy_label1" min="-2" max="-2" attributes="0"/> <Component id="rec_smart_proxy_label1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="auto_refresh_proxy_time_spinner" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="bad_proxy_time_spinner" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="bad_proxy_time_spinner" alignment="3" min="-2" max="-2" attributes="0"/>
@ -684,6 +691,24 @@
<Property name="text" type="java.lang.String" value="Forces the use of smart proxy even if we still have direct bandwidth available (useful to test proxies)."/> <Property name="text" type="java.lang.String" value="Forces the use of smart proxy even if we still have direct bandwidth available (useful to test proxies)."/>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Noto Sans" size="16" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Proxy list refresh (minutes):"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="auto_refresh_proxy_time_spinner">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Noto Sans" size="16" style="0"/>
</Property>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="60" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
</SubComponents> </SubComponents>
@ -908,7 +933,7 @@
</Property> </Property>
<Property name="lineWrap" type="boolean" value="true"/> <Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="5"/> <Property name="rows" type="int" value="5"/>
<Property name="text" type="java.lang.String" value="THIS OPTION IS NOT RECOMMENDED. Using this will cause MegaBasterd uploaded folder to appear in your account as NOT DECRYPTABLE. &#xa;&#xa;At the time of writing there is a method to FIX IT:&#xa;&#xa;1) Move &quot;MEGABASTERD&quot; FOLDER (first &quot;child&quot; folder of the upload folder) to the ROOT (cloud) folder of your account. &#xa;&#xa;2) Then go to account settings and RELOAD ACCOUNT. &#xa;&#xa;I don&apos;t know how long this method will last. USE THIS OPTION AT YOUR OWN RISK."/> <Property name="text" type="java.lang.String" value="THIS OPTION IS NOT RECOMMENDED. Using this will cause MegaBasterd uploaded folder to appear in your account as NOT DECRYPTABLE. &#xa;&#xa;At the time of writing this text, there is a method to FIX IT:&#xa;&#xa;1) Move first upload subfolder to the ROOT (CLOUD) folder of your account. &#xa;&#xa;2) Go to account settings and click RELOAD ACCOUNT. &#xa;&#xa;I don&apos;t know how long this method will last. USE THIS OPTION AT YOUR OWN RISK."/>
<Property name="wrapStyleWord" type="boolean" value="true"/> <Property name="wrapStyleWord" type="boolean" value="true"/>
</Properties> </Properties>
</Component> </Component>
@ -1265,31 +1290,26 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="run_command_textbox" max="32767" attributes="0"/> <Component id="run_command_textbox" max="32767" attributes="0"/>
</Group> </Group>
<Group type="102" attributes="0"> <Component id="start_frozen_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="start_frozen_checkbox" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="debug_file_checkbox" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/>
<Component id="debug_file_checkbox" min="-2" max="-2" attributes="0"/> <Component id="debug_file_path" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> </Group>
<Component id="debug_file_path" min="-2" max="-2" attributes="0"/> <Group type="102" alignment="0" attributes="0">
</Group> <EmptySpace min="-2" pref="165" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Component id="custom_chunks_dir_current_label" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="165" max="-2" attributes="0"/> </Group>
<Component id="custom_chunks_dir_current_label" min="-2" max="-2" attributes="0"/> <Component id="rec_zoom_label" alignment="0" min="-2" max="-2" attributes="0"/>
</Group> <Component id="run_command_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="rec_zoom_label" alignment="0" min="-2" max="-2" attributes="0"/> <Group type="102" alignment="0" attributes="0">
<Component id="run_command_checkbox" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="custom_chunks_dir_checkbox" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/>
<Component id="custom_chunks_dir_checkbox" min="-2" max="-2" attributes="0"/> <Component id="custom_chunks_dir_button" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> </Group>
<Component id="custom_chunks_dir_button" min="-2" max="-2" attributes="0"/> <Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
</Group> <Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0"> <Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>

View File

@ -12,6 +12,7 @@ package com.tonikelope.megabasterd;
import static com.tonikelope.megabasterd.DBTools.*; import static com.tonikelope.megabasterd.DBTools.*;
import static com.tonikelope.megabasterd.MainPanel.*; import static com.tonikelope.megabasterd.MainPanel.*;
import static com.tonikelope.megabasterd.MiscTools.*; import static com.tonikelope.megabasterd.MiscTools.*;
import static com.tonikelope.megabasterd.SmartMegaProxyManager.PROXY_AUTO_REFRESH_TIME;
import static com.tonikelope.megabasterd.SmartMegaProxyManager.PROXY_BLOCK_TIME; import static com.tonikelope.megabasterd.SmartMegaProxyManager.PROXY_BLOCK_TIME;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Frame; import java.awt.Frame;
@ -324,6 +325,18 @@ public class SettingsDialog extends javax.swing.JDialog {
max_up_speed_spinner.setEnabled(limit_ul_speed); max_up_speed_spinner.setEnabled(limit_ul_speed);
String smartproxy_auto_refresh = DBTools.selectSettingValue("smartproxy_autorefresh_time");
int smartproxy_auto_refresh_int = PROXY_AUTO_REFRESH_TIME;
if (smartproxy_auto_refresh != null) {
smartproxy_auto_refresh_int = Integer.parseInt(smartproxy_auto_refresh);
}
auto_refresh_proxy_time_spinner.setModel(new SpinnerNumberModel(smartproxy_auto_refresh_int, 1, Integer.MAX_VALUE, 1));
((JSpinner.DefaultEditor) auto_refresh_proxy_time_spinner.getEditor()).getTextField().setEditable(true);
String smartproxy_ban_time = DBTools.selectSettingValue("smartproxy_ban_time"); String smartproxy_ban_time = DBTools.selectSettingValue("smartproxy_ban_time");
int smartproxy_ban_time_int = PROXY_BLOCK_TIME; int smartproxy_ban_time_int = PROXY_BLOCK_TIME;
@ -346,7 +359,7 @@ public class SettingsDialog extends javax.swing.JDialog {
proxy_timeout_spinner.setModel(new SpinnerNumberModel(smartproxy_timeout_int, 1, Integer.MAX_VALUE, 1)); proxy_timeout_spinner.setModel(new SpinnerNumberModel(smartproxy_timeout_int, 1, Integer.MAX_VALUE, 1));
((JSpinner.DefaultEditor) bad_proxy_time_spinner.getEditor()).getTextField().setEditable(true); ((JSpinner.DefaultEditor) proxy_timeout_spinner.getEditor()).getTextField().setEditable(true);
String max_ul_speed = DBTools.selectSettingValue("max_upload_speed"); String max_ul_speed = DBTools.selectSettingValue("max_upload_speed");
@ -771,6 +784,8 @@ public class SettingsDialog extends javax.swing.JDialog {
proxy_timeout_spinner = new javax.swing.JSpinner(); proxy_timeout_spinner = new javax.swing.JSpinner();
force_smart_proxy_checkbox = new javax.swing.JCheckBox(); force_smart_proxy_checkbox = new javax.swing.JCheckBox();
jLabel7 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
auto_refresh_proxy_time_spinner = new javax.swing.JSpinner();
uploads_scrollpane = new javax.swing.JScrollPane(); uploads_scrollpane = new javax.swing.JScrollPane();
uploads_panel = new javax.swing.JPanel(); uploads_panel = new javax.swing.JPanel();
default_slots_up_label = new javax.swing.JLabel(); default_slots_up_label = new javax.swing.JLabel();
@ -1035,6 +1050,12 @@ public class SettingsDialog extends javax.swing.JDialog {
jLabel7.setFont(new java.awt.Font("Noto Sans", 2, 16)); // NOI18N jLabel7.setFont(new java.awt.Font("Noto Sans", 2, 16)); // NOI18N
jLabel7.setText("Forces the use of smart proxy even if we still have direct bandwidth available (useful to test proxies)."); jLabel7.setText("Forces the use of smart proxy even if we still have direct bandwidth available (useful to test proxies).");
jLabel8.setFont(new java.awt.Font("Noto Sans", 1, 16)); // NOI18N
jLabel8.setText("Proxy list refresh (minutes):");
auto_refresh_proxy_time_spinner.setFont(new java.awt.Font("Noto Sans", 0, 16)); // NOI18N
auto_refresh_proxy_time_spinner.setModel(new javax.swing.SpinnerNumberModel(60, 1, null, 1));
javax.swing.GroupLayout smart_proxy_settingsLayout = new javax.swing.GroupLayout(smart_proxy_settings); javax.swing.GroupLayout smart_proxy_settingsLayout = new javax.swing.GroupLayout(smart_proxy_settings);
smart_proxy_settings.setLayout(smart_proxy_settingsLayout); smart_proxy_settings.setLayout(smart_proxy_settingsLayout);
smart_proxy_settingsLayout.setHorizontalGroup( smart_proxy_settingsLayout.setHorizontalGroup(
@ -1048,12 +1069,14 @@ public class SettingsDialog extends javax.swing.JDialog {
.addComponent(rec_smart_proxy_label) .addComponent(rec_smart_proxy_label)
.addComponent(rec_smart_proxy_label2) .addComponent(rec_smart_proxy_label2)
.addGroup(smart_proxy_settingsLayout.createSequentialGroup() .addGroup(smart_proxy_settingsLayout.createSequentialGroup()
.addGroup(smart_proxy_settingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(smart_proxy_settingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(smart_proxy_settingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(bad_proxy_time_spinner) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(smart_proxy_settingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(bad_proxy_time_spinner, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
.addComponent(auto_refresh_proxy_time_spinner, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(proxy_timeout_spinner)) .addComponent(proxy_timeout_spinner))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(smart_proxy_settingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(smart_proxy_settingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -1077,6 +1100,10 @@ public class SettingsDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rec_smart_proxy_label1) .addComponent(rec_smart_proxy_label1)
.addGap(18, 18, 18) .addGap(18, 18, 18)
.addGroup(smart_proxy_settingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(auto_refresh_proxy_time_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(smart_proxy_settingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(smart_proxy_settingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3) .addComponent(jLabel3)
.addComponent(bad_proxy_time_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(bad_proxy_time_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@ -1259,7 +1286,7 @@ public class SettingsDialog extends javax.swing.JDialog {
public_folder_warning.setFont(new java.awt.Font("Noto Sans", 1, 18)); // NOI18N public_folder_warning.setFont(new java.awt.Font("Noto Sans", 1, 18)); // NOI18N
public_folder_warning.setLineWrap(true); public_folder_warning.setLineWrap(true);
public_folder_warning.setRows(5); public_folder_warning.setRows(5);
public_folder_warning.setText("THIS OPTION IS NOT RECOMMENDED. Using this will cause MegaBasterd uploaded folder to appear in your account as NOT DECRYPTABLE. \n\nAt the time of writing there is a method to FIX IT:\n\n1) Move \"MEGABASTERD\" FOLDER (first \"child\" folder of the upload folder) to the ROOT (cloud) folder of your account. \n\n2) Then go to account settings and RELOAD ACCOUNT. \n\nI don't know how long this method will last. USE THIS OPTION AT YOUR OWN RISK."); public_folder_warning.setText("THIS OPTION IS NOT RECOMMENDED. Using this will cause MegaBasterd uploaded folder to appear in your account as NOT DECRYPTABLE. \n\nAt the time of writing this text, there is a method to FIX IT:\n\n1) Move first upload subfolder to the ROOT (CLOUD) folder of your account. \n\n2) Go to account settings and click RELOAD ACCOUNT. \n\nI don't know how long this method will last. USE THIS OPTION AT YOUR OWN RISK.");
public_folder_warning.setWrapStyleWord(true); public_folder_warning.setWrapStyleWord(true);
public_folder_panel.setViewportView(public_folder_warning); public_folder_panel.setViewportView(public_folder_warning);
@ -1836,26 +1863,23 @@ public class SettingsDialog extends javax.swing.JDialog {
.addComponent(run_command_test_button) .addComponent(run_command_test_button)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(run_command_textbox)) .addComponent(run_command_textbox))
.addComponent(start_frozen_checkbox)
.addGroup(advanced_panelLayout.createSequentialGroup() .addGroup(advanced_panelLayout.createSequentialGroup()
.addGroup(advanced_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(debug_file_checkbox)
.addComponent(start_frozen_checkbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(advanced_panelLayout.createSequentialGroup() .addComponent(debug_file_path))
.addComponent(debug_file_checkbox) .addGroup(advanced_panelLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGap(165, 165, 165)
.addComponent(debug_file_path)) .addComponent(custom_chunks_dir_current_label))
.addGroup(advanced_panelLayout.createSequentialGroup() .addComponent(rec_zoom_label)
.addGap(165, 165, 165) .addComponent(run_command_checkbox)
.addComponent(custom_chunks_dir_current_label)) .addGroup(advanced_panelLayout.createSequentialGroup()
.addComponent(rec_zoom_label) .addComponent(custom_chunks_dir_checkbox)
.addComponent(run_command_checkbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(advanced_panelLayout.createSequentialGroup() .addComponent(custom_chunks_dir_button))
.addComponent(custom_chunks_dir_checkbox) .addGroup(advanced_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(custom_chunks_dir_button)) .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(advanced_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGap(0, 0, 0)))
.addContainerGap()) .addContainerGap())
); );
advanced_panelLayout.setVerticalGroup( advanced_panelLayout.setVerticalGroup(
@ -1999,6 +2023,7 @@ public class SettingsDialog extends javax.swing.JDialog {
settings.put("upload_public_folder", upload_public_folder_checkbox.isSelected() ? "yes" : "no"); settings.put("upload_public_folder", upload_public_folder_checkbox.isSelected() ? "yes" : "no");
settings.put("smartproxy_ban_time", String.valueOf(bad_proxy_time_spinner.getValue())); settings.put("smartproxy_ban_time", String.valueOf(bad_proxy_time_spinner.getValue()));
settings.put("smartproxy_timeout", String.valueOf(proxy_timeout_spinner.getValue())); settings.put("smartproxy_timeout", String.valueOf(proxy_timeout_spinner.getValue()));
settings.put("smartproxy_autorefresh_time", String.valueOf(auto_refresh_proxy_time_spinner.getValue()));
if (custom_proxy_textarea.getText().trim().length() == 0) { if (custom_proxy_textarea.getText().trim().length() == 0) {
smart_proxy_checkbox.setSelected(false); smart_proxy_checkbox.setSelected(false);
@ -3285,6 +3310,7 @@ public class SettingsDialog extends javax.swing.JDialog {
private javax.swing.JButton add_mega_account_button; private javax.swing.JButton add_mega_account_button;
private javax.swing.JPanel advanced_panel; private javax.swing.JPanel advanced_panel;
private javax.swing.JScrollPane advanced_scrollpane; private javax.swing.JScrollPane advanced_scrollpane;
private javax.swing.JSpinner auto_refresh_proxy_time_spinner;
private javax.swing.JSpinner bad_proxy_time_spinner; private javax.swing.JSpinner bad_proxy_time_spinner;
private javax.swing.JButton cancel_button; private javax.swing.JButton cancel_button;
private javax.swing.JButton change_download_dir_button; private javax.swing.JButton change_download_dir_button;
@ -3323,6 +3349,7 @@ public class SettingsDialog extends javax.swing.JDialog {
private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel2;
private javax.swing.JProgressBar jProgressBar1; private javax.swing.JProgressBar jProgressBar1;

View File

@ -39,6 +39,7 @@ public final class SmartMegaProxyManager {
public static String DEFAULT_SMART_PROXY_URL = null; public static String DEFAULT_SMART_PROXY_URL = null;
public static final int PROXY_BLOCK_TIME = 300; public static final int PROXY_BLOCK_TIME = 300;
public static final int PROXY_AUTO_REFRESH_TIME = 60;
public static final int PROXY_AUTO_REFRESH_SLEEP_TIME = 30; public static final int PROXY_AUTO_REFRESH_SLEEP_TIME = 30;
private static final Logger LOG = Logger.getLogger(SmartMegaProxyManager.class.getName()); private static final Logger LOG = Logger.getLogger(SmartMegaProxyManager.class.getName());
@ -49,6 +50,8 @@ public final class SmartMegaProxyManager {
private volatile int _ban_time; private volatile int _ban_time;
private volatile int _proxy_timeout; private volatile int _proxy_timeout;
private volatile boolean _force_smart_proxy; private volatile boolean _force_smart_proxy;
private volatile int _autorefresh_time;
private volatile long _last_refresh_timestamp;
public int getProxy_timeout() { public int getProxy_timeout() {
return _proxy_timeout; return _proxy_timeout;
@ -67,6 +70,22 @@ public final class SmartMegaProxyManager {
THREAD_POOL.execute(() -> { THREAD_POOL.execute(() -> {
refreshProxyList(); refreshProxyList();
while (true) {
while (System.currentTimeMillis() < _last_refresh_timestamp + _autorefresh_time * 60 * 1000) {
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
Logger.getLogger(SmartMegaProxyManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (MainPanel.isUse_smart_proxy()) {
refreshProxyList();
}
}
}); });
} }
@ -114,7 +133,15 @@ public final class SmartMegaProxyManager {
_force_smart_proxy = MainPanel.FORCE_SMART_PROXY; _force_smart_proxy = MainPanel.FORCE_SMART_PROXY;
} }
LOG.log(Level.INFO, "SmartProxy BAN_TIME: " + String.valueOf(_ban_time) + " TIMEOUT: " + String.valueOf(_proxy_timeout / 1000) + " FORCE: " + String.valueOf(_force_smart_proxy)); String autorefresh_smart_proxy_string = DBTools.selectSettingValue("smartproxy_autorefresh_time");
if (autorefresh_smart_proxy_string != null) {
_autorefresh_time = Integer.parseInt(autorefresh_smart_proxy_string);
} else {
_autorefresh_time = PROXY_AUTO_REFRESH_TIME;
}
LOG.log(Level.INFO, "SmartProxy BAN_TIME: " + String.valueOf(_ban_time) + " TIMEOUT: " + String.valueOf(_proxy_timeout / 1000) + " REFRESH: " + String.valueOf(_autorefresh_time) + " FORCE: " + String.valueOf(_force_smart_proxy));
} }
public synchronized int getProxyCount() { public synchronized int getProxyCount() {
@ -345,6 +372,8 @@ public final class SmartMegaProxyManager {
} }
_last_refresh_timestamp = System.currentTimeMillis();
} }
public static class SmartProxyAuthenticator extends Authenticator { public static class SmartProxyAuthenticator extends Authenticator {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 206 KiB