Pocket plugin – oneclickpocket

Post plugins and custom CSS snippets here
User avatar
fxneumann
Bear Rating Trainee
Bear Rating Trainee
Posts: 8
Joined: 01 Jun 2013, 18:38
Location: Bonn, Germany
Contact:

Pocket plugin – oneclickpocket

Postby fxneumann » 25 Jun 2013, 15:06

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.

yelfathi
Bear Rating Trainee
Bear Rating Trainee
Posts: 20
Joined: 14 May 2013, 19:32

Re: Pocket plugin – oneclickpocket

Postby yelfathi » 25 Jun 2013, 16:53

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];

User avatar
fxneumann
Bear Rating Trainee
Bear Rating Trainee
Posts: 8
Joined: 01 Jun 2013, 18:38
Location: Bonn, Germany
Contact:

Re: Pocket plugin – oneclickpocket

Postby fxneumann » 25 Jun 2013, 17:46

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?

yelfathi
Bear Rating Trainee
Bear Rating Trainee
Posts: 20
Joined: 14 May 2013, 19:32

Re: Pocket plugin – oneclickpocket

Postby yelfathi » 25 Jun 2013, 18:06

Great thanks it works now!

User avatar
Skibbi
Bear Rating Disaster
Bear Rating Disaster
Posts: 61
Joined: 15 Mar 2013, 14:59
Location: Poland

Re: Pocket plugin – oneclickpocket

Postby Skibbi » 25 Jun 2013, 20:58

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.

User avatar
fxneumann
Bear Rating Trainee
Bear Rating Trainee
Posts: 8
Joined: 01 Jun 2013, 18:38
Location: Bonn, Germany
Contact:

Re: Pocket plugin – oneclickpocket

Postby fxneumann » 25 Jun 2013, 22:39

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.

kuestenjunge
Bear Rating Trainee
Bear Rating Trainee
Posts: 1
Joined: 02 Jul 2013, 10:43

Re: Pocket plugin – oneclickpocket

Postby kuestenjunge » 02 Jul 2013, 11:29

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

MacDork
Bear Rating Trainee
Bear Rating Trainee
Posts: 30
Joined: 01 May 2013, 05:55

Re: Pocket plugin – oneclickpocket

Postby MacDork » 03 Jul 2013, 06:16

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?

wjchen
Bear Rating Trainee
Bear Rating Trainee
Posts: 3
Joined: 28 Jun 2013, 17:57

Re: Pocket plugin – oneclickpocket

Postby wjchen » 03 Jul 2013, 09:36

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.
Attachments
oneclicktweet.zip
(20.98 KiB) Downloaded 110 times

Bas1c
Bear Rating Trainee
Bear Rating Trainee
Posts: 1
Joined: 26 Jun 2013, 15:49

Re: Pocket plugin – oneclickpocket

Postby Bas1c » 03 Jul 2013, 11:47

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.
Attachments
oneclickpocket_withShortcut.zip
Same Plugin, but with Shortcut - Bind to i - Changeable in init.php Line 146
(5.55 KiB) Downloaded 174 times

User avatar
fxneumann
Bear Rating Trainee
Bear Rating Trainee
Posts: 8
Joined: 01 Jun 2013, 18:38
Location: Bonn, Germany
Contact:

Re: Pocket plugin – oneclickpocket

Postby fxneumann » 03 Jul 2013, 12:25

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.)

davgen
Bear Rating Trainee
Bear Rating Trainee
Posts: 1
Joined: 10 Jul 2013, 17:04

Re: Pocket plugin – oneclickpocket

Postby davgen » 10 Jul 2013, 17:09

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.

User avatar
fxneumann
Bear Rating Trainee
Bear Rating Trainee
Posts: 8
Joined: 01 Jun 2013, 18:38
Location: Bonn, Germany
Contact:

Re: Pocket plugin – oneclickpocket

Postby fxneumann » 11 Jul 2013, 12:15

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

MacDork
Bear Rating Trainee
Bear Rating Trainee
Posts: 30
Joined: 01 May 2013, 05:55

Re: Pocket plugin – oneclickpocket

Postby MacDork » 13 Jul 2013, 10:28

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

Thanks!!!

User avatar
acaranta
Bear Rating Trainee
Bear Rating Trainee
Posts: 15
Joined: 30 Mar 2013, 10:30

Re: Pocket plugin – oneclickpocket

Postby acaranta » 02 Dec 2013, 19:02

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 ;)


Return to “Themes and plugins”

Who is online

Users browsing this forum: No registered users and 1 guest