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

32 Commits

Author SHA1 Message Date
Rob Loranger
ff67ed2bb8
remove default collection of username 2019-09-18 14:10:49 -07:00
Rob Loranger
024b7090ac
clean up CurrentUser global cfg logic 2019-09-10 09:00:48 -07:00
Rob Loranger
83bc1cf310
fix hostname schema dir issues 2019-09-10 09:00:20 -07:00
Rob Loranger
96f57d52e8
fix user auth for writeas posting 2019-09-10 08:55:09 -07:00
Rob Loranger
abc78c7652
CurrentUser should always return the flag if set
previously when the user flag was provided, the function would still try
to get a user from config. flag should take precedence
2019-08-08 10:06:09 -07:00
Rob Loranger
8625e42ce7
do not parse url from configured host
now that the scheme is not required in the configuration file, we can
assume the configured value is correct. as with other uses, the
configured value is only used when noth host and user are present.
2019-08-08 09:28:09 -07:00
Rob Loranger
55dcf5e79c
CurrentUser only use global when needed
by needed: when host flag was supplied, matches that configured and a
user is set in config as well. they should be a pair.
2019-08-02 10:58:36 -07:00
Rob Loranger
c218012d42
export UserHostDir
for use outside of package
2019-08-02 10:43:56 -07:00
60d987eed3 Clean up directories on wf logout
On logout, this deletes host / user directories if they're empty.

Ref T586
2019-07-29 14:47:01 -04:00
8d1b4102b8 Automatically set WF account as default on first auth
Now when running `wf auth`, we'll automatically set the given host +
username as the default account in .writefreely/config.ini, so subsequent
requests without an explicit --host and --user will use this account.

Ref T635 T586
2019-07-22 15:13:51 -04:00
8b1cc1411c Reflect wf-cli/writeas-cli in User-Agent
Previously, this would always include writeas-cli.

Ref T586
2019-07-22 15:08:06 -04:00
1b8655f06a Accept --host without scheme
This automatically prepends https:// to any given --host value. It also
adds an --insecure flag, which will instead prepend http://

The goal with this is to save some typing and encourage operations over
HTTPS.

Ref T595
2019-07-22 13:21:09 -04:00
a53cbb16b5 Show correct executable name in user messages 2019-07-21 10:26:57 -04:00
Rob j Loranger
5212fa12c8 fix LoadUser directory does not exist
config.LoadUser was not ensuring the directory exists before trying to
load any already authenticated user, fixed using config.DirMustExist
2019-07-03 19:01:19 +00:00
Rob Loranger
83ad65c27d
add config.TorURL
select tor URL based on provided host flag, default host in config or
default write.as onion address. in that order of precedence.
2019-06-24 20:37:07 -07:00
Rob Loranger
498a3af787
Merge branch 'develop' into T586 2019-06-24 20:16:15 -07: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
Rob Loranger
3f8b0d0c6e
default to user collection
new posts, when no flag is specified for blog or collection, will now
default to the user collection. that is the username.
2019-06-18 14:56:50 -07:00
Rob Loranger
9266f66221
revert global flag change
I had changed the global flags variable to only be those that are global
this broke some compatibility with piping from stdout into the binary.

also:
- binary specific configuration details have moved into the same map but
in main.go. only the configDir is OS dependent.
- a new key in the map is for the version so each binary can have their
own
2019-06-18 14:56:47 -07:00
Rob Loranger
ea3e57a2a7
bugfix: default user should work on other domains
there was a bug where a default user at the config directory root was
not being used for calls not including a flag or host level config.ini
2019-06-18 14:56:45 -07:00
Rob Loranger
d10b3ee85a
store user.json in user sub folder
only on wf, writeas still stores in root user config directory
2019-06-18 14:56:44 -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
79aae31052
delete host specific user when doing logout 2019-06-18 14:56:38 -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
834bc2a440
add helper to parse host based config dir 2019-06-18 14:56:35 -07:00
a294c6e4cd Bump version to 2.0 2019-06-11 12:14:22 -04:00
Rob Loranger
31575d41bd
move to version two of go-writeas
this changes imports to use the github import path
github.com/writeas/go-writeas/v2
2019-06-10 15:23:42 -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
Rob Loranger
efa3f32a35
Ref T597 split out shared code
first moving everything out into the base package
should be followed by some refactoring and reorganizing before creating
two different binaries for write.as and writefreely
2019-05-29 11:36:37 -07:00