htmx

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Overview

Package htmx handles the routes and views for the AJAX responses using the htmx library.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCreators     = errors.New("invalid reset creators format")
	ErrDate         = errors.New("invalid reset date format")
	ErrDB           = errors.New("database connection is nil")
	ErrDir          = errors.New("cannot be a directory")
	ErrExist        = errors.New("file already exists")
	ErrFile         = errors.New("cannot be a file")
	ErrFileHead     = errors.New("file header is nil")
	ErrKey          = errors.New("numeric record key is invalid")
	ErrRoutes       = errors.New("echo instance is nil")
	ErrUploaderDest = errors.New("invalid uploader destination")
	ErrUploaderSave = errors.New("cannot save a file to the uploader destination")
	ErrUUID         = errors.New("invalid or an empty UUID")
)

Functions

func AdvancedSubmit

func AdvancedSubmit(c echo.Context, logger *zap.SugaredLogger, prod bool, downloadDir string) error

AdvancedSubmit is a handler for the /uploader/advanced route.

func DataListMagazines

func DataListMagazines(c echo.Context, logger *zap.SugaredLogger, input string) error

DataListMagazines is a handler for the /datalist/magazines route.

func DataListReleasers

func DataListReleasers(c echo.Context, logger *zap.SugaredLogger, input string) error

DataListReleasers is a handler for the /datalist/releasers route.

func DemozooProd

func DemozooProd(c echo.Context) error

DemozooProd fetches the multiple download_links values from the Demozoo production API and attempts to download and save one of the linked files. If multiple links are found, the first link is used as they should all point to the same asset.

Both the Demozoo production ID param and the Defacto2 UUID query param values are required as params to fetch the production data and to save the file to the correct filename.

func DemozooSubmit

func DemozooSubmit(c echo.Context, logger *zap.SugaredLogger) error

DemozooSubmit is the handler for the /demozoo/production/submit route. This will attempt to insert a new file record into the database using the Demozoo production ID. If the Demozoo production ID is already in use, an error message is returned.

func DemozooValid

func DemozooValid(c echo.Context, id int) (demozoo.Production, error)

DemozooValid fetches the first usable download link from the Demozoo API. The production ID is validated and the production is checked to see if it is suitable for Defacto2. If the production is not suitable, an empty production is returned with a htmx message.

func Duplicate

func Duplicate(logger *zap.SugaredLogger, uid uuid.UUID, srcPath, dstDir string)

Duplicate copies the chosen file to the destination directory. The UUID needs be provided as a unique identifier for the filename. The source path is the temporary file that was uploaded. The destination directory is where the file will be copied to.

func GlobTo

func GlobTo(name string) string

GlobTo returns the path to the template file.

func HumanizeAndCount

func HumanizeAndCount(c echo.Context, logger *zap.SugaredLogger, name string) error

HumanizeAndCount handles the post submission for the Uploader classification, such as the platform, operating system, section or category tags. The return value is either the humanized and counted classification or an error.

func ImageSubmit

func ImageSubmit(c echo.Context, logger *zap.SugaredLogger, prod bool, downloadDir string) error

ImageSubmit is a handler for the /uploader/image route.

func IntroSubmit

func IntroSubmit(c echo.Context, logger *zap.SugaredLogger, prod bool, downloadDir string) error

IntroSubmit is a handler for the /uploader/intro route.

func LookupSHA384

func LookupSHA384(c echo.Context, logger *zap.SugaredLogger) error

LookupSHA384 is a handler for the /uploader/sha384 route.

func MagazineSubmit

func MagazineSubmit(c echo.Context, logger *zap.SugaredLogger, prod bool, downloadDir string) error

MagazineSubmit is a handler for the /uploader/magazine route.

func PouetProd

func PouetProd(c echo.Context) error

PouetProd fetches the multiple download_links values from the Pouet production API and attempts to download and save one of the linked files. If multiple links are found, the first link is used as they should all point to the same asset.

Both the Pouet production ID param and the Defacto2 UUID query param values are required as params to fetch the production data and to save the file to the correct filename.

func PouetSubmit

func PouetSubmit(c echo.Context, logger *zap.SugaredLogger) error

PouetSubmit is the handler for the /pouet/production/submit route. This will attempt to insert a new file record into the database using the Pouet production ID. If the Pouet production ID is already in use, an error message is returned.

func PouetValid

func PouetValid(c echo.Context, id int) (pouet.Response, error)

PouetValid fetches the first usable download link from the Pouet API. The production ID is validated and the production is checked to see if it is suitable for Defacto2. If the production is not suitable, an empty production is returned with a htmx message.

func Record16Colors

func Record16Colors(c echo.Context) error

Record16Colors handles the post submission for the file artifact 16 Colors link.

func RecordClassification

