mirror of
https://code.rocketnine.space/tslocum/gmitohtml.git
synced 2024-11-27 14:38:14 +01:00
Fix connection issue affecting some sites
This commit is contained in:
parent
f933e9dd1b
commit
a23ad13fd8
2 changed files with 48 additions and 39 deletions
|
@ -1,5 +1,9 @@
|
||||||
1.0.4:
|
1.0.5:
|
||||||
- Add option ConvertImages (thanks to @f)
|
- Add option ConvertImages (thanks to @f)
|
||||||
|
- Fix connection issue affecting some sites
|
||||||
|
|
||||||
|
1.0.4:
|
||||||
|
- Migrate to code.rocketnine.space
|
||||||
|
|
||||||
1.0.3:
|
1.0.3:
|
||||||
- Add hostname option
|
- Add hostname option
|
||||||
|
|
|
@ -22,7 +22,14 @@ var assetLock sync.Mutex
|
||||||
var imageExtensions = []string{"png", "jpg", "jpeg", "gif", "svg", "webp"}
|
var imageExtensions = []string{"png", "jpg", "jpeg", "gif", "svg", "webp"}
|
||||||
|
|
||||||
func rewriteURL(u string, loc *url.URL) string {
|
func rewriteURL(u string, loc *url.URL) string {
|
||||||
if daemonAddress != "" {
|
if daemonAddress == "" {
|
||||||
|
return u
|
||||||
|
}
|
||||||
|
|
||||||
|
if loc.Path == "" {
|
||||||
|
loc.Path = "/"
|
||||||
|
}
|
||||||
|
|
||||||
scheme := "gemini"
|
scheme := "gemini"
|
||||||
if strings.HasPrefix(loc.Path, "/file/") {
|
if strings.HasPrefix(loc.Path, "/file/") {
|
||||||
scheme = "file"
|
scheme = "file"
|
||||||
|
@ -60,8 +67,6 @@ func rewriteURL(u string, loc *url.URL) string {
|
||||||
}
|
}
|
||||||
return "http://" + daemonAddress + "/" + scheme + "/" + u
|
return "http://" + daemonAddress + "/" + scheme + "/" + u
|
||||||
}
|
}
|
||||||
return u
|
|
||||||
}
|
|
||||||
|
|
||||||
func newPage() []byte {
|
func newPage() []byte {
|
||||||
data := []byte(pageHeader)
|
data := []byte(pageHeader)
|
||||||
|
|
Loading…
Reference in a new issue