shared

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

This package contains functions useful to two or more of the other binaries/pkgs.

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigDir = errors.New("config dir invalid or not set")

Functions

func FixQuery

func FixQuery(query, file string) string

FixQuery removes the file string from the beginning of the query. Some clients just append the query string, which results in query strings like this: `?file.gmi?username comment text`. This removes the file part.

func GetCommentsDir

func GetCommentsDir() string

func GetCommentsFile

func GetCommentsFile(file string) string

func GetConfigPath

func GetConfigPath() string

func GetLikesDir

func GetLikesDir() string

func GetQueryAndIP

func GetQueryAndIP() (string, string, error)

func GetTmpDir

func GetTmpDir() string

func HandleErr

func HandleErr(err error)

func IsFileValid

func IsFileValid(file string) bool

IsFileValid returns a true if that file is actionable. ie, it can be commented on and liked.

func PathEscape added in v1.0.2

func PathEscape(path string) string

func PathExists

func PathExists(path string) bool

func Respond

func Respond(gmi string)

func RespondError

func RespondError(reason string)

func RespondInput

func RespondInput(prompt string)

func SafeInit

func SafeInit() error

SafeInit makes sure all the required data directories are created. It can be called multiple times safely.

It should be called and checked before doing any other operation.

func SanitizeIP

func SanitizeIP(ip string) string

SanitizeIP makes IPs filename safe. It changes IPv6 colons to underscores.

Types

This section is empty.

Jump to

Keyboard shortcuts

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