Spaces:
Runtime error
Runtime error
Commit Β·
99fdb5f
0
Parent(s):
Deploy clean FastAPI backend without node_modules
Browse filesThis view is limited to 50 files because it contains too many changes. Β See raw diff
- .env +14 -0
- .gitignore +41 -0
- .main.py.swo +0 -0
- Dockerfile +35 -0
- // +6 -0
- __pycache__/celery_app.cpython-312.pyc +0 -0
- __pycache__/main.cpython-312.pyc +0 -0
- __pycache__/main.cpython-39.pyc +0 -0
- admin/auth.py +8 -0
- admin/models.py +11 -0
- admin/resources.py +16 -0
- admin/setup.py +29 -0
- alembic.ini +116 -0
- alembic/README +1 -0
- alembic/__pycache__/env.cpython-310.pyc +0 -0
- alembic/__pycache__/env.cpython-312.pyc +0 -0
- alembic/env.py +78 -0
- alembic/script.py.mako +26 -0
- app.py +5 -0
- celery.txt +10 -0
- celery_app.py +16 -0
- cleanup.py +48 -0
- config.json +16 -0
- core/admin.py +345 -0
- core/config.py +31 -0
- core/database.py +32 -0
- core/dependencies.py +20 -0
- core/models.py +188 -0
- create_table.py +5 -0
- create_tables.py +5 -0
- dependencies/__init__.py +0 -0
- dependencies/__pycache__/__init__.cpython-312.pyc +0 -0
- dependencies/__pycache__/__init__.cpython-39.pyc +0 -0
- dependencies/__pycache__/api_auth.cpython-312.pyc +0 -0
- dependencies/__pycache__/auth.cpython-312.pyc +0 -0
- dependencies/__pycache__/auth.cpython-39.pyc +0 -0
- dependencies/api_auth.py +34 -0
- dependencies/auth.py +31 -0
- e8604869-ecdd-420e-926d-bd6afc04f3fe_map.shtml +3 -0
- fastapi +11 -0
- filespath.sh +4 -0
- img.txt +1 -0
- install.sh +323 -0
- install1.sh +323 -0
- lib.sh +15 -0
- logs.sh +3 -0
- main.py +133 -0
- models/__pycache__/stats_model.cpython-312.pyc +0 -0
- models/__pycache__/stats_model.cpython-39.pyc +0 -0
- models/admin_user.py +13 -0
.env
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SECRET_KEY=12345
|
| 2 |
+
DATABASE_URL=postgresql+psycopg2://gpr3:gpr3.admin@localhost:5432/gpr3db
|
| 3 |
+
BASE_URL=https://www.cloudaipdf.com
|
| 4 |
+
|
| 5 |
+
ADMIN_SECRET=superadmin123
|
| 6 |
+
# .env file
|
| 7 |
+
|
| 8 |
+
# REPLACE 1234567 with your actual GAM Network Code
|
| 9 |
+
GAM_NETWORK_CODE=1234567
|
| 10 |
+
# A default site URL for GAM compliance (use your main website)
|
| 11 |
+
DEFAULT_SITE_URL=http://www.yourapp.com
|
| 12 |
+
ADMIN_USER=admin
|
| 13 |
+
ADMIN_PASS=1234
|
| 14 |
+
|
.gitignore
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.pyc
|
| 4 |
+
*.pyo
|
| 5 |
+
*.pyd
|
| 6 |
+
.env
|
| 7 |
+
venv/
|
| 8 |
+
|
| 9 |
+
# Node
|
| 10 |
+
node_modules/
|
| 11 |
+
|
| 12 |
+
# Logs & temp
|
| 13 |
+
logs/
|
| 14 |
+
temp/
|
| 15 |
+
output/
|
| 16 |
+
outputs/
|
| 17 |
+
compressed_files/
|
| 18 |
+
uploads/
|
| 19 |
+
|
| 20 |
+
# ML / AI models
|
| 21 |
+
*.onnx
|
| 22 |
+
*.pt
|
| 23 |
+
*.pth
|
| 24 |
+
*.bin
|
| 25 |
+
|
| 26 |
+
# Test & junk files
|
| 27 |
+
test.*
|
| 28 |
+
*.pdf
|
| 29 |
+
*.png
|
| 30 |
+
*.jpg
|
| 31 |
+
|
| 32 |
+
# OS / editor
|
| 33 |
+
.DS_Store
|
| 34 |
+
.idea/
|
| 35 |
+
.vscode/
|
| 36 |
+
|
| 37 |
+
# Accidental files
|
| 38 |
+
\
|
| 39 |
+
udo apt install -y ffmpeg
|
| 40 |
+
|
| 41 |
+
node_modules/
|
.main.py.swo
ADDED
|
Binary file (77.8 kB). View file
|
|
|
Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
# Prevent Python buffering & writing bytecode
|
| 4 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 5 |
+
ENV PYTHONUNBUFFERED=1
|
| 6 |
+
|
| 7 |
+
WORKDIR /app
|
| 8 |
+
|
| 9 |
+
# 1. Install all Linux tools needed by your converters
|
| 10 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
+
ffmpeg \
|
| 12 |
+
libreoffice \
|
| 13 |
+
pandoc \
|
| 14 |
+
potrace \
|
| 15 |
+
imagemagick \
|
| 16 |
+
p7zip-full \
|
| 17 |
+
unzip \
|
| 18 |
+
libcairo2 \
|
| 19 |
+
libheif-dev \
|
| 20 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
+
|
| 22 |
+
# 2. Copy requirements & install Python dependencies
|
| 23 |
+
COPY requirements.txt .
|
| 24 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 25 |
+
|
| 26 |
+
# 3. Copy project files
|
| 27 |
+
COPY . .
|
| 28 |
+
|
| 29 |
+
# 4. Create working folders with full permissions
|
| 30 |
+
RUN mkdir -p static/output tmp temp && chmod -R 777 static tmp temp
|
| 31 |
+
|
| 32 |
+
# 5. Port 7860 for Hugging Face Spaces
|
| 33 |
+
EXPOSE 7860
|
| 34 |
+
|
| 35 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
//
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from core.database import engine, Base
|
| 2 |
+
from core.models import rating
|
| 3 |
+
|
| 4 |
+
Base.metadata.create_all(bind=engine)
|
| 5 |
+
print("β
Tables created")
|
| 6 |
+
|
__pycache__/celery_app.cpython-312.pyc
ADDED
|
Binary file (530 Bytes). View file
|
|
|
__pycache__/main.cpython-312.pyc
ADDED
|
Binary file (4.53 kB). View file
|
|
|
__pycache__/main.cpython-39.pyc
ADDED
|
Binary file (1.6 kB). View file
|
|
|
admin/auth.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# admin/auth.py
|
| 2 |
+
from fastapi_admin.providers.login import UsernamePasswordProvider
|
| 3 |
+
|
| 4 |
+
auth_provider = UsernamePasswordProvider(
|
| 5 |
+
login_logo_url="",
|
| 6 |
+
admin_model="admin.models.AdminUser",
|
| 7 |
+
)
|
| 8 |
+
|
admin/models.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# admin/models.py
|
| 2 |
+
from sqlmodel import SQLModel, Field
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
|
| 5 |
+
class AdminUser(SQLModel, table=True):
|
| 6 |
+
id: int = Field(default=None, primary_key=True)
|
| 7 |
+
username: str = Field(index=True, unique=True)
|
| 8 |
+
password_hash: str
|
| 9 |
+
is_active: bool = True
|
| 10 |
+
created_at: datetime = Field(default_factory=datetime.utcnow)
|
| 11 |
+
|
admin/resources.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# admin/resources.py
|
| 2 |
+
from fastapi_admin.resources import Model
|
| 3 |
+
from fastapi_admin.widgets import inputs, displays
|
| 4 |
+
from admin.models import AdminUser
|
| 5 |
+
|
| 6 |
+
class AdminUserResource(Model):
|
| 7 |
+
model = AdminUser
|
| 8 |
+
icon = "fa-solid fa-user"
|
| 9 |
+
label = "Admin Users"
|
| 10 |
+
fields = [
|
| 11 |
+
"id",
|
| 12 |
+
"username",
|
| 13 |
+
"is_active",
|
| 14 |
+
"created_at",
|
| 15 |
+
]
|
| 16 |
+
|
admin/setup.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# admin/setup.py
|
| 2 |
+
import aioredis
|
| 3 |
+
from fastapi import FastAPI
|
| 4 |
+
from fastapi_admin.app import app as admin_app
|
| 5 |
+
from fastapi_admin.providers.login import UsernamePasswordProvider
|
| 6 |
+
from fastapi_admin.template import templates
|
| 7 |
+
from fastapi_admin.resources import Resource
|
| 8 |
+
from admin.resources import AdminUserResource
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
async def setup_fastapi_admin(app: FastAPI):
|
| 12 |
+
redis = await aioredis.create_redis_pool("redis://localhost")
|
| 13 |
+
|
| 14 |
+
admin_app.init(
|
| 15 |
+
app=app,
|
| 16 |
+
redis=redis,
|
| 17 |
+
providers=[
|
| 18 |
+
UsernamePasswordProvider(
|
| 19 |
+
admin_model="admin.models.AdminUser",
|
| 20 |
+
)
|
| 21 |
+
],
|
| 22 |
+
resources=[
|
| 23 |
+
AdminUserResource,
|
| 24 |
+
],
|
| 25 |
+
template_folders=["templates"],
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
app.mount("/admin", admin_app)
|
| 29 |
+
|
alembic.ini
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A generic, single database configuration.
|
| 2 |
+
|
| 3 |
+
[alembic]
|
| 4 |
+
# path to migration scripts
|
| 5 |
+
script_location = alembic
|
| 6 |
+
|
| 7 |
+
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
|
| 8 |
+
# Uncomment the line below if you want the files to be prepended with date and time
|
| 9 |
+
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
|
| 10 |
+
# for all available tokens
|
| 11 |
+
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
|
| 12 |
+
|
| 13 |
+
# sys.path path, will be prepended to sys.path if present.
|
| 14 |
+
# defaults to the current working directory.
|
| 15 |
+
prepend_sys_path = .
|
| 16 |
+
|
| 17 |
+
# timezone to use when rendering the date within the migration file
|
| 18 |
+
# as well as the filename.
|
| 19 |
+
# If specified, requires the python>=3.9 or backports.zoneinfo library.
|
| 20 |
+
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
|
| 21 |
+
# string value is passed to ZoneInfo()
|
| 22 |
+
# leave blank for localtime
|
| 23 |
+
# timezone =
|
| 24 |
+
|
| 25 |
+
# max length of characters to apply to the
|
| 26 |
+
# "slug" field
|
| 27 |
+
# truncate_slug_length = 40
|
| 28 |
+
|
| 29 |
+
# set to 'true' to run the environment during
|
| 30 |
+
# the 'revision' command, regardless of autogenerate
|
| 31 |
+
# revision_environment = false
|
| 32 |
+
|
| 33 |
+
# set to 'true' to allow .pyc and .pyo files without
|
| 34 |
+
# a source .py file to be detected as revisions in the
|
| 35 |
+
# versions/ directory
|
| 36 |
+
# sourceless = false
|
| 37 |
+
|
| 38 |
+
# version location specification; This defaults
|
| 39 |
+
# to alembic/versions. When using multiple version
|
| 40 |
+
# directories, initial revisions must be specified with --version-path.
|
| 41 |
+
# The path separator used here should be the separator specified by "version_path_separator" below.
|
| 42 |
+
# version_locations = %(here)s/bar:%(here)s/bat:alembic/versions
|
| 43 |
+
|
| 44 |
+
# version path separator; As mentioned above, this is the character used to split
|
| 45 |
+
# version_locations. The default within new alembic.ini files is "os", which uses os.pathsep.
|
| 46 |
+
# If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas.
|
| 47 |
+
# Valid values for version_path_separator are:
|
| 48 |
+
#
|
| 49 |
+
# version_path_separator = :
|
| 50 |
+
# version_path_separator = ;
|
| 51 |
+
# version_path_separator = space
|
| 52 |
+
version_path_separator = os # Use os.pathsep. Default configuration used for new projects.
|
| 53 |
+
|
| 54 |
+
# set to 'true' to search source files recursively
|
| 55 |
+
# in each "version_locations" directory
|
| 56 |
+
# new in Alembic version 1.10
|
| 57 |
+
# recursive_version_locations = false
|
| 58 |
+
|
| 59 |
+
# the output encoding used when revision files
|
| 60 |
+
# are written from script.py.mako
|
| 61 |
+
# output_encoding = utf-8
|
| 62 |
+
|
| 63 |
+
sqlalchemy.url = postgresql://gpr3:gpr3.admin@localhost/gpr3db
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
[post_write_hooks]
|
| 67 |
+
# post_write_hooks defines scripts or Python functions that are run
|
| 68 |
+
# on newly generated revision scripts. See the documentation for further
|
| 69 |
+
# detail and examples
|
| 70 |
+
|
| 71 |
+
# format using "black" - use the console_scripts runner, against the "black" entrypoint
|
| 72 |
+
# hooks = black
|
| 73 |
+
# black.type = console_scripts
|
| 74 |
+
# black.entrypoint = black
|
| 75 |
+
# black.options = -l 79 REVISION_SCRIPT_FILENAME
|
| 76 |
+
|
| 77 |
+
# lint with attempts to fix using "ruff" - use the exec runner, execute a binary
|
| 78 |
+
# hooks = ruff
|
| 79 |
+
# ruff.type = exec
|
| 80 |
+
# ruff.executable = %(here)s/.venv/bin/ruff
|
| 81 |
+
# ruff.options = --fix REVISION_SCRIPT_FILENAME
|
| 82 |
+
|
| 83 |
+
# Logging configuration
|
| 84 |
+
[loggers]
|
| 85 |
+
keys = root,sqlalchemy,alembic
|
| 86 |
+
|
| 87 |
+
[handlers]
|
| 88 |
+
keys = console
|
| 89 |
+
|
| 90 |
+
[formatters]
|
| 91 |
+
keys = generic
|
| 92 |
+
|
| 93 |
+
[logger_root]
|
| 94 |
+
level = WARN
|
| 95 |
+
handlers = console
|
| 96 |
+
qualname =
|
| 97 |
+
|
| 98 |
+
[logger_sqlalchemy]
|
| 99 |
+
level = WARN
|
| 100 |
+
handlers =
|
| 101 |
+
qualname = sqlalchemy.engine
|
| 102 |
+
|
| 103 |
+
[logger_alembic]
|
| 104 |
+
level = INFO
|
| 105 |
+
handlers =
|
| 106 |
+
qualname = alembic
|
| 107 |
+
|
| 108 |
+
[handler_console]
|
| 109 |
+
class = StreamHandler
|
| 110 |
+
args = (sys.stderr,)
|
| 111 |
+
level = NOTSET
|
| 112 |
+
formatter = generic
|
| 113 |
+
|
| 114 |
+
[formatter_generic]
|
| 115 |
+
format = %(levelname)-5.5s [%(name)s] %(message)s
|
| 116 |
+
datefmt = %H:%M:%S
|
alembic/README
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Generic single-database configuration.
|
alembic/__pycache__/env.cpython-310.pyc
ADDED
|
Binary file (1.73 kB). View file
|
|
|
alembic/__pycache__/env.cpython-312.pyc
ADDED
|
Binary file (2.52 kB). View file
|
|
|
alembic/env.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from logging.config import fileConfig
|
| 2 |
+
|
| 3 |
+
from sqlalchemy import engine_from_config
|
| 4 |
+
from sqlalchemy import pool
|
| 5 |
+
|
| 6 |
+
from alembic import context
|
| 7 |
+
|
| 8 |
+
# this is the Alembic Config object, which provides
|
| 9 |
+
# access to the values within the .ini file in use.
|
| 10 |
+
config = context.config
|
| 11 |
+
|
| 12 |
+
# Interpret the config file for Python logging.
|
| 13 |
+
# This line sets up loggers basically.
|
| 14 |
+
if config.config_file_name is not None:
|
| 15 |
+
fileConfig(config.config_file_name)
|
| 16 |
+
|
| 17 |
+
# add your model's MetaData object here
|
| 18 |
+
# for 'autogenerate' support
|
| 19 |
+
# from myapp import mymodel
|
| 20 |
+
# target_metadata = mymodel.Base.metadata
|
| 21 |
+
target_metadata = None
|
| 22 |
+
|
| 23 |
+
# other values from the config, defined by the needs of env.py,
|
| 24 |
+
# can be acquired:
|
| 25 |
+
# my_important_option = config.get_main_option("my_important_option")
|
| 26 |
+
# ... etc.
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def run_migrations_offline() -> None:
|
| 30 |
+
"""Run migrations in 'offline' mode.
|
| 31 |
+
|
| 32 |
+
This configures the context with just a URL
|
| 33 |
+
and not an Engine, though an Engine is acceptable
|
| 34 |
+
here as well. By skipping the Engine creation
|
| 35 |
+
we don't even need a DBAPI to be available.
|
| 36 |
+
|
| 37 |
+
Calls to context.execute() here emit the given string to the
|
| 38 |
+
script output.
|
| 39 |
+
|
| 40 |
+
"""
|
| 41 |
+
url = config.get_main_option("sqlalchemy.url")
|
| 42 |
+
context.configure(
|
| 43 |
+
url=url,
|
| 44 |
+
target_metadata=target_metadata,
|
| 45 |
+
literal_binds=True,
|
| 46 |
+
dialect_opts={"paramstyle": "named"},
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
with context.begin_transaction():
|
| 50 |
+
context.run_migrations()
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def run_migrations_online() -> None:
|
| 54 |
+
"""Run migrations in 'online' mode.
|
| 55 |
+
|
| 56 |
+
In this scenario we need to create an Engine
|
| 57 |
+
and associate a connection with the context.
|
| 58 |
+
|
| 59 |
+
"""
|
| 60 |
+
connectable = engine_from_config(
|
| 61 |
+
config.get_section(config.config_ini_section, {}),
|
| 62 |
+
prefix="sqlalchemy.",
|
| 63 |
+
poolclass=pool.NullPool,
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
with connectable.connect() as connection:
|
| 67 |
+
context.configure(
|
| 68 |
+
connection=connection, target_metadata=target_metadata
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
with context.begin_transaction():
|
| 72 |
+
context.run_migrations()
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
if context.is_offline_mode():
|
| 76 |
+
run_migrations_offline()
|
| 77 |
+
else:
|
| 78 |
+
run_migrations_online()
|
alembic/script.py.mako
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""${message}
|
| 2 |
+
|
| 3 |
+
Revision ID: ${up_revision}
|
| 4 |
+
Revises: ${down_revision | comma,n}
|
| 5 |
+
Create Date: ${create_date}
|
| 6 |
+
|
| 7 |
+
"""
|
| 8 |
+
from typing import Sequence, Union
|
| 9 |
+
|
| 10 |
+
from alembic import op
|
| 11 |
+
import sqlalchemy as sa
|
| 12 |
+
${imports if imports else ""}
|
| 13 |
+
|
| 14 |
+
# revision identifiers, used by Alembic.
|
| 15 |
+
revision: str = ${repr(up_revision)}
|
| 16 |
+
down_revision: Union[str, None] = ${repr(down_revision)}
|
| 17 |
+
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
|
| 18 |
+
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def upgrade() -> None:
|
| 22 |
+
${upgrades if upgrades else "pass"}
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def downgrade() -> None:
|
| 26 |
+
${downgrades if downgrades else "pass"}
|
app.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import uvicorn
|
| 2 |
+
from main import app
|
| 3 |
+
|
| 4 |
+
if __name__ == "__main__":
|
| 5 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
celery.txt
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
redis-server
|
| 2 |
+
celery -A celery_app.celery_app worker -c 4 --loglevel=info
|
| 3 |
+
gunicorn main:app -k uvicorn.workers.UvicornWorker -w 4 --timeout 0
|
| 4 |
+
redis-cli ping
|
| 5 |
+
celery -A celery_app.celery_app worker -c 4 --loglevel=info
|
| 6 |
+
gunicorn main:app \
|
| 7 |
+
-k uvicorn.workers.UvicornWorker \
|
| 8 |
+
-w 4 \
|
| 9 |
+
--timeout 0
|
| 10 |
+
|
celery_app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from celery import Celery
|
| 2 |
+
|
| 3 |
+
celery_app = Celery(
|
| 4 |
+
"converter",
|
| 5 |
+
broker="redis://localhost:6379/0",
|
| 6 |
+
backend="redis://localhost:6379/1"
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
celery_app.conf.update(
|
| 10 |
+
task_serializer="json",
|
| 11 |
+
accept_content=["json"],
|
| 12 |
+
result_serializer="json",
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
# π FORCE IMPORT
|
| 16 |
+
import workers.converter_worker
|
cleanup.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import time
|
| 3 |
+
from datetime import datetime, timedelta
|
| 4 |
+
from core.config import settings
|
| 5 |
+
|
| 6 |
+
OUTPUT_DIR = settings.OUTPUT_DIR
|
| 7 |
+
TEMP_DIR = settings.TEMP_DIR
|
| 8 |
+
TTL_HOURS = 6 # delete files older than 6 hours (change if needed)
|
| 9 |
+
|
| 10 |
+
def auto_cleanup():
|
| 11 |
+
now = datetime.utcnow()
|
| 12 |
+
cutoff = now - timedelta(hours=TTL_HOURS)
|
| 13 |
+
|
| 14 |
+
removed = []
|
| 15 |
+
|
| 16 |
+
for folder in [OUTPUT_DIR, TEMP_DIR]:
|
| 17 |
+
if not os.path.exists(folder):
|
| 18 |
+
continue
|
| 19 |
+
|
| 20 |
+
for filename in os.listdir(folder):
|
| 21 |
+
file_path = os.path.join(folder, filename)
|
| 22 |
+
|
| 23 |
+
try:
|
| 24 |
+
# modification time
|
| 25 |
+
mtime = datetime.utcfromtimestamp(os.path.getmtime(file_path))
|
| 26 |
+
|
| 27 |
+
if mtime < cutoff:
|
| 28 |
+
if os.path.isdir(file_path):
|
| 29 |
+
import shutil
|
| 30 |
+
shutil.rmtree(file_path, ignore_errors=True)
|
| 31 |
+
removed.append(file_path)
|
| 32 |
+
else:
|
| 33 |
+
os.remove(file_path)
|
| 34 |
+
removed.append(file_path)
|
| 35 |
+
except Exception:
|
| 36 |
+
continue
|
| 37 |
+
|
| 38 |
+
if removed:
|
| 39 |
+
print(f"[CLEANUP] Removed {len(removed)} old files:")
|
| 40 |
+
for path in removed:
|
| 41 |
+
print(" -", path)
|
| 42 |
+
else:
|
| 43 |
+
print("[CLEANUP] No old files found.")
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
if __name__ == "__main__":
|
| 47 |
+
auto_cleanup()
|
| 48 |
+
|
config.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cat > config.json << 'EOF'
|
| 2 |
+
[
|
| 3 |
+
{
|
| 4 |
+
"page": 0,
|
| 5 |
+
"type": "text",
|
| 6 |
+
"text": "TEST WATERMARK",
|
| 7 |
+
"fontSize": 48,
|
| 8 |
+
"color": "#999999",
|
| 9 |
+
"opacity": 0.5,
|
| 10 |
+
"rotation": -45,
|
| 11 |
+
"x": 300,
|
| 12 |
+
"y": 400
|
| 13 |
+
}
|
| 14 |
+
]
|
| 15 |
+
EOF
|
| 16 |
+
|
core/admin.py
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
from markupsafe import Markup
|
| 10 |
+
|
| 11 |
+
# Import WTForms fields
|
| 12 |
+
from wtforms import FileField, SelectMultipleField, StringField, TextAreaField, SelectField
|
| 13 |
+
|
| 14 |
+
from sqladmin import Admin, ModelView
|
| 15 |
+
from sqladmin.authentication import AuthenticationBackend
|
| 16 |
+
|
| 17 |
+
# Import your application-specific components
|
| 18 |
+
from core.database import engine
|
| 19 |
+
from core.config import settings
|
| 20 |
+
from core.models import (
|
| 21 |
+
UsageStat, AdUnit, AdPlacement, AdStat, AdGlobalSettings, Rating,
|
| 22 |
+
)
|
| 23 |
+
from core.models import ToolRatingAggregate
|
| 24 |
+
# ==============================================================
|
| 25 |
+
# ποΈ CONFIGURATION & UTILITIES
|
| 26 |
+
# ==============================================================
|
| 27 |
+
|
| 28 |
+
UPLOAD_DIR = "static/uploads"
|
| 29 |
+
os.makedirs(UPLOAD_DIR, exist_ok=True)
|
| 30 |
+
|
| 31 |
+
async def save_ad_file(upload: UploadFile) -> str:
|
| 32 |
+
"""Saves the UploadFile asynchronously using a unique name and returns the public file path."""
|
| 33 |
+
|
| 34 |
+
# 1. Generate a unique and safe filename
|
| 35 |
+
file_extension = upload.filename.split(".")[-1] if "." in upload.filename else "file"
|
| 36 |
+
unique_filename = f"{uuid.uuid4().hex}.{file_extension}"
|
| 37 |
+
save_path_full = os.path.join(UPLOAD_DIR, unique_filename)
|
| 38 |
+
|
| 39 |
+
# 2. Asynchronously read content
|
| 40 |
+
content = await upload.read()
|
| 41 |
+
|
| 42 |
+
# 3. Use anyio to safely run the blocking file write operation on a thread pool
|
| 43 |
+
def write_file_sync():
|
| 44 |
+
with open(save_path_full, "wb") as f:
|
| 45 |
+
f.write(content)
|
| 46 |
+
|
| 47 |
+
await anyio.to_thread.run_sync(write_file_sync)
|
| 48 |
+
|
| 49 |
+
# 4. Return the web-accessible path
|
| 50 |
+
return f"/{save_path_full}"
|
| 51 |
+
|
| 52 |
+
def detect_file_type(filename: str) -> str:
|
| 53 |
+
"""Utility to determine file category based on extension."""
|
| 54 |
+
ext = filename.lower().split(".")[-1]
|
| 55 |
+
if ext in ["jpg", "jpeg", "png", "gif", "webp"]:
|
| 56 |
+
return "image"
|
| 57 |
+
if ext in ["mp4", "mov", "mkv", "avi"]:
|
| 58 |
+
return "video"
|
| 59 |
+
if ext in ["mp3", "wav", "ogg"]:
|
| 60 |
+
return "audio"
|
| 61 |
+
return "unknown"
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
# ==============================================================
|
| 65 |
+
# π AUTHENTICATION BACKEND
|
| 66 |
+
# ==============================================================
|
| 67 |
+
class AdminAuth(AuthenticationBackend):
|
| 68 |
+
async def login(self, request: Request) -> bool:
|
| 69 |
+
form = await request.form()
|
| 70 |
+
username = form.get("username")
|
| 71 |
+
password = form.get("password")
|
| 72 |
+
|
| 73 |
+
if username == settings.ADMIN_USER and password == settings.ADMIN_PASS:
|
| 74 |
+
request.session["authenticated"] = True
|
| 75 |
+
return True
|
| 76 |
+
return False
|
| 77 |
+
|
| 78 |
+
async def logout(self, request: Request) -> bool:
|
| 79 |
+
request.session.clear()
|
| 80 |
+
return True
|
| 81 |
+
|
| 82 |
+
async def authenticate(self, request: Request) -> bool:
|
| 83 |
+
return request.session.get("authenticated") is True
|
| 84 |
+
|
| 85 |
+
# ---
|
| 86 |
+
|
| 87 |
+
# ==============================================================
|
| 88 |
+
# π MODEL VIEWS - STATS & GLOBAL SETTINGS
|
| 89 |
+
# ==============================================================
|
| 90 |
+
|
| 91 |
+
class UsageStatAdmin(ModelView, model=UsageStat):
|
| 92 |
+
column_list = [
|
| 93 |
+
"id", "tool_name", "usage_count", "last_used_at",
|
| 94 |
+
"open_count", "process_count", "download_count",
|
| 95 |
+
]
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
# ==============================================================
|
| 99 |
+
# β USER RATINGS ADMIN
|
| 100 |
+
# ==============================================================
|
| 101 |
+
|
| 102 |
+
class RatingAdmin(ModelView, model=Rating):
|
| 103 |
+
name = "Rating"
|
| 104 |
+
name_plural = "Ratings"
|
| 105 |
+
icon = "fa-solid fa-star"
|
| 106 |
+
|
| 107 |
+
column_list = [
|
| 108 |
+
"id",
|
| 109 |
+
"tool",
|
| 110 |
+
"rating",
|
| 111 |
+
"created_at",
|
| 112 |
+
]
|
| 113 |
+
|
| 114 |
+
column_searchable_list = ["tool"]
|
| 115 |
+
column_sortable_list = ["created_at", "rating"]
|
| 116 |
+
|
| 117 |
+
class ToolRatingAggregateAdmin(ModelView, model=ToolRatingAggregate):
|
| 118 |
+
name = "Rating Aggregate"
|
| 119 |
+
name_plural = "Rating Aggregates"
|
| 120 |
+
icon = "fa-solid fa-chart-simple"
|
| 121 |
+
|
| 122 |
+
column_list = [
|
| 123 |
+
"tool",
|
| 124 |
+
"average_rating",
|
| 125 |
+
"rating_count",
|
| 126 |
+
"updated_at",
|
| 127 |
+
]
|
| 128 |
+
|
| 129 |
+
column_sortable_list = [
|
| 130 |
+
"average_rating",
|
| 131 |
+
"rating_count",
|
| 132 |
+
"updated_at",
|
| 133 |
+
]
|
| 134 |
+
|
| 135 |
+
can_create = False
|
| 136 |
+
can_edit = False
|
| 137 |
+
can_delete = False
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
class AdGlobalSettingsAdmin(ModelView, model=AdGlobalSettings):
|
| 142 |
+
column_list = [
|
| 143 |
+
"id",
|
| 144 |
+
"all_ads_enabled", "banners_enabled", "popups_enabled",
|
| 145 |
+
"predownload_enabled", "sidebar_enabled", "mobile_enabled",
|
| 146 |
+
"audio_enabled", "rotation_enabled", "updated_at",
|
| 147 |
+
]
|
| 148 |
+
|
| 149 |
+
# ---
|
| 150 |
+
|
| 151 |
+
# ==============================================================
|
| 152 |
+
# π― AD UNIT ADMIN (Final Logic for File Upload)
|
| 153 |
+
# ==============================================================
|
| 154 |
+
|
| 155 |
+
# ==============================================================
|
| 156 |
+
# π― AD UNIT ADMIN (Final Logic for File Upload)
|
| 157 |
+
# ==============================================================
|
| 158 |
+
|
| 159 |
+
class AdUnitAdmin(ModelView, model=AdUnit):
|
| 160 |
+
name = "Ad Unit"
|
| 161 |
+
name_plural = "Ad Units"
|
| 162 |
+
icon = "fa-solid fa-ad"
|
| 163 |
+
delete_redirect_url = "/admin/ad-unit/list" # <-- π₯ ADD THIS LINE
|
| 164 |
+
column_list = [
|
| 165 |
+
"id", "name", "placement", "ad_type",
|
| 166 |
+
"file_path", "priority", "enabled", "created_at", "vast_url",
|
| 167 |
+
]
|
| 168 |
+
|
| 169 |
+
column_formatters = {
|
| 170 |
+
"file_path": lambda obj, _: (
|
| 171 |
+
Markup(f"<img src='{obj.file_path}' width='120'>") if getattr(obj, "file_type", None) == "image"
|
| 172 |
+
else Markup(f"<video src='{obj.file_path}' width='160' controls></video>") if getattr(obj, "file_type", None) == "video"
|
| 173 |
+
else Markup(f"<audio src='{obj.file_path}' controls></audio>") if getattr(obj, "file_type", None) == "audio"
|
| 174 |
+
else "-"
|
| 175 |
+
)
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
# ... (Keep form_columns, form_overrides, form_args as they are) ...
|
| 179 |
+
form_columns = [
|
| 180 |
+
"name",
|
| 181 |
+
"placement",
|
| 182 |
+
"ad_type",
|
| 183 |
+
"file_path",
|
| 184 |
+
"preset_size",
|
| 185 |
+
"custom_width",
|
| 186 |
+
"custom_height",
|
| 187 |
+
"priority",
|
| 188 |
+
"enabled",
|
| 189 |
+
"target_devices",
|
| 190 |
+
"target_categories",
|
| 191 |
+
"target_countries",
|
| 192 |
+
"vast_url",
|
| 193 |
+
"html_code",
|
| 194 |
+
"duration_seconds",
|
| 195 |
+
"skippable_after",
|
| 196 |
+
]
|
| 197 |
+
|
| 198 |
+
form_overrides = {
|
| 199 |
+
"file_path": FileField,
|
| 200 |
+
"target_devices": SelectMultipleField, "target_categories": SelectMultipleField,
|
| 201 |
+
"target_countries": SelectMultipleField, "placement": SelectField,
|
| 202 |
+
"ad_type": SelectField, "preset_size": SelectField,
|
| 203 |
+
"html_code": TextAreaField, "vast_url": StringField,
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
form_args = {
|
| 207 |
+
"target_devices": {
|
| 208 |
+
"choices": [("all", "All Devices"), ("mobile", "Mobile"), ("desktop", "Desktop"),
|
| 209 |
+
("tablet", "Tablet")],
|
| 210 |
+
},
|
| 211 |
+
"target_categories": {
|
| 212 |
+
"choices": [("all", "All Categories"), ("finance", "Finance"), ("photo", "Photo"),
|
| 213 |
+
("pdf", "PDF Tools"), ("developer", "Developer Tools"), ("games", "Games"),
|
| 214 |
+
("education", "Education"), ("shopping", "Shopping"),
|
| 215 |
+
("entertainment", "Entertainment"), ("fitness", "Fitness"), ("news", "News")],
|
| 216 |
+
},
|
| 217 |
+
"target_countries": {
|
| 218 |
+
"choices": [("all", "All Countries"), ("US", "United States"), ("IN", "India"),
|
| 219 |
+
("UK", "United Kingdom"), ("AE", "UAE"), ("CA", "Canada")],
|
| 220 |
+
},
|
| 221 |
+
"placement": {
|
| 222 |
+
"choices": [("landing_top", "Landing Top"), ("landing_bottom", "Landing Bottom"),
|
| 223 |
+
("tools_top", "Tools Top"), ("tools_bottom", "Tools Bottom"),
|
| 224 |
+
("tool_popup", "Tool Popup"), ("predownload_video", "Pre-download Video"),
|
| 225 |
+
("download_page_banner", "Download Page Banner")],
|
| 226 |
+
},
|
| 227 |
+
"ad_type": {
|
| 228 |
+
"choices": [("image_banner", "Image Banner"), ("video_ad", "Video Ad"),
|
| 229 |
+
("audio_ad", "Audio Ad"), ("popup", "Popup Ad"),
|
| 230 |
+
("vast_url", "VAST URL"), ("html_snippet", "Custom HTML Snippet")],
|
| 231 |
+
},
|
| 232 |
+
"preset_size": {
|
| 233 |
+
"choices": [
|
| 234 |
+
("none", "Custom Size"),
|
| 235 |
+
|
| 236 |
+
("300x250", "300 Γ 250 (Medium Rectangle)"),
|
| 237 |
+
("336x280", "336 Γ 280 (Large Rectangle)"),
|
| 238 |
+
("728x90", "728 Γ 90 (Leaderboard)"),
|
| 239 |
+
("970x90", "970 Γ 90 (Large Leaderboard)"),
|
| 240 |
+
("970x250", "970 Γ 250 (Billboard)"),
|
| 241 |
+
("468x60", "468 Γ 60 (Banner)"),
|
| 242 |
+
("234x60", "234 Γ 60 (Half Banner)"),
|
| 243 |
+
|
| 244 |
+
("320x50", "320 Γ 50 (Mobile Banner)"),
|
| 245 |
+
("320x100", "320 Γ 100 (Large Mobile Banner)"),
|
| 246 |
+
|
| 247 |
+
("250x250", "250 Γ 250 (Square)"),
|
| 248 |
+
("200x200", "200 Γ 200 (Small Square)"),
|
| 249 |
+
("180x150", "180 Γ 150 (Small Rectangle)"),
|
| 250 |
+
|
| 251 |
+
("120x600", "120 Γ 600 (Skyscraper)"),
|
| 252 |
+
("160x600", "160 Γ 600 (Wide Skyscraper)"),
|
| 253 |
+
("300x600", "300 Γ 600 (Half Page)"),
|
| 254 |
+
],
|
| 255 |
+
},
|
| 256 |
+
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
# ===========================
|
| 260 |
+
# π― CORRECTED LOGIC: on_model_change (The Final Edit Fix)
|
| 261 |
+
# ===========================
|
| 262 |
+
async def on_model_change(self, data: dict, model: AdUnit, is_created: bool, request: Request):
|
| 263 |
+
"""
|
| 264 |
+
Handles file uploads and multi-select fields safely before database commit.
|
| 265 |
+
This hook fixes the AttributeError when editing without changing the file.
|
| 266 |
+
"""
|
| 267 |
+
|
| 268 |
+
upload_value = data.get("file_path")
|
| 269 |
+
|
| 270 |
+
if isinstance(upload_value, UploadFile) and upload_value.filename:
|
| 271 |
+
# Case 1: NEW file uploaded and it is not empty.
|
| 272 |
+
try:
|
| 273 |
+
# Save the new file using your existing function
|
| 274 |
+
data["file_path"] = await save_ad_file(upload_value)
|
| 275 |
+
data["file_type"] = detect_file_type(upload_value.filename)
|
| 276 |
+
except Exception:
|
| 277 |
+
# Fallback on failure (retain existing path on update, clear on create)
|
| 278 |
+
data["file_path"] = model.file_path if not is_created else None
|
| 279 |
+
data["file_type"] = model.file_type if not is_created else None
|
| 280 |
+
|
| 281 |
+
elif not is_created:
|
| 282 |
+
# Case 2: EDIT operation and NO new file was provided.
|
| 283 |
+
# This is the essential fix: explicitly retain the existing file path/type
|
| 284 |
+
# if the form element was present but no new file was attached.
|
| 285 |
+
data["file_path"] = model.file_path
|
| 286 |
+
data["file_type"] = model.file_type
|
| 287 |
+
|
| 288 |
+
else:
|
| 289 |
+
# Case 3: Create operation with no file, or explicitly removed file.
|
| 290 |
+
data["file_path"] = None
|
| 291 |
+
data["file_type"] = None
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
# 2. MULTI-SELECT FIELDS HANDLING (Required for your setup)
|
| 295 |
+
# Ensure list of choices is converted to a CSV string.
|
| 296 |
+
data["target_devices"] = ",".join(data.get("target_devices") or [])
|
| 297 |
+
data["target_categories"] = ",".join(data.get("target_categories") or [])
|
| 298 |
+
data["target_countries"] = ",".join(data.get("target_countries") or [])
|
| 299 |
+
|
| 300 |
+
# Call the parent method
|
| 301 |
+
# Note: The original logic for insert_model and update_model is now gone,
|
| 302 |
+
# and all necessary pre-save modifications are in this single hook.
|
| 303 |
+
# super().on_model_change() is technically not needed here unless the parent
|
| 304 |
+
# class has custom logic you need to run, but keeping it is harmless.
|
| 305 |
+
|
| 306 |
+
# ---
|
| 307 |
+
|
| 308 |
+
# ==============================================================
|
| 309 |
+
# π― AD PLACEMENT & STATS
|
| 310 |
+
# ==============================================================
|
| 311 |
+
|
| 312 |
+
class AdPlacementAdmin(ModelView, model=AdPlacement):
|
| 313 |
+
column_list = [
|
| 314 |
+
"id", "ad_unit_id", "placement", "priority", "enabled",
|
| 315 |
+
"custom_width", "custom_height", "created_at", "updated_at",
|
| 316 |
+
]
|
| 317 |
+
form_columns = ["ad_unit_id", "placement", "priority", "enabled", "custom_width", "custom_height"]
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
class AdStatAdmin(ModelView, model=AdStat):
|
| 321 |
+
column_list = [
|
| 322 |
+
"id", "ad_unit_id", "placement", "impressions", "clicks",
|
| 323 |
+
"last_served_at", "updated_at",
|
| 324 |
+
]
|
| 325 |
+
|
| 326 |
+
# ---
|
| 327 |
+
|
| 328 |
+
# ==============================================================
|
| 329 |
+
# π SETUP FUNCTION
|
| 330 |
+
# ==============================================================
|
| 331 |
+
|
| 332 |
+
def setup_admin(app):
|
| 333 |
+
"""Initializes and configures the SQLAdmin panel."""
|
| 334 |
+
admin = Admin(
|
| 335 |
+
app=app,
|
| 336 |
+
engine=engine,
|
| 337 |
+
authentication_backend=AdminAuth(secret_key=settings.SECRET_KEY),
|
| 338 |
+
)
|
| 339 |
+
admin.add_view(UsageStatAdmin)
|
| 340 |
+
admin.add_view(AdUnitAdmin)
|
| 341 |
+
admin.add_view(AdPlacementAdmin)
|
| 342 |
+
admin.add_view(AdStatAdmin)
|
| 343 |
+
admin.add_view(AdGlobalSettingsAdmin)
|
| 344 |
+
admin.add_view(RatingAdmin) # β ADD THIS
|
| 345 |
+
admin.add_view(ToolRatingAggregateAdmin)
|
core/config.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
| 2 |
+
from functools import lru_cache
|
| 3 |
+
|
| 4 |
+
class Settings(BaseSettings):
|
| 5 |
+
DATABASE_URL: str
|
| 6 |
+
ADMIN_SECRET: str
|
| 7 |
+
SECRET_KEY: str
|
| 8 |
+
|
| 9 |
+
# π REQUIRED: Admin login credentials (FastAPI Admin)
|
| 10 |
+
ADMIN_USER: str
|
| 11 |
+
ADMIN_PASS: str
|
| 12 |
+
|
| 13 |
+
# π Ad Manager settings
|
| 14 |
+
GAM_NETWORK_CODE: str
|
| 15 |
+
DEFAULT_SITE_URL: str
|
| 16 |
+
|
| 17 |
+
# Optional directory paths
|
| 18 |
+
TEMP_DIR: str = "./temp"
|
| 19 |
+
OUTPUT_DIR: str = "./output"
|
| 20 |
+
UPLOAD_DIR: str = "./uploads"
|
| 21 |
+
# Pydantic v2 config
|
| 22 |
+
model_config = SettingsConfigDict(
|
| 23 |
+
env_file=".env",
|
| 24 |
+
env_file_encoding="utf-8",
|
| 25 |
+
extra="ignore" # ignore unused environment variables
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
settings = Settings()
|
| 29 |
+
@lru_cache()
|
| 30 |
+
def get_settings():
|
| 31 |
+
return settings
|
core/database.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# core/database.py
|
| 2 |
+
from sqlalchemy import create_engine
|
| 3 |
+
from sqlalchemy.orm import sessionmaker, declarative_base
|
| 4 |
+
from sqlalchemy.pool import StaticPool
|
| 5 |
+
|
| 6 |
+
# SQLAlchemy Base
|
| 7 |
+
Base = declarative_base()
|
| 8 |
+
|
| 9 |
+
# π 100% in RAM using SQLite (Zero external DB, 100% Free)
|
| 10 |
+
# StaticPool ensures all FastAPI threads share the same in-memory database
|
| 11 |
+
engine = create_engine(
|
| 12 |
+
"sqlite:///:memory:",
|
| 13 |
+
connect_args={"check_same_thread": False},
|
| 14 |
+
poolclass=StaticPool,
|
| 15 |
+
future=True,
|
| 16 |
+
echo=False
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
# Session factory
|
| 20 |
+
SessionLocal = sessionmaker(
|
| 21 |
+
bind=engine,
|
| 22 |
+
autoflush=False,
|
| 23 |
+
autocommit=False
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
# Dependency for routes (kept identical so nothing breaks)
|
| 27 |
+
def get_db():
|
| 28 |
+
db = SessionLocal()
|
| 29 |
+
try:
|
| 30 |
+
yield db
|
| 31 |
+
finally:
|
| 32 |
+
db.close()
|
core/dependencies.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# core/dependencies.py
|
| 2 |
+
|
| 3 |
+
from fastapi import Depends
|
| 4 |
+
from sqlalchemy.orm import Session
|
| 5 |
+
from services.stats_service import increment_tool_usage
|
| 6 |
+
from core.database import get_db
|
| 7 |
+
|
| 8 |
+
def LogToolUsage(tool_name: str, event_type: str = "open"):
|
| 9 |
+
"""
|
| 10 |
+
Logs tool usage automatically when added as a dependency.
|
| 11 |
+
|
| 12 |
+
tool_name β name of the tool: "audio_compress", "pdf_split", etc.
|
| 13 |
+
event_type β "open", "process", or "download"
|
| 14 |
+
"""
|
| 15 |
+
def log_and_pass(db: Session = Depends(get_db)):
|
| 16 |
+
increment_tool_usage(db, tool_name, event_type)
|
| 17 |
+
return None
|
| 18 |
+
|
| 19 |
+
return log_and_pass
|
| 20 |
+
|
core/models.py
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# core/models.py
|
| 2 |
+
from sqlalchemy import Column, Integer, String, DateTime, Text, Boolean, ForeignKey, func
|
| 3 |
+
from sqlalchemy.orm import relationship
|
| 4 |
+
from sqlalchemy.sql import expression
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
from core.database import Base
|
| 7 |
+
from sqlalchemy import Float
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# -----------------------
|
| 11 |
+
# AdUnit
|
| 12 |
+
# -----------------------
|
| 13 |
+
class AdUnit(Base):
|
| 14 |
+
__tablename__ = "ad_units"
|
| 15 |
+
|
| 16 |
+
id = Column(Integer, primary_key=True)
|
| 17 |
+
name = Column(String(255), unique=False, nullable=False)
|
| 18 |
+
placement = Column(String(80), index=True, nullable=True) # canonical placement string
|
| 19 |
+
ad_type = Column(String(50), nullable=False) # image_banner, video_ad, audio_ad, vast_url, html_snippet, popup
|
| 20 |
+
preset_size = Column(String(32), nullable=True)
|
| 21 |
+
custom_width = Column(Integer, nullable=True)
|
| 22 |
+
custom_height = Column(Integer, nullable=True)
|
| 23 |
+
file_type = Column(String(32), nullable=True) # image/video/audio/unknown
|
| 24 |
+
file_path = Column(String(1024), nullable=True)
|
| 25 |
+
vast_url = Column(String(1024), nullable=True)
|
| 26 |
+
html_code = Column(Text, nullable=True)
|
| 27 |
+
click_url = Column(String(1024), nullable=True)
|
| 28 |
+
priority = Column(Integer, default=0)
|
| 29 |
+
duration_seconds = Column(Integer, nullable=True)
|
| 30 |
+
skippable_after = Column(Integer, nullable=True)
|
| 31 |
+
enabled = Column(Boolean, server_default=expression.true(), default=True)
|
| 32 |
+
created_at = Column(DateTime, default=datetime.utcnow)
|
| 33 |
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
| 34 |
+
|
| 35 |
+
# CSV targeting fields
|
| 36 |
+
target_devices = Column(Text, nullable=True)
|
| 37 |
+
target_categories = Column(Text, nullable=True)
|
| 38 |
+
target_countries = Column(Text, nullable=True)
|
| 39 |
+
|
| 40 |
+
# relationships
|
| 41 |
+
# FIX: Added cascade for placement editing/deletion
|
| 42 |
+
placements = relationship(
|
| 43 |
+
"AdPlacement",
|
| 44 |
+
back_populates="ad_unit",
|
| 45 |
+
cascade="all, delete-orphan",
|
| 46 |
+
single_parent=True
|
| 47 |
+
)
|
| 48 |
+
# FIX: Added cascade for stats deletion (Resolves 500 Error)
|
| 49 |
+
stats = relationship(
|
| 50 |
+
"AdStat",
|
| 51 |
+
back_populates="ad_unit",
|
| 52 |
+
cascade="all, delete-orphan",
|
| 53 |
+
passive_deletes=True
|
| 54 |
+
)
|
| 55 |
+
# FIX: Added cascade for impressions deletion
|
| 56 |
+
impressions = relationship(
|
| 57 |
+
"AdImpression",
|
| 58 |
+
back_populates="ad_unit",
|
| 59 |
+
cascade="all, delete-orphan",
|
| 60 |
+
passive_deletes=True
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
# -----------------------
|
| 65 |
+
# AdPlacement
|
| 66 |
+
# -----------------------
|
| 67 |
+
class AdPlacement(Base):
|
| 68 |
+
__tablename__ = "ad_placements"
|
| 69 |
+
|
| 70 |
+
id = Column(Integer, primary_key=True)
|
| 71 |
+
ad_unit_id = Column(
|
| 72 |
+
Integer,
|
| 73 |
+
ForeignKey("ad_units.id", ondelete="CASCADE"),
|
| 74 |
+
nullable=False
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
placement = Column(String(80), index=True, nullable=False)
|
| 78 |
+
priority = Column(Integer, default=0)
|
| 79 |
+
enabled = Column(Boolean, server_default=expression.true(), default=True)
|
| 80 |
+
custom_width = Column(Integer, nullable=True)
|
| 81 |
+
custom_height = Column(Integer, nullable=True)
|
| 82 |
+
created_at = Column(DateTime, default=datetime.utcnow)
|
| 83 |
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
| 84 |
+
|
| 85 |
+
ad_unit = relationship("AdUnit", back_populates="placements")
|
| 86 |
+
|
| 87 |
+
# -----------------------
|
| 88 |
+
# Tool Ratings (Public)
|
| 89 |
+
# -----------------------
|
| 90 |
+
class Rating(Base):
|
| 91 |
+
__tablename__ = "tool_ratings"
|
| 92 |
+
|
| 93 |
+
id = Column(Integer, primary_key=True, index=True)
|
| 94 |
+
tool = Column(String(100), index=True, nullable=False)
|
| 95 |
+
rating = Column(Integer, nullable=False) # 1β5
|
| 96 |
+
created_at = Column(DateTime, server_default=func.now())
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
# -----------------------
|
| 100 |
+
# Tool Rating Aggregate
|
| 101 |
+
# -----------------------
|
| 102 |
+
class ToolRatingAggregate(Base):
|
| 103 |
+
__tablename__ = "tool_rating_aggregates"
|
| 104 |
+
|
| 105 |
+
tool = Column(String(100), primary_key=True)
|
| 106 |
+
average_rating = Column(Float, nullable=False, default=0)
|
| 107 |
+
rating_count = Column(Integer, nullable=False, default=0)
|
| 108 |
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
| 109 |
+
# -----------------------
|
| 110 |
+
# AdStat
|
| 111 |
+
# -----------------------
|
| 112 |
+
class AdStat(Base):
|
| 113 |
+
__tablename__ = "ad_stats"
|
| 114 |
+
|
| 115 |
+
id = Column(Integer, primary_key=True)
|
| 116 |
+
ad_unit_id = Column(
|
| 117 |
+
Integer,
|
| 118 |
+
ForeignKey("ad_units.id", ondelete="CASCADE"),
|
| 119 |
+
nullable=False
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
placement = Column(String(80), nullable=False)
|
| 123 |
+
impressions = Column(Integer, default=0)
|
| 124 |
+
clicks = Column(Integer, default=0)
|
| 125 |
+
last_served_at = Column(DateTime, nullable=True)
|
| 126 |
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
| 127 |
+
|
| 128 |
+
ad_unit = relationship("AdUnit", back_populates="stats")
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
# -----------------------
|
| 132 |
+
# AdImpression (optional detailed events)
|
| 133 |
+
# -----------------------
|
| 134 |
+
class AdImpression(Base):
|
| 135 |
+
__tablename__ = "ad_impressions"
|
| 136 |
+
|
| 137 |
+
id = Column(Integer, primary_key=True)
|
| 138 |
+
ad_unit_id = Column(
|
| 139 |
+
Integer,
|
| 140 |
+
ForeignKey("ad_units.id", ondelete="CASCADE"),
|
| 141 |
+
nullable=False
|
| 142 |
+
)
|
| 143 |
+
|
| 144 |
+
client_id = Column(String(64), nullable=True)
|
| 145 |
+
placement = Column(String(80), nullable=True)
|
| 146 |
+
timestamp = Column(DateTime, default=datetime.utcnow)
|
| 147 |
+
|
| 148 |
+
ad_unit = relationship("AdUnit", back_populates="impressions")
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
# -----------------------
|
| 152 |
+
# AdGlobalSettings
|
| 153 |
+
# -----------------------
|
| 154 |
+
class AdGlobalSettings(Base):
|
| 155 |
+
__tablename__ = "ad_global_settings"
|
| 156 |
+
|
| 157 |
+
id = Column(Integer, primary_key=True)
|
| 158 |
+
all_ads_enabled = Column(Boolean, server_default=expression.true(), default=True)
|
| 159 |
+
banners_enabled = Column(Boolean, server_default=expression.true(), default=True)
|
| 160 |
+
popups_enabled = Column(Boolean, server_default=expression.true(), default=True)
|
| 161 |
+
predownload_enabled = Column(Boolean, server_default=expression.true(), default=True)
|
| 162 |
+
sidebar_enabled = Column(Boolean, server_default=expression.true(), default=True)
|
| 163 |
+
|
| 164 |
+
# NEW FIELD YOU REQUESTED
|
| 165 |
+
mobile_enabled = Column(Boolean, server_default=expression.true(), default=True)
|
| 166 |
+
|
| 167 |
+
audio_enabled = Column(Boolean, server_default=expression.true(), default=True)
|
| 168 |
+
rotation_enabled = Column(Boolean, server_default=expression.true(), default=True)
|
| 169 |
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
| 170 |
+
|
| 171 |
+
# --------------------------------------
|
| 172 |
+
# APP USAGE & TOOL USAGE STATS
|
| 173 |
+
# --------------------------------------
|
| 174 |
+
class UsageStat(Base):
|
| 175 |
+
__tablename__ = "usage_stats"
|
| 176 |
+
|
| 177 |
+
id = Column(Integer, primary_key=True)
|
| 178 |
+
tool_name = Column(String(255), nullable=False)
|
| 179 |
+
|
| 180 |
+
open_count = Column(Integer, default=0)
|
| 181 |
+
process_count = Column(Integer, default=0)
|
| 182 |
+
download_count = Column(Integer, default=0)
|
| 183 |
+
usage_count = Column(Integer, default=0)
|
| 184 |
+
last_used_at = Column(DateTime, default=datetime.utcnow)
|
| 185 |
+
created_at = Column(DateTime, default=datetime.utcnow)
|
| 186 |
+
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
| 187 |
+
|
| 188 |
+
|
create_table.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from core.database import engine, Base
|
| 2 |
+
from core.models import rating
|
| 3 |
+
|
| 4 |
+
Base.metadata.create_all(bind=engine)
|
| 5 |
+
print("β
Tables created")
|
create_tables.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from core.database import engine, Base
|
| 2 |
+
from core.models import ToolRating
|
| 3 |
+
|
| 4 |
+
Base.metadata.create_all(bind=engine)
|
| 5 |
+
print("β
ratings table created")
|
dependencies/__init__.py
ADDED
|
File without changes
|
dependencies/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (149 Bytes). View file
|
|
|
dependencies/__pycache__/__init__.cpython-39.pyc
ADDED
|
Binary file (137 Bytes). View file
|
|
|
dependencies/__pycache__/api_auth.cpython-312.pyc
ADDED
|
Binary file (1.54 kB). View file
|
|
|
dependencies/__pycache__/auth.cpython-312.pyc
ADDED
|
Binary file (1.9 kB). View file
|
|
|
dependencies/__pycache__/auth.cpython-39.pyc
ADDED
|
Binary file (999 Bytes). View file
|
|
|
dependencies/api_auth.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# dependencies/api_auth.py
|
| 2 |
+
import secrets
|
| 3 |
+
import os
|
| 4 |
+
from fastapi.security import HTTPBasic, HTTPBasicCredentials
|
| 5 |
+
from fastapi import Depends, HTTPException, status
|
| 6 |
+
|
| 7 |
+
# Load credentials securely from environment variables (matching the values in auth.py)
|
| 8 |
+
ADMIN_USERNAME = os.environ.get("ADMIN_USER", "admin")
|
| 9 |
+
ADMIN_PASSWORD = os.environ.get("ADMIN_PASS", "1234")
|
| 10 |
+
|
| 11 |
+
# Initialize HTTP Basic Security Scheme
|
| 12 |
+
security = HTTPBasic()
|
| 13 |
+
|
| 14 |
+
def get_current_admin_user(credentials: HTTPBasicCredentials = Depends(security)):
|
| 15 |
+
"""
|
| 16 |
+
FastAPI dependency function to check HTTP Basic Auth credentials.
|
| 17 |
+
This protects API routes (like the ones in routers/stats.py)
|
| 18 |
+
that are not part of the starlette-admin dashboard.
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
# Use secrets.compare_digest for secure, constant-time comparison
|
| 22 |
+
is_valid_username = secrets.compare_digest(credentials.username, ADMIN_USERNAME)
|
| 23 |
+
is_valid_password = secrets.compare_digest(credentials.password, ADMIN_PASSWORD)
|
| 24 |
+
|
| 25 |
+
if not (is_valid_username and is_valid_password):
|
| 26 |
+
# Raise an exception if authentication fails
|
| 27 |
+
raise HTTPException(
|
| 28 |
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
| 29 |
+
detail="Incorrect username or password",
|
| 30 |
+
headers={"WWW-Authenticate": "Basic"},
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
# Return the username on success (or any user object if needed)
|
| 34 |
+
return credentials.username
|
dependencies/auth.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# dependencies/auth.py
|
| 2 |
+
from starlette.requests import Request
|
| 3 |
+
from starlette_admin.auth import BaseAuthProvider
|
| 4 |
+
import secrets
|
| 5 |
+
|
| 6 |
+
ADMIN_USERNAME = "admin"
|
| 7 |
+
ADMIN_PASSWORD = "admin123"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class BasicAdminAuthProvider(BaseAuthProvider):
|
| 11 |
+
|
| 12 |
+
async def login(self, request: Request) -> bool:
|
| 13 |
+
form = await request.form()
|
| 14 |
+
username = form.get("username", "")
|
| 15 |
+
password = form.get("password", "")
|
| 16 |
+
|
| 17 |
+
if secrets.compare_digest(username, ADMIN_USERNAME) and secrets.compare_digest(password, ADMIN_PASSWORD):
|
| 18 |
+
request.session["is_authenticated"] = True
|
| 19 |
+
return True
|
| 20 |
+
return False
|
| 21 |
+
|
| 22 |
+
async def is_authenticated(self, request: Request) -> bool:
|
| 23 |
+
return request.session.get("is_authenticated") is True
|
| 24 |
+
|
| 25 |
+
async def logout(self, request: Request) -> None:
|
| 26 |
+
request.session.clear()
|
| 27 |
+
|
| 28 |
+
async def setup_admin(self, admin):
|
| 29 |
+
# MUST exist β required by Starlette-Admin
|
| 30 |
+
return
|
| 31 |
+
|
e8604869-ecdd-420e-926d-bd6afc04f3fe_map.shtml
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<map id="e8604869-ecdd-420e-926d-bd6afc04f3fe" name="e8604869-ecdd-420e-926d-bd6afc04f3fe">
|
| 2 |
+
<area href="e8604869-ecdd-420e-926d-bd6afc04f3fe_map.shtml" shape="rect" coords="0,0,594,841" alt="" />
|
| 3 |
+
</map>
|
fastapi
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
python -c "import fastapi; print('FASTAPI OK')"
|
| 2 |
+
pip install fastapi
|
| 3 |
+
pip install "uvicorn[standard]"
|
| 4 |
+
pip install python-multipart
|
| 5 |
+
pip install aiofiles
|
| 6 |
+
pip install pydantic
|
| 7 |
+
pip install requests
|
| 8 |
+
pip install python-dotenv
|
| 9 |
+
pip install psycopg2-binary
|
| 10 |
+
pip install pillow
|
| 11 |
+
|
filespath.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sudo nano /etc/systemd/system/backend.service
|
| 2 |
+
sudo nano /etc/systemd/system/celery.service
|
| 3 |
+
sudo nano /etc/systemd/system/backend.socket
|
| 4 |
+
|
img.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
iVBORw0KGgoAAAANSUhEUgAAAyAAAABkCAYAAAB+UVSPAAAACXBIWXMAAAsSAAALEgHS3X78AAAQAElEQVR4AexdB4BU5dU933vTt7NLEVSw94JoDCj2mij2XmIvsYs9JtH8GjVqrDExSmJi79gwJhpBEXsvwa70sn2nz7z3/nPf7CxL21lgFVjuuGe+fu/9zvfUe96b2bVgaj2FcqDXgF4Deg3oNaDXgF4Deg3oNaDXgF4DP8Y1YEFfyoAysJwYULfKgDKgDCgDyoAyoAysegyoAFn1zlx3rAwoA8qAMqAMKAPKgDKgDCw3BlSALDfq1bEyoAwoA8qAMqAMKAOrHgO6Y2VABYheA8qAMqAMKAPKgDKgDCgDyoAy8KMxoALkR6N6QUfaVgaUAWVAGVAGlAFlQBlQBlY9BlSArHpnrjtWBpQBZUAZUAaUAWVAGVAGlhsDKkCWG/XqWBn4cRmwouU/rkP1pgwoA8rAIhjQLmVAGVAGVIDoNaAMrCIM9D3nNtSe8DuYUHQV2bFuUxlQ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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pip install fastapi-admin bcrypt python-jose
|
| 2 |
+
sudo apt update
|
| 3 |
+
sudo apt install ffmpeg -y
|
| 4 |
+
sudo apt install ghostscript -y
|
| 5 |
+
sudo apt install imagemagick -y
|
| 6 |
+
pip install pydantic-settings
|
| 7 |
+
pip install fastapi uvicorn sqlalchemy psycopg2-binary pydantic python-dotenv fastapi-admin bcrypt python-jose
|
| 8 |
+
pip install sqlalchemy psycopg2-binary
|
| 9 |
+
pip install fastapi uvicorn python-dotenv
|
| 10 |
+
pip install pillow pikepdf wand python-magic ffmpeg-python pydub
|
| 11 |
+
pip install chardet unidecode
|
| 12 |
+
sudo apt install p7zip-full p7zip-rar -y
|
| 13 |
+
sudo apt install pandoc -y
|
| 14 |
+
chmod +x cleanup.py
|
| 15 |
+
# system
|
| 16 |
+
sudo apt update
|
| 17 |
+
sudo apt install imagemagick -y # ensures 'magick' or 'convert' binary exists
|
| 18 |
+
# python libs
|
| 19 |
+
pip install pillow piexif pdf2image
|
| 20 |
+
# (pdf2image used earlier; kept if needed)
|
| 21 |
+
# system
|
| 22 |
+
sudo apt update
|
| 23 |
+
sudo apt install ffmpeg sox -y
|
| 24 |
+
|
| 25 |
+
# python (inside your venv)
|
| 26 |
+
pip install ffmpeg-python pydub numpy soundfile librosa matplotlib aubio faster-whisper demucs TTS
|
| 27 |
+
# extras (optional, help)
|
| 28 |
+
pip install scipy matplotlib python-soundfile
|
| 29 |
+
sudo apt update
|
| 30 |
+
sudo apt install ffmpeg sox ghostscript imagemagick tesseract-ocr poppler-utils -y
|
| 31 |
+
pip install torch --index-url https://download.pytorch.org/whl/cu121
|
| 32 |
+
pip install torch --index-url https://download.pytorch.org/whl/cpu
|
| 33 |
+
sudo apt update
|
| 34 |
+
sudo apt install -y ghostscript poppler-utils imagemagick tesseract-ocr
|
| 35 |
+
pip install pikepdf pymupdf ocrmypdf pdf2image reportlab pillow python-magic
|
| 36 |
+
sudo apt update
|
| 37 |
+
sudo apt install -y ffmpeg libopencv-dev ffmpeg libavcodec-extra
|
| 38 |
+
# For stabilization (optional): libvidstab
|
| 39 |
+
# On Ubuntu you might need to build ffmpeg with libvidstab or use a custom build/distribution.
|
| 40 |
+
|
| 41 |
+
# Python packages (inside your venv)
|
| 42 |
+
pip install ffmpeg-python moviepy opencv-python numpy scikit-image
|
| 43 |
+
sudo mkdir -p /opt/realesrgan-models
|
| 44 |
+
cd /opt/realesrgan-models
|
| 45 |
+
# Example model files (replace URLs with actual ones)
|
| 46 |
+
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.3.0/realesrgan-x4plus.param
|
| 47 |
+
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.3.0/realesrgan-x4plus.bin
|
| 48 |
+
# Or use an anime/video-specific model if available: realesr-animevideov3-x2.param/.bin etc.
|
| 49 |
+
pip install Pillow pymupdf markdown python-magic
|
| 50 |
+
# System (already likely installed): poppler-utils (for pdf2image if used), but pdf->text uses PyMuPDF
|
| 51 |
+
pip install qrcode[pil] python-barcode reportlab pillow
|
| 52 |
+
pip install pygments sqlparse xmltodict requests
|
| 53 |
+
python3.10 -m venv ttsenv
|
| 54 |
+
source ttsenv/bin/activate
|
| 55 |
+
#pip install TTS
|
| 56 |
+
pip install pyttsx3
|
| 57 |
+
sudo apt update
|
| 58 |
+
sudo apt install python3.10 python3.10-venv python3.10-dev
|
| 59 |
+
python3.10 -m venv venv
|
| 60 |
+
source venv/bin/activate
|
| 61 |
+
python --version
|
| 62 |
+
pip install pydantic-settings
|
| 63 |
+
pip install pikepdf==5.0.1
|
| 64 |
+
sudo apt update
|
| 65 |
+
sudo apt install -y libqpdf-dev
|
| 66 |
+
pip install pikepdf==5.0.1
|
| 67 |
+
pip install PyMuPDF pikepdf
|
| 68 |
+
pip install "PyMuPDF==1.23.4" "pikepdf==5.0.1"
|
| 69 |
+
sudo apt update
|
| 70 |
+
sudo apt install -y libqpdf-dev
|
| 71 |
+
pip install pikepdf
|
| 72 |
+
pip install reportlab
|
| 73 |
+
sudo apt install libfreetype6-dev libjpeg-dev
|
| 74 |
+
pip install reportlab
|
| 75 |
+
pip install pdf2image pillow pikepdf pymupdf reportlab ffmpeg-python moviepy numpy scipy librosa soundfile python-multipart
|
| 76 |
+
sudo apt install poppler-utils
|
| 77 |
+
sudo apt install ffmpeg poppler-utils -y
|
| 78 |
+
pip install onnxruntime pillow numpy
|
| 79 |
+
pip install gdown
|
| 80 |
+
pip install realesrgan
|
| 81 |
+
pip install basicsr
|
| 82 |
+
pip install realesrgan[full]
|
| 83 |
+
pip install realesrgan basicsr torch torchvision
|
| 84 |
+
pip install torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorch.org/whl/cpu
|
| 85 |
+
pip install realesrgan basicsr
|
| 86 |
+
pip uninstall -y torch torchvision
|
| 87 |
+
pip install torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorch.org/whl/cpu
|
| 88 |
+
pip install realesrgan basicsr
|
| 89 |
+
pip install torch==1.13.1 torchvision==0.14.1
|
| 90 |
+
pip install realesrgan basicsr
|
| 91 |
+
sudo apt install python3.10 python3.10-venv
|
| 92 |
+
python3.10 -m venv venv310
|
| 93 |
+
source venv310/bin/activate
|
| 94 |
+
pip install torch==1.13.1+cpu torchvision==0.14.1+cpu --index-url https://download.pytorch.org/whl/cpu
|
| 95 |
+
pip install realesrgan basicsr
|
| 96 |
+
sudo apt install libvulkan1 vulkan-tools
|
| 97 |
+
|
| 98 |
+
pip install \
|
| 99 |
+
pdf2image pillow pikepdf pymupdf reportlab \
|
| 100 |
+
ffmpeg-python moviepy numpy scipy librosa soundfile \
|
| 101 |
+
opencv-python pandas python-magic filetype \
|
| 102 |
+
python-multipart
|
| 103 |
+
sudo apt update
|
| 104 |
+
sudo apt install -y ocrmypdf tesseract-ocr tesseract-ocr-eng ghostscript qpdf
|
| 105 |
+
pip install ocrmypdf[all]
|
| 106 |
+
pip install ocrmypdf --no-binary :all:
|
| 107 |
+
pip install pillow opencv-python piexif numpy
|
| 108 |
+
pip install piexif
|
| 109 |
+
sudo apt install ffmpeg -y
|
| 110 |
+
pip install pydub
|
| 111 |
+
pip install moviepy
|
| 112 |
+
pip install --upgrade --force-reinstall moviepy
|
| 113 |
+
sudo apt install ffmpeg -y
|
| 114 |
+
pip install imageio imageio-ffmpeg
|
| 115 |
+
pip install moviepy imageio imageio-ffmpeg numpy
|
| 116 |
+
sudo apt install ffmpeg -y
|
| 117 |
+
pip uninstall moviepy -y
|
| 118 |
+
pip uninstall imageio imageio-ffmpeg -y
|
| 119 |
+
pip install moviepy==1.0.3 imageio==2.31.1 imageio-ffmpeg==0.4.9 numpy
|
| 120 |
+
pip cache purge
|
| 121 |
+
sudo apt install ffmpeg -y
|
| 122 |
+
rm -rf venv/lib/python3.9/site-packages/moviepy
|
| 123 |
+
rm -rf venv/lib/python3.9/site-packages/moviepy-*
|
| 124 |
+
pip install moviepy==1.0.3
|
| 125 |
+
pip install markdown
|
| 126 |
+
pip install qrcode[pil]
|
| 127 |
+
pip install pillow
|
| 128 |
+
pip install python-barcode
|
| 129 |
+
pip install sqlparse
|
| 130 |
+
pip install xmltodict
|
| 131 |
+
pip install psycopg2-binary
|
| 132 |
+
python -c "import fastapi, pydantic; print(fastapi.__version__, pydantic.__version__)"
|
| 133 |
+
pip install --upgrade fastapi starlette
|
| 134 |
+
pip install PyJWT
|
| 135 |
+
pip install PyJWT[crypto]
|
| 136 |
+
# If you haven't already installed the PostgreSQL driver
|
| 137 |
+
pip install psycopg2-binary
|
| 138 |
+
pip install itsdangerous
|
| 139 |
+
pip install starlette-admini
|
| 140 |
+
pip install pydantic-settings python-dotenv
|
| 141 |
+
pip install fastapi-admin tortoise-orm aiofiles python-multipart jinja2
|
| 142 |
+
pip install fastapi-admin tortoise-orm aiofiles python-multipart jinja2
|
| 143 |
+
sudo apt install redis
|
| 144 |
+
sudo service redis start
|
| 145 |
+
pip uninstall starlette-admin
|
| 146 |
+
# then remove imports and admin-specific files you added earlier (core/admin.py earlier version)
|
| 147 |
+
pip install sqladmin sqlalchemy psycopg2-binary python-multipart
|
| 148 |
+
pip install sqladmin psycopg2-binary
|
| 149 |
+
pip install sqladmin psycopg2-binary sqlalchemy
|
| 150 |
+
pip install PyPDF2
|
| 151 |
+
pip install pytesseract
|
| 152 |
+
sudo apt install tesseract-ocr
|
| 153 |
+
python -m pip install fastapi uvicorn sqlalchemy alembic python-multipart itsdangerous email-validator jinja2 passlib[bcrypt] requests pydantic cryptography reportlab
|
| 154 |
+
python -m pip install pydantic-settings
|
| 155 |
+
python -m pip install psycopg2-binary
|
| 156 |
+
pip uninstall onnxruntime torch realesrgan basicsr -y
|
| 157 |
+
pip install super-image
|
| 158 |
+
pip install pillow-heif
|
| 159 |
+
pip install pillow pillow-heif cairosvg
|
| 160 |
+
pip install cairosvg
|
| 161 |
+
pip install pillow-heif
|
| 162 |
+
pip install pillow
|
| 163 |
+
npm install @mediapipe/tasks-vision
|
| 164 |
+
npm install @tensorflow/tfjs @tensorflow-models/body-pix
|
| 165 |
+
npm install @tensorflow/tfjs @tensorflow-models/body-pix
|
| 166 |
+
pip install -r requirements.txt
|
| 167 |
+
# or
|
| 168 |
+
pip install Pillow reportlab
|
| 169 |
+
pip install rawpy==0.25.1
|
| 170 |
+
pip install opencv-python
|
| 171 |
+
pip install opencv-python-headless
|
| 172 |
+
pip install fastapi uvicorn pillow numpy opencv-python rembg
|
| 173 |
+
pip install onnxruntime-gpu
|
| 174 |
+
pip install onnxruntime
|
| 175 |
+
pip install fastapi uvicorn pillow numpy rembg opencv-python
|
| 176 |
+
sudo apt install libwebp-dev
|
| 177 |
+
pip install pillow fastapi uvicorn
|
| 178 |
+
npm install -g prettier
|
| 179 |
+
npm install prettier --save-dev
|
| 180 |
+
npm install prettier prettier-plugin-standalone --save
|
| 181 |
+
sudo apt update
|
| 182 |
+
sudo apt install -y \
|
| 183 |
+
ffmpeg \
|
| 184 |
+
ghostscript \
|
| 185 |
+
imagemagick \
|
| 186 |
+
graphicsmagick \
|
| 187 |
+
mupdf \
|
| 188 |
+
poppler-utils \
|
| 189 |
+
pandoc \
|
| 190 |
+
p7zip-full \
|
| 191 |
+
unzip \
|
| 192 |
+
unrar \
|
| 193 |
+
libimage-exiftool-perl
|
| 194 |
+
sudo apt install -y gdal-bin libgdal-dev
|
| 195 |
+
sudo apt install -y freecad
|
| 196 |
+
sudo apt install -y libreoffice
|
| 197 |
+
pip install python-multipart
|
| 198 |
+
pip install pypdf2
|
| 199 |
+
pip install python-docx
|
| 200 |
+
pip install openpyxl
|
| 201 |
+
pip install fastapi
|
| 202 |
+
pip install uvicorn
|
| 203 |
+
pip install pillow
|
| 204 |
+
pip install pymupdf
|
| 205 |
+
pip install pydub
|
| 206 |
+
pip install ffmpeg-python
|
| 207 |
+
pip install pandas pyarrow fastparquet
|
| 208 |
+
pip install python-magic
|
| 209 |
+
pip install aiofiles
|
| 210 |
+
pip install --upgrade imageio imageio-ffmpeg
|
| 211 |
+
pip install "setuptools<81"
|
| 212 |
+
sudo apt install potrace
|
| 213 |
+
sudo apt update
|
| 214 |
+
sudo apt install ffmpeg -y
|
| 215 |
+
pip install pydub
|
| 216 |
+
pip install librosa soundfile matplotlib
|
| 217 |
+
pip install openai-whisper
|
| 218 |
+
# upgrade packaging tools first (recommended)
|
| 219 |
+
python -m pip install --upgrade pip setuptools wheel
|
| 220 |
+
|
| 221 |
+
# install numpy (required by whisper)
|
| 222 |
+
python -m pip install numpy
|
| 223 |
+
|
| 224 |
+
# (optional but often required) install/update whisper and its deps
|
| 225 |
+
python -m pip install -U openai-whisper
|
| 226 |
+
|
| 227 |
+
# If you plan to use PyTorch-backed whisper (recommended for performance),
|
| 228 |
+
# install torch. For CPU-only builds use the CPU index:
|
| 229 |
+
python -m pip install --index-url https://download.pytorch.org/whl/cpu torch
|
| 230 |
+
|
| 231 |
+
# OR if you have CUDA and want GPU support, install the correct torch wheel from PyTorch site:
|
| 232 |
+
# See https://pytorch.org/get-started/locally/ for the right command for your CUDA version.
|
| 233 |
+
pip uninstall -y numpy
|
| 234 |
+
pip install "numpy<2"
|
| 235 |
+
pip install torch --index-url https://download.pytorch.org/whl/cpu
|
| 236 |
+
pip install -U openai-whisper
|
| 237 |
+
pip install "numpy<2"
|
| 238 |
+
pip uninstall -y opencv-python opencv-python-headless
|
| 239 |
+
pip install "opencv-python==4.7.0.72"
|
| 240 |
+
pip install "opencv-python-headless==4.7.0.72"
|
| 241 |
+
pip install --force-reinstall torch --index-url https://download.pytorch.org/whl/cpu
|
| 242 |
+
pip install --force-reinstall openai-whisper
|
| 243 |
+
pip install whisper
|
| 244 |
+
pip install whisper
|
| 245 |
+
pip freeze
|
| 246 |
+
pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu
|
| 247 |
+
pip install fastapi
|
| 248 |
+
pip install uvicorn[standard]
|
| 249 |
+
pip install python-multipart
|
| 250 |
+
pip install pydantic
|
| 251 |
+
pip install aiofiles
|
| 252 |
+
pip install python-dotenv
|
| 253 |
+
pip install psycopg2-binary
|
| 254 |
+
pip install PyJWT
|
| 255 |
+
pip install pillow
|
| 256 |
+
pip install requests
|
| 257 |
+
sudo apt install -y ffmpeg
|
| 258 |
+
pip uninstall -y opencv-python opencv-python-headless moviepy numpy
|
| 259 |
+
pip install numpy==1.26.4
|
| 260 |
+
pip install opencv-python==4.7.0.72 opencv-python-headless==4.7.0.72
|
| 261 |
+
pip install moviepy==1.0.3
|
| 262 |
+
pip install --upgrade pip
|
| 263 |
+
pip install fastapi uvicorn
|
| 264 |
+
pip install numpy==1.26.4
|
| 265 |
+
pip install opencv-python==4.7.0.72
|
| 266 |
+
pip install opencv-python-headless==4.7.0.72
|
| 267 |
+
pip install moviepy==1.0.3
|
| 268 |
+
pip install whisper
|
| 269 |
+
pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu
|
| 270 |
+
python -c "import fastapi; print('FASTAPI OK')"
|
| 271 |
+
python -c "import cv2; print('CV2 OK')"
|
| 272 |
+
python -c "import moviepy; print('MOVIEPY OK')"
|
| 273 |
+
python -c "import whisper; print('WHISPER OK')"
|
| 274 |
+
python -c "import torch; print('TORCH OK')"
|
| 275 |
+
pip install faster-whisper
|
| 276 |
+
pip install PyPDF2==3.0.1
|
| 277 |
+
pip install PyPDF2
|
| 278 |
+
pip install python-docx
|
| 279 |
+
pip install python-docx==0.8.11
|
| 280 |
+
sudo apt-get install ghostscript
|
| 281 |
+
pip install pikepdf
|
| 282 |
+
sudo apt update
|
| 283 |
+
sudo apt install handbrake-cli -y
|
| 284 |
+
pip install fastapi uvicorn[standard] python-multipart ffmpeg-python
|
| 285 |
+
pip install Flask flask-cors ffmpeg-normalize gunicorn
|
| 286 |
+
pip install "fastapi[all]" python-multipart pydub numpy pyloudnorm
|
| 287 |
+
sudo apt update
|
| 288 |
+
sudo apt install -y qpdf ghostscript
|
| 289 |
+
sudo apt install tesseract-ocr -y
|
| 290 |
+
pip install pytesseract pymupdf pillow
|
| 291 |
+
pip install markdown bleach
|
| 292 |
+
pip install pillow pillow-heif pillow-avif-plugin cairosvg
|
| 293 |
+
sudo apt install fonts-dejavu fonts-liberation ttf-mscorefonts-installer
|
| 294 |
+
sudo apt install fonts-freefont-ttf fonts-lato
|
| 295 |
+
pip install playwright
|
| 296 |
+
playwright install chromium
|
| 297 |
+
sudo apt install tesseract-ocr poppler-utils calibre
|
| 298 |
+
pip install pytesseract pdf2image pillow
|
| 299 |
+
sudo apt update
|
| 300 |
+
sudo apt install gdal-bin
|
| 301 |
+
sudo apt install poppler-utils
|
| 302 |
+
sudo apt install openbabel
|
| 303 |
+
sudo apt install ffmpeg
|
| 304 |
+
pip install openai-whisper
|
| 305 |
+
sudo apt install djvulibre-bin
|
| 306 |
+
sudo apt install mupdf-tools
|
| 307 |
+
sudo apt install graphicsmagick
|
| 308 |
+
sudo apt update
|
| 309 |
+
sudo apt install imagemagick
|
| 310 |
+
sudo apt install potrace imagemagick
|
| 311 |
+
cd ~/backend_copy
|
| 312 |
+
source venv/bin/activate
|
| 313 |
+
pip install pypdf
|
| 314 |
+
sudo apt install tesseract-ocr
|
| 315 |
+
sudo apt install tesseract-ocr-eng
|
| 316 |
+
pip install pytesseract
|
| 317 |
+
pip uninstall -y moviepy
|
| 318 |
+
pip install "moviepy==1.0.3"
|
| 319 |
+
pip install bleach
|
| 320 |
+
pip install PyJWT
|
| 321 |
+
pip install celery
|
| 322 |
+
pip install redis
|
| 323 |
+
|
install1.sh
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sudo apt update
|
| 2 |
+
sudo apt install fonts-dejavu-core
|
| 3 |
+
pip uninstall pymupdf -y
|
| 4 |
+
pip install --upgrade pymupdf
|
| 5 |
+
pip uninstall pymupdf -y
|
| 6 |
+
pip install --upgrade pymupdf
|
| 7 |
+
sudo apt install qpdf
|
| 8 |
+
sudo apt install qpdf
|
| 9 |
+
|
| 10 |
+
pip install fastapi-admin bcrypt python-jose
|
| 11 |
+
sudo apt update
|
| 12 |
+
sudo apt install ffmpeg -y
|
| 13 |
+
sudo apt install ghostscript -y
|
| 14 |
+
sudo apt install imagemagick -y
|
| 15 |
+
pip install pydantic-settings
|
| 16 |
+
pip install fastapi uvicorn sqlalchemy psycopg2-binary pydantic python-dotenv fastapi-admin bcrypt python-jose
|
| 17 |
+
pip install sqlalchemy psycopg2-binary
|
| 18 |
+
pip install fastapi uvicorn python-dotenv
|
| 19 |
+
pip install pillow pikepdf wand python-magic ffmpeg-python pydub
|
| 20 |
+
pip install chardet unidecode
|
| 21 |
+
sudo apt install p7zip-full p7zip-rar -y
|
| 22 |
+
sudo apt install pandoc -y
|
| 23 |
+
chmod +x cleanup.py
|
| 24 |
+
# system
|
| 25 |
+
sudo apt update
|
| 26 |
+
sudo apt install imagemagick -y # ensures 'magick' or 'convert' binary exists
|
| 27 |
+
# python libs
|
| 28 |
+
pip install pillow piexif pdf2image
|
| 29 |
+
# (pdf2image used earlier; kept if needed)
|
| 30 |
+
# system
|
| 31 |
+
sudo apt update
|
| 32 |
+
sudo apt install ffmpeg sox -y
|
| 33 |
+
|
| 34 |
+
# python (inside your venv)
|
| 35 |
+
pip install ffmpeg-python pydub numpy soundfile librosa matplotlib aubio faster-whisper demucs TTS
|
| 36 |
+
# extras (optional, help)
|
| 37 |
+
pip install scipy matplotlib python-soundfile
|
| 38 |
+
sudo apt update
|
| 39 |
+
sudo apt install ffmpeg sox ghostscript imagemagick tesseract-ocr poppler-utils -y
|
| 40 |
+
pip install torch --index-url https://download.pytorch.org/whl/cu121
|
| 41 |
+
pip install torch --index-url https://download.pytorch.org/whl/cpu
|
| 42 |
+
sudo apt update
|
| 43 |
+
sudo apt install -y ghostscript poppler-utils imagemagick tesseract-ocr
|
| 44 |
+
pip install pikepdf pymupdf ocrmypdf pdf2image reportlab pillow python-magic
|
| 45 |
+
sudo apt update
|
| 46 |
+
sudo apt install -y ffmpeg libopencv-dev ffmpeg libavcodec-extra
|
| 47 |
+
# For stabilization (optional): libvidstab
|
| 48 |
+
# On Ubuntu you might need to build ffmpeg with libvidstab or use a custom build/distribution.
|
| 49 |
+
|
| 50 |
+
# Python packages (inside your venv)
|
| 51 |
+
pip install ffmpeg-python moviepy opencv-python numpy scikit-image
|
| 52 |
+
sudo mkdir -p /opt/realesrgan-models
|
| 53 |
+
cd /opt/realesrgan-models
|
| 54 |
+
# Example model files (replace URLs with actual ones)
|
| 55 |
+
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.3.0/realesrgan-x4plus.param
|
| 56 |
+
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.3.0/realesrgan-x4plus.bin
|
| 57 |
+
# Or use an anime/video-specific model if available: realesr-animevideov3-x2.param/.bin etc.
|
| 58 |
+
pip install Pillow pymupdf markdown python-magic
|
| 59 |
+
# System (already likely installed): poppler-utils (for pdf2image if used), but pdf->text uses PyMuPDF
|
| 60 |
+
pip install qrcode[pil] python-barcode reportlab pillow
|
| 61 |
+
pip install pygments sqlparse xmltodict requests
|
| 62 |
+
python3.10 -m venv ttsenv
|
| 63 |
+
source ttsenv/bin/activate
|
| 64 |
+
#pip install TTS
|
| 65 |
+
pip install pyttsx3
|
| 66 |
+
sudo apt update
|
| 67 |
+
sudo apt install python3.10 python3.10-venv python3.10-dev
|
| 68 |
+
python3.10 -m venv venv
|
| 69 |
+
source venv/bin/activate
|
| 70 |
+
python --version
|
| 71 |
+
pip install pydantic-settings
|
| 72 |
+
pip install pikepdf==5.0.1
|
| 73 |
+
sudo apt update
|
| 74 |
+
sudo apt install -y libqpdf-dev
|
| 75 |
+
pip install pikepdf==5.0.1
|
| 76 |
+
pip install PyMuPDF pikepdf
|
| 77 |
+
pip install "PyMuPDF==1.23.4" "pikepdf==5.0.1"
|
| 78 |
+
sudo apt update
|
| 79 |
+
sudo apt install -y libqpdf-dev
|
| 80 |
+
pip install pikepdf
|
| 81 |
+
pip install reportlab
|
| 82 |
+
sudo apt install libfreetype6-dev libjpeg-dev
|
| 83 |
+
pip install reportlab
|
| 84 |
+
pip install pdf2image pillow pikepdf pymupdf reportlab ffmpeg-python moviepy numpy scipy librosa soundfile python-multipart
|
| 85 |
+
sudo apt install poppler-utils
|
| 86 |
+
sudo apt install ffmpeg poppler-utils -y
|
| 87 |
+
pip install onnxruntime pillow numpy
|
| 88 |
+
pip install gdown
|
| 89 |
+
pip install realesrgan
|
| 90 |
+
pip install basicsr
|
| 91 |
+
pip install realesrgan[full]
|
| 92 |
+
pip install realesrgan basicsr torch torchvision
|
| 93 |
+
pip install torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorch.org/whl/cpu
|
| 94 |
+
pip install realesrgan basicsr
|
| 95 |
+
pip uninstall -y torch torchvision
|
| 96 |
+
pip install torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorch.org/whl/cpu
|
| 97 |
+
pip install realesrgan basicsr
|
| 98 |
+
pip install torch==1.13.1 torchvision==0.14.1
|
| 99 |
+
pip install realesrgan basicsr
|
| 100 |
+
sudo apt install python3.10 python3.10-venv
|
| 101 |
+
python3.10 -m venv venv310
|
| 102 |
+
source venv310/bin/activate
|
| 103 |
+
pip install torch==1.13.1+cpu torchvision==0.14.1+cpu --index-url https://download.pytorch.org/whl/cpu
|
| 104 |
+
pip install realesrgan basicsr
|
| 105 |
+
sudo apt install libvulkan1 vulkan-tools
|
| 106 |
+
|
| 107 |
+
pip install \
|
| 108 |
+
pdf2image pillow pikepdf pymupdf reportlab \
|
| 109 |
+
ffmpeg-python moviepy numpy scipy librosa soundfile \
|
| 110 |
+
opencv-python pandas python-magic filetype \
|
| 111 |
+
python-multipart
|
| 112 |
+
sudo apt update
|
| 113 |
+
sudo apt install -y ocrmypdf tesseract-ocr tesseract-ocr-eng ghostscript qpdf
|
| 114 |
+
pip install ocrmypdf[all]
|
| 115 |
+
pip install ocrmypdf --no-binary :all:
|
| 116 |
+
pip install pillow opencv-python piexif numpy
|
| 117 |
+
pip install piexif
|
| 118 |
+
sudo apt install ffmpeg -y
|
| 119 |
+
pip install pydub
|
| 120 |
+
pip install moviepy
|
| 121 |
+
pip install --upgrade --force-reinstall moviepy
|
| 122 |
+
sudo apt install ffmpeg -y
|
| 123 |
+
pip install imageio imageio-ffmpeg
|
| 124 |
+
pip install moviepy imageio imageio-ffmpeg numpy
|
| 125 |
+
sudo apt install ffmpeg -y
|
| 126 |
+
pip uninstall moviepy -y
|
| 127 |
+
pip uninstall imageio imageio-ffmpeg -y
|
| 128 |
+
pip install moviepy==1.0.3 imageio==2.31.1 imageio-ffmpeg==0.4.9 numpy
|
| 129 |
+
pip cache purge
|
| 130 |
+
sudo apt install ffmpeg -y
|
| 131 |
+
rm -rf venv/lib/python3.9/site-packages/moviepy
|
| 132 |
+
rm -rf venv/lib/python3.9/site-packages/moviepy-*
|
| 133 |
+
pip install moviepy==1.0.3
|
| 134 |
+
pip install markdown
|
| 135 |
+
pip install qrcode[pil]
|
| 136 |
+
pip install pillow
|
| 137 |
+
pip install python-barcode
|
| 138 |
+
pip install sqlparse
|
| 139 |
+
pip install xmltodict
|
| 140 |
+
pip install psycopg2-binary
|
| 141 |
+
python -c "import fastapi, pydantic; print(fastapi.__version__, pydantic.__version__)"
|
| 142 |
+
pip install --upgrade fastapi starlette
|
| 143 |
+
pip install PyJWT
|
| 144 |
+
pip install PyJWT[crypto]
|
| 145 |
+
# If you haven't already installed the PostgreSQL driver
|
| 146 |
+
pip install psycopg2-binary
|
| 147 |
+
pip install itsdangerous
|
| 148 |
+
pip install starlette-admini
|
| 149 |
+
pip install pydantic-settings python-dotenv
|
| 150 |
+
pip install fastapi-admin tortoise-orm aiofiles python-multipart jinja2
|
| 151 |
+
pip install fastapi-admin tortoise-orm aiofiles python-multipart jinja2
|
| 152 |
+
sudo apt install redis
|
| 153 |
+
sudo service redis start
|
| 154 |
+
pip uninstall starlette-admin
|
| 155 |
+
# then remove imports and admin-specific files you added earlier (core/admin.py earlier version)
|
| 156 |
+
pip install sqladmin sqlalchemy psycopg2-binary python-multipart
|
| 157 |
+
pip install sqladmin psycopg2-binary
|
| 158 |
+
pip install sqladmin psycopg2-binary sqlalchemy
|
| 159 |
+
pip install PyPDF2
|
| 160 |
+
pip install pytesseract
|
| 161 |
+
sudo apt install tesseract-ocr
|
| 162 |
+
python -m pip install fastapi uvicorn sqlalchemy alembic python-multipart itsdangerous email-validator jinja2 passlib[bcrypt] requests pydantic cryptography reportlab
|
| 163 |
+
python -m pip install pydantic-settings
|
| 164 |
+
python -m pip install psycopg2-binary
|
| 165 |
+
pip uninstall onnxruntime torch realesrgan basicsr -y
|
| 166 |
+
pip install super-image
|
| 167 |
+
pip install pillow-heif
|
| 168 |
+
pip install pillow pillow-heif cairosvg
|
| 169 |
+
pip install cairosvg
|
| 170 |
+
pip install pillow-heif
|
| 171 |
+
pip install pillow
|
| 172 |
+
npm install @mediapipe/tasks-vision
|
| 173 |
+
npm install @tensorflow/tfjs @tensorflow-models/body-pix
|
| 174 |
+
npm install @tensorflow/tfjs @tensorflow-models/body-pix
|
| 175 |
+
pip install -r requirements.txt
|
| 176 |
+
# or
|
| 177 |
+
pip install Pillow reportlab
|
| 178 |
+
pip install rawpy==0.25.1
|
| 179 |
+
pip install opencv-python
|
| 180 |
+
pip install opencv-python-headless
|
| 181 |
+
pip install fastapi uvicorn pillow numpy opencv-python rembg
|
| 182 |
+
pip install onnxruntime-gpu
|
| 183 |
+
pip install onnxruntime
|
| 184 |
+
pip install fastapi uvicorn pillow numpy rembg opencv-python
|
| 185 |
+
sudo apt install libwebp-dev
|
| 186 |
+
pip install pillow fastapi uvicorn
|
| 187 |
+
npm install -g prettier
|
| 188 |
+
npm install prettier --save-dev
|
| 189 |
+
npm install prettier prettier-plugin-standalone --save
|
| 190 |
+
sudo apt update
|
| 191 |
+
sudo apt install -y \
|
| 192 |
+
ffmpeg \
|
| 193 |
+
ghostscript \
|
| 194 |
+
imagemagick \
|
| 195 |
+
graphicsmagick \
|
| 196 |
+
mupdf \
|
| 197 |
+
poppler-utils \
|
| 198 |
+
pandoc \
|
| 199 |
+
p7zip-full \
|
| 200 |
+
unzip \
|
| 201 |
+
unrar \
|
| 202 |
+
libimage-exiftool-perl
|
| 203 |
+
sudo apt install -y gdal-bin libgdal-dev
|
| 204 |
+
sudo apt install -y freecad
|
| 205 |
+
sudo apt install -y libreoffice
|
| 206 |
+
pip install python-multipart
|
| 207 |
+
pip install pypdf2
|
| 208 |
+
pip install python-docx
|
| 209 |
+
pip install openpyxl
|
| 210 |
+
pip install fastapi
|
| 211 |
+
pip install uvicorn
|
| 212 |
+
pip install pillow
|
| 213 |
+
pip install pymupdf
|
| 214 |
+
pip install pydub
|
| 215 |
+
pip install ffmpeg-python
|
| 216 |
+
pip install pandas pyarrow fastparquet
|
| 217 |
+
pip install python-magic
|
| 218 |
+
pip install aiofiles
|
| 219 |
+
pip install --upgrade imageio imageio-ffmpeg
|
| 220 |
+
pip install "setuptools<81"
|
| 221 |
+
sudo apt install potrace
|
| 222 |
+
sudo apt update
|
| 223 |
+
sudo apt install ffmpeg -y
|
| 224 |
+
pip install pydub
|
| 225 |
+
pip install librosa soundfile matplotlib
|
| 226 |
+
pip install openai-whisper
|
| 227 |
+
# upgrade packaging tools first (recommended)
|
| 228 |
+
python -m pip install --upgrade pip setuptools wheel
|
| 229 |
+
|
| 230 |
+
# install numpy (required by whisper)
|
| 231 |
+
python -m pip install numpy
|
| 232 |
+
|
| 233 |
+
# (optional but often required) install/update whisper and its deps
|
| 234 |
+
python -m pip install -U openai-whisper
|
| 235 |
+
|
| 236 |
+
# If you plan to use PyTorch-backed whisper (recommended for performance),
|
| 237 |
+
# install torch. For CPU-only builds use the CPU index:
|
| 238 |
+
python -m pip install --index-url https://download.pytorch.org/whl/cpu torch
|
| 239 |
+
|
| 240 |
+
# OR if you have CUDA and want GPU support, install the correct torch wheel from PyTorch site:
|
| 241 |
+
# See https://pytorch.org/get-started/locally/ for the right command for your CUDA version.
|
| 242 |
+
pip uninstall -y numpy
|
| 243 |
+
pip install "numpy<2"
|
| 244 |
+
pip install torch --index-url https://download.pytorch.org/whl/cpu
|
| 245 |
+
pip install -U openai-whisper
|
| 246 |
+
pip install "numpy<2"
|
| 247 |
+
pip uninstall -y opencv-python opencv-python-headless
|
| 248 |
+
pip install "opencv-python==4.7.0.72"
|
| 249 |
+
pip install "opencv-python-headless==4.7.0.72"
|
| 250 |
+
pip install --force-reinstall torch --index-url https://download.pytorch.org/whl/cpu
|
| 251 |
+
pip install --force-reinstall openai-whisper
|
| 252 |
+
pip install whisper
|
| 253 |
+
pip install whisper
|
| 254 |
+
pip freeze
|
| 255 |
+
pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu
|
| 256 |
+
pip install fastapi
|
| 257 |
+
pip install uvicorn[standard]
|
| 258 |
+
pip install python-multipart
|
| 259 |
+
pip install pydantic
|
| 260 |
+
pip install aiofiles
|
| 261 |
+
pip install python-dotenv
|
| 262 |
+
pip install psycopg2-binary
|
| 263 |
+
pip install PyJWT
|
| 264 |
+
pip install pillow
|
| 265 |
+
pip install requests
|
| 266 |
+
sudo apt install -y ffmpeg
|
| 267 |
+
pip uninstall -y opencv-python opencv-python-headless moviepy numpy
|
| 268 |
+
pip install numpy==1.26.4
|
| 269 |
+
pip install opencv-python==4.7.0.72 opencv-python-headless==4.7.0.72
|
| 270 |
+
pip install moviepy==1.0.3
|
| 271 |
+
pip install --upgrade pip
|
| 272 |
+
pip install fastapi uvicorn
|
| 273 |
+
pip install numpy==1.26.4
|
| 274 |
+
pip install opencv-python==4.7.0.72
|
| 275 |
+
pip install opencv-python-headless==4.7.0.72
|
| 276 |
+
pip install moviepy==1.0.3
|
| 277 |
+
pip install whisper
|
| 278 |
+
pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu
|
| 279 |
+
python -c "import fastapi; print('FASTAPI OK')"
|
| 280 |
+
python -c "import cv2; print('CV2 OK')"
|
| 281 |
+
python -c "import moviepy; print('MOVIEPY OK')"
|
| 282 |
+
python -c "import whisper; print('WHISPER OK')"
|
| 283 |
+
python -c "import torch; print('TORCH OK')"
|
| 284 |
+
pip install faster-whisper
|
| 285 |
+
pip install PyPDF2==3.0.1
|
| 286 |
+
pip install PyPDF2
|
| 287 |
+
pip install python-docx
|
| 288 |
+
pip install python-docx==0.8.11
|
| 289 |
+
sudo apt-get install ghostscript
|
| 290 |
+
pip install pikepdf
|
| 291 |
+
sudo apt update
|
| 292 |
+
sudo apt install handbrake-cli -y
|
| 293 |
+
pip install fastapi uvicorn[standard] python-multipart ffmpeg-python
|
| 294 |
+
pip install Flask flask-cors ffmpeg-normalize gunicorn
|
| 295 |
+
pip install "fastapi[all]" python-multipart pydub numpy pyloudnorm
|
| 296 |
+
sudo apt update
|
| 297 |
+
sudo apt install -y qpdf ghostscript
|
| 298 |
+
sudo apt install tesseract-ocr -y
|
| 299 |
+
pip install pytesseract pymupdf pillow
|
| 300 |
+
pip install markdown bleach
|
| 301 |
+
pip install pillow pillow-heif pillow-avif-plugin cairosvg
|
| 302 |
+
sudo apt install fonts-dejavu fonts-liberation ttf-mscorefonts-installer
|
| 303 |
+
sudo apt install fonts-freefont-ttf fonts-lato
|
| 304 |
+
pip install playwright
|
| 305 |
+
playwright install chromium
|
| 306 |
+
sudo apt install tesseract-ocr poppler-utils calibre
|
| 307 |
+
pip install pytesseract pdf2image pillow
|
| 308 |
+
sudo apt update
|
| 309 |
+
sudo apt install gdal-bin
|
| 310 |
+
sudo apt install poppler-utils
|
| 311 |
+
sudo apt install openbabel
|
| 312 |
+
sudo apt install ffmpeg
|
| 313 |
+
pip install openai-whisper
|
| 314 |
+
sudo apt install djvulibre-bin
|
| 315 |
+
sudo apt install mupdf-tools
|
| 316 |
+
sudo apt install graphicsmagick
|
| 317 |
+
sudo apt update
|
| 318 |
+
sudo apt install imagemagick
|
| 319 |
+
sudo apt install potrace imagemagick
|
| 320 |
+
cd ~/backend_copy
|
| 321 |
+
source venv/bin/activate
|
| 322 |
+
pip install pypdf
|
| 323 |
+
|
lib.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sudo apt install libreoffice libreoffice-impress libreoffice-writer
|
| 2 |
+
|
| 3 |
+
sudo apt update
|
| 4 |
+
sudo apt install libreoffice-impress libreoffice-writer libreoffice-core
|
| 5 |
+
pip install python-pptx beautifulsoup4 lxml
|
| 6 |
+
sudo apt install texlive-xetex
|
| 7 |
+
sudo apt install wkhtmltopdf
|
| 8 |
+
sudo apt install calibre
|
| 9 |
+
sudo apt update
|
| 10 |
+
sudo apt install libreoffice-calc
|
| 11 |
+
pip install pandas xlrd openpy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|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from fastapi import FastAPI
|
| 3 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 4 |
+
from starlette.middleware.sessions import SessionMiddleware
|
| 5 |
+
from starlette.middleware.base import BaseHTTPMiddleware
|
| 6 |
+
from fastapi.staticfiles import StaticFiles
|
| 7 |
+
|
| 8 |
+
# π 1. ENSURE DIRECTORIES EXIST (Prevents startup crash)
|
| 9 |
+
os.makedirs("static/output", exist_ok=True)
|
| 10 |
+
os.makedirs("uploads", exist_ok=True)
|
| 11 |
+
os.makedirs("tmp", exist_ok=True)
|
| 12 |
+
os.makedirs("temp", exist_ok=True)
|
| 13 |
+
|
| 14 |
+
# π 2. INITIALIZE RAM DATABASE TABLES (Prevents "no such table" error)
|
| 15 |
+
from core.database import Base, engine
|
| 16 |
+
Base.metadata.create_all(bind=engine)
|
| 17 |
+
|
| 18 |
+
from core.admin import setup_admin
|
| 19 |
+
from core.config import settings
|
| 20 |
+
|
| 21 |
+
# Routers
|
| 22 |
+
from routers.ratings import router as ratings_router
|
| 23 |
+
from routers import ratings
|
| 24 |
+
from routers import network_tools
|
| 25 |
+
from routers import (
|
| 26 |
+
pdf,
|
| 27 |
+
image,
|
| 28 |
+
audio,
|
| 29 |
+
video,
|
| 30 |
+
utility,
|
| 31 |
+
business,
|
| 32 |
+
developer,
|
| 33 |
+
converter_tools,
|
| 34 |
+
admin_auth,
|
| 35 |
+
stats,
|
| 36 |
+
ads,
|
| 37 |
+
tool_tracking,
|
| 38 |
+
image_tools,
|
| 39 |
+
devtools,
|
| 40 |
+
)
|
| 41 |
+
from routers.pdf_watermark import router as watermark_router
|
| 42 |
+
from routers.universal_converter_full import router as universal_converter_router
|
| 43 |
+
|
| 44 |
+
# -------------------------------------------------------
|
| 45 |
+
# π APP INIT
|
| 46 |
+
# -------------------------------------------------------
|
| 47 |
+
app = FastAPI(title="Tools Backend API", version="1.0.0")
|
| 48 |
+
|
| 49 |
+
class LargeUploadMiddleware(BaseHTTPMiddleware):
|
| 50 |
+
async def dispatch(self, request, call_next):
|
| 51 |
+
request.scope["client_max_size"] = 5 * 1024 * 1024 * 1024
|
| 52 |
+
return await call_next(request)
|
| 53 |
+
|
| 54 |
+
app.add_middleware(LargeUploadMiddleware)
|
| 55 |
+
|
| 56 |
+
# -------------------------------------------------------
|
| 57 |
+
# π CORS (Includes Hugging Face & Production)
|
| 58 |
+
# -------------------------------------------------------
|
| 59 |
+
LOCAL_ORIGINS = [
|
| 60 |
+
"http://localhost:3000",
|
| 61 |
+
"http://127.0.0.1:3000",
|
| 62 |
+
"http://localhost:7860",
|
| 63 |
+
]
|
| 64 |
+
|
| 65 |
+
PRODUCTION_ORIGINS = [
|
| 66 |
+
"https://cloudaipdf.com",
|
| 67 |
+
"https://www.cloudaipdf.com",
|
| 68 |
+
"https://api.cloudaipdf.com",
|
| 69 |
+
"https://upload.cloudaipdf.com",
|
| 70 |
+
]
|
| 71 |
+
|
| 72 |
+
app.add_middleware(
|
| 73 |
+
CORSMiddleware,
|
| 74 |
+
allow_origins=LOCAL_ORIGINS + PRODUCTION_ORIGINS,
|
| 75 |
+
allow_origin_regex=r"https://.*\.hf\.space", # β
Allows Hugging Face Space URLs
|
| 76 |
+
allow_credentials=True,
|
| 77 |
+
allow_methods=["*"],
|
| 78 |
+
allow_headers=["*"],
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
# -------------------------------------------------------
|
| 82 |
+
# πͺ SESSIONS
|
| 83 |
+
# -------------------------------------------------------
|
| 84 |
+
app.add_middleware(
|
| 85 |
+
SessionMiddleware,
|
| 86 |
+
secret_key=getattr(settings, "SECRET_KEY", "default-fallback-secret-key-32chars"),
|
| 87 |
+
same_site="none",
|
| 88 |
+
https_only=True,
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
# -------------------------------------------------------
|
| 92 |
+
# π STATIC FILES
|
| 93 |
+
# -------------------------------------------------------
|
| 94 |
+
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 95 |
+
app.mount("/uploads", StaticFiles(directory="uploads"), name="uploads")
|
| 96 |
+
|
| 97 |
+
# -------------------------------------------------------
|
| 98 |
+
# π‘οΈ ADMIN (LOAD FIRST)
|
| 99 |
+
# -------------------------------------------------------
|
| 100 |
+
setup_admin(app)
|
| 101 |
+
|
| 102 |
+
# -------------------------------------------------------
|
| 103 |
+
# π ROUTERS
|
| 104 |
+
# -------------------------------------------------------
|
| 105 |
+
app.include_router(pdf.router, prefix="/pdf")
|
| 106 |
+
app.include_router(image.router, prefix="/image")
|
| 107 |
+
app.include_router(image_tools.router, prefix="/image-tools")
|
| 108 |
+
app.include_router(image_tools.router, prefix="/converters")
|
| 109 |
+
app.include_router(audio.router, prefix="/audio")
|
| 110 |
+
app.include_router(video.router, prefix="/video")
|
| 111 |
+
app.include_router(utility.router, prefix="/utility")
|
| 112 |
+
app.include_router(business.router, prefix="/business")
|
| 113 |
+
app.include_router(developer.router, prefix="/developer")
|
| 114 |
+
app.include_router(converter_tools.router, prefix="/tools")
|
| 115 |
+
app.include_router(universal_converter_router, prefix="/convert")
|
| 116 |
+
app.include_router(network_tools.router, prefix="/network")
|
| 117 |
+
app.include_router(ads.router)
|
| 118 |
+
app.include_router(devtools.router)
|
| 119 |
+
app.include_router(stats.router)
|
| 120 |
+
app.include_router(tool_tracking.router)
|
| 121 |
+
app.include_router(ratings_router)
|
| 122 |
+
app.include_router(admin_auth.router, prefix="/admin-auth")
|
| 123 |
+
|
| 124 |
+
# -------------------------------------------------------
|
| 125 |
+
# π HEALTH CHECK
|
| 126 |
+
# -------------------------------------------------------
|
| 127 |
+
@app.get("/")
|
| 128 |
+
def home():
|
| 129 |
+
return {"message": "Tools Backend Running Successfully!"}
|
| 130 |
+
|
| 131 |
+
@app.get("/health", include_in_schema=False)
|
| 132 |
+
def health():
|
| 133 |
+
return {"status": "ok"}
|
models/__pycache__/stats_model.cpython-312.pyc
ADDED
|
Binary file (836 Bytes). View file
|
|
|
models/__pycache__/stats_model.cpython-39.pyc
ADDED
|
Binary file (953 Bytes). View file
|
|
|
models/admin_user.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# models/admin_user.py
|
| 2 |
+
from sqlalchemy import Column, Integer, String, DateTime, func
|
| 3 |
+
from core.database import Base
|
| 4 |
+
|
| 5 |
+
class AdminUser(Base):
|
| 6 |
+
__tablename__ = "admin_users"
|
| 7 |
+
|
| 8 |
+
id = Column(Integer, primary_key=True, index=True)
|
| 9 |
+
username = Column(String(150), nullable=False, unique=True, index=True)
|
| 10 |
+
password_hash = Column(String(300), nullable=False)
|
| 11 |
+
full_name = Column(String(200), nullable=True)
|
| 12 |
+
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
| 13 |
+
|