GithubHelp home page GithubHelp logo

flipez / hubot-rss-rolf Goto Github PK

View Code? Open in Web Editor NEW
9.0 5.0 4.0 127 KB

RSS Reader on Hubot

Home Page: https://www.npmjs.org/package/hubot-rss-rolf

JavaScript 100.00%
hubot hubot-scripts hubot-script hubot-rss rss rocketchat rocketchat-hubot

hubot-rss-rolf's Introduction

Hubot RSS Reader

RSS Reader for each Chat Channels, works with Hubot.

npm version

screen shot

Requirements

Install

% npm install hubot-rss-rolf -save

edit external-script.json

["hubot-rss-rolf"]

Configure (ENV vars)

export DEBUG=hubot-rss-reader*      # debug print
export HUBOT_RSS_INTERVAL=600       # 600 sec (default)
export HUBOT_RSS_HEADER=:sushi:     # RSS Header Emoji (default is "sushi")
export HUBOT_RSS_USERAGENT=hubot    # (default is "hubot-rss-reader/#{package_version}")
export HUBOT_RSS_PRINTSUMMARY=true  # print summary (default is "true")
export HUBOT_RSS_PRINTIMAGE=false   # print image in summary (default is "true")
export HUBOT_RSS_PRINTMARKDOWN=true # use markdown message (default is "false")
export HUBOT_RSS_PRINTERROR=false   # print error message (default is "true")
export HUBOT_RSS_IRCCOLORS=true     # use IRC color message (default is "false")
export HUBOT_RSS_LIMIT_ON_ADD=false # limit printing entries on add new feed. (default is 5)
export HUBOT_RSS_DUMP_USERS=""      # limit dump to special user (list without spaces eg. "user1,user2")

Usage

add

hubot rss add https://github.com/Flipez.atom
# or
hubot rss register https://github.com/Flipez.atom

delete

hubot rss delete https://github.com/Flipez.atom
hubot rss delete #room_name (only within the room or for users in HUBOT_RSS_DUMP_USERS list)

list

hubot rss list
hubot rss dump (only for users in HUBOT_RSS_DUMP_USERS list)

About

This project was forked from hubot-rss-reader from shokai with the fix from yynozk and published as hubot-rss-rolf to make it useable for rocketchat again.

hubot-rss-rolf's People

Contributors

flipez avatar localguru avatar motchang avatar pastelinc avatar patrys avatar raucao avatar sairoutine avatar shokai avatar uk-ar avatar vitallan avatar yuya-oc avatar zonkyy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hubot-rss-rolf's Issues

Doing hubot rss dump should not post dump form all rooms

I run the bot for anyone to use upon request since the bot cant join rooms when invited. However I noticed that doing rss dump displays lists of all RSS feeds of all rooms the bot is in. This of course leaks the room addresses which are sometimes private.

EDIT:
I thought HUBOT_RSS_DUMP_USERS should prevent anyone from doing dump.
I'm using xmpp connector btw.

deleting feeds with a trailing slash

Hi Robert,

I had some problems today to remove an URL which I added with a trailing slash. RocketChat doesn't display a trailing slash and rss list doesn't show it. So if you want to delete the URL later and don't remember the trailing slash the URL is not found ;)

See here: RocketChat/Rocket.Chat#7527

I would classify this as a RocketChat problem, but if deleting an URL a workaround could be to test both versions of an URL with and without a trailing slash.

Ciao!

human readable room names

Hi,

where do I configure human readable room names? I get this when dumping and therefore I can't use rss delete #niceroomname, but must use the id rss delete #okj4ersqPSaw7A4MZ

foobar

Ciao!

ERROR ReferenceError: room is not defined

I get this error when the bot tries to post rss entries:

ERROR ReferenceError: room is not defined                     
    at Timeout._onTimeout (/home/hubot/myhubot/node_modules/hubot-rss-rolf/scripts/hubot-rss-reader.coffe
e:71:51)                                                                                                 
    at ontimeout (timers.js:475:11)                                                                      
    at tryOnTimeout (timers.js:310:5)                                                                    
    at Timer.listOnTimeout (timers.js:270:5)

I found a fix for this. Change the setInterval part to look like this:

  setInterval ->
    return if typeof robot.send isnt 'function'
    return if send_queue.length < 1
    msg = send_queue.shift()
    msg.envelope.user = {}
    try
      robot.send msg.envelope, msg.body
    catch err
      logger.error "Error sending message in setInterval"
      logger.error err
  , 2000

Maybe this is caused by using a newer rocketchat connector.

Save rss urls on stop/restart

In testing it appears that stopping the bot & starting/restarting causes all rss urls to be lost. Is there a way to save these prior?

dump publishes private rooms

Hi,

via rss dump it is possible to get names of private rooms in RocketChat, which is to my mind a kind of security risk as private room names are hidden to others.

Ciao
Marcus

[error] room is not defined

@Flipez I am able to regenerate the issue #10 with 2.0.0-beta1

Could you please take a look on that?

droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO Filters passed, will receive message
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO hubot-rss-reader: add http://feeds.skynews.com/feeds/rss/world.xml
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO hubot-rss-reader: checker start
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO [sendMessage] Calling (async): [{"msg":"registered http://feeds.skynews.com/feeds/rss/world.xml","bot":{"i":"js.SDK"},"rid":"qswndTHNDruLKmaiz"}]
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO [received] Message in room qswndTHNDruLKmaiz
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO [received] Message in room qswndTHNDruLKmaiz
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO [received] Message in room qswndTHNDruLKmaiz
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO hubot-rss-reader: wait 600 seconds
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:59 GMT+0000 (Coordinated Universal Time)] ERROR ReferenceError: room is not defined
droid_1_165c287c5d29 |   at Timeout._onTimeout (/home/hubot/node_modules/hubot-rss-rolf/scripts/hubot-rss-reader.js:79:61)
droid_1_165c287c5d29 |   at ontimeout (timers.js:436:11)
droid_1_165c287c5d29 |   at tryOnTimeout (timers.js:300:5)
droid_1_165c287c5d29 |   at listOnTimeout (timers.js:263:5)
droid_1_165c287c5d29 |   at Timer.processTimers (timers.js:223:10)
droid_1_165c287c5d29 | 
  • RocketChat 0.73.1
  • hubot-rss-rolf 2.0.0-beta1

Originally posted by @realrill in #10 (comment)

Hubot doesn't start anymore (I guess after updates)

I want to restart the hubot via docker-compose, but It never goes live. It worked till some weeks ago though. I guess it doesn't work anymore because of your updates. If I can help debug it, let me know. Here is the log file:

npm info build /home/hubot/node_modules/hubot-rss-rolf
npm info preinstall [email protected]
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info prepublish [email protected]
npm info ok 
[Sun Sep 16 2018 23:05:19 GMT+0000 (UTC)] INFO Starting Rocketchat adapter version 1.0.11...
[Sun Sep 16 2018 23:05:19 GMT+0000 (UTC)] INFO Once connected to rooms I will respond to the name: bonnbot
[Sun Sep 16 2018 23:05:19 GMT+0000 (UTC)] WARNING No services ROCKETCHAT_ROOM provided to Hubot, using 
[Sun Sep 16 2018 23:05:19 GMT+0000 (UTC)] INFO Connecting To: rocketchat:3000
[Sun Sep 16 2018 23:05:19 GMT+0000 (UTC)] INFO Successfully connected!
[Sun Sep 16 2018 23:05:19 GMT+0000 (UTC)] INFO 
[Sun Sep 16 2018 23:05:19 GMT+0000 (UTC)] INFO Logging In
[Sun Sep 16 2018 23:05:23 GMT+0000 (UTC)] INFO Successfully Logged In
[Sun Sep 16 2018 23:05:23 GMT+0000 (UTC)] INFO rid:  []
[Sun Sep 16 2018 23:05:23 GMT+0000 (UTC)] INFO All rooms joined.
[Sun Sep 16 2018 23:05:23 GMT+0000 (UTC)] INFO Preparing Meteor Subscriptions..
[Sun Sep 16 2018 23:05:23 GMT+0000 (UTC)] INFO Subscribing to Room: __my_messages__
[Sun Sep 16 2018 23:05:23 GMT+0000 (UTC)] INFO Successfully subscribed to messages
[Sun Sep 16 2018 23:05:23 GMT+0000 (UTC)] INFO Setting up reactive message list...
[Sun Sep 16 2018 23:05:23 GMT+0000 (UTC)] WARNING Loading scripts from hubot-scripts.json is deprecated and will be removed in 3.0 (https://github.com/github/hubot-scripts/issues/1113) in favor of packages for each script.

Your hubot-scripts.json is empty, so you just need to remove it.
[Sun Sep 16 2018 23:05:23 GMT+0000 (UTC)] ERROR Error loading scripts from npm package - SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (/home/hubot/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Robot.loadExternalScripts (/home/hubot/node_modules/hubot/src/robot.coffee:401:11)
    at /home/hubot/node_modules/hubot/bin/hubot:159:26
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info package.json [email protected] No license field.
npm info addNameTag [ 'hubot-giphy-gifme', 'latest' ]
npm info addNameTag [ 'hubot-rss-rolf', 'latest' ]
npm info attempt registry request try #1 at 11:05:30 PM
npm http request GET https://registry.npmjs.org/hubot-help
npm info attempt registry request try #1 at 11:05:30 PM

Security: abuse of "rss delete #room"

Hi Robert,

at the moment it is possible for any user to delete any rss delete #room. We offer several public readonly channels with rss feeds in Rocket.Chat. Even though a user can't post messages to those readonly channels and and send bot commands, it's possible to remove the complete "rss room" from another channel or private room. Furthermore it is possible to delete rss rooms in other user's private rooms (assumed you know the room name). Therefore I posted a PR #6

Ciao
Marcus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.