diff --git a/.github/workflows/release.yml b/.gitea/workflows/release.yml similarity index 71% rename from .github/workflows/release.yml rename to .gitea/workflows/release.yml index a2ad2a9..33fac5d 100644 --- a/.github/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -5,12 +5,9 @@ on: tags: - 'v*.*.*' -permissions: - contents: write - jobs: build: - runs-on: windows-latest + runs-on: windows steps: - uses: actions/checkout@v4 @@ -39,7 +36,6 @@ jobs: Copy-Item dist/dhcpsrv.exe $folder/ @" dhcpsrv v$ver - portable edition - made by engelgardt Minimal laptop-side DHCP server for storage/server engineers. @@ -71,10 +67,19 @@ jobs: "$hash $zip" | Out-File -FilePath "$zip.sha256" -Encoding ASCII -NoNewline Get-Content "$zip.sha256" - - name: Create release - uses: softprops/action-gh-release@v2 - with: - files: | - dhcpsrv-portable-v${{ steps.ver.outputs.version }}.zip - dhcpsrv-portable-v${{ steps.ver.outputs.version }}.zip.sha256 - generate_release_notes: true + - name: Publish Gitea release + shell: pwsh + env: + TOKEN: ${{ secrets.RELEASE_TOKEN }} + run: | + $ver = '${{ steps.ver.outputs.version }}' + $tag = "v$ver" + $api = "${{ github.server_url }}/api/v1/repos/${{ github.repository }}" + $hdr = @{ Authorization = "token $env:TOKEN" } + $body = @{ tag_name = $tag; name = $tag; draft = $false; prerelease = $false } | ConvertTo-Json + $rel = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $hdr -ContentType 'application/json' -Body $body + $rid = $rel.id + foreach ($f in @("dhcpsrv-portable-v$ver.zip", "dhcpsrv-portable-v$ver.zip.sha256")) { + curl.exe -s -H "Authorization: token $env:TOKEN" -F "attachment=@$f" "$api/releases/$rid/assets?name=$f" | Out-Null + Write-Host "uploaded $f" + } diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index 9286a28..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Bug report -description: Something doesn't work as expected -labels: ["bug"] -body: - - type: input - id: version - attributes: - label: Version - description: Visible in the startup banner. - placeholder: v1.1.0 - validations: - required: true - - - type: textarea - id: steps - attributes: - label: Steps to reproduce - placeholder: | - 1. ... - 2. ... - 3. ... - validations: - required: true - - - type: textarea - id: expected - attributes: - label: What you expected to happen - validations: - required: true - - - type: textarea - id: actual - attributes: - label: What actually happened - description: Paste any error output verbatim. Screenshots are welcome. - validations: - required: true - - - type: input - id: os - attributes: - label: Windows version - placeholder: e.g. Windows 11 24H2 - - - type: input - id: network - attributes: - label: Network setup (if relevant) - placeholder: e.g. USB Realtek NIC to a server's BMC port via an 8-port switch - - - type: textarea - id: extra - attributes: - label: Anything else? - description: Workarounds tried, related links, etc. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 33a6ce9..0000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: Security vulnerability - url: https://github.com/Engelgardt23/dhcpsrv/security/advisories/new - about: Please report security issues privately via GitHub Security Advisories — not as a public issue. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index 48f565a..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Feature request -description: Suggest a new feature or an improvement -labels: ["enhancement"] -body: - - type: textarea - id: motivation - attributes: - label: What's the use case? - description: What are you trying to do, and why is the current behavior not enough? - validations: - required: true - - - type: textarea - id: proposal - attributes: - label: Proposed solution - validations: - required: true - - - type: textarea - id: alternatives - attributes: - label: Alternatives considered diff --git a/CHANGELOG.md b/CHANGELOG.md index 10c380b..a50f718 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and ## [1.2.1] - 2026-05-18 ### Changed -- The `Update available (vX.Y.Z)` hint in the header is now a clickable hyperlink that opens the GitHub releases page (OSC 8 terminal hyperlink). Modern terminals (Windows Terminal, VS Code, WezTerm, most Linux/macOS terminals) render it as a link — `Ctrl+Click` to follow. Older consoles show the plain text, so nothing breaks. +- The `Update available (vX.Y.Z)` hint in the header is now a clickable hyperlink that opens the releases page (OSC 8 terminal hyperlink). Modern terminals (Windows Terminal, VS Code, WezTerm, most Linux/macOS terminals) render it as a link — `Ctrl+Click` to follow. Older consoles show the plain text, so nothing breaks. - Russian tagline tightened: dropped the `для инженера` phrase, the wording was carried over from an earlier draft and felt out of place. ## [1.2.0] - 2026-05-18 @@ -35,11 +35,11 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and ## [1.1.0] - 2026-05-16 ### Added -- Auto-update check on startup. Polls GitHub `/releases/latest` with a 3-second timeout. If a newer version is available, prints a yellow notice and offers to open the download page in your browser. Silent on offline / API errors. +- Auto-update check on startup. Polls the Gitea instance `/releases/latest` with a 3-second timeout. If a newer version is available, prints a yellow notice and offers to open the download page in your browser. Silent on offline / API errors. ## [1.0.0] - 2026-05-16 ### Added -- First public release on GitHub. +- First public release. - Single portable `.exe` (~12 MB) — no Python required on target machines. - Full-screen TUI built on `rich`: header with server config + live counters (Leases / Pkts / DISCOVER / REQUEST / RELEASE), clients table (`#`, IP, Hostname, MAC, Last seen, Ping), scrolling events panel. - Hardcoded sensible defaults: server `10.10.10.1/24`, pool `10.10.10.2..10.10.10.51` (50 addresses), lease `7200 s`, TFTP option (66/150) = server IP. @@ -51,11 +51,11 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and - Scrollback cleared on startup so mouse-wheel doesn't expose pre-launch text. - MIT licensed. -[Unreleased]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.2.1...HEAD -[1.2.1]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.2.0...v1.2.1 -[1.2.0]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.1.3...v1.2.0 -[1.1.3]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.1.2...v1.1.3 -[1.1.2]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.1.1...v1.1.2 -[1.1.1]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.1.0...v1.1.1 -[1.1.0]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.0.0...v1.1.0 -[1.0.0]: https://github.com/Engelgardt23/dhcpsrv/releases/tag/v1.0.0 +[Unreleased]: https://git.engelgardt23.ru/engel/dhcpsrv/compare/v1.2.1...HEAD +[1.2.1]: https://git.engelgardt23.ru/engel/dhcpsrv/compare/v1.2.0...v1.2.1 +[1.2.0]: https://git.engelgardt23.ru/engel/dhcpsrv/compare/v1.1.3...v1.2.0 +[1.1.3]: https://git.engelgardt23.ru/engel/dhcpsrv/compare/v1.1.2...v1.1.3 +[1.1.2]: https://git.engelgardt23.ru/engel/dhcpsrv/compare/v1.1.1...v1.1.2 +[1.1.1]: https://git.engelgardt23.ru/engel/dhcpsrv/compare/v1.1.0...v1.1.1 +[1.1.0]: https://git.engelgardt23.ru/engel/dhcpsrv/compare/v1.0.0...v1.1.0 +[1.0.0]: https://git.engelgardt23.ru/engel/dhcpsrv/releases/tag/v1.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 88eb01b..7a5d98a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,15 +6,14 @@ ``` dhcpsrv/ -├── .github/ -│ ├── workflows/release.yml ← CI: tag-driven build + GitHub Release -│ └── ISSUE_TEMPLATE/ ← bug / feature / security routing +├── .gitea/ +│ └── workflows/release.yml ← CI: tag-driven build + Gitea Release ├── src/dhcpsrv/ ← package source (≤200 lines per module) │ ├── __init__.py ← single source of truth for __version__ │ ├── __main__.py ← entry: python -m dhcpsrv │ ├── app.py ← main flow, wires everything │ ├── platform_win.py ← VT enable + UAC self-elevate -│ ├── update_check.py ← GitHub /releases/latest poll +│ ├── update_check.py ← Gitea /releases/latest poll │ ├── network.py ← list_adapters, netsh, ping (no shared state) │ ├── dhcp.py ← DhcpConfig, DhcpServer, packet parse/build │ └── ui.py ← rich-based full-screen TUI @@ -64,7 +63,7 @@ flag tells PyInstaller where to find the `dhcpsrv` package itself. Output: 4. Tag: `git tag vX.Y.Z`. 5. Push: `git push && git push --tags`. -That's it. GitHub Actions picks up the tag, builds the exe, writes the SHA-256, and creates the GitHub Release with the zip attached. +That's it. Gitea Actions picks up the tag, builds the exe, writes the SHA-256, and creates the Gitea Release with the zip attached. ## Where features go @@ -76,4 +75,4 @@ That's it. GitHub Actions picks up the tag, builds the exe, writes the SHA-256, | Something shown in the header | `ui.py` → `Ui._render_header` | | A startup check or banner line | `app.py` → `main()` | | A change to UAC / VT logic | `platform_win.py` | -| Tweaking the GitHub update-check UX | `update_check.py` | +| Tweaking the update-check UX | `update_check.py` | diff --git a/README.md b/README.md index badaf3b..626d1fd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # dhcpsrv -[![Latest release](https://img.shields.io/github/v/release/Engelgardt23/dhcpsrv)](https://github.com/Engelgardt23/dhcpsrv/releases/latest) +[![Latest release](https://img.shields.io/gitea/v/release/engel/dhcpsrv?gitea_url=https%3A%2F%2Fgit.engelgardt23.ru&label=release)](https://git.engelgardt23.ru/engel/dhcpsrv/releases/latest) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) 🇺🇸 English | [🇷🇺 Русский](README.ru.md) @@ -10,13 +10,11 @@ One double-click — pick a NIC — done. Live table of clients, ping status, pa Built for the “plug the cable in, watch a BMC pop up with an IP” workflow during firmware updates, recovery, and benchmarks. -> **Made by engelgardt.** - --- ## Download -Grab the latest release: [**releases page**](https://github.com/Engelgardt23/dhcpsrv/releases/latest). +Grab the latest release: [**releases page**](https://git.engelgardt23.ru/engel/dhcpsrv/releases/latest). The asset is `dhcpsrv-portable-vX.Y.Z.zip` (~12 MB). ## Run @@ -39,7 +37,7 @@ The asset is `dhcpsrv-portable-vX.Y.Z.zip` (~12 MB). ## What's on screen ``` -┌─ dhcpsrv v1.0.0 made by engelgardt ────────────────────────────────────┐ +┌─ dhcpsrv v1.0.0 ────────────────────────────────────────────────────────┐ │ Server: 10.10.10.1/255.255.255.0 Pool: 10.10.10.2–10.10.10.51 … │ │ Leases: 3/50 Pkts: 47 DISCOVER: 12 REQUEST: 11 RELEASE: 0 │ └─────────────────────────────────────────────────────────────────────────┘ diff --git a/README.ru.md b/README.ru.md index a5c866d..243e15c 100644 --- a/README.ru.md +++ b/README.ru.md @@ -1,6 +1,6 @@ # dhcpsrv -[![Последний релиз](https://img.shields.io/github/v/release/Engelgardt23/dhcpsrv)](https://github.com/Engelgardt23/dhcpsrv/releases/latest) +[![Последний релиз](https://img.shields.io/gitea/v/release/engel/dhcpsrv?gitea_url=https%3A%2F%2Fgit.engelgardt23.ru&label=release)](https://git.engelgardt23.ru/engel/dhcpsrv/releases/latest) [![Лицензия: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [🇺🇸 English](README.md) | 🇷🇺 Русский @@ -10,13 +10,11 @@ Сделан под сценарий «воткнул кабель, увидел как BMC получил IP» во время прошивки, восстановления и бенчмарков. -> **Автор: engelgardt.** - --- ## Скачать -Последний релиз: [**страница релизов**](https://github.com/Engelgardt23/dhcpsrv/releases/latest). +Последний релиз: [**страница релизов**](https://git.engelgardt23.ru/engel/dhcpsrv/releases/latest). Архив `dhcpsrv-portable-vX.Y.Z.zip` (~12 МБ). ## Запуск diff --git a/SECURITY.md b/SECURITY.md index 485b888..e428c55 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,16 +6,14 @@ on the host — so vulnerability reports are very welcome. ## Supported versions -Only the latest tagged release on GitHub is supported. Older versions will not +Only the latest tagged release is supported. Older versions will not get fixes; please upgrade first. ## How to report a vulnerability **Please do not open a public issue** for security-sensitive findings. -Use GitHub's private security advisories: go to the -[Security tab](../../security/advisories/new) of this repo and click -"Report a vulnerability". GitHub will route it privately. +Report privately by email to the maintainer at engelgardt2024@gmail.com. Please include: - The version you tested (the startup banner is enough). diff --git a/pyproject.toml b/pyproject.toml index eef9f22..af2b511 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,8 +13,8 @@ dependencies = ["rich>=13"] dynamic = ["version"] [project.urls] -Homepage = "https://github.com/Engelgardt23/dhcpsrv" -Issues = "https://github.com/Engelgardt23/dhcpsrv/issues" +Homepage = "https://git.engelgardt23.ru/engel/dhcpsrv" +Issues = "https://git.engelgardt23.ru/engel/dhcpsrv/issues" [project.scripts] dhcpsrv = "dhcpsrv.app:main" diff --git a/src/dhcpsrv/__init__.py b/src/dhcpsrv/__init__.py index c250318..d2ecce3 100644 --- a/src/dhcpsrv/__init__.py +++ b/src/dhcpsrv/__init__.py @@ -1,10 +1,9 @@ """ dhcpsrv - portable laptop-side DHCP server for storage/server engineers. -made by engelgardt The single source of truth for the project version. Bump this before tagging a release; CI reads the tag, the code reads this constant. """ __version__ = "1.2.2" -GITHUB_REPO = "engel/dhcpsrv" # на Forgejo (git.engelgardt23.ru) +REPO = "engel/dhcpsrv" # self-hosted Gitea (git.engelgardt23.ru) diff --git a/src/dhcpsrv/app.py b/src/dhcpsrv/app.py index 08a8755..d2351ed 100644 --- a/src/dhcpsrv/app.py +++ b/src/dhcpsrv/app.py @@ -11,7 +11,7 @@ from rich.console import Console from rich.prompt import Confirm, Prompt from rich.table import Table -from . import __version__, GITHUB_REPO +from . import __version__, REPO from .platform_win import enable_vt, require_admin from .update_check import check_for_update from .network import list_adapters, set_static_ip, revert_to_dhcp @@ -53,7 +53,7 @@ def main() -> None: title = f"[bold cyan]dhcpsrv v{__version__}[/] {t('tagline')}" latest = check_for_update() if latest: - release_url = f"https://git.engelgardt23.ru/{GITHUB_REPO}/releases/latest" + release_url = f"https://git.engelgardt23.ru/{REPO}/releases/latest" notice = t("update_available", tag=latest) header = Table.grid(expand=True) header.add_column(justify="left", ratio=1) diff --git a/src/dhcpsrv/update_check.py b/src/dhcpsrv/update_check.py index 995ac12..6aaecaf 100644 --- a/src/dhcpsrv/update_check.py +++ b/src/dhcpsrv/update_check.py @@ -1,16 +1,16 @@ """ Auto-update check. -On startup, ask GitHub for the latest release tag. If it's newer than the -local `__version__`, return the tag string so the caller can show a quiet -hint in the header. Silent on any error (offline, rate-limit, etc.). +On startup, ask the Gitea instance for the latest release tag. If it's newer +than the local `__version__`, return the tag string so the caller can show a +quiet hint in the header. Silent on any error (offline, rate-limit, etc.). """ from __future__ import annotations import json import urllib.request -from . import __version__, GITHUB_REPO +from . import __version__, REPO def _parse_version(s: str) -> tuple[int, int, int]: @@ -29,7 +29,7 @@ def check_for_update() -> str | None: currently running version. Returns None when up to date, offline, or on any error — the caller decides how (or whether) to render the hint.""" try: - url = f"https://git.engelgardt23.ru/api/v1/repos/{GITHUB_REPO}/releases/latest" + url = f"https://git.engelgardt23.ru/api/v1/repos/{REPO}/releases/latest" req = urllib.request.Request(url, headers={ "User-Agent": f"dhcpsrv/{__version__}", })