models

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiKey

type ApiKey struct {
	Id             string `json:"Id"`
	FriendlyName   string `json:"FriendlyName"`
	LastUsed       int64  `json:"LastUsed"`
	LastUsedString string `json:"LastUsedString"`
}

ApiKey contains data of a single api key

type AuthenticationConfig

type AuthenticationConfig struct {
	Method            int      `json:"Method"`
	SaltAdmin         string   `json:"SaltAdmin"`
	SaltFiles         string   `json:"SaltFiles"`
	Username          string   `json:"Username"`
	Password          string   `json:"Password"`
	HeaderKey         string   `json:"HeaderKey"`
	OauthProvider     string   `json:"OauthProvider"`
	OAuthClientId     string   `json:"OAuthClientId"`
	OAuthClientSecret string   `json:"OAuthClientSecret"`
	HeaderUsers       []string `json:"HeaderUsers"`
	OauthUsers        []string `json:"OauthUsers"`
}

AuthenticationConfig holds configuration on how to authenticate to Gokapi admin menu

type AwsConfig

type AwsConfig struct {
	Bucket    string `yaml:"Bucket"`
	Region    string `yaml:"Region"`
	KeyId     string `yaml:"KeyId"`
	KeySecret string `yaml:"KeySecret"`
	Endpoint  string `yaml:"Endpoint"`
}

AwsConfig contains all configuration values / credentials for AWS cloud storage

func (*AwsConfig) IsAllProvided

func (c *AwsConfig) IsAllProvided() bool

IsAllProvided returns true if all required variables have been set for using AWS S3 / Backblaze

type Configuration

type Configuration struct {
	Authentication      AuthenticationConfig `json:"Authentication"`
	Port                string               `json:"Port"`
	ServerUrl           string               `json:"ServerUrl"`
	RedirectUrl         string               `json:"RedirectUrl"`
	ConfigVersion       int                  `json:"ConfigVersion"`
	LengthId            int                  `json:"LengthId"`
	DataDir             string               `json:"DataDir"`
	MaxMemory           int                  `json:"MaxMemory"`
	UseSsl              bool                 `json:"UseSsl"`
	MaxFileSizeMB       int                  `json:"MaxFileSizeMB"`
	Encryption          Encryption           `json:"Encryption"`
	PicturesAlwaysLocal bool                 `json:"PicturesAlwaysLocal"`
}

Configuration is a struct that contains the global configuration

func (Configuration) ToJson

func (c Configuration) ToJson() []byte

ToJson returns an idented JSon representation

func (Configuration) ToString

func (c Configuration) ToString() string

ToString returns the object as an unidented Json string used for test units

type DownloadStatus

type DownloadStatus struct {
	Id       string
	FileId   string
	ExpireAt int64
}

DownloadStatus contains current downloads, so they do not get removed during cleanup

type E2EFile added in v1.6.0

type E2EFile struct {
	Uuid     string `json:"uuid"`
	Id       string `json:"id"`
	Filename string `json:"filename"`
	Cipher   []byte `json:"cipher"`
}

E2EFile contains information about a stored e2e file

type E2EHashContent added in v1.6.0

type E2EHashContent struct {
	Filename string `json:"f"`
	Cipher   string `json:"c"`
}

E2EHashContent contains the info that is added after the hash for an e2e link

type E2EInfoEncrypted added in v1.6.0

type E2EInfoEncrypted struct {
	Version        int      `json:"version"`
	Nonce          []byte   `json:"nonce"`
	Content        []byte   `json:"content"`
	AvailableFiles []string `json:"availablefiles"`
}

E2EInfoEncrypted is the struct that is stored on the server and decrypted locally

func (*E2EInfoEncrypted) HasBeenSetUp added in v1.6.0

func (e *E2EInfoEncrypted) HasBeenSetUp() bool

HasBeenSetUp returns true if E2E setup has been run

type E2EInfoPlainText added in v1.6.0

type E2EInfoPlainText struct {
	Files []E2EFile `json:"files"`
}

E2EInfoPlainText is stored locally and will be encrypted before storing on server

type Encryption

type Encryption struct {
	Level        int
	Cipher       []byte
	Salt         string
	Checksum     string
	ChecksumSalt string
}

