mirror of
https://codeberg.org/icewind/ptouch-api.git
synced 2026-06-03 19:04:08 +02:00
readme updates
This commit is contained in:
parent
a3f392743d
commit
678fdf5185
2 changed files with 51 additions and 0 deletions
1
51-ptouch-api-everyone.rules
Normal file
1
51-ptouch-api-everyone.rules
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
ENV{ID_VENDOR_ID}=="04f9", ENV{ID_MODEL_ID}=="2001|2004|2007|2011|2019|201f|202c|202d|2030|2031|2041|205e|205f|2061|2062|2064|2065|20df|2073|20e0|2074|20e1|20af|2201", MODE="0666"
|
||||||
50
README.md
50
README.md
|
|
@ -29,6 +29,20 @@ provided socket.
|
||||||
ptouch-api [--config config.toml]
|
ptouch-api [--config config.toml]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Permissions
|
||||||
|
|
||||||
|
You'll need to either run `ptouch-api` as root or setup a udev rule to change
|
||||||
|
the owner or permissions to allow `ptouch-api` to access the label printer over
|
||||||
|
usb.
|
||||||
|
|
||||||
|
See [51-ptouch-api.rules](./51-ptouch-api.rules) for an example udev rule,
|
||||||
|
placing this into `/etc/udev/rules.d` and adjusting the username as desired
|
||||||
|
should give the specified user access to the ptouch printer.
|
||||||
|
|
||||||
|
Alternatively you can use
|
||||||
|
[51-ptouch-api-everyone.rules](./51-ptouch-api-everyone.rules) to give all users
|
||||||
|
on the system access to the label printer.
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
- GET `/status`: get printer and tape status for details about the fields.
|
- GET `/status`: get printer and tape status for details about the fields.
|
||||||
|
|
@ -71,3 +85,39 @@ The following printers are currently supported
|
||||||
- PT-D600
|
- PT-D600
|
||||||
- PT-D610BT
|
- PT-D610BT
|
||||||
- PT-P710BT
|
- PT-P710BT
|
||||||
|
|
||||||
|
## NixOs module
|
||||||
|
|
||||||
|
For NixOs users, a module is available as a flake that includes everything
|
||||||
|
needed run the api.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
inputs.ptouch-api.url = "git+ssh://git@codeberg.org/icewind/ptouch-api.git";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, ptouch-api }: {
|
||||||
|
nixosConfigurations.my-machine = nixpkgs.lib.nixosSystem {
|
||||||
|
modules =
|
||||||
|
[
|
||||||
|
ptouch-api.nixosModules.default
|
||||||
|
({config, ...}: {
|
||||||
|
# enable the api service and setup the udev rules
|
||||||
|
services.ptouch-api = {
|
||||||
|
enable = true;
|
||||||
|
# socket = "/path/for/socket/to/listen"; # defaults to /run/ptouch-api/ptouch-api.sock
|
||||||
|
};
|
||||||
|
# expose the api to the outside world
|
||||||
|
services.nginx = {
|
||||||
|
virtualHosts."ptouch.example.com" = {
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://unix://${config.services.ptouch-api.socket}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
# ... other configuration ...
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue