feat: import and group AlbionBB battle history

This commit is contained in:
Meghdad committed 2026-10-18 21:52:32 +03:30
1 parent 2f13547239
commit 4cea3709af
180 files changed
+69005 -26

No files matched your search

+4
View File
@@ -18,6 +18,7 @@ Preview at `http://localhost:4173`. Restart after source or content changes to r
| `npm run build` | Generate the static website in `dist/` | | `npm run build` | Generate the static website in `dist/` |
| `npm test` | Validate content, URL handling, preview metadata, and generated pages | | `npm test` | Validate content, URL handling, preview metadata, and generated pages |
| `npm run sync:battles` | Download social preview images for configured AlbionBB reports | | `npm run sync:battles` | Download social preview images for configured AlbionBB reports |
| `npm run import:battles` | Scan available battle history and import verified reports |
The build works offline. Battle image synchronization requires network access and preserves report links when previews are unavailable. The build works offline. Battle image synchronization requires network access and preserves report links when previews are unavailable.
@@ -43,6 +44,9 @@ test/ Node.js tests
Localized fields accept `{ "en": "English", "fa": "فارسی" }` or a plain string. Missing Persian values fall back to English. See [the content reference](docs/content.md) for media formats, battle report fields, recruitment, and rewards. Localized fields accept `{ "en": "English", "fa": "فارسی" }` or a plain string. Missing Persian values fall back to English. See [the content reference](docs/content.md) for media formats, battle report fields, recruitment, and rewards.
The [battle importer](docs/battle-import.md) documents ongoing imports, selection
criteria, multi-report grouping, and verification. The scan has no date cutoff.
## Architecture ## Architecture
The Node.js generator renders complete HTML pages at `/` (English) and `/fa/` (Persian, RTL). Vanilla JavaScript handles navigation, reward tabs, media dialogs, and language preferences. A one-year `oneup_language` cookie remembers the selected language; `?lang=en` or `?lang=fa` overrides it. The Node.js generator renders complete HTML pages at `/` (English) and `/fa/` (Persian, RTL). Vanilla JavaScript handles navigation, reward tabs, media dialogs, and language preferences. A one-year `oneup_language` cookie remembers the selected language; `?lang=en` or `?lang=fa` overrides it.
+11
View File
@@ -0,0 +1,11 @@
{
"guildId": "SF2Zf4PrRsmdBAL5PaBV_A",
"guildName": "OneUP",
"region": "europe",
"apiBaseUrl": "https://api.albionbb.com/eu",
"sourceUrl": "https://europe.albionbb.com/guilds/SF2Zf4PrRsmdBAL5PaBV_A/battles",
"filters": {
"minPlayers": 10,
"minGuildPlayers": 5
}
}
+1881 -19
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -1,5 +1,6 @@
{ {
"en": { "en": {
"moreBattleReports": "Explore {count} more reports",
"battleArchive": "From the war archive", "singleReport": "Battle report", "combinedReport": "Campaign report", "europe": "Europe", "engagement": "engagement", "engagements": "engagements", "reportIds": "Battle report IDs", "archivedReports": "Archived reports", "loggedEngagements": "Recorded engagements", "archiveMotto": "One banner. Every battlefield.", "detailedLog": "Detailed battle log", "battleArchive": "From the war archive", "singleReport": "Battle report", "combinedReport": "Campaign report", "europe": "Europe", "engagement": "engagement", "engagements": "engagements", "reportIds": "Battle report IDs", "archivedReports": "Archived reports", "loggedEngagements": "Recorded engagements", "archiveMotto": "One banner. Every battlefield.", "detailedLog": "Detailed battle log",
"mainContent": "Our main content", "recruitmentRequirements": "Entry requirements", "applicationTitle": "Ready to join the ranks?", "applyDiscord": "Apply on Discord", "mainContent": "Our main content", "recruitmentRequirements": "Entry requirements", "applicationTitle": "Ready to join the ranks?", "applyDiscord": "Apply on Discord",
"title": "OneUP — One United Power. | Albion Online Guild", "title": "OneUP — One United Power. | Albion Online Guild",
@@ -19,6 +20,7 @@
"communityLabel": "05 / ANSWER THE CALL", "communityTitle": "Your next chapter", "communityAccent": "starts with us.", "communityText": "Find your people. Bring your ambition. Stand beneath the OneUP banner.", "socialSoon": "Link coming soon", "socialOpen": "Visit", "footer": "Many warriors. One United Power.", "fan": "An independent Albion Online guild community. Albion Online belongs to Sandbox Interactive.", "top": "Back to top", "menu": "Toggle navigation", "videoFallback": "Open original video", "videoError": "This video could not be loaded. You can open the original link below." "communityLabel": "05 / ANSWER THE CALL", "communityTitle": "Your next chapter", "communityAccent": "starts with us.", "communityText": "Find your people. Bring your ambition. Stand beneath the OneUP banner.", "socialSoon": "Link coming soon", "socialOpen": "Visit", "footer": "Many warriors. One United Power.", "fan": "An independent Albion Online guild community. Albion Online belongs to Sandbox Interactive.", "top": "Back to top", "menu": "Toggle navigation", "videoFallback": "Open original video", "videoError": "This video could not be loaded. You can open the original link below."
}, },
"fa": { "fa": {
"moreBattleReports": "مشاهدهٔ {count} گزارش دیگر",
"battleArchive": "از آرشیو نبردها", "singleReport": "گزارش نبرد", "combinedReport": "گزارش مجموعه نبردها", "europe": "اروپا", "engagement": "نبرد", "engagements": "نبرد", "reportIds": "شناسه گزارش نبردها", "archivedReports": "گزارش ثبت‌شده", "loggedEngagements": "نبرد ثبت‌شده", "archiveMotto": "یک پرچم، در هر میدان نبرد.", "detailedLog": "جزئیات گزارش نبردها", "battleArchive": "از آرشیو نبردها", "singleReport": "گزارش نبرد", "combinedReport": "گزارش مجموعه نبردها", "europe": "اروپا", "engagement": "نبرد", "engagements": "نبرد", "reportIds": "شناسه گزارش نبردها", "archivedReports": "گزارش ثبت‌شده", "loggedEngagements": "نبرد ثبت‌شده", "archiveMotto": "یک پرچم، در هر میدان نبرد.", "detailedLog": "جزئیات گزارش نبردها",
"mainContent": "فعالیت‌های اصلی ما", "recruitmentRequirements": "شرایط پیوستن", "applicationTitle": "آماده پیوستن به ما هستید؟", "applyDiscord": "درخواست عضویت در دیسکورد", "mainContent": "فعالیت‌های اصلی ما", "recruitmentRequirements": "شرایط پیوستن", "applicationTitle": "آماده پیوستن به ما هستید؟", "applyDiscord": "درخواست عضویت در دیسکورد",
"title": "وان‌آپ — یک قدرت متحد | گیلد آلبیون آنلاین", "title": "وان‌آپ — یک قدرت متحد | گیلد آلبیون آنلاین",
File diff suppressed because it is too large. Load diff
+94
View File
@@ -0,0 +1,94 @@
# Battle archive importer
The battle archive is maintained with a repeatable importer. It scans the full
available OneUP battle history on AlbionBB Europe, with no season boundary or
calendar cutoff.
## Commands
```bash
npm run import:battles
npm run sync:battles
npm run build
```
The first command scans and imports reports; the second downloads their preview
images; the third builds the English and Persian site. Importing is an explicit
maintenance command. The deployment workflow refreshes images and builds the
saved archive without initiating a history scan.
To rebuild the archive from saved data without network access:
```bash
npm run import:battles -- --offline
```
## Configuration and selection
[Import configuration](../content/battle-import.json) contains the guild ID,
server endpoints, and listing filters. The default listing filters require
10 total participants and 5 OneUP participants, focusing on group fights.
The importer exhausts pagination rather than stopping at a particular battle
date. It fetches missing battle details, refreshes the first page of recent
reports, and reuses cached details for older reports. Cached history and every
already published battle ID are retained, including reports no longer returned
by the listing or below its participation filters.
Sessions are selected when at least 8 OneUP members participated in one
engagement and the session has either 5 OneUP kills plus deaths or 1 million
OneUP kill fame. Previously published battle IDs are preserved even below those
thresholds. Selection does not favor positive K/D.
## Combining reports
An automatic merge requires all of the following:
1. At most 20 minutes from the previous engagement's finish to the next start.
2. A combined start-to-finish duration of at most 90 minutes.
3. At least 3 shared OneUP players, covering 50% of the smaller roster.
4. At least 3 shared participant slots outside OneUP's alliance, covering 50% of
the smaller outside-team composition. Guilds in the same alliance form one
team; independent guilds retain their own identity.
5. Both the previous engagement and the session's first engagement must match,
preventing chains from gradually drifting to unrelated teams.
OneUP's allied guilds cannot create a match by themselves. Team identity uses
alliance and guild membership; it does not prove a fight's location or objective.
Ambiguous cases stay separate. Titles list the largest guilds outside OneUP's
alliance and the engagement's start time in UTC.
These short time intervals identify related fights. They do not restrict how
far back the history scan reaches. Grouping and selection rules live in
[the importer](../scripts/import-battles.mjs).
## Verification and saved data
Individual detail responses must contain OneUP's exact guild ID. Kills and deaths
come from the OneUP guild row, never the entire battle. New combined reports are
checked against AlbionBB's actual multi endpoint before publication. Previously
verified combinations are reused only when their IDs and totals still match.
Outcomes remain `recorded`: K/D alone cannot establish a confirmed winner.
- [Source data](battle-source.json) stores cached battle details, guild compositions,
OneUP rosters, preserved IDs, and verified combined totals.
- [Import audit](battle-import-audit.json) records included and excluded sessions,
selection reasons, and calculated guild statistics.
- [Published content](../content/site.json) contains the reports used by the site.
Source and audit metadata record when data was fetched for traceability; those
values do not limit imports. Battle timestamps remain part of the actual report
data for ordering and grouping. Source and audit files are not shipped with the
site. Network, grouping, or verification errors stop the import before saved
files change. Reports outside the fetched and cached history remain untouched;
a partially overlapping report stops the import for review.
## Presentation and checks
The first 12 cards are visible immediately. Remaining reports appear in a native,
keyboard-accessible disclosure in both languages. The detailed table contains
all reports. Each combined report uses its own combined scoreboard image.
`npm test` checks pagination, unrestricted history, grouping boundaries, unrelated
teams, roster continuity, duplicate IDs, source totals, preservation, and both
languages. `npm run build` also works offline with the saved content and images.
File diff suppressed because it is too large. Load diff
+8 -4
View File
@@ -40,19 +40,19 @@ Put additional local images under `public/assets/` and reference them as `assets
## Battle reports and AlbionBB preview images ## Battle reports and AlbionBB preview images
Add each battle manually to `battles` after the fight: Use `npm run import:battles` to scan the available guild history, or add a report
manually to `battles`:
```json ```json
{ {
"title": { "en": "Your battle title", "fa": "عنوان نبرد شما" }, "title": { "en": "Your battle title", "fa": "عنوان نبرد شما" },
"date": "2026-10-18",
"url": "https://europe.albionbb.com/battles/448776222" "url": "https://europe.albionbb.com/battles/448776222"
} }
``` ```
The sample title and date are illustrative. Omit the date or results when unknown. The sample title is illustrative. Omit the date or results when unknown.
Optional fields: `"date": "2026-10-18"`, `"outcome": "victory"` (also `defeat`, `draw`, or `recorded`), `"kills": 0`, and `"deaths": 0`. Enter verified guild-specific numbers. Omit unknown dates and figures; they display as dashes. Reports sort by date, newest first, with undated reports following in JSON order. Combined `/battles/multi?ids=...` links are supported and receive distinct preview cache filenames. Optional fields: `date` in `YYYY-MM-DD` format, `"outcome": "victory"` (also `defeat`, `draw`, or `recorded`), `"kills": 0`, and `"deaths": 0`. Enter verified guild-specific numbers. Omit unknown dates and figures; they display as dashes. Reports sort by date, newest first, with undated reports following in JSON order. Combined `/battles/multi?ids=...` links are supported and receive distinct preview cache filenames.
Only the report URL is needed to discover its preview; no `preview` field is required. The GitHub deployment automatically runs `npm run sync:battles`, which reads each report's `twitter:image` or `og:image`, including combined reports. If the report page cannot be read or has no image metadata, Europe reports fall back to endpoints derived from the report URL: `https://api.albionbb.com/eu/preview/BATTLE_ID` for a single battle, or `https://api.albionbb.com/eu/preview/multi?ids=ID1,ID2,...` for combined battles. An optional explicit `preview` field overrides discovery. Only the report URL is needed to discover its preview; no `preview` field is required. The GitHub deployment automatically runs `npm run sync:battles`, which reads each report's `twitter:image` or `og:image`, including combined reports. If the report page cannot be read or has no image metadata, Europe reports fall back to endpoints derived from the report URL: `https://api.albionbb.com/eu/preview/BATTLE_ID` for a single battle, or `https://api.albionbb.com/eu/preview/multi?ids=ID1,ID2,...` for combined battles. An optional explicit `preview` field overrides discovery.
@@ -60,6 +60,10 @@ PNG/JPEG/WebP images are downloaded to `public/assets/battles/` and included in
Every report renders a visual card with local decorative terrain artwork, guild branding, report IDs, and single/combined report labels. Report images display in full without cropping; missing or failed images retain the local artwork. Combined reports use the combined scoreboard image; a single engagement's image is not substituted for the combined results. The map is decorative, not a reconstruction of the battle. Archive counts use report entries and unique battle IDs from their URLs. Only supplied dates and results are shown. The full table is available in the expandable detailed log. Every report renders a visual card with local decorative terrain artwork, guild branding, report IDs, and single/combined report labels. Report images display in full without cropping; missing or failed images retain the local artwork. Combined reports use the combined scoreboard image; a single engagement's image is not substituted for the combined results. The map is decorative, not a reconstruction of the battle. Archive counts use report entries and unique battle IDs from their URLs. Only supplied dates and results are shown. The full table is available in the expandable detailed log.
For archives larger than 12 reports, the first 12 cards appear immediately and
the remainder are available through “Explore more reports.” See the
[battle importer documentation](battle-import.md) for ongoing imports and grouping.
To download previews locally, run: To download previews locally, run:
```bash ```bash
+2 -1
View File
@@ -9,6 +9,7 @@
"build": "node scripts/build.mjs", "build": "node scripts/build.mjs",
"dev": "node scripts/serve.mjs", "dev": "node scripts/serve.mjs",
"test": "node --test", "test": "node --test",
"sync:battles": "node scripts/sync-battles.mjs" "sync:battles": "node scripts/sync-battles.mjs",
"import:battles": "node scripts/import-battles.mjs"
} }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Loaded 100 of 180 files, more files were not shown because too many files have changed in this diff. Show more