commit 7a5df6e5872bd74f06ebeacba2139ad672285a60
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2026-10-05T06:39:12Z |
| subject | Added logs & make push |
commit 7a5df6e5872bd74f06ebeacba2139ad672285a60
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2026-10-05T06:39:12Z
Added logs & make push
---
.gitignore | 3 +++
Dockerfile | 8 +++++++-
Makefile | 47 ++++++++++++++++++++++++++++++++++++++++---
README.md | 5 -----
build.env | 4 ++++
ha-app/CHANGELOG.md | 3 +++
ha-app/DOCS.md | 5 -----
ha-app/NFC.md | 4 ++--
ha-app/config.yaml | 2 +-
internal/provision/control.go | 3 +++
10 files changed, 67 insertions(+), 17 deletions(-)
diff --git a/.gitignore b/.gitignore
index afbd467..a7afc49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
/bin/
/state/
+out/
+bin/
+build.env.work
*.test
diff --git a/Dockerfile b/Dockerfile
index 975cae6..72d66ec 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -10,13 +10,19 @@ RUN CGO_ENABLED=0 go build -mod=readonly -buildvcs=false -trimpath \
-ldflags='-s -w' -o /out/homekey ./cmd/homekey
FROM debian:bookworm-slim
-ARG BUILD_VERSION=0.0.3
+ARG BUILD_VERSION=0.0.4
ARG BUILD_ARCH=amd64
LABEL io.hass.type="app" \
io.hass.version="${BUILD_VERSION}" \
io.hass.arch="${BUILD_ARCH}" \
org.opencontainers.image.title="homekey-go" \
org.opencontainers.image.licenses="Apache-2.0"
+
+ARG APT_PROXY
+RUN if [ -n "${APT_PROXY}" ]; then \
+ echo "Acquire::http::Proxy \"http://${APT_PROXY}\";" > /etc/apt/apt.conf.d/01proxy; \
+ fi
+
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates jq tzdata && rm -rf /var/lib/apt/lists/*
COPY --from=builder /out/homekey /usr/local/bin/homekey
diff --git a/Makefile b/Makefile
index 9d0d72b..e427c0a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,39 @@
+include build.env
+-include build.env.work
+export
+
+OUT_DIR := out
+BIN_DIR := bin
+
+IMAGE_NAME ?= ghcr.io/tgckpg/homekey-go
+IMAGE_TAG ?= dev
+
+BUILDX_BUILDER ?= container-builder
+
GO ?= go
-.PHONY: all build test race vet run clean
+
+BUILDINFO_FILE := internal/buildinfo/buildinfo_gen.go
+BUILDX_BUILDER ?= container-builder
+
+all: test build
+
+ensure-buildx:
+ @if ! docker buildx inspect $(BUILDX_BUILDER) >/dev/null 2>&1; then \
+ echo "Creating buildx builder $(BUILDX_BUILDER)..."; \
+ docker buildx create \
+ --name $(BUILDX_BUILDER) \
+ --driver docker-container \
+ --driver-opt network=host \
+ --bootstrap --use; \
+ else \
+ echo "Using existing buildx builder $(BUILDX_BUILDER)"; \
+ docker buildx use $(BUILDX_BUILDER); \
+ fi
+
all: build
build:
- mkdir -p bin
- $(GO) build -buildvcs=false -trimpath -o bin/homekey ./cmd/homekey
+ mkdir -p $(BIN_DIR)
+ $(GO) build -buildvcs=false -trimpath -o $(BIN_DIR)/homekey ./cmd/homekey
test:
$(GO) test ./...
race:
@@ -12,5 +42,16 @@ vet:
$(GO) vet ./...
run:
$(GO) run -buildvcs=false ./cmd/homekey
+
+push:
+ docker buildx build \
+ --platform linux/amd64,linux/arm64 \
+ --build-arg APT_PROXY=$(APT_PROXY) \
+ -f Dockerfile \
+ -t $(IMAGE_NAME):$(IMAGE_TAG) \
+ --push .
+
clean:
rm -rf bin
+
+.PHONY: all build test race vet run clean push ensure-buildx
diff --git a/README.md b/README.md
index 62ed1a4..abb0c04 100644
--- a/README.md
+++ b/README.md
@@ -181,8 +181,3 @@ Protocol sources:
- https://github.com/ikalchev/HAP-python (Home Key characteristic metadata)
Apache-2.0; see LICENSE, NOTICE and the retained third-party license.
-
-## NFC authentication
-
-Version 0.0.3 adds BLE APDU relay and Home Key STANDARD authentication for
-already-enrolled devices. See [NFC deployment and testing](ha-app/NFC.md).
diff --git a/build.env b/build.env
new file mode 100644
index 0000000..d3cd6ca
--- /dev/null
+++ b/build.env
@@ -0,0 +1,4 @@
+IMAGE_NAME=ghcr.io/tgckpg/homekey-go
+IMAGE_TAG=0.0.4
+
+APT_PROXY=
diff --git a/ha-app/CHANGELOG.md b/ha-app/CHANGELOG.md
index c8f2bfc..568095b 100644
--- a/ha-app/CHANGELOG.md
+++ b/ha-app/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 0.0.4
+DEBUG added logs
+
## 0.0.3
- Relay NFC APDUs through the ESP32 BLE reader, keeping the card active.
diff --git a/ha-app/DOCS.md b/ha-app/DOCS.md
index f2b4783..1a52f05 100644
--- a/ha-app/DOCS.md
+++ b/ha-app/DOCS.md
@@ -118,11 +118,6 @@ and repository identity to keep existing installs on their update path.
## Current functionality
-The HAP listener supports Apple Home pairing and Home Key provisioning.
-Version 0.0.3 adds a direct BlueZ BLE connection to the ESP32/PN532 reader and
-STANDARD NFC authentication for enrolled keys. A verified active key unlocks
-the virtual lock; physical actuator integration is not included.
-
See [NFC.md](NFC.md) for matching firmware, Wallet test steps, expected logs
and current limitations. Keep the existing HomeKit state and app slug when
updating.
diff --git a/ha-app/NFC.md b/ha-app/NFC.md
index 495e5ab..4c5f868 100644
--- a/ha-app/NFC.md
+++ b/ha-app/NFC.md
@@ -1,4 +1,4 @@
-# NFC STANDARD authentication (0.0.3)
+# NFC STANDARD authentication
This release connects the HomeKit provisioning store to the ESP32 reader. Go
runs SELECT, AUTH0 and STANDARD AUTH1; the ESP32 keeps the PN532 target active
@@ -20,7 +20,7 @@ physical actuator integration in this release.
existing initialization order. NFC runs in its own task with an 8192-byte
stack; there is no need to edit an existing sdkconfig's main-task stack.
-2. Build and publish your usual `homekey-go` image tagged `0.0.3`, then stage
+2. Build and publish your usual `homekey-go` image tagged `0.0.4`, then stage
the HA app metadata using the existing repository workflow. Update the
installed app and restart it. Keep its existing persistent `/data/state`.
diff --git a/ha-app/config.yaml b/ha-app/config.yaml
index 3a35002..5dbce2e 100644
--- a/ha-app/config.yaml
+++ b/ha-app/config.yaml
@@ -1,5 +1,5 @@
name: Home Key Go
-version: "0.0.3"
+version: "0.0.4"
slug: homekey_go
description: HomeKit virtual lock with Apple Home Key NFC authentication
url: https://sgit.k8s.astropenguin.net/penguin/homekey-go/
diff --git a/internal/provision/control.go b/internal/provision/control.go
index 49ffcf0..21e0db7 100644
--- a/internal/provision/control.go
+++ b/internal/provision/control.go
@@ -7,6 +7,7 @@ import (
"crypto/sha1"
"encoding/hex"
"fmt"
+ "log"
"math/big"
"time"
)
@@ -51,6 +52,8 @@ func (s *Store) Handle(raw []byte) (response []byte, err error) {
if err != nil {
return nil, err
}
+ log.Printf("Provisioning request: op=%d reader=%t endpoint=%t",
+ op, hasReader, hasEndpoint)
err = s.update(func(d *Data) error {
if hasReader {
response, err = readerOperation(&d.HomeKey, op, inner)