web

package
v0.0.0-...-7aaaf19 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Session_Account = "session_account"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(backendAddr string, sess *scs.SessionManager, logger *logrus.Logger) (*App, error)

func (*App) Delete

func (v *App) Delete(w http.ResponseWriter, r *http.Request)

func (*App) Download

func (v *App) Download(w http.ResponseWriter, r *http.Request)

func (*App) DownloadShare

func (v *App) DownloadShare(w http.ResponseWriter, r *http.Request)

func (*App) List

func (v *App) List(w http.ResponseWriter, r *http.Request)

func (*App) LoginService

func (v *App) LoginService(redirecURL string) http.HandlerFunc

redirect with http status 303

func (*App) RegisterService

func (v *App) RegisterService(redirectURL string) http.HandlerFunc

redirect with http status 303

func (*App) Run

func (app *App) Run(ctx context.Context, addr string, middlewares ...func(http.Handler) http.Handler) error

func (*App) ShareFile

func (v *App) ShareFile(publicDownloadPath string) http.HandlerFunc

func (*App) Upload

func (v *App) Upload(w http.ResponseWriter, r *http.Request)

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

wrap backend grpc api call

func (*Backend) BasicAuth

func (b *Backend) BasicAuth(ctx context.Context, username, password string) (*BasicAuthResponse, error)

func (*Backend) Delete

func (b *Backend) Delete(ctx context.Context, bucket, filename string) (*DeleteResponse, error)

func (*Backend) DownloadObject

func (b *Backend) DownloadObject(ctx context.Context, userID, filename string) (*GetObjectResult, error)

func (*Backend) DownloadWithToken

func (b *Backend) DownloadWithToken(ctx context.Context, shareToken string) (*GetObjectResult, error)

func (*Backend) Objects

func (b *Backend) Objects(ctx context.Context, userID, lastFilename string, limit int) (<-chan *Object, error)

func (*Backend) Register

func (b *Backend) Register(ctx context.Context, param RegisterParam) (*RegisterResult, error)

func (*Backend) ShareObject

func (b *Backend) ShareObject(ctx context.Context, bucket, filename string) (*SharedObject, error)

func (*Backend) UploadObject

func (b *Backend) UploadObject(ctx context.Context, bucket, filename, contentType string, size int64, body io.Reader) (*UploadResult, error)

type BasicAuthResponse

type BasicAuthResponse struct {
	Token  string
	UserID string
}

type DeleteResponse

type DeleteResponse struct {
	DeletedAt time.Time
}

type Filename

type Filename string

type GetObjectResult

type GetObjectResult struct {
	Filename    string
	ContentType string
	Size        int64
	Reader      io.ReadCloser
}

type Object

type Object struct {
	Bucket       string
	Filename     string
	Sum          string
	Size         int64
	LastModified time.Time
	ContentType  string
	// contains filtered or unexported fields
}

func (*Object) Err

func (o *Object) Err() error

type RegisterParam

type RegisterParam struct {
	Username string
	Password string
}

type RegisterResult

type RegisterResult struct {
	UserID   string
	Username string
}

type ShareToken

type ShareToken struct {
	Key        string
	ValidUntil time.Time
}

func (*ShareToken) IsExpired

func (st *ShareToken) IsExpired() bool

type SharedObject

type SharedObject struct {
	ShareToken string
	ValidUntil time.Time
}

type UploadResult

type UploadResult struct {
	Sum string
}

Directories

Path Synopsis
templ: version: v0.3.833
templ: version: v0.3.833

Jump to

Keyboard shortcuts

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