render

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package render provides the file content rendering for the web server.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDownload = errors.New("cannot stat the downloaded file")
	ErrFilename = errors.New("file model filename is empty")
	ErrUUID     = errors.New("file model uuid is empty")
)

Functions

func DescriptorText added in v1.10.8

func DescriptorText(buf *bytes.Buffer, art *models.File, extra dir.Directory) error

DescriptorText (File ID - Description In ZIP) returns the content of archive file descriptor. Usually this brief summary text is named 'FILE_ID.DescriptorText' and is a legacy of the BBS era of file hosting.

The summary text can be used as a readme, preview, or viewed in the browser.

func Encoder

func Encoder(art *models.File, r io.Reader) encoding.Encoding

Encoder returns the encoding for the model file entry. Based on the platform and section. Otherwise it will attempt to determine the encoding from the file byte content.

func HelperText added in v1.10.8

func HelperText(buf *bytes.Buffer, art *models.File, extra dir.Directory) error

HelperText returns the content of a helper text file. These optional texts can be secondary NFOs, READMEs, or additional instructions.

func InformationText added in v1.9.13

func InformationText(buf, ruf *bytes.Buffer, sizeLimit int64, art *models.File, download, extra dir.Directory) error

InformationText writes the content of either the file download or an extracted text file to the buffers. The text is intended to be used as a readme, preview or an in-browser viewer.

Both the buf buffer and the ruf rune buffer are reset before writing.

func InsertPrefix added in v1.10.8

func InsertPrefix(p []byte, prefix []byte) []byte

InsertPrefix injects content before the existing byte content. This is usually to inject FILE_ID.DIZ text files.

func InsertSuffix added in v1.10.8

func InsertSuffix(p []byte, suffix []byte) []byte

InsertSuffix injects content after the existing byte content. This is usually to inject an additional helper text file.

func NoScreenshot

func NoScreenshot(art *models.File, previewPath string) bool

NoScreenshot returns true when the file entry should not attempt to display a screenshot. This is based on the platform, section or if the screenshot is missing on the server.

func Viewer

func Viewer(art *models.File) bool

Viewer returns true if the file entry should display the file download in the browser plain text viewer. The result is based on the platform and section such as "text" or "textamiga" will return true. If the filename is "file_id.diz" then it will return false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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