render

package
v1.9.13 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 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 DescriptionInZIP added in v1.9.13

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

DescriptionInZIP returns the content of the description in archive file. Usually this brief summary text is named 'file_id.diz' 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 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 InsertDiz added in v1.5.1

func InsertDiz(b []byte, diz []byte) []byte

InsertDiz inserts the FILE_ID.DIZ content into the existing byte content.

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