mirror of
https://github.com/makew0rld/amfora.git
synced 2024-12-04 14:46:29 -05:00
✨ Proxy support
This commit is contained in:
parent
11c3b1fec9
commit
164ed98588
@ -97,6 +97,9 @@ Features in *italics* are in the master branch, but not in the latest release.
|
|||||||
- [x] Theming
|
- [x] Theming
|
||||||
- [x] *Emoji favicons*
|
- [x] *Emoji favicons*
|
||||||
- See `gemini://mozz.us/files/rfc_gemini_favicon.gmi` for details
|
- See `gemini://mozz.us/files/rfc_gemini_favicon.gmi` for details
|
||||||
|
- [x] *Proxying*
|
||||||
|
- All requests can optionally be sent through another server
|
||||||
|
- A gemini proxy server implementation currently does not exist, but Amfora will support it when it does!
|
||||||
- [ ] Subscribe to RSS and Atom feeds and display them
|
- [ ] Subscribe to RSS and Atom feeds and display them
|
||||||
- Subscribing to page changes, similar to how Spacewalk works, will also be supported
|
- Subscribing to page changes, similar to how Spacewalk works, will also be supported
|
||||||
- *In progress on `feeds` branch*
|
- *In progress on `feeds` branch*
|
||||||
|
@ -5,12 +5,20 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/makeworld-the-better-one/go-gemini"
|
"github.com/makeworld-the-better-one/go-gemini"
|
||||||
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Fetch returns response data and an error.
|
// Fetch returns response data and an error.
|
||||||
// The error text is human friendly and should be displayed.
|
// The error text is human friendly and should be displayed.
|
||||||
func Fetch(u string) (*gemini.Response, error) {
|
func Fetch(u string) (*gemini.Response, error) {
|
||||||
res, err := gemini.Fetch(u)
|
var res *gemini.Response
|
||||||
|
var err error
|
||||||
|
|
||||||
|
if viper.GetString("a-general.proxy") == "" {
|
||||||
|
res, err = gemini.Fetch(u)
|
||||||
|
} else {
|
||||||
|
res, err = gemini.FetchWithHost(viper.GetString("a-general.proxy"), u)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,13 @@ page_max_time = 10
|
|||||||
# Whether to replace tab numbers with emoji favicons, which are cached.
|
# Whether to replace tab numbers with emoji favicons, which are cached.
|
||||||
emoji_favicons = false
|
emoji_favicons = false
|
||||||
|
|
||||||
|
# Proxy server, through which all requests would be sent.
|
||||||
|
# String should be a host: a domain/IP with an optional port. Port 1965 is assumed otherwise.
|
||||||
|
# The proxy server needs to be a Gemini server that supports proxying.
|
||||||
|
# By default it is empty, which disables the proxy.
|
||||||
|
proxy = ""
|
||||||
|
|
||||||
|
|
||||||
[keybindings]
|
[keybindings]
|
||||||
# In the future there will be more settings here.
|
# In the future there will be more settings here.
|
||||||
|
|
||||||
@ -154,4 +161,5 @@ max_pages = 30 # The maximum number of pages the cache will store
|
|||||||
# bkmk_modal_text
|
# bkmk_modal_text
|
||||||
# bkmk_modal_label
|
# bkmk_modal_label
|
||||||
# bkmk_modal_field_bg
|
# bkmk_modal_field_bg
|
||||||
# bkmk_modal_field_text`)
|
# bkmk_modal_field_text
|
||||||
|
`)
|
||||||
|
@ -52,6 +52,13 @@ page_max_time = 10
|
|||||||
# Whether to replace tab numbers with emoji favicons, which are cached.
|
# Whether to replace tab numbers with emoji favicons, which are cached.
|
||||||
emoji_favicons = false
|
emoji_favicons = false
|
||||||
|
|
||||||
|
# Proxy server, through which all requests would be sent.
|
||||||
|
# String should be a host: a domain/IP with an optional port. Port 1965 is assumed otherwise.
|
||||||
|
# The proxy server needs to be a Gemini server that supports proxying.
|
||||||
|
# By default it is empty, which disables the proxy.
|
||||||
|
proxy = ""
|
||||||
|
|
||||||
|
|
||||||
[keybindings]
|
[keybindings]
|
||||||
# In the future there will be more settings here.
|
# In the future there will be more settings here.
|
||||||
|
|
||||||
@ -151,4 +158,4 @@ max_pages = 30 # The maximum number of pages the cache will store
|
|||||||
# bkmk_modal_text
|
# bkmk_modal_text
|
||||||
# bkmk_modal_label
|
# bkmk_modal_label
|
||||||
# bkmk_modal_field_bg
|
# bkmk_modal_field_bg
|
||||||
# bkmk_modal_field_text
|
# bkmk_modal_field_text
|
||||||
|
Loading…
Reference in New Issue
Block a user