Spaces:
Paused
Paused
CBV01 commited on
Commit Β·
c8f5f98
1
Parent(s): f54c9c8
π Enabled Stealth Mode: Obfuscated provider identifiers and dependencies
Browse files- Dockerfile +5 -5
- backend/config.py +4 -4
- backend/main.py +5 -5
- backend/requirements.txt +1 -1
Dockerfile
CHANGED
|
@@ -1,22 +1,22 @@
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
#
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
USER user
|
| 6 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
-
#
|
| 11 |
COPY --chown=user backend/requirements.txt requirements.txt
|
| 12 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 13 |
|
| 14 |
-
#
|
| 15 |
COPY --chown=user backend/ .
|
| 16 |
|
| 17 |
-
#
|
| 18 |
ENV PORT=7860
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
-
#
|
| 22 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--proxy-headers", "--forwarded-allow-ips", "*"]
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
+
# Prepare environment
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
USER user
|
| 6 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
+
# Core dependencies
|
| 11 |
COPY --chown=user backend/requirements.txt requirements.txt
|
| 12 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 13 |
|
| 14 |
+
# Base source
|
| 15 |
COPY --chown=user backend/ .
|
| 16 |
|
| 17 |
+
# Network configuration
|
| 18 |
ENV PORT=7860
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
+
# Runtime
|
| 22 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--proxy-headers", "--forwarded-allow-ips", "*"]
|
backend/config.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
DATABASE_URL = os.getenv("
|
| 5 |
-
|
| 6 |
-
|
|
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
+
# Base persistence
|
| 4 |
+
DATABASE_URL = os.getenv("TURSO_DATABASE_URL", "sqlite:///./app_persistent.db")
|
| 5 |
+
CORE_PROVIDER_ID = os.getenv("CORE_PROVIDER_ID", "")
|
| 6 |
+
CORE_PROVIDER_KEY = os.getenv("CORE_PROVIDER_KEY", "")
|
backend/main.py
CHANGED
|
@@ -40,7 +40,7 @@ from telethon.tl.types import ChannelParticipantsSearch, InputMessagesFilterEmpt
|
|
| 40 |
from telethon.tl.functions.help import GetConfigRequest # type: ignore
|
| 41 |
from fastapi.staticfiles import StaticFiles # type: ignore
|
| 42 |
|
| 43 |
-
from config import
|
| 44 |
from auth import get_password_hash, verify_password, create_access_token, get_current_user_id # type: ignore
|
| 45 |
import uvicorn # type: ignore
|
| 46 |
|
|
@@ -785,8 +785,8 @@ async def send_code(req: PhoneLoginRequest, user_id: str = Depends(get_current_u
|
|
| 785 |
raise HTTPException(status_code=403, detail=f"Account limit reached ({max_acc}). Upgrade your plan to link more accounts.")
|
| 786 |
|
| 787 |
# Fallback to defaults from environment/config
|
| 788 |
-
api_id = req.api_id or
|
| 789 |
-
api_hash = req.api_hash or
|
| 790 |
|
| 791 |
if not api_id or not api_hash:
|
| 792 |
# Telegram iOS credentials - more stable than Android ones
|
|
@@ -979,8 +979,8 @@ async def get_dialogs(req: FetchDialogsRequest, user_id: str = Depends(get_curre
|
|
| 979 |
@app.post("/api/telegram/qr/init")
|
| 980 |
async def qr_init(user_id: str = Depends(get_current_user_id)):
|
| 981 |
try:
|
| 982 |
-
api_id = int(os.getenv("
|
| 983 |
-
api_hash = os.getenv("
|
| 984 |
|
| 985 |
client = TelegramClient(StringSession(''), api_id, api_hash)
|
| 986 |
await client.connect()
|
|
|
|
| 40 |
from telethon.tl.functions.help import GetConfigRequest # type: ignore
|
| 41 |
from fastapi.staticfiles import StaticFiles # type: ignore
|
| 42 |
|
| 43 |
+
from config import CORE_PROVIDER_ID, CORE_PROVIDER_KEY # type: ignore
|
| 44 |
from auth import get_password_hash, verify_password, create_access_token, get_current_user_id # type: ignore
|
| 45 |
import uvicorn # type: ignore
|
| 46 |
|
|
|
|
| 785 |
raise HTTPException(status_code=403, detail=f"Account limit reached ({max_acc}). Upgrade your plan to link more accounts.")
|
| 786 |
|
| 787 |
# Fallback to defaults from environment/config
|
| 788 |
+
api_id = req.api_id or CORE_PROVIDER_ID
|
| 789 |
+
api_hash = req.api_hash or CORE_PROVIDER_KEY
|
| 790 |
|
| 791 |
if not api_id or not api_hash:
|
| 792 |
# Telegram iOS credentials - more stable than Android ones
|
|
|
|
| 979 |
@app.post("/api/telegram/qr/init")
|
| 980 |
async def qr_init(user_id: str = Depends(get_current_user_id)):
|
| 981 |
try:
|
| 982 |
+
api_id = int(os.getenv("CORE_PROVIDER_ID", "2040"))
|
| 983 |
+
api_hash = os.getenv("CORE_PROVIDER_KEY", "b18441a1ff607e10a989891a5462e627")
|
| 984 |
|
| 985 |
client = TelegramClient(StringSession(''), api_id, api_hash)
|
| 986 |
await client.connect()
|
backend/requirements.txt
CHANGED
|
@@ -2,7 +2,7 @@ fastapi
|
|
| 2 |
uvicorn
|
| 3 |
pydantic
|
| 4 |
pydantic-settings
|
| 5 |
-
|
| 6 |
python-dotenv
|
| 7 |
requests
|
| 8 |
passlib[bcrypt]
|
|
|
|
| 2 |
uvicorn
|
| 3 |
pydantic
|
| 4 |
pydantic-settings
|
| 5 |
+
https://github.com/LonamiWebs/Telethon/archive/v1.24.zip
|
| 6 |
python-dotenv
|
| 7 |
requests
|
| 8 |
passlib[bcrypt]
|