util

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InlineContentTypes = []string{

	"text/css",
	"text/plain",
	"text/csv",
	"application/json",
	"application/ld+json",
	"image/jpeg",
	"image/gif",
	"image/png",
	"image/apng",
	"image/webp",
	"image/avif",
	"video/mp4",
	"video/webm",
	"video/ogg",
	"video/quicktime",
	"audio/mp4",
	"audio/webm",
	"audio/aac",
	"audio/mpeg",
	"audio/ogg",
	"audio/wave",
	"audio/wav",
	"audio/x-wav",
	"audio/x-pn-wav",
	"audio/flac",
	"audio/x-flac",
}

Functions

func ArrayContains

func ArrayContains(a []string, v string) bool

func CalcBlockForDuration

func CalcBlockForDuration(timeoutMs string) (time.Duration, error)

func CanInline

func CanInline(ct string) bool

func DecodeUnpaddedBase64String

func DecodeUnpaddedBase64String(val string) ([]byte, error)

func EncodeCanonicalJson

func EncodeCanonicalJson(obj map[string]interface{}) ([]byte, error)

func EncodeUnpaddedBase64ToString

func EncodeUnpaddedBase64ToString(val []byte) string

func ExtensionForContentType

func ExtensionForContentType(ct string) string

func FixContentType

func FixContentType(ct string) string

func FromMillis

func FromMillis(m int64) time.Time

func GenerateRandomString

func GenerateRandomString(nBytes int) (string, error)

func GetAccessTokenFromRequest

func GetAccessTokenFromRequest(request *http.Request) string

func GetAppserviceUserIdFromRequest

func GetAppserviceUserIdFromRequest(request *http.Request) string

func GetHourBucket

func GetHourBucket(ts int64) int64

func GetLogSafeQueryString

func GetLogSafeQueryString(r *http.Request) string

func GetLogSafeUrl

func GetLogSafeUrl(r *http.Request) string

func GetOurDomains

func GetOurDomains() []string

func HasAnyPrefix

func HasAnyPrefix(val string, prefixes []string) bool

func IsGlobalAdmin

func IsGlobalAdmin(userId string) bool

func IsHostIgnored

func IsHostIgnored(serverName string) bool

func IsServerOurs

func IsServerOurs(server string) bool

func MakeUrl

func MakeUrl(parts ...string) string

func MaxInt

func MaxInt(a int, b int) int

func MinFloat32

func MinFloat32(a float32, b float32) float32

func MinInt

func MinInt(a int, b int) int

func MxcUri

func MxcUri(origin string, mediaId string) string

func NowMillis

func NowMillis() int64

func SplitMxc

func SplitMxc(mxc string) (string, string, error)

func SplitUserId

func SplitUserId(userId string) (string, string, error)

func ToUtf8

func ToUtf8(text string, possibleContentType string) string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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