diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/proxy.go | 17 |
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) +} |