osr proxy

This commit is contained in:
2026-04-04 11:28:57 -04:00
parent 5b04a6aac4
commit c31a9c01b6
2 changed files with 21 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ import warnings
import random
import math
import socketio
import httpx
from contextlib import asynccontextmanager, suppress
from typing import Optional, Dict
from dotenv import load_dotenv
@@ -19,7 +20,7 @@ with warnings.catch_warnings():
warnings.simplefilter("ignore", category=UserWarning)
import fastapi
import uvicorn
from fastapi import FastAPI, APIRouter
from fastapi import FastAPI, APIRouter, Request
from fastapi.encoders import jsonable_encoder
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
@@ -58,7 +59,8 @@ from .models import (
SimulationRequestData,
SimulationRequestResponseData,
iCloudLocationData,
LatLng
LatLng,
ORSRequest
)
from .json_formatter import JsonFormatter, handler, root_logger, logger
from .geo_cache import AsyncReverseGeocoder
@@ -1300,6 +1302,18 @@ class TunneldRunnerSio:
logger.info("Reverse Geocoded %s to %s", coords, rev_geocode)
return generate_http_response(rev_geocode)
@self._app.post("/proxy/ors/{full_path:path}")
async def app_proxy_ors(full_path: str, request: Request):
logger.info("request: %s", request)
body = await request.body()
headers = dict(request.headers)
method = request.method
url = "https://ors.intrepidnet.org/" + full_path
async with httpx.AsyncClient() as client:
response = await client.request(method, url, headers=headers, content=body)
return response.content
""" Socket.IO Functions"""
async def sio_send_status(sid):