From ad272f521b6b3f173048b394e71b5bd364a9154b Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Mon, 15 Jun 2020 20:51:44 +0200 Subject: [PATCH] Fix timeline generator to respect --instance option Access the anon public & tag timelines in this case. This makes it possible to see those timelines without being logged in. --- CHANGELOG.md | 1 + changelog.yaml | 1 + toot/commands.py | 10 ++++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10ece35..6e573cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Changelog * Fix access to public and tag timelines when on private mastodon instances (#168) * Add `--reverse` option to `toot notifications` (#151) +* Fix `toot timeline` to respect `--instance` option * TUI: Add opton to pin/save tag timelines (#163, thanks @dlax) * TUI: Fixed crash on empty timeline (#138, thanks ecs) diff --git a/changelog.yaml b/changelog.yaml index d42ae45..d04fab2 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -3,6 +3,7 @@ changes: - "Fix access to public and tag timelines when on private mastodon instances (#168)" - "Add `--reverse` option to `toot notifications` (#151)" + - "Fix `toot timeline` to respect `--instance` option" - "TUI: Add opton to pin/save tag timelines (#163, thanks @dlax)" - "TUI: Fixed crash on empty timeline (#138, thanks ecs)" diff --git a/toot/commands.py b/toot/commands.py index d92bc02..7575791 100644 --- a/toot/commands.py +++ b/toot/commands.py @@ -22,9 +22,15 @@ def get_timeline_generator(app, user, args): raise ConsoleError("The --instance option is only valid alongside --public or --tag.") if args.public: - return api.public_timeline_generator(app, user, local=args.local, limit=args.count) + if args.instance: + return api.anon_public_timeline_generator(args.instance, local=args.local, limit=args.count) + else: + return api.public_timeline_generator(app, user, local=args.local, limit=args.count) elif args.tag: - return api.tag_timeline_generator(app, user, args.tag, local=args.local, limit=args.count) + if args.instance: + return api.anon_tag_timeline_generator(args.instance, args.tag, limit=args.count) + else: + return api.tag_timeline_generator(app, user, args.tag, local=args.local, limit=args.count) elif args.list: return api.timeline_list_generator(app, user, args.list, limit=args.count) else: