diff options
author | FChannel <> | 2021-07-31 17:20:36 -0700 |
---|---|---|
committer | FChannel <> | 2021-07-31 17:20:36 -0700 |
commit | ca7a516f878bba8ab62ffda596ba603b26250917 (patch) | |
tree | bde29eb873b9a744c618d877292eb4951e6d8065 | |
parent | c2184d6add23d9b0ca44dbbc5d026ab4f482dceb (diff) |
changed timeout time for requests
-rw-r--r-- | main.go | 8 | ||||
-rw-r--r-- | static/ncatalog.html | 2 | ||||
-rw-r--r-- | static/posts.html | 2 |
3 files changed, 8 insertions, 4 deletions
@@ -2590,7 +2590,7 @@ func RouteProxy(req *http.Request) (*http.Response, error) { CheckError(err, "error parsing tor proxy url") proxyTransport := &http.Transport{Proxy: http.ProxyURL(proxyUrl)} - client := &http.Client{ Transport: proxyTransport, Timeout: time.Second * 30 } + client := &http.Client{ Transport: proxyTransport, Timeout: time.Second * 10 } return client.Do(req) } @@ -2834,7 +2834,11 @@ func RouteImages(w http.ResponseWriter, media string) { CheckError(err, "error with Route Images req") - resp, err := http.DefaultClient.Do(req) + client := http.Client{ + Timeout: 5 * time.Second, + } + + resp, err := client.Do(req) if err != nil || resp.StatusCode == 404 { fileBytes, err := ioutil.ReadFile("./static/notfound.png") diff --git a/static/ncatalog.html b/static/ncatalog.html index c51a5a3..e35edd0 100644 --- a/static/ncatalog.html +++ b/static/ncatalog.html @@ -46,7 +46,7 @@ <script> media = document.getElementById("media-{{ .Id }}") - if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || ({{ isOnion .Id }} && !{{ isOnion $board.Domain }}){ + if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || ({{ isOnion .Id }} && !{{ isOnion $board.Domain }})){ sensitive = document.getElementById("sensitive-{{ .Id }}") hide = document.getElementById("hide-{{ .Id }}") sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"} diff --git a/static/posts.html b/static/posts.html index c4f19d8..50d8b43 100644 --- a/static/posts.html +++ b/static/posts.html @@ -24,7 +24,7 @@ <div id="media-{{ .Id }}">{{ parseAttachment . false }}</div> <script> media = document.getElementById("media-{{ .Id }}") - if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || {{ isOnion .Id }} && !{{ isOnion $board.Domain }}){ + if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || ({{ isOnion .Id }} && !{{ isOnion $board.Domain }})){ sensitive = document.getElementById("sensitive-{{ .Id }}") hide = document.getElementById("hide-{{ .Id }}") sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"} |