Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ TZ=UTC
#GOKAPI_MAX_FILESIZE=102400
#GOKAPI_MAX_MEMORY_UPLOAD=50
#GOKAPI_MAX_PARALLEL_UPLOADS=3
# Default name template for browser-side zip archives (supports date tokens like %Y %m %d %H %M %S)
#GOKAPI_DEFAULT_ZIP_NAME=gokapi-upload-%Y%m%d-%H%M%S
#TMPDIR=/app/data/tmp


Expand Down
6 changes: 6 additions & 0 deletions docs/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ Available environment variables
+-------------------------------------+----------------------------------------------------------------------------------------+-----------------+-----------------------------+
| GOKAPI_DATA_DIR | Sets the directory for the data | Yes | data |
+-------------------------------------+----------------------------------------------------------------------------------------+-----------------+-----------------------------+
| GOKAPI_DEFAULT_ZIP_NAME | Sets the default name template used when compressing an upload into a zip | No | gokapi-upload-%Y%m%d-%H%M%S |
| | | | |
| | archive in the browser. Supports strftime-style date tokens, e.g. | | |
| | | | |
| | %Y %m %d %H %M %S. The .zip extension is added automatically. | | |
+-------------------------------------+----------------------------------------------------------------------------------------+-----------------+-----------------------------+
| GOKAPI_DISABLE_API_MENU | Disables the API menu and generation of API keys for non-admin users | No | false |
+-------------------------------------+----------------------------------------------------------------------------------------+-----------------+-----------------------------+
| GOKAPI_DISABLE_CORS_CHECK | Disables the CORS check on startup and during setup, if set to true | No | false |
Expand Down
4 changes: 4 additions & 0 deletions internal/environment/Environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ type Environment struct {
UseCloudFlare bool `env:"USE_CLOUDFLARE" envDefault:"false"`
// Sets the webserver port
WebserverPort int `env:"PORT" envDefault:"53842" onlyPositive:"true" persistent:"true"`
// Sets the default name template used when compressing an upload into a zip
// archive in the browser. Supports strftime-style date tokens, e.g.
// %Y %m %d %H %M %S. The .zip extension is added automatically.
DefaultZipName string `env:"DEFAULT_ZIP_NAME" envDefault:"gokapi-upload-%Y%m%d-%H%M%S"`
// Allow hotlinking of videos. Note: Due to buffering, playing a video might count as
// multiple downloads. It is only recommended to use video hotlinking for uploads with
// unlimited downloads enabled
Expand Down
2 changes: 2 additions & 0 deletions internal/webserver/Webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ type AdminView struct {
IsUserTabAvailable bool
EndToEndEncryption bool
IncludeFilename bool
DefaultZipName string
IsInternalAuth bool
ShowApiMenu bool
ShowDeprecationNotice bool
Expand Down Expand Up @@ -912,6 +913,7 @@ func (u *AdminView) convertGlobalConfig(view int, user models.User) *AdminView {
u.MaxParallelUploads = config.MaxParallelUploads
u.ChunkSize = config.ChunkSize
u.IncludeFilename = config.IncludeFilename
u.DefaultZipName = configuration.GetEnvironment().DefaultZipName
return u
}

Expand Down
14 changes: 14 additions & 0 deletions internal/webserver/web/static/assets/dist/js/jszip.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions internal/webserver/web/static/css/cover.css
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,17 @@ tr.no-bottom-border td {
filter: invert(1) brightness(0.6);
}

/* ── Zip archive name template input ────────────────────────────── */

.upload-option-zip-input {
font-size: 0.8rem;
}

.upload-option-zip-input::placeholder {
color: #6c757d;
opacity: 1;
}


.modal-samesize-input-edit {
width: 11rem;
Expand Down

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions internal/webserver/web/static/js/admin_ui_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ function initDropzone() {
init: function() {
dropzoneObject = this;
this.on("addedfile", file => {
// If zip grouping is enabled, buffer the file and compress a batch
// into a single archive instead of uploading files individually.
// handleZipAddedFile() returns true if it took ownership of the file.
if (typeof handleZipAddedFile === "function" && handleZipAddedFile(file)) {
return;
}
file.upload.uuid = getUuid();
saveUploadDefaults();
addFileProgress(file);
Expand Down
Loading