# holynova/flysheep-game-rating architecture

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

- Interactive diagram: https://gitdiagram.com/holynova/flysheep-game-rating
- Repository: https://github.com/holynova/flysheep-game-rating

## Overview

FlySheep Game Rating is a Chromium extension that adds Steam and Xiaoheihe ratings to Flysheep game pages and offers a standalone lookup popup. Its page workflow extracts Chinese and English title candidates, requests ratings through the background service worker, and renders linked, rarity-colored tags. The service worker coordinates lookups, applies grade thresholds, and caches results; the popup uses the same lookup route and can inspect or clear that cache. README documentation establishes the major features; unsampled manifest wiring and some UI details are not independently verified here.

Main entry points: [`src/background.js`](https://github.com/holynova/flysheep-game-rating/blob/main/src/background.js) (Lookup messaging), [`src/content.js`](https://github.com/holynova/flysheep-game-rating/blob/main/src/content.js) (Title extraction), [`src/ratings.js`](https://github.com/holynova/flysheep-game-rating/blob/main/src/ratings.js) (Rating matching), [`src/popup.js`](https://github.com/holynova/flysheep-game-rating/blob/main/src/popup.js) (Popup interactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_page["Page Integration"]
  node_content["Title extraction<br/>[content.js]"]
  node_page_tags["Page rating tags<br/>[content.js]"]
  node_tag_styles["Rating styles<br/>[tags.css]"]
end

subgraph group_lookup["Rating Lookup"]
  node_ratings["Rating matching<br/>[ratings.js]"]
end

subgraph group_background["Background Services"]
  node_message_router["Lookup messaging<br/>[background.js]"]
  node_request_queue["Request queue<br/>[background.js]"]
  node_grade_rules["Grade calculation<br/>[background.js]"]
  node_cache_logic["Cache management<br/>[background.js]"]
end

subgraph group_popup["Popup Interface"]
  node_popup_view["Popup interface<br/>[popup.html]"]
  node_popup_logic["Popup interactions<br/>[popup.js]"]
  node_popup_styles["Popup styles<br/>[popup.css]"]
end

node_visitor(("Extension user"))
node_flysheep["Flysheep pages"]
node_steam{{"Steam services"}}
node_heybox{{"Xiaoheihe API"}}
node_local_storage[("Browser local storage")]

node_flysheep -->|"hosts script"| node_content
node_content -->|"extracts candidates"| node_ratings
node_content -->|"sends lookup"| node_message_router
node_message_router -->|"queues lookup"| node_request_queue
node_request_queue -->|"runs lookup"| node_ratings
node_ratings -->|"searches and fetches reviews"| node_steam
node_ratings -->|"searches games"| node_heybox
node_message_router -->|"grades results"| node_grade_rules
node_message_router -->|"checks and stores"| node_cache_logic
node_cache_logic -->|"reads and writes"| node_local_storage
node_message_router -->|"returns results"| node_content
node_content -->|"renders ratings"| node_page_tags
node_page_tags -->|"uses styles"| node_tag_styles
node_visitor -->|"opens popup"| node_popup_view
node_popup_view -->|"provides interface"| node_popup_logic
node_popup_logic -->|"sends lookup"| node_message_router
node_popup_logic -->|"reads and clears cache"| node_local_storage
node_message_router -->|"returns results"| node_popup_logic
node_popup_view -->|"uses styles"| node_popup_styles

click node_content "https://github.com/holynova/flysheep-game-rating/blob/main/src/content.js"
click node_page_tags "https://github.com/holynova/flysheep-game-rating/blob/main/src/content.js"
click node_tag_styles "https://github.com/holynova/flysheep-game-rating/blob/main/src/tags.css"
click node_ratings "https://github.com/holynova/flysheep-game-rating/blob/main/src/ratings.js"
click node_message_router "https://github.com/holynova/flysheep-game-rating/blob/main/src/background.js"
click node_request_queue "https://github.com/holynova/flysheep-game-rating/blob/main/src/background.js"
click node_grade_rules "https://github.com/holynova/flysheep-game-rating/blob/main/src/background.js"
click node_cache_logic "https://github.com/holynova/flysheep-game-rating/blob/main/src/background.js"
click node_popup_view "https://github.com/holynova/flysheep-game-rating/blob/main/src/popup.html"
click node_popup_logic "https://github.com/holynova/flysheep-game-rating/blob/main/src/popup.js"
click node_popup_styles "https://github.com/holynova/flysheep-game-rating/blob/main/src/popup.css"

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_content,node_page_tags,node_tag_styles,node_visitor toneBlue
class node_ratings,node_local_storage toneAmber
class node_message_router,node_request_queue,node_grade_rules,node_cache_logic,node_heybox toneMint
class node_popup_view,node_popup_logic,node_popup_styles toneRose
class node_flysheep,node_steam toneIndigo
```

## Components

### Page Integration

- [Title extraction](https://github.com/holynova/flysheep-game-rating/blob/main/src/content.js): `src/content.js`
- [Page rating tags](https://github.com/holynova/flysheep-game-rating/blob/main/src/content.js): `src/content.js`
- [Rating styles](https://github.com/holynova/flysheep-game-rating/blob/main/src/tags.css): `src/tags.css`

### Rating Lookup

- [Rating matching](https://github.com/holynova/flysheep-game-rating/blob/main/src/ratings.js): `src/ratings.js`

### Background Services

- [Lookup messaging](https://github.com/holynova/flysheep-game-rating/blob/main/src/background.js): `src/background.js`
- [Request queue](https://github.com/holynova/flysheep-game-rating/blob/main/src/background.js): `src/background.js`
- [Grade calculation](https://github.com/holynova/flysheep-game-rating/blob/main/src/background.js): `src/background.js`
- [Cache management](https://github.com/holynova/flysheep-game-rating/blob/main/src/background.js): `src/background.js`

### Popup Interface

- [Popup interface](https://github.com/holynova/flysheep-game-rating/blob/main/src/popup.html): `src/popup.html`
- [Popup interactions](https://github.com/holynova/flysheep-game-rating/blob/main/src/popup.js): `src/popup.js`
- [Popup styles](https://github.com/holynova/flysheep-game-rating/blob/main/src/popup.css): `src/popup.css`

### Other components

- **Extension user**
- **Flysheep pages**
- **Steam services**
- **Xiaoheihe API**
- **Browser local storage**

## Connections

- Flysheep pages → Title extraction: hosts script (evidence: `README.md`)
- Title extraction → Rating matching: extracts candidates (evidence: `src/content.js`)
- Title extraction → Lookup messaging: sends lookup (evidence: `src/content.js`)
- Lookup messaging → Request queue: queues lookup (evidence: `src/background.js`)
- Request queue → Rating matching: runs lookup (evidence: `src/background.js`)
- Rating matching → Steam services: searches and fetches reviews (evidence: `src/ratings.js`)
- Rating matching → Xiaoheihe API: searches games (evidence: `src/ratings.js`)
- Lookup messaging → Grade calculation: grades results (evidence: `src/background.js`)
- Lookup messaging → Cache management: checks and stores (evidence: `src/background.js`)
- Cache management → Browser local storage: reads and writes (evidence: `src/background.js`)
- Lookup messaging → Title extraction: returns results (evidence: `src/content.js`)
- Title extraction → Page rating tags: renders ratings (evidence: `src/content.js`)
- Page rating tags → Rating styles: uses styles (evidence: `README.md`)
- Extension user → Popup interface: opens popup (evidence: `README.md`)
- Popup interface → Popup interactions: provides interface (evidence: `README.md`)
- Popup interactions → Lookup messaging: sends lookup (evidence: `src/popup.js`)
- Popup interactions → Browser local storage: reads and clears cache (evidence: `src/popup.js`)
- Lookup messaging → Popup interactions: returns results (evidence: `src/popup.js`)
- Popup interface → Popup styles: uses styles (evidence: `README.md`)
