1
0
mirror of https://github.com/writeas/writeas-cli synced 2025-07-26 23:08:16 +00:00
Commit Graph

41 Commits

Author SHA1 Message Date
Christopher Davis
bd378a85ad commands: Remove redundant string() cast on pass
When logging in we had a cast that was made redundant, since
`pass` is now a string.
2019-10-08 18:36:38 -07:00
Christopher Davis
f2bb9f5896 commands: Fix up the interactive auth flow
Fixes up the interactive authorization workflow so that
pass is reassigned properly.

For T692
2019-10-08 18:36:38 -07:00
Christopher Davis
c6af292b2a Add password flag for authentication
For T692
2019-10-08 18:36:38 -07:00
Rob Loranger
47d8bb3e6d
wf/post list: draft posts not anonymous 2019-09-10 11:06:43 -07:00
Rob Loranger
05380e618f
fix post url for non standard hostnames 2019-09-10 10:59:36 -07:00
Rob Loranger
6dbf4f98cd
command auth should use user flag
if the user flag is provided auth should attempt to authenticate with
that user.
2019-08-08 10:07:42 -07:00
Rob Loranger
44501a2e8c
use default user when authenticating
if both a user and host are configured, the command auth should assume
that user and host when none specified
2019-08-08 09:26:49 -07:00
Rob Loranger
630a867a34
update requireAuth helper, check logged in users
this uses the usersLoggedIn helper to check for already logged in users,
selecting the single user when only one present and returning and error
when multiple are logged in.
2019-08-02 10:46:55 -07:00
a53cbb16b5 Show correct executable name in user messages 2019-07-21 10:26:57 -04:00
Rob j Loranger
8129d8440d CmdListPosts: update use of LoadUser
config.LoadUser now only takes a *cli.Context
2019-07-03 18:59:32 +00:00
da1dce68b0 Merge branch 'master' into T586 2019-07-01 15:49:50 -04:00
ae30827389 Include anonymous posts in posts when auth'd
This lists the anonymous posts owned by the currently-authenticated
user in addition to any local posts, with titles marking both sections.

Ref T604
2019-06-26 15:02:15 -04:00
08c7201580 Tweak "couldn't delete" prefix text
Now we use "post" instead of "remote copy"
2019-06-26 14:17:55 -04:00
Rob Loranger
498a3af787
Merge branch 'develop' into T586 2019-06-24 20:16:15 -07:00
a4f122aa55 Display errors with various commands 2019-06-20 22:59:51 -04:00
ccec921bd7 Show "publishing..." statuses before publishing
instead of after.
2019-06-20 22:59:51 -04:00
f46c5717a7 Make Tor publishing statuses consistent
This uses "[action] via hidden service" instead of "[action] to hidden
service". It also consistently uses "publishing" instead of "posting".
2019-06-20 22:59:42 -04:00
Rob Loranger
27e615035e
support tor everywhere
this changes all api calls to respect the flags for tor and tor-port

- config now has TorPort method to return flag value if set, or default
- api now only has newClient, this creates a tor client when flag is
present. does not need to be exported anymore
- no methods take a tor argument as no longer needed
- all commands now share the same behaviour logging tor messages
- api.torClient was removed as not used anywhere
- all calls to api.newClient now check for and return the error
- api.HandlePost was removed as redundant of api.DoPost
2019-06-20 15:25:36 -07:00
73501ae46e Keep new post listing style under -v flag 2019-06-20 09:31:53 -04:00
Rob Loranger
844ce0708e
local posts should use host dir
also CmdPost should return an exit error if there is one
2019-06-18 14:56:48 -07:00
Rob Loranger
572044043a
include new claim cmd in wf
also update CmdClaim for new LoadUser signiture
2019-06-18 14:56:46 -07:00
Rob Loranger
20919fbe0d
support any writefreely instance
full support, auth and actions working by use of flags or defaults
maintains backwards compatibility with write.as
2019-06-18 14:56:42 -07:00
Rob Loranger
15f71e3714
multiple user authentication
- now allows authentication with more than one user per host, stored as
username.json inside the [host] directory.
- supports a default user and host in config.ini
- global flags will override the default
2019-06-18 14:56:41 -07:00
Rob Loranger
33578e83e9
start multi user authentication
- adds new user/u flag to wf
- load and save user file based on username
- removed host flag from writeas
- adds hidden global flag for user to writeas to maintain
compatibility
2019-06-18 14:56:40 -07:00
Rob Loranger
d6c4b2c392
store/load user with host specific sub folder
only if host flag supplied for writefreely binary, writeas unaffected
2019-06-18 14:56:38 -07:00
Rob Loranger
4ed622b6df
revert posts listing style to v1.2
this changes the posts listing output back to v1.2 style

