Skip to content

Latest commit

 

History

History
95 lines (68 loc) · 2.52 KB

prices.md

File metadata and controls

95 lines (68 loc) · 2.52 KB

Fuel Prices

Reverse-engineered fuel-price submission used by the public frontend.

Users can report current fuel prices per station. Prices are entered per fuel grade, validated client-side against a configured range, then submitted via POST /api/price.


Submit prices

POST /api/price
Content-Type: application/json

Payload

{
  "osm_id": "268902927",
  "fp": "<fingerprint>",
  "prices": { "92": 55.9, "95": 60.4, "ДТ": 62.0 },
  "vt": "<vote token>",
  "cvt": "<cvt token>"
}
Field Condition Meaning
osm_id always Station OSM id
fp always Visitor fingerprint (Zt())
prices always Map of fuel grade → price (RUB/L)
vt always Vote token (window.__VT)
cvt window._cvt.osm === osm_id Comment/onsite token

Client-side validation (hb / gb / yb)

Input for a grade is accepted only if:

value >= cfg.prices.min && value <= cfg.prices.max   // default 40..250
  • Comma or dot decimals allowed ("55,9" → 55.9).
  • yb() returns the accepted prices map rounded to 2 decimals, or null if none valid.
  • gb() returns the list of grades that were filled but rejected (empty null/"" values are skipped).

Fuel grades iterated (sn) include 92, 95, 98, 100, ДТ.


Responses

Status Meaning Client handling
200 Accepted (possibly partial) May include price_rejected[]
403 Not allowed "Цена принимается только на открытой карточке"
409 No recent vote "Сначала отметьте эту заправку" / нужна отметка за последние 12 часов

On partial rejection the response includes:

{
  "price_rejected": [
    { "g": "95", "lo": 45, "hi": 65 }
  ]
}

g = grade, lo/hi = allowed range. Client builds messages like АИ-95 — от 45 до 65 ₽ and keeps the accepted grades for resubmission.


Local storage

Own reported prices are cached under localStorage["gas_myprice"]:

{
  "268902927": { "prices": { "92": 55.9 }, "g": ["92"], "t": 1699999999, "edited": 1 }
}
Field Meaning
prices Accepted prices map
g Grades list
t Timestamp (Dx(0))
edited 1 if manually edited

Notes

All information was obtained from the publicly distributed JavaScript bundle. No server-side source code or private implementation details are included.