- JavaScript 53.9%
- Python 21.4%
- CSS 15.9%
- HTML 8.7%
| .forgejo/workflows | ||
| static | ||
| templates | ||
| tests | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| compose.yaml | ||
| DEPLOY.md | ||
| Dockerfile | ||
| label_history.py | ||
| label_printer.py | ||
| mock_datamatrix.py | ||
| mock_snipe.py | ||
| printers.example.json | ||
| README.md | ||
| server.py | ||
Snipe-IT Scanner
A small web app for scanning BGCWPA asset labels and working with them in Snipe-IT. Scan a label with a phone camera or a USB barcode gun to look up, audit, check out/in, or print labels for an asset.
What each section does
Phone app (/)
Scan a label with the camera, upload a photo of one, or type a tag or serial number.
- Check In/Out: check an asset out to a person, return it (to Ready to Deploy at Carnegie by default), or reassign it to someone else in one step.
- Audit: scan an asset and mark it audited, with an optional note.
- Carts: scan a Chromebook cart, then every Chromebook in it. Shows which ones are missing or belong to another cart, then audits the cart and the Chromebooks in it.
Desktop app (/desktop/, for a USB barcode gun)
- Dashboard: live counts from Snipe-IT (checked out, ready to deploy, audits due, overdue returns, out for repair), plus recent activity and a list of assets that need attention.
- Scan station: choose a mode and scan. Auto just looks the asset up. Check out, Return and Audit apply that action to every asset you scan. Undo reverses the last action.
- New asset: add an asset quickly (warranty, EOL date, optional checkout) and print its label.
- Assets: a searchable, sortable list of every asset. Open one in the side panel to view or edit it, or select several to check out, return, audit, edit or print labels for all of them at once.
- Cart check: the same cart check as the phone app, using the barcode gun.
- Labels: a print queue for asset labels. Add assets by pasting tags, ranges, a CSV, filters or scans, then print. You can scan each new label to make sure it opens the right asset, and every print is saved in a history.
Print label buttons throughout the app print the asset's Snipe-IT label on the CUPS label printer. Both apps support light and dark mode.
Setup
Needs only Python 3, no packages to install.
cp .env.example .env # set SNIPE_URL and SNIPE_API_KEY
python3 server.py
Then open http://localhost:8080 (phone layout) or http://localhost:8080/desktop/.
For label printing, copy printers.example.json to printers.json and set your CUPS printer.
Other options are documented in .env.example.
Deploy (Forgejo Actions)
Every push to main runs .forgejo/workflows/deploy.yml: the tests run in a container, then the runner
on the Docker VM builds the image (Dockerfile) and restarts the snipe-scanner container (compose.yaml) on port 8080.
The server keeps its settings and data outside the repo:
/opt/snipe-scanner/.env– same keys as.env.example. SetCUPS_SERVER=<cups-host>for label printing from the container./home/bgcmanage/snipe-scanner/data/–printers.json, the label history DB and label PDFs (survives redeploys)
The runner needs the labels docker:docker://node:lts and deploy:host. One-time server setup: DEPLOY.md.
Security
The API key stays on the server. server.py proxies only an allow-listed set of Snipe-IT endpoints (ALLOWED),
so use a Snipe-IT account with just the permissions the app needs.
Testing
Run against a fake Snipe-IT instead of the real one:
python3 mock_snipe.py # fake Snipe-IT on :9000
SNIPE_URL=http://localhost:9000 SNIPE_API_KEY=test python3 server.py
Tests: python3 tests/test_labels.py and python3 tests/test_assets.py.