Commit graph

963 commits

Author SHA1 Message Date
Akinori MUSHA
d63f714ae9 RssAgent: Migrate from FeedNormalizer to Feedjira
FeedNormalizer is no longer maintained, and its Atom support has flaws
in that it throws away what RSS::Parser returns and falls back to using
SimpleRSS which is not capable of handling XML entities, resulting in
getting ususable URLs such as ones including `&`.

Feedjira is highly customizable as it implements parsers for various
feed formats on its own using sax-machine.

The `clean` option is reimplemented using the loofah gem.
`Feedjira::FeedUtilities#sanitize_entries!` is not used because it
tries to sanitize non-HTML properties too.

A new option `include_feed_info` is added, with which turned on feed
information is added to each event payload.

A new key `links` is added, which lists all `link` elements.

A new key `enclosure` is added.
2016-10-06 11:49:34 +09:00
Dominik Sander
f1e554cfff Add integration test for dry running Agents 2016-10-05 22:47:38 +02:00
Dominik Sander
5b5da87c3a Add integration tests for Scenario imports 2016-10-05 22:47:38 +02:00
Dominik Sander
b651f08cc5 Fix the specs on rails5 2016-10-05 22:47:38 +02:00
Dominik Sander
26e878c61a Fix the rest of the deprecation warnings 2016-10-05 22:47:38 +02:00
Dominik Sander
03b628dadb Fix "request methods will accept only keyword arguments" deprecation 2016-10-05 22:47:38 +02:00
Akinori MUSHA
7e79d576b5 Improve Utils.normalize_uri (#1719)
* Improve Utils.normalize_uri

Globally replacing generally unsafe characters in a URL would not fix
invalid authorities and paths, so use Addressable::URI to normalize them
when necessary.

This should fix #1701.

* Remove an unused function

* Fix the test case to make sure an IPv6 address is supported
2016-10-05 14:17:04 +09:00
Akinori MUSHA
a47c5c8a80 PushoverAgent: Treat parameter options as templates rather than default values
This should fix #1718.

While at it, character limit implementation is fixed: `slice(0..n)`
would take the first n+1 characters instead of n.
2016-10-04 21:57:30 +09:00
Dominik Sander
4309460896 Fix escape characters of events when dry running
JSONEditor double escapes escape characters to properly display them in the UI, however when dry running Agents we
actually need to send the Event's characters as they were.
Before an event containing new lines like this `Line A\nLineB` would be send as `Line A\\nLineB` to the backend. By
replacing the double escaped slashes we ensure the event is handled as it would be when not dry running.

 #1677
2016-09-30 17:06:50 +02:00
Dominik Sander
e0fa7f00d0 Merge pull request #1695 from kreuzwerker/missing-agent-warning
Rescue from AR:SubclassNotFound and allow to delete agents
2016-09-21 21:04:46 +02:00
Dominik Sander
d2b26a0684 Merge pull request #1698 from kreuzwerker/fix-form-completion
Replace jquery.serializeObject with new implementation
2016-09-21 20:58:03 +02:00
Dominik Sander
42b132017f Rescue from AR:SubclassNotFound and allow to delete agents
Especially when using Agent gems it happens that an Agent was deleted from the gem or the user removed a gem from the
configuration. Instead of failing with an Internal Server Error the user now is offered to delete all undefined agents.

`type.constantize` is needed to invoke the Rails auto_loader in development since not all Agent classes are loaded when
the application boots.
2016-09-21 20:10:49 +02:00
Dominik Sander
517e42c9d2 Replace jquery.serializeObject with new implementation
The old serializeObject function serialized checked checkboxes as an array which was not correct and with
strong_parameters enabled it triggered a `UnpermittedParameters` error.

In the AgentEditPage javascript we only need to initialize `select2` when then `#agent_type` field is a select
box (trying to call `select2` on normal text fields caused a javascript error in the feature specs)
2016-09-21 20:05:18 +02:00
Andrew Cantino
0dd1c78ae0 Ignore the fixture API key in WeatherAgent (#1694) 2016-09-20 20:31:44 -04:00
Dominik Sander
663eebc080 Add multipart file upload to PostAgent
This allows the PostAgent to receive `file_pointer` events and upload the data to a website.
2016-09-19 10:39:48 +02:00
Thiago Talma
4fdd69c6f4 interpolated response (#1682) 2016-09-15 19:15:46 -04:00
Dominik Sander
58f388d530 service_id is a valid part of the agent_params
Fixes #1685
2016-09-15 16:17:46 +02:00
Dominik Sander
b2f031003f Use strong_parameters and drop protected_attributes
* Ensure admin attribute can not be set at sign up and the agents user_id is not changeable
* Remove ACCESSIBLE_ATTRIBUTES from the User model
* Remove side effect on agent_params from AgentsController#build_agent
2016-09-12 15:54:26 +02:00
Thiago Talma
c3d5380f98 Option to set response code for webhook agent (#1676)
* setting for webhook response code

* some adjustments
2016-09-09 09:53:29 -04:00
Dominik Sander
f42ad96ed6 Merge pull request #1645 from dsander/retry-twitter-action-agent
Allow TwitterUserAgent to retry failed actions
2016-09-08 20:44:20 +02:00
Will Read
6b459ef412 Extract service option prviders for non-standard Omniauth payloads (#1655)
* Extract option prviders for non-standard Omniauth payloads

- should enable huginn_agent gem developers to add their own providers
- devs would reopen OmniauthCallbacksController and define their specific action, supplying their own option provider

* Creates a registry for option providers on the Service class

- enables huginn_agent gem developers to register their own omniauth option interpreters

* Cleans up changes to the global Service class after the spec
2016-09-04 19:39:49 -04:00
Albert Sun
6bb61065ec Allow admins to login as another user (#1659)
* switch_to_user and switch_back routes

* Uses session to store original user id
2016-09-02 15:32:38 -04:00
Dominik Sander
49d3611273 Allow TwitterUserAgent to retry failed actions
Add new `emit_error_events` option which is set to `false` for all new `TwitterActionAgent`s. This will ensure the Agent
is retried when the action failed by raising an exception.

For all existing `TwitterUserAgent`s the option is set to `true` to keep the previous behavior.
2016-08-25 19:49:31 +02:00
Will Read
a6fe9743f6 EmailDigestAgent relies on received events, rather in memory (#1624)
* EmailDigestAgent relies on received events, rather than storing them in memory

- Addressing a problem where 40,000+ events were stored in one agent's memory, and the agent never loaded from the database

* Cleans up references to memory["queue"]

- incorporates suggested style and safeguards

* Adds clarification on event inclusion in email

* Use `reorder` rather than stripping away all scoping
2016-08-16 23:05:16 -04:00
Dominik Sander
fade736381 Update rails to 4.2.7.1
* Update dependencies to fix deprecation warnings
* Fix BoxcarAgent specs (found by rspec warning about expecting `raise_error` without specifying the exception)
2016-08-11 20:56:32 +02:00
Akinori MUSHA
9b23c28049 Merge pull request #1444 from cantino/data_output_agent_limits_events_after_ordering
DataOutputAgent limits events after ordering
2016-08-08 14:12:25 +09:00
Sascha Hagedorn
d627a18f6d Added api_key option to UserLocationAgent (#1613)
* Added `api_key` option to UserLocationAgent

The `api_key` is used on the summary page of the UserLocationAgent
as well as the event detail page to display a location on a Google
Map which requires an API key. Closes #1612

* added link to Google API key documentation
2016-08-04 21:22:59 -04:00
Darren Cauthon
9d584b6ba4 Liquid output agent (#1587)
* Start with a stripped copy of the data output agent.

* Run the data from the last event through a liquid template.

* Flatten the secret logic to allow for an easier switch to FormConfigurable.

* Switch to form configurable, and allow the content of the page to be configured.

* Allow the mime type to be changed.

* Cleanup.

* Write how this template works.

* Better default values.

* Cleanup.

* Refactor.

* Start testing.

* Test the validation.

* Test receive.

* Test the happy path through the receive web events.

* Test the authentication.

* This is actually a match.

* Refactor.

* Refactor.

* Refactor for better testing.

* Create a mode that lets the logic change. Start with a merge behavior.

* Refactor.

* Create a form configurable setting to change the mode.

* Document how the modes work.

* Wording change.

* Go with a singular secret.

* Fix typo.

* Fix the tests.

* Test cleanup.

* If not one of two types that receive events, ignore all received events.

* Set up these tests for the next set of changes.

* Isolate the method that gets the data for the liquid template.

* Look up past events to render through the liquid template.

* Implement a limit of 2 events.

* Extract a method.

* Hook the limit to options.

* Implement a limit of X events.

* Implement a date limit.

* Refactor the count limit.

* Limit by date with sql, not in-memory objects.

* This ordering is already built into the scope.

* Refactor the dates a bit.

* Put in a few checks around the date limits.

* Add the last X event options to the form and the documentation.

* Missed one bit of documentation.

* Add a view for a liquid output agent that makes it easy to retrieve the generated URL.

* This agent cannot accept events.

* Hardcode the possibilities instead of inspecting the integer.

* Do not be case sensitive on the date filter.

* Hardcode a limit of 5000, just in case no limit was provided.

* Better checks around the time period parsing.

* Test the hardcodes, and rename for consistency.

* Nevermind on that rename.

* Do not be case sensitive on this mode.

* Test that it works even when the casing on the mode is wrong.

* Here is more descriptive default content.

* Text change.

* The if is no longer necessary.

* Refactor.

* Move the limit down to 1000.

* Put a hard limit of 1000.

* Note the new event limit... limit.

* Validate for a valid event limit.

* Do not throw an error if someone types in a non-integer into this field.

* Text update.

* Typo.

* Add a link to the Liquid Templating engine.
2016-07-25 21:23:33 -04:00
Andrew Cantino
cc72f79e0b Allow PostAgent headers to interpolate event data (#1606) 2016-07-25 19:59:14 -04:00
Alex Jordan
c1095330ea Make HttpStatusAgent provide redirect info (#1590)
* Make HttpStatusAgent provide redirect info

* Mock to_hash for HttpStatusAgent specs

* Refactor HttpStatusAgent spec mock responses
2016-07-20 08:29:09 -04:00
Darren Cauthon
29007c9019 Add an option to fire http status events only when a change occurs. (#1582) 2016-07-14 21:12:20 -04:00
Lloyd Pick
8c0a10fc4b attribute difference agent (#1572) 2016-07-09 19:51:08 -04:00
Paul Platenius
da833b13bb Add setMemory function to Javascript Agent 2016-07-03 22:48:45 +02:00
Dominik Sander
811f9c27d1 Allow specifing Agent gem in the Gemfile 2016-06-20 10:37:33 +02:00
Dominik Sander
9c8ec30cc5 Move RSSAgent back to its original path 2016-06-20 10:32:37 +02:00
Andrew Cantino
0bd46b524f initial effort on pulling Agents into gems 2016-06-20 10:32:37 +02:00
Alex Jordan
3c8d6655a3 Expand HTTP status agent (#1521)
* Add WIP support for HTTP headers

* Actually pass the header to check_this_url

* Fix an unmerged hunk

* Fix some syntax errors

* Fix an outdated variable name

* Comment on which sections do what

* Get rid of (another) unmerged hunk

* Show a form element for the header field

* Fix event emitter conditional

* Adjust tests for header logic

* Test for not returning a header

* Refactor payload generation

* Rename 'header' to 'headers'

* Add multiple header support

* Update HttpStatusAgent docs

* Fix (some) failing tests

* Fix remaining tests

* Add specs for HttpStatusAgent's header code

* Super tiny cleanups
2016-06-20 00:37:15 -07:00
Akinori MUSHA
371bfa34b7 Merge pull request #1551 from cantino/jsagent_fix_memory
Fix `this.memory(key, falsy)` not working in JavaScriptAgent
2016-06-20 12:48:44 +09:00
Andrey Yantsen
3b4b4f3761 [fix #1512] add not in comparison into Trigger Agent (#1545) 2016-06-18 16:09:54 -07:00
Enfop
5cdc37f716 DryRunMemory (#1550) 2016-06-18 15:53:58 -07:00
Akinori MUSHA
4edb6e0866 Add specs that this.memory(key, falsy) should work
This spots a bug in `getMemory()`.
2016-06-16 20:11:58 +09:00
Judy Ngai
1abcd947f5 Uploadicons (#1427)
* checking in work for glyph upload

* checking in icon selections

* added more icon options

* work on upload icon

* fix issue

* switched to options for select

* removed wrapper and removed commment

* add migration to support icon

* remove right floating

* rm params session add it to model

* rebuilt the menu

* rm extra div

* converted js to coffee

* quick change in indentation

* using the view helper

* submitting icons and loading into form

* added icon to both scenario export and import

* added icon to spec

* low level caching the icons

* tentative work in making a new coffee class

* renamed js page

* switched to cache in memory and worked on coffee class

* made pathsmatching compatible for all scenarios

* switched to rails root

* fixed all rubocop stylings

* fixed line is too long styling

* rm private method definition

* patch to avoid having no icon

* blank or nil?

* reordering the lines
2016-06-15 23:52:50 -07:00
Enfop
2295875d81 Add deleteKey function to Javascript Agent (#1543)
* Add deleteKey function to Javascript Agent

* JSONifying return value of deleteKey
2016-06-15 23:30:33 -07:00
Dominik Sander
47715c3349 Merge pull request #1541 from kreuzwerker/permanent-dropbox-links
Permanent dropbox links
2016-06-14 09:30:07 +02:00
Judy Ngai
f57a3af521 enable disable all agents within a scenario (#1506)
* tentative work on enable disable all agents within a scenario

* more work with pr

* more work

* better names and save a line of code

* coffeescript to change modal text and hidden disabled value

* redoing coffeescript class to save some code

* initing the function

* updated coffeescript

* change text from specific modal, made names more specific

* updates disabled test and rubocop bug

* improved test and refactored method per rubocop warnings

* switched from 0 to false

* switched from 0 to false and 1 to true

* fixed null bug in postgresql database

* fixed ruby boolean bug

* moved instances into let lazy load and use proper agent fixture

* putting in a different fix

* using existing membership and agent and another version of test

* switch back to 2 not 3 after rm an agent in yml

* made test passed locally

* forgot to remove debuging pp

* small spacing bug

* trying to get rid of newline in file

* typo not agent but scenario

* minor changes to syntax and naming

* rm potential failure and changed update_all statement

* fixing new line issue

* removed unnecessary if else statement from method
2016-06-13 22:36:22 -07:00
Dominik Sander
d4008ba4d2 Add specs for permanent urls in the DropboxFileUrlAgent 2016-06-10 10:20:34 +02:00
Akinori MUSHA
978ec06199 Rename events_order to events_list_order and readd events_order
`events_order` determines how to select events for outputting, whereas
`events_list_order` determines how to list selected events in the
output.
2016-06-07 15:11:47 +09:00
Akinori MUSHA
fe50730033 DataOutputAgent should limit events after ordering
This should fix #1044.
2016-06-06 17:41:37 +09:00
Enfop
4b011a1370 Javascript Agent Hash and Array memory (#1524)
* Javascript Agent Hash and Array memory

* add specs
2016-06-04 17:28:37 -07:00
luckylu
90f5de5fe3 fix typo (#1533) 2016-06-03 21:22:25 -07:00