
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
ember-window-messenger
Advanced tools
This Ember addon is a lightweight postMessage client/server implementation. It is built on promises so the fetch
and rpc
methods can be used directly in your route model()
hooks.
For changelog see CHANGELOG.md
It supports JSON only messages for now
ember install ember-window-messenger
Add target:origin
map to your config/environment.js
. This effectively defines which targets (windows, frames) is your app communicating with.
APP: {
// Here you can pass flags/options to your application instance
// when it is created
'ember-window-messenger': {
'parent': 'http://localhost:4200',
'target-1': 'http://localhost:4200',
'target-2': 'http://localhost:4200',
'popup': 'http://localhost:4200'
}
}
This list is also used for validation, to check if message comes from an allowed origin.
If you dare, fire up the dummy app in this addon and test it out. Below are the basic examples, see dummy app for more.
import Ember from 'ember';
export default Ember.Route.extend({
server: Ember.inject.service('window-messenger-server'),
init() {
this._super(...arguments);
this.get('server').on('demo-data', (resolve, reject, query) => {
resolve('Some data');
});
}
});
import Ember from 'ember';
export default Ember.Route.extend({
client: Ember.inject.service('window-messenger-client'),
model() {
return this.get('client').fetch('demo-data');
}
});
This can be used from parent window to frames/tabs communication.
import Ember from 'ember';
export default Ember.Route.extend({
client: Ember.inject.service('window-messenger-client'),
model() {
return this.get('client').fetch('popup:demo-data');
}
});
Internally it is the same as fetch
, but provides semantic sugar to your app code.
import Ember from 'ember';
export default Ember.Route.extend({
client: Ember.inject.service('window-messenger-client'),
actions {
runMe() {
this.get('client').rpc('start-worker').then((response) => {
// handle response here
});
}
}
});
If you want to communicate with an iframe or a popup window opened with window.open
, then you have to register your window instance on the client with matching target name from config/environment
map.
// app/components/x-frame.js
import Ember from 'ember';
export default Ember.Component.extend({
client: Ember.inject.service('window-messenger-client'),
didInsertElement() {
this.get('client').addTarget('target-1', this.$().get(0).contentWindow);
},
willDestroyElement() {
this.get('client').removeTarget('target-1');
}
});
// app/routes/my-route.js
import Ember from 'ember';
export default Ember.Route.extend({
client: Ember.inject.service('window-messenger-client'),
actions: {
openPopup() {
let win = window.open('/some/path', 'Example popup', 'toolbar=no,resizable=no,width=400,height=400');
this.get('client').addTarget('popup', win);
},
fetchFromPopup() {
this.get('client').fetch('popup:some-data').then((name) => {
this.controller.set('model', name);
});
}
}
});
// app/routes/my-route.js
import Ember from 'ember';
export default Ember.Route.extend({
client: Ember.inject.service('window-messenger-client'),
actions: {
openPopup() {
if (!this.get('client').hasTarget('popup')) {
let win = window.open('/some/path', 'Example popup', 'toolbar=no,resizable=no,width=400,height=400');
this.get('client').addTarget('popup', win);
}
},
}
});
git clone <repository-url>
this repositorycd ember-window-messenger
yarn install
or npm install
yarn run lint:hbs
yarn run lint:js
yarn run lint:js -- --fix
ember test
– Runs the test suite on the current Ember versionember test --server
– Runs the test suite in "watch mode"ember try:each
– Runs the test suite against multiple Ember versionsember serve
For more information on using ember-cli, visit https://ember-cli.com/.
This project is licensed under the MIT License.
[2.0.0] - 2018-10-06
FAQs
Simple window postMessage Ember addon
We found that ember-window-messenger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.