Coder Social home page Coder Social logo

ghi's People

Contributors

dstillman avatar gkrizek avatar kvaciral avatar m3dwards avatar miwob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ghi's Issues

python3.9 - module 'base64' has no attribute 'encodestring'

2021-06-29 18:25:41 [ghi] IRC - Connecting to irc.libera.chat:6667 with nick nickname and channels: #channel
2021-06-29 18:25:42 [ghi] IRC - There was a problem sending messages to IRC
2021-06-29 18:25:42 [ghi] IRC - module 'base64' has no attribute 'encodestring'
2021-06-29 18:25:42 [ghi] Something went wrong while trying to notify IRC.

offending line: https://github.com/gkrizek/ghi/blob/master/ghi/irc.py#L87

can see that this fails in python 3.9.x

$ python3
Python 3.9.4 (default, Apr  9 2021, 01:15:05)
>>> blah = base64.encodestring("whatever".encode("UTF-8"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'base64' has no attribute 'encodestring'

https://docs.python.org/3.9/whatsnew/3.9.html

base64.encodestring() and base64.decodestring(), aliases deprecated since Python 3.1, have been removed: use
base64.encodebytes() and base64.decodebytes() instead. (Contributed by Victor Stinner in bpo-39351.)

changing encodestring to encodebytes resoles error and bot works again:

IRC - Connection Successful

From Gitea / Forgejo (Codeberg.org)?

Would be nice if this could also be configured to receive webhooks from Gitea/Forgejo instances like codeberg.org

As far as I know the hooks follow a Github like structure, so it should be relatively strait forward to add this.

Thanks!

feature-request: Notifications to mastodon

I currently run two separate github event notification systems in parallel:

  • one based on an old version of bitcoinacks—this can do notifications to Mastodon and Twitter (I only care about the former right now), for merges (polling based)
  • ghi—for notifying IRC (webhook notification based)

It would be nice to have this in one system, specified by one configuration file.

For comparison here was the patch to add "toot" support to bitcoinacks: PierreRochard/bitcoin-acks@9f828d9

Authentication with freenode not working

This could be a duplicate of #11 but there wasn't much information in that issue so I'm creating this one.

When authenticating with freenode, ghi waits for a message from the IRC server with the following pattern (r'(.*)AUTHENTICATE \+(.*) but the server responds with an almost matching AUTHENTICATE :+ which is not matched and the authentication fails.

Making the match more permissive has solved the problem for me.

Organisation-wide notifications?

Is it possible to set up ghi to watch an entire organization and notify about each commit happening in either of the projects belonging there?

Bot stops working after exception in handling thread

A few days ago my instance of GHI got an invalid request, which did not come from github, for all intents or purposes it looks like a random scan for a XMLRPC vulnerability, but it managed to make the bot stop working

Jun 27 17:38:37 galatea python3[458]: POST /ui/h5-vsan/rest/proxy/service/invalidArgument/invalidArgument (XX.XX.XX.XX)
Jun 27 17:38:37 galatea python3[458]: Found configuration file at '/home/ghi/.ghi.yml'
Jun 27 17:38:38 galatea python3[458]:   config = yaml.load(readFile(configFilePath))
Jun 27 17:38:38 galatea python3[458]: Exception in thread Thread-1:
Jun 27 17:38:38 galatea python3[458]: Traceback (most recent call last):
Jun 27 17:38:38 galatea python3[458]:   File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
Jun 27 17:38:38 galatea python3[458]:     self.run()
Jun 27 17:38:38 galatea python3[458]:   File "/usr/lib/python3.8/threading.py", line 870, in run
Jun 27 17:38:38 galatea python3[458]:     self._target(*self._args, **self._kwargs)
Jun 27 17:38:38 galatea python3[458]:   File "ghi/ghi/server.py", line 86, in worker
Jun 27 17:38:38 galatea python3[458]:     response = item(*args, **kwargs)
Jun 27 17:38:38 galatea python3[458]:   File "ghi/ghi/server.py", line 44, in InvokeFunction
Jun 27 17:38:38 galatea python3[458]:     return handler(event=payload, sysd=GetArgs()['log_mode'])
Jun 27 17:38:38 galatea python3[458]:   File "ghi/index.py", line 54, in handler
Jun 27 17:38:38 galatea python3[458]:     pool = getPool(githubPayload, configuration["pools"])
Jun 27 17:38:38 galatea python3[458]:   File "ghi/github.py", line 23, in getPool
Jun 27 17:38:38 galatea python3[458]:     repo = payload["repository"]["full_name"]
Jun 27 17:38:38 galatea python3[458]: KeyError: 'repository'

After this are no more reports of notifications at all, nor errors, although I'm sure github kept sending them. It's as if it became deaf. Likely, the exception brought it into an invalid state.

After restarting everything worked again.

Error after successfully delivering a message to an IRC channel on freenode

After successfully delivering a first message to my IRC channel ghi is reporting an error:

2022-02-02 13:33:30 [ghi] waiting for messages...
2022-02-02 13:33:31 [ghi] waiting for messages...
2022-02-02 13:33:32 [ghi] waiting for messages...
2022-02-02 13:33:34 [ghi] waiting for messages...
2022-02-02 13:33:35 [ghi] waiting for messages...
2022-02-02 13:33:36 [ghi] waiting for messages...
2022-02-02 13:33:37 [ghi] waiting for messages...
2022-02-02 13:33:39 [ghi] waiting for messages...
2022-02-02 13:33:40 [ghi] waiting for messages...
2022-02-02 13:33:41 [ghi] waiting for messages...
2022-02-02 13:33:42 [ghi] waiting for messages...
2022-02-02 13:33:44 [ghi] waiting for messages...
2022-02-02 13:33:44 [ghi] IRC - There was a problem sending messages to IRC
2022-02-02 13:33:44 [ghi] IRC - Timeout sending messages to IRC.
2022-02-02 13:33:44 [ghi] Something went wrong while trying to notify IRC.
2022-02-02 13:33:44 [ghi]
2022-02-02 13:33:44 [ghi] Response:
2022-02-02 13:33:44 [ghi] {'statusCode': 500, 'body': '{"success": false, "message": "Something went wrong."}'}
2022-02-02 13:33:44 [ghi] Stop UUID: 4e46361f-b0d4-480e-b7e9-d2db060a9250
2022-02-02 13:33:44 [ghi]

It takes about 150 seconds to timeout and throw this message during which new messages will not be delivered although they appear to be delivered after this timeout.

This bug doesn't stop messages being delivered, it just fills the logs with errors and means two messages can't be delivered within 150 seconds of each other.

I suspect the problem might be similar to the cause of #16 where ghi is looking for a specific message and freenode has changed the format or content although I've not looked into it yet.

Matrix backend

A possibly useful feature would be a matrix backend. This would both be useful to have merge notifications in matrix rooms, and (in combination with matrix-IRC bridge) to have a bot that sticks around persistently instead of leaving every time.

module 'base64' has no attribute 'encodestring' on Python 3.9

Sending to IRC fails with this message:

Feb 20 14:03:09 … python3[399]: IRC - Connecting to irc.libera.chat:6697 with nick bitcoin-git and channels: #bitcoin-commits,#bitcoin-core-dev
Feb 20 14:03:09 … python3[399]: IRC - There was a problem sending messages to IRC
Feb 20 14:03:09 … python3[399]: IRC - module 'base64' has no attribute 'encodestring'

According to upstream issue 39351, this function was deprecated since Python 3.1 in favor of base64.encodebytes and decodebytes.

IRC Channels that start with a hash (#) need to be in quotes in the config file

Could file this one under user error as a quote makes a comment in the yaml file but it caught me out. Perhaps the documentation and the example config files could include channel names that start with a hash and are in quotes. This would give an example and maybe stop someone from having to check the logs to see why it can't talk to their IRC channel.

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.