diff --git a/README.md b/README.md index 2df4c8db..249bdc3d 100644 --- a/README.md +++ b/README.md @@ -99,9 +99,9 @@ Requirements: - Node v22+ - Tilt v0.33+ -Run `tilt up`, and see `http://localhost:10350/` for the Tilt dashboard. +Run `tilt up`, and see http://localhost:10350/ for the Tilt dashboard. -Front-end application is available at `http://localhost:15641/`. +Front-end application is available at http://localhost:15641/. ## Localize to your own language diff --git a/pkg/customization/customize.go b/pkg/customization/customize.go index c22e6ac3..4ff0f252 100644 --- a/pkg/customization/customize.go +++ b/pkg/customization/customize.go @@ -30,8 +30,10 @@ type ( DisableQRSupport bool `json:"disableQRSupport,omitempty" yaml:"disableQRSupport"` DisableThemeSwitcher bool `json:"disableThemeSwitcher,omitempty" yaml:"disableThemeSwitcher"` - DisableExpiryOverride bool `json:"disableExpiryOverride,omitempty" yaml:"disableExpiryOverride"` - ExpiryChoices []int64 `json:"expiryChoices,omitempty" yaml:"expiryChoices"` + DisableExpiryOverride bool `json:"disableExpiryOverride,omitempty" yaml:"disableExpiryOverride"` + ExpiryChoices []int64 `json:"expiryChoices,omitempty" yaml:"expiryChoices"` + ExpiryChoicesHuman []string `json:"expiryChoicesHuman,omitempty" yaml:"expiryChoicesHuman"` + DefaultExpiryHuman string `json:"defaultExpiryHuman,omitempty" yaml:"defaultExpiryHuman"` AcceptedFileTypes string `json:"acceptedFileTypes" yaml:"acceptedFileTypes"` DisableFileAttachment bool `json:"disableFileAttachment" yaml:"disableFileAttachment"` diff --git a/src/components/create.vue b/src/components/create.vue index 7532bcff..074fff87 100644 --- a/src/components/create.vue +++ b/src/components/create.vue @@ -122,8 +122,11 @@ diff --git a/src/helpers.ts b/src/helpers.ts index 04348b7c..886fb7ce 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -9,13 +9,38 @@ function bytesToHuman(bytes: number): string { { thresh: 1024, unit: 'KiB' }, ]) { if (bytes > t.thresh) { - return `${(bytes / t.thresh).toFixed(1)} ${t.unit}` + return `${parseFloat((bytes / t.thresh).toFixed(1))} ${t.unit}` } } return `${bytes} B` } +function durationToSeconds(duration) { + const regex = /^(\d+)([smhd])$/ + const match = typeof duration === 'string' && duration.match(regex) + if (!match) { + return duration + } + + const value = parseInt(match[1], 10) + const unit = match[2] + + switch (unit) { + case 's': + return value + case 'm': + return value * 60 + case 'h': + return value * 3600 + case 'd': + return value * 86400 + } + + return duration // Fallback: return as-is +} + export { bytesToHuman, + durationToSeconds, }