diff --git a/backend/.gitignore b/backend/.gitignore index 655560d..dbec00d 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -1,2 +1,161 @@ -.idea -app/config.py \ No newline at end of file +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +.idea/ +server/config.py \ No newline at end of file diff --git a/backend/docker/Dockerfile b/backend/docker/Dockerfile index b3a6bb0..6762aac 100644 --- a/backend/docker/Dockerfile +++ b/backend/docker/Dockerfile @@ -2,6 +2,6 @@ FROM python:3.9 WORKDIR /code COPY ../requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt -COPY ../app /code/app +COPY ../server /code/server -CMD ["uvicorn", "app.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"] \ No newline at end of file +CMD ["uvicorn", "server.api:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"] \ No newline at end of file diff --git a/backend/app/__init__.py b/backend/server/__init__.py similarity index 100% rename from backend/app/__init__.py rename to backend/server/__init__.py diff --git a/backend/app/api.py b/backend/server/api.py similarity index 86% rename from backend/app/api.py rename to backend/server/api.py index ba5fc1b..5bd4d02 100644 --- a/backend/app/api.py +++ b/backend/server/api.py @@ -6,13 +6,14 @@ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import StreamingResponse -from app import config -from app.config import log_config -from app.lib.epg.epg import EPGParser -from app.lib.streamer import Streamer -from app.lib.xtream import XTream +from server import config +from server.config import log_config +from server.lib.epg.epg import EPGParser +from server.lib.streamer import Streamer +from server.lib.xtream import XTream -dictConfig(log_config) +logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.DEBUG) +logger = logging.getLogger(__name__) provider = XTream( config.provider['server'], diff --git a/backend/app/config.sample.py b/backend/server/config.sample.py similarity index 100% rename from backend/app/config.sample.py rename to backend/server/config.sample.py diff --git a/backend/app/lib/__init__.py b/backend/server/lib/__init__.py similarity index 100% rename from backend/app/lib/__init__.py rename to backend/server/lib/__init__.py diff --git a/backend/app/lib/cache.py b/backend/server/lib/cache.py similarity index 100% rename from backend/app/lib/cache.py rename to backend/server/lib/cache.py diff --git a/backend/app/lib/epg/__init__.py b/backend/server/lib/epg/__init__.py similarity index 100% rename from backend/app/lib/epg/__init__.py rename to backend/server/lib/epg/__init__.py diff --git a/backend/app/lib/epg/epg.py b/backend/server/lib/epg/epg.py similarity index 95% rename from backend/app/lib/epg/epg.py rename to backend/server/lib/epg/epg.py index 41dee14..37b448d 100644 --- a/backend/app/lib/epg/epg.py +++ b/backend/server/lib/epg/epg.py @@ -6,7 +6,7 @@ import requests import logging -from app.lib.epg import xmltv +from server.lib.epg import xmltv log = logging.getLogger(__name__) diff --git a/backend/app/lib/epg/xmltv.py b/backend/server/lib/epg/xmltv.py similarity index 100% rename from backend/app/lib/epg/xmltv.py rename to backend/server/lib/epg/xmltv.py diff --git a/backend/app/lib/streamer.py b/backend/server/lib/streamer.py similarity index 100% rename from backend/app/lib/streamer.py rename to backend/server/lib/streamer.py diff --git a/backend/app/lib/xtream.py b/backend/server/lib/xtream.py similarity index 98% rename from backend/app/lib/xtream.py rename to backend/server/lib/xtream.py index 6bc005e..aaeaced 100644 --- a/backend/app/lib/xtream.py +++ b/backend/server/lib/xtream.py @@ -1,6 +1,6 @@ from enum import Enum -from app.lib.cache import Cache +from server.lib.cache import Cache import requests diff --git a/frontend/package.json b/frontend/package.json index b5da2d4..334179a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -6,7 +6,6 @@ "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^12.0.0", "@testing-library/user-event": "^13.2.1", - "@windmill/react-ui": "^0.6.0", "autoprefixer": "^10.4.4", "hls.js": "^1.1.5", "postcss": "^8.4.12", @@ -16,6 +15,7 @@ "react-icons": "^4.3.1", "react-router-dom": "6", "react-scripts": "5.0.0", + "react-toastify": "^8.2.0", "tailwindcss": "^3.0.23", "typescript": "^4.4.2", "web-vitals": "^2.1.0" diff --git a/frontend/public/index.html b/frontend/public/index.html index 7b0f1df..d0d2da6 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -1,5 +1,5 @@ - + diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 96cf36c..badbdb5 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,10 +1,12 @@ import React from "react"; import { BrowserRouter, Route, Routes } from "react-router-dom"; +import { ToastContainer } from "react-toastify"; import { Layout } from "./containers"; function App() { return ( + } /> diff --git a/frontend/src/components/header.component.tsx b/frontend/src/components/header.component.tsx index 6fbc9c8..1ed0276 100644 --- a/frontend/src/components/header.component.tsx +++ b/frontend/src/components/header.component.tsx @@ -1,13 +1,13 @@ import React from "react"; +import { VscDebug } from "react-icons/vsc"; import { Avatar, Badge, Input, Dropdown, DropdownItem, - WindmillContext, } from "@windmill/react-ui"; -import { SidebarContext } from "../context"; +import { SidebarContext, ThemeContext } from "../context"; import { BellIcon, MenuIcon, @@ -18,15 +18,26 @@ import { SearchIcon, SunIcon, } from "../icons"; +import { toast } from "react-toastify"; const Header = () => { - const { mode, toggleMode } = React.useContext(WindmillContext); const { toggleSidebar } = React.useContext(SidebarContext); - + const { theme, toggleTheme } = React.useContext(ThemeContext); const [isNotificationsMenuOpen, setIsNotificationsMenuOpen] = React.useState(false); const [isProfileMenuOpen, setIsProfileMenuOpen] = React.useState(false); + const _debuggles = () => { + toast("🦄 Wow so easy!", { + position: "top-right", + autoClose: 5000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + }); + }; const handleNotificationsClick = () => { setIsNotificationsMenuOpen(!isNotificationsMenuOpen); }; @@ -51,7 +62,7 @@ const Header = () => { @@ -61,10 +72,19 @@ const Header = () => {
  • +
  • +
  • + + > diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js index 7430ba7..fb81339 100644 --- a/frontend/tailwind.config.js +++ b/frontend/tailwind.config.js @@ -1,5 +1,4 @@ const defaultTheme = require("tailwindcss/defaultTheme"); -const windmill = require("@windmill/react-ui/config"); const config = { darkMode: "class", @@ -7,7 +6,7 @@ const config = { theme: { extend: { fontFamily: { - Rampart: ["Raleway", "sans-serif"], + 'xtreamium-font': ["Raleway", "sans-serif"], }, }, }, diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 4ec0f4c..e7f4789 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -2924,6 +2924,11 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" +clsx@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.1.1.tgz#98b3134f9abbdf23b2663491ace13c5c03a73188" + integrity sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA== + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -7228,6 +7233,13 @@ react-side-effect@^2.1.0: resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-2.1.1.tgz#66c5701c3e7560ab4822a4ee2742dee215d72eb3" integrity sha512-2FoTQzRNTncBVtnzxFOk2mCpcfxQpenBMbk5kSVBg5UcPqV9fRbgY2zhb7GTWWOlpFmAxhClBDlIq8Rsubz1yQ== +react-toastify@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/react-toastify/-/react-toastify-8.2.0.tgz#ef7d56bdfdc6272ca6b228368ab564721c3a3244" + integrity sha512-Pg2Ju7NngAamarFvLwqrFomJ57u/Ay6i6zfLurt/qPynWkAkOthu6vxfqYpJCyNhHRhR4hu7+bySSeWWJu6PAg== + dependencies: + clsx "^1.1.1" + react-transition-group@4.4.1: version "4.4.1" resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.1.tgz#63868f9325a38ea5ee9535d828327f85773345c9" diff --git a/server/server.py b/server/server.py index c50483b..cdaa265 100755 --- a/server/server.py +++ b/server/server.py @@ -49,9 +49,11 @@ class CORSRequestHandler(SimpleHTTPRequestHandler): query.get("mpv_args", [])) except FileNotFoundError as e: missing_bin('mpv') - self.send_response(200, "playing...") + self.send_response(501, "mpv application missing...") + self.end_headers() + return - self.send_response(200) + self.send_response(200, "playing...") self.end_headers()