Public folder link optional
This commit is contained in:
tonikelope 2023-10-12 17:44:03 +02:00
parent 716ad43f49
commit 98af706ff3
11 changed files with 115 additions and 22 deletions

View File

@ -31,6 +31,7 @@ import java.util.logging.Logger;
*/
public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
public static final double SLOW_PROXY_PERC = 0.5;
private static final Logger LOG = Logger.getLogger(ChunkDownloader.class.getName());
private final int _id;
private final Download _download;

View File

@ -1512,10 +1512,6 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
error_code = ex.getCode();
if (error_code == -11) {
_status_error = "ERROR: MEGA LINK BLOCKED/DELETED!";
}
if (Arrays.asList(FATAL_API_ERROR_CODES).contains(error_code)) {
_auto_retry_on_error = Arrays.asList(FATAL_API_ERROR_CODES_WITH_RETRY).contains(error_code);

View File

@ -285,7 +285,6 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="1"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Enable log file"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
<Property name="enabled" type="boolean" value="false"/>

View File

@ -109,6 +109,10 @@ public class FileGrabberDialog extends javax.swing.JDialog {
MiscTools.GUIRunAndWait(() -> {
initComponents();
String upload_log_string = DBTools.selectSettingValue("upload_log");
upload_log_checkbox.setSelected("yes".equals(upload_log_string));
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
updateTitledBorderFont(((javax.swing.border.TitledBorder) jPanel1.getBorder()), GUI_FONT, _main_panel.getZoom_factor());
@ -340,7 +344,6 @@ public class FileGrabberDialog extends javax.swing.JDialog {
});
upload_log_checkbox.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
upload_log_checkbox.setSelected(true);
upload_log_checkbox.setText("Enable log file");
upload_log_checkbox.setDoubleBuffered(true);
upload_log_checkbox.setEnabled(false);

View File

@ -1122,7 +1122,7 @@ public final class MainPanel {
upload.getView().printStatusNormal("Stopping upload safely before exit MegaBasterd, please wait...");
upload.getView().getSlots_spinner().setEnabled(false);
upload.getView().getPause_button().setEnabled(false);
upload.getView().getFolder_link_button().setEnabled(false);
upload.getView().getFile_link_button().setEnabled(false);
upload.getView().getFile_size_label().setEnabled(false);
upload.getView().getFile_name_label().setEnabled(false);

View File

@ -286,7 +286,7 @@ public final class MainPanelView extends javax.swing.JFrame {
fr.write("***** MegaBasterd UPLOAD LOG FILE *****\n\n");
fr.write(MiscTools.getFechaHoraActual() + "\n\n");
fr.write(ma.getEmail() + "\n\n");
fr.write(dir_name + "\n\n");
fr.write(dir_name + " " + folder_link + "\n\n");
fr.close();
} catch (IOException ex) {
Logger.getLogger(Upload.class.getName()).log(Level.SEVERE, ex.getMessage());
@ -464,8 +464,6 @@ public final class MainPanelView extends javax.swing.JFrame {
initComponents();
unfreeze_transferences_button.setBackground(Color.WHITE);
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
translateLabels(this);

View File

@ -1031,7 +1031,6 @@ public class MegaAPI implements Serializable {
return genRandomByteArray(16);
}
//OJO A ESTO, HAY QUE ACTUALIZAR ESTO CON EL ANILLO DE CLAVES Y LA ACTUALIZACIÓN DE SEGURIDAD DE MEGA de 2023 (PENDIENTE)
public String shareFolder(String node, byte[] node_key, byte[] share_key) {
try {

View File

@ -3098,6 +3098,10 @@ public class SettingsDialog extends javax.swing.JDialog {
this.upload_public_folder_checkbox.setBackground(this.upload_public_folder_checkbox.isSelected() ? java.awt.Color.RED : null);
this.public_folder_panel.setVisible(this.upload_public_folder_checkbox.isSelected());
revalidate();
repaint();
}//GEN-LAST:event_upload_public_folder_checkboxActionPerformed

View File

@ -25,7 +25,7 @@ public interface Transference {
int HTTP_READ_TIMEOUT = 60000;
int MAX_SIM_TRANSFERENCES = 50;
int SIM_TRANSFERENCES_DEFAULT = 4;
int PROGRESS_WATCHDOG_TIMEOUT = 300;
int PROGRESS_WATCHDOG_TIMEOUT = 600;
boolean LIMIT_TRANSFERENCE_SPEED_DEFAULT = false;
int MAX_TRANSFERENCE_SPEED_DEFAULT = 5;
int MAX_WAIT_WORKERS_SHUTDOWN = 15;

View File

@ -31,7 +31,11 @@
<Component id="progress_pbar" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="file_size_label" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="open_browser_button" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="folder_link_button" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="file_link_button" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
@ -64,7 +68,7 @@
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="status_label" max="32767" attributes="0"/>
<Component id="status_label" pref="446" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="cbc_label" min="-2" max="-2" attributes="0"/>
</Group>
@ -102,9 +106,13 @@
<Component id="slot_status_label" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="file_link_button" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="file_size_label" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="open_browser_button" alignment="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="folder_link_button" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="file_link_button" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="file_size_label" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="progress_pbar" min="-2" max="-2" attributes="0"/>
@ -277,6 +285,20 @@
<Property name="doubleBuffered" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="folder_link_button">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="16" style="1"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/images/icons8-copy-to-clipboard-30.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Copy folder link"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="folder_link_buttonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="file_link_button">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
@ -358,5 +380,20 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="queue_bottom_buttonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="open_browser_button">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="16" style="1"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/images/icons8-export-30.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Open folder in browser"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="open_browser_buttonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -93,6 +93,14 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
return file_link_button;
}
public JButton getFolder_link_button() {
return folder_link_button;
}
public JButton getOpen_browser_button() {
return open_browser_button;
}
public JLabel getStatus_label() {
return status_label;
}
@ -162,12 +170,14 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
restart_button = new javax.swing.JButton();
file_size_label = new javax.swing.JLabel();
slot_status_label = new javax.swing.JLabel();
folder_link_button = new javax.swing.JButton();
file_link_button = new javax.swing.JButton();
queue_up_button = new javax.swing.JButton();
queue_down_button = new javax.swing.JButton();
cbc_label = new javax.swing.JLabel();
queue_top_button = new javax.swing.JButton();
queue_bottom_button = new javax.swing.JButton();
open_browser_button = new javax.swing.JButton();
setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 204, 255), 3, true));
@ -253,6 +263,15 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
slot_status_label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
slot_status_label.setDoubleBuffered(true);
folder_link_button.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
folder_link_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8-copy-to-clipboard-30.png"))); // NOI18N
folder_link_button.setText("Copy folder link");
folder_link_button.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
folder_link_buttonActionPerformed(evt);
}
});
file_link_button.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
file_link_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8-copy-to-clipboard-30.png"))); // NOI18N
file_link_button.setText("Copy file link");
@ -302,6 +321,16 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
}
});
open_browser_button.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
open_browser_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8-export-30.png"))); // NOI18N
open_browser_button.setText("Open folder in browser");
open_browser_button.setDoubleBuffered(true);
open_browser_button.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
open_browser_buttonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -312,7 +341,11 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
.addComponent(progress_pbar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(file_size_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(open_browser_button)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(folder_link_button)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(file_link_button))
.addGroup(layout.createSequentialGroup()
.addComponent(file_name_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@ -340,7 +373,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
.addComponent(queue_bottom_button)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(status_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(status_label, javax.swing.GroupLayout.DEFAULT_SIZE, 446, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(cbc_label)))
.addGap(18, 18, 18)
@ -369,9 +402,12 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
.addComponent(file_name_label)
.addComponent(slot_status_label))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(file_link_button)
.addComponent(file_size_label))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(open_browser_button)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(folder_link_button)
.addComponent(file_link_button)
.addComponent(file_size_label)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(progress_pbar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -432,6 +468,19 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
});
}
private void folder_link_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_folder_link_buttonActionPerformed
folder_link_button.setEnabled(false);
folder_link_button.setText(LabelTranslatorSingleton.getInstance().translate("Please wait..."));
copyTextToClipboard(_upload.getFolder_link());
folder_link_button.setText(LabelTranslatorSingleton.getInstance().translate("Copy folder link"));
folder_link_button.setEnabled(true);
}//GEN-LAST:event_folder_link_buttonActionPerformed
private void file_link_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_file_link_buttonActionPerformed
file_link_button.setEnabled(false);
@ -497,6 +546,11 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
});
}//GEN-LAST:event_queue_bottom_buttonActionPerformed
private void open_browser_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_open_browser_buttonActionPerformed
// TODO add your handling code here:
MiscTools.openBrowserURL(_upload.getFolder_link());
}//GEN-LAST:event_open_browser_buttonActionPerformed
public void updateCBC(String status) {
MiscTools.GUIRunAndWait(() -> {
@ -648,6 +702,8 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
private javax.swing.JButton file_link_button;
private javax.swing.JLabel file_name_label;
private javax.swing.JLabel file_size_label;
private javax.swing.JButton folder_link_button;
private javax.swing.JButton open_browser_button;
private javax.swing.JButton pause_button;
private javax.swing.JProgressBar progress_pbar;
private javax.swing.JButton queue_bottom_button;