New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

homebridge-website-to-camera

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-website-to-camera - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

5

CameraSource.js

@@ -5,3 +5,3 @@ "use strict";

let crypto = require("crypto");
let screenshotHelper = require("./ScreenshotHelper");
let ScreenshotHelper = require("./ScreenshotHelper");

@@ -16,2 +16,3 @@ module.exports = Camera;

this.streamControllers = [];
this.screenshotHelper = new ScreenshotHelper(log, conf.url, conf.width, conf.height, conf.chromiumPath)

@@ -63,3 +64,3 @@ this.pendingSessions = {};

Camera.prototype.handleSnapshotRequest = function (request, callback) {
screenshotHelper.getScreenshot(this.conf.url, this.conf.width || 640, this.conf.height || 360, this.conf.chromiumPath)
this.screenshotHelper.getScreenshot()
.then(

@@ -66,0 +67,0 @@ img => {

14

package.json
{
"name": "homebridge-website-to-camera",
"version": "1.1.0",
"version": "1.1.1",
"description": "shows the screenshot of a website as camera (image)",

@@ -21,5 +21,13 @@ "main": "index.js",

"maps",
"traffic"
"traffic",
"chromium",
"chrome",
"puppeteer"
],
"author": "David Werth",
"authors": [
{
"name": "David Werth",
"email": "werth.david@gmail.com"
}
],
"license": "MIT",

@@ -26,0 +34,0 @@ "bugs": {

@@ -15,2 +15,3 @@ # homebridge-website-to-camera

1. Download the latest Chromium `sudo apt-get install chromium-browser`
2. Verify the Chromium installation by running `chromium-browser`, output should be similar to `(chromium-browser:30533): Gtk-WARNING **: cannot open display`
3. Install this plugin using: ` echo "export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true && npm install -g homebridge-website-to-camera" | sudo sh`

@@ -17,0 +18,0 @@ 4. Update your Homebridge `config.json` using the sample below (append in the block 'platforms' not 'accessories')

const puppeteer = require('puppeteer');
let browser;
module.exports = ScreenshotHelper;
const screenshotHelper = exports;
function ScreenshotHelper(log, url, width = 640, height = 360, chromiumPath = "/usr/bin/chromium-browser") {
this.log = log;
this.width = width;
this.height = height;
this.url = url;
this.chromiumPath = chromiumPath;
this.log("Initialized ScreenshotHelper");
}
screenshotHelper.getScreenshot = async function (url, width = 640, height = 360, chromiumPath = "/usr/bin/chromium-browser") {
if (!browser) {
browser = await puppeteer.launch({executablePath: chromiumPath})
ScreenshotHelper.prototype.getScreenshot = async function () {
if (!this.browser) {
this.log("Starting new instance of Chromium: " + this.chromiumPath);
this.browser = await puppeteer.launch({executablePath: this.chromiumPath});
this.log("Chromium started");
}
const page = await browser.newPage();
const page = await this.browser.newPage();
await page.setViewport({width: 640, height: 360});
await page.goto(url, {waitUntil: 'networkidle0', timeout: 6000});
await page.setViewport({width: width, height: height});
this.log("Going to page: " + this.url);
await page.goto(this.url, {waitUntil: 'networkidle0', timeout: 6000});
await page.setViewport({width: this.width, height: this.height});
const screenshot = await page.screenshot({type: "jpeg"});
page.close();
return screenshot;
};
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc