branch: externals/srht
commit e7ee980ff7713c58fa31d620c5679d78c7dde947
Author: Aleksandr Vityazev <avitya...@disroot.org>
Commit: Aleksandr Vityazev <avitya...@disroot.org>

    srht: srht-token: Use srht-username if available.
    
    * list/srht (srht-token): Use srht-username if available.
    * README: update.
---
 README.org   | 6 +++---
 lisp/srht.el | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index e8baf26d5f..78ce1ec2a6 100644
--- a/README.org
+++ b/README.org
@@ -50,7 +50,7 @@ machine sr.ht password TOKEN
 To store the token use =auth-source.el=, the host must be set to git.sr.ht.
 
 #+begin_example
-machine git.sr.ht password TOKEN
+machine git.sr.ht login LOGIN password TOKEN
 #+end_example
 Strongly encouraged for the user to limit the scope of access that is provided
 by an authentication token.  Currently srht-git.el requires at least
@@ -71,8 +71,8 @@ If you are using a self-hosted instanse:
 
 * Commands
 
-| Function             | Description                           |
-|----------------------+---------------------------------------|
+| Function               | Description                           |
+|------------------------+---------------------------------------|
 | =srht-git-repo-update= | Update information for git repository |
 | =srht-git-repo-delete= | Delete existing git repository        |
 | =srht-git-repo-create= | Create git repository                 |
diff --git a/lisp/srht.el b/lisp/srht.el
index 1312269a8c..09e2bc0318 100644
--- a/lisp/srht.el
+++ b/lisp/srht.el
@@ -70,7 +70,11 @@ an error.  HOST - DNS name of the service."
   (if srht-token
       srht-token
     (let ((token (when-let ((f (plist-get
-                                (car (auth-source-search :host host))
+                                (car
+                                 (if srht-username
+                                     (auth-source-search :host host
+                                                         :user srht-username)
+                                   (auth-source-search :host host)))
                                 :secret)))
                    (funcall f))))
       (unless token

Reply via email to