Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

FlashForgeWebUI is a standalone web-based interface for controlling and monitoring FlashForge 3D printers. It was ported from the FlashForgeUI-Electron project (located at `C:\Users\Cope\Documents\GitHub\FlashForgeUI-Electron`) to create a lightweight deployment option for low-spec devices like Raspberry Pi, without Electron dependencies.
FlashForgeWebUI is a standalone web-based interface for controlling and monitoring FlashForge 3D printers. It provides a lightweight deployment option for low-spec devices like Raspberry Pi, without Electron dependencies.

**Current Status**: Initial porting is complete but not fully tested. Some bugs are expected.
**Current Status**: Production-ready. Core functionality tested and working including multi-printer support, Spoolman integration, and cross-platform binary distribution.

## Build & Development Commands

Expand Down Expand Up @@ -278,19 +278,19 @@ class Service extends EventEmitter<EventMap> {

## Testing Notes

Initial porting is complete but **not fully tested**. Known areas to test:
Core functionality has been tested and verified:
- Multi-printer context switching
- Camera proxy stability under load
- RTSP streaming for supported printers
- Spoolman integration (filament tracking)
- Print state monitoring and notifications
- Temperature anomaly detection
- Different printer model backends (AD5X, 5M, 5M Pro, legacy)
- Platform-specific binary builds (Linux ARM, Linux x64, Windows, macOS)
- WebUI authentication
- Platform-specific builds (Linux ARM, Windows, macOS)
- Static file serving in packaged binaries

Areas for continued testing:
- Camera proxy stability under extended load
- RTSP streaming for all supported printers
- Temperature anomaly detection edge cases

## Related Projects

- **FlashForgeUI-Electron**: Parent project with full Electron desktop app (`C:\Users\Cope\Documents\GitHub\FlashForgeUI-Electron`)
- **@ghosttypes/ff-api**: FlashForge API client library (public package)
- **@parallel-7/slicer-meta**: Printer metadata and model utilities (public package)
142 changes: 120 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,61 +122,159 @@ FlashForge WebUI supports a wide range of FlashForge printers through its adapta

<div align="center">

**Pre-built Binaries**

</div>

Download the appropriate binary for your platform from the [Releases](https://github.com/Parallel-7/FlashForgeWebUI/releases) page:

| Platform | Binary | Notes |
|----------|--------|-------|
| Windows x64 | `flashforge-webui-win-x64.exe` | Most Windows PCs |
| macOS x64 | `flashforge-webui-macos-x64` | Intel Macs |
| macOS ARM | `flashforge-webui-macos-arm64` | Apple Silicon (M1/M2/M3) |
| Linux x64 | `flashforge-webui-linux-x64` | Most Linux PCs |
| Linux ARM64 | `flashforge-webui-linux-arm64` | Raspberry Pi 4/5 (64-bit OS) |
| Linux ARMv7 | `flashforge-webui-linux-armv7` | Raspberry Pi 3/4 (32-bit OS) |

**Raspberry Pi Users:** Use `flashforge-webui-linux-arm64` for 64-bit Raspberry Pi OS, or `flashforge-webui-linux-armv7` for 32-bit.

```bash
# Make the binary executable (Linux/macOS)
chmod +x flashforge-webui-linux-arm64

# Run with auto-connect to last used printer
./flashforge-webui-linux-arm64 --last-used

# Run without auto-connect
./flashforge-webui-linux-arm64 --no-printers
```

<div align="center">

**Running from Source**

</div>

```bash
# Clone the repository
git clone https://github.com/Parallel-7/flashforge-webui.git
cd flashforge-webui
git clone https://github.com/Parallel-7/FlashForgeWebUI.git
cd FlashForgeWebUI

# Install dependencies
npm install

# Build the application
# Build the application (required before first run)
npm run build

# Start the server
npm start

# Or start with auto-connect to last used printer
npm start -- --last-used
```

**Development Mode:**
```bash
# Build and watch for changes with hot reload
npm run dev
```

<div align="center">
<h2>Usage</h2>
</div>

After starting the server, open your browser and navigate to:

```
http://localhost:3000
```

Or if accessing from another device on your network:

```
http://<server-ip>:3000
```

**Default Login:** The default password is `changeme`. You should change this in `data/config.json` or via the `--webui-password` flag.

<div align="center">
<h2>Command Line Options</h2>
</div>

| Option | Description |
|--------|-------------|
| `--last-used` | Connect to the last used printer on startup |
| `--all-saved-printers` | Connect to all saved printers on startup |
| `--printers="IP:TYPE:CODE,..."` | Connect to specific printers (TYPE: "new" or "legacy") |
| `--no-printers` | Start WebUI only, without connecting to any printer |
| `--webui-port=PORT` | Override the WebUI port (default: 3000) |
| `--webui-password=PASS` | Override the WebUI password |

<div align="center">
<h2>Configuration</h2>
</div>

<div align="center">

The application automatically creates a configuration file at `data/config.json` on first run. You can modify this file to customize your experience.
The application automatically creates a configuration file at `data/config.json` on first run.

</div>

```json
{
"WebUIEnabled": true,
"WebUIPort": 3000,
"WebUIPassword": "changeme",
"WebUIPasswordRequired": true,
"SpoolmanEnabled": false,
"SpoolmanServerUrl": "http://your-spoolman-instance:7912",
"CameraProxyPort": 8181
}
```
| Setting | Default | Description |
|---------|---------|-------------|
| `WebUIEnabled` | `true` | Enable/disable the web interface |
| `WebUIPort` | `3000` | Port for the web server |
| `WebUIPassword` | `changeme` | Login password (change this!) |
| `WebUIPasswordRequired` | `true` | Require password to access |
| `SpoolmanEnabled` | `false` | Enable Spoolman integration |
| `SpoolmanServerUrl` | `""` | Your Spoolman server URL (e.g., `http://192.168.1.100:7912`) |
| `CameraProxyPort` | `8181` | Starting port for camera proxies |

<div align="center">
<h2>Development</h2>
<h2>Building from Source</h2>
</div>

```bash
# Start development server with hot-reload
npm run dev

# Build for specific platform
npm run build:linux
npm run build:win
npm run build:mac
npm run build:linux # Linux x64
npm run build:linux-arm # Linux ARM64 (Raspberry Pi 4/5)
npm run build:linux-armv7 # Linux ARMv7 (Raspberry Pi 3)
npm run build:win # Windows x64
npm run build:mac # macOS x64
npm run build:mac-arm # macOS ARM (Apple Silicon)
```

<div align="center">
<h2>Troubleshooting</h2>
</div>

**"Cannot GET /" or blank page when accessing WebUI:**
- If running from source: Make sure you ran `npm run build` before `npm start`
- If using a pre-1.0.2 binary: Update to version 1.0.2 or later (fixes static file serving bug)

**"Permission denied" when running binary:**
```bash
chmod +x flashforge-webui-linux-*
```

**Port already in use:**
- Change the port in `data/config.json` or use `--webui-port=3001`

**Cannot connect to printer:**
- Ensure your printer is on the same network as the device running WebUI
- Check that the printer's IP address is correct
- For legacy printers, ensure TCP port 8899 is accessible

**Selecting the correct binary for your platform:**
- Windows: `flashforge-webui-win-x64.exe`
- macOS Intel: `flashforge-webui-macos-x64`
- macOS Apple Silicon: `flashforge-webui-macos-arm64`
- Linux x64: `flashforge-webui-linux-x64`
- Raspberry Pi (64-bit OS): `flashforge-webui-linux-arm64`
- Raspberry Pi (32-bit OS): `flashforge-webui-linux-armv7`
- Check your architecture with `uname -m` (x86_64 = x64, aarch64 = ARM64, armv7l = ARMv7)

<div align="center">
<h2>License</h2>
</div>
Expand Down
42 changes: 42 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Jest configuration for FlashForgeWebUI
*/

module.exports = {
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
roots: ['<rootDir>/src'],
testMatch: [
'**/?(*.)+(spec|test).ts'
],
testPathIgnorePatterns: [
'<rootDir>/src/__tests__/setup.ts'
],
transform: {
'^.+\\.ts$': ['ts-jest', {
useESM: true,
}],
},
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!src/webui/static/**/*.ts',
'!src/**/*.test.ts',
'!src/**/*.spec.ts',
'!src/__tests__/**',
],
coverageDirectory: 'coverage',
coverageReporters: [
'text',
'lcov',
'html'
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
moduleFileExtensions: ['ts', 'js', 'json'],
verbose: true,
testTimeout: 10000,
setupFilesAfterEnv: ['<rootDir>/src/__tests__/setup.ts'],
extensionsToTreatAsEsm: ['.ts'],
};
Loading