fix(tandoor): implement smart image upload with auth fix

- Fix authentication header from 'Bearer' to 'Token' (DRF TokenAuth)
- Implement three-strategy upload system:
  1. URL pass-through for direct URLs (most efficient)
  2. Base64 data URL conversion for screenshots
  3. Fallback blob upload for any other format
- Add comprehensive error handling with response details
- Add detailed logging for debugging upload strategies
- Document thumbnail formats in extractThumbnailStealth()

Fixes #30 - Tandoor image upload 400 Bad Request error

Based on Tandoor source code analysis (cookbook/views/api.py):
- RecipeImageSerializer accepts 'image_url' field for server-side download
- Uses Token authentication, not Bearer
- Supports multipart file upload with proper MIME types
This commit is contained in:
Giancarmine Salucci
2025-12-21 04:58:45 +01:00
parent 281c82e76a
commit d1dc791854
4 changed files with 879 additions and 23 deletions

View File

@@ -5,7 +5,7 @@
"value": "SDRORLyWEsWWty2ZoVGdER",
"domain": ".instagram.com",
"path": "/",
"expires": 1800848369.155388,
"expires": 1800849269.656302,
"httpOnly": false,
"secure": true,
"sameSite": "Lax"
@@ -45,7 +45,7 @@
"value": "59661903731",
"domain": ".instagram.com",
"path": "/",
"expires": 1774064369.155498,
"expires": 1774065269.656394,
"httpOnly": false,
"secure": true,
"sameSite": "None"
@@ -55,7 +55,7 @@
"value": "1280x720",
"domain": ".instagram.com",
"path": "/",
"expires": 1766893170,
"expires": 1766894070,
"httpOnly": false,
"secure": true,
"sameSite": "Lax"
@@ -72,7 +72,7 @@
},
{
"name": "rur",
"value": "\"CLN\\05459661903731\\0541797824369:01fe8c862f2dd54b808a334f6088f2bf4dad9b4c8965f2abd3762be986fe5c03e8e410df\"",
"value": "\"CLN\\05459661903731\\0541797825269:01fe6904bc7d85ccbfea5233062783089ac963caf6202742eb0b112bd5ab4f6ef965e2f4\"",
"domain": ".instagram.com",
"path": "/",
"expires": -1,
@@ -87,7 +87,7 @@
"localStorage": [
{
"name": "chatd-deviceid",
"value": "712a4dc5-cc51-4b0c-a373-611ef9b65c23"
"value": "11f6cbef-22a3-4c0b-9558-7a83fd40e521"
},
{
"name": "hb_timestamp",
@@ -95,7 +95,7 @@
},
{
"name": "IGSession",
"value": "6m2tlb:1766290170601"
"value": "6m2tlb:1766291070793"
},
{
"name": "pixel_fire_ts",
@@ -107,7 +107,7 @@
},
{
"name": "Session",
"value": "wayu8j:1766288405601"
"value": "0f4qnx:1766289305793"
},
{
"name": "has_interop_upgraded",