Compare commits

..

No commits in common. "master" and "v8.16" have entirely different histories.

12 changed files with 140 additions and 213 deletions

View File

@ -14,11 +14,8 @@
<p align="center"><a href="https://youtu.be/5TkBXT7osQI"><b>MegaBasterd DEMO</b></a></p>
<p align="center"><img src="https://raw.githubusercontent.com/tonikelope/megabasterd/master/coffee.png"><br><img src="https://raw.githubusercontent.com/tonikelope/megabasterd/master/src/main/resources/images/ethereum_toni.png"></p>
<p align="center"><img src="https://raw.githubusercontent.com/tonikelope/megabasterd/master/src/main/resources/images/ethereum_toni.png"></p>
<p align="center"><a href="https://github.com/tonikelope/megabasterd/issues/385#issuecomment-1019215670">BONUS: Why the f*ck has MegaBasterd stopped downloading?</a></p>
<p align="center"><b>IMPORTANT:</b> You are not authorized to use MegaBasterd in any way that violates <a href="https://mega.io/es/terms"><b>MEGA's terms of use</b></a>.</p>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId>
<version>8.22</version>
<version>8.16</version>
<packaging>jar</packaging>
<repositories>
<repository>

View File

@ -19,7 +19,6 @@ import java.nio.file.Paths;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.crypto.CipherInputStream;
@ -33,8 +32,6 @@ public class ChunkWriterManager implements Runnable, SecureSingleThreadNotifiabl
private static final Logger LOG = Logger.getLogger(ChunkWriterManager.class.getName());
private static final ReentrantLock JOIN_CHUNKS_LOCK = new ReentrantLock();
public static long calculateChunkOffset(long chunk_id, int size_multi) {
long[] offs = {0, 128, 384, 768, 1280, 1920, 2688};
@ -182,89 +179,71 @@ public class ChunkWriterManager implements Runnable, SecureSingleThreadNotifiabl
LOG.log(Level.INFO, "{0} ChunkWriterManager LAST CHUNK WRITTEN -> [{1}] {2} {3}...", new Object[]{Thread.currentThread().getName(), _last_chunk_id_written, _bytes_written, _download.getFile_name()});
boolean download_finished = false;
if (_file_size > 0) {
while (!_exit && (!_download.isStopped() || !_download.getChunkworkers().isEmpty()) && _bytes_written < _file_size) {
try {
if (!download_finished && _download.getProgress() == _file_size) {
while (!_exit && (!_download.isStopped() || !_download.getChunkworkers().isEmpty()) && _bytes_written < _file_size) {
finishDownload();
download_finished = true;
}
if (!JOIN_CHUNKS_LOCK.isHeldByCurrentThread()) {
LOG.log(Level.INFO, "{0} ChunkWriterManager: JOIN LOCK LOCKED FOR {1}", new Object[]{Thread.currentThread().getName(), _download.getFile_name()});
JOIN_CHUNKS_LOCK.lock();
}
boolean chunk_io_error;
if (!download_finished && _download.getProgress() == _file_size) {
do {
finishDownload();
download_finished = true;
}
chunk_io_error = false;
boolean chunk_io_error;
try {
do {
File chunk_file = new File(getChunks_dir() + "/" + MiscTools.HashString("sha1", _download.getUrl()) + ".chunk" + String.valueOf(_last_chunk_id_written + 1));
chunk_io_error = false;
while (chunk_file.exists() && chunk_file.canRead() && chunk_file.canWrite() && chunk_file.length() > 0) {
try {
if (!download_finished && _download.getProgress() == _file_size) {
File chunk_file = new File(getChunks_dir() + "/" + MiscTools.HashString("sha1", _download.getUrl()) + ".chunk" + String.valueOf(_last_chunk_id_written + 1));
while (chunk_file.exists() && chunk_file.canRead() && chunk_file.canWrite() && chunk_file.length() > 0) {
if (!download_finished && _download.getProgress() == _file_size) {
finishDownload();
download_finished = true;
}
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
int reads;
try (CipherInputStream cis = new CipherInputStream(new BufferedInputStream(new FileInputStream(chunk_file)), genDecrypter("AES", "AES/CTR/NoPadding", _byte_file_key, forwardMEGALinkKeyIV(_byte_iv, _bytes_written)))) {
while ((reads = cis.read(buffer)) != -1) {
_download.getOutput_stream().write(buffer, 0, reads);
}
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException ex) {
LOG.log(Level.SEVERE, ex.getMessage());
}
_bytes_written += chunk_file.length();
_last_chunk_id_written++;
LOG.log(Level.INFO, "{0} ChunkWriterManager has written to disk chunk [{1}] {2} {3} {4}...", new Object[]{Thread.currentThread().getName(), _last_chunk_id_written, _bytes_written, _download.calculateLastWrittenChunk(_bytes_written), _download.getFile_name()});
chunk_file.delete();
chunk_file = new File(getChunks_dir() + "/" + MiscTools.HashString("sha1", _download.getUrl()) + ".chunk" + String.valueOf(_last_chunk_id_written + 1));
finishDownload();
download_finished = true;
}
} catch (IOException ex) {
chunk_io_error = true;
LOG.log(Level.WARNING, ex.getMessage());
MiscTools.pausar(1000);
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
int reads;
try (CipherInputStream cis = new CipherInputStream(new BufferedInputStream(new FileInputStream(chunk_file)), genDecrypter("AES", "AES/CTR/NoPadding", _byte_file_key, forwardMEGALinkKeyIV(_byte_iv, _bytes_written)))) {
while ((reads = cis.read(buffer)) != -1) {
_download.getOutput_stream().write(buffer, 0, reads);
}
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException ex) {
LOG.log(Level.SEVERE, ex.getMessage());
}
_bytes_written += chunk_file.length();
_last_chunk_id_written++;
LOG.log(Level.INFO, "{0} ChunkWriterManager has written to disk chunk [{1}] {2} {3} {4}...", new Object[]{Thread.currentThread().getName(), _last_chunk_id_written, _bytes_written, _download.calculateLastWrittenChunk(_bytes_written), _download.getFile_name()});
chunk_file.delete();
chunk_file = new File(getChunks_dir() + "/" + MiscTools.HashString("sha1", _download.getUrl()) + ".chunk" + String.valueOf(_last_chunk_id_written + 1));
}
} while (chunk_io_error);
if (!_exit && (!_download.isStopped() || !_download.getChunkworkers().isEmpty()) && _bytes_written < _file_size) {
LOG.log(Level.INFO, "{0} ChunkWriterManager waiting for chunk [{1}] {2}...", new Object[]{Thread.currentThread().getName(), _last_chunk_id_written + 1, _download.getFile_name()});
if (JOIN_CHUNKS_LOCK.isHeldByCurrentThread() && JOIN_CHUNKS_LOCK.isLocked()) {
LOG.log(Level.INFO, "{0} ChunkWriterManager: JOIN LOCK RELEASED FOR {1}", new Object[]{Thread.currentThread().getName(), _download.getFile_name()});
JOIN_CHUNKS_LOCK.unlock();
}
secureWait();
} catch (IOException ex) {
chunk_io_error = true;
LOG.log(Level.WARNING, ex.getMessage());
MiscTools.pausar(1000);
}
} while (chunk_io_error);
if (!_exit && (!_download.isStopped() || !_download.getChunkworkers().isEmpty()) && _bytes_written < _file_size) {
LOG.log(Level.INFO, "{0} ChunkWriterManager waiting for chunk [{1}] {2}...", new Object[]{Thread.currentThread().getName(), _last_chunk_id_written + 1, _download.getFile_name()});
secureWait();
}
} finally {
if (JOIN_CHUNKS_LOCK.isHeldByCurrentThread() && JOIN_CHUNKS_LOCK.isLocked()) {
LOG.log(Level.INFO, "{0} ChunkWriterManager: JOIN LOCK RELEASED FOR {1}", new Object[]{Thread.currentThread().getName(), _download.getFile_name()});
JOIN_CHUNKS_LOCK.unlock();
}
}
if (_bytes_written == _file_size && MiscTools.isDirEmpty(Paths.get(getChunks_dir()))) {

View File

@ -1534,6 +1534,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
_retrying_request = true;
MiscTools.GUIRun(() -> {
getMain_panel().getView().getNew_download_menu().setEnabled(true);
getView().getStop_button().setVisible(true);

View File

@ -41,6 +41,7 @@ public class FileSplitterDialog extends javax.swing.JDialog {
private final MainPanel _main_panel;
private File[] _files = null;
private File _output_dir = null;
private volatile String _sha1 = null;
private volatile long _progress = 0L;
private volatile Path _current_part = null;
private volatile int _current_file = 0;
@ -85,6 +86,17 @@ public class FileSplitterDialog extends javax.swing.JDialog {
private boolean _splitFile(int i) throws IOException {
_sha1 = "";
THREAD_POOL.execute(() -> {
try {
_sha1 = MiscTools.computeFileSHA1(new File(_files[i].getAbsolutePath()));
} catch (IOException ex) {
Logger.getLogger(FileSplitterDialog.class.getName()).log(Level.SEVERE, null, ex);
}
});
this._progress = 0L;
int mBperSplit = Integer.parseInt(this.split_size_text.getText());
@ -123,6 +135,20 @@ public class FileSplitterDialog extends javax.swing.JDialog {
}
}
while ("".equals(_sha1)) {
MiscTools.GUIRunAndWait(() -> {
split_button.setText(LabelTranslatorSingleton.getInstance().translate("GENERATING SHA1, please wait..."));
});
MiscTools.pausar(1000);
}
if (_sha1 != null) {
Files.writeString(Paths.get(this._files[i].getAbsolutePath() + ".sha1"), _sha1);
}
return true;
}
@ -169,13 +195,9 @@ public class FileSplitterDialog extends javax.swing.JDialog {
monitorProgress(f, byteSize);
if (!_exit) {
long dest_bytes_copied = Files.exists(fileName) ? Files.size(fileName) : 0;
try (RandomAccessFile toFile = new RandomAccessFile(fileName.toFile(), "rw"); FileChannel toChannel = toFile.getChannel()) {
while (dest_bytes_copied < byteSize) {
sourceChannel.position(position + dest_bytes_copied);
dest_bytes_copied += toChannel.transferFrom(sourceChannel, dest_bytes_copied, byteSize - dest_bytes_copied);
}
sourceChannel.position(position);
toChannel.transferFrom(sourceChannel, 0, byteSize);
}
}

View File

@ -61,6 +61,7 @@ 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;
/**
@ -69,7 +70,7 @@ import javax.swing.UIManager;
*/
public final class MainPanel {
public static final String VERSION = "8.22";
public static final String VERSION = "8.16";
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;
@ -106,6 +107,11 @@ public final class MainPanel {
public static void main(String args[]) {
setNimbusLookAndFeel();
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
defaults.put("nimbusOrange", defaults.get("nimbusFocus"));
if (args.length > 0) {
if (args.length > 1) {
@ -130,20 +136,6 @@ public final class MainPanel {
MEGABASTERD_HOME_DIR = f.getParentFile().getAbsolutePath();
}
try {
setupSqliteTables();
} catch (SQLException ex) {
Logger.getLogger(MainPanel.class.getName()).log(SEVERE, null, ex);
}
setNimbusLookAndFeel("yes".equals(DBTools.selectSettingValue("dark_mode")));
if ("yes".equals(DBTools.selectSettingValue("upload_log"))) {
MiscTools.createUploadLogDir();
}
final MainPanel main_panel = new MainPanel();
invokeLater(() -> {
@ -264,6 +256,16 @@ public final class MainPanel {
_resume_downloads = false;
MiscTools.createUploadLogDir();
try {
setupSqliteTables();
} catch (SQLException ex) {
Logger.getLogger(MainPanel.class.getName()).log(SEVERE, null, ex);
}
loadUserSettings();
if (_debug_file) {

View File

@ -276,8 +276,6 @@ public final class MainPanelView extends javax.swing.JFrame {
if (dialog.getUpload_log_checkbox().isSelected()) {
MiscTools.createUploadLogDir();
File upload_log = new File(MiscTools.UPLOAD_LOGS_DIR + "/megabasterd_upload_" + parent_node + ".log");
upload_log.createNewFile();
@ -1028,6 +1026,8 @@ public final class MainPanelView extends javax.swing.JFrame {
private void new_download_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_new_download_menuActionPerformed
new_download_menu.setEnabled(false);
final LinkGrabberDialog dialog = new LinkGrabberDialog(this, true, _main_panel.getDefault_download_path(), _main_panel.getClipboardspy());
_main_panel.getClipboardspy().attachObserver(dialog);
@ -1134,6 +1134,10 @@ public final class MainPanelView extends javax.swing.JFrame {
getMain_panel().getDownload_manager().secureNotify();
MiscTools.GUIRun(() -> {
new_download_menu.setEnabled(true);
});
boolean link_warning;
for (String url : urls) {
@ -1250,6 +1254,10 @@ public final class MainPanelView extends javax.swing.JFrame {
}
} else {
MiscTools.GUIRun(() -> {
new_download_menu.setEnabled(true);
});
}
};
@ -1257,6 +1265,9 @@ public final class MainPanelView extends javax.swing.JFrame {
getMain_panel().getDownload_manager().secureNotify();
} else {
new_download_menu.setEnabled(true);
}
dialog.dispose();

View File

@ -11,7 +11,6 @@ package com.tonikelope.megabasterd;
import static com.tonikelope.megabasterd.MainPanel.THREAD_POOL;
import static com.tonikelope.megabasterd.MainPanel.VERSION;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Desktop;
@ -100,8 +99,6 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
@ -283,41 +280,16 @@ public class MiscTools {
return font;
}
public static void setNimbusLookAndFeel(boolean dark) {
public static void setNimbusLookAndFeel() {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
if (dark) {
// Dark LAF
UIManager.put("control", new Color(128, 128, 128));
UIManager.put("info", new Color(128, 128, 128));
UIManager.put("nimbusBase", new Color(18, 30, 49));
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
UIManager.put("nimbusDisabledText", new Color(100, 100, 100));
UIManager.put("nimbusFocus", new Color(115, 164, 209));
UIManager.put("nimbusGreen", new Color(176, 179, 50));
UIManager.put("nimbusInfoBlue", new Color(66, 139, 221));
UIManager.put("nimbusLightBackground", new Color(18, 30, 49));
UIManager.put("nimbusOrange", new Color(191, 98, 4));
UIManager.put("nimbusRed", new Color(169, 46, 34));
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
UIManager.put("nimbusSelectionBackground", new Color(104, 93, 156));
UIManager.put("text", new Color(230, 230, 230));
} else {
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
defaults.put("nimbusOrange", defaults.get("nimbusFocus"));
}
break;
}
}
} catch (Exception ex) {
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MiscTools.class.getName()).log(java.util.logging.Level.SEVERE, ex.getMessage());
}
}

View File

@ -405,9 +405,6 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="18" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="0" red="33" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="default dir"/>
<Property name="opaque" type="boolean" value="true"/>
</Properties>
@ -1013,9 +1010,6 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Noto Sans" size="18" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="33" red="0" type="rgb"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<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 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."/>
@ -1831,26 +1825,23 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="zoom_label" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="font_label" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="font_combo" max="32767" attributes="0"/>
<Component id="zoom_spinner" min="-2" pref="351" max="-2" attributes="0"/>
</Group>
<Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="zoom_label" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="font_label" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="language_combo" min="-2" pref="351" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="font_combo" max="32767" attributes="0"/>
<Component id="zoom_spinner" min="-2" pref="351" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="dark_mode_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="language_combo" min="-2" pref="351" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -1875,8 +1866,6 @@
<Component id="language_combo" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="dark_mode_checkbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -1941,14 +1930,6 @@
<Property name="doubleBuffered" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="dark_mode_checkbox">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="DARK MODE"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="debug_file_path">

View File

@ -387,17 +387,6 @@ public class SettingsDialog extends javax.swing.JDialog {
proxy_sequential_radio.setSelected(true);
}
boolean dark_mode = false;
String dark_mode_select = DBTools.selectSettingValue("dark_mode");
if (dark_mode_select != null) {
dark_mode = dark_mode_select.equals("yes");
}
dark_mode_checkbox.setSelected(dark_mode);
String max_ul_speed = DBTools.selectSettingValue("max_upload_speed");
int max_upload_speed = Upload.MAX_TRANSFERENCE_SPEED_DEFAULT;
@ -894,7 +883,6 @@ public class SettingsDialog extends javax.swing.JDialog {
font_combo = new javax.swing.JComboBox<>();
zoom_label = new javax.swing.JLabel();
zoom_spinner = new javax.swing.JSpinner();
dark_mode_checkbox = new javax.swing.JCheckBox();
debug_file_path = new javax.swing.JLabel();
status = new javax.swing.JLabel();
@ -1008,7 +996,6 @@ public class SettingsDialog extends javax.swing.JDialog {
default_dir_label.setBackground(new java.awt.Color(153, 255, 153));
default_dir_label.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
default_dir_label.setForeground(new java.awt.Color(51, 0, 255));
default_dir_label.setText("default dir");
default_dir_label.setOpaque(true);
@ -1377,7 +1364,6 @@ public class SettingsDialog extends javax.swing.JDialog {
public_folder_warning.setBackground(new java.awt.Color(255, 255, 51));
public_folder_warning.setColumns(20);
public_folder_warning.setFont(new java.awt.Font("Noto Sans", 1, 18)); // NOI18N
public_folder_warning.setForeground(new java.awt.Color(0, 51, 255));
public_folder_warning.setLineWrap(true);
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 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.");
@ -1903,30 +1889,25 @@ public class SettingsDialog extends javax.swing.JDialog {
zoom_spinner.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
zoom_spinner.setDoubleBuffered(true);
dark_mode_checkbox.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
dark_mode_checkbox.setText("DARK MODE");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(zoom_label)
.addComponent(font_label))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(font_combo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(zoom_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 351, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(language_combo, javax.swing.GroupLayout.PREFERRED_SIZE, 351, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(dark_mode_checkbox))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(zoom_label)
.addComponent(font_label))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(font_combo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(zoom_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 351, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(language_combo, javax.swing.GroupLayout.PREFERRED_SIZE, 351, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
@ -1944,8 +1925,6 @@ public class SettingsDialog extends javax.swing.JDialog {
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(language_combo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(dark_mode_checkbox)
.addContainerGap())
);
@ -2123,16 +2102,11 @@ public class SettingsDialog extends javax.swing.JDialog {
settings.put("force_smart_proxy", force_smart_proxy_checkbox.isSelected() ? "yes" : "no");
settings.put("reset_slot_proxy", proxy_reset_slot_checkbox.isSelected() ? "yes" : "no");
settings.put("random_proxy", proxy_random_radio.isSelected() ? "yes" : "no");
settings.put("dark_mode", dark_mode_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_timeout", String.valueOf(proxy_timeout_spinner.getValue()));
settings.put("smartproxy_autorefresh_time", String.valueOf(auto_refresh_proxy_time_spinner.getValue()));
if (upload_log_checkbox.isSelected()) {
createUploadLogDir();
}
if (custom_proxy_textarea.getText().trim().length() == 0) {
smart_proxy_checkbox.setSelected(false);
}
@ -2195,16 +2169,6 @@ public class SettingsDialog extends javax.swing.JDialog {
String zoom = String.valueOf(zoom_spinner.getValue());
boolean old_dark_mode = false;
String dark_mode_val = DBTools.selectSettingValue("dark_mode");
if (dark_mode_val != null) {
old_dark_mode = (dark_mode_val.equals("yes"));
}
boolean dark_mode = dark_mode_checkbox.isSelected();
boolean old_use_proxy = false;
String use_proxy_val = DBTools.selectSettingValue("use_proxy");
@ -2278,8 +2242,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|| !proxy_host.equals(old_proxy_host)
|| !proxy_port.equals(old_proxy_port)
|| !proxy_user.equals(old_proxy_user)
|| !proxy_pass.equals(old_proxy_pass)
|| dark_mode != old_dark_mode) {
|| !proxy_pass.equals(old_proxy_pass)) {
_main_panel.setRestart(true);
}
@ -3453,7 +3416,6 @@ public class SettingsDialog extends javax.swing.JDialog {
private javax.swing.JLabel custom_chunks_dir_current_label;
private javax.swing.JLabel custom_proxy_list_label;
private javax.swing.JTextArea custom_proxy_textarea;
private javax.swing.JCheckBox dark_mode_checkbox;
private javax.swing.JCheckBox debug_file_checkbox;
private javax.swing.JLabel debug_file_path;
private javax.swing.JLabel default_dir_label;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

After

Width:  |  Height:  |  Size: 205 KiB