gta6-loot-map 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -2
  3. package/Start Atlas.cmd +7 -0
  4. package/Stop Atlas.cmd +7 -0
  5. package/VERSION +1 -0
  6. package/app.py +20 -0
  7. package/bin/gta6-loot-map.mjs +71 -0
  8. package/bin/portable-python.mjs +209 -0
  9. package/bounty_watch.py +262 -0
  10. package/community_votes.py +92 -0
  11. package/discovery.py +506 -0
  12. package/docs/ACTIVITY-PINS.md +43 -0
  13. package/docs/ADVANCED.md +94 -0
  14. package/docs/API.md +63 -0
  15. package/docs/COLLECTIBLES.md +15 -0
  16. package/docs/EVIDENCE-REVIEW.md +31 -0
  17. package/docs/MAP-DATA.md +49 -0
  18. package/docs/MISSIONS.md +28 -0
  19. package/docs/MODELS.md +38 -0
  20. package/docs/NAVIGATION.md +36 -0
  21. package/docs/PLAYER.md +34 -0
  22. package/docs/PORTABLE-RUNTIME.md +11 -0
  23. package/docs/QUALITY-AND-DISCOVERY.md +38 -0
  24. package/docs/RELEASE-0.1.0.md +30 -0
  25. package/docs/RESEARCH-AND-PLAN.md +47 -0
  26. package/docs/RESOURCE-DISCOVERY.md +59 -0
  27. package/docs/VERIFICATION.md +41 -0
  28. package/docs/atlas-preview.webp +0 -0
  29. package/docs/quickstart/bounty-watch.webp +0 -0
  30. package/docs/quickstart/cover.webp +0 -0
  31. package/docs/quickstart/daily-discovery.webp +0 -0
  32. package/docs/quickstart/field-journal.webp +0 -0
  33. package/docs/quickstart/filter-and-pin.webp +0 -0
  34. package/docs/quickstart/gear.webp +0 -0
  35. package/docs/quickstart/goals.webp +0 -0
  36. package/docs/quickstart/live-sources.webp +0 -0
  37. package/docs/quickstart/mission-build.webp +0 -0
  38. package/docs/quickstart/model-setup.webp +0 -0
  39. package/docs/quickstart/npm-start.webp +0 -0
  40. package/docs/quickstart/player-manual.webp +0 -0
  41. package/docs/quickstart/reward-map.webp +0 -0
  42. package/docs/quickstart/route-planner.webp +0 -0
  43. package/docs/quickstart/stop-server.webp +0 -0
  44. package/docs/quickstart/windows-start.webp +0 -0
  45. package/docs/quickstart/world-map.webp +0 -0
  46. package/gps.py +254 -0
  47. package/launch_atlas.py +215 -0
  48. package/media_cache.py +207 -0
  49. package/mission_watch.py +126 -0
  50. package/package.json +22 -4
  51. package/providers.py +300 -0
  52. package/public/app.mjs +1462 -0
  53. package/public/atlas.css +1348 -0
  54. package/public/collectible-guides.json +306 -0
  55. package/public/community.json +1 -0
  56. package/public/dashboard.css +60 -0
  57. package/public/day-map-meta.json +50 -0
  58. package/public/directions.mjs +104 -0
  59. package/public/export-center.mjs +127 -0
  60. package/public/field-manual.mjs +183 -0
  61. package/public/fonts/BarlowCondensed-Bold.ttf +0 -0
  62. package/public/fonts/OFL.txt +93 -0
  63. package/public/game-map-meta.json +41 -0
  64. package/public/goals.css +181 -0
  65. package/public/goals.mjs +483 -0
  66. package/public/gps.mjs +185 -0
  67. package/public/guide-positions.json +852 -0
  68. package/public/guides.json +1257 -0
  69. package/public/index.html +196 -0
  70. package/public/journal.mjs +157 -0
  71. package/public/landmarks.json +1 -0
  72. package/public/manual.css +255 -0
  73. package/public/map-meta.json +31 -0
  74. package/public/map-upgrade.css +426 -0
  75. package/public/map.mjs +617 -0
  76. package/public/map.webp +0 -0
  77. package/public/mark.svg +1 -0
  78. package/public/mission-positions.json +1642 -0
  79. package/public/missions.css +49 -0
  80. package/public/missions.json +3254 -0
  81. package/public/missions.mjs +178 -0
  82. package/public/official-map-meta.json +41 -0
  83. package/public/roads.json +1 -0
  84. package/public/routing.mjs +97 -0
  85. package/public/settings.mjs +331 -0
  86. package/public/source-view.mjs +93 -0
  87. package/public/themes.css +235 -0
  88. package/public/themes.mjs +69 -0
  89. package/public/ui.mjs +170 -0
  90. package/report_verification.py +352 -0
  91. package/resource_discovery.py +467 -0
  92. package/server.py +638 -0
  93. package/tools/WindowsLauncher.ps1 +123 -0
  94. package/tools/gtadb-day-tiles.sha256 +280 -0
  95. package/tools/gtadb-tiles.sha256 +280 -0
  96. package/tools/import_gtadb.py +173 -0
  97. package/tools/install_local_maps.py +79 -0
  98. package/votes.py +66 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Ihtisham and GTA 6 Loot Map contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,129 @@
