Page 1 of 2

Pocket plugin – oneclickpocket

Posted: 25 Jun 2013, 15:06
by fxneumann
Hi,

I've written a plugin to add articles to Pocket with a single click; you'll find it here:

https://github.com/fxneumann/oneclickpocket

This is my first plugin, and being neither the best programmer nor experienced enough with both tt-rss hooks and the Dojo toolkit, it needs some improvement in authenticating the plugin with Pocket. My solution is quite quick and dirty, using a separate script auth.php and forcing the user to mind Pocket's API key and auth token.

Thanks to Acaranta, whose plugin for Yourls was very helpful to understand how plugins work in tt-rss!

I'm looking forward to your feedback and ideas for improvement.

Re: Pocket plugin – oneclickpocket

Posted: 25 Jun 2013, 16:53
by yelfathi
Hi, thanks for the initiative but I have an issue with version 1.7.8 (hosted on a public server) when generating Pocket Access Token:
"Parse error: syntax error, unexpected '[' in /homez.168/elfathi/www/ttrss/plugins/oneclickpocket/auth.php on line 46"

which corresponds to line code: $access_token = explode('=', explode('&', $oAuthRequest)[0])[1];

Re: Pocket plugin – oneclickpocket

Posted: 25 Jun 2013, 17:46
by fxneumann
Hi!

yelfathi wrote:Hi, thanks for the initiative but I have an issue with version 1.7.8 (hosted on a public server) when generating Pocket Access Token:
"Parse error: syntax error, unexpected '[' in /homez.168/elfathi/www/ttrss/plugins/oneclickpocket/auth.php on line 46"

which corresponds to line code: $access_token = explode('=', explode('&', $oAuthRequest)[0])[1];


Seems this syntax doesn't work with all PHP versions. Try replacing this line with

Code: Select all

 $access_token = explode('&', $oAuthRequest);
 $access_token = $access_token[0];
 $access_token = explode('=', $access_token);
 $access_token = $access_token[1];

(Or get it from Github, https://github.com/fxneumann/oneclickpo ... ebef450507)

Does it work now?

Re: Pocket plugin – oneclickpocket

Posted: 25 Jun 2013, 18:06
by yelfathi
Great thanks it works now!

Re: Pocket plugin – oneclickpocket

Posted: 25 Jun 2013, 20:58
by Skibbi
Great plugin! I have a feature request - make the button behave like star/unstar one (toggle) so I can see which entries are already in pocket. Also it would be nice to have the pocket button avaliable not only on expaned articles.

Re: Pocket plugin – oneclickpocket

Posted: 25 Jun 2013, 22:39
by fxneumann
Skibbi wrote:make the button behave like star/unstar one (toggle) so I can see which entries are already in pocket.


Good idea, but difficult to implement. I did something similar (https://github.com/fxneumann/oneclickpo ... dcd1b73cfd): When you click on the icon, it now turns from grey to red. This only works as long as the item with the clicked item is displayed, i.e. if you refresh the view or go to another feed and return, the indicator will be gone.

The reason for this is that to have a true star/unstar-like, persistent feature, I either would have to effectively duplicate the star/unstar-function with a Pocket/unPocket-function, or check on each and every display of an article with Pocket whether the target is already saved. The first seems to be quite an overkill for me (not to mention it is far beyond my ken), the second would slow everything extremely down.

Skibbi wrote:Also it would be nice to have the pocket button avaliable not only on expaned articles.


I'd love to have that, too. This would be quite easy to implement if there were a hook to display something beneath the star – but, AFAIK, there is no such hook, and I can't program one myself. If somebody can give me a hint how to do this: Go ahead, I'd be happy to put it in the plugin.

Re: Pocket plugin – oneclickpocket

Posted: 02 Jul 2013, 11:29
by kuestenjunge
Hi folks,

I've tried to use onecklickpocket but if I try to get an access token I'm getting this error:

Code: Select all

There was a problem trying to connect this app to Pocket. Please try again.
Array ( [output] => Array ( [is_valid] => 0 ) [header] => 403 Forbidden )


I'm using the current version from github of oneclickpocket.
My PHP Version 5.3.21.

Has anyone an idea how to fix that problem?

Best regards
Kuestenjunge

Re: Pocket plugin – oneclickpocket

Posted: 03 Jul 2013, 06:16
by MacDork
fxneumann wrote:Hi,

I've written a plugin to add articles to Pocket with a single click; you'll find it here:

https://github.com/fxneumann/oneclickpocket
....
I'm looking forward to your feedback and ideas for improvement.

Thanks for your work!

Can you add a keyboard shortcut so I can just press one letter and have the article saved to Pocket?

Re: Pocket plugin – oneclickpocket

Posted: 03 Jul 2013, 09:36
by wjchen
Great work!
I modified your plugin to share articles to twitter.
Oauth function not implement.
To get consumer_key,consumer_secret,access_token,access_token_secret visit [url]https:://dev.twitter.com/[/url] .
Still need more work about oauth and improvement.

Re: Pocket plugin – oneclickpocket

Posted: 03 Jul 2013, 11:47
by Bas1c
MacDork wrote:
fxneumann wrote:Hi,

I've written a plugin to add articles to Pocket with a single click; you'll find it here:

https://github.com/fxneumann/oneclickpocket
....
I'm looking forward to your feedback and ideas for improvement.

Thanks for your work!

Can you add a keyboard shortcut so I can just press one letter and have the article saved to Pocket?


Was the first thing I did, sorry I didn´t share.

Re: Pocket plugin – oneclickpocket

Posted: 03 Jul 2013, 12:25
by fxneumann
Bas1c wrote:Was the first thing I did, sorry I didn´t share.


Great, thank you! Do you have a Github-Account so you could send me a commit? (If not, I'll add it under my account, but I want to give credit were credit's due.)

Re: Pocket plugin – oneclickpocket

Posted: 10 Jul 2013, 17:09
by davgen
Thank you for this plugin! Works perfectly.
You should add to the readme that your plugin needs php-curl because if this library is not installed, the authentication fails (without any error message). Since php-curl is not required by tt-rss, i suppose i'm not the only one without php-curl on my tt-rss server.
Good job!
David.

Re: Pocket plugin – oneclickpocket

Posted: 11 Jul 2013, 12:15
by fxneumann
davgen wrote:You should add to the readme that your plugin needs php-curl because if this library is not installed, the authentication fails (without any error message). Since php-curl is not required by tt-rss, i suppose i'm not the only one without php-curl on my tt-rss server.


Good point, I mentioned it in the Readme and added a check for CURL which complains in Prefs and throws an error when save() is called: https://github.com/fxneumann/oneclickpo ... 100a816d3a

Best regards

Felix

Re: Pocket plugin – oneclickpocket

Posted: 13 Jul 2013, 10:28
by MacDork
Bas1c wrote:
Was the first thing I did, sorry I didn´t share.

Thanks!!!

Re: Pocket plugin – oneclickpocket

Posted: 02 Dec 2013, 19:02
by acaranta
huhuhu how nice is that ... I was looking for a pocket plugin ... found one and realised I was credited on your github repo ! \o/

Thanks for your work ;)