# creativestar-studio/qupeiyinbrowser architecture

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

- Interactive diagram: https://gitdiagram.com/creativestar-studio/qupeiyinbrowser
- Repository: https://github.com/creativestar-studio/qupeiyinbrowser

## Overview

XTC Browser is a Python HTTPS proxy/server that lets an XTC watch reach a browser-like page through the English dubbing app’s child-privacy-policy entry. The runtime sets hotspot DNS and hosts redirection, starts a TLS-wrapped server on port 443, and serves the local privacy page; shutdown restores network settings. The README also documents port-occupancy handling and automatic SSL setup, but the sampled source does not show a separate port check or certificate-generation subsystem. Relationships below are limited to the entry-point excerpt and README; frontend behavior is not sampled.

Main entry points: [`src/main.py`](https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py) (HTTPS server), [`src/app/xtc/privacy/child.html`](https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/app/xtc/privacy/child.html) (Privacy page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_network["Network redirection"]
  node_dns["Hotspot DNS<br/>[main.py]"]
  node_hosts["Hosts mapping<br/>[main.py]"]
  node_localip["Local IP lookup<br/>[main.py]"]
  node_cleanup["Network cleanup<br/>[main.py]"]
end

subgraph group_server["HTTPS serving"]
  node_runtime["Runtime startup<br/>[main.py]"]
  node_https["HTTPS server<br/>[main.py]"]
  node_handler["No-cache handler<br/>[main.py]"]
  node_cert["TLS certificate"]
end

subgraph group_web["Browser content"]
  node_privacy["Privacy page<br/>[child.html]"]
end

node_watch(("XTC watch"))
node_app(("English dubbing app"))
node_powershell["Windows networking"]

node_app -->|"opens policy"| node_watch
node_runtime -->|"configures"| node_dns
node_runtime -->|"configures"| node_hosts
node_dns -->|"gets address"| node_localip
node_hosts -->|"gets address"| node_localip
node_dns -->|"sets DNS"| node_powershell
node_hosts -->|"writes mapping"| node_powershell
node_runtime -->|"starts"| node_https
node_https -->|"uses"| node_handler
node_https -->|"wraps with TLS"| node_cert
node_watch -.->|"requests page"| node_https
node_https -.->|"serves content"| node_privacy
node_runtime -->|"registers shutdown"| node_cleanup
node_cleanup -->|"restores mapping"| node_hosts
node_cleanup -->|"restores DNS"| node_dns
node_cleanup -->|"stops server"| node_https

click node_runtime "https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py"
click node_dns "https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py"
click node_hosts "https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py"
click node_localip "https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py"
click node_https "https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py"
click node_handler "https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py"
click node_privacy "https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/app/xtc/privacy/child.html"
click node_cleanup "https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py"

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_dns,node_hosts,node_localip,node_cleanup toneBlue
class node_runtime,node_https,node_handler,node_cert toneAmber
class node_privacy toneMint
class node_watch,node_app,node_powershell toneIndigo
```

## Components

### Network redirection

- [Hotspot DNS](https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py): `src/main.py`
- [Hosts mapping](https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py): `src/main.py`
- [Local IP lookup](https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py): `src/main.py`
- [Network cleanup](https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py): `src/main.py`

### HTTPS serving

- [Runtime startup](https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py): `src/main.py`
- [HTTPS server](https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py): `src/main.py`
- [No-cache handler](https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/main.py): `src/main.py`
- **TLS certificate**

### Browser content

- [Privacy page](https://github.com/creativestar-studio/qupeiyinbrowser/blob/main/src/app/xtc/privacy/child.html): `src/app/xtc/privacy/child.html`

### Other components

- **XTC watch**
- **English dubbing app**
- **Windows networking**

## Connections

- English dubbing app → XTC watch: opens policy (evidence: `README.md`)
- Runtime startup → Hotspot DNS: configures (evidence: `src/main.py`)
- Runtime startup → Hosts mapping: configures (evidence: `src/main.py`)
- Hotspot DNS → Local IP lookup: gets address (evidence: `src/main.py`)
- Hosts mapping → Local IP lookup: gets address (evidence: `src/main.py`)
- Hotspot DNS → Windows networking: sets DNS (evidence: `src/main.py`)
- Hosts mapping → Windows networking: writes mapping (evidence: `src/main.py`)
- Runtime startup → HTTPS server: starts (evidence: `src/main.py`)
- HTTPS server → No-cache handler: uses (evidence: `src/main.py`)
- HTTPS server → TLS certificate: wraps with TLS (evidence: `src/main.py`)
- XTC watch → HTTPS server: requests page (evidence: `README.md`)
- HTTPS server → Privacy page: serves content (evidence: `README.md`)
- Runtime startup → Network cleanup: registers shutdown (evidence: `src/main.py`)
- Network cleanup → Hosts mapping: restores mapping (evidence: `src/main.py`)
- Network cleanup → Hotspot DNS: restores DNS (evidence: `src/main.py`)
- Network cleanup → HTTPS server: stops server (evidence: `src/main.py`)
