Skip to content

Commit e9efe7c

Browse files
committed
feat: add amazon invitation pokemon items scelled
1 parent 672b84c commit e9efe7c

217 files changed

Lines changed: 190679 additions & 9921 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-api.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Déploie l'API FastAPI (dossier api/) sur le VPS — venv + systemd + Nginx reload.
2-
# La base MariaDB peut être distante (ex. o2switch) : DATABASE_URL dans les secrets.
3-
# Sur le VPS : installe xvfb + xauth et lance Uvicorn sous xvfb-run (Chromium fenêtré si VINTED_BROWSER_HEADLESS=false).
4-
# Secret optionnel VINTED_BROWSER_HEADLESS : absent → true (historique) ; false → moins flaggé par Vinted sur Xvfb.
1+
# Deploy FastAPI (api/) to the VPS — venv + systemd + Nginx reload.
2+
# MariaDB may be remote (e.g. o2switch): DATABASE_URL in secrets.
3+
# On the VPS: install xvfb + xauth and run Uvicorn under xvfb-run (headed Chromium if VINTED_BROWSER_HEADLESS=false).
4+
# Optional secret VINTED_BROWSER_HEADLESS: missing → true (legacy); false → less likely flagged by Vinted on Xvfb.
55

66
name: Deploy API (FastAPI)
77

@@ -162,9 +162,9 @@ jobs:
162162
python -m pip install --upgrade pip wheel
163163
pip install -r "$APP_ROOT/requirements.txt" --no-cache-dir
164164
deactivate
165-
# Migrations SQL (fichiers non déjà enregistrés dans schema_migrations)
165+
# SQL migrations (files not already recorded in schema_migrations)
166166
"$APP_ROOT/.venv/bin/python" "$APP_ROOT/migrations/run_migrations.py"
167-
# Bootstrap DB si tables vides (user / marges ; articles seulement si SEED_DEV_ARTICLES=1 sur le VPS)
167+
# Bootstrap DB if empty tables (user / margins; articles only if SEED_DEV_ARTICLES=1 on the VPS)
168168
"$APP_ROOT/.venv/bin/python" "$APP_ROOT/seeders/conditional_seed.py"
169169
sudo tee "/etc/systemd/system/${SVC}" > /dev/null <<EOF
170170
[Unit]

.github/workflows/deploy-web.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Déploie le frontend Nuxt 4 (dossier web/) sur le VPS — Nitro node-server + PM2.
2-
# Secrets requis : voir README déploiement ou message de configuration du dépôt.
1+
# Deploy Nuxt 4 frontend (web/) to the VPS — Nitro node-server + PM2.
2+
# Required secrets: see deploy README or repo configuration message.
33

44
name: Deploy web (Nuxt)
55

.github/workflows/desktop-release.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
- 'web/**'
88
- 'api/desktop_vinted_server.py'
99
- 'api/desktop_vinted_server.spec'
10+
- 'api/desktop_amazon_server.py'
11+
- 'api/desktop_amazon_server.spec'
1012
- 'api/worker_bundled.env'
1113
- 'api/worker_env_bootstrap.py'
1214
- '.github/workflows/desktop-release.yml'
@@ -19,7 +21,7 @@ concurrency:
1921
jobs:
2022
build-desktop:
2123
name: Build desktop (${{ matrix.platform }})
22-
# Évite l'avertissement « actions JS sur Node 20 » (passage Node 24 côté runner GitHub).
24+
# Avoid the "JS actions on Node 20" warning (GitHub runner now on Node 24).
2325
env:
2426
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
2527
permissions:
@@ -28,9 +30,9 @@ jobs:
2830
fail-fast: false
2931
matrix:
3032
include:
31-
# Mac Intel : Tauri cross-compile depuis le runner ARM, et on installe un Python x86_64
32-
# (exécuté via Rosetta 2, préinstallée sur les runners macos-latest) pour que PyInstaller
33-
# produise un sidecar Intel natif. Évite la queue infinie sur macos-13.
33+
# macOS Intel: Tauri cross-compile from ARM runner; install x86_64 Python
34+
# (runs via Rosetta 2, preinstalled on macos-latest) so PyInstaller
35+
# builds a native Intel sidecar. Avoids the endless queue on macos-13.
3436
- platform: macos-latest
3537
args: --target x86_64-apple-darwin
3638
rust_triple: x86_64-apple-darwin
@@ -132,15 +134,34 @@ jobs:
132134
mv "dist/goupix-vinted-worker" \
133135
"../web/src-tauri/binaries/goupix-vinted-worker-${MATRIX_TRIPLE}"
134136
chmod +x "../web/src-tauri/binaries/goupix-vinted-worker-${MATRIX_TRIPLE}"
135-
# Vérifie que l'arch produite correspond bien à la cible Tauri
137+
# Verify produced arch matches the Tauri target
136138
file "../web/src-tauri/binaries/goupix-vinted-worker-${MATRIX_TRIPLE}" || true
137139
fi
138140
ls -la "../web/src-tauri/binaries/"
139141
142+
- name: Build Amazon local worker (PyInstaller)
143+
shell: bash
144+
working-directory: api
145+
env:
146+
MATRIX_TRIPLE: ${{ matrix.rust_triple }}
147+
run: |
148+
set -e
149+
pyinstaller desktop_amazon_server.spec --noconfirm --clean
150+
if [[ "$RUNNER_OS" == "Windows" ]]; then
151+
mv "dist/goupix-amazon-worker.exe" \
152+
"../web/src-tauri/binaries/goupix-amazon-worker-${MATRIX_TRIPLE}.exe"
153+
else
154+
mv "dist/goupix-amazon-worker" \
155+
"../web/src-tauri/binaries/goupix-amazon-worker-${MATRIX_TRIPLE}"
156+
chmod +x "../web/src-tauri/binaries/goupix-amazon-worker-${MATRIX_TRIPLE}"
157+
file "../web/src-tauri/binaries/goupix-amazon-worker-${MATRIX_TRIPLE}" || true
158+
fi
159+
ls -la "../web/src-tauri/binaries/"
160+
140161
- name: Install frontend dependencies
141162
run: npm ci
142163

143-
# Version unique par run CI (semver patch = run_number) pour futur updater / traçabilité des builds.
164+
# Unique version per CI run (semver patch = run_number) for future updater / build traceability.
144165
- name: Set desktop version for this release
145166
shell: bash
146167
working-directory: web

.husky/commit-msg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm --prefix web exec -- commitlint --edit "$1" --config commitlint.json
5+

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm --prefix web run lint
422 KB
Binary file not shown.

api/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ api/
1919
main.py # FastAPI app (routers + middleware)
2020
desktop_vinted_server.py # Local HTTP worker (127.0.0.1:18766) for Tauri desktop:
2121
# Vinted publish + wardrobe sync via nodriver/Chromium
22+
desktop_amazon_server.py # Local HTTP worker (127.0.0.1:18768) for Tauri desktop:
23+
# Amazon invites (stub or nodriver depending on integration)
2224
config.py # AppSettings + legacy Vinted CLI defaults
2325
cli_vinted_listings.py # Standalone nodriver CLI (legacy batch from items.json)
2426
app_types/ # TypedDict (PokéWallet, Groq, Vinted, eBay payloads)
@@ -107,6 +109,14 @@ pip install -r requirements.txt
107109

108110
Copy `.env.example` to `.env` and set at least `DATABASE_URL` and `JWT_SECRET`.
109111

112+
**Troubleshooting —** `ModuleNotFoundError: No module named 'pydantic._internal._signature'`: your environment has an **outdated Pydantic 2** (e.g. 2.5) while `pydantic-settings` expects internal modules from newer releases. Upgrade the venv:
113+
114+
```bash
115+
pip install -U -r requirements.txt
116+
```
117+
118+
(`requirements.txt` now pins **pydantic ≥ 2.10**.)
119+
110120
### Database
111121

112122
```bash
@@ -163,12 +173,14 @@ On **Windows**, if you use **`--reload`** with **Vinted** publishing (nodriver /
163173
python run_dev.py
164174
```
165175

