mirror of
https://github.com/makeworld-the-better-one/amfora.git
synced 2024-09-11 14:55:51 +03:00
Ask about downloading if user doesn't add feed
This commit is contained in:
parent
8ffc0ca29c
commit
8875af6c57
5
NOTES.md
5
NOTES.md
@ -3,13 +3,10 @@
|
||||
## Feeds (temp)
|
||||
- Feed page doesn't update automatically if you add a feed by bottom bar URL while already on the feed page
|
||||
- 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
|
||||
|
||||
## Regressions
|
||||
|
||||
|
||||
## Upstream Bugs
|
||||
- Wrapping messes up on brackets
|
||||
- Filed [issue 23](https://gitlab.com/tslocum/cview/-/issues/23)
|
||||
|
@ -158,10 +158,12 @@ func getFeedFromPage(p *structs.Page) (*gofeed.Feed, bool) {
|
||||
|
||||
// addFeedDirect is only for adding feeds, not pages.
|
||||
// It's for when you already have a feed and know if it's tracked.
|
||||
// Use mainly by handleURL because it already did a lot of the work.
|
||||
// Used mainly by handleURL because it already did a lot of the work.
|
||||
// It returns a bool indicating whether the user actually wanted to
|
||||
// add the feed or not.
|
||||
//
|
||||
// Like addFeed, it should be called in a goroutine.
|
||||
func addFeedDirect(u string, feed *gofeed.Feed, tracked bool) {
|
||||
func addFeedDirect(u string, feed *gofeed.Feed, tracked bool) bool {
|
||||
logger.Log.Println("display.addFeedDirect called")
|
||||
|
||||
if openFeedModal(true, tracked) {
|
||||
@ -169,7 +171,9 @@ func addFeedDirect(u string, feed *gofeed.Feed, tracked bool) {
|
||||
if err != nil {
|
||||
Error("Feed Error", err.Error())
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// addFeed goes through the process of tracking the current page/feed.
|
||||
|
@ -593,7 +593,13 @@ func handleURL(t *tab, u string, numRedirects int) (string, bool) {
|
||||
mediatype, _, _ := mime.ParseMediaType(res.Meta)
|
||||
feed, ok := feeds.GetFeed(mediatype, filename, res.Body)
|
||||
if ok {
|
||||
go addFeedDirect(u, feed, feeds.IsTracked(u))
|
||||
go func() {
|
||||
added := addFeedDirect(u, feed, feeds.IsTracked(u))
|
||||
if !added {
|
||||
// Otherwise offer download choices
|
||||
go dlChoice("That file could not be displayed. What would you like to do?", u, res)
|
||||
}
|
||||
}()
|
||||
return ret("", false)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user