1
- # Temporary Holding Version
1
+ ![GTA 6 Loot Map cover. Two travelers trace a route across a paper map at a Leonida-inspired marina. Original fan illustration.](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/cover.webp)
2
+
3
+ # GTA 6 Loot Map
4
+
5
+ An open-source GTA VI companion by **The Ihtisham**. Pick a reward, put your character on the map, and plot a route across Leonida. Keep your mission checklist on your own computer. [@theihtishaam on GitHub](https://github.com/theihtishaam) · [Star the project](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker) · [LinkedIn](https://www.linkedin.com/in/ihtishamdeveloper/)
6
+
7
+ **176 mission entries · 88 mission start waypoints · 76 loot and activity guides · 3,663 landmarks.** The bundled map, routes and journal work offline. Leave the local server running to check public sources for new missions, rewards and bounties **every 24 hours**. When a report identifies a location, the atlas pins it automatically. [Mission coverage](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/MISSIONS.md) · [How discovery works](#4-check-for-new-finds)
8
+
9
+ ![Every 24 hours the running atlas checks public sources for missions, rewards and bounties, reviews the evidence and automatically pins supported locations. Unlocated reports stay searchable. Players can choose 6 or 12 hours instead.](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/daily-discovery.webp)
10
+
11
+ ## 1. Install and open the map
12
+
13
+ ### Quick start with npm
14
+
15
+ With **Node.js 22 or newer**, open a terminal and run this command. If npm asks to install the package on first launch, enter **y**. [Get Node.js](https://nodejs.org/en/download) · [View the npm package](https://www.npmjs.com/package/gta6-loot-map)
16
+
17
+ ```sh
18
+ npx gta6-loot-map
19
+ ```
20
+
21
+ ![npm quick start showing Node.js 22 or later, npx gta6-loot-map to open the map, and npx gta6-loot-map stop to shut it down](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/npm-start.webp)
22
+
23
+ The map opens in your browser. If it doesn’t, copy the local URL printed in the terminal. The launcher normally uses port 8765 and selects an available port if needed. Keep the server running while you play. The launcher can set up checksum-verified portable Python on supported Windows, macOS and Linux systems. [Supported platforms](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/PORTABLE-RUNTIME.md)
24
+
25
+ If you prefer to install the command once and use it again from any folder:
26
+
27
+ ```sh
28
+ npm install -g gta6-loot-map
29
+ gta6-loot-map
30
+ gta6-loot-map status
31
+ gta6-loot-map stop
32
+ ```
33
+
34
+ Use `npx gta6-loot-map status` or `npx gta6-loot-map stop` if you started with npx. To start again, run `npx gta6-loot-map` or the installed `gta6-loot-map` command. The npm launcher keeps its local data outside the installed package. See [advanced setup](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/ADVANCED.md) for Python requirements and command options.
35
+
36
+ ### Windows ZIP alternative
37
+
38
+ ![Windows ZIP setup in three steps. Extract the ZIP, double-click Start Atlas.cmd, and use Stop Atlas.cmd when finished.](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/windows-start.webp)
39
+
40
+ 1. Download the [v0.1.1 Windows ZIP](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/releases/download/v0.1.1/GTA-6-Interactive-Map-and-Loot-Tracker-v0.1.1.zip). Right-click it in File Explorer, choose **Extract All**, and open the extracted folder.
41
+ 2. Double-click **Start Atlas.cmd**. It uses installed Python 3.10 or newer or downloads a verified portable Python 3.14.10 to the app’s `.atlas` folder. The first download needs internet access. This path needs no Node.js or npm.
42
+ 3. Keep the launcher window open. Double-click **Stop Atlas.cmd** when you’re done. Starting again from the same extracted folder reopens the running map.
43
+
44
+ ![First launch of the World map with the search field, activity layers, and My position button](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/world-map.webp)
45
+
46
+ *On a small screen, select **Map index** to open search and filters.*
47
+
48
+ For either installation, you can also open **Settings**, scroll to **Local server**, and click **Stop server**. Closing the browser tab leaves scheduled checks running. After you stop, run your npm start command again or double-click **Start Atlas.cmd** in the extracted ZIP folder to resume checks.
49
+
50
+ ![The Local server settings section shows the Stop server button and tells players that closing the browser tab leaves scheduled checks running](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/stop-server.webp)
51
+
52
+ ## 2. Pick a first stop
53
+
54
+ ![Original field-guide illustration of wireless earbuds, a canvas duffel, driving gloves and fictional cash at the marina](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/gear.webp)
55
+
56
+ | Look for | Where to start | What you get or pay in-game |
57
+ | --- | --- | --- |
58
+ | Afternoon Delight | In Chapter 2, progress past **Coffee Break** and wait for Vicki’s call. Search **Afternoon Delight** for the Delights venue in Port Gellhorn. | **GTA$10,000** via BuckMe the following in-game day. [Walkthrough](https://www.powerpyx.com/gta-6-afternoon-delight-rob-vickis-boss-walkthrough/) |
59
+ | First duffel bag | Open the **Lab Fees** build and follow Jason’s objective. | Pick up the bag during the mission. [Walkthrough](https://www.powerpyx.com/gta-6-lab-fees-collect-brians-rent-walkthrough/) |
60
+ | Earbuds | Select **Earbuds** and open **Game Horde**. Choose which character will make the purchase. | Check the price in the in-game shop. Jason and Lucia have separate audio gear. [Headphone guide](https://www.gamesradar.com/games/grand-theft-auto/gta-6-headphones-music-radio-podcasts-how-to-use/) |
61
+
62
+ ![Actual atlas screenshot with the Afternoon Delight venue selected, its GTA$10,000 reward, three completion steps and the Route here button](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/reward-map.webp)
63
+
64
+ 1. In **World map**, select a category such as **Collectibles** or **Earbuds**. You can also type an item name or region in the search box.
65
+ 2. Click a result or pin. Read **How to complete** and the source before travelling. A venue pin can lead you to the right building. A map-marker pin follows the in-game marker, so use your game’s prompt to find the interaction.
66
+ 3. When you finish that location in GTA 6, select **Mark complete**. The checklist filter lets you hide completed entries.
67
+
68
+ ![A meditation search highlights the Smooth Sand pin and opens its steps, coordinates and evidence links](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/filter-and-pin.webp)
69
+
70
+ *Try the search term **meditation**. The atlas includes all ten documented sites. Jason’s House is available in Chapter 1 only.* [Meditation evidence](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/COLLECTIBLES.md)
71
+
72
+ ## Mission builds and goals
73
+
74
+ Open **Missions** and search by title, quest giver or starting area. Select the result to open its **Mission build**. Read the unlock requirements, tick objectives as you play, then mark the mission complete. **Route to start** appears when the atlas has a supported starting position. A mission that starts on a phone call can still have a complete walkthrough.
75
+
76
+ ![A mission build with objectives and evidence](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/mission-build.webp)
77
+
78
+ Open **Goals** to track one mission or set a category target, such as three collectibles. Set your chapter and character to narrow down the next stop. Open its instructions or route from your character’s position. A bounty goal stays on your list and shows its shortfall until eligible reports arrive. Your checklist, builds and goals travel together in a journal backup.
79
+
80
+ ![A real player goal for the first duffel bag with its Lab Fees instructions and route action](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/goals.webp)
81
+
82
+ ## 3. Follow a route and save your progress
83
+
84
+ ![GTA 6 Loot Map in Vice Neon showing activity markers, a player position and a traced route through Vice City](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/route-planner.webp)
85
+
86
+ 1. In the atlas, choose **My position** and click the location that matches your in-game character. If you’re already at a listed place, open it and choose **Set as my position**.
87
+ 2. Open your destination and choose **Route here**. The GPS card shows the next stop. Solid lines follow mapped road traces. A dashed line shows an estimated connection or a direct bearing when no road trace connects the points. [How directions are calculated](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/NAVIGATION.md)
88
+ 3. As you travel in the game, update your position in the atlas. Use **Route planner → Reached first stop** to advance a multistop route. The optional screenshot locator and coordinate feed are described in [advanced features](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/ADVANCED.md#optional-positioning).
89
+ 4. Open **Field journal** to review completed locations, add personal pins and back up your progress. Use **Export center** for a printable field pack or a filtered list.
90
+
91
+ ![Field journal showing a completed meditation and buttons for exporting, backup and personal pins](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/field-journal.webp)
92
+
93
+ *Use a **journal backup** to move editable progress and routes to a different browser. CSV is for reviewing or sharing a list.*
94
+
95
+ ## 4. Check for new finds
96
+
97
+ Open **Live sources → All activities** for public reports about heists, gear and rewards. Open **Bounty Watch** for bounty-specific searches. Each defaults to **Every 24 hours** and has its own **Check now** button. Choose 6, 12 or 24 hours and select **Save schedule** to change either one. Both run while the local server is open.
98
+
99
+ ![Live sources with All activities selected and the refresh schedule set to Every 24 hours](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/live-sources.webp)
100
+
101
+ *This is the first-launch view before checks finish. Open a report to check its evidence. Discoveries with uncertain locations stay in the feed without a pin.*
102
+
103
+ ![Bounty Watch with an independent 24-hour schedule, source coverage and the no qualifying reports state](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/bounty-watch.webp)
104
+
105
+ *After a check, zero qualifying reports means the checked sources produced no eligible bounty claims. Open the public directory to inspect the checked feeds or browse a community manually.* [Source discovery and coverage](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/RESOURCE-DISCOVERY.md) · [Bounty Watch API](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/API.md)
106
+
107
+ Every discovered report carries a source. **Corroborated** means independent accounts match a specific activity and location. **Needs review** hides a disputed pin and removes its linked route stop. Choose **Draft a community report** on any entry to write a correction, review it and post it yourself on GitHub. [Evidence rules](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/EVIDENCE-REVIEW.md)
108
+
109
+ ### Optional AI
110
+
111
+ Open **Settings** to connect a provider. Ollama Cloud preselects **GPT-OSS 120B** from its live catalogue. Keep it or choose another model before enabling enrichment. For free hosted inference, OpenRouter prefers the free 120B variant when listed and otherwise offers its free router. Local Ollama uses a model already on your computer. Ollama Cloud requires consent to metered use. [Model setup and cost](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/MODELS.md)
112
+
113
+ ![Optional model setup showing the empty local key field, provider selector and model catalogue](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/model-setup.webp)
114
+
115
+ ### A first-day routine
116
+
117
+ Open **Player manual** and start with **First launch**. Pick a landmark you recognize in the game, set your position, and route to one nearby activity. Check it off when you finish, back up your journal, then check **Live sources** or leave the default schedules running in the background.
118
+
119
+ ![Player manual with the opening chapter and a guided Wonder Whale collectible exercise](https://raw.githubusercontent.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/v0.1.1/docs/quickstart/player-manual.webp)
120
+
121
+ ## Sources and credits
122
+
123
+ - Community cartography by YANIS, GTADB and contributors is adapted under CC BY 4.0. The screenshots above use that bundled map. [Map data and attribution](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/MAP-DATA.md)
124
+ - The illustrated cover and gear spread are original AI-assisted fan art. The dashboard images show the running companion app.
125
+ - Guide pins link to their published evidence. An in-game map marker, a venue pin and an area report represent different levels of precision. [Guide research](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/PLAYER.md) · [Activity-pin evidence](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/ACTIVITY-PINS.md)
126
+ - This independent fan project’s code is MIT licensed. Optional locally downloaded game images remain with their rights holders. [License](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/LICENSE) · [Developer notes and tests](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker/blob/v0.1.1/docs/ADVANCED.md#development)
127
+
128
+ **Built by The Ihtisham (@theihtishaam).** [GitHub profile](https://github.com/theihtishaam) · [LinkedIn](https://www.linkedin.com/in/ihtishamdeveloper/) · [Star the project](https://github.com/theihtishaam/GTA-6-Interactive-Map-and-Loot-Tracker)
2
129
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
@@ -0,0 +1,7 @@
1
+ @echo off
2
+ setlocal
3
+ cd /d "%~dp0"
4
+ powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%~dp0tools\WindowsLauncher.ps1" -Action Start %*
5
+ set "atlas_result=%errorlevel%"
6
+ if not "%atlas_result%"=="0" pause
7
+ exit /b %atlas_result%
@@ -0,0 +1,7 @@
1
+ @echo off
2
+ setlocal
3
+ cd /d "%~dp0"
4
+ powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%~dp0tools\WindowsLauncher.ps1" -Action Stop %*
5
+ set "atlas_result=%errorlevel%"
6
+ if not "%atlas_result%"=="0" pause
7
+ exit /b %atlas_result%
package/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
package/app.py ADDED
@@ -0,0 +1,20 @@
1
+ """Start GTA 6 Loot Map. Use --stop to close it."""
2
+ import sys
3
+ from os.path import abspath, dirname
4
+
5
+
6
+ def main():
7
+ if sys.version_info < (3, 10):
8
+ print("GTA 6 Loot Map needs Python 3.10 or newer. On Windows, double-click Start Atlas.cmd for automatic setup.")
9
+ return 1
10
+
11
+ # Windows embeddable Python isolates sys.path from the script's directory.
12
+ project = dirname(abspath(__file__))
13
+ if project not in sys.path:
14
+ sys.path.insert(0, project)
15
+ from launch_atlas import main as launch
16
+ return launch()
17
+
18
+
19
+ if __name__ == "__main__":
20
+ sys.exit(main())
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from "node:child_process";
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { homedir } from "node:os";
5
+ import { dirname, join, resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const project = dirname(dirname(fileURLToPath(import.meta.url)));
9
+ const help = [
10
+ "GTA 6 Loot Map by theihtishaam",
11
+ "",
12
+ " gta6-loot-map Open the map in your browser",
13
+ " gta6-loot-map status Show this player's server address",
14
+ " gta6-loot-map stop Stop the local server",
15
+ "",
16
+ "Start options: --no-open, --bundled-only, --port NUMBER",
17
+ "You can also use Settings > Stop server or Ctrl+C.",
18
+ ].join("\n");
19
+
20
+ function playerDirectory() {
21
+ if (process.env.GTA6_LOOT_MAP_DATA) return resolve(process.env.GTA6_LOOT_MAP_DATA);
22
+ if (process.platform === "win32")
23
+ return join(process.env.LOCALAPPDATA || join(homedir(),"AppData","Local"),"GTA6LootMap");
24
+ if (process.platform === "darwin") return join(homedir(),"Library","Application Support","GTA6LootMap");
25
+ return join(process.env.XDG_DATA_HOME || join(homedir(),".local","share"),"gta6-loot-map");
26
+ }
27
+
28
+ function parse(args) {
29
+ const raw = [...args];
30
+ let action = "start";
31
+ if (["start","stop","status","--stop","--status"].includes(raw[0])) action = raw.shift().replace(/^--/,"");
32
+ const options = [];
33
+ while (raw.length) {
34
+ const word = raw.shift();
35
+ if (action === "start" && ["--no-open", "--bundled-only"].includes(word)) options.push(word);
36
+ else if (action === "start" && word === "--port" && /^\d{1,5}$/.test(raw[0]) && Number(raw[0]) <= 65535)
37
+ options.push("--port",raw.shift());
38
+ else throw Error("Unknown or invalid option: "+word+". Run gta6-loot-map --help.");
39
+ }
40
+ return {action,options};
41
+ }
42
+
43
+ async function main() {
44
+ const args = process.argv.slice(2);
45
+ if (args.includes("--help") || args[0] === "help" || args[0] === "-h") { console.log(help); return 0; }
46
+ if (args.includes("--version") || args[0] === "-v") { console.log(readFileSync(join(project,"VERSION"),"utf8").trim()); return 0; }
47
+ const {action,options} = parse(args);
48
+ const dataDir = playerDirectory();
49
+ if (action !== "start" && !existsSync(join(dataDir,"launcher.lock"))) {
50
+ console.log("GTA 6 Loot Map is already stopped.");
51
+ return 0;
52
+ }
53
+ let executable, parameters;
54
+ if (process.platform === "win32") {
55
+ executable = join(process.env.SystemRoot || "C:\\Windows","System32","WindowsPowerShell","v1.0","powershell.exe");
56
+ parameters = ["-NoLogo","-NoProfile","-ExecutionPolicy","Bypass","-File",join(project,"tools","WindowsLauncher.ps1"),"-Action",action];
57
+ for (const value of options)
58
+ parameters.push(({"--no-open":"-NoOpen","--bundled-only":"-BundledOnly","--port":"-Port"})[value] || value);
59
+ } else {
60
+ const {findUnixPython} = await import("./portable-python.mjs");
61
+ executable = await findUnixPython(dataDir);
62
+ parameters = [join(project,"app.py"), ...(action === "start" ? options : ["--"+action])];
63
+ }
64
+ const child = spawnSync(executable, parameters, {
65
+ stdio:"inherit", env:{...process.env,GTA6_LOOT_MAP_DATA:dataDir,PYTHONDONTWRITEBYTECODE:"1"},
66
+ });
67
+ if (child.error) throw child.error;
68
+ return child.status ?? (child.signal === "SIGINT" ? 0 : 1);
69
+ }
70
+ try { process.exitCode = await main(); }
71
+ catch (err) { console.error("GTA 6 Loot Map: " + err.message); process.exitCode = 1; }
@@ -0,0 +1,209 @@
1
+ import { execFile } from "node:child_process";
2
+ import { createHash } from "node:crypto";
3
+ import { createWriteStream } from "node:fs";
4
+ import { access, lstat, mkdir, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
5
+ import { join, resolve } from "node:path";
6
+ import { Readable, Transform } from "node:stream";
7
+ import { pipeline } from "node:stream/promises";
8
+ import { promisify } from "node:util";
9
+
10
+ const runFile = promisify(execFile);
11
+ const VERSION = "3.12.16";
12
+ const RELEASE = "20261110";
13
+ const ASSETS = {
14
+ "aarch64-apple-darwin": [25237581, "2f11b8aa3726bdbd87dd9eb76568412faddf4f47e26913fa45d6a2e424972acd"],
15
+ "x86_64-apple-darwin": [24957926, "b78a4c479f1964ec484880bee567568266f68da102269fb93a05fe8716b45f91"],
16
+ "aarch64-unknown-linux-gnu": [29440910, "b6a41defec4975d94b4ff1950236e7383e5c02ba40ea48c9ec33c66087a35aab"],
17
+ "x86_64-unknown-linux-gnu": [34709145, "6a9e62dad033790aef722dbd370e0ce76ce17b73627ba3ae679f537049350b39"],
18
+ "aarch64-unknown-linux-musl": [28552582, "64bb304e59d5d6ed5eaae24e95e743a2420a8897d2f6c854b1438ff9cb47e432"],
19
+ "x86_64-unknown-linux-musl": [28193015, "e32685cf248d2f33b249816120774143b4b57578cb30de5b8dba3e54963765c3"],
20
+ };
21
+ const DOWNLOAD_HOSTS = new Set([
22
+ "github.com", "release-assets.githubusercontent.com", "objects.githubusercontent.com",
23
+ ]);
24
+ const RUN_OPTIONS = { encoding: "utf8", timeout: 5000, maxBuffer: 65536, windowsHide: true };
25
+ const PROBE = [
26
+ "import sqlite3, ssl, sys",
27
+ "assert sys.version_info[:2] >= (3, 10)",
28
+ "assert sqlite3.connect(':memory:').execute('SELECT 1').fetchone() == (1,)",
29
+ "assert ssl.OPENSSL_VERSION",
30
+ ].join("\n");
31
+ const RECOVERY = "Install Python 3.10 or later with sqlite3 and ssl, then make python3 available on PATH.";
32
+ const RECEIPT = ".loot-atlas-runtime-sha256";
33
+
34
+ async function compatible(command, run) {
35
+ try {
36
+ await run(command, ["-I", "-B", "-c", PROBE], RUN_OPTIONS);
37
+ return true;
38
+ } catch {
39
+ return false;
40
+ }
41
+ }
42
+
43
+ async function commandOutput(command, args, run) {
44
+ try {
45
+ const result = await run(command, args, RUN_OPTIONS);
46
+ return [result.stdout, result.stderr].filter(Boolean).join("\n");
47
+ } catch (error) {
48
+ // musl's ldd reports its version on stderr and may return a nonzero status.
49
+ return [error.stdout, error.stderr].filter(Boolean).join("\n");
50
+ }
51
+ }
52
+
53
+ async function systemPython(platform, run) {
54
+ for (const command of ["python3", "python"]) {
55
+ if (platform === "darwin" && command === "python3") {
56
+ const path = (await commandOutput("which", [command], run)).trim();
57
+ if (path === "/usr/bin/python3" && !(await commandOutput("/usr/bin/xcode-select", ["-p"], run)).trim().startsWith("/"))
58
+ continue;
59
+ }
60
+ if (await compatible(command, run)) return command;
61
+ }
62
+ return null;
63
+ }
64
+
65
+ async function targetFor(platform, arch, run) {
66
+ const cpu = { x64: "x86_64", arm64: "aarch64" }[arch];
67
+ if (!cpu || !["darwin", "linux"].includes(platform))
68
+ throw new Error("No portable Python build is provided for " + platform + "/" + arch + ". " + RECOVERY);
69
+ if (platform === "darwin") return cpu + "-apple-darwin";
70
+
71
+ const conf = await commandOutput("getconf", ["GNU_LIBC_VERSION"], run);
72
+ const [, major, minor] = conf.match(/glibc\s+(\d+)\.(\d+)/i) || [];
73
+ if (major) {
74
+ if (Number(major) === 2 && Number(minor) < 17)
75
+ throw new Error("Portable Python requires glibc 2.17 or newer on this GNU/Linux host. " + RECOVERY);
76
+ return cpu + "-unknown-linux-gnu";
77
+ }
78
+ const ldd = await commandOutput("ldd", ["--version"], run);
79
+ if (/\bmusl\b/i.test(ldd)) return cpu + "-unknown-linux-musl";
80
+ const [, oldMajor, oldMinor] = ldd.match(/(?:glibc|GNU libc|GNU C Library)[^\n]*?\b(\d+)\.(\d+)\b/i) || [];
81
+ if (oldMajor) {
82
+ if (Number(oldMajor) === 2 && Number(oldMinor) < 17)
83
+ throw new Error("Portable Python requires glibc 2.17 or newer on this GNU/Linux host. " + RECOVERY);
84
+ return cpu + "-unknown-linux-gnu";
85
+ }
86
+ try {
87
+ await access("/lib/ld-musl-" + cpu + ".so.1");
88
+ return cpu + "-unknown-linux-musl";
89
+ } catch {
90
+ throw new Error("The Linux C library could not be identified as glibc or musl. " + RECOVERY);
91
+ }
92
+ }
93
+
94
+ async function downloadArchive(target, destination, fetcher) {
95
+ const [expectedBytes, expectedHash] = ASSETS[target];
96
+ const archive = "cpython-" + VERSION + "+" + RELEASE + "-" + target + "-install_only_stripped.tar.gz";
97
+ let url = new URL("https://github.com/astral-sh/python-build-standalone/releases/download/" +
98
+ RELEASE + "/" + archive);
99
+ const signal = AbortSignal.timeout(90000);
100
+ for (let hop = 0; hop < 5; hop++) {
101
+ if (url.protocol !== "https:" || url.port || url.username || url.password || !DOWNLOAD_HOSTS.has(url.hostname))
102
+ throw new Error("Portable Python download was redirected outside approved GitHub release hosts.");
103
+ const response = await fetcher(url, {
104
+ signal, redirect: "manual", headers: { "Accept-Encoding": "identity", "User-Agent": "GTA6-Loot-Map" },
105
+ });
106
+ if ([301, 302, 303, 307, 308].includes(response.status)) {
107
+ await response.body?.cancel();
108
+ const location = response.headers.get("location");
109
+ if (!location) throw new Error("GitHub did not supply a release-asset destination.");
110
+ url = new URL(location, url);
111
+ continue;
112
+ }
113
+ if (response.status !== 200 || !response.body) {
114
+ await response.body?.cancel();
115
+ throw new Error("GitHub returned HTTP " + response.status + " for the pinned Python archive.");
116
+ }
117
+ const contentLength = response.headers.get("content-length");
118
+ if (contentLength !== null && Number(contentLength) !== expectedBytes) {
119
+ await response.body.cancel();
120
+ throw new Error("Portable Python download did not have the expected size.");
121
+ }
122
+ let bytes = 0;
123
+ const sha = createHash("sha256");
124
+ const meter = new Transform({
125
+ transform(chunk, encoding, done) {
126
+ bytes += chunk.length;
127
+ if (bytes > expectedBytes) {
128
+ done(new Error("Portable Python download exceeded the expected size."));
129
+ return;
130
+ }
131
+ sha.update(chunk);
132
+ done(null, chunk);
133
+ },
134
+ });
135
+ await pipeline(Readable.fromWeb(response.body), meter,
136
+ createWriteStream(destination, { flags: "wx", mode: 0o600 }), { signal });
137
+ if (bytes !== expectedBytes || sha.digest("hex") !== expectedHash)
138
+ throw new Error("Portable Python archive failed SHA-256 verification.");
139
+ return;
140
+ }
141
+ throw new Error("GitHub returned too many release-asset redirects.");
142
+ }
143
+
144
+ const interpreter = (directory) => join(directory, "bin", "python3");
145
+
146
+ async function usableInstall(directory, hash, run) {
147
+ try {
148
+ if (!(await lstat(directory)).isDirectory()) return false;
149
+ const path = join(directory, RECEIPT);
150
+ const receipt = await lstat(path);
151
+ if (!receipt.isFile() || receipt.size !== 65 || (await readFile(path, "utf8")) !== hash + "\n") return false;
152
+ return compatible(interpreter(directory), run);
153
+ } catch {
154
+ return false;
155
+ }
156
+ }
157
+
158
+ export async function findUnixPython(dataDir, {
159
+ platform = process.platform, arch = process.arch, run = runFile, fetcher = fetch,
160
+ notify = (message) => process.stderr.write(message + "\n"),
161
+ } = {}) {
162
+ const system = await systemPython(platform, run);
163
+ if (system) return system;
164
+
165
+ const target = await targetFor(platform, arch, run);
166
+ const [bytes, hash] = ASSETS[target];
167
+ const root = join(resolve(dataDir), "runtime");
168
+ const name = "python-" + VERSION + "-" + RELEASE + "-" + target;
169
+ const installs = [join(root, name), join(root, name + "-recovery")];
170
+ for (const directory of installs) {
171
+ if (await usableInstall(directory, hash, run)) return interpreter(directory);
172
+ }
173
+
174
+ await mkdir(root, { recursive: true, mode: 0o700 });
175
+ const staging = await mkdtemp(join(root, ".python-stage-"));
176
+ try {
177
+ const archive = join(staging, "runtime.tar.gz");
178
+ notify("Downloading verified Python " + VERSION + " (" + Math.ceil(bytes / 1_000_000) + " MB) for " + target + ".");
179
+ await downloadArchive(target, archive, fetcher);
180
+ try {
181
+ await run("tar", ["-xzf", archive, "-C", staging, "--no-same-owner"], {
182
+ ...RUN_OPTIONS, timeout: 60000,
183
+ env: { PATH: process.env.PATH, LANG: "C", LC_ALL: "C" },
184
+ });
185
+ } catch {
186
+ throw new Error("Could not unpack the verified archive. The system tar command must support gzip.");
187
+ }
188
+ const unpacked = join(staging, "python");
189
+ if (!(await compatible(interpreter(unpacked), run)))
190
+ throw new Error("The downloaded interpreter cannot run with sqlite3 and ssl on this host.");
191
+ await writeFile(join(unpacked, RECEIPT), hash + "\n", { flag: "wx", mode: 0o600 });
192
+
193
+ // Concurrent processes may unpack separately. Only complete, verified trees enter the cache.
194
+ for (const directory of installs) {
195
+ try {
196
+ await rename(unpacked, directory);
197
+ return interpreter(directory);
198
+ } catch (error) {
199
+ if (await usableInstall(directory, hash, run)) return interpreter(directory);
200
+ if (!["EEXIST", "ENOTEMPTY"].includes(error.code)) throw error;
201
+ }
202
+ }
203
+ throw new Error("The managed runtime folders already exist but could not be used.");
204
+ } catch (error) {
205
+ throw new Error("Portable Python setup failed. " + error.message + " " + RECOVERY, { cause: error });
206
+ } finally {
207
+ await rm(staging, { recursive: true, force: true }).catch(() => {});
208
+ }
209
+ }