From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aleksandr Vityazev Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: srht Date: Thu, 19 May 2022 21:06:28 +0000 Message-ID: <87ilq1tep7.fsf@posteo.org> References: <87mtfdtk1y.fsf@posteo.org> <87czg9waac.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7790"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , emacs-devel@gnu.org To: Tassilo Horn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 20 07:42:49 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nrvPU-0001pf-OW for ged-emacs-devel@m.gmane-mx.org; Fri, 20 May 2022 07:42:48 +0200 Original-Received: from localhost ([::1]:42848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nrvPT-00087s-Bi for ged-emacs-devel@m.gmane-mx.org; Fri, 20 May 2022 01:42:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrnLv-0000Hx-I2 for emacs-devel@gnu.org; Thu, 19 May 2022 17:06:35 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:53509) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrnLt-0004nK-1j for emacs-devel@gnu.org; Thu, 19 May 2022 17:06:35 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 0AF79240108 for ; Thu, 19 May 2022 23:06:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.org; s=2017; t=1652994391; bh=esq5jw2eRgqW30xjeM5U6l4tq1tS/5AGNo1Sjqg97+k=; h=From:To:Cc:Subject:Date:From; b=lq4RJi1XSa4wgQl7Y6C28SyADGo9u9S6H1y/ow3FuRuE+6GCuam9YnuEuxvZ5JCc/ +TB+mc+Yt7zVgVl5opMOU4pMbBiLvgpHrY1j1XwPQU3YbRSvvQyKEvjLfK+L84VAUu XQzy8fysudCWePotJeM6aCSq+VbA5igAxiYHkP77C+MZtcTYfN0QScTUdIDQFch3wU CW11Q8AGWt815VXp33wtScOCMaduyUOC5aQjdWSG3aYCWkN/+W5lA3MrYDQE1+dQ6B n9k2piGeI4N+U6KKjwG/3GXFUj4haGOXLTJqmuF98TnvdV+D+qbC/C/wqeIViOfO2t bvYvNi5xNsuIA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4L42Td4pskz6tmX; Thu, 19 May 2022 23:06:29 +0200 (CEST) In-Reply-To: <87czg9waac.fsf@gnu.org> (Tassilo Horn's message of "Thu, 19 May 2022 21:50:14 +0200") Received-SPF: pass client-ip=185.67.36.66; envelope-from=avityazev@posteo.org; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 20 May 2022 01:40:27 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:289995 Archived-At: On 2022-05-19, 21:50 +0200, Tassilo Horn wrote: > Aleksandr Vityazev 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 > > 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 password > > 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