Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.git
.github
.dart_tool
build
android
ios
macos
linux
windows
docs
test
backend.Tests
backend/bin
backend/obj
backend/wwwroot
**/bin
**/obj
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Bug report
description: Something does not work, looks wrong, or is confusing
labels: [bug]
body:
- type: textarea
id: what
attributes:
label: What happened
description: What you did, what you expected, and what you saw instead.
validations:
required: true
- type: dropdown
id: where
attributes:
label: Where
options:
- Phone layout
- Printer panel layout
- Administrator screen
- Sign-in
- Server or API
- Hosting
validations:
required: true
- type: input
id: setup
attributes:
label: Device, browser and text size
placeholder: "Phone, Chrome, text size larger than normal"
- type: textarea
id: shot
attributes:
label: Screenshot or message shown
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Report a security problem privately
url: https://github.com/Hikki-dev/pull_printing_app/security/advisories/new
about: Please do not open a public issue for security problems.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Idea or improvement
description: Something that would make the demo or the product better
labels: [enhancement]
body:
- type: textarea
id: problem
attributes:
label: What problem would this solve, and for whom
description: Describe the person and the moment, not the solution.
validations:
required: true
- type: textarea
id: idea
attributes:
label: What you have in mind
21 changes: 21 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## What this changes

<!-- Say what changed and why, in plain words. -->

## How it was checked

<!-- Tests you ran, and anything you tried by hand (which screens, which text size). -->

- [ ] `dotnet test backend.Tests`
- [ ] `flutter analyze --no-fatal-infos` and `flutter test`
- [ ] Tried it in a browser or on a device

## Not checked

<!-- Be honest about what you did not verify. -->

## Checklist

- [ ] Rules about who may do what are enforced by the server, with a test
- [ ] New or changed screens work at 1.5 and 2 times text size
- [ ] Docs in `docs/` and `CHANGELOG.md` updated if behaviour changed
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
push:
pull_request:

jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- run: dotnet test backend.Tests

frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: stable
- run: flutter pub get
- run: flutter analyze --no-fatal-infos
- run: flutter test

docker:
# Builds the image the way a host would, then starts it and checks it answers.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t pull-print-demo .
- name: Start the image and check it
run: |
docker run -d --name pp -p 8080:8080 pull-print-demo
for i in $(seq 1 30); do curl -fs http://localhost:8080/healthz && break; sleep 2; done
curl -fs http://localhost:8080/healthz
curl -fs http://localhost:8080/ | grep -q "Pull Print demo"
curl -fs -X POST -H 'content-type: application/json' -d '{"admin":false}' \
http://localhost:8080/api/auth/demo-login | grep -q '"token"'
test "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/jobs/held)" = "401"
- if: failure()
run: docker logs pp
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

# .NET
**/bin/
**/obj/
backend/wwwroot/
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Changelog

All notable changes. Newest first.

## Unreleased (pull request #1)

### Added
- **Work-account sign-in.** People sign in with their Microsoft 365 or Google Workspace account. The server does the sign-in, only lets in people from your organisation, adds them on first sign-in, and decides who is an administrator.
- **Printers and quotas managed on the server.** Administrators add, switch off and remove printers, set pages a month for new people, for everyone or for one person, and see a setup check that names anything still to do. Pages start again each month.
- A printer picker on the phone, and printer panels fixed to one printer by their address (`?printer=`).
- `docs/09-connecting-your-workspace.md`: the ten-minute setup for Microsoft and Google.
- A new README and guides with pictures of every screen taken from the running app (`docs/Getting%20started.md`, `docs/Fixing%20problems.md`), two diagrams, a short demo GIF, and `tools/screenshots/` to make them again.
- Phone and printer-panel screens: sign in, choose documents, print, confirmation, administrator view.
- A working .NET 8 backend with protected routes, quota checks on the server, and private demo sandboxes.
- Demo banner and "What is this?" dialog on every screen, sample documents on demand, and **Start over**.
- Select all and Clear, plain messages for a long document and for no pages left, partial-print notice.
- The printer panel signs out after 60 seconds without a touch.
- Static hosting on Vercel (`vercel.json`, `scripts/vercel-build.sh`) and a `Dockerfile` and `render.yaml` for the full stack.
- A branded loading screen, page title, description, icons and manifest for the web build.
- Design documents, mockups, an architecture and API reference, and a review record in `docs/`.
- CI for the backend, the app, and the Docker image.
- 112 backend tests and 64 app tests, including a simulated Microsoft/Google sign-in.

