Documentation ¶
Overview ¶
Package htmx handles the routes and views for the AJAX responses using the htmx library.
Index ¶
- Variables
- func AdvancedSubmit(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string) error
- func DBConnections(c echo.Context, db *sql.DB) error
- func DataListMagazines(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, input string) error
- func DataListReleasers(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, input string) error
- func DeleteForever(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, id string) error
- func DemozooLookup(c echo.Context, db *sql.DB) error
- func DemozooSubmit(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string) error
- func DemozooValid(c echo.Context, id int) (demozoo.Production, error)
- func Duplicate(logger *zap.SugaredLogger, uid uuid.UUID, srcPath, dstDir string)
- func GlobTo(name string) string
- func HumanizeCount(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, name string) error
- func ImageSubmit(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string) error
- func IntroSubmit(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string) error
- func LookupSHA384(c echo.Context, db *sql.DB, logger *zap.SugaredLogger) error
- func MagazineSubmit(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string) error
- func Pings(c echo.Context, proto string, port int) error
- func PouetLookup(c echo.Context, db *sql.DB) error
- func PouetSubmit(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string) error
- func PouetValid(c echo.Context, id int, useCache bool) (pouet.Response, error)
- func Record16Colors(c echo.Context, db *sql.DB) error
- func RecordClassification(c echo.Context, db *sql.DB, logger *zap.SugaredLogger) error
- func RecordComment(c echo.Context, db *sql.DB) error
- func RecordCommentReset(c echo.Context, db *sql.DB) error
- func RecordCreatorAudio(c echo.Context, db *sql.DB) error
- func RecordCreatorIll(c echo.Context, db *sql.DB) error
- func RecordCreatorProg(c echo.Context, db *sql.DB) error
- func RecordCreatorReset(c echo.Context, db *sql.DB) error
- func RecordCreatorText(c echo.Context, db *sql.DB) error
- func RecordDateIssued(c echo.Context, db *sql.DB) error
- func RecordDateIssuedReset(c echo.Context, db *sql.DB, elmID string) error
- func RecordDemozoo(c echo.Context, db *sql.DB) error
- func RecordEmulateBroken(c echo.Context, db *sql.DB) error
- func RecordEmulateCPU(c echo.Context, db *sql.DB) error
- func RecordEmulateEMS(c echo.Context, db *sql.DB) error
- func RecordEmulateMachine(c echo.Context, db *sql.DB) error
- func RecordEmulateRunProgram(c echo.Context, db *sql.DB) error
- func RecordEmulateSFX(c echo.Context, db *sql.DB) error
- func RecordEmulateUMB(c echo.Context, db *sql.DB) error
- func RecordEmulateXMS(c echo.Context, db *sql.DB) error
- func RecordFilename(c echo.Context, db *sql.DB) error
- func RecordFilenameReset(c echo.Context, db *sql.DB) error
- func RecordGitHub(c echo.Context, db *sql.DB) error
- func RecordImageCopier(c echo.Context, debug *zap.SugaredLogger, dirs command.Dirs) error
- func RecordImageCropper(c echo.Context, crop command.Crop, dirs command.Dirs) error
- func RecordImagePixelator(c echo.Context, dirs ...string) error
- func RecordImagesDeleter(c echo.Context, dirs ...string) error
- func RecordLinks(c echo.Context) error
- func RecordLinksReset(c echo.Context, db *sql.DB) error
- func RecordPouet(c echo.Context, db *sql.DB) error
- func RecordReadmeCopier(c echo.Context, extraDir string) error
- func RecordReadmeDeleter(c echo.Context, extraDir string) error
- func RecordReadmeImager(c echo.Context, logger *zap.SugaredLogger, dirs command.Dirs) error
- func RecordRelations(c echo.Context, db *sql.DB) error
- func RecordReleasers(c echo.Context, db *sql.DB) error
- func RecordReleasersReset(c echo.Context, db *sql.DB) error
- func RecordSites(c echo.Context, db *sql.DB) error
- func RecordThumb(c echo.Context, thumb command.Thumb, dirs command.Dirs) error
- func RecordThumbAlignment(c echo.Context, align command.Align, dirs command.Dirs) error
- func RecordTitle(c echo.Context, db *sql.DB) error
- func RecordTitleReset(c echo.Context, db *sql.DB) error
- func RecordToggle(c echo.Context, db *sql.DB, state bool) error
- func RecordToggleByID(c echo.Context, db *sql.DB, key string, state bool) error
- func RecordVirusTotal(c echo.Context, db *sql.DB) error
- func RecordYouTube(c echo.Context, db *sql.DB) error
- func SearchByID(c echo.Context, db *sql.DB, logger *zap.SugaredLogger) error
- func SearchReleaser(c echo.Context, db *sql.DB, logger *zap.SugaredLogger) error
- func Suggestion(name, initialism string, count any) string
- func TemplateFuncMap() template.FuncMap
- func Templates(fs embed.FS) map[string]*template.Template
- func TextSubmit(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string) error
- func TrainerSubmit(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string) error
- func UploadPreview(c echo.Context, previewDir, thumbnailDir string) error
- func UploadReplacement(c echo.Context, db *sql.DB, downloadDir string) error
- type Submission
Constants ¶
This section is empty.
Variables ¶
var ( ErrIsDir = errors.New("the file is a directory") ErrYT = errors.New("youtube watch video id needs to be empty or 11 characters") )
var ( ErrDB = errors.New("database connection is nil") ErrFormat = errors.New("invalid format") ErrKey = errors.New("numeric record key is invalid") )
Functions ¶
func AdvancedSubmit ¶
func AdvancedSubmit(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string) error
AdvancedSubmit is a handler for the /uploader/advanced route.
func DBConnections ¶ added in v0.8.0
DBConnections is the handler for the database connections page.
func DataListMagazines ¶
DataListMagazines is a handler for the /datalist/magazines route.
func DataListReleasers ¶
DataListReleasers is a handler for the /datalist/releasers route.
func DeleteForever ¶ added in v0.8.0
DeleteForever is a handler for the /delete/forever route.
func DemozooLookup ¶ added in v0.10.0
DemozooLookup is the handler for the /demozoo/production route. This looks up the Demozoo production ID and returns a form button to submit the ID to the server for processing. If the Demozoo production ID is already in use, an error message is returned.
func DemozooSubmit ¶
DemozooSubmit is the handler for the /demozoo/production put 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 looks up the Demozoo production ID and confirms that the production is suitable for Defacto2. If a production is not suitable, an message is returned.
A valid production requires at least one download link and must be a suitable type such as an intro, demo or cracktro for MS-DOS, Windows etc.
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 HumanizeCount ¶ added in v0.10.0
HumanizeCount 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 ¶
ImageSubmit is a handler for the /uploader/image route.
func IntroSubmit ¶
IntroSubmit is a handler for the /uploader/intro route.
func LookupSHA384 ¶
func LookupSHA384(c echo.Context, db *sql.DB, logger *zap.SugaredLogger) error
LookupSHA384 is a handler for the /uploader/sha384 route.
func MagazineSubmit ¶
func MagazineSubmit(c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string) error
MagazineSubmit is a handler for the /uploader/magazine route.
func PouetLookup ¶ added in v0.10.0
PouetLookup 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 ¶
PouetSubmit is the handler for the /pouet/production PUT 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 ¶
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 ¶
Record16Colors handles the post submission for the file artifact 16 Colors link.
func RecordClassification ¶
func RecordClassification(c echo.Context, db *sql.DB, 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 ¶
RecordComment handles the post submission for the file artifact comment.
func RecordCommentReset ¶
RecordCommentReset handles the post submission for the file artifact comment reset.
func RecordCreatorAudio ¶
RecordCreatorAudio handles the post submission for the file artifact creator musician.
func RecordCreatorIll ¶
RecordCreatorIll handles the post submission for the file artifact creator illustrator.
func RecordCreatorProg ¶
RecordCreatorProg handles the post submission for the file artifact creator programmer.
func RecordCreatorReset ¶
RecordCreatorReset handles the post submission for the file artifact creators reset.
func RecordCreatorText ¶
RecordCreatorText handles the post submission for the file artifact creator text.
func RecordDateIssued ¶
RecordDateIssued handles the post submission for the file artifact date of release.
func RecordDateIssuedReset ¶
RecordDateIssuedReset handles the post submission for the file artifact date of release reset.
func RecordDemozoo ¶
RecordDemozoo handles the post submission for the file artifact Demozoo production link.
func RecordEmulateBroken ¶ added in v0.10.0
RecordEmulateBroken handles the patch submission for the broken emulation for a file artifact.
func RecordEmulateCPU ¶ added in v0.10.0
RecordEmulateCPU handles the patch submission for the CPU emulation for a file artifact.
func RecordEmulateEMS ¶ added in v0.10.0
func RecordEmulateMachine ¶ added in v0.10.0
RecordEmulateMachine handles the patch submission for the machine and graphic emulation for a file artifact.
func RecordEmulateRunProgram ¶ added in v0.10.0
RecordEmulateRunProgram handles the patch submission for the run program emulation.
func RecordEmulateSFX ¶ added in v0.10.0
RecordEmulateSFX handles the patch submission for the audio emulation for a file artifact.
func RecordEmulateUMB ¶ added in v0.10.0
func RecordEmulateXMS ¶ added in v0.10.0
func RecordFilename ¶
RecordFilename handles the post submission for the file artifact filename.
func RecordFilenameReset ¶
RecordFilenameReset handles the post submission for the file artifact filename reset.
func RecordGitHub ¶
RecordGitHub handles the post submission for the file artifact GitHub repository link.
func RecordImageCopier ¶ added in v0.10.0
func RecordImageCopier(c echo.Context, debug *zap.SugaredLogger, dirs command.Dirs) error
func RecordImageCropper ¶ added in v0.10.0
func RecordImagePixelator ¶ added in v0.10.0
func RecordImagesDeleter ¶ added in v0.10.0
func RecordLinks ¶
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 RecordLinksReset ¶ added in v0.8.0
RecordLinksReset handles the post submission for the file artifact links reset.
func RecordPouet ¶
RecordPouet handles the post submission for the file artifact Pouet production link.
func RecordReadmeCopier ¶ added in v0.10.0
func RecordReadmeDeleter ¶ added in v0.10.0
func RecordReadmeImager ¶ added in v0.10.0
func RecordReadmeImager(c echo.Context, logger *zap.SugaredLogger, dirs command.Dirs) error
func RecordRelations ¶
RecordRelations handles the post submission for the file artifact releaser relationships.
func RecordReleasers ¶
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 ¶
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 ¶
RecordSites handles the post submission for the file artifact website links.
func RecordThumb ¶ added in v0.10.0
func RecordThumbAlignment ¶ added in v0.10.0
func RecordTitle ¶
RecordTitle handles the post submission for the file artifact title.
func RecordTitleReset ¶
RecordTitleReset handles the post submission for the file artifact title reset.
func RecordToggle ¶
RecordToggle handles the post submission for the file artifact record toggle. The return value is either "online" or "offline" depending on the state.
func RecordToggleByID ¶ added in v0.8.0
RecordToggle handles the post submission for the file artifact record toggle. The key string is converted into an integer and used as the artifact id. The return value is either "online" or "offline" depending on the state.
func RecordVirusTotal ¶
RecordVirusTotal handles the post submission for the file artifact VirusTotal report link.
func RecordYouTube ¶
RecordYouTube handles the post submission for the file artifact YouTube watch video link.
func SearchByID ¶ added in v0.8.0
func SearchByID(c echo.Context, db *sql.DB, logger *zap.SugaredLogger) error
SearchByID is a handler for the /editor/search/id route.
func SearchReleaser ¶
func SearchReleaser(c echo.Context, db *sql.DB, logger *zap.SugaredLogger) error
SearchReleaser is a handler for the /search/releaser route.
func Suggestion ¶
Suggestion returns a human readable string of the byte count with a named description.
func TemplateFuncMap ¶
TemplateFuncMap are a collection of mapped functions that can be used in a template.
func TextSubmit ¶
TextSubmit is a handler for the /uploader/text route.
func TrainerSubmit ¶
TrainerSubmit is a handler for the /uploader/trainer route.
func UploadPreview ¶ added in v0.10.0
func UploadReplacement ¶ added in v0.10.0
UploadReplacement is the file transfer handler that uploads, validates a new file upload and updates the existing artifact record with the new file information. The logger is optional and if nil then the function will not log any debug information.
Types ¶
type Submission ¶ added in v0.10.0
type Submission int
const ( Demozoo Submission = iota Pouet )
func (Submission) String ¶ added in v0.10.0
func (prod Submission) String() string
func (Submission) Submit ¶ added in v0.10.0
func (prod Submission) Submit( c echo.Context, db *sql.DB, logger *zap.SugaredLogger, downloadDir string, ) error