Initial Commit

This commit is contained in:
kittentm 2026-03-28 03:18:41 +01:00
commit 29564f0e0b
No known key found for this signature in database
GPG key ID: AC43DFDBC1F44A91
11 changed files with 1270 additions and 2210 deletions

4
.gitignore vendored
View file

@ -1,4 +1,6 @@
__pycache__ __pycache__
.env .env
boss.yaml boss.yaml
node_modules node_modules
build
splatnet_backend.egg-info

1
.python-version Normal file
View file

@ -0,0 +1 @@
3.11

3
MANIFEST.in Normal file
View file

@ -0,0 +1,3 @@
recursive-include judd *
recursive-include routes *.json
recursive-include services *.js

View file

@ -1,5 +1,9 @@
from pydantic_settings import BaseSettings, SettingsConfigDict from pydantic_settings import BaseSettings, SettingsConfigDict
from cryptography.fernet import Fernet from cryptography.fernet import Fernet
from pathlib import Path
import os
BASE_DIR = Path(__file__).resolve().parent
class Settings(BaseSettings): class Settings(BaseSettings):
port: int = 5000 port: int = 5000
@ -15,7 +19,15 @@ class Settings(BaseSettings):
twitter_client_secret: str twitter_client_secret: str
twitter_redirect_uri: str twitter_redirect_uri: str
model_config = SettingsConfigDict(env_file=".env", extra="ignore") model_config = SettingsConfigDict(
env_file=[
os.path.join(os.getcwd(), ".env"),
#fallback
BASE_DIR / ".env"
],
env_file_encoding='utf-8',
extra="ignore"
)
cookie_secure: bool = True cookie_secure: bool = True
webhook_url: str webhook_url: str

2176
judd/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,6 @@
"express-rate-limit": "^8.3.1", "express-rate-limit": "^8.3.1",
"express-subdomain": "^1.0.5", "express-subdomain": "^1.0.5",
"joi": "^17.7.0", "joi": "^17.7.0",
"mongoose": "^6.7.1",
"morgan": "^1.10.0", "morgan": "^1.10.0",
"multer": "^1.4.5-lts.1", "multer": "^1.4.5-lts.1",
"pg": "^8.18.0", "pg": "^8.18.0",

11
main.py
View file

@ -18,6 +18,7 @@ from routes import twitter_link
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
from datetime import datetime, timedelta from datetime import datetime, timedelta
from sqlalchemy import delete from sqlalchemy import delete
from config import BASE_DIR
import asyncio import asyncio
import subprocess import subprocess
import signal import signal
@ -25,8 +26,9 @@ import sys
import httpx import httpx
import os import os
JUDD_CMD = ["node", "server.js"] JUDD_CWD = os.path.join(BASE_DIR, "judd")
JUDD_CWD = "./judd" JUDD_SERVER_JS = os.path.join(JUDD_CWD, "server.js")
JUDD_CMD = ["node", JUDD_SERVER_JS]
judd_process = None judd_process = None
@ -163,5 +165,8 @@ app.include_router(equipment.router, prefix="/api/v1")
app.include_router(Ranking.router, prefix="/api/v1") app.include_router(Ranking.router, prefix="/api/v1")
app.include_router(twitter_link.router, prefix="/api/v1") app.include_router(twitter_link.router, prefix="/api/v1")
def start():
uvicorn.run("main:app", host="0.0.0.0", port=settings.port, reload=True)
if __name__ == '__main__': if __name__ == '__main__':
uvicorn.run("main:app", host="0.0.0.0", port=settings.port, reload=True) start()

68
pyproject.toml Normal file
View file

@ -0,0 +1,68 @@
[project]
name = "splatnet-backend"
version = "0.1.0"
description = "Backend for SplatNet"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"annotated-doc==0.0.4",
"annotated-types==0.7.0",
"anyio==4.12.1",
"argon2-cffi==25.1.0",
"argon2-cffi-bindings==25.1.0",
"certifi==2026.2.25",
"cffi==2.0.0",
"charset-normalizer==3.4.4",
"click==8.3.1",
"colorama==0.4.6",
"cryptography==46.0.5",
"fastapi==0.134.0",
"fastapi-cache2==0.2.2",
"greenlet==3.3.2",
"h11==0.16.0",
"httpcore==1.0.9",
"httpx==0.28.1",
"idna==3.11",
"oauthlib==3.3.1",
"oead==1.2.9.post4",
"pendulum==3.2.0",
"psycopg2-binary==2.9.11",
"pycparser==3.0",
"pydantic==2.12.5",
"pydantic-core==2.41.5",
"pydantic-settings==2.13.1",
"python-dateutil==2.9.0.post0",
"python-dotenv==1.2.1",
"python-multipart==0.0.22",
"pyyaml==6.0.3",
"requests==2.32.5",
"requests-oauthlib==2.0.0",
"six==1.17.0",
"sqlalchemy==2.0.47",
"starlette==0.52.1",
"tweepy==4.16.0",
"typing-extensions==4.15.0",
"typing-inspection==0.4.2",
"tzdata==2025.3",
"urllib3==2.6.3",
"uvicorn==0.41.0",
]
[tool.setuptools]
packages = { find = {} }
include-package-data = true
py-modules = ["main", "database", "config"]
[tool.setuptools.package-data]
"*" = [
".env",
".env.example",
"judd/**/*",
"services/**/*.js",
"routes/**/*.json",
"**/*.json"
]
[project.scripts]
splatnet = "main:start"

View file

@ -1,41 +0,0 @@
annotated-doc==0.0.4
annotated-types==0.7.0
anyio==4.12.1
argon2-cffi==25.1.0
argon2-cffi-bindings==25.1.0
certifi==2026.2.25
cffi==2.0.0
charset-normalizer==3.4.4
click==8.3.1
colorama==0.4.6
cryptography==46.0.5
fastapi==0.134.0
fastapi-cache2==0.2.2
greenlet==3.3.2
h11==0.16.0
httpcore==1.0.9
httpx==0.28.1
idna==3.11
oauthlib==3.3.1
oead==1.2.9.post4
pendulum==3.2.0
psycopg2-binary==2.9.11
pycparser==3.0
pydantic==2.12.5
pydantic-settings==2.13.1
pydantic_core==2.41.5
python-dateutil==2.9.0.post0
python-dotenv==1.2.1
python-multipart==0.0.22
PyYAML==6.0.3
requests==2.32.5
requests-oauthlib==2.0.0
six==1.17.0
SQLAlchemy==2.0.47
starlette==0.52.1
tweepy==4.16.0
typing-inspection==0.4.2
typing_extensions==4.15.0
tzdata==2025.3
urllib3==2.6.3
uvicorn==0.41.0

View file

@ -3,12 +3,12 @@ import requests
import oead import oead
import os import os
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from config import settings from config import settings, BASE_DIR
def process_boss_file(): def process_boss_file():
temp_boss = "bosstemp.bin" temp_boss = "bosstemp.bin"
output_yaml = "boss.yaml" output_yaml = "boss.yaml"
decrypt_script = os.path.join("services", "decrypt.js") decrypt_script = os.path.join(BASE_DIR, "services", "decrypt.js")
if not os.path.exists(decrypt_script): if not os.path.exists(decrypt_script):
print(f"{decrypt_script} is missing!") print(f"{decrypt_script} is missing!")

1059
uv.lock generated Normal file

File diff suppressed because it is too large Load diff