emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ELPA] New package: srht


From: Aleksandr Vityazev
Subject: Re: [ELPA] New package: srht
Date: Thu, 19 May 2022 21:06:28 +0000

On 2022-05-19, 21:50 +0200, Tassilo Horn <tsdh@gnu.org> wrote:

> Aleksandr Vityazev <avityazev@posteo.org> writes:
>
> Hi Aleksandr,
>
>>> Out of curiosity, what are you planning to do?
>>>
>>> I didn't quite get Stefan's compaint to begin with.  I would imagine
>>> one sets srht-domain on a per-project basis, i.e., in a
>>> .dir-locals.el file.  Should the package cater for the possibility
>>> that a project's git is on instance 1 but the tracker on instance 2?
>>> Or should there just be a way to define all instances I want to
>>> interact with and then have an convenient switch-command?  Or should
>>> the instance be a mandatory argument to all functions (which would
>>> also be ok if it's just a library providing access to the srht API)
>>> and packages using srht should handle the "which instance" aspect?
>>
>> Not to say that srht is a library that simply binds the Sourcehut REST
>> API. There are also several commands to interact with. As a solution, I
>> chose the latter by adding an extra mandatory argument for the
>> functions. The available commands use srht-domains (list of instance
>> domain names), where users can specify all the instances they want to
>> interact with. When the command is invoked, it offers instance selection
>> if srht-domains contains more than one. When used in conjunction with
>> .dir-locals.el there is little change.
>
> Sounds good.
>
> I've just wanted to give it a try.  The docs of srht-username don't say
> wether it is with the ~ or without.

Will work either way, but yes it's worth clarifying.

> I've generated a new OAuth 2.0 token and put a line in my
> ~/.authinfo.gpg as stated in the README, i.e.:
>
>   machine sr.ht password <my-oauth-token>
>
> However, when I try to use srht-paste-region I always get this error:
>
> --8<---------------cut here---------------start------------->8---
> error in process sentinel: Unkown error with status 400: #s(plz-error nil 
> #s(plz-response 2 400 ((server . "nginx") (date . "Thu, 19 May 2022 20:00:32 
> GMT") (content-type . "application/json") (content-length . "58") 
> (content-security-policy . "default-src 'none'; style-src 'self' 
> 'unsafe-inline'; img-src * data:; script-src 'self' 'unsafe-inline'")) 
> "{\"errors\": [{\"reason\": \"Invalid or expired OAuth token\"}]}") nil)
> --8<---------------cut here---------------end--------------->8---
>
> I've tried srht-username with and without tilde, I've tried using
>
>   machine sr.ht login <username> password <my-oauth-token>
>
> but always got the above error...
>
> Oh, I finally made it!  It seems you cannot use an OAuth 2.0 token but
> must use a legacy one.  I'm not sure whose fault that is.  I use a sr.ht
> OAuth 2.0 token in hut (the command line client for sr.ht) without
> issues.  I think that uses the same REST/GraphQL APIs.

Sourcehut REST API does not support OAuth2 [1], also worth clarifying.
I don't use hut, but after looking a bit, I can tell that only GraphQl
with API2.0 is used there. There is a GraphQl library for Emacs, but
unfortunately neither elpa nor non-gnu elpa has it. 

Thanks for feedback.

[1] https://sourcehut.org/blog/2020-09-25-api-2-updates/
-- 
Best regards,
Aleksandr Vityazev



reply via email to

[Prev in Thread] Current Thread [Next in Thread]