Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
cordova-plugin-browsersync
Advanced tools
Cordova Plugin to integrate browser-sync in the workflow
Integrating BrowserSync into your Cordova workflow.
www
folder and automatically reload HTML and CSS in all connected devicesHere is a blog post explaining the plugin and its internals.
There are three ways to use the code in this plugin. Ensure that you have added the ws:
and unsafe-inline
CSP policies to your default-src
section of the CSP meta tag (<meta content=...>
) in index.html file.
Note that a
-- --live-reload
may need to be passed tocordova run
command.
The presence of this --live-reload
flag triggers the live reload workflow. Without this flag, the project remains unchanged. This way, the plugin does not have to be removed before packaging it for final deployment.
This simplest way to integrate this in your Cordova workflow is to add it as a plugin
cordova plugin add cordova-plugin-browsersync
and then run run the cordova with cordova run -- --live-reload
.
Clone this repo and run npm run createHook
to get a after_prepare.js
. Add this file as an after_prepare
hook to your config.xml. For example:
<hook type="after_prepare" src="scripts/after_prepare.js" />
You can also require('cordova-plugin-browsersync')
in your node module and use the changeHost
function and browserSyncServer
directly in your existing workflow.
In many cases other hooks may copy over JS, CSS or image assets into folders like www\lib
, typically from locations like bower_components
. These hooks may run at after_prepare
and hence should be ignored in the live reload workflow. To achieve this, run the command as
cordova run -- --live-reload --ignore=lib/**/*.*
The --ignore
commands takes an anymatch compatible destination relative to the www
folder.
Sometimes, depending on your network, your OS will report multiple external IP addresses. If this happens, by default browsersync just picks the first one and hopes for the best.
To override this behaviour and manually select which host you want to use for the external interface, use the --host
option, for example:
cordova run -- --live-reload --host=192.168.1.1
If you need to forward ports from your local computer to the device because the device is not in the same network as your device then you may getting an error or red circle.
If this happens the problem could be the 3000
port. Then you can try another one for example 8090
which should work then.
cordova run -- --live-reload --port=8090
If you do not have "index.html" in your config.xml
under content
node then you need to set this option to the value.
Please use the --index
option.
cordova run -- --live-reload --index=content.html
FAQs
Cordova Plugin to integrate browser-sync in the workflow
We found that cordova-plugin-browsersync 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.