mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-28 12:30:23 +02:00
2.07
-Premium account download/streaming
This commit is contained in:
parent
dce6b94bb0
commit
b0d591f20e
@ -58,6 +58,7 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
public static final boolean VERIFY_CBC_MAC_DEFAULT = false;
|
||||
public static final boolean USE_SLOTS_DEFAULT = false;
|
||||
public static final int WORKERS_DEFAULT = 4;
|
||||
public static final boolean USE_MEGA_ACCOUNT_DOWN = false;
|
||||
|
||||
private final MainPanel _main_panel;
|
||||
private volatile DownloadView _view = null; //lazy init
|
||||
@ -97,10 +98,12 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
private boolean _status_error;
|
||||
private final ConcurrentLinkedQueue<Long> _rejectedChunkIds;
|
||||
private long _last_chunk_id_dispatched;
|
||||
private final MegaAPI _ma;
|
||||
|
||||
public Download(MainPanel main_panel, String url, String download_path, String file_name, String file_key, Long file_size, String file_pass, String file_noexpire, boolean use_slots, int slots, boolean restart) {
|
||||
public Download(MainPanel main_panel, MegaAPI ma, String url, String download_path, String file_name, String file_key, Long file_size, String file_pass, String file_noexpire, boolean use_slots, int slots, boolean restart) {
|
||||
|
||||
_paused_workers = 0;
|
||||
_ma = ma;
|
||||
_last_chunk_id_dispatched = 0L;
|
||||
_status_error = false;
|
||||
_fatal_error = null;
|
||||
@ -327,10 +330,16 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
_main_panel.getDownload_manager().secureNotify();
|
||||
}
|
||||
|
||||
public MegaAPI getMa() {
|
||||
return _ma;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void restart() {
|
||||
|
||||
Download new_download = new Download(getMain_panel(), getUrl(), getDownload_path(), getFile_name(), getFile_key(), getFile_size(), getFile_pass(), getFile_noexpire(), getMain_panel().isUse_slots_down(), getMain_panel().getDefault_slots_down(), true);
|
||||
Download new_download = new Download(getMain_panel(), getMa(), getUrl(), getDownload_path(), getFile_name(), getFile_key(), getFile_size(), getFile_pass(), getFile_noexpire(), getMain_panel().isUse_slots_down(), getMain_panel().getDefault_slots_down(), true);
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_remove_queue().add(this);
|
||||
|
||||
@ -877,9 +886,8 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
|
||||
try {
|
||||
if (findFirstRegex("://mega(\\.co)?\\.nz/", _url, 0) != null) {
|
||||
MegaAPI ma = new MegaAPI();
|
||||
|
||||
download_url = ma.getMegaFileDownloadUrl(_url);
|
||||
download_url = _ma.getMegaFileDownloadUrl(_url);
|
||||
|
||||
} else {
|
||||
download_url = MegaCrypterAPI.getMegaFileDownloadUrl(_url, _file_pass, _file_noexpire);
|
||||
@ -1182,9 +1190,7 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
|
||||
if (findFirstRegex("://mega(\\.co)?\\.nz/", link, 0) != null) {
|
||||
|
||||
MegaAPI ma = new MegaAPI();
|
||||
|
||||
file_info = ma.getMegaFileMetadata(link);
|
||||
file_info = _ma.getMegaFileMetadata(link);
|
||||
|
||||
} else {
|
||||
file_info = MegaCrypterAPI.getMegaFileMetadata(link, panel);
|
||||
@ -1286,9 +1292,8 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
|
||||
try {
|
||||
if (findFirstRegex("://mega(\\.co)?\\.nz/", _url, 0) != null) {
|
||||
MegaAPI ma = new MegaAPI();
|
||||
|
||||
dl_url = ma.getMegaFileDownloadUrl(link);
|
||||
|
||||
dl_url = _ma.getMegaFileDownloadUrl(link);
|
||||
|
||||
} else {
|
||||
dl_url = MegaCrypterAPI.getMegaFileDownloadUrl(link, _file_pass, _file_noexpire);
|
||||
|
@ -25,7 +25,7 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="links_scrollpane" max="32767" attributes="0"/>
|
||||
@ -43,6 +43,11 @@
|
||||
<EmptySpace pref="59" max="32767" attributes="0"/>
|
||||
<Component id="dlc_button" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="use_mega_account_down_label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="use_mega_account_down_combobox" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@ -57,7 +62,12 @@
|
||||
<Component id="dlc_button" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="links_scrollpane" pref="245" max="32767" attributes="0"/>
|
||||
<Component id="links_scrollpane" pref="343" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="use_mega_account_down_label" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="use_mega_account_down_combobox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="change_dir_button" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@ -159,5 +169,29 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="dlc_buttonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="use_mega_account_down_label">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="16" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Use this account for download (only MEGA/ELC):"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="use_mega_account_down_combobox">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="16" style="1"/>
|
||||
</Property>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="use_mega_account_down_comboboxItemStateChanged"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -1,23 +1,32 @@
|
||||
package megabasterd;
|
||||
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Font;
|
||||
import java.awt.Frame;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import static megabasterd.MainPanel.FONT_DEFAULT;
|
||||
import static megabasterd.MainPanel.THREAD_POOL;
|
||||
import static megabasterd.MiscTools.BASE642Bin;
|
||||
import static megabasterd.MiscTools.Bin2BASE64;
|
||||
import static megabasterd.MiscTools.bin2i32a;
|
||||
import static megabasterd.MiscTools.extractMegaLinksFromString;
|
||||
import static megabasterd.MiscTools.extractStringFromClipboardContents;
|
||||
import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
import static megabasterd.MiscTools.swingReflectionInvokeAndWait;
|
||||
import static megabasterd.MiscTools.truncateText;
|
||||
import static megabasterd.MiscTools.updateFont;
|
||||
|
||||
@ -26,6 +35,22 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
||||
private boolean _download;
|
||||
private String _download_path;
|
||||
private final ClipboardSpy _clipboardspy;
|
||||
private final MainPanel _main_panel;
|
||||
private volatile String _last_selected_account;
|
||||
private boolean _remember_master_pass;
|
||||
|
||||
public boolean isRemember_master_pass() {
|
||||
return _remember_master_pass;
|
||||
}
|
||||
|
||||
public JComboBox<String> getUse_mega_account_down_combobox() {
|
||||
return use_mega_account_down_combobox;
|
||||
}
|
||||
|
||||
public JButton getDance_button() {
|
||||
return dance_button;
|
||||
}
|
||||
|
||||
|
||||
public boolean isDownload() {
|
||||
return _download;
|
||||
@ -57,14 +82,36 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
||||
updateFont(download_dir_label, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(dlc_button, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(links_textarea, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(use_mega_account_down_label, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(use_mega_account_down_combobox, FONT_DEFAULT, Font.PLAIN);
|
||||
}
|
||||
}, true);
|
||||
|
||||
_download_path = download_path;
|
||||
|
||||
_clipboardspy = clipboardspy;
|
||||
|
||||
_last_selected_account = null;
|
||||
|
||||
_remember_master_pass = true;
|
||||
|
||||
swingReflectionInvoke("setText", download_dir_label, truncateText(download_path, 80));
|
||||
|
||||
_main_panel = ((MainPanelView) parent).getMain_panel();
|
||||
|
||||
if(_main_panel.isUse_mega_account_down() && _main_panel.getMega_accounts().size() > 0) {
|
||||
|
||||
for (Object o : _main_panel.getMega_accounts().keySet()) {
|
||||
|
||||
swingReflectionInvoke("addItem", use_mega_account_down_combobox, o);
|
||||
}
|
||||
} else {
|
||||
swingReflectionInvoke("setEnabled", use_mega_account_down_combobox, false);
|
||||
swingReflectionInvoke("setEnabled", use_mega_account_down_label, false);
|
||||
swingReflectionInvoke("setVisible", use_mega_account_down_combobox, false);
|
||||
swingReflectionInvoke("setVisible", use_mega_account_down_label, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,6 +131,8 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
||||
down_dir_to_label = new javax.swing.JLabel();
|
||||
download_dir_label = new javax.swing.JLabel();
|
||||
dlc_button = new javax.swing.JButton();
|
||||
use_mega_account_down_label = new javax.swing.JLabel();
|
||||
use_mega_account_down_combobox = new javax.swing.JComboBox<>();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("LinkGrabber");
|
||||
@ -134,6 +183,16 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
||||
}
|
||||
});
|
||||
|
||||
use_mega_account_down_label.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
|
||||
use_mega_account_down_label.setText("Use this account for download (only MEGA/ELC):");
|
||||
|
||||
use_mega_account_down_combobox.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
|
||||
use_mega_account_down_combobox.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
use_mega_account_down_comboboxItemStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@ -153,7 +212,11 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(links_label, javax.swing.GroupLayout.PREFERRED_SIZE, 662, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
|
||||
.addComponent(dlc_button)))
|
||||
.addComponent(dlc_button))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(use_mega_account_down_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(use_mega_account_down_combobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
@ -164,7 +227,11 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
||||
.addComponent(links_label)
|
||||
.addComponent(dlc_button))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(links_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
|
||||
.addComponent(links_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(use_mega_account_down_label)
|
||||
.addComponent(use_mega_account_down_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(change_dir_button)
|
||||
@ -302,6 +369,105 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
||||
}
|
||||
}//GEN-LAST:event_dlc_buttonActionPerformed
|
||||
|
||||
private void use_mega_account_down_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_use_mega_account_down_comboboxItemStateChanged
|
||||
String selected_item = (String) use_mega_account_down_combobox.getSelectedItem();
|
||||
|
||||
if (_main_panel.isUse_mega_account_down() && selected_item != null && !selected_item.equals(_last_selected_account)) {
|
||||
|
||||
use_mega_account_down_combobox.setEnabled(false);
|
||||
|
||||
dance_button.setEnabled(false);
|
||||
|
||||
_last_selected_account = selected_item;
|
||||
|
||||
final String email = selected_item;
|
||||
|
||||
final Dialog tthis = this;
|
||||
|
||||
THREAD_POOL.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
HashMap<String, Object> account_info = (HashMap) _main_panel.getMega_accounts().get(email);
|
||||
|
||||
MegaAPI ma = _main_panel.getMega_active_accounts().get(use_mega_account_down_combobox.getSelectedItem());
|
||||
|
||||
if (ma == null) {
|
||||
|
||||
ma = new MegaAPI();
|
||||
|
||||
String password_aes, user_hash;
|
||||
|
||||
try {
|
||||
|
||||
if (_main_panel.getMaster_pass_hash() != null) {
|
||||
|
||||
if (_main_panel.getMaster_pass() == null) {
|
||||
|
||||
GetMasterPasswordDialog dialog = new GetMasterPasswordDialog((Frame) getParent(), true, _main_panel.getMaster_pass_hash(), _main_panel.getMaster_pass_salt());
|
||||
|
||||
swingReflectionInvokeAndWait("setLocationRelativeTo", dialog, tthis);
|
||||
|
||||
swingReflectionInvokeAndWait("setVisible", dialog, true);
|
||||
|
||||
if (dialog.isPass_ok()) {
|
||||
|
||||
_main_panel.setMaster_pass(dialog.getPass());
|
||||
|
||||
dialog.deletePass();
|
||||
|
||||
_remember_master_pass = dialog.getRemember_checkbox().isSelected();
|
||||
|
||||
dialog.dispose();
|
||||
|
||||
password_aes = Bin2BASE64(CryptTools.aes_cbc_decrypt_pkcs7(BASE642Bin((String) account_info.get("password_aes")), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
user_hash = Bin2BASE64(CryptTools.aes_cbc_decrypt_pkcs7(BASE642Bin((String) account_info.get("user_hash")), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
} else {
|
||||
|
||||
dialog.dispose();
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
password_aes = Bin2BASE64(CryptTools.aes_cbc_decrypt_pkcs7(BASE642Bin((String) account_info.get("password_aes")), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
user_hash = Bin2BASE64(CryptTools.aes_cbc_decrypt_pkcs7(BASE642Bin((String) account_info.get("user_hash")), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
password_aes = (String) account_info.get("password_aes");
|
||||
|
||||
user_hash = (String) account_info.get("user_hash");
|
||||
}
|
||||
|
||||
ma.fastLogin(email, bin2i32a(BASE642Bin(password_aes)), user_hash);
|
||||
|
||||
_main_panel.getMega_active_accounts().put(email, ma);
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
//getLogger(FileGrabberDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
_last_selected_account = null;
|
||||
|
||||
swingReflectionInvoke("setSelectedIndex", ((LinkGrabberDialog)tthis).getUse_mega_account_down_combobox(), -1);
|
||||
}
|
||||
}
|
||||
|
||||
swingReflectionInvokeAndWait("setEnabled",((LinkGrabberDialog)tthis).getUse_mega_account_down_combobox(), true);
|
||||
|
||||
swingReflectionInvokeAndWait("setEnabled",((LinkGrabberDialog)tthis).getDance_button(), true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}//GEN-LAST:event_use_mega_account_down_comboboxItemStateChanged
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton change_dir_button;
|
||||
private javax.swing.JButton dance_button;
|
||||
@ -311,6 +477,8 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
||||
private javax.swing.JLabel links_label;
|
||||
private javax.swing.JScrollPane links_scrollpane;
|
||||
private javax.swing.JTextArea links_textarea;
|
||||
private javax.swing.JComboBox<String> use_mega_account_down_combobox;
|
||||
private javax.swing.JLabel use_mega_account_down_label;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@Override
|
||||
|
@ -61,7 +61,7 @@ import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "2.06";
|
||||
public static final String VERSION = "2.07";
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int STREAMER_PORT = 1337;
|
||||
public static final int WATCHDOG_PORT = 1338;
|
||||
@ -102,7 +102,8 @@ public final class MainPanel {
|
||||
private final UploadManager _upload_manager;
|
||||
private final StreamThrottlerSupervisor _stream_supervisor;
|
||||
private int _max_dl, _max_ul, _default_slots_down, _default_slots_up, _max_dl_speed, _max_up_speed;
|
||||
private boolean _use_slots_down, _use_slots_up, _limit_download_speed, _limit_upload_speed;
|
||||
private boolean _use_slots_down, _use_slots_up, _limit_download_speed, _limit_upload_speed, _use_mega_account_down;
|
||||
private String _mega_account_down;
|
||||
private String _default_download_path;
|
||||
private HashMap<String, Object> _mega_accounts;
|
||||
private HashMap<String, Object> _elc_accounts;
|
||||
@ -203,6 +204,14 @@ public final class MainPanel {
|
||||
|
||||
}
|
||||
|
||||
public boolean isUse_mega_account_down() {
|
||||
return _use_mega_account_down;
|
||||
}
|
||||
|
||||
public String getMega_account_down() {
|
||||
return _mega_account_down;
|
||||
}
|
||||
|
||||
public boolean isRestart() {
|
||||
return _restart;
|
||||
}
|
||||
@ -472,6 +481,12 @@ public final class MainPanel {
|
||||
} catch (SQLException ex) {
|
||||
getLogger(MainPanel.class.getName()).log(SEVERE, null, ex);
|
||||
}
|
||||
|
||||
_mega_account_down = DBTools.selectSettingValueFromDB("mega_account_down");
|
||||
|
||||
String use_account;
|
||||
|
||||
_use_mega_account_down = ((use_account=DBTools.selectSettingValueFromDB("use_mega_account_down"))!=null && use_account.equals("yes"));
|
||||
|
||||
_master_pass_hash = DBTools.selectSettingValueFromDB("master_pass_hash");
|
||||
|
||||
@ -643,7 +658,7 @@ public final class MainPanel {
|
||||
|
||||
for (HashMap<String, Object> o : res) {
|
||||
|
||||
Download download = new Download(tthis, (String) o.get("url"), (String) o.get("path"), (String) o.get("filename"), (String) o.get("filekey"), (Long) o.get("filesize"), (String) o.get("filepass"), (String) o.get("filenoexpire"), _use_slots_down, _default_slots_down, false);
|
||||
Download download = new Download(tthis, new MegaAPI(), (String) o.get("url"), (String) o.get("path"), (String) o.get("filename"), (String) o.get("filekey"), (Long) o.get("filesize"), (String) o.get("filepass"), (String) o.get("filenoexpire"), _use_slots_down, _default_slots_down, false);
|
||||
|
||||
getDownload_manager().getTransference_provision_queue().add(download);
|
||||
|
||||
|
@ -511,7 +511,27 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
_main_panel.getClipboardspy().detachObserver(dialog);
|
||||
|
||||
final String dl_path = dialog.getDownload_path();
|
||||
|
||||
final MegaAPI ma;
|
||||
|
||||
if(getMain_panel().isUse_mega_account_down())
|
||||
{
|
||||
final String mega_account = (String) dialog.getUse_mega_account_down_combobox().getSelectedItem();
|
||||
|
||||
if(mega_account == null) {
|
||||
|
||||
ma = new MegaAPI();
|
||||
|
||||
} else {
|
||||
|
||||
ma = getMain_panel().getMega_active_accounts().get(mega_account);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
ma = new MegaAPI();
|
||||
}
|
||||
|
||||
jTabbedPane1.setSelectedIndex(0);
|
||||
|
||||
if (dialog.isDownload()) {
|
||||
@ -594,7 +614,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
for (HashMap folder_link : folder_links) {
|
||||
|
||||
download = new Download(getMain_panel(), (String) folder_link.get("url"), dl_path, (String) folder_link.get("filename"), (String) folder_link.get("filekey"), (long) folder_link.get("filesize"), null, null, getMain_panel().isUse_slots_down(), getMain_panel().getDefault_slots_down(), true);
|
||||
download = new Download(getMain_panel(), ma, (String) folder_link.get("url"), dl_path, (String) folder_link.get("filename"), (String) folder_link.get("filekey"), (long) folder_link.get("filesize"), null, null, getMain_panel().isUse_slots_down(), getMain_panel().getDefault_slots_down(), true);
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_provision_queue().add(download);
|
||||
}
|
||||
@ -606,7 +626,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
} else {
|
||||
|
||||
download = new Download(getMain_panel(), url, dl_path, null, null, null, null, null, getMain_panel().isUse_slots_down(), getMain_panel().getDefault_slots_down(), false);
|
||||
download = new Download(getMain_panel(), ma, url, dl_path, null, null, null, null, null, getMain_panel().isUse_slots_down(), getMain_panel().getDefault_slots_down(), false);
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_provision_queue().add(download);
|
||||
}
|
||||
@ -632,6 +652,11 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
new_download_menu.setEnabled(true);
|
||||
}
|
||||
|
||||
if (!dialog.isRemember_master_pass()) {
|
||||
|
||||
_main_panel.setMaster_pass(null);
|
||||
}
|
||||
|
||||
dialog.dispose();
|
||||
|
||||
|
@ -376,12 +376,12 @@ public final class MegaAPI {
|
||||
|
||||
request = "[{\"a\":\"g\", \"g\":\"1\", \"n\":\"" + file_id + "\"}]";
|
||||
|
||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : "") + "&n=" + folder_id);
|
||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&sid=" + _sid + (API_KEY != null ? "&ak=" + API_KEY : "") + "&n=" + folder_id);
|
||||
|
||||
} else {
|
||||
|
||||
request = "[{\"a\":\"g\", \"g\":\"1\", \"p\":\"" + file_id + "\"}]";
|
||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&sid=" + _sid + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||
}
|
||||
|
||||
String data = _rawRequest(request, url_api);
|
||||
@ -408,13 +408,13 @@ public final class MegaAPI {
|
||||
|
||||
request = "[{\"a\":\"g\", \"g\":\"1\", \"n\":\"" + file_id + "\"}]";
|
||||
|
||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : "") + "&n=" + folder_id);
|
||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&sid=" + _sid + (API_KEY != null ? "&ak=" + API_KEY : "") + "&n=" + folder_id);
|
||||
|
||||
} else {
|
||||
|
||||
request = "[{\"a\":\"g\", \"p\":\"" + file_id + "\"}]";
|
||||
|
||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||
url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&sid=" + _sid + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||
}
|
||||
|
||||
String data = _rawRequest(request, url_api);
|
||||
|
@ -104,10 +104,10 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="jSeparator3" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jSeparator3" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="jSeparator1" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="change_download_dir_button" min="-2" max="-2" attributes="0"/>
|
||||
@ -116,9 +116,9 @@
|
||||
</Group>
|
||||
<Component id="jSeparator2" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="jSeparator4" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jSeparator7" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="verify_file_down_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="down_dir_label" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="multi_slot_down_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="rec_download_slots_label" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
@ -145,8 +145,15 @@
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="use_mega_account_down_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="verify_file_down_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="use_mega_label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="use_mega_account_down_combobox" min="-2" pref="569" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="221" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="190" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@ -194,7 +201,16 @@
|
||||
<Component id="jSeparator4" min="-2" pref="10" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="verify_file_down_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="151" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSeparator7" min="-2" pref="10" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="use_mega_account_down_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="use_mega_account_down_combobox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="use_mega_label" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="54" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -328,6 +344,40 @@
|
||||
<Property name="text" type="java.lang.String" value="Note: it is recommended not to enable MULTI SLOT."/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="use_mega_account_down_checkbox">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="20" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Use MEGA account for download/stream (only MEGA/ELC)"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="use_mega_account_down_checkboxStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="use_mega_account_down_combobox">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="20" style="1"/>
|
||||
</Property>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSeparator7">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="use_mega_label">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="DejaVu Sans" size="16" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Default account:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="uploads_panel">
|
||||
|
@ -1,5 +1,6 @@
|
||||
package megabasterd;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Font;
|
||||
import java.awt.Frame;
|
||||
@ -118,6 +119,9 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
updateFont(proxy_warning_label, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(rec_upload_slots_label, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(rec_download_slots_label, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(use_mega_account_down_checkbox, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(use_mega_account_down_combobox, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(use_mega_label, FONT_DEFAULT, Font.PLAIN);
|
||||
}
|
||||
}, true);
|
||||
|
||||
@ -288,6 +292,28 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
swingReflectionInvoke("setEnabled", max_uploads_label, true);
|
||||
swingReflectionInvoke("setEnabled", default_slots_up_spinner, true);
|
||||
}
|
||||
|
||||
boolean use_mega_account = Download.USE_MEGA_ACCOUNT_DOWN;
|
||||
|
||||
String use_mega_acc = DBTools.selectSettingValueFromDB("use_mega_account_down");
|
||||
|
||||
String mega_account = null;
|
||||
|
||||
if (use_mega_acc != null) {
|
||||
|
||||
use_mega_account = use_mega_acc.equals("yes");
|
||||
|
||||
mega_account = DBTools.selectSettingValueFromDB("mega_account_down");
|
||||
}
|
||||
|
||||
if(use_mega_account) {
|
||||
|
||||
swingReflectionInvoke("setSelected", use_mega_account_down_checkbox, true);
|
||||
|
||||
} else {
|
||||
|
||||
swingReflectionInvoke("setSelected", use_mega_account_down_checkbox, false);
|
||||
}
|
||||
|
||||
DefaultTableModel mega_model = (DefaultTableModel) swingReflectionInvokeAndWaitForReturn("getModel", mega_accounts_table);
|
||||
|
||||
@ -476,6 +502,10 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
jSeparator3 = new javax.swing.JSeparator();
|
||||
jSeparator4 = new javax.swing.JSeparator();
|
||||
rec_download_slots_label = new javax.swing.JLabel();
|
||||
use_mega_account_down_checkbox = new javax.swing.JCheckBox();
|
||||
use_mega_account_down_combobox = new javax.swing.JComboBox<>();
|
||||
jSeparator7 = new javax.swing.JSeparator();
|
||||
use_mega_label = new javax.swing.JLabel();
|
||||
uploads_panel = new javax.swing.JPanel();
|
||||
default_slots_up_label = new javax.swing.JLabel();
|
||||
max_uploads_label = new javax.swing.JLabel();
|
||||
@ -601,24 +631,37 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
rec_download_slots_label.setFont(new java.awt.Font("DejaVu Sans", 0, 16)); // NOI18N
|
||||
rec_download_slots_label.setText("Note: it is recommended not to enable MULTI SLOT.");
|
||||
|
||||
use_mega_account_down_checkbox.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
|
||||
use_mega_account_down_checkbox.setText("Use MEGA account for download/stream (only MEGA/ELC)");
|
||||
use_mega_account_down_checkbox.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
use_mega_account_down_checkboxStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
use_mega_account_down_combobox.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
|
||||
|
||||
use_mega_label.setFont(new java.awt.Font("DejaVu Sans", 0, 16)); // NOI18N
|
||||
use_mega_label.setText("Default account:");
|
||||
|
||||
javax.swing.GroupLayout downloads_panelLayout = new javax.swing.GroupLayout(downloads_panel);
|
||||
downloads_panel.setLayout(downloads_panelLayout);
|
||||
downloads_panelLayout.setHorizontalGroup(
|
||||
downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, downloads_panelLayout.createSequentialGroup()
|
||||
.addGroup(downloads_panelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jSeparator3)
|
||||
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, downloads_panelLayout.createSequentialGroup()
|
||||
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jSeparator1)
|
||||
.addGroup(downloads_panelLayout.createSequentialGroup()
|
||||
.addComponent(change_download_dir_button)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(default_dir_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSeparator4, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, downloads_panelLayout.createSequentialGroup()
|
||||
.addComponent(jSeparator2)
|
||||
.addComponent(jSeparator4)
|
||||
.addComponent(jSeparator7)
|
||||
.addGroup(downloads_panelLayout.createSequentialGroup()
|
||||
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(verify_file_down_checkbox)
|
||||
.addComponent(down_dir_label)
|
||||
.addComponent(multi_slot_down_checkbox)
|
||||
.addComponent(rec_download_slots_label)
|
||||
@ -638,8 +681,14 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
.addGroup(downloads_panelLayout.createSequentialGroup()
|
||||
.addComponent(default_slots_down_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(default_slots_down_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))))
|
||||
.addGap(0, 221, Short.MAX_VALUE)))
|
||||
.addComponent(default_slots_down_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addComponent(use_mega_account_down_checkbox)
|
||||
.addComponent(verify_file_down_checkbox)
|
||||
.addGroup(downloads_panelLayout.createSequentialGroup()
|
||||
.addComponent(use_mega_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(use_mega_account_down_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, 569, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(0, 190, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
downloads_panelLayout.setVerticalGroup(
|
||||
@ -679,7 +728,15 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
.addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(verify_file_down_checkbox)
|
||||
.addContainerGap(151, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(use_mega_account_down_checkbox)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(use_mega_account_down_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(use_mega_label))
|
||||
.addContainerGap(54, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab("Downloads", downloads_panel);
|
||||
@ -1192,7 +1249,11 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
insertSettingValueInDB("max_download_speed", String.valueOf((int) swingReflectionInvokeAndWaitForReturn("getValue", max_down_speed_spinner)));
|
||||
insertSettingValueInDB("limit_upload_speed", (boolean) swingReflectionInvokeAndWaitForReturn("isSelected", limit_upload_speed_checkbox) ? "yes" : "no");
|
||||
insertSettingValueInDB("max_upload_speed", String.valueOf((int) swingReflectionInvokeAndWaitForReturn("getValue", max_up_speed_spinner)));
|
||||
insertSettingValueInDB("use_mega_account_down", (boolean) swingReflectionInvokeAndWaitForReturn("isSelected", use_mega_account_down_checkbox) ? "yes" : "no");
|
||||
insertSettingValueInDB("mega_account_down", (String)swingReflectionInvokeAndWaitForReturn("getSelectedItem", use_mega_account_down_combobox));
|
||||
|
||||
|
||||
|
||||
boolean old_use_proxy = false;
|
||||
|
||||
String use_proxy_val = DBTools.selectSettingValueFromDB("use_proxy");
|
||||
@ -1982,6 +2043,48 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
}//GEN-LAST:event_multi_slot_up_checkboxActionPerformed
|
||||
|
||||
private void use_mega_account_down_checkboxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_use_mega_account_down_checkboxStateChanged
|
||||
|
||||
if (!use_mega_account_down_checkbox.isSelected()) {
|
||||
|
||||
use_mega_account_down_combobox.setEnabled(false);
|
||||
|
||||
use_mega_label.setEnabled(false);
|
||||
|
||||
} else {
|
||||
|
||||
use_mega_account_down_combobox.setEnabled(true);
|
||||
|
||||
use_mega_label.setEnabled(true);
|
||||
|
||||
use_mega_account_down_combobox.removeAllItems();
|
||||
|
||||
if (_main_panel.getMega_accounts().size() > 0) {
|
||||
|
||||
for (Object o : _main_panel.getMega_accounts().keySet()) {
|
||||
|
||||
use_mega_account_down_combobox.addItem((String)o);
|
||||
|
||||
}
|
||||
|
||||
String use_mega_account_down = DBTools.selectSettingValueFromDB("mega_account_down");
|
||||
|
||||
if(use_mega_account_down != null) {
|
||||
|
||||
use_mega_account_down_combobox.setSelectedItem(use_mega_account_down);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
use_mega_account_down_combobox.setEnabled(false);
|
||||
|
||||
use_mega_label.setEnabled(false);
|
||||
|
||||
use_mega_account_down_checkbox.setSelected(false);
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_use_mega_account_down_checkboxStateChanged
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel accounts_panel;
|
||||
private javax.swing.JButton add_elc_account_button;
|
||||
@ -2007,6 +2110,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
private javax.swing.JSeparator jSeparator4;
|
||||
private javax.swing.JSeparator jSeparator5;
|
||||
private javax.swing.JSeparator jSeparator6;
|
||||
private javax.swing.JSeparator jSeparator7;
|
||||
private javax.swing.JTabbedPane jTabbedPane1;
|
||||
private javax.swing.JCheckBox limit_download_speed_checkbox;
|
||||
private javax.swing.JCheckBox limit_upload_speed_checkbox;
|
||||
@ -2042,6 +2146,9 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
private javax.swing.JLabel status;
|
||||
private javax.swing.JButton unlock_accounts_button;
|
||||
private javax.swing.JPanel uploads_panel;
|
||||
private javax.swing.JCheckBox use_mega_account_down_checkbox;
|
||||
private javax.swing.JComboBox<String> use_mega_account_down_combobox;
|
||||
private javax.swing.JLabel use_mega_label;
|
||||
private javax.swing.JCheckBox use_proxy_checkbox;
|
||||
private javax.swing.JCheckBox verify_file_down_checkbox;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
@ -4,7 +4,6 @@
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="title" type="java.lang.String" value="Streamer"/>
|
||||
<Property name="resizable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
@ -29,11 +28,14 @@
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="646" max="32767" attributes="0"/>
|
||||
<Component id="use_mega_account_down_label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="use_mega_account_down_combobox" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="dance_button" min="-2" pref="300" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="original_link_textfield" max="32767" attributes="0"/>
|
||||
<Component id="put_label" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="put_label" alignment="0" pref="1076" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@ -41,14 +43,18 @@
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="put_label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="original_link_textfield" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="dance_button" min="-2" pref="37" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="dance_button" alignment="3" min="-2" pref="37" max="-2" attributes="0"/>
|
||||
<Component id="use_mega_account_down_combobox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="use_mega_account_down_label" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -92,5 +98,29 @@
|
||||
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="original_link_textfield.addMouseListener(new ContextMenuMouseListener());"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="use_mega_account_down_label">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="16" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Use this account for streaming (only MEGA/ELC):"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="use_mega_account_down_combobox">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="16" style="1"/>
|
||||
</Property>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="use_mega_account_down_comboboxItemStateChanged"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -2,18 +2,26 @@ package megabasterd;
|
||||
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Font;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.WindowEvent;
|
||||
import static java.awt.event.WindowEvent.WINDOW_CLOSING;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.logging.Level;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JOptionPane;
|
||||
import static megabasterd.MainPanel.FONT_DEFAULT;
|
||||
import static megabasterd.MainPanel.THREAD_POOL;
|
||||
import static megabasterd.MiscTools.BASE642Bin;
|
||||
import static megabasterd.MiscTools.Bin2BASE64;
|
||||
import static megabasterd.MiscTools.bin2i32a;
|
||||
import static megabasterd.MiscTools.extractFirstMegaLinkFromString;
|
||||
import static megabasterd.MiscTools.extractStringFromClipboardContents;
|
||||
import static megabasterd.MiscTools.findFirstRegex;
|
||||
import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
import static megabasterd.MiscTools.swingReflectionInvokeAndWait;
|
||||
import static megabasterd.MiscTools.swingReflectionInvokeAndWaitForReturn;
|
||||
import static megabasterd.MiscTools.updateFont;
|
||||
|
||||
@ -25,7 +33,22 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
|
||||
private final ClipboardSpy _clipboardspy;
|
||||
private final MainPanelView _mainPanelView;
|
||||
private final MainPanel _main_panel;
|
||||
private volatile String _last_selected_account;
|
||||
private boolean _remember_master_pass;
|
||||
|
||||
public boolean isRemember_master_pass() {
|
||||
return _remember_master_pass;
|
||||
}
|
||||
|
||||
public JButton getDance_button() {
|
||||
return dance_button;
|
||||
}
|
||||
|
||||
public JComboBox<String> getUse_mega_account_down_combobox() {
|
||||
return use_mega_account_down_combobox;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new form Streamer
|
||||
*
|
||||
@ -37,6 +60,8 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
|
||||
_clipboardspy = clipboardspy;
|
||||
_mainPanelView = (MainPanelView) parent;
|
||||
_last_selected_account = null;
|
||||
_remember_master_pass = true;
|
||||
|
||||
MiscTools.swingInvokeIt(new Runnable() {
|
||||
|
||||
@ -45,8 +70,25 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
updateFont(put_label, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(original_link_textfield, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(dance_button, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(use_mega_account_down_label, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(use_mega_account_down_combobox, FONT_DEFAULT, Font.PLAIN);
|
||||
}
|
||||
}, true);
|
||||
|
||||
_main_panel = ((MainPanelView) parent).getMain_panel();
|
||||
|
||||
if(_main_panel.isUse_mega_account_down() && _main_panel.getMega_accounts().size() > 0) {
|
||||
|
||||
for (Object o : _main_panel.getMega_accounts().keySet()) {
|
||||
|
||||
swingReflectionInvoke("addItem", use_mega_account_down_combobox, o);
|
||||
}
|
||||
} else {
|
||||
swingReflectionInvoke("setEnabled", use_mega_account_down_combobox, false);
|
||||
swingReflectionInvoke("setEnabled", use_mega_account_down_label, false);
|
||||
swingReflectionInvoke("setVisible", use_mega_account_down_combobox, false);
|
||||
swingReflectionInvoke("setVisible", use_mega_account_down_label, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -62,10 +104,11 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
put_label = new javax.swing.JLabel();
|
||||
dance_button = new javax.swing.JButton();
|
||||
original_link_textfield = new javax.swing.JTextField();
|
||||
use_mega_account_down_label = new javax.swing.JLabel();
|
||||
use_mega_account_down_combobox = new javax.swing.JComboBox<>();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("Streamer");
|
||||
setResizable(false);
|
||||
|
||||
put_label.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
|
||||
put_label.setText("Put your MEGA/MegaCrypter/ELC link here in order to get a streaming link:");
|
||||
@ -85,6 +128,16 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
original_link_textfield.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
|
||||
original_link_textfield.setDoubleBuffered(true);
|
||||
|
||||
use_mega_account_down_label.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
|
||||
use_mega_account_down_label.setText("Use this account for streaming (only MEGA/ELC):");
|
||||
|
||||
use_mega_account_down_combobox.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
|
||||
use_mega_account_down_combobox.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
use_mega_account_down_comboboxItemStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@ -93,21 +146,27 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 646, Short.MAX_VALUE)
|
||||
.addComponent(use_mega_account_down_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(use_mega_account_down_combobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(dance_button, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(original_link_textfield)
|
||||
.addComponent(put_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(put_label, javax.swing.GroupLayout.DEFAULT_SIZE, 1076, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(put_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(original_link_textfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(dance_button, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(dance_button, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(use_mega_account_down_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(use_mega_account_down_label))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
@ -198,6 +257,105 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
});
|
||||
}//GEN-LAST:event_dance_buttonActionPerformed
|
||||
|
||||
private void use_mega_account_down_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_use_mega_account_down_comboboxItemStateChanged
|
||||
String selected_item = (String) use_mega_account_down_combobox.getSelectedItem();
|
||||
|
||||
if (_main_panel.isUse_mega_account_down() && selected_item != null && !selected_item.equals(_last_selected_account)) {
|
||||
|
||||
use_mega_account_down_combobox.setEnabled(false);
|
||||
|
||||
dance_button.setEnabled(false);
|
||||
|
||||
_last_selected_account = selected_item;
|
||||
|
||||
final String email = selected_item;
|
||||
|
||||
final Dialog tthis = this;
|
||||
|
||||
THREAD_POOL.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
HashMap<String, Object> account_info = (HashMap) _main_panel.getMega_accounts().get(email);
|
||||
|
||||
MegaAPI ma = _main_panel.getMega_active_accounts().get(use_mega_account_down_combobox.getSelectedItem());
|
||||
|
||||
if (ma == null) {
|
||||
|
||||
ma = new MegaAPI();
|
||||
|
||||
String password_aes, user_hash;
|
||||
|
||||
try {
|
||||
|
||||
if (_main_panel.getMaster_pass_hash() != null) {
|
||||
|
||||
if (_main_panel.getMaster_pass() == null) {
|
||||
|
||||
GetMasterPasswordDialog dialog = new GetMasterPasswordDialog((Frame) getParent(), true, _main_panel.getMaster_pass_hash(), _main_panel.getMaster_pass_salt());
|
||||
|
||||
swingReflectionInvokeAndWait("setLocationRelativeTo", dialog, tthis);
|
||||
|
||||
swingReflectionInvokeAndWait("setVisible", dialog, true);
|
||||
|
||||
if (dialog.isPass_ok()) {
|
||||
|
||||
_main_panel.setMaster_pass(dialog.getPass());
|
||||
|
||||
dialog.deletePass();
|
||||
|
||||
_remember_master_pass = dialog.getRemember_checkbox().isSelected();
|
||||
|
||||
dialog.dispose();
|
||||
|
||||
password_aes = Bin2BASE64(CryptTools.aes_cbc_decrypt_pkcs7(BASE642Bin((String) account_info.get("password_aes")), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
user_hash = Bin2BASE64(CryptTools.aes_cbc_decrypt_pkcs7(BASE642Bin((String) account_info.get("user_hash")), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
} else {
|
||||
|
||||
dialog.dispose();
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
password_aes = Bin2BASE64(CryptTools.aes_cbc_decrypt_pkcs7(BASE642Bin((String) account_info.get("password_aes")), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
user_hash = Bin2BASE64(CryptTools.aes_cbc_decrypt_pkcs7(BASE642Bin((String) account_info.get("user_hash")), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
password_aes = (String) account_info.get("password_aes");
|
||||
|
||||
user_hash = (String) account_info.get("user_hash");
|
||||
}
|
||||
|
||||
ma.fastLogin(email, bin2i32a(BASE642Bin(password_aes)), user_hash);
|
||||
|
||||
_main_panel.getMega_active_accounts().put(email, ma);
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
//getLogger(FileGrabberDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
_last_selected_account = null;
|
||||
|
||||
swingReflectionInvoke("setSelectedIndex", ((StreamerDialog)tthis).getUse_mega_account_down_combobox(), -1);
|
||||
}
|
||||
}
|
||||
|
||||
swingReflectionInvokeAndWait("setEnabled",((StreamerDialog)tthis).getUse_mega_account_down_combobox(), true);
|
||||
|
||||
swingReflectionInvokeAndWait("setEnabled",((StreamerDialog)tthis).getDance_button(), true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}//GEN-LAST:event_use_mega_account_down_comboboxItemStateChanged
|
||||
|
||||
@Override
|
||||
public void notifyClipboardChange() {
|
||||
|
||||
@ -213,6 +371,8 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
private javax.swing.JButton dance_button;
|
||||
private javax.swing.JTextField original_link_textfield;
|
||||
private javax.swing.JLabel put_label;
|
||||
private javax.swing.JComboBox<String> use_mega_account_down_combobox;
|
||||
private javax.swing.JLabel use_mega_account_down_label;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user