3 Commits

Author SHA1 Message Date
Markus F.J. Busche
9a84d7da2e docs: document systemd-based auto-disable of Tailscale Funnel on boot 2025-09-21 15:01:10 +02:00
Markus F.J. Busche
eef0bb13c8 docs: link to latest Releases on Gitea; release notes updated (en) 2025-09-21 13:36:33 +02:00
Markus F.J. Busche
876048f60e chore(release): release_gitea.sh (Tag+Release+Assets) hinzugefügt 2025-09-21 13:24:40 +02:00
2 changed files with 166 additions and 0 deletions

View File

@@ -30,6 +30,10 @@ Disclaimer: *This plugin was partially vibe-coded*.
5. Configure the plugin settings in OctoPrint's settings panel 5. Configure the plugin settings in OctoPrint's settings panel
6. Enable Funnel through the plugin interface 6. Enable Funnel through the plugin interface
### Latest Release
Get the latest packaged release (wheel, sdist, zip) from Gitea: [Releases](https://gitea.elpatron.me/elpatron/octo-funnel/releases)
## Building from Source ## Building from Source
If you want to build the plugin from source, please refer to the [BUILDING.md](BUILDING.md) file for detailed instructions. If you want to build the plugin from source, please refer to the [BUILDING.md](BUILDING.md) file for detailed instructions.
@@ -81,6 +85,43 @@ sudo tailscale funnel reset
Enabling Funnel makes your OctoPrint instance accessible from the public internet. Only enable it when needed and disable it when finished. The plugin will show a confirmation dialog before enabling Funnel if the "Confirm Enable" option is checked. Enabling Funnel makes your OctoPrint instance accessible from the public internet. Only enable it when needed and disable it when finished. The plugin will show a confirmation dialog before enabling Funnel if the "Confirm Enable" option is checked.
### Disable Funnel automatically on system boot (systemd)
If you prefer to make sure the Tailscale Funnel is always off after a system reboot (independent of the plugin), you can add a small systemd unit that disables Funnel shortly after boot:
1) Create unit file:
```bash
sudo tee /etc/systemd/system/octoprint-tailscale-funnel-off.service >/dev/null <<'UNIT'
[Unit]
Description=Disable Tailscale Funnel after boot
After=network-online.target tailscaled.service
Wants=network-online.target
[Service]
Type=oneshot
User=octoprint
ExecStart=/usr/bin/tailscale funnel reset
# Optional: also turn off possible serve mappings on common ports
ExecStart=/usr/bin/tailscale serve --http=80 off
ExecStart=/usr/bin/tailscale serve --https=80 off
[Install]
WantedBy=multi-user.target
UNIT
```
2) Enable and test:
```bash
sudo systemctl daemon-reload
sudo systemctl enable --now octoprint-tailscale-funnel-off.service
sudo systemctl status octoprint-tailscale-funnel-off.service
```
Notes:
- Adjust `User=octoprint` if your OctoPrint runs under a different user (e.g. `pi`).
- If sudo is required for tailscale on your system, add the corresponding sudoers entry as described above.
- You can add a short delay by inserting `ExecStartPre=/bin/sleep 5` if Tailscale comes up late during boot.
## API Endpoints ## API Endpoints
The plugin exposes the following API endpoints: The plugin exposes the following API endpoints:

125
scripts/release_gitea.sh Normal file → Executable file
View File

@@ -1,6 +1,131 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# Usage: scripts/release_gitea.sh <version> [--draft] [--prerelease]
# Env: liest automatisch $ROOT_DIR/.env (GITEA_TOKEN, GITEA_BASE, OWNER, REPO)
# Falls nicht gesetzt, werden GITEA_BASE/OWNER/REPO aus der Git-Remote-URL abgeleitet.
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <version> [--draft] [--prerelease]" >&2
exit 1
fi
VERSION="$1"
shift || true
DRAFT=false
PRERELEASE=false
for arg in "$@"; do
case "$arg" in
--draft) DRAFT=true ;;
--prerelease) PRERELEASE=true ;;
esac
done
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
# Load .env if present
if [[ -f "$ROOT_DIR/.env" ]]; then
set -a
# shellcheck disable=SC1090
. "$ROOT_DIR/.env"
set +a
fi
# Map alternative token variable name
if [[ -z "${GITEA_TOKEN:-}" && -n "${GITEA_API_TOKEN:-}" ]]; then
GITEA_TOKEN="$GITEA_API_TOKEN"
fi
# Map API URL to base if provided
if [[ -z "${GITEA_BASE:-}" && -n "${GITEA_API_URL:-}" ]]; then
# strip trailing /api/... from URL
GITEA_BASE="${GITEA_API_URL%%/api/*}"
fi
# Map owner/repo alternative names
if [[ -z "${OWNER:-}" && -n "${GITEA_OWNER:-}" ]]; then
OWNER="$GITEA_OWNER"
fi
if [[ -z "${REPO:-}" && -n "${GITEA_REPO:-}" ]]; then
REPO="$GITEA_REPO"
fi
# Derive defaults from git remote if not provided
if [[ -z "${GITEA_BASE:-}" || -z "${OWNER:-}" || -z "${REPO:-}" ]]; then
ORIGIN_URL=$(git -C "$ROOT_DIR" remote get-url origin 2>/dev/null || true)
if [[ "$ORIGIN_URL" =~ ^https?://([^/]+)/([^/]+)/([^/]+?)(\.git)?$ ]]; then
: "${GITEA_BASE:="https://${BASH_REMATCH[1]}"}"
: "${OWNER:=${BASH_REMATCH[2]}}"
: "${REPO:=${BASH_REMATCH[3]}}"
fi
fi
: "${GITEA_TOKEN:?Set GITEA_TOKEN (in .env oder Umgebung)}"
: "${GITEA_BASE:?Set GITEA_BASE (z. B. https://gitea.elpatron.me)}"
: "${OWNER:?Set OWNER (z. B. elpatron)}"
: "${REPO:?Set REPO (z. B. octo-funnel)}"
DIST_DIR="$ROOT_DIR/octoprint_tailscale_funnel/dist"
TAG="v${VERSION}"
echo "Creating git tag ${TAG} and pushing..."
git tag -f "${TAG}"
git push -f origin "${TAG}"
echo "Creating Gitea release ${TAG}..."
BODY=$(cat <<EOF
Release ${TAG}
Changes:
- Navbar: Statusanzeige, Toggle, Farbkennung
- Build-Skript & Quick-Build Docs
- Version ${VERSION}
EOF
)
CREATE_PAYLOAD=$(jq -n \
--arg tag_name "${TAG}" \
--arg name "${TAG}" \
--arg body "${BODY}" \
--argjson draft ${DRAFT} \
--argjson prerelease ${PRERELEASE} \
'{tag_name:$tag_name, name:$name, body:$body, draft:$draft, prerelease:$prerelease}')
RELEASE_JSON=$(curl -sS -X POST "${GITEA_BASE}/api/v1/repos/${OWNER}/${REPO}/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H 'Content-Type: application/json' \
-d "${CREATE_PAYLOAD}")
UPLOAD_URL=$(echo "$RELEASE_JSON" | jq -r .upload_url)
ID=$(echo "$RELEASE_JSON" | jq -r .id)
if [[ -z "$ID" || "$ID" == "null" ]]; then
echo "Failed to create release: $RELEASE_JSON" >&2
exit 1
fi
echo "Release created: ID=$ID"
echo "Using: GITEA_BASE=$GITEA_BASE OWNER=$OWNER REPO=$REPO"
function upload_asset() {
local file="$1"
local name
name=$(basename "$file")
echo "Uploading asset: $name"
curl -sS -X POST "${GITEA_BASE}/api/v1/repos/${OWNER}/${REPO}/releases/${ID}/assets?name=${name}" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H 'Content-Type: application/octet-stream' \
--data-binary @"$file" > /dev/null
}
upload_asset "$DIST_DIR/octoprint_tailscale_funnel-${VERSION}-py3-none-any.whl"
upload_asset "$DIST_DIR/octoprint_tailscale_funnel-${VERSION}.tar.gz"
upload_asset "$DIST_DIR/octoprint_tailscale_funnel-${VERSION}.zip"
echo "Release ${TAG} created and assets uploaded."
#!/usr/bin/env bash
set -euo pipefail
# Load .env if present # Load .env if present
if [ -f "$(dirname "$0")/../.env" ]; then if [ -f "$(dirname "$0")/../.env" ]; then
set -a set -a