mirror of
https://github.com/mickael-kerjean/filestash
synced 2026-01-06 15:55:30 +01:00
* add an option to change the number of parallel uploads * undo automatic format Co-authored-by: Quentin Bramas <bramas@unistra.fr>
This commit is contained in:
parent
44fc901b4b
commit
31564efaec
2 changed files with 8 additions and 2 deletions
|
|
@ -7,7 +7,6 @@ import { Icon, NgIf } from "./";
|
|||
import { t } from "../locales/";
|
||||
import "./upload_queue.scss";
|
||||
|
||||
const MAX_POOL_SIZE = 15;
|
||||
|
||||
function humanFileSize(bytes, si) {
|
||||
var thresh = si ? 1000 : 1024;
|
||||
|
|
@ -225,6 +224,10 @@ export class UploadQueue extends React.Component {
|
|||
requestAnimationFrame(() => this.start());
|
||||
}
|
||||
|
||||
maxPoolSize() {
|
||||
return window.CONFIG["upload_pool_size"] || 10;
|
||||
}
|
||||
|
||||
start() {
|
||||
if (!this.state.running) {
|
||||
window.setTimeout(() => this.calcSpeed(), 500);
|
||||
|
|
@ -232,7 +235,7 @@ export class UploadQueue extends React.Component {
|
|||
running: true,
|
||||
error: null
|
||||
});
|
||||
Promise.all(Array.apply(null, Array(MAX_POOL_SIZE)).map(() => {
|
||||
Promise.all(Array.apply(null, Array(this.maxPoolSize())).map(() => {
|
||||
return this.runner();
|
||||
})).then(() => {
|
||||
this.setState({ running: false });
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ func NewConfiguration() Configuration {
|
|||
FormElement{Name: "display_hidden", Type: "boolean", Default: false, Description: "Should files starting with a dot be visible by default?"},
|
||||
FormElement{Name: "auto_connect", Type: "boolean", Default: false, Description: "User don't have to click on the login button if an admin is prefilling a unique backend"},
|
||||
FormElement{Name: "upload_button", Type: "boolean", Default: false, Description: "Display the upload button on any device"},
|
||||
FormElement{Name: "upload_pool_size", Type: "number", Default: 10, Description: "Maximum number of files upload in parallel"},
|
||||
FormElement{Name: "custom_css", Type: "long_text", Default: "", Description: "Set custom css code for your instance"},
|
||||
},
|
||||
},
|
||||
|
|
@ -358,6 +359,7 @@ func (this Configuration) Export() interface{} {
|
|||
EnableShare bool `json:"enable_share"`
|
||||
Logout string `json:"logout"`
|
||||
MimeTypes map[string]string `json:"mime"`
|
||||
UploadPoolSize int `json:"upload_pool_size"`
|
||||
}{
|
||||
Editor: this.Get("general.editor").String(),
|
||||
ForkButton: this.Get("general.fork_button").Bool(),
|
||||
|
|
@ -369,6 +371,7 @@ func (this Configuration) Export() interface{} {
|
|||
EnableShare: this.Get("features.share.enable").Bool(),
|
||||
Logout: this.Get("general.logout").String(),
|
||||
MimeTypes: AllMimeTypes(),
|
||||
UploadPoolSize: this.Get("general.upload_pool_size").Int(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue