Compare commits

...

3 commits

3 changed files with 11 additions and 25 deletions

View file

@ -7,6 +7,7 @@ COMPOSE := DOCKER_HOST=$(DOCKER_HOST) $(COMPOSE_CMD)
psql: psql:
$(COMPOSE) exec inventree-db sh -c 'psql $$POSTGRES_USER $$POSTGRES_DB' $(COMPOSE) exec inventree-db sh -c 'psql $$POSTGRES_USER $$POSTGRES_DB'
.PHONY: update
update: update:
read -p "Update will cause downtime of the server. Are you sure you want to continue? Press Ctrl+c to abort!" _ read -p "Update will cause downtime of the server. Are you sure you want to continue? Press Ctrl+c to abort!" _
$(COMPOSE) pull $(COMPOSE) pull
@ -17,6 +18,14 @@ update:
data: # podman does not autocreate data folder data: # podman does not autocreate data folder
mkdir data mkdir data
.PHONY: caddy-check
caddy-check:
docker run --rm --env-file .env -v ./Caddyfile:/etc/caddy/Caddyfile:ro,Z caddy:alpine caddy validate --config /etc/caddy/Caddyfile
.PHONY: caddy-print
caddy-print:
docker run --rm --env-file .env -v ./Caddyfile:/etc/caddy/Caddyfile:ro,Z caddy:alpine caddy adapt --config /etc/caddy/Caddyfile --pretty
# pass all commands to compose cli # pass all commands to compose cli
%: data %: data
$(COMPOSE) $@ $(COMPOSE) $@

View file

@ -113,6 +113,8 @@ services:
- 443:443 - 443:443
env_file: env_file:
- .env - .env
environment:
INVENTREE_SERVER: http://inventree-server:${INVENTREE_WEB_PORT}
volumes: volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro,z - ./Caddyfile:/etc/caddy/Caddyfile:ro,z
- ${INVENTREE_EXT_VOLUME}/static:/var/www/static:z - ${INVENTREE_EXT_VOLUME}/static:/var/www/static:z

View file

@ -1,25 +0,0 @@
from plugin import InvenTreePlugin
from plugin.mixins import BarcodeMixin
from part.models import Part
import structlog
logger = structlog.get_logger("ctbk.barcode")
class CtbkBarcodePlugin(BarcodeMixin, InvenTreePlugin):
TITLE = "CTBK IPN Barcode Plugin"
NAME = "ctbk-ipn-barcode-plugin"
DESCRIPTION = "Supports the CTBK IPN format directly in barcodes"
VERSION = "0.0.1"
AUTHOR = "kleines Filmröllchen"
def scan(self, barcode_data):
if barcode_data.startswith("963e5440-"):
try:
instance = Part.objects.get(IPN=barcode_data.strip())
label = Part.barcode_model_type()
return {label: instance.format_matched_response()}
except Part.DoesNotExist:
logger.error("could not find a part for barcode %s", barcode_data)
pass