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 +
+ Ein Klick auf die Nummer – das Telefon wählt.
+ tel:-Links über ein Gigaset DL500A, per Bluetooth.
+
+
+
+
+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`.
+
+
+
+**„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.
+
+