func RecordClassification(c echo.Context, logger *zap.SugaredLogger) error

RecordClassification handles the post submission for the file artifact classifications, such as the platform, operating system, section or category tags. The return value is either the humanized and counted classification or an error.

func RecordComment

func RecordComment(c echo.Context) error

RecordComment handles the post submission for the file artifact comment.

func RecordCommentReset

func RecordCommentReset(c echo.Context) error

RecordCommentReset handles the post submission for the file artifact comment reset.

func RecordCreatorAudio

func RecordCreatorAudio(c echo.Context) error

RecordCreatorAudio handles the post submission for the file artifact creator musician.

func RecordCreatorIll

func RecordCreatorIll(c echo.Context) error

RecordCreatorIll handles the post submission for the file artifact creator illustrator.

func RecordCreatorProg

func RecordCreatorProg(c echo.Context) error

RecordCreatorProg handles the post submission for the file artifact creator programmer.

func RecordCreatorReset

func RecordCreatorReset(c echo.Context) error

RecordCreatorReset handles the post submission for the file artifact creators reset.

func RecordCreatorText

func RecordCreatorText(c echo.Context) error

RecordCreatorText handles the post submission for the file artifact creator text.

func RecordDateIssued

func RecordDateIssued(c echo.Context) error

RecordDateIssued handles the post submission for the file artifact date of release.

func RecordDateIssuedReset

func RecordDateIssuedReset(c echo.Context, elmID string) error

RecordDateIssuedReset handles the post submission for the file artifact date of release reset.

func RecordDemozoo

func RecordDemozoo(c echo.Context) error

RecordDemozoo handles the post submission for the file artifact Demozoo production link.

func RecordFilename

func RecordFilename(c echo.Context) error

RecordFilename handles the post submission for the file artifact filename.

func RecordFilenameReset

func RecordFilenameReset(c echo.Context) error

RecordFilenameReset handles the post submission for the file artifact filename reset.

func RecordGitHub

func RecordGitHub(c echo.Context) error

RecordGitHub handles the post submission for the file artifact GitHub repository link.

func RecordLinks(c echo.Context) error

RecordLinks handles the post submission for a form submission to provide the HTML formatted links for the "Links" section of the artifact editor.

func RecordPouet

func RecordPouet(c echo.Context) error

RecordPouet handles the post submission for the file artifact Pouet production link.

func RecordRelations

func RecordRelations(c echo.Context) error

RecordRelations handles the post submission for the file artifact releaser relationships.

func RecordReleasers

func RecordReleasers(c echo.Context) error

RecordReleasers handles the post submission for the file artifact releasers. It will only update the releaser1 and the releaser2 values if they have changed. The return value is either "Updated" or "Update" depending on if the values have changed.

func RecordReleasersReset

func RecordReleasersReset(c echo.Context) error

RecordReleasersReset handles the post submission for the file artifact releasers reset. It will always reset and save the releaser1 and the releaser2 values. The return value is always "Resetted" unless an error occurs.

func RecordSites

func RecordSites(c echo.Context) error

RecordSites handles the post submission for the file artifact website links.

func RecordTitle

func RecordTitle(c echo.Context) error

RecordTitle handles the post submission for the file artifact title.

func RecordTitleReset

func RecordTitleReset(c echo.Context) error

RecordTitleReset handles the post submission for the file artifact title reset.

func RecordToggle

func RecordToggle(c echo.Context, state bool) error

RecordToggle handles the post submission for the file artifact record toggle. The return value is either "online" or "offline" depending on the state.

func RecordVirusTotal

func RecordVirusTotal(c echo.Context) error

RecordVirusTotal handles the post submission for the file artifact VirusTotal report link.

func RecordYouTube

func RecordYouTube(c echo.Context) error

RecordYouTube handles the post submission for the file artifact YouTube watch video link.

func SearchReleaser

func SearchReleaser(c echo.Context, logger *zap.SugaredLogger) error

SearchReleaser is a handler for the /search/releaser route.

func Suggestion

func Suggestion(name, initialism string, count any) string

Suggestion returns a human readable string of the byte count with a named description.

func TemplateFuncMap

func TemplateFuncMap() template.FuncMap

TemplateFuncMap are a collection of mapped functions that can be used in a template.

func Templates

func Templates(fs embed.FS) map[string]*template.Template

Templates returns a map of the templates.

func TextSubmit

func TextSubmit(c echo.Context, logger *zap.SugaredLogger, prod bool, downloadDir string) error

TextSubmit is a handler for the /uploader/text route.

func TrainerSubmit

func TrainerSubmit(c echo.Context, logger *zap.SugaredLogger, prod bool, downloadDir string) error

TrainerSubmit is a handler for the /uploader/trainer route.

Types

This section is empty.

Jump to

Keyboard shortcuts

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