Merge pull request #14 from 45Drives/dev-josh

fix issue with upload chunk size in el7
This commit is contained in:
Josh Boudreau 2021-06-07 13:11:58 -03:00 committed by GitHub
commit 923e3e0fe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 11 deletions

View File

@ -22,17 +22,17 @@ With no command line use needed, you can:
# Installation
## From Github Release
### Ubuntu
1. `$ wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.4.0/cockpit-navigator_0.4.0-1focal_all.deb`
1. `# apt install ./cockpit-navigator_0.4.0-1focal_all.deb`
1. `$ wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.4/cockpit-navigator_0.4.1-1focal_all.deb`
1. `# apt install ./cockpit-navigator_0.4.1-1focal_all.deb`
### EL7
1. `# yum install https://github.com/45Drives/cockpit-navigator/releases/download/v0.4.0/cockpit-navigator-0.4.0-1.el7.noarch.rpm`
1. `# yum install https://github.com/45Drives/cockpit-navigator/releases/download/v0.4/cockpit-navigator-0.4.1-1.el7.noarch.rpm`
### EL8
1. `# dnf install https://github.com/45Drives/cockpit-navigator/releases/download/v0.4.0/cockpit-navigator-0.4.0-1.el8.noarch.rpm`
1. `# dnf install https://github.com/45Drives/cockpit-navigator/releases/download/v0.4/cockpit-navigator-0.4.1-1.el8.noarch.rpm`
## From Source
1. Ensure dependencies are installed: `cockpit`, `python3`, `rsync`, `zip`.
1. `$ git clone https://github.com/45Drives/cockpit-navigator.git`
1. `$ cd cockpit-navigator`
1. `$ git checkout <version>` (v0.4.0 is latest)
1. `$ git checkout <version>` (v0.4 is latest)
1. `# make install`
## From 45Drives Repositories
### Ubuntu

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
cockpit-navigator (0.4.1-1focal) focal; urgency=low
* Use smaller chunk size while uploading for older versions of Cockpit.
-- Josh Boudreau <jboudreau@45drives.com> Mon, 07 Jun 2021 13:08:00 -0300
cockpit-navigator (0.4.0-1focal) focal; urgency=low
* Add icons to right click menu.

View File

@ -1,5 +1,5 @@
Name: cockpit-navigator
Version: 0.4.0
Version: 0.4.1
Release: 1%{?dist}
Summary: A File System Browser for Cockpit.
License: GPL-3.0+
@ -32,6 +32,8 @@ rm -rf %{buildroot}
/usr/share/cockpit/navigator/*
%changelog
* Mon Jun 07 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.1-1
- Use smaller chunk size while uploading for older versions of Cockpit.
* Mon Jun 07 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.0-1
- Add icons to right click menu.
- Add ability to download files and directories.

View File

@ -1039,11 +1039,15 @@ class FileUpload {
/**
*
* @param {File|Blob} file
* @param {Number} chunk_size
* @param {NavWindow} nav_window_ref
*/
constructor(file, chunk_size, nav_window_ref) {
this.chunk_size = chunk_size;
constructor(file, nav_window_ref) {
try {
this.chunk_size = (parseInt(cockpit.info.version) > 238)? 1048576 : 65536;
} catch(e) {
console.log(e);
this.chunk_size = 65536;
}
this.filename = file.name;
this.nav_window_ref = nav_window_ref;
this.path = nav_window_ref.pwd().path_str() + "/" + file.name;
@ -1231,7 +1235,7 @@ class NavDragDrop {
window.alert(file.name + ": Cannot upload folders.");
continue;
}
var uploader = new FileUpload(file, 1048576, this.nav_window_ref);
var uploader = new FileUpload(file, this.nav_window_ref);
uploader.upload();
}
}
@ -1239,7 +1243,7 @@ class NavDragDrop {
for (let file of ev.dataTransfer.files) {
if (file.type === "")
continue;
var uploader = new FileUpload(file, 1048576, this.nav_window_ref);
var uploader = new FileUpload(file, this.nav_window_ref);
uploader.upload();
}
}