Socket
Book a DemoInstallSign in
Socket

@xofeulb/bluefox-server

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xofeulb/bluefox-server

HTTP and WS Server for BlueFox and BlueFoxServer (VSCode)

0.3.3
latest
Source
npmnpm
Version published
Weekly downloads
2
Maintainers
0
Weekly downloads
 
Created
Source

bluefox-nodejs-server

npm i @xofeulb/bluefox-server
import { BlueFoxServer } from "../src/index.js";
import fs from "fs";
import child_process from "child_process";
let sleep = (msec) => new Promise((resolve) => setTimeout(resolve, msec));

if (!fs.existsSync("./test/BlueFoxScript-Examples")) {
  child_process.execSync("git clone https://github.com/xoFeulB/BlueFoxScript-Examples.git ./test/BlueFoxScript-Examples");
} else {
  child_process.execSync("git -C ./test/BlueFoxScript-Examples pull");
}

const gate = new BlueFoxServer.Gate(9999);
const server = new BlueFoxServer.Server("./test/BlueFoxScript-Examples", "ws://127.0.0.1:9999");

gate.start();
server.start();

let BlueFox = await gate.webSocketServer.openChrome("jmkijjjfiimebohbccipaahimknabkfe");
let config = async () => {
  // window scope
  url = "https://ooo.bluefox.ooo/BlueFoxDemo/8bit.html"; // or window.url
  blueFoxScript = await new BlueFoxScript();
};
let callable = async () => {
  let tab = await blueFoxScript.createWindow(url);
  let result = await tab.dispatchScriptTillTrue(
    // in https://ooo.bluefox.ooo/BlueFoxDemo/8bit.html scope
    () => {
      if (document.querySelector("[out]").textContent == "#80") {
        return [...document.querySelectorAll("input")].map((_) => {
          return {
            testid: _.attributes["data-testid"].value,
            checked: _.checked,
          }
        });
      } else {
        return false;
      }
    },
    (max_polling = 100)
  );
  alert(JSON.stringify(result.result.value, null, 4));
  return result.result.value;
}

await sleep(5000);
await BlueFox.runScript(`(${config.toString()})();`);
let result = await BlueFox.runScript(
  `(${callable.toString()})();`
);
if (JSON.stringify({
  type: 'object',
  value: [
    { checked: true, testid: 'bit-8' },
    { checked: false, testid: 'bit-7' },
    { checked: false, testid: 'bit-6' },
    { checked: false, testid: 'bit-5' },
    { checked: false, testid: 'bit-4' },
    { checked: false, testid: 'bit-3' },
    { checked: false, testid: 'bit-2' },
    { checked: false, testid: 'bit-1' }
  ]
}) == JSON.stringify(result.result)) {
  console.info("OK");
} else {
  console.info("NG");
}

FAQs

Package last updated on 02 Sep 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.