### Changed
- `PullPrintingBackend.csproj` is no longer empty; the backend builds.
- Routes match what the app calls. `POST /api/jobs/release` takes `jobIds` and returns what really printed.
- The app uses the server's answer about what printed, and refreshes a stale list.

### Fixed
- Sign in button pushed off screen at large text sizes and on short phones.
- Overflows at 1.5 and 2 times text size.
- A demo administrator could see every visitor's documents.
- Unexpected server errors, missing security headers, and unbounded request sizes.

### Removed
- The MSAL wrapper (`msal_flutter`, `MsAuthService.dart`) and the `AUTH_MODE` and `MS_SCOPE` build settings. Sign-in no longer needs anything in the app.
- The `AzureAd__*` settings, replaced by `Workspace__*`. `Demo__SigningKey` is now `Auth__SigningKey` (the old name still works).
- Windows-only printing code (`System.Printing`), replaced by `IPrintDispatcher` with a simulated implementation.
- The mock JSON server data (`frontend/db.json`).

## Before this

An early prototype: screens and an API shape that were not connected, and a backend that did not build.
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributing

Thanks for helping. This is a small project, so the process is light.

## Get set up

You need the [Flutter SDK](https://docs.flutter.dev/get-started/install) and the [.NET 8 SDK](https://dotnet.microsoft.com/download).

```bash
flutter pub get
flutter run -t frontend/lib/main.dart # the app on built-in sample data

dotnet run --project backend # the API (ASPNETCORE_ENVIRONMENT=Development turns demo sign-in on)
```

The README has the full list of ways to run it, and [`docs/How%20it%20works.md`](docs/How%20it%20works.md) explains how the pieces fit.

## Before you open a pull request

Run what CI runs:

```bash
dotnet test backend.Tests
flutter analyze --no-fatal-infos
flutter test
```

There are 64 app tests and 112 backend tests.

- **Add a test with every behaviour change.** Server rules go in `backend.Tests`; screens and the API client go in `test/`.
- **Check large text.** `test/widget_test.dart` runs the phone screens at 1.5 and 2 times text size and fails on any overflow. New screens should be added there.
- **Keep the server in charge.** The app only shows things; any rule about who may do what belongs in the backend, with a test.
- **Match the style around you.** Run `dart format` on Flutter code you touch.
- **Wording is part of the design.** Use the plain words in [`docs/03-screen-specs.md`](docs/03-screen-specs.md#wording), and keep messages saying what to do next.
- **No stock or generated imagery, no emoji.** See [`docs/04-design-guidelines.md`](docs/04-design-guidelines.md).

## Pull requests

- One change per pull request, with a description that says what changed, why, and how you checked it.
- Say what you did **not** check.
- Update the docs in `docs/` and `CHANGELOG.md` when behaviour changes.
- If a screen changed, take its pictures again: [`tools/screenshots`](tools/screenshots/README.md) explains how. Pictures come from the running app, never from a mock-up.

## Reporting problems

Use the issue templates. For anything security related, read [SECURITY.md](SECURITY.md) first.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# One image that serves both the web app and the API, for a free demo host.
# Build: docker build -t pull-print-demo .
# Run: docker run -p 8080:8080 pull-print-demo then open http://localhost:8080

# 1) The web app (Flutter), built to talk to the API on the same address.
FROM ghcr.io/cirruslabs/flutter:stable AS web
WORKDIR /src
COPY pubspec.yaml pubspec.lock .metadata ./
COPY frontend ./frontend
COPY web ./web
RUN flutter pub get
RUN flutter build web -t frontend/lib/main.dart --release --no-web-resources-cdn \
--dart-define=USE_MOCK=false

# 2) The API (ASP.NET Core).
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS api
WORKDIR /src
COPY backend ./backend
RUN dotnet publish backend -c Release -o /out

# 3) Run both together: the API serves the web app from wwwroot.
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=api /out .
COPY --from=web /src/build/web ./wwwroot
ENV ASPNETCORE_ENVIRONMENT=Production \
Demo__Enabled=true
USER $APP_UID
EXPOSE 8080
# Hosts such as Render tell the app which port to use through PORT.
CMD ["sh", "-c", "ASPNETCORE_URLS=http://0.0.0.0:${PORT:-8080} exec dotnet PullPrintingBackend.dll"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Pull Print contributors

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.
Loading
Loading