mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-28 20:40:13 +02:00
5.81
-2FA
This commit is contained in:
parent
536e5afaf7
commit
26e1cf66dc
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.tonikelope</groupId>
|
||||
<artifactId>MegaBasterd</artifactId>
|
||||
<version>5.80</version>
|
||||
<version>5.81</version>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
154
src/main/java/com/tonikelope/megabasterd/Get2FACode.form
Normal file
154
src/main/java/com/tonikelope/megabasterd/Get2FACode.form
Normal file
@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="title" type="java.lang.String" value="2FA CODE"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="status_label" max="32767" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="ok_button" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="cancel_button" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="lock_label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="email_label" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="please_label" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="current_code_textfield" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</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="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="email_label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="please_label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="current_code_textfield" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="lock_label" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" alignment="1" groupAlignment="3" attributes="0">
|
||||
<Component id="ok_button" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cancel_button" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="status_label" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="cancel_button">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="18" style="1"/>
|
||||
</Property>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/images/icons8-cancel-30.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="CANCEL"/>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancel_buttonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="ok_button">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="18" style="1"/>
|
||||
</Property>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/images/icons8-ok-30.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="OK"/>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ok_buttonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lock_label">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/images/lock_medium.png"/>
|
||||
</Property>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="email_label">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="24" style="1"/>
|
||||
</Property>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="status_label">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="please_label">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="24" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Please enter 2FA PIN CODE:"/>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="current_code_textfield">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="36" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="current_code_textfieldKeyPressed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
181
src/main/java/com/tonikelope/megabasterd/Get2FACode.java
Normal file
181
src/main/java/com/tonikelope/megabasterd/Get2FACode.java
Normal file
@ -0,0 +1,181 @@
|
||||
package com.tonikelope.megabasterd;
|
||||
|
||||
import static com.tonikelope.megabasterd.MainPanel.*;
|
||||
import static com.tonikelope.megabasterd.MiscTools.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tonikelope
|
||||
*/
|
||||
public class Get2FACode extends javax.swing.JDialog {
|
||||
|
||||
private boolean _code_ok;
|
||||
|
||||
private String _pin_code;
|
||||
|
||||
public boolean isCode_ok() {
|
||||
return _code_ok;
|
||||
}
|
||||
|
||||
public String getPin_code() {
|
||||
return _pin_code;
|
||||
}
|
||||
|
||||
public Get2FACode(java.awt.Frame parent, boolean modal, String email, MainPanel main_panel) {
|
||||
super(parent, modal);
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, DEFAULT_FONT, main_panel.getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
_code_ok = false;
|
||||
|
||||
this.email_label.setText(email);
|
||||
|
||||
pack();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
cancel_button = new javax.swing.JButton();
|
||||
ok_button = new javax.swing.JButton();
|
||||
lock_label = new javax.swing.JLabel();
|
||||
email_label = new javax.swing.JLabel();
|
||||
status_label = new javax.swing.JLabel();
|
||||
please_label = new javax.swing.JLabel();
|
||||
current_code_textfield = new javax.swing.JTextField();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("2FA CODE");
|
||||
|
||||
cancel_button.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
|
||||
cancel_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8-cancel-30.png"))); // NOI18N
|
||||
cancel_button.setText("CANCEL");
|
||||
cancel_button.setDoubleBuffered(true);
|
||||
cancel_button.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cancel_buttonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
ok_button.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
|
||||
ok_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8-ok-30.png"))); // NOI18N
|
||||
ok_button.setText("OK");
|
||||
ok_button.setDoubleBuffered(true);
|
||||
ok_button.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
ok_buttonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
lock_label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/lock_medium.png"))); // NOI18N
|
||||
lock_label.setDoubleBuffered(true);
|
||||
|
||||
email_label.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N
|
||||
email_label.setDoubleBuffered(true);
|
||||
|
||||
status_label.setFont(new java.awt.Font("Dialog", 0, 14)); // NOI18N
|
||||
status_label.setDoubleBuffered(true);
|
||||
|
||||
please_label.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N
|
||||
please_label.setText("Please enter 2FA PIN CODE:");
|
||||
please_label.setDoubleBuffered(true);
|
||||
|
||||
current_code_textfield.setFont(new java.awt.Font("Dialog", 0, 36)); // NOI18N
|
||||
current_code_textfield.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyPressed(java.awt.event.KeyEvent evt) {
|
||||
current_code_textfieldKeyPressed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(status_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(ok_button)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(cancel_button))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lock_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(email_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(please_label, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(current_code_textfield))))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(email_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(please_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(current_code_textfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(7, 7, 7))
|
||||
.addComponent(lock_label))
|
||||
.addGap(18, 18, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(ok_button)
|
||||
.addComponent(cancel_button))
|
||||
.addComponent(status_label, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void cancel_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_buttonActionPerformed
|
||||
|
||||
_code_ok = false;
|
||||
|
||||
setVisible(false);
|
||||
}//GEN-LAST:event_cancel_buttonActionPerformed
|
||||
|
||||
private void ok_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ok_buttonActionPerformed
|
||||
|
||||
_code_ok = true;
|
||||
|
||||
_pin_code = current_code_textfield.getText();
|
||||
|
||||
setVisible(false);
|
||||
}//GEN-LAST:event_ok_buttonActionPerformed
|
||||
|
||||
private void current_code_textfieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_current_code_textfieldKeyPressed
|
||||
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
|
||||
ok_buttonActionPerformed(null);
|
||||
}
|
||||
}//GEN-LAST:event_current_code_textfieldKeyPressed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton cancel_button;
|
||||
private javax.swing.JTextField current_code_textfield;
|
||||
private javax.swing.JLabel email_label;
|
||||
private javax.swing.JLabel lock_label;
|
||||
private javax.swing.JButton ok_button;
|
||||
private javax.swing.JLabel please_label;
|
||||
private javax.swing.JLabel status_label;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
@ -48,7 +48,7 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "5.80";
|
||||
public static final String VERSION = "5.81";
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||
public static final int STREAMER_PORT = 1337;
|
||||
|
@ -30,7 +30,7 @@ public final class MegaAPI {
|
||||
public static final String API_URL = "https://g.api.mega.co.nz";
|
||||
public static final String API_KEY = null;
|
||||
public static final int REQ_ID_LENGTH = 10;
|
||||
public static final Integer[] MEGA_ERROR_EXCEPTION_CODES = {-2, -8, -9, -10, -11, -12, -13, -14, -15, -16};
|
||||
public static final Integer[] MEGA_ERROR_EXCEPTION_CODES = {-2, -5, -8, -9, -10, -11, -12, -13, -14, -15, -16, -26};
|
||||
public static final int PBKDF2_ITERATIONS = 100000;
|
||||
public static final int PBKDF2_OUTPUT_BIT_LENGTH = 256;
|
||||
|
||||
@ -133,9 +133,15 @@ public final class MegaAPI {
|
||||
return _trashbin_id;
|
||||
}
|
||||
|
||||
private void _realLogin() throws Exception {
|
||||
private void _realLogin(String pincode) throws Exception {
|
||||
|
||||
String request = "[{\"a\":\"us\",\"user\":\"" + _email + "\",\"uh\":\"" + _user_hash + "\"}]";
|
||||
String request;
|
||||
|
||||
if (pincode != null) {
|
||||
request = "[{\"a\":\"us\", \"mfa\":\"" + pincode + "\", \"user\":\"" + _email + "\",\"uh\":\"" + _user_hash + "\"}]";
|
||||
} else {
|
||||
request = "[{\"a\":\"us\",\"user\":\"" + _email + "\",\"uh\":\"" + _user_hash + "\"}]";
|
||||
}
|
||||
|
||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||
|
||||
@ -187,7 +193,23 @@ public final class MegaAPI {
|
||||
|
||||
}
|
||||
|
||||
public void login(String email, String password) throws Exception {
|
||||
public boolean check2FA(String email) throws Exception {
|
||||
|
||||
String request = "[{\"a\":\"mfag\",\"e\":\"" + email + "\"}]";
|
||||
|
||||
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : ""));
|
||||
|
||||
String res = _rawRequest(request, url_api);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
Integer[] res_map = objectMapper.readValue(res, Integer[].class);
|
||||
|
||||
return (res_map[0] == 1);
|
||||
|
||||
}
|
||||
|
||||
public void login(String email, String password, String pincode) throws Exception {
|
||||
|
||||
_full_email = email;
|
||||
|
||||
@ -214,10 +236,10 @@ public final class MegaAPI {
|
||||
_user_hash = MiscTools.Bin2UrlBASE64(Arrays.copyOfRange(pbkdf2_key, 16, 32));
|
||||
}
|
||||
|
||||
_realLogin();
|
||||
_realLogin(pincode);
|
||||
}
|
||||
|
||||
public void fastLogin(String email, int[] password_aes, String user_hash) throws Exception {
|
||||
public void fastLogin(String email, int[] password_aes, String user_hash, String pincode) throws Exception {
|
||||
|
||||
_full_email = email;
|
||||
|
||||
@ -233,7 +255,7 @@ public final class MegaAPI {
|
||||
|
||||
_user_hash = user_hash;
|
||||
|
||||
_realLogin();
|
||||
_realLogin(pincode);
|
||||
}
|
||||
|
||||
public Long[] getQuota() {
|
||||
|
@ -1147,7 +1147,22 @@ public final class MiscTools {
|
||||
user_hash = (String) account_info.get("user_hash");
|
||||
}
|
||||
|
||||
ma.fastLogin(email, bin2i32a(BASE642Bin(password_aes)), user_hash);
|
||||
String pincode = null;
|
||||
|
||||
if (ma.check2FA(email)) {
|
||||
|
||||
Get2FACode dialog = new Get2FACode((Frame) container.getParent(), true, email, main_panel);
|
||||
|
||||
dialog.setLocationRelativeTo(container);
|
||||
|
||||
dialog.setVisible(true);
|
||||
|
||||
if (dialog.isCode_ok()) {
|
||||
pincode = dialog.getPin_code();
|
||||
}
|
||||
}
|
||||
|
||||
ma.fastLogin(email, bin2i32a(BASE642Bin(password_aes)), user_hash, pincode);
|
||||
|
||||
main_panel.getMega_active_accounts().put(email, ma);
|
||||
|
||||
|
@ -20,7 +20,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
@ -33,13 +32,9 @@ import javax.swing.JOptionPane;
|
||||
import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
|
||||
import static javax.swing.JOptionPane.showOptionDialog;
|
||||
import javax.swing.JSpinner;
|
||||
import javax.swing.RowSorter;
|
||||
import javax.swing.SortOrder;
|
||||
import javax.swing.SpinnerNumberModel;
|
||||
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableModel;
|
||||
import javax.swing.table.TableRowSorter;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -270,6 +265,10 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
use_mega_account_down_combobox.setEnabled(false);
|
||||
}
|
||||
|
||||
mega_accounts_table.setAutoCreateRowSorter(true);
|
||||
|
||||
elc_accounts_table.setAutoCreateRowSorter(true);
|
||||
|
||||
DefaultTableModel mega_model = (DefaultTableModel) mega_accounts_table.getModel();
|
||||
|
||||
DefaultTableModel elc_model = (DefaultTableModel) elc_accounts_table.getModel();
|
||||
@ -400,30 +399,6 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
}
|
||||
|
||||
TableRowSorter<TableModel> sorter_mega = new TableRowSorter<>(mega_accounts_table.getModel());
|
||||
|
||||
mega_accounts_table.setRowSorter(sorter_mega);
|
||||
|
||||
List<RowSorter.SortKey> sortKeys_mega = new ArrayList<>();
|
||||
|
||||
sortKeys_mega.add(new RowSorter.SortKey(0, SortOrder.ASCENDING));
|
||||
|
||||
sorter_mega.setSortKeys(sortKeys_mega);
|
||||
|
||||
sorter_mega.sort();
|
||||
|
||||
TableRowSorter<TableModel> sorter_elc = new TableRowSorter<>(elc_accounts_table.getModel());
|
||||
|
||||
elc_accounts_table.setRowSorter(sorter_elc);
|
||||
|
||||
List<RowSorter.SortKey> sortKeys_elc = new ArrayList<>();
|
||||
|
||||
sortKeys_elc.add(new RowSorter.SortKey(0, SortOrder.ASCENDING));
|
||||
|
||||
sorter_elc.setSortKeys(sortKeys_elc);
|
||||
|
||||
sorter_elc.sort();
|
||||
|
||||
boolean use_mc_reverse = false;
|
||||
|
||||
String megacrypter_reverse = DBTools.selectSettingValue("megacrypter_reverse");
|
||||
@ -1763,7 +1738,23 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
ma = new MegaAPI();
|
||||
|
||||
try {
|
||||
ma.login(email, pass);
|
||||
|
||||
String pincode = null;
|
||||
|
||||
if (ma.check2FA(email)) {
|
||||
|
||||
Get2FACode dialog = new Get2FACode((Frame) getParent(), true, email, _main_panel);
|
||||
|
||||
dialog.setLocationRelativeTo(tthis);
|
||||
|
||||
dialog.setVisible(true);
|
||||
|
||||
if (dialog.isCode_ok()) {
|
||||
pincode = dialog.getPin_code();
|
||||
}
|
||||
}
|
||||
|
||||
ma.login(email, pass, pincode);
|
||||
|
||||
_main_panel.getMega_active_accounts().put(email, ma);
|
||||
|
||||
@ -1808,7 +1799,23 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
ma = new MegaAPI();
|
||||
|
||||
try {
|
||||
ma.login(email, pass);
|
||||
|
||||
String pincode = null;
|
||||
|
||||
if (ma.check2FA(email)) {
|
||||
|
||||
Get2FACode dialog = new Get2FACode((Frame) getParent(), true, email, _main_panel);
|
||||
|
||||
dialog.setLocationRelativeTo(tthis);
|
||||
|
||||
dialog.setVisible(true);
|
||||
|
||||
if (dialog.isCode_ok()) {
|
||||
pincode = dialog.getPin_code();
|
||||
}
|
||||
}
|
||||
|
||||
ma.login(email, pass, pincode);
|
||||
|
||||
_main_panel.getMega_active_accounts().put(email, ma);
|
||||
|
||||
@ -2060,6 +2067,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
}//GEN-LAST:event_add_elc_account_buttonActionPerformed
|
||||
|
||||
private void remove_elc_account_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_remove_elc_account_buttonActionPerformed
|
||||
|
||||
DefaultTableModel model = (DefaultTableModel) elc_accounts_table.getModel();
|
||||
|
||||
int selected = elc_accounts_table.getSelectedRow();
|
||||
@ -2420,8 +2428,6 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
model.addRow(new Object[]{"", ""});
|
||||
|
||||
mega_accounts_table.clearSelection();
|
||||
|
||||
remove_mega_account_button.setEnabled(true);
|
||||
}//GEN-LAST:event_add_mega_account_buttonActionPerformed
|
||||
|
||||
private void remove_mega_account_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_remove_mega_account_buttonActionPerformed
|
||||
@ -2447,6 +2453,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
remove_mega_account_button.setEnabled(false);
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_remove_mega_account_buttonActionPerformed
|
||||
|
||||
private void multi_slot_down_checkboxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_multi_slot_down_checkboxStateChanged
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 188 KiB |
Loading…
x
Reference in New Issue
Block a user