Encryption hold information about the encryption used on this file

type EncryptionInfo

type EncryptionInfo struct {
	IsEncrypted         bool   `json:"IsEncrypted"`
	IsEndToEndEncrypted bool   `json:"IsEndToEndEncrypted"`
	DecryptionKey       []byte `json:"DecryptionKey"`
	Nonce               []byte `json:"Nonce"`
}

EncryptionInfo holds information about the encryption used on the file

type File

type File struct {
	Id                 string         `json:"Id"`
	Name               string         `json:"Name"`
	Size               string         `json:"Size"`
	SHA1               string         `json:"SHA1"`
	ExpireAt           int64          `json:"ExpireAt"`
	ExpireAtString     string         `json:"ExpireAtString"`
	DownloadsRemaining int            `json:"DownloadsRemaining"`
	DownloadCount      int            `json:"DownloadCount"`
	PasswordHash       string         `json:"PasswordHash"`
	HotlinkId          string         `json:"HotlinkId"`
	ContentType        string         `json:"ContentType"`
	AwsBucket          string         `json:"AwsBucket"`
	Encryption         EncryptionInfo `json:"Encryption"`
	UnlimitedDownloads bool           `json:"UnlimitedDownloads"`
	UnlimitedTime      bool           `json:"UnlimitedTime"`
}

File is a struct used for saving information about an uploaded file

func (*File) IsLocalStorage added in v1.6.0

func (f *File) IsLocalStorage() bool

IsLocalStorage returns true if the file is not stored on a remote storage

func (*File) ToFileApiOutput added in v1.6.0

func (f *File) ToFileApiOutput(isClientSideDecryption bool) (FileApiOutput, error)

ToFileApiOutput returns a json object without sensitive information

func (*File) ToJsonResult

func (f *File) ToJsonResult(serverUrl string, isClientSideDecryption bool) string

ToJsonResult converts the file info to a json String used for returning a result for an upload

type FileApiOutput added in v1.6.0

type FileApiOutput struct {
	Id                           string `json:"Id"`
	Name                         string `json:"Name"`
	Size                         string `json:"Size"`
	HotlinkId                    string `json:"HotlinkId"`
	ContentType                  string `json:"ContentType"`
	ExpireAt                     int64  `json:"ExpireAt"`
	ExpireAtString               string `json:"ExpireAtString"`
	DownloadsRemaining           int    `json:"DownloadsRemaining"`
	DownloadCount                int    `json:"DownloadCount"`
	UnlimitedDownloads           bool   `json:"UnlimitedDownloads"`
	UnlimitedTime                bool   `json:"UnlimitedTime"`
	RequiresClientSideDecryption bool   `json:"RequiresClientSideDecryption"`
	IsEncrypted                  bool   `json:"IsEncrypted"`
	IsPasswordProtected          bool   `json:"IsPasswordProtected"`
	IsSavedOnLocalStorage        bool   `json:"IsSavedOnLocalStorage"`
}

FileApiOutput will be displayed for public outputs from the ID, hiding sensitive information

type LastUploadValues

type LastUploadValues struct {
	Downloads         int
	TimeExpiry        int
	Password          string
	UnlimitedDownload bool
	UnlimitedTime     bool
}

LastUploadValues is used to save the last used values for uploads in the database

type Result

type Result struct {
	Result            string        `json:"Result"`
	FileInfo          FileApiOutput `json:"FileInfo"`
	Url               string        `json:"Url"`
	HotlinkUrl        string        `json:"HotlinkUrl"`
	GenericHotlinkUrl string        `json:"GenericHotlinkUrl"`
}

Result is the struct used for the result after an upload swagger:model UploadResult

type Session

type Session struct {
	RenewAt    int64
	ValidUntil int64
}

Session contains cookie parameter

type UploadRequest

type UploadRequest struct {
	AllowedDownloads    int
	Expiry              int
	ExpiryTimestamp     int64
	Password            string
	ExternalUrl         string
	MaxMemory           int
	UnlimitedDownload   bool
	UnlimitedTime       bool
	IsEndToEndEncrypted bool
	RealSize            int64
}

UploadRequest is used to set an upload request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL