RUN /app/docker-setup.sh | RUN /app/docker-setup.sh | ||||
COPY . /app | COPY . /app | ||||
EXPOSE 5000 | |||||
WORKDIR /app | WORKDIR /app | ||||
ENTRYPOINT ["uvicorn", "--proxy-headers", "app:app", "--host", "0.0.0.0", "--port", "5000"] | |||||
ENTRYPOINT ["uvicorn", "--proxy-headers", "--forwarded-allow-ips='*'", "app:app", "--uds", "/mnt/workdir/uvicorn.sock"] |
@app.post('/action/flag') | @app.post('/action/flag') | ||||
async def handle_flag(req: Request, date: str = Form(...), article: str = Form(...)): | async def handle_flag(req: Request, date: str = Form(...), article: str = Form(...)): | ||||
ipaddr = req.client.host | |||||
xff = req.headers['X-Forwarded-For'] if 'X-Forwarded-For' in req.headers else None | |||||
ipaddr = xff if xff is not None else req.client.host | |||||
try: | try: | ||||
today = datetime.now() | today = datetime.now() |