kaoriUtils

package module
v0.0.0-...-1aee6c4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: Apache-2.0 Imports: 25 Imported by: 8

Documentation

Index

Constants

View Source
const LittleBoxURI string = "https://litterbox.catbox.moe/resources/internals/api.php"
View Source
const UrlAnilist string = "https://anilist.co"

Variables

This section is empty.

Functions

func Base64toJpg

func Base64toJpg(data string) ([]byte, error)

Given a base64 string of a JPEG, encodes it into an JPEG image test.jpg

func Base64toMp3

func Base64toMp3(data string) ([]byte, error)

func Base64toPng

func Base64toPng(strcode string) ([]byte, error)

Converts pre-existing base64 data (found in example of https://golang.org/pkg/image/#Decode) to test.png

func CheckFiltersLogGet

func CheckFiltersLogGet(params []ParamsInfo, values map[string]interface{}) error

func CheckFiltersLogPost

func CheckFiltersLogPost(values map[string]interface{}) error

func CheckHash

func CheckHash(hash string) bool

func CheckImage

func CheckImage(data string) (err error)

CheckImage controlla se è un'immagine e se è nei formati gestibili dal server

func DateToUnix

func DateToUnix(date string) int64

func ExistUser

func ExistUser(db *kaoriDatabase.NoSqlDb, email string) bool

func FilterLog

func FilterLog(rows []string, filter string, filterValue string) (r []string, err error)

func GenerateID

func GenerateID() string

func GetCookies

func GetCookies(r *http.Request, tokenIss, cookieKey string) (map[string]string, error)

func GetIP

func GetIP(r *http.Request) string

Restituisce l'IP del client che ha effettuato la richiesta.

func GetParams

func GetParams(params []ParamsInfo, r *http.Request) (map[string]interface{}, error)

getParams ritorna i parametri inviati tramite metodo GET dell'HTTP request.

func HasContentType

func HasContentType(r *http.Request, mimetype string) bool

func IsEmailValid

func IsEmailValid(email string) bool

func Ls

func Ls(dir string) (files []string, err error)

Ls ritorna la path e il nome dei file presenti in una directory.

func ParseTemplate

func ParseTemplate(tmpl string, data interface{}) (string, error)

func ParseTemplateHtml

func ParseTemplateHtml(tmpl string, data interface{}) (string, error)

func PasswordValid

func PasswordValid(pws string) error

func PortValid

func PortValid(port string) error

func PrintErr

func PrintErr(w http.ResponseWriter, err string)

printErr ritorna un errore al client impostando a 400 lo status code della risposta HTTP.

func PrintInternalErr

func PrintInternalErr(w http.ResponseWriter)

printInternalErr imposta a 500 lo status code della risposta HTTP.

func PrintOk

func PrintOk(w http.ResponseWriter)

printOk ritorna scrive al client uno status code 200 per indicare che va tutto bene.

func SetCookies

func SetCookies(w http.ResponseWriter, token, tokenIss, cookieKey string) error

func UploadLittleBox

func UploadLittleBox(data []byte, nameFile string) (uri string, err error)

func ValidateIdAnilist

func ValidateIdAnilist(ida int, tipo string) bool

validateIdAnilist convalida l'id anilist, ritorna true se è corretto altrimenti false.

func VerifyAuth

func VerifyAuth(db *kaoriDatabase.NoSqlDb, email, password string) (bool, error)

Types

type ParamsInfo

type ParamsInfo struct {
	Key      string
	Required bool
}

Jump to

Keyboard shortcuts

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