1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-06-15 19:15:24 +00:00

🚧 Autodetect all kinds of feeds

This commit is contained in:
makeworld 2020-11-18 20:39:27 -05:00
parent e026eb25e0
commit d0d8b15bbb
3 changed files with 14 additions and 4 deletions

View File

@ -1,11 +1,8 @@
# Notes
## Feeds (temp)
- Only options for "non-text" feed files is the download modal - there should be a feed modal before that one
- Auto feed detection fails on `ebc.li/atom.xml` - which is text
- TODO: remove all logger lines
## Issues
- URL for each tab should not be stored as a string - in the current code there's lots of reparsing the URL

View File

@ -230,7 +230,7 @@ func Init() error {
viper.SetDefault("a-general.page_max_size", 2097152)
viper.SetDefault("a-general.page_max_time", 10)
viper.SetDefault("a-general.emoji_favicons", false)
viper.SetDefault("a-general.feeds_popup", true)
viper.SetDefault("a-general.feed_popup", true)
viper.SetDefault("keybindings.shift_numbers", "!@#$%^&*()")
viper.SetDefault("url-handlers.other", "off")
viper.SetDefault("cache.max_size", 0)

View File

@ -5,9 +5,11 @@ import (
"errors"
"fmt"
"io"
"mime"
"net"
"net/url"
"os/exec"
"path"
"strconv"
"strings"
@ -585,6 +587,17 @@ func handleURL(t *tab, u string, numRedirects int) (string, bool) {
}
// Status code 20, but not a document that can be displayed
// First see if it's a feed, and ask the user about adding it if it is
filename := path.Base(parsed.Path)
mediatype, _, _ := mime.ParseMediaType(res.Meta)
feed, ok := feeds.GetFeed(mediatype, filename, res.Body)
if ok {
go addFeedDirect(u, feed, feeds.IsTracked(u))
return ret("", false)
}
// Otherwise offer download choices
go dlChoice("That file could not be displayed. What would you like to do?", u, res)
return ret("", false)
}