A project to replace pterodactyl and be a showcase of my Python and React skills.
- This project does not follow Open Authorization specification. Read the documentation.
- This project works hand in hand with its docker management daemon
Done? | Idea |
---|---|
✔️ | Make it possible when @inject_user is called user.cache are attributes |
✔️ | Rewrite the whole codebase to use global app context for all common functions. |
✔️ | Write a cache system - option to use SQLite |
✔️ | Implement the use of the new session system. |
✔️ | Rewrite the session system to not rely on python dictionaries. |
✔️ | Move the authentication routes to /auth/... |
✔️ | Decorator for authenticated routes. |
🖊️ | View and edit user data via API. |
❌ | Add create server routes. |
❌ | Replace sanic_dantic with my own solution. |
✔️ | Add email verification with code/link for signup. |
✔️ | Add option to login with email code/link. |
✔️ | Add 2FA and Oauth2 |
❌ | Regen backup codes... |
❌ | Create the entire plugin system from scratch. |
- Built with SQLAlchemy, allowing for connections to
SQLite
,Postgresql
,MySQL
,Oracle
,MS-SQL
,Firebird
,Sybase
.
- Ingegrated, out-the-box plugin support.
- Built with documentation, comments and moduled. This allows for easy contribution.
Download the files:
git clone https://github.com/Daftscientist/my-pterodactyl
Unzip the downloaded files:
Ubuntu: unzip my-pterodactyl-main.zip -d my-pterodactyl-main
Windows: zip file. tar -xf my-pterodactyl-main.zip
Make sure your in the backend folder:
cd backend
Check if python is installed:
python –version
OR
python3 -version
Make sure PIP package manager is installed:
python -m pip --version
OR
python3 -m pip --version
Install required dependencies:
pip install -r requirements.txt
OR
pip3 install -r requirements.txt
Run the backend API:
sanic main
Use ctrl+c
to stop the backend running.
Creating virtual environments:
python -m venv
OR
python3 -m venv
Entering the virtual environment:
Unix or MacOS - bash shell: source /venv/bin/activate
Unix or MacOS - csh shell: source /venv/bin/activate.csh
Unix or MacOS - fish shell: source /venv/bin/activate.fish
Windows - Command Prompt: venv\Scripts\activate.bat
Windows - PowerShell: venv\Scripts\Activate.ps1
Running the backend API with live reloading:
sanic main --reload
Running the backend API in debug mode:
sanic main --debug
You can combine sanic main --dev
for development.
Creating a user:
import requests
API_URL = "http://localhost:8080/api/v1"
response = requests.post(API_URL + "/user/create", json={
"username": "example_username",
"email": "user@example.com",
"password": "password1",
"repeated_password": "password1"
})
print(response.json())
Logging in:
import requests
API_URL = "http://localhost:8080/api/v1"
response = requests.post(API_URL + "/user/login", json={
"email": "user@example.com",
"password": "password1"
})
print(response.json())
print(response.cookies.get_dict().session)
Logging out (cookies from login must be included in the request):
import requests
API_URL = "http://localhost:8080/api/v1"
response = requests.post(API_URL + "/user/logout", cookies={'session': 'jwt-encoded-string'})
print(response.json())
Example error:
{
"error": "Page not found",
"status": 404,
"path": "/api/v1/user/nothing",
"request_id": "request-id",
"timestamp": "May 10, 2023, 12:00:00 AM"
}
When stumbling across an exception during a production installation of this project, this rarity will be written to the log file. This file, located in backend/localstorage/exceptions.log
, will provide the error ID (provided to the user in the UI), message, HTTP code and timestamp.
ID: 9ac65dcb-fbe3-4ce0-af0e-5136c70fe2f1 - Message: 'Invalid response type <coroutine object Success at 0x0000024A20732960> (need HTTPResponse)' - Code: 500 - Timestamp: 2023-05-23 20:38:26.521845
Once this information is gathered, check through all open and already solved GitHub issues before reporting it to the development team.
We welcome contributions from the community! To contribute to this project, please follow the guidelines below:
Fork the repository and create your branch. Set up the development environment. Make your changes and test thoroughly. Submit a pull request, clearly describing the changes you've made. Please make sure to follow our code of conduct and be respectful to all contributors.
This project is licensed under the Apache License 2.0.