| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
|\ |
|
| |\
| | |
| | |
| | |
| | |
| | | |
Red_Starfish/mastodon-up.el:login into develop
Reviewed-on: https://codeberg.org/martianh/mastodon.el/pulls/255
|
| | |
| | |
| | |
| | |
| | | |
The variable `mastodon-auth-source-file' serves no purpose so change it
from a defcustom to a defvar. Also update its docstring to document it.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Hold the explanation string in the variable
`mastodon-auth--user-unaware'. This explanation is provided to old
mastodon.el users who are not aware of the 2FA related changes.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Most old users of the mastodon.el wouldn't know about the introduction
of new variable `mastodon-active-user'[1]. Our goal is to make them
aware.
Set the default value of [1] to nil. This way we can know that the user
hasn't set [1] properly because user is unaware of it.
In the definition of `mastodon-auth--access-token', check [1]'s value
and if it's null, explain to the user about the new situation. Finally
signal the error "Variables not set properly".
We have considered the possibility of automating the process but since
the new login mechanism depends on setting [1] *in the init file*, the
only way to automate it would be to write to user's init file which we
consider to be very rude and shouldn't be done by this package.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Instead of using the minibuffer prompt to present the explanation what
the user needs to do to get authorization code, use Emacs buffer and
Window. The minibuffer prompt should have 2-3 words.
This increases the readability of the explanation.
Of course delete explanation buffer and restore the window configuration
as it was after reading from minibuffer.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Change the name of the function `mastodon-auth--ask-authorization-code'
to `mastodon-auth--request-authorization-code'.
Suggested-by: Marty Hiatt <martianhiatus@riseup.net>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
mastodon.el currently follows the convention where all function names
should have two dashes (not one dash) in between function and namespace
names. Update all function names to follow this convention.
See issue #205 and pull request #255
|
| | |
| | |
| | |
| | |
| | | |
Update Copyright holder info for files that have undergone non trivial
changes.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
Refactor `mastodon-auth--access-token' and
`mastodon-auth--handle-token-response' to work with the new
authentication mechanism.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Remove `mastodon-auth--generate-token-no-storing-credentials' and
'mastodon-auth--generate-token-and-store' as these two are no longer
needed.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Refactor `mastodon-auth--generate-token' to work with new user
authentication and token generation mechanism. This enables mastodon.el
to work with 2FA and also not to handle password directly.
In this implementation mastodon-auth--generate-token gets authorization
code from the user and sends post request to mastodon server. Ask for
authorization code from the user using two helper functions:
* mastodon-auth--ask-authorization-code: Explain to the user what the
user needs to do to get the authorization code. Store this explanation
message in variable `mastodon-auth--explanation'.
* mastodon-auth--get-browser-login-url: Return a appropriate query
string appended to url to the caller, which is needed by the user to
access the authorization code.
|
|\| | |
|
| |/ |
|
|\| |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
strictly, the 27.1 dependency is only for proper-list-p in -http.el.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
- A `progn` with a single form is redundant
- `when` doesn't need a `progn` body
- `if` has an implicit `progn` for the consequences
- I converted one cascade of `if`s into a `cond`.
|
| |
| |
| |
| |
| |
| |
| | |
<some-symbol> <a-list>)`
This is more readable and actually more efficient (maybe) since it
uses `eq` rather than `equal` as a test.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is mostly reflowing / reworkding docstrings to keep within 80
characters limit and adding autoloads.
There are two warning remaining that I don't understand:
- mastodon-async.el:359:16: Warning: reference to free variable
‘url-http-end-of-headers’
- mastodon-http.el:139:8: Warning: value returned from (string-equal json-string "") is unused
When adding autoloads this sorts them for better readability.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently, `mastodon-auth--access-token` unconditionally returns the
value of the `:access_token` key from the response of
`(mastodon-auth--get-token)`. This causes problems when there was an
error getting the token, for example, if you enter the wrong
password. If a token couldn’t be retrieved, the JSON looks like:
(:error "invalid_grant"
:error_description "The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.")
Since there is no `:access_token` key, `mastodon-auth--access-token`
returns `nil`, which results in a broken header in the next request:
Authorization: Bearer
Which causes the whole thing to freeze Emacs until you mash `C-g`.
This commit rewrites the function to handle that case; to explicitly
signal an error for *any* response that isn’t expected; to use
`if-let`, which allows the temporary `token` variable to be
eliminated; uses `pcase` to determine what kind of response was
received; and adds ERT tests for all these cases.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, `mastodon-auth--access-token` unconditionally returns the
value of the `:access_token` key from the response of
`(mastodon-auth--get-token)`. This causes problems when there was an
error getting the token, for example, if you enter the wrong
password. If a token couldn’t be retrieved, the JSON looks like:
(:error "invalid_grant"
:error_description "The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.")
Since there is no `:access_token` key, `mastodon-auth--access-token`
returns `nil`, which results in a broken header in the next request:
Authorization: Bearer
Which causes the whole thing to freeze Emacs until you mash `C-g`.
This commit rewrites the function to handle that case; to explicitly
signal an error for *any* response that isn’t expected; to use
`if-let`, which allows the temporary `token` variable to be
eliminated; uses `pcase` to determine what kind of response was
received; and adds ERT tests for all these cases.
|
| |
|
|
|
|
|
|
| |
As pointed out in issue #211 the compiler actually warned the user about `json-array-type` etc. being unused lexical vars.
Let's hope that this fixes the errors reported with reading json.
|
|
|
|
| |
* Use the email address of the current user as default
|
| |
|
|
|
|
|
|
|
|
|
| |
* Use auth-source-search for fetching and saving password
This gives users the ability to save their password to either the gpg-encrypted ~/.authinfo.gpg or
~/.authinfo so that they don't have to provide username/password each time
* Add a new custom var to decide whether to use the auth-source package or not.
|
|
|
|
|
| |
We used to be clean but have slipped recently.
Let's clean up the code so it's easier to see real code smell warnings in the compilation.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When responding to toots the full acct for both local and federated accounts are now added to the new toot buffer.
Changes
- Added a function in mastodon.el to return the current user acct
- Added mastodon-toot--process-local, which takes an acct and appends the current server if it is local returns an empty string if the acct matches the current user and does only adds a prefix @ if the acct is federated
- mastodon-toot--mentions will return a formatted string of mentions or an empty string
- adds tests for mastodon-toot--mentions
- adds a missing , in mastodon-http--post
- `mastodon-toot--reply` now passes `mastodon-toot` a toot-id rather than the whole json
- 'mastodon-toot--reply-to-id is now a local var in a new toot
|
|
|
|
|
|
| |
* Bump version numbers to 0.7.2
* Adjusted functions to bring line length below 90.
|
|
|
|
|
|
|
|
|
|
|
| |
While testing out issue
149 (https://github.com/jdenen/mastodon.el/issues/149) I had problems
due to stale client information being cached.
With this change we store various pieces of information (the client
information in the plstore and the auth tokens) in alists keyed by the
instance url (and the plstore key contains the instance url as well to
allow us to store data per instance).
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
We do this by
- moving vars into the files where they are (mostly) used
- "declaring" vars used elsewhere with the (defvar <var-name>) pattern,
- declaring functions defined in others functions rather than loading the file via require.
|
| |
|
|
|
|
|
| |
We only support Emacs 24 and 25 so are free to use sane bindings by default.
To keep the linter happy, we need to declare dependency on Emacs 24 in all files.
|