30 lines
583 B
Go
30 lines
583 B
Go
package server
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"uncensored-send/internal/config"
|
|
"uncensored-send/internal/store"
|
|
)
|
|
|
|
type preview struct {
|
|
Description string
|
|
Author string
|
|
URL string
|
|
}
|
|
|
|
func objectPreview(m *store.Meta, url string) *preview {
|
|
facts := []string{config.FormatBytes(m.Size)}
|
|
if m.Owner != "" {
|
|
facts = append(facts, "uploaded by "+m.Owner)
|
|
}
|
|
if m.Expires != nil {
|
|
facts = append(facts, "expires "+absolute(m.Expires))
|
|
}
|
|
return &preview{
|
|
Description: strings.Join(facts, ", ") + ". Open the page to download it.",
|
|
Author: m.Owner,
|
|
URL: url,
|
|
}
|
|
}
|