aboutsummaryrefslogtreecommitdiff
path: root/util/proxy.go
diff options
context:
space:
mode:
authorFChannel <>2022-05-02 12:44:41 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit1ee6552559141dd5dba91abec7c81d68c56abda0 (patch)
tree4ac21571a27980e8ebf83a065c270b36cc3ecfd6 /util/proxy.go
parent733f911fadc872933481bcbe087d519ce00372df (diff)
removed all unneeded .go files from root directory
Diffstat (limited to 'util/proxy.go')
-rw-r--r--util/proxy.go17
1 files changed, 17 insertions, 0 deletions
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)
+}