also removes remote posts listing for now.
posts with edit tokens are behind `-v` flag.
2019-06-18 14:52:00 -07:00
Rob Loranger
36477afe2a
remove local post save and delete
until the fetch command is included again
2019-06-13 14:12:17 -07:00
ed5e498c40 Tweak post claim logging
- Presents a summary before making the request when verbose (-v) enabled
- Successful claims only shown with verbose (-v) enabled
- Failed claims now always mention cause of failure
- A summary of successes / failures shows after logging any failures,
  when verbose (-v) enabled

Ref T194
2019-06-11 11:22:41 -04:00
4b42c2160b Fix nil pointer error in CmdClaim
Ref T194
2019-06-11 11:16:45 -04:00
Rob Loranger
c371da1e5e
add claim posts to writeas CLI
this adds the ability to claim local posts under an authenticated
account.

removePost is now exported for use the claim command
2019-06-10 15:01:34 -07:00
Rob Loranger
8cc41b8e35
return proper errors in CmdCollections
fix tabwriter padding
2019-06-10 07:43:08 -07:00
Rob Loranger
30ecad172a
add collection listing
adds subcommand colls
lists collections for authenticated user
supports -url flag for listing collection URLs
2019-06-07 09:44:29 -07:00
Matt Baer
440e210afa
Merge pull request #29 from writeas/T604
fetch authenticated users posts
2019-06-07 11:17:27 -04:00
Rob Loranger
4ac17b62dd
use stdout in list posts tabwriter
was using stderr from initial prototyping
2019-06-07 07:30:13 -07:00
Rob Loranger
97d682c73d
use current application vocabulary
hopefully making the output simple to understand at a glance
2019-06-05 15:32:11 -07:00
Rob Loranger
07a55f4530
use cli.NewExitError in CmdDelete 2019-06-05 13:37:16 -07:00
Rob Loranger
dbe15329af
return errors on delete command
changes command for delete to return errors to the user

also updates comment for DoDelete
2019-06-05 11:05:37 -07:00
Rob Loranger
6bb2d38208
only show local posts header if there are any 2019-05-30 15:57:55 -07:00
Rob Loranger
1fccf7ad62
Resolves T604 Fetch users posts if authenticated
This changes the 'posts' subcommand, previously 'list', to also list any
remote posts for the user if currently authenticated.

- adds DoFetchPosts to the api pkg which returns all the logged in users
posts.
- adds a RemotePost type to the api pkg which stores some of the return
information from DoFetchPosts for use in printing to stdout
- adds GetUserPosts to the api pkg which converts the incoming
writeas.Posts into the smaller RemotePost type
- adds getExcerpt which takes the incoming writeas.Post.Content and
returns a trimmed down excerpt of the content. Max 2 lines of 80 chars
and delimited by '...'
- changes CmdList from pkg commands to CmdListPosts which now writes out
any local and remote posts in simple formatted tables
2019-05-30 13:37:07 -07:00
Rob Loranger
a993f00846
ref T594 allow configurable config directory
this adds a configurable directory, currently within the users path for
the configuration, user and post data to be saved.

it is accessible down the stack of the application via the cli.Context,
specificaly c.App.ExtraData which is a function that returns a map of
[string]string under the key 'configDir".
2019-05-29 12:14:07 -07:00
Rob Loranger
f227faa5dc
Closes T592 T593 T597 splits code into packages
this splits everything out into shared packages

- user config and application config share a package for now
- sync is part of the api package which includes the client, posts and
tor logic
- logging is it's own package
- commands are in their own package
2019-05-29 11:43:00 -07:00