228 lines
5.3 KiB
JSON
228 lines
5.3 KiB
JSON
{
|
|
"module": "brother",
|
|
"version": "1",
|
|
"emits": [
|
|
"scan.added"
|
|
],
|
|
"config": {
|
|
"scanner": {
|
|
"type": "string",
|
|
"description": "The network scanner's eSCL address, such as http://192.0.2.10/eSCL: the scanner's own address and the path its eSCL service answers on; the operator's, with no default.",
|
|
"pattern": "^https?://.+",
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"scan-folder": {
|
|
"type": "string",
|
|
"description": "The absolute path of the folder the scans are filed in as PDF files; the module makes it when it files the first scan, and never touches a file in it that it did not write. The operator's, with no default.",
|
|
"pattern": "^/",
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"printer": {
|
|
"type": "string",
|
|
"description": "The printer's host, such as 192.0.2.10: where its admin page (HTTPS) and its IPP service answer. The device is the scanner's own; the operator's, with no default.",
|
|
"pattern": "^[A-Za-z0-9.:-]+$",
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"printer-certificate": {
|
|
"type": "string",
|
|
"description": "The SHA-256 fingerprint of the certificate the printer's admin page serves, as 32 upper-case hex pairs joined by colons. The module trusts that certificate alone and refuses any other; the operator's, with no default.",
|
|
"pattern": "^([0-9A-F]{2}:){31}[0-9A-F]{2}$",
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"resolution": {
|
|
"type": "number",
|
|
"description": "The resolution asked of the scanner, in dpi: 100, 200, 300 or 600. A scanner may give another; the scan is filed at the resolution it gave.",
|
|
"enum": [
|
|
100,
|
|
200,
|
|
300,
|
|
600
|
|
],
|
|
"trusted": false,
|
|
"default": 300
|
|
},
|
|
"color-mode": {
|
|
"type": "string",
|
|
"description": "Whether the scan is in colour or in grays: color or gray.",
|
|
"enum": [
|
|
"color",
|
|
"gray"
|
|
],
|
|
"trusted": false,
|
|
"default": "color"
|
|
},
|
|
"crop": {
|
|
"type": "boolean",
|
|
"description": "Whether the document is cut out of the platen's white lid; false files the whole platen.",
|
|
"trusted": false,
|
|
"default": true
|
|
}
|
|
},
|
|
"own-secrets": {
|
|
"admin-password": {
|
|
"path": "${dir:state}/admin-password.secret",
|
|
"issued-by": "outside",
|
|
"prompt": "the admin password of the Brother printer",
|
|
"owner": "brother-device"
|
|
},
|
|
"broker-device": {
|
|
"path": "${dir:state}/broker-device.secret",
|
|
"owner": "brother-device"
|
|
}
|
|
},
|
|
"streams": [
|
|
{
|
|
"name": "device-asks",
|
|
"events": [
|
|
"device.asked"
|
|
],
|
|
"max-age-days": 1,
|
|
"max-mib": 8,
|
|
"retention": "work-queue",
|
|
"max-deliveries": 3
|
|
}
|
|
],
|
|
"state": [
|
|
{
|
|
"name": "device-answers",
|
|
"ttl-seconds": 600
|
|
}
|
|
],
|
|
"seats": [
|
|
{
|
|
"name": "scanner",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"scan",
|
|
"status",
|
|
"list"
|
|
]
|
|
},
|
|
{
|
|
"name": "printer",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"status",
|
|
"settings"
|
|
]
|
|
}
|
|
],
|
|
"claims": [
|
|
{
|
|
"name": "scanner",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"scan",
|
|
"status",
|
|
"list"
|
|
]
|
|
},
|
|
{
|
|
"name": "printer",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"status",
|
|
"settings"
|
|
]
|
|
}
|
|
],
|
|
"tools": [
|
|
"printer.status",
|
|
"printer.settings",
|
|
"scanner.scan",
|
|
"scanner.status",
|
|
"scanner.list"
|
|
],
|
|
"resources": [
|
|
{
|
|
"id": "account",
|
|
"type": "user",
|
|
"name": "brother-device",
|
|
"shell": "/usr/bin/nologin"
|
|
},
|
|
{
|
|
"id": "state",
|
|
"type": "directory",
|
|
"mode": "0711",
|
|
"owner": "${machine:account}",
|
|
"place": ".",
|
|
"unknown": "program"
|
|
},
|
|
{
|
|
"id": "settings",
|
|
"type": "file",
|
|
"path": "${dir:state}/settings.json",
|
|
"owner": "${machine:account}",
|
|
"mode": "0644",
|
|
"takes-config": [
|
|
"scanner",
|
|
"scan-folder",
|
|
"printer",
|
|
"printer-certificate",
|
|
"resolution",
|
|
"color-mode",
|
|
"crop"
|
|
],
|
|
"merge": "json",
|
|
"template": "files/settings.json"
|
|
},
|
|
{
|
|
"id": "device",
|
|
"type": "process",
|
|
"name": "brother-device",
|
|
"artifact": "tools",
|
|
"run": [
|
|
"./brother",
|
|
"device"
|
|
],
|
|
"user": "brother-device",
|
|
"env": {
|
|
"BROTHER_SETTINGS": "${dir:state}/settings.json",
|
|
"BROTHER_ADMIN_PASSWORD": "${dir:state}/admin-password.secret",
|
|
"BROTHER_BROKER": "${dir:state}/broker-device.secret"
|
|
},
|
|
"restart-on": [
|
|
"settings"
|
|
],
|
|
"bus": {
|
|
"queues": [
|
|
"device-asks"
|
|
],
|
|
"state": [
|
|
"device-answers"
|
|
]
|
|
},
|
|
"health": {
|
|
"kind": "unit"
|
|
}
|
|
}
|
|
],
|
|
"build": {
|
|
"artifacts": [
|
|
{
|
|
"name": "tools",
|
|
"kind": "bundle",
|
|
"language": "go",
|
|
"system": "arch",
|
|
"from": "cmd/brother",
|
|
"binary": "brother",
|
|
"loads": [
|
|
"brother"
|
|
],
|
|
"env": {
|
|
"BROTHER_SETTINGS": "${dir:state}/settings.json"
|
|
}
|
|
},
|
|
{
|
|
"name": "files",
|
|
"kind": "archive",
|
|
"from": "files"
|
|
}
|
|
]
|
|
}
|
|
}
|