feat: add file management and branding
Release / deploy (push) Successful in 2m26s

This commit is contained in:
loveuer
2026-09-10 20:40:57 -07:00
parent 8ca8341d7c
commit 3907410354
9 changed files with 209 additions and 36 deletions
+16 -11
View File
@@ -7,6 +7,7 @@ type User struct {
Username string `gorm:"uniqueIndex;size:32;not null" json:"username"`
PasswordHash string `json:"-"`
CanManageUsers bool `json:"canManageUsers"`
CanManageFiles bool `json:"canManageFiles"`
CanUpload bool `json:"canUpload"`
CanAdvancedUpload bool `json:"canAdvancedUpload"`
MustChangePassword bool `json:"mustChangePassword"`
@@ -41,22 +42,26 @@ type SharedFile struct {
func (f SharedFile) HasPickupCode() bool { return f.PickupCodeHash != "" }
type fileResponse struct {
ID uint `json:"id"`
Hash string `json:"hash"`
Name string `json:"name"`
MimeType string `json:"mimeType"`
Size int64 `json:"size"`
ExpiresAt *time.Time `json:"expiresAt"`
MaxDownloads *int `json:"maxDownloads"`
DownloadCount int `json:"downloadCount"`
HasPickupCode bool `json:"hasPickupCode"`
CreatedAt time.Time `json:"createdAt"`
ID uint `json:"id"`
Hash string `json:"hash"`
Name string `json:"name"`
MimeType string `json:"mimeType"`
Size int64 `json:"size"`
ExpiresAt *time.Time `json:"expiresAt"`
MaxDownloads *int `json:"maxDownloads"`
DownloadCount int `json:"downloadCount"`
OwnerID uint `json:"ownerId"`
OwnerUsername string `json:"ownerUsername,omitempty"`
HasPickupCode bool `json:"hasPickupCode"`
FailedCodeAttempts int `json:"failedCodeAttempts"`
CreatedAt time.Time `json:"createdAt"`
}
func presentFile(f SharedFile) fileResponse {
return fileResponse{
ID: f.ID, Hash: f.Hash, Name: f.OriginalName, MimeType: f.MimeType,
Size: f.Size, ExpiresAt: f.ExpiresAt, MaxDownloads: f.MaxDownloads,
DownloadCount: f.DownloadCount, HasPickupCode: f.HasPickupCode(), CreatedAt: f.CreatedAt,
DownloadCount: f.DownloadCount, OwnerID: f.OwnerID, HasPickupCode: f.HasPickupCode(),
FailedCodeAttempts: f.FailedCodeAttempts, CreatedAt: f.CreatedAt,
}
}