Documentation
¶
Index ¶
- Constants
- Variables
- func MigrateExistingDatabase(ctx context.Context, database *gorm.DB, databaseType string, ...) (err error)
- func ProviderToIcon(provider string) string
- func ProviderToLinkingText(provider string) string
- func RunMigrations(database *gorm.DB, databaseType string, databaseConnectionUrl string) (err error)
- func Sum[T any](slice []T, getValue func(T) int) int
- type AccountStats
- type Application
- type Config
- type FileStatsOutput
- type FilesApiInput
- type FilesApiOutput
- type LoginProvider
- type ProviderInfo
- type SessionTokenVerification
- type TagInput
Constants ¶
View Source
const ( AUTH_COOKIE = "auth" LINKING_COOKIE = "linking" )
View Source
const Version = "v0.4.0"
Variables ¶
View Source
var ErrCantDeleteSelf = fmt.Errorf("you can't delete yourself")
View Source
var ErrInvalidAuthCookie = errors.New("invalid session token")
View Source
var ErrInvalidDatabaseType = errors.New("invalid database type")
View Source
var ErrUnknownStorageMethod = errors.New("unknown file storage method")
Functions ¶
func MigrateExistingDatabase ¶
func MigrateExistingDatabase( ctx context.Context, database *gorm.DB, databaseType string, databaseConnectionUrl string, migrator migrate.RevisionReadWriter, sqlDB *sql.DB, dir *migrate.MemDir, ) (err error)
Temporary code to migrate from existing database from before migration system Can be dumped in the future
func ProviderToIcon ¶
func ProviderToLinkingText ¶
func RunMigrations ¶
Types ¶
type AccountStats ¶
type Application ¶
type Application struct {
RateLimiter *limiter.Limiter
Router *gin.Engine
// contains filtered or unexported fields
}
func InitializeApplication ¶
func InitializeApplication() *Application
func (*Application) CleanUpJob ¶
func (app *Application) CleanUpJob()
func (*Application) Run ¶
func (app *Application) Run()
func (*Application) Shutdown ¶
func (app *Application) Shutdown()
func (*Application) StartJobScheduler ¶
func (app *Application) StartJobScheduler()
type Config ¶
type Config struct {
DataFolder string `toml:"data_folder"`
MaxUploadSize int64 `toml:"max_upload_size"`
DatabaseType string `toml:"database_type"`
DatabaseConnectionUrl string `toml:"database_connection_url"`
Port int `toml:"port"`
UnixSocket string `toml:"unix_socket"`
BehindReverseProxy bool `toml:"behind_reverse_proxy"`
TrustedProxy string `toml:"trusted_proxy"`
PublicUrl string `toml:"public_url"` // URL to use for github callback and cookies, e.g http://cdn.example.com
CookieDomain string // hostname extracted from PublicUrl
CookieSecure bool // true when PublicUrl is https
Branding string `toml:"branding"` // Branding text for toolbar (max 20 characters)
Tagline string `toml:"tagline"` // Used for meta description and text on index page (max 100 characters)
FileStorageMethod fileStorageMethod
S3 s3Config `toml:"s3"`
}
type FileStatsOutput ¶
type FilesApiInput ¶
type FilesApiInput struct {
Skip uint `form:"skip,default=0"` // Used for pagination
Sort string `form:"sort,default=created_at"` // "created_at", "views", "file_size"
Desc bool `form:"desc,default=true"` // true for descending, false for ascending
Tag string `form:"tag"` // optional tag filter
Filter string `form:"filter"` // "untagged" for files without tags, "public" for public files, "private" for private files
}
type FilesApiOutput ¶
type LoginProvider ¶
type ProviderInfo ¶
type ProviderInfo struct {
Name string
Icon string // lucide-icon name, should probably be replaced with simpleicons.org when supporting more login platforms
LinkingText string // e.g., "Link with GitHub"
IsLinked bool // whether the account is linked to this provider
Username string // Used for displaying linked username
ProfileURL string // Profile URL if the provider supports it, e.g for github you can open your profile
}
type SessionTokenVerification ¶
type SessionTokenVerification struct {
SessionToken string `form:"token"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.