# atmluck/autoszuweb architecture

> Architecture diagram of the GitHub repository atmluck/autoszuweb, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atmluck/autoszuweb
- Repository: https://github.com/atmluck/autoszuweb

## Overview

AutoSZUWeb is a Windows background campus-network authenticator. Its workflow starts with first-run credential setup and DPAPI-backed configuration, then logs in and monitors connectivity in a persistent retry loop. Login prefers SZU SRun and falls back to dormitory ePortal; the README also documents autostart, local auth logs, and silent reconnects. Sampled sources substantiate the main calls, storage, probes, and protocol implementations; documented runtime capabilities without sampled implementations are represented at their supported enclosing source paths.

Main entry points: [`src/AutoSZUWeb.cpp`](https://github.com/atmluck/autoszuweb/blob/main/src/AutoSZUWeb.cpp) (Credential setup), [`src/web.cpp`](https://github.com/atmluck/autoszuweb/blob/main/src/web.cpp) (Login coordinator), [`src/sys.cpp`](https://github.com/atmluck/autoszuweb/blob/main/src/sys.cpp) (DPAPI encryption), [`src/srun.cpp`](https://github.com/atmluck/autoszuweb/blob/main/src/srun.cpp) (SRun protocol)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["First-run setup"]
  node_setupflow["Credential setup<br/>[AutoSZUWeb.cpp]"]
  node_desktopfile["Temporary credentials"]
end

subgraph group_runtime["Resident runtime"]
  node_app["Application entry<br/>[AutoSZUWeb.cpp]"]
  node_loop["Reconnect loop<br/>[AutoSZUWeb.cpp]"]
  node_probe["Connectivity probe<br/>[web.cpp]"]
  node_feedback["First-login feedback<br/>[web.cpp]"]
end

subgraph group_auth["Authentication"]
  node_login["Login coordinator<br/>[web.cpp]"]
  node_srun["SRun protocol<br/>[srun.cpp]"]
  node_eportal["ePortal protocol<br/>[web.cpp]"]
end

subgraph group_local["Local state"]
  node_configpath["Config paths<br/>[file_path.cpp]"]
  node_credentials[("Encrypted settings")]
  node_crypto["DPAPI encryption<br/>[sys.cpp]"]
  node_autostart["Startup registration<br/>[sys.cpp]"]
  node_logs[("Authentication logs<br/>[sys.cpp]")]
end

node_student(("Student"))
node_dns(("Public DNS endpoints"))
node_srunserver(("SZU SRun server"))
node_dormserver(("Dorm ePortal"))
node_windows[("Windows startup registry")]

node_student -->|"provides credentials"| node_setupflow
node_setupflow -->|"reads or creates"| node_desktopfile
node_setupflow -->|"gets config path"| node_configpath
node_setupflow -->|"encrypts credentials"| node_crypto
node_crypto -->|"writes ciphertext"| node_credentials
node_setupflow -->|"registers startup"| node_autostart
node_autostart -->|"writes Run entry"| node_windows
node_app -->|"gets config path"| node_configpath
node_app -->|"starts setup"| node_setupflow
node_app -->|"starts runtime"| node_loop
node_loop -->|"reads settings"| node_credentials
node_loop -->|"decrypts credentials"| node_crypto
node_loop -->|"logs in"| node_login
node_loop -->|"checks online state"| node_probe
node_probe -->|"probes TCP"| node_dns
node_login -->|"tries first"| node_srun
node_login -->|"falls back"| node_eportal
node_srun -->|"requests challenge and login"| node_srunserver
node_eportal -->|"sends login request"| node_dormserver
node_login -->|"records result"| node_logs
node_login -->|"shows first-run result"| node_feedback

click node_app "https://github.com/atmluck/autoszuweb/blob/main/src/AutoSZUWeb.cpp"
click node_setupflow "https://github.com/atmluck/autoszuweb/blob/main/src/AutoSZUWeb.cpp"
click node_configpath "https://github.com/atmluck/autoszuweb/blob/main/src/file_path.cpp"
click node_crypto "https://github.com/atmluck/autoszuweb/blob/main/src/sys.cpp"
click node_autostart "https://github.com/atmluck/autoszuweb/blob/main/src/sys.cpp"
click node_loop "https://github.com/atmluck/autoszuweb/blob/main/src/AutoSZUWeb.cpp"
click node_probe "https://github.com/atmluck/autoszuweb/blob/main/src/web.cpp"
click node_login "https://github.com/atmluck/autoszuweb/blob/main/src/web.cpp"
click node_srun "https://github.com/atmluck/autoszuweb/blob/main/src/srun.cpp"
click node_eportal "https://github.com/atmluck/autoszuweb/blob/main/src/web.cpp"
click node_logs "https://github.com/atmluck/autoszuweb/blob/main/src/sys.cpp"
click node_feedback "https://github.com/atmluck/autoszuweb/blob/main/src/web.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_setupflow,node_desktopfile toneBlue
class node_app,node_loop,node_probe,node_feedback,node_windows toneAmber
class node_login,node_srun,node_eportal,node_srunserver toneMint
class node_configpath,node_credentials,node_crypto,node_autostart,node_logs toneRose
class node_student,node_dns,node_dormserver toneIndigo
```

## Components

### First-run setup

- [Credential setup](https://github.com/atmluck/autoszuweb/blob/main/src/AutoSZUWeb.cpp): `src/AutoSZUWeb.cpp`
- **Temporary credentials**

### Resident runtime

- [Application entry](https://github.com/atmluck/autoszuweb/blob/main/src/AutoSZUWeb.cpp): `src/AutoSZUWeb.cpp`
- [Reconnect loop](https://github.com/atmluck/autoszuweb/blob/main/src/AutoSZUWeb.cpp): `src/AutoSZUWeb.cpp`
- [Connectivity probe](https://github.com/atmluck/autoszuweb/blob/main/src/web.cpp): `src/web.cpp`
- [First-login feedback](https://github.com/atmluck/autoszuweb/blob/main/src/web.cpp): `src/web.cpp`

### Authentication

- [Login coordinator](https://github.com/atmluck/autoszuweb/blob/main/src/web.cpp): `src/web.cpp`
- [SRun protocol](https://github.com/atmluck/autoszuweb/blob/main/src/srun.cpp): `src/srun.cpp`
- [ePortal protocol](https://github.com/atmluck/autoszuweb/blob/main/src/web.cpp): `src/web.cpp`

### Local state

- [Config paths](https://github.com/atmluck/autoszuweb/blob/main/src/file_path.cpp): `src/file_path.cpp`
- **Encrypted settings**
- [DPAPI encryption](https://github.com/atmluck/autoszuweb/blob/main/src/sys.cpp): `src/sys.cpp`
- [Startup registration](https://github.com/atmluck/autoszuweb/blob/main/src/sys.cpp): `src/sys.cpp`
- [Authentication logs](https://github.com/atmluck/autoszuweb/blob/main/src/sys.cpp): `src/sys.cpp`

### Other components

- **Student**
- **Public DNS endpoints**
- **SZU SRun server**
- **Dorm ePortal**
- **Windows startup registry**

## Connections

- Student → Credential setup: provides credentials
- Credential setup → Temporary credentials: reads or creates
- Credential setup → Config paths: gets config path
- Credential setup → DPAPI encryption: encrypts credentials
- DPAPI encryption → Encrypted settings: writes ciphertext
- Credential setup → Startup registration: registers startup
- Startup registration → Windows startup registry: writes Run entry
- Application entry → Config paths: gets config path
- Application entry → Credential setup: starts setup
- Application entry → Reconnect loop: starts runtime
- Reconnect loop → Encrypted settings: reads settings
- Reconnect loop → DPAPI encryption: decrypts credentials
- Reconnect loop → Login coordinator: logs in
- Reconnect loop → Connectivity probe: checks online state
- Connectivity probe → Public DNS endpoints: probes TCP
- Login coordinator → SRun protocol: tries first
- Login coordinator → ePortal protocol: falls back
- SRun protocol → SZU SRun server: requests challenge and login
- ePortal protocol → Dorm ePortal: sends login request
- Login coordinator → Authentication logs: records result
- Login coordinator → First-login feedback: shows first-run result
