Commit Graph

231 Commits

Author SHA1 Message Date
Denis Laxalde 0bf4b2a21a
Fix left column padding in timeline with wide characters
When the left column contains wide characters (which occupy more than
one cell when printed to screen), padding to 30-characters with
"{:30}".format() does not work well. This happens for instance when the
display name contains unicode characters such as emojis.

We fix this by introducing a pad() function in utils module which uses
the wcwidth library (https://pypi.org/project/wcwidth/) to compute the
length of the text for the column. trunc() function is also adjusted to
optionally compute the length of the text to be truncated since, when
called from pad(), we now pre-compute this value.

We update test for timeline rendering so that the display name now
includes an emoji. (Without the fix, the test would not pass as left
column would be misaligned.)
2019-02-14 14:21:53 +01:00
Ivan Habunek a3ebd96e05
Mark function as private 2019-02-13 14:19:27 +01:00
Ivan Habunek 19cbcd43b2
Make `toot timeline` continuable by pressing Enter 2019-02-13 14:19:00 +01:00
Ivan Habunek 0dfb04e9e3
Ignore bs4 warnings
These are triggered by false positives and get printed to screen when
running `toot curses`.
2019-02-13 13:38:37 +01:00
Ivan Habunek 32b1c67d49
Make boolen params a bit less verbose 2019-01-24 11:23:12 +01:00
Ivan Habunek c7c42b8337
Merge pull request #85 from ksunden/localtag
Add local and tag timelines to curses
2019-01-24 11:20:58 +01:00
Balazs Nadasdi e42c4c3b80
use http.get instead of hacking _status_action in api.py
(and fix a typo)
2019-01-21 17:25:20 +01:00
Balazs Nadasdi ee417df60e Status ID + thread view
- Status ID on timeline list view
 - thread command to view a complete thread
   Display order:
    - ancestors
    - status
    - descendants
2019-01-19 19:28:17 +01:00
ksunden 4df0c7882d ENH: Add local and tag timeline support to curses
Closes #61
2019-01-02 22:36:40 -06:00
Ivan Habunek 3ac8e59dec
Bump version 2019-01-02 12:51:49 +01:00
Ivan Habunek 82ed630864
Add status related commands
(un)favourite, (un)reblog & (un)pin.

fixes #75
2019-01-02 12:33:25 +01:00
Ivan Habunek fc57d2695a
Merge pull request #83 from dlax/apos
Replace ' by "'" before parsing HTML
2019-01-02 11:39:21 +01:00
Ivan Habunek 14a580bc19
Make toot post prompt for input if no text is given
fixes #82
2019-01-02 10:50:56 +01:00
Denis Laxalde 0f6bd920c3 Replace ' by "'" before parsing HTML
Beautiful will does not parse HTML entities like `'` as we expect
and the previous logic of replacing this *after* HTML parsing occurred
did not produced expected results.

To illustrate this, we change data in "test_timeline" to include a
literal `'` as it sometimes occur in data returned by Mastodon API.
New HTML content is:

    <p>The computer can&apos;t tell you the emotional story [...] </p>

Beautiful will parse this as as:

    <p>The computer can&amp;apost tell you the emotional story [...] </p>

which is not what we expect.

We fix this by replacing `&apos;` *before* HTML parsing by Beautiful.
Since test data in "test_timeline" got updated we also add an extra
assertion checking that part of the content with a literal "'" is
(still) properly rendered.
2019-01-01 23:14:54 +01:00
Nick Loadholtes 91fc273af7 Update for the curses ui help menu (#78)
Added `s` option to the help menu.
2018-12-30 22:34:15 +01:00
Ivan Habunek 226713a5a0
Apply requests environment settings
Allows use of enironment variables for setting proxies and trusted CAs.

See:
http://docs.python-requests.org/en/master/user/advanced/#prepared-requests
2018-12-30 10:38:40 +01:00
Ivan Habunek b06e9ea733
Enable fetching instance info over http
issue #56
2018-12-30 09:53:12 +01:00
Ivan Habunek f7f867f1b3
Merge pull request #80 from SteelPangolin/master
Feature proposal: --disable-https flag
2018-12-30 09:39:38 +01:00
Ivan Habunek 9c4964116e
Move common auth commands to a variable 2018-12-30 09:00:19 +01:00
Erica Ehrhardt fde84295e0 Add --disable-https flag 2018-12-24 17:20:30 -08:00
Kasra_mp 6fc48697c5
#69 Fix typo 2018-08-11 10:58:13 +02:00
Waweic d910cf9420 Added an option to reverse the timeline
Added the (in my opinion) mission option to reverse the timeline by Adding a command and reversing the entries before they get printed out.
2018-07-25 20:40:59 +02:00
Ivan Habunek 5871916f8e
Bump version 2018-06-27 16:33:00 +02:00
Ivan Habunek 05086e0c1f
Fix all media marked as sensitive
Needed to use "true" and "false" strings instead of bools.
2018-06-27 15:30:56 +02:00
Ivan Habunek 0c9b63b036
Don't print stack trace on keyboard interrupt 2018-06-15 10:01:18 +02:00
Ivan Habunek aabfd0fa31
Make browser login the default 2018-06-15 09:39:28 +02:00
Ivan Habunek 92435d630c
Add a global --silent flag to silence output
issue #46
2018-06-15 09:02:19 +02:00
Ivan Habunek 72f88831ad
Add delete command
issue #54
2018-06-14 10:40:16 +02:00
Ivan Habunek 025d8dde09
Use Idempotency-Key header when posting toots 2018-06-13 13:22:52 +02:00
Ivan Habunek 8f93b255ad
Add option to reply to a toot
fixes #6
2018-06-13 13:21:22 +02:00
Ivan Habunek 41e6ce6257
Bump version, add changelog 2018-06-12 12:22:37 +02:00
Ivan Habunek 7445c16947
Show version number in help text 2018-06-12 12:22:16 +02:00
Ivan Habunek f7619d5b22
Move parsing functions to separate file 2018-06-12 12:03:49 +02:00
Ivan Habunek 10f68fdab7
Replace --list-id with --list
verbosity ftw
2018-06-12 11:53:10 +02:00
Ivan Habunek b3d81c43cc
Tweak timeline output 2018-06-12 11:43:47 +02:00
Ivan Habunek 3f79b76aab
Fix alignment in timeline 2018-06-12 10:52:47 +02:00
Ivan Habunek e1cfda1acb
Add support for tag and list timelines 2018-06-12 10:40:36 +02:00
kakakaya 406943237a
Support -l/--local argument in timeline command 2018-06-12 09:54:57 +02:00
kakakaya 08c5226ae2
Add api.timeline_public method 2018-06-12 09:50:50 +02:00
kakakaya 09a138ba27
Use SCOPES const 2018-06-12 09:50:50 +02:00
Ivan Habunek ceb324e9b0
Move timeline printing code to output.py 2018-06-07 10:27:11 +02:00
Ivan Habunek fa4e4e6357
Add spoiler text and sensitive options to post
issue #63
2018-06-07 10:06:43 +02:00
Ivan Habunek c6b1d91370
Improve rendering of list view
Fixes appearence when unicode wraps due to wide characters.

Not a real fix, but looks nicer.
2018-01-22 10:18:48 +01:00
Ivan Habunek 760a80442c
Add help modal window 2018-01-22 10:07:18 +01:00
Ivan Habunek 2ecc6a28c6
Normalize unicode 2018-01-21 16:39:40 +01:00
Ivan Habunek cb1f7b4e61
Highlight hashtags 2018-01-21 16:39:16 +01:00
Ivan Habunek 3d44eeebba
More colors 2018-01-21 14:30:05 +01:00
Ivan Habunek 4314751610
Localize text wrapping 2018-01-20 13:43:21 +01:00
Ivan Habunek fba3b78ff6
Respect sensitive content, require keypress to show
fixes #42
2018-01-20 12:44:22 +01:00
Ivan Habunek 18e28531fd
Bump version 2018-01-15 23:18:13 +01:00
Ivan Habunek 05a06acf8e
Create config folder if it does not exist
fixes #40
2018-01-15 23:14:20 +01:00
Ivan Habunek 27df352519
Bump version 2018-01-15 13:36:40 +01:00
Ivan Habunek db4e1d59f3
Add __version__ to init file 2018-01-15 12:19:37 +01:00
Ivan Habunek d8fd8d0d56
Wrap URLs if needed 2018-01-14 15:46:31 +01:00
Ivan Habunek e829ce2714
Don't draw out of bounds 2018-01-14 15:46:31 +01:00
Ivan Habunek 5463e86d5d
Don't draw empty line when account has no name 2018-01-14 15:46:31 +01:00
Ivan Habunek 53cd9442f8
Fix list window refresh 2018-01-14 15:46:30 +01:00
Ivan Habunek e204722425
Extract status list window 2018-01-14 15:46:30 +01:00
Ivan Habunek 554618db4b
Extract header and footer windows 2018-01-14 15:46:30 +01:00
Ivan Habunek dc3b17c69b
Extract StatusDetailWindow 2018-01-14 15:46:30 +01:00
Ivan Habunek 022e437784
Fix status url parsing
Use reblog url if status url not present.
2018-01-14 15:46:30 +01:00
Ivan Habunek e421d24c80
Move curses app into toot.ui module 2018-01-14 15:46:29 +01:00
Ivan Habunek 6149c9beda
Show public or home timeline in curses 2018-01-14 15:46:29 +01:00
Ivan Habunek 521c329db9
Hacky way to support up/down arrows
They actually return 3 chars instead of 1, not sure why, but the third
one resolves to "A" for up and "B" for down, so good enough for now.

fixes #30
2018-01-14 15:46:29 +01:00
Ivan Habunek a2d59cdab4
Scroll status list when bottom is reached 2018-01-14 15:46:29 +01:00
Ivan Habunek 923ac57811
Fetch next statuses when going below last 2018-01-14 15:46:29 +01:00
Ivan Habunek d789d21171
Curses: nicer Colors lookup 2018-01-14 15:46:28 +01:00
Ivan Habunek 19888ea2f3
Curses: nicer status bar 2018-01-14 15:46:28 +01:00
Ivan Habunek 0ef5a9e41e
Dynamically size the status list window
This makes toot more usable on narrow screens. Still requires 60
columns minimum.

fixes #26
2018-01-14 15:46:28 +01:00
Ivan Habunek b92049ff1d
Redraw curses app on window resize
fixes #25
2018-01-14 15:46:28 +01:00
Ivan Habunek 508b4ff7ea
Enable logging to a file 2018-01-14 15:34:41 +01:00
Ivan Habunek 455e531194
Respect XDG_CONFIG_HOME env variable
to locate configuration home directory.

fixes #12
2018-01-14 15:29:34 +01:00
Ivan Habunek 536328f56b
More robust parsing of legacy config 2018-01-14 13:04:04 +01:00
Ivan Habunek 6a3c877270
Reimplement configuration to allow multiple logins
The configuration is now stored in a single json encoded file instead of
separate files.
2018-01-02 12:24:32 +01:00
Ivan Habunek 06a68d4142
Fix app registration
Was using http instead of https.
2017-12-30 17:54:22 +01:00
Ivan Habunek fde6bd6125
Allow posting media without text
issue #24
2017-12-30 16:42:52 +01:00
Ivan Habunek 92d4dc745a
Use http methods instead of requests directly 2017-12-30 16:30:35 +01:00
Ivan Habunek 20eaf86b56
Extract http methods 2017-12-30 14:15:51 +01:00
Ivan Habunek 7bbc98363e
Extract exceptions 2017-12-30 13:32:52 +01:00
Ivan Habunek 177af4fac9
Fix code style 2017-12-30 13:14:37 +01:00
Ivan Habunek cf9efc128a
Extract logging code 2017-12-30 13:06:24 +01:00
Ivan Habunek a50ffe62c3
Extract auth code to own file, add some tests 2017-12-30 13:05:47 +01:00
Ivan Habunek 787e0d28b4
Move printing logic to output 2017-12-29 14:42:51 +01:00
Ivan Habunek dfdad045f0
Add instance command 2017-12-29 14:26:40 +01:00
Ivan Habunek 609c432e68
Remove login_2fa command
It was a hacky way to log with 2fa without using a browser, but did not
work on half the instances. login_browser now exists and should be used
instead.
2017-12-29 12:08:51 +01:00
Ivan Habunek 1b86cdd404
Drop support for Python 2
It's hard to maintain both versions, having unicode issues in py2, etc.
2017-12-29 11:31:21 +01:00
Vee Satayamas 4b4b415986 Avoid displaying toot URL when it is None, in order to prevent crashing (Fix issue #33) 2017-12-10 21:59:25 +07:00
Ivan Habunek 729498559d
Fix problem with string formatting
%d would fail if given a string
2017-11-29 16:04:35 +01:00
Ivan Habunek 007d5539fa Fix Windows compatibility
Don't load curses until required. Since it's not available on windows,
importing the module early broke the whole app.

issue #18
2017-09-09 09:54:13 +02:00
Ivan Habunek e4c3a85045 Add --debug option to replace TOOT_DEBUG env 2017-08-26 15:12:32 +02:00
Ivan Habunek 62c4075fe1 Implement proper two factor authentication
fixes #19, #23
2017-08-26 14:39:53 +02:00
Ivan Habunek fff5c8bc98 Allow passing instance and email to login command 2017-08-26 11:34:32 +02:00
Ivan Habunek e46a817f09
Exit with nonzero code on error
fixes #14
2017-05-08 09:11:20 +02:00
Ivan Habunek 39c2cc661d
Rework how colors are shown in the commandline
Add an option to disable colors.

fixes #15
2017-05-08 09:09:20 +02:00
Ivan Habunek 661d35675a
Nicer account output 2017-05-07 10:42:31 +02:00
Ivan Habunek 6766cf83b4
Search only accounts when looking for users
Instead of using general search.
2017-05-07 10:42:04 +02:00
Ivan Habunek 02e364b521
Don't add stdin contents to arguments if empty
fixes #11
2017-05-07 10:28:11 +02:00
Ivan Habunek 0198bd3af7
Group commands contextually in print_help 2017-04-26 12:12:31 +02:00
Ivan Habunek 7563641f54
Add commands: (un)mute, (un)block 2017-04-26 11:49:21 +02:00
Ivan Habunek 3a1d7e17aa
Proper way of getting next values in a generator 2017-04-26 11:25:12 +02:00
Ivan Habunek 47b6a830a1
Rework status content wrapping 2017-04-26 11:01:28 +02:00
Ivan Habunek b3ef85b42d
Don't name file 'curses' to avoid conflicts 2017-04-24 09:38:07 +02:00
Ivan Habunek a3b207647b
Experimental curses app for viewing the timeline 2017-04-21 20:23:48 +02:00
Ivan Habunek 1c22eaa44f
Implement fetching posts as a generator 2017-04-21 12:57:34 +02:00
Ivan Habunek 9b48432d04
Add whois command 2017-04-19 15:29:40 +02:00
Ivan Habunek 373f26424d
Rework how commands are defined 2017-04-19 14:47:30 +02:00
Ivan Habunek 2a3d66bae5
Allow piping in text to be tooted 2017-04-19 11:03:44 +02:00
Ivan Habunek 7886199295
Experimental two factor authentication support
issue #3
2017-04-18 17:16:31 +02:00
Ivan Habunek 3f44d560c8
Store access tokens for multiple instances
This makes it so an app is created only once for each instance, instead
of being re-created on each login. Prevents accumulations of authroized
apps in https://mastodon.social/oauth/authorized_applications
2017-04-18 16:16:24 +02:00
Ivan Habunek ed20c7fded
More extensive request logging 2017-04-17 11:10:57 +02:00
MineRobber9000 f29cec0ce8
Fix typo in search function help 2017-04-17 09:59:17 +02:00
Ivan Habunek 64086cd0fe
Fix handling of unicode in py2 2017-04-17 09:58:36 +02:00
Ivan Habunek a666689c8d
Add whoami command 2017-04-16 17:53:02 +02:00
Ivan Habunek 2c121b2df4
Fix unicode on py2.7 2017-04-16 17:19:05 +02:00
Ivan Habunek a493da5c84
Added follow and unfollow commands 2017-04-16 17:15:05 +02:00
Ivan Habunek 64d46955e2
Add search command 2017-04-16 15:07:27 +02:00
Ivan Habunek d53849fe4b
Extract api functions to api.py 2017-04-16 14:14:33 +02:00
Ivan Habunek d7701bd2e6
Replace deprecated optparse with argparse 2017-04-16 14:06:16 +02:00
Ivan Habunek d21e45899c
Add coding directive 2017-04-15 14:53:08 +02:00
Ivan Habunek 7e31c57a63
Start testing 2017-04-15 14:46:22 +02:00
Ivan Habunek 3f1e8682c9
More descriptive application name 2017-04-15 12:45:16 +02:00
Ivan Habunek 3864563520
Add --visibility option to post command 2017-04-15 12:39:14 +02:00
Ivan Habunek 9b861ec9cc
Consistent --help on commands 2017-04-15 12:12:54 +02:00
Ivan Habunek 8285abb04e
Allow attaching media files to posts
fixes #1
2017-04-15 12:00:22 +02:00
Ivan Habunek c2625d536f
More extensive POST request logging 2017-04-15 11:55:33 +02:00
Ivan Habunek fd08b3884a
Add 'upload' command for uploading media 2017-04-14 16:41:09 +02:00
Ivan Habunek 9e32f7f8dd
Require an explicit login 2017-04-13 13:52:28 +02:00
Ivan Habunek 5297430483
Add a simple timeline command 2017-04-13 13:16:28 +02:00
Ivan Habunek 26be88aed6
Fixes for py3 2017-04-12 17:12:47 +02:00
Ivan Habunek 8e4342b818
Add missing slash to relative urls 2017-04-12 17:03:04 +02:00
Ivan Habunek 40a0739227
Initial commit 2017-04-12 16:43:30 +02:00