CBV01 commited on
Commit
c8f5f98
Β·
1 Parent(s): f54c9c8

πŸš€ Enabled Stealth Mode: Obfuscated provider identifiers and dependencies

Browse files
Dockerfile CHANGED
@@ -1,22 +1,22 @@
1
  FROM python:3.9-slim
2
 
3
- # Create a non-root user
4
  RUN useradd -m -u 1000 user
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
  WORKDIR /app
9
 
10
- # Copy only the backend requirements first for caching
11
  COPY --chown=user backend/requirements.txt requirements.txt
12
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
- # Copy the entire backend folder content to the container root /app
15
  COPY --chown=user backend/ .
16
 
17
- # Hugging Face requires port 7860
18
  ENV PORT=7860
19
  EXPOSE 7860
20
 
21
- # Run the app.
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
- # SQLite path or LibSQL (Turso) connection string
4
- DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///./telegram_app.db")
5
- TELEGRAM_API_ID = os.getenv("TELEGRAM_API_ID", "")
6
- TELEGRAM_API_HASH = os.getenv("TELEGRAM_API_HASH", "")
 
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 TELEGRAM_API_ID, TELEGRAM_API_HASH # 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,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 TELEGRAM_API_ID
789
- api_hash = req.api_hash or TELEGRAM_API_HASH
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("TELEGRAM_API_ID", "2040"))
983
- api_hash = os.getenv("TELEGRAM_API_HASH", "b18441a1ff607e10a989891a5462e627")
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
- telethon
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]