# cpw-spoof

This repository contains a tool for spoofing Poopulo CPWeb for easy testing. It allows developers to simulate CPW responses and workflows without interacting with the full, hosted system.

## Getting Started

- install pnpm
- install node v24

 == OR == 

- install mise (https://mise.jdx.dev/) for automatic tool management
- run `mise install` to get the correct versions of node and pnpm.

 == THEN == 

- from the root of the project run `pnpm install` to install dependencies.
- run `pnpm start`. This starts the iframe playground app.
- Open `http://localhost:8080` in your computer's browser to verify it is working. Take note of your computer's IP address at this time. 

- install the autorun.zip onto your brightsign device running BrightSign OS 9.1+
- connect to the remote development console by visitng `chrome://inspect` and configuring your brightsign's ip address in the configure menu for remote network targets
- inspect the page For "Content Player for BrightSign"
- in the javascript console paste the following snippet:

```js
 DeviceAPI.dispatch().setCurrentUrl('http://<YOUR_COMPUTER_IP>:8080');
```

Your brightsign should now be displaying the iframe playground application.




### back end
- Mock CPWeb api signature that SoC uses to check for valid channel urls.
- Simple express server that also serves the front-end dist folder

### Front-end
- react + ts + vite
- fps counter
- device detection
- easy postMessage mocking

## Usage

1. run `pnpm i` to isntall dependencies
2. run `pnpm dev` to start the backend on `:8080` and the front-end on `:8079`
3. run `pnpm build` to build the front-end
4. on the SoC device enter `http://<your-computer-ip>:8080` as the channel url
