mirror of
https://codeberg.org/icewind/ptouch-api.git
synced 2026-06-03 10:54:07 +02:00
rename to ptouch-remote
This commit is contained in:
parent
9073a9d217
commit
1422f9b8be
12 changed files with 43 additions and 40 deletions
33
README.md
33
README.md
|
|
@ -1,11 +1,14 @@
|
|||
# ptouch-api
|
||||
# ptouch-remote
|
||||
|
||||
Simple REST api for Brother P-touch label printers.
|
||||
Web interface and REST api for Brother P-touch label printers.
|
||||
|
||||

|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
You can download pre-built binaries from the
|
||||
[releases page](https://codeberg.org/icewind/ptouch-api/releases) or build it
|
||||
[releases page](https://codeberg.org/icewind/ptouch-remote/releases) or build it
|
||||
yourself using `cargo build`.
|
||||
|
||||
## Configuring
|
||||
|
|
@ -16,7 +19,7 @@ yourself using `cargo build`.
|
|||
# address = "0.0.0.0" # defaults to "127.0.0.1"
|
||||
# port = 1234 # defaults to 7074
|
||||
# you can set it to listen over a unix socket instead.
|
||||
socket = "/run/ptouch-api.sock"
|
||||
socket = "/run/ptouch-remote.sock"
|
||||
```
|
||||
|
||||
In additional to the `listen` configuration, the server will automatically
|
||||
|
|
@ -26,21 +29,21 @@ provided socket.
|
|||
## Usage
|
||||
|
||||
```bash
|
||||
ptouch-api [--config config.toml]
|
||||
ptouch-remote [--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
|
||||
You'll need to either run `ptouch-remote` as root or setup a udev rule to change
|
||||
the owner or permissions to allow `ptouch-remote` to access the label printer over
|
||||
usb.
|
||||
|
||||
See [51-ptouch-api.rules](./51-ptouch-api.rules) for an example udev rule,
|
||||
See [51-ptouch-remote.rules](./51-ptouch-remote.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
|
||||
[51-ptouch-remote-everyone.rules](./51-ptouch-remote-everyone.rules) to give all users
|
||||
on the system access to the label printer.
|
||||
|
||||
## API
|
||||
|
|
@ -97,24 +100,24 @@ needed run the api.
|
|||
|
||||
```nix
|
||||
{
|
||||
inputs.ptouch-api.url = "git+ssh://git@codeberg.org/icewind/ptouch-api.git";
|
||||
inputs.ptouch-remote.url = "git+ssh://git@codeberg.org/icewind/ptouch-remote.git";
|
||||
|
||||
outputs = { self, nixpkgs, ptouch-api }: {
|
||||
outputs = { self, nixpkgs, ptouch-remote }: {
|
||||
nixosConfigurations.my-machine = nixpkgs.lib.nixosSystem {
|
||||
modules =
|
||||
[
|
||||
ptouch-api.nixosModules.default
|
||||
ptouch-remote.nixosModules.default
|
||||
({config, ...}: {
|
||||
# enable the api service and setup the udev rules
|
||||
services.ptouch-api = {
|
||||
services.ptouch-remote = {
|
||||
enable = true;
|
||||
# socket = "/path/for/socket/to/listen"; # defaults to /run/ptouch-api/ptouch-api.sock
|
||||
# socket = "/path/for/socket/to/listen"; # defaults to /run/ptouch-remote/ptouch-remote.sock
|
||||
};
|
||||
# expose the api to the outside world
|
||||
services.nginx = {
|
||||
virtualHosts."ptouch.example.com" = {
|
||||
locations."/" = {
|
||||
proxyPass = "http://unix://${config.services.ptouch-api.socket}";
|
||||
proxyPass = "http://unix://${config.services.ptouch-remote.socket}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue