diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..10b79e4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,65 @@ +name: Bug report +description: Something in Freizeichen is broken or behaves unexpectedly +labels: [bug] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to report a bug! + Please use **fictional phone numbers only** in screenshots and examples. + A security problem — for example a `tel:` link that dials something it should not — + belongs in a [private report](https://github.com/CodeForFire/freizeichen/security/advisories/new), not here. + - type: input + id: version + attributes: + label: Version + description: Installer file name or tag from [Releases](https://github.com/CodeForFire/freizeichen/releases), or the commit if you built it yourself + placeholder: v0.1.0 + validations: + required: true + - type: dropdown + id: platform + attributes: + label: Platform + options: + - Windows + - macOS + - Linux + validations: + required: true + - type: input + id: phone + attributes: + label: Phone and port + description: Phone model and firmware if known, and the port selected in the settings + placeholder: Gigaset DL500A, COM7 + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps to reproduce + description: What exactly did you do? Where did the `tel:` link come from? + placeholder: | + 1. Click a phone number in Lagebuch + 2. ... + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected behaviour + validations: + required: true + - type: textarea + id: actual + attributes: + label: Actual behaviour + description: Include the status text Freizeichen showed, verbatim (e.g. „Telefon antwortet nicht. …“). + validations: + required: true + - type: textarea + id: attachments + attributes: + label: Screenshots / AT transcript + description: Screenshots, or the lines `make fake-phone` or a serial terminal showed. Fictional numbers only. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..03aa8f0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: false +contact_links: + - name: Frage stellen + url: https://github.com/CodeForFire/freizeichen/discussions + about: Wie koppele ich das Telefon, welcher Port ist der richtige, geht das auch mit meinem Telefon? Fragen bitte in den Discussions stellen — nicht als Issue. + - name: Sicherheitslücke melden + url: https://github.com/CodeForFire/freizeichen/security/advisories/new + about: Sicherheitslücken bitte vertraulich melden — nicht als öffentliches Issue. Siehe SECURITY.md. + - name: Lagebuch + url: https://github.com/CodeForFire/lagebuch/issues/new/choose + about: Es geht um Lagebuch selbst, nicht um das Wählen? Dann bitte dort melden. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..a9332de --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,28 @@ +name: Feature request +description: Suggest an idea or improvement for Freizeichen +labels: [enhancement] +body: + - type: textarea + id: problem + attributes: + label: Problem / use case + description: What are you trying to do that Freizeichen does not support, or does badly? + validations: + required: true + - type: textarea + id: proposal + attributes: + label: Proposed solution + description: What should happen instead? Keep it concrete. + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Alternatives considered + description: Other approaches, or how you handle this today. + - type: textarea + id: phone + attributes: + label: Other phone? + description: If this is about supporting another phone, its model and what `AT`, `AT+CGMI` and `ATD` return on its Bluetooth serial port. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..8c8c747 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Summary + + + +## Changes + +- + +## Checklist + +- [ ] Commits follow [Conventional Commits](https://www.conventionalcommits.org/) and are DCO signed off (`git commit -s`) +- [ ] Commits are cryptographically signed (SSH or GPG) and show as **Verified** on GitHub — see [CONTRIBUTING.md](https://github.com/CodeForFire/freizeichen/blob/main/CONTRIBUTING.md#signing-your-commits) +- [ ] `make clean ci` passes locally +- [ ] UI changes include before/after screenshots; `make screenshots` re-run if a README view changed +- [ ] Dialling still goes through the confirm window, and numbers still reach the phone only through `TelUri` +- [ ] Screenshots, tests and examples use fictional phone numbers only diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000..15d47bc --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,57 @@ +name: Scorecard + +# OpenSSF Scorecard measures the repository's supply-chain posture: pinned +# actions, branch protection, dependency updates, signed releases and so on. +# publish_results is what lets api.securityscorecards.dev serve the README +# badge; the SARIF upload puts the same findings in the Code Scanning tab. + +on: + branch_protection_rule: + push: + branches: [main] + schedule: + - cron: '41 4 * * 1' + +permissions: + contents: read + +jobs: + analysis: + name: analysis + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + security-events: write # upload the SARIF results + id-token: write # required by publish_results + contents: read + actions: read + + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Run analysis + uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 + with: + results_file: results.sarif + results_format: sarif + # Scorecard reads branch-protection settings with the default + # GITHUB_TOKEN, which on a public repository sees only part of them. + # A classic PAT with public_repo scope in a SCORECARD_TOKEN secret + # would make the Branch-Protection check accurate. Deliberately not + # used: this is a single-maintainer project whose branch rules are + # what they are, and the extra long-lived credential costs more than + # the reporting accuracy is worth. + publish_results: true + + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: scorecard-results + path: results.sarif + retention-days: 5 + + - name: Upload to code scanning + uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 + with: + sarif_file: results.sarif diff --git a/AGENTS.md b/AGENTS.md index 5c9e37c..e8c98e8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,6 +40,8 @@ Einsatzkraft). Keep UI wording short and imperative; it is read in a command veh commit". - A pull request that touches a view carries before/after PNGs rendered with the headless Skia harness in `tests/Freizeichen.App.Tests`, attached with `gh pr create --attach`. +- The README's screenshots come from `ReadmeScreenshotTests`: run `make screenshots` and commit + `docs/screenshots/` whenever a view they show changes. Fixtures use fictional numbers only. ## GitHub Actions diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..e01071c --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,130 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the project maintainers through GitHub — either by opening a +private discussion with [@CodeForFire](https://github.com/CodeForFire) or by +using [GitHub's report-content flow](https://docs.github.com/en/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam) +on the offending material. All complaints will be reviewed and investigated +promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. + +Community Impact Guidelines were inspired by +[Mozilla's coc enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..afb4e18 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,141 @@ +# Contributing to Freizeichen + +Thanks for your interest in contributing! Freizeichen dials `tel:` links on a Gigaset DL500A over +Bluetooth, so that [Lagebuch](https://github.com/CodeForFire/lagebuch) and every other program in +the ELW can offer one-click calling. Every contribution is welcome, from a typo fix to support for +another phone. + +## Before you start + +- **Found a bug or have an idea?** Open an issue with the templates, or start a + [Discussion](https://github.com/CodeForFire/freizeichen/discussions) if you are unsure. +- **Another phone?** If your base station also speaks AT commands over Bluetooth SPP, open an + issue with what `AT`, `AT+CGMI` and `ATD` return on it. That transcript is worth more than a + patch. +- **Bigger changes:** say what you plan in an issue first. Asking early costs everyone less than a + pull request that goes the wrong way. + +## Language + +Issues, pull requests, commit messages, code and comments are in **English**, so that someone who +does not speak German can read the backlog and work here. + +The **UI is German**, and its text is inline (there are no `.resx` files). German terms of art stay +German even in English text: Amtsholung, Ländervorwahl, Einsatzkraft, Lagebuchführer. Quoted UI +strings are reproduced verbatim, never translated. Keep UI wording short and imperative, because +it is read in a command vehicle. + +**Discussions are exempt:** German and English are both fine there. + +## Development setup + +- [.NET SDK](https://dotnet.microsoft.com/download/dotnet). The version is pinned in + [`global.json`](global.json) (10.x). +- `make`, plus Python 3 for the fake phone (Linux only). + +```bash +make ci # restore (locked), build, test, format check: what CI runs +make run # settings window +make run ARGS=tel:0891234567 # dial window +make help # everything else +``` + +You do not need a DL500A. On Linux, `make fake-phone` plays one on `/dev/rfcomm9` and prints every +line Freizeichen sends; `SCENARIO=ok|error|busy|nocarrier|nodialtone|silent` picks how it answers +`ATD`. See the [README](README.md#ohne-telefon-testen). + +Before you push, run a clean build, `make clean ci`, and read the output. The last line can say +`0 Error(s)` even when a test assembly failed, so search the output for `Test Run Failed`. + +## Code conventions + +[`AGENTS.md`](AGENTS.md) has them in full: the dependency direction between the four projects, +view models without an Avalonia reference, injected `TimeProvider`, nullability, failure handling +and the Avalonia rules. The analyzers run at `AnalysisMode=All` with warnings as errors, so most +style questions are answered by the build. + +Tests use xUnit with plain `Assert` and handwritten test doubles, with no mocking library. Name +each test as a sentence in snake_case, e.g. `Rejects_a_semicolon_command`. A bug fix starts with +the failing test. + +## Commit conventions + +Every commit must meet three requirements: + +1. a [Conventional Commits](https://www.conventionalcommits.org/) subject line, +2. a DCO `Signed-off-by` trailer, added by `git commit -s`, +3. a cryptographic signature, SSH or GPG, added by `git commit -S`. + +```bash +git commit -s -S -m "fix(modem): report a timeout with the audio-connection hint" +``` + +The subject line starts with a type prefix (`feat:`, `fix:`, `docs:`, `style:`, `refactor:`, +`perf:`, `test:`, `build:`, `ci:` or `chore:`), optionally scoped, e.g. `fix(modem):`. + +You need both the sign-off and the signature, and they mean different things. The sign-off is +about **rights**: it certifies you may submit the change under the project's licence (see +[Licence](#licence)). The signature is about **identity**: it proves the commit came from you. + +### Signing your commits + +Set this up once, and from then on `git commit -s` is all you type. + +**SSH** is recommended, because you already have a key: + +```bash +git config --global gpg.format ssh +git config --global user.signingkey ~/.ssh/id_ed25519.pub +git config --global commit.gpgsign true +``` + +Then upload the same public key to GitHub **a second time**, as a signing key: *Settings → SSH and +GPG keys → New SSH key →* **Key type: Signing Key**. This is the step people miss. Without it your +commits are signed but show as *Unverified*. + +**GPG** works too; follow GitHub's +[Telling Git about your signing key](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key). + +### Fixing a branch you already pushed + +If a commit slipped through unsigned or without a sign-off, rewrite the branch rather than adding +a commit on top: + +```bash +git rebase --signoff --gpg-sign origin/main +git push --force-with-lease +``` + +Force-pushing your own pull-request branch is expected here. + +## Pull requests + +- Branch from `main`, and keep one change per pull request. +- `make clean ci` is green. +- **UI changes** include a before/after pair of screenshots, rendered with the headless harness in + `tests/Freizeichen.App.Tests` (`Window.CaptureRenderedFrame()`). If a view the README shows has + changed, run `make screenshots` and commit `docs/screenshots/`. +- **The dial path** still goes through the confirm window, and the number still reaches the phone + only through `TelUri`. A change there needs a test that replays the attack it guards against. +- **GitHub Actions** are pinned to a full commit SHA, and `zizmor .` stays clean. +- Screenshots, tests and examples use **fictional phone numbers** only. + +The PR template has this checklist. + +## Reporting issues + +Use the issue templates. For a bug, include your OS, the Freizeichen version, the phone model and +the port you selected. Security vulnerabilities do **not** belong in public issues; see +[`SECURITY.md`](SECURITY.md). + +## AI-assisted contributions + +Contributions made with coding agents are welcome if they follow the conventions above. +[`AGENTS.md`](AGENTS.md) documents them in the form agents read. + +## Licence + +By contributing, you agree that your contributions will be licensed under the +[MIT licence](LICENSE). Signing off your commits (`git commit -s`) certifies that you wrote the +change or otherwise have the right to submit it under the project's licence +([Developer Certificate of Origin](https://developercertificate.org/)). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5d09072 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Thomas Müller + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile index 90da49c..ef8de46 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ APP := src/Freizeichen.App/Freizeichen.App.csproj SCENARIO ?= ok PHONE_PORT ?= /dev/rfcomm9 -.PHONY: help restore build test ci format format-check run fake-phone clean +.PHONY: help restore build test ci format format-check run fake-phone screenshots clean help: ## Show this help @grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-14s %s\n", $$1, $$2}' @@ -34,5 +34,9 @@ run: ## Run the app (ARGS=tel:0891234567 to open the dial window) fake-phone: ## Play a DL500A on /dev/rfcomm9 (SCENARIO=ok|error|busy|nocarrier|nodialtone|silent; Linux) python3 tools/fake-dl500a.py --link $(PHONE_PORT) --scenario $(SCENARIO) +screenshots: ## Regenerate docs/screenshots/*.png for the README (ReadmeScreenshotTests with RENDER_OUT) + RENDER_OUT=$(CURDIR)/docs/screenshots dotnet test tests/Freizeichen.App.Tests -c Release \ + --filter "FullyQualifiedName~ReadmeScreenshotTests" + clean: ## Remove build output find src tests -type d \( -name bin -o -name obj \) -prune -exec rm -rf {} + diff --git a/README.md b/README.md index a8c9033..050db66 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,115 @@ -# Freizeichen +

Freizeichen

-*Ein Klick auf die Nummer – das Telefon wählt.* +

+ Ein Klick auf die Nummer – das Telefon wählt.
+ tel:-Links über ein Gigaset DL500A, per Bluetooth. +

-Wählt `tel:`-Links über ein Gigaset DL500A – per Bluetooth, ohne Gigaset QuickSync, TAPI oder CSTA. +

+ CI + Release + Downloads + MIT + OpenSSF Scorecard +

-Ein Klick auf eine Telefonnummer in Lagebuch (oder in jedem anderen Programm, das `tel:`-Links -öffnet) zeigt ein kleines Fenster „0891234567 wählen?“. Nach *Wählen* baut das DL500A den Anruf -auf; das Gespräch wird am Telefon geführt. +

+ Freizeichen fragt: 0891234567 über das Telefon wählen? – Abbrechen oder Wählen +

+ +Ein Klick auf eine Telefonnummer in [Lagebuch](https://github.com/CodeForFire/lagebuch) – oder in +jedem anderen Programm, das `tel:`-Links öffnet – zeigt ein kleines Fenster mit der Nummer. Nach +*Wählen* baut das Gigaset DL500A den Anruf auf; das Gespräch wird am Telefon geführt. + +Kein Gigaset QuickSync, kein TAPI, keine CSTA-Lizenz, kein Server. + +*English speakers: the developer documentation starts at [For developers](#for-developers).* + +## Wofür? + +Im ELW steht das Telefon neben dem Laptop, und die Nummer steht auf dem Bildschirm: im Lagebuch +bei der Einsatzkraft, im Alarmfax, auf einer Webseite. Abtippen kostet Zeit und geht im Einsatz +auch mal schief. Freizeichen macht aus jeder `tel:`-Nummer einen Klick – Lagebuch selbst muss dafür +nichts über das Telefon wissen, es erzeugt nur gewöhnliche `tel:`-Links. ## So funktioniert es Das DL500A stellt über Bluetooth eine serielle Schnittstelle (SPP) bereit und versteht dort -AT-Befehle. Freizeichen öffnet diese Schnittstelle, sendet `ATD ` und schließt sie wieder. +AT-Befehle wie ein Modem. Freizeichen öffnet diese Schnittstelle, sendet `ATD ` und schließt +sie wieder. Der Anruf bleibt danach an der Basis bestehen. + +Wie das Protokoll gefunden wurde: [CodeForFire/lagebuch#617](https://github.com/CodeForFire/lagebuch/issues/617). + +## Voraussetzungen + +- Ein **Gigaset DL500A** mit eingeschaltetem Bluetooth. +- Ein PC mit Bluetooth, auf dem das Telefon **gekoppelt** ist. +- Das Telefon ist **nicht als Audiogerät** (Freisprechen/Headset) mit dem PC verbunden. Solange + diese Audioverbindung besteht, antwortet das DL500A auf der seriellen Schnittstelle nicht – + siehe [Fehlerbehebung](#fehlerbehebung). + +## Installation + +Die Pakete liegen unter [Releases](../../releases). + +| System | Paket | Erster Start | +|---|---|---| +| **Windows** (x64) | `freizeichen--windows-x64.msi` ausführen | SmartScreen → „Weitere Informationen“ → „Trotzdem ausführen“ | +| **macOS** | `.dmg` öffnen (`arm64` für Apple-Chips, `x64` für Intel), Freizeichen in „Programme“ ziehen | Rechtsklick auf Freizeichen.app → „Öffnen“ | +| **Linux** | kein Paket – aus dem Quellcode starten, siehe [For developers](#for-developers) | Port mit `rfcomm bind` anlegen | + +Die Pakete sind noch nicht signiert. Ob ein Download unverändert ist, zeigt `SHA256SUMS.txt` im +Release: `sha256sum -c SHA256SUMS.txt` (Linux) bzw. `shasum -a 256 -c SHA256SUMS.txt` (macOS). + +## Einrichten + +Freizeichen-Einstellungen: Bluetooth-Port COM7, Ländervorwahl 49, Telefon antwortet. Alles bereit. + +Freizeichen ohne Nummer starten – es öffnet die Einstellungen. + +1. Das DL500A in den Bluetooth-Einstellungen des PCs **koppeln**, nicht als Audiogerät verbinden. +2. Unter **Bluetooth-Port** den Port des Telefons wählen: unter Windows ein ausgehender + COM-Port, unter macOS `/dev/cu.…`, unter Linux `/dev/rfcomm0`. +3. **Ländervorwahl** und, falls die Leitung eine braucht, **Amtsholung** eintragen, + **Speichern**. +4. **Verbindung testen** – „Telefon antwortet. Alles bereit.“ Ein **Testanruf** auf das eigene + Handy zeigt, dass auch das Wählen klappt. +5. **Als Standard festlegen**, damit `tel:`-Links künftig bei Freizeichen landen. + +Internationale Nummern im eigenen Land werden zur nationalen Form: `tel:+49 89 1234567` wählt +`0891234567`. + +
+ +## Sicherheit + +Ein `tel:`-Link kann von jeder Webseite und jedem Dokument kommen. Freizeichen behandelt ihn +deshalb als fremde Eingabe: + +- **Nichts wird ohne Bestätigung gewählt.** Jeder Link öffnet das Wählfenster; in der ersten + Sekunde nach dem Öffnen löst nicht einmal *Enter* den Anruf aus, damit ein Tastendruck, der für + ein anderes Programm gedacht war, nicht wählt. +- **Zum Telefon gelangen nur Ziffern** (und ein führendes `+`), höchstens 32 davon. Ein Link kann + so keine eigenen AT-Befehle anhängen und keine Dienstkennzahlen wie `*21*…#` für eine + Rufumleitung an der Vermittlungsstelle auslösen. + +Sicherheitslücken bitte vertraulich melden – siehe [SECURITY.md](SECURITY.md). + +## Fehlerbehebung + +Telefon antwortet nicht. Bluetooth am Telefon eingeschaltet? Ist es mit diesem PC als Audiogerät verbunden, diese Verbindung trennen. + +**„Telefon antwortet nicht.“** Fast immer besteht noch eine Audioverbindung (Freisprechen) vom PC +zum DL500A. Dann wird die serielle Verbindung nicht abgelehnt, sondern läuft ins Leere. In den +Bluetooth-Einstellungen des PCs die Audioverbindung trennen – gekoppelt bleibt das Telefon. + +**„Port … nicht gefunden.“** Das Telefon ist nicht (mehr) gekoppelt, oder unter Linux fehlt +`rfcomm bind`. Koppeln, dann in den Einstellungen **Aktualisieren**. + +**„Port … ist belegt.“** Ein anderes Programm hält die Schnittstelle offen, oder ein Anruf läuft +noch. + +
## Ohne Telefon testen @@ -27,6 +125,58 @@ make run ARGS=tel:0891234567 # Wählfenster `SCENARIO` steuert die Antwort auf `ATD`: `ok`, `error`, `busy`, `nocarrier`, `nodialtone` oder `silent` – Letzteres antwortet gar nicht, wie das DL500A bei bestehender Audioverbindung. -## Status +## Mitmachen + +Fehler gefunden, Idee, anderes Telefon? [Issues](../../issues) und +[Discussions](../../discussions) sind offen – in den Discussions gern auf Deutsch. +Wie Pull Requests aussehen sollen, steht in [CONTRIBUTING.md](CONTRIBUTING.md). + +--- + +## For developers + +Freizeichen is a small .NET 10 / Avalonia 12 desktop app for Windows, macOS and Linux. It +registers as the operating system's `tel:` handler, shows a confirm window and sends `ATD` to a +Gigaset DL500A over Bluetooth SPP. It exists so that [Lagebuch](https://github.com/CodeForFire/lagebuch) +and every other program in the ELW can keep emitting plain `tel:` links. + +### Build and run + +Prerequisite: the .NET SDK pinned in [`global.json`](global.json) (10.x). + +```sh +make ci # restore (locked), build, test, format check — what CI runs +make run # settings window +make run ARGS=tel:0891234567 # dial window +make fake-phone # a fake DL500A on /dev/rfcomm9 (Linux, needs sudo) +make screenshots # regenerate docs/screenshots/ for this README +make help # everything else +``` + +On Linux the phone appears as a serial port only after `sudo rfcomm bind 0 1`, and +the `tel:` handler is not registered automatically. + +### Layout + +| Project | What it holds | +|---|---| +| `Freizeichen.Domain` | `tel:` parsing (`TelUri`), number normalisation, settings. References nothing. | +| `Freizeichen.Modem` | The AT dial session over an `IAtChannel`, and the serial port. | +| `Freizeichen.AppLogic` | View models (CommunityToolkit.Mvvm). No Avalonia reference, so it is testable without a UI. | +| `Freizeichen.App` | Views, `Program`, the composition root and the per-OS `tel:` registration. | + +Packaging lives in [`packaging/`](packaging/): a WiX MSI for Windows and a `.dmg` for macOS, built +by [`release.yml`](.github/workflows/release.yml) when a `v*` tag is pushed. + +### Contributing + +- [CONTRIBUTING.md](CONTRIBUTING.md): setup, commit rules (Conventional Commits, DCO sign-off, + signed commits) and pull requests. +- [AGENTS.md](AGENTS.md): the architecture and code conventions in full, also read by coding agents. +- [SECURITY.md](SECURITY.md): how to report a vulnerability. +- [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). + +## Lizenz / Licence -In Entwicklung. Hintergrund: CodeForFire/lagebuch#617. +[MIT](LICENSE) © 2026 Thomas Müller. Bundled fonts and libraries are listed with their licences in +[THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..f4da26e --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,60 @@ +# Security Policy + +## Supported versions + +Freizeichen is pre-1.0. Only the **latest release** receives security fixes. + +| Version | Supported | +|---------|-----------| +| latest release | :white_check_mark: | +| earlier releases | :x: | + +## Reporting a vulnerability + +**Please do not report security vulnerabilities through public GitHub issues, discussions or pull +requests.** + +Use [GitHub's private vulnerability reporting](https://github.com/CodeForFire/freizeichen/security/advisories/new) +instead: + +1. Go to the repository's **Security** tab. +2. Click **Report a vulnerability**. +3. Describe the issue, including: + - the affected version (installer file name or tag, e.g. `v0.1.0`); + - the platform: Windows, macOS or Linux; + - steps to reproduce, or a proof of concept (a crafted `tel:` link is ideal); + - the impact you think it has. + +Reports are reviewed promptly. Please give us reasonable time to fix the issue before you disclose +it publicly. + +## What matters here + +Freizeichen is the operating system's `tel:` handler, so **any web page, e-mail or document can +hand it input**. Whatever reaches the phone after `ATD` is executed by the phone. Within scope: + +- **Getting anything other than a phone number to the phone.** `TelUri` reduces a link to digits + and an optional leading `+`, capped at 32 digits and 256 characters. A way to get a `;`, `\r`, + `\n` or letter through would let a link append its own AT commands. A `*` or `#` would let it + dial service codes, such as `*21*#`, which sets up call forwarding at the exchange. +- **Dialling without confirmation.** Every link must go through the confirm window, and a keypress + in the first second after the window opens must not dial. Any path that places a call without + the Lagebuchführer pressing *Wählen* is a vulnerability. +- **The `tel:` registration**, meaning the Windows registry entries and the macOS bundle claim. For + example, a way for Freizeichen's registration to be hijacked, or to hijack another scheme. +- **Settings file handling**, such as path or deserialization issues in the stored settings. +- **The release supply chain**: the build workflows, pinned actions, and the published installers + and `SHA256SUMS.txt`. + +## Out of scope + +- The Bluetooth security of the DL500A itself (pairing, SPP access by another paired device). + Report those to Gigaset. +- Anyone who can already run code as the logged-in user can open the serial port directly and + needs no help from Freizeichen. +- The installers are not code-signed yet. This is a known limitation, not a vulnerability. + Verify downloads with `SHA256SUMS.txt`. + +## Non-security issues + +Please use the [issue templates](https://github.com/CodeForFire/freizeichen/issues/new/choose). diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md new file mode 100644 index 0000000..2775081 --- /dev/null +++ b/THIRD-PARTY-NOTICES.md @@ -0,0 +1,40 @@ +# Third-party notices + +Freizeichen itself is released under the [MIT licence](LICENSE). The installers (MSI and .dmg) +also contain the third-party components listed below, each under its own licence. This file and +the font licence ship next to the program. + +## Fonts + +Bundled as application resources, unmodified except that the Oswald files are static weight +instances of the upstream variable font (see [`Assets/Fonts/README.md`](src/Freizeichen.App/Assets/Fonts/README.md)). +All three families are under the **SIL Open Font License 1.1**; the full text, with every +copyright line, is in [`OFL.txt`](src/Freizeichen.App/Assets/Fonts/OFL.txt). + +| Family | Copyright | Source | +|---|---|---| +| Oswald | Copyright 2016 The Oswald Project Authors | | +| Barlow | Copyright 2017 The Barlow Project Authors | | +| JetBrains Mono | Copyright 2020 The JetBrains Mono Project Authors | | + +## Libraries + +Pulled in as NuGet packages; exact versions are pinned in `Directory.Packages.props` and the +`packages.lock.json` files. + +| Component | Licence | Source | +|---|---|---| +| .NET runtime (self-contained) | MIT | | +| System.IO.Ports | MIT | | +| CommunityToolkit.Mvvm | MIT | | +| Avalonia (incl. Desktop, Skia, Fluent theme, platform backends) | MIT | | +| Avalonia.Angle.Windows.Natives (ANGLE) | BSD-3-Clause | | +| SkiaSharp | MIT; native Skia: BSD-3-Clause | | +| HarfBuzzSharp | MIT; native HarfBuzz: MIT ("Old MIT") | | +| MicroCom.Runtime | MIT | | +| Tmds.DBus.Protocol | MIT | | + +The .NET runtime carries its own third-party notices for the code it incorporates: +. + +Build- and test-only tools (StyleCop.Analyzers, xUnit, coverlet, WiX) are not shipped. diff --git a/docs/screenshots/dial-timeout.png b/docs/screenshots/dial-timeout.png new file mode 100644 index 0000000..a7af2ae Binary files /dev/null and b/docs/screenshots/dial-timeout.png differ diff --git a/docs/screenshots/dial.png b/docs/screenshots/dial.png new file mode 100644 index 0000000..4571272 Binary files /dev/null and b/docs/screenshots/dial.png differ diff --git a/docs/screenshots/settings.png b/docs/screenshots/settings.png new file mode 100644 index 0000000..10b2c27 Binary files /dev/null and b/docs/screenshots/settings.png differ diff --git a/src/Freizeichen.App/Assets/Fonts/OFL.txt b/src/Freizeichen.App/Assets/Fonts/OFL.txt new file mode 100644 index 0000000..1d4d0d9 --- /dev/null +++ b/src/Freizeichen.App/Assets/Fonts/OFL.txt @@ -0,0 +1,94 @@ +Copyright 2016 The Oswald Project Authors (https://github.com/googlefonts/OswaldFont) +Copyright 2017 The Barlow Project Authors (https://github.com/jpt/barlow) +Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/src/Freizeichen.App/Freizeichen.App.csproj b/src/Freizeichen.App/Freizeichen.App.csproj index 609d784..157f1c3 100644 --- a/src/Freizeichen.App/Freizeichen.App.csproj +++ b/src/Freizeichen.App/Freizeichen.App.csproj @@ -23,6 +23,14 @@ + + + + + + + diff --git a/tests/Freizeichen.App.Tests/ReadmeScreenshotTests.cs b/tests/Freizeichen.App.Tests/ReadmeScreenshotTests.cs new file mode 100644 index 0000000..e82de5d --- /dev/null +++ b/tests/Freizeichen.App.Tests/ReadmeScreenshotTests.cs @@ -0,0 +1,92 @@ +using Avalonia.Controls; +using Avalonia.Headless; +using Avalonia.Headless.XUnit; +using Avalonia.Input; +using Avalonia.Media.Imaging; +using Avalonia.Threading; +using Freizeichen.App.Views; +using Freizeichen.AppLogic.Tests; +using Freizeichen.AppLogic.ViewModels; +using Freizeichen.Domain; +using Freizeichen.Modem; +using Microsoft.Extensions.Time.Testing; + +namespace Freizeichen.App.Tests; + +// The source of every image in the README (docs/screenshots). `make screenshots` sets RENDER_OUT; +// a plain test run captures nothing and only checks that each window shows the state the README +// describes. +public sealed class ReadmeScreenshotTests +{ + // Fictional: 089 123456-7 is no one's number. + private const string Link = "tel:+49 89 1234567"; + + private readonly FakeDialer _dialer = new(); + private readonly FakeTimeProvider _time = new(); + + [AvaloniaFact] + public void Dial_window_asks_before_it_dials() + { + var window = OpenDialWindow(); + + Assert.Equal("0891234567", window.FindControl("NumberText")?.Text); + Assert.Empty(_dialer.Dialled); + Capture(window, "dial.png"); + } + + [AvaloniaFact] + public void Dial_window_explains_a_phone_that_does_not_answer() + { + _dialer.Result = DialResult.NoResponse; + var window = OpenDialWindow(); + + window.Press(PhysicalKey.Enter); + + Assert.Contains("als Audiogerät verbunden", window.FindControl("StatusText")?.Text, StringComparison.Ordinal); + Capture(window, "dial-timeout.png"); + } + + [AvaloniaFact] + public void Settings_window_shows_a_phone_that_answers() + { + var store = new FakeSettingsStore(DialSettings.Default with { PortName = "COM7" }); + var registration = new FakeRegistration { IsDefault = true }; + var vm = new SettingsViewModel(store, _dialer, () => ["COM3", "COM7"], registration); + var window = new SettingsWindow { DataContext = vm }; + window.Show(); + Dispatcher.UIThread.RunJobs(); + + _dialer.Result = DialResult.Answered; + vm.TestConnectionCommand.Execute(null); + Dispatcher.UIThread.RunJobs(); + + Assert.Equal(["COM7"], _dialer.Probed); + Assert.True(window.FindControl("IsDefaultText")?.IsVisible); + Capture(window, "settings.png"); + } + + private static void Capture(Window window, string name) + { + var dir = Environment.GetEnvironmentVariable("RENDER_OUT"); + if (string.IsNullOrWhiteSpace(dir)) + { + return; + } + + Directory.CreateDirectory(dir); + using var frame = window.CaptureRenderedFrame(); + Assert.NotNull(frame); + frame.Save(Path.Join(dir, name), new PngBitmapEncoderOptions()); + } + + private DialWindow OpenDialWindow() + { + var settings = DialSettings.Default with { PortName = "COM7" }; + var window = new DialWindow { DataContext = new DialViewModel(Link, settings, _dialer, _time) }; + window.Show(); + Dispatcher.UIThread.RunJobs(); + _time.Advance(DialViewModel.ArmDelay); + Dispatcher.UIThread.RunJobs(); + return window; + } +}