166-
or explicitly (Windows only — stdlib `ProactorEventLoop` class):
176+
or explicitly (Windows only — with **uvicorn ≥ 0.30**, use the `asyncio` loop key, not a stdlib import string):
167177

168178
```bash
169-
uvicorn main:app --reload --host 0.0.0.0 --port 8000 --loop asyncio.windows_events:ProactorEventLoop
179+
uvicorn main:app --reload --host 0.0.0.0 --port 8000 --loop asyncio
170180
```
171181

182+
On Windows, `main.py` already calls `ensure_proactor_event_loop()`; the loop from `--loop asyncio` remains nodriver-compatible.
183+
172184
- Swagger UI: http://127.0.0.1:8000/docs
173185
- Health: `GET /health`
174186
- Article images are stored in **Supabase Storage** (public URLs in DB).
@@ -225,7 +237,7 @@ It exposes job-style endpoints used by the Nuxt frontend (`useWardrobeLocalSync`
225237
| GET | `/ebay/oauth/authorize-url` | Build the consent URL (per-user OAuth state) |
226238
| POST | `/ebay/oauth/exchange` \| `/disconnect` | Store / clear encrypted tokens on the user row |
227239
| POST | `/ebay/onboarding/setup` | Create FR inventory location + business policies |
228-
| POST | `/ebay/policies/fulfillment/ensure` | Create/update « GoupixDex — Envoi » shipping policy |
240+
| POST | `/ebay/policies/fulfillment/ensure` | Create/update GoupixDex — Shipping” fulfillment policy |
229241
| GET | `/ebay/status` \| `/ebay/seller-setup` | Connection state and metadata |
230242
| GET | `/stats/dashboard` | KPIs, revenue timeline, channel split |
231243

api/amazon_config.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"""
2+
Amazon / Chrome configuration — aligned with GoupixDex (``OsService`` + ``GOUPIX_*`` env prefixes).
3+
4+
Chromium profile and ``amazon_cookies.json`` live outside the repo under ``…/GoupixDex/``.
5+
"""
6+
from __future__ import annotations
7+
8+
import os
9+
from pathlib import Path
10+
11+
from dotenv import load_dotenv
12+
13+
_REPO_ROOT = Path(__file__).resolve().parent.parent
14+
15+
load_dotenv(_REPO_ROOT / ".env")
16+
load_dotenv()
17+
18+
from services.os_service import OsService
19+
20+
21+
def _resolved_user_data_dir() -> str:
22+
raw = os.environ.get("GOUPIX_AMAZON_USER_DATA_DIR") or os.environ.get("AMAZON_USER_DATA_DIR")
23+
if raw and str(raw).strip():
24+
return str(Path(str(raw).strip()).expanduser().resolve())
25+
return str(OsService.resolve_amazon_nodriver_user_data_dir(None))
26+
27+
28+
def _resolved_cookies_export_file() -> str:
29+
raw = os.environ.get("GOUPIX_AMAZON_COOKIES_JSON") or os.environ.get("AMAZON_COOKIES_JSON")
30+
if raw and str(raw).strip():
31+
return str(Path(str(raw).strip()).expanduser().resolve())
32+
prof = Path(_resolved_user_data_dir())
33+
return str(prof.parent / "amazon_cookies.json")
34+
35+
36+
AMAZON_BASE_URL = (
37+
os.getenv("GOUPIX_AMAZON_BASE_URL") or os.getenv("AMAZON_BASE_URL") or "https://www.amazon.fr"
38+
).rstrip("/")
39+
AMAZON_USER_DATA_DIR = _resolved_user_data_dir()
40+
AMAZON_COOKIES_EXPORT_FILE = _resolved_cookies_export_file()
41+
42+
AMAZON_CHROME_EXECUTABLE = (
43+
os.getenv("AMAZON_CHROME_EXECUTABLE")
44+
or os.getenv("CHROME_EXECUTABLE")
45+
or os.getenv("GOOGLE_CHROME_BIN")
46+
)

0 commit comments

Comments
 (0)