Sichtungen
Der Ordner demo-kit/ simuliert das Gerät für die Demo auf der Startseite. Auf dem Gerät wird er nicht benötigt.
Der Ordner demo-kit/ simuliert das Gerät für die Demo auf der Startseite. Auf dem Gerät wird er nicht benötigt.
A nature journal on a device, for birds, butterflies and whatever else crosses the path. The person frames what they see in a live viewfinder (or takes or picks a photo), names the species, counts them, and if they like adds a note, a short voice note and where they were. The device keeps the journal; its own screen (device UIs) runs in the Connectivitizer app and uses everything a device page may ask the phone for, all inside one New sighting composer, each from its own button and with a sentence that says what it is for:
| Button | What it uses |
|---|---|
| Live camera, then the round shutter Capture | The camera, as a live viewfinder in the page (getUserMedia({ video: { facingMode: "environment" } })); the picture is taken from a canvas as a JPEG and the camera is stopped. |
| Take or choose | The phone's own camera app or photo picker (<input type="file" accept="image/*" capture="environment">). Needs no permission. |
| Voice note, then Stop | The microphone (getUserMedia({ audio: true }) and MediaRecorder), at most 15 seconds with a small level meter, played back before saving. |
| Location | The location, once (navigator.geolocation.getCurrentPosition): latitude, longitude and accuracy go with the sighting ("Location added ±12 m"). |
| Open in map, Email this entry (in a sighting's ⋯ menu), How device screens work, Write an email | Links that open outside the app: OpenStreetMap at the sighting's position, a mailto: with the sighting, the device-UI guide on connectivitizer.com, an empty mailto:. |
The journal groups the sightings by day: the photo as the card's picture, species and count as its title, a voice note as a play button with its waveform, the location as an Open in map chip, and Edit, Email this entry and Delete in each card's ⋯ menu. Above it, a tally of sightings, species and individuals. The manifest also offers a whole-app theme, Meadow (appThemes), in the page's colours.
When a request is refused, the page says where it is turned on, for example "To use the camera here, turn on 'Device pages may ask for the camera' under Account › Security in the Connectivitizer app.", and in the app it adds a button Open Account › Security that goes there (connectivitizer.openSettings()). In a browser it says to allow it in the browser's site settings instead.
| File | What it is |
|---|---|
server.mjs | The web server on 127.0.0.1 (node:http, no packages): the entries in memory, the screen and its manifest. Runs on its own with npm run local. |
index.mjs | Starts the server and makes it reachable through Connectivitizer as the service api. |
ui/field-log.html | The screen: one self-contained page, light and dark after the phone's setting. |
ui/manifest.json | What the device serves as /.cz/ui.json: the screen's name (Sightings), the colours of the app's bar and the app theme Meadow. |
ui/demo-data.js | The pretend device for the demo on the start page of the web app (demo kit). |
server.test.mjs | Tests of the server's addresses and limits (npm test). |
Dockerfile | The device as a container, to run unattended. |
Needs Node.js 20+.
cd src/examples/field-log
npm install # @huelake/connectivitizer from npm
$env:CZ_DEVICE_KEY = "czd_..." # web app: Credentials > Create credential > Device key
$env:CZ_SHARED_KEY = "czs_..." # web app: Credentials > Generate a shared key
npm startTo try the SDK of this checkout instead of the release on npm: ../pack-local.ps1 (packs it into artifacts/packages), then npm install --no-save ../../../artifacts/packages/huelake-connectivitizer-1.0.0-dev.tgz.
The device appears in the workspace as field-log (CZ_DEVICE_NAME changes that) the first time it connects. CZ_API_URL points it at another platform than the default one, and CZ_RELAY_ONLY=1 makes it refuse peer-to-peer connections. In the Connectivitizer app, open the device to see its screen; on a computer, cz ui field-log shows it in the browser.
Without Connectivitizer, npm run local serves the same screen on http://127.0.0.1:8770/.cz/ui.html (another port: node server.mjs 9000). Opened there, the browser asks for the camera, microphone and location itself, as for any site; 127.0.0.1 counts as a secure address, other addresses on the network do not, and there the browser offers no camera or microphone (the photo picker still works).
docker build -t field-log .
docker run -d --restart unless-stopped --name field-log -e CZ_DEVICE_KEY=czd_... -e CZ_SHARED_KEY=czs_... field-logThe image installs the SDK from npm, runs as the user node, opens no port and needs no volume. The same variables as above apply (CZ_DEVICE_NAME, CZ_API_URL, CZ_RELAY_ONLY).
All under the service api. Errors are one sentence in plain text, with the status.
| Request | Answer |
|---|---|
GET /.cz/ui.json, GET /.cz/ui.html | The screen. The manifest colours the app's bar like the page (theme); the page switches it to its dark colours with connectivitizer.setTheme when the phone is set to dark. |
GET /info | { "name", "entries", "uptimeSeconds", "limits": { "maxEntries", "maxNoteChars", "maxSpeciesChars", "maxCount", "maxPhotoBytes", "maxAudioBytes", "keepHours" }, "appsConnected" } |
GET /entries | The entries, newest first, without photos and sound: [ { "id", "createdAt", "note", "species", "count", "location": { "lat", "lon", "accuracy" } | null, "photo": { "type", "size" } | null, "audio": { "type", "size" } | null, "sample": true? } ] |
POST /entries | application/json { "note"?, "species"?, "count"?, "location"? }; answers 201 with the entry. Other content types get 415, so that a form on another site cannot post here. species is "" and count null when the entry has none (as all entries from before there were species); the page shows those as Unnamed sighting. |
PUT /entries/{id} | application/json with any of note, species, count, location: what the body names is replaced (null or "" clears it), the rest stays; answers with the entry. |
PUT /entries/{id}/photo | The photo as the raw body, image/jpeg, image/png or image/webp; answers with the entry. |
PUT /entries/{id}/audio | The voice note as the raw body, audio/webm, audio/ogg, audio/mp4, audio/mpeg or audio/wav; answers with the entry. |
GET /entries/{id}/photo, GET /entries/{id}/audio | The bytes, with the type they were stored with. |
DELETE /entries/{id} | 204. DELETE /entries/{id}/photo and …/audio remove only that part. |
GET /entries/{id} | One entry, as in the list. |
The page saves an entry in up to three requests: POST /entries, then the photo and the voice note as raw bodies. Raw bodies keep the bridge's work small (it carries every body as base64 already). If an upload is refused, the page deletes the half entry again and keeps the draft.
The device runs unattended and can be reached by anyone with access to its workspace, so everything it keeps is bounded, and nothing is written to disk:
| Entries | At most 30; a new one pushes out the oldest. Each is forgotten after 24 hours, and all are gone when the device restarts. The example entry the device starts with is not forgotten by time, only deleted or pushed out. |
| Note | At most 1000 characters (413). Control characters other than line breaks and tabs are dropped. |
| Species | Text of at most 80 characters, on one line (400); runs of spaces become one. |
| Count | A whole number from 1 to 999 (400). |
| Photo | At most 1.5 MB (413, "The photo is larger than 1.5 MB."). The page makes a JPEG of at most 1600 pixels a side before sending, so a photo from the phone's camera fits. The first bytes have to match the type (415). |
| Voice note | At most 1 MB (413), 15 seconds in the page. The first bytes have to match the type (415). |
| Location | Latitude −90 to 90, longitude −180 to 180, accuracy 0 to 1000000 m (400). |
The page shows species and notes only as text (textContent), never as HTML, and the device sends pictures and sound with X-Content-Type-Options: nosniff. Opened straight from the device, the page gets about the same Content-Security-Policy the app gives it.
Google Play and Apple App Review get a test account for the Connectivitizer app. Its workspace has this device online (run in Docker as above, with a device key and shared key of that workspace; the shared key is on the test phone or in the test account's instructions). It is there to show what each permission the app declares is for: the app itself uses the camera only to scan a key's QR code (Add a key, Start the camera under Scan the QR code) and never uses the microphone or the location; device pages may use all three, and only when the person allows it.
In the app: sign in, open the device field-log. Its screen opens full screen.
| Button on the page | Switch | Android permission | What happens |
|---|---|---|---|
| Live camera, then the round shutter Capture | Device pages may ask for the camera | CAMERA | A live viewfinder in the page; Capture keeps one picture for the sighting and turns the camera off. |
| Take or choose | none | none | The phone's own camera app or photo picker; works with every switch off. |
| Voice note, then Stop | Device pages may ask for the microphone | RECORD_AUDIO | Records up to 15 seconds; it can be played before saving. |
| Location | Device pages may ask for your location | ACCESS_FINE_LOCATION / ACCESS_COARSE_LOCATION | Reads the position once and shows Location added ±… m; saved with the sighting. |
| Open in map (on a sighting with a location) | Device pages may open links | none | Opens OpenStreetMap at that position in the browser. |
| Email this entry (a sighting's ⋯ menu), Write an email (at the bottom) | Device pages may open links | none | Opens the mail app with a draft; nothing is sent until the person sends it. |
| How device screens work | Device pages may open links | none | Opens the guide on connectivitizer.com in the browser. |
Android asks for its own runtime permission only the first time a page's request for it is allowed, never when the app starts or the screen opens. What the page captures goes to this device only; Connectivitizer does not receive it, and the device forgets it after 24 hours at the latest.
The device starts with one example sighting (a blackbird) that has a location, so Open in map can be tried before anything has been added.
The page was redesigned as Sightings on 2026-11-25. Run since: the server's tests (node --test server.test.mjs, including species, count and PUT /entries/{id}); the page in headless Chromium (Playwright) at 390 and 360 pixels wide, light and dark, against the demo data (demo-data.js, built by scripts/build-demos.mjs): menu, edit, save, voice note playback, no horizontal scrolling, no script errors; and the page against server.mjs with Chromium's fake camera and microphone and a set location: capture, record, location, save with species and count, an entry without species and count (as older pages sent them) shown as Unnamed sighting, the voice note loaded back and played. The contrast of the bar theme and of the Meadow app theme was checked against the rules in device UIs. The earlier page had also been run with every request refused, and the Docker image built and started; neither has been repeated for this version. Not yet run through the Connectivitizer app on a phone.