From 1ee6552559141dd5dba91abec7c81d68c56abda0 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Mon, 2 May 2022 12:44:41 -0700 Subject: removed all unneeded .go files from root directory --- util/proxy.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'util') diff --git a/util/proxy.go b/util/proxy.go index 1fc9b03..0f4a648 100644 --- a/util/proxy.go +++ b/util/proxy.go @@ -37,3 +37,20 @@ func GetPathProxyType(path string) string { return "clearnet" } + +func MediaProxy(url string) string { + re := regexp.MustCompile("(.+)?" + config.Domain + "(.+)?") + + if re.MatchString(url) { + return url + } + + re = regexp.MustCompile("(.+)?\\.onion(.+)?") + + if re.MatchString(url) { + return url + } + + config.MediaHashs[HashMedia(url)] = url + return "/api/media?hash=" + HashMedia(url) +} -- cgit v1.2.3