From a4c64444b2b3df780a7a23e65d24f03dc983a188 Mon Sep 17 00:00:00 2001 From: FChannel <=> Date: Sun, 17 Jan 2021 12:06:01 -0800 Subject: added go mod and config-init --- main.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index cda1f97..a1f55d8 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ var Domain = TP + "" + GetConfigValue("instance") var authReq = []string{"captcha","email","passphrase"} -var supportedFiles = []string{"image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/avif","image/apng","video/mp4","video/ogg","video/webm","audio/mpeg","audio/ogg","audio/wav"} +var supportedFiles = []string{"image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/avif","image/apng","video/mp4","video/ogg","video/webm","audio/mpeg","audio/ogg","audio/wav", "audio/wave", "audio/x-wav"} var SiteEmail string //contact@fchan.xyz var SiteEmailPassword string @@ -389,6 +389,17 @@ func CreateTripCode(input string) string { return out.String() } +func CreateNameTripCode(input string) string { + fmt.Println("AHHHHHHHHHH") + re := regexp.MustCompile("#.+") + chunck := re.FindString(input) + fmt.Println(input) + fmt.Println(chunck) + hash := CreateTripCode(chunck) + fmt.Println(hash[0:8]) + return re.ReplaceAllString(input, hash[0:8]) +} + func GetActorFromPath(db *sql.DB, location string, prefix string) Actor { pattern := fmt.Sprintf("%s([^/\n]+)(/.+)?", prefix) re := regexp.MustCompile(pattern) @@ -426,7 +437,7 @@ func GetContentType(location string) string { func RandomID(size int) string { rand.Seed(time.Now().UnixNano()) - domain := "0123456789ABCDEF" + domain := "0123456789ABCDEFG" rng := size newID := "" for i := 0; i < rng; i++ { @@ -1009,3 +1020,5 @@ func IsInStringArray(array []string, value string) bool { } return false } + + -- cgit v1.2.3