aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-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)
+}