Kegan Dougal
b59d43b810
Add a `NextBatchStorer` interface to load/save next_batch tokens
Gets around cyclic dependencies.
8 years ago
Kegan Dougal
5f9a065d83
Persist next_batch tokens
Indirect this through a `NextBatchStore` type to get around circular dependencies
which are formed if you try to inline it in the `Sync()` while loop.
Fork out event handlers to separate functions in `Clients` to make gocyclo happy.
Add `UPDATE` query for `next_batch`.
8 years ago
Kegan Dougal
bacc0eebb5
Return Authenticated:false rather than 404ing on missing sessions - it makes life much easier
8 years ago
Kegan Dougal
8fe15076e9
More useful input/output logging please for debugging
8 years ago
Kegsay
70bf4ce5ed
Merge pull request #57 from matrix-org/kegan/gh-explicit-unregister-webhooks
Allow github webhooks to be explicitly removed
8 years ago
Kegan Dougal
8c6445183c
Warn rather than Error
8 years ago
Kegan Dougal
b5e0665c64
Allow github webhooks to be explicitly removed
Removing a repo entirely from a service will now remove the webhook in the
`PostRegister()` function. This function is still within the `configureService`
critical section to prevent another request for the same service racing with
the cleanup process.
8 years ago
Kegsay
635ea03516
Merge pull request #56 from matrix-org/kegan/configure-client-name
Set the desired DisplayName for a client when it is being configured
8 years ago
Kegan Dougal
7bafa40708
Only Sync if told to do so
8 years ago
Kegan Dougal
314b63e900
Set the desired DisplayName for a client when it is being configured
8 years ago
Kegsay
d8b248cb2c
Merge pull request #52 from matrix-org/kegan/split-gh-service
Split up github service into 2 services
8 years ago
Kegan Dougal
aea0e3a104
Split up github service into 2 services
One for commands/expansions, the other for webhooks. Call the type 'github-webhook'.
8 years ago
Kegsay
dc9872bbd8
Merge pull request #48 from matrix-org/kegan/giphy
Add Giphy integration
8 years ago
Kegan Dougal
b2e301651b
Be less excited about logging; use res.ContentLength
8 years ago
Kegan Dougal
fcd4b5adc7
Comments
8 years ago
Kegan Dougal
6f2d9dc72c
Add giphy integration
8 years ago
Kegsay
16e7bf3957
Merge pull request #47 from matrix-org/kegan/bot-options
Support bot options and implement github bot options for default repos
8 years ago
Kegan Dougal
d100d8ddd4
Don't share the matchingGroups array across multiple functions because that's insane
8 years ago
Kegan Dougal
95d8f86fa4
Combine together short and long form regexp matching to avoid expanding twice on long form
8 years ago
Kegan Dougal
8b44f3658c
Support bot options and implement github bot options for default repos
- Add a new `bot_options` table
- Allow github expansions/commands to omit the owner/repo and use a default if set
8 years ago
Kegan Dougal
15dc39dedc
Add an inviter key when joining rooms
8 years ago
Kegsay
761823d423
Merge pull request #46 from matrix-org/kegan/github-join-room-on-register
Join webhook rooms on Register()
8 years ago
Kegsay
35f83a6c67
Merge pull request #45 from matrix-org/kegan/github-remove-hooks-on-webhook-event
Delete webhooks when receive webhook events for no known repository
8 years ago
Kegan Dougal
6924f44379
Merge branch 'kegan/github-mutex-on-register' into kegan/github-remove-hooks-on-webhook-event
8 years ago
Kegsay
324231cf00
Merge pull request #44 from matrix-org/kegan/github-mutex-on-register
Mutex-guard services with the same ID being modified concurrently
8 years ago
Kegan Dougal
0e5716da1a
Add TODO explaining why the mutex storage is bad and what a better solution is
8 years ago
Kegan Dougal
4772d10cbd
Join webhook rooms on Register()
Also fix a NPE when there was no old service.
8 years ago
Kegan Dougal
b32cb06b74
Delete webhooks when receive webhook events for no known repository
8 years ago
Kegan Dougal
26a17ab3d6
Mutex-guard services with the same ID being modified concurrently
Also treat 422 "already exists" errors as success.
8 years ago
Kegsay
313c4ed92a
Merge pull request #43 from matrix-org/kegan/github-make-webhooks-on-register
Create delta webhooks in GithubService.Register()
8 years ago
Kegan Dougal
0f60be3ffc
Create delta webhooks in GithubService.Register()
Remove PostRegister() as it isn't used for anything anymore. Add TODO marker
for guarding against race conditions.
8 years ago
Kegan Dougal
5ac36551a6
Block comment on Github Register() to explain semantics and edge cases
8 years ago
Kegsay
9b649f001d
Merge pull request #39 from matrix-org/kegan/gh-service-client-id-is-opt
Client ID is optional when creating Github services
8 years ago
Kegan Dougal
569587aa6b
Log for nonsensical configs
8 years ago
Kegan Dougal
0ad4fc6135
Add TODO to parse the rest of the config to make sure no webhook config was supplied
8 years ago
Kegan Dougal
699b003c15
Client ID is optional when creating Github services
We only use it for making webhooks (to determine which GH account to load up).
We need it to be optional for the global GH bot to work (which has no account
and uses the account of whoever issued the !command to do the work).
8 years ago
Kegsay
d662d2e678
Merge pull request #38 from matrix-org/kegan/sync-on-startup
Start client sync streams on startup
8 years ago
Kegan Dougal
c7114907f6
Auto-join rooms if set in config
8 years ago
Kegan Dougal
8f8dec5539
Sync rooms on startup
8 years ago
Kegsay
42b547a5c5
Merge pull request #36 from matrix-org/kegan/github-cmd-expan-service
Change how Services are notified for incoming !commands and expansions
8 years ago
Kegan Dougal
b923d364ed
Indexes!
8 years ago
Kegan Dougal
97a292c65f
Change how Services are notified for incoming !commands and expansions
Previously, we would notify `Services` based on matching the `room_id` of the
event with a list of `RoomIDs()` which the service returned.
Now we notify `Services` based on matching the `user_id` of the client listening
for events. This means that the service will receive more events because there
isn't a filter on a set of room IDs.
This is required in order to implement "auto-join on invite" semantics for
Services, as the room ID is not known at that point in time.
8 years ago
Kegan Dougal
b45afac270
Add flags to control if the GH Service should handle expansions/commands
8 years ago
Kegan Dougal
25fb7ca0d9
Return Location headers on 302s
WriteHeader must come AFTER Header().Set() else it does nothing, yay!
8 years ago
Kegan Dougal
b643b8c797
Redirect even if already authed if a redirect URL is given
8 years ago
Kegan Dougal
de3dc5f33c
More logging
8 years ago
Kegan Dougal
479055748c
Log what the clients send us for debugging purposes
8 years ago
Kegan Dougal
cacdc632a4
More logging
8 years ago
Kegan Dougal
4d9574e6da
More logging
8 years ago
Kegan Dougal
ec9e462eab
Linting
8 years ago