open-vault/ui/app/services/csp-event.js
Matthew Irish 8fd4f5ba0e
UI - transit update (#4298)
* use waitForEvent for the CSP service as @alisdair suggested
* Secrets engine not secret engine
* move algorithm -> hash_algorithm and add support for picking signature_algorithm for RSA keys when signing or verifying in transit
2018-04-09 16:50:36 -05:00

28 lines
632 B
JavaScript

/*eslint-disable no-constant-condition*/
import Ember from 'ember';
import { task, waitForEvent } from 'ember-concurrency';
const { Service, computed } = Ember;
export default Service.extend({
events: [],
connectionViolations: computed.filterBy('events', 'violatedDirective', 'connect-src'),
attach() {
this.get('monitor').perform();
},
remove() {
this.get('monitor').cancelAll();
},
monitor: task(function*() {
this.get('events').clear();
while (true) {
let event = yield waitForEvent(window.document, 'securitypolicyviolation');
this.get('events').addObject(event);
}
}),
});