Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelIT7 committed Jul 5, 2023
0 parents commit 9057bf1
Show file tree
Hide file tree
Showing 1,353 changed files with 103,242 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
97 changes: 97 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build and deploy

on:
push:
workflow_dispatch:

env:
PTERODACTYL: "/var/www/pterodactyl"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: ilammy/msvc-dev-cmd@v1
- uses: leafo/gh-actions-lua@v10
with:
luaVersion: "5.1.5"

- name: build
run: |
cd addons
lua addons.lua
mv additional_cmds.txt ../panel
cd ../
cd panel
zip -r panel.zip ./
mv panel.zip ../
- name: prepare deploy
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.SSH_IP }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
password: ${{ secrets.SSH_PASSWORD }}
port: 22
script: |
cd ${{ env.PTERODACTYL }}
sudo chown -R pterodactyl-updater:pterodactyl-updater ${{ env.PTERODACTYL }}
sudo rm -rf *
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- name: upload zip
uses: wlixcc/SFTP-Deploy-Action@v1.2.4
with:
username: '${{ secrets.SSH_USER }}'
server: '${{ secrets.SSH_IP }}'
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
local_path: './panel.zip'
remote_path: '${{ env.PTERODACTYL }}'
sftpArgs: '-o ConnectTimeout=5'
password: '${{ secrets.SSH_PASSWORD }}'

- name: setup deploy
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.SSH_IP }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
password: ${{ secrets.SSH_PASSWORD }}
port: 22
script: |
cd ${{ env.PTERODACTYL }}
unzip panel.zip
cd panel
mv {*,.[^.]*,..?*} ../ -f
cd ../
rm -rf panel/
rm -rf panel.zip
- name: deploy
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.SSH_IP }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
password: ${{ secrets.SSH_PASSWORD }}
port: 22
script: |
cd ${{ env.PTERODACTYL }}
mkdir storage/framework
mkdir storage/framework/cache
mkdir storage/framework/sessions
mkdir storage/framework/views
mkdir public/assets
chmod -R 755 storage/* bootstrap/cache
composer install --no-dev --optimize-autoloader
sh additional_cmds.txt
yarn install
yarn run build:production
php artisan optimize
rm additional_cmds.txt
sudo chown -R www-data:www-data ${{ env.PTERODACTYL }}*
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# website

This project aims to make it easier to customize Pterodactyl.  
If you make changes to the panel and then update it, all your changes are gone.  
With this Project, you only need to set up everything once, and then you only need up update the panel (the panel folder).  
It could happen that an Update causes the setup to fail, but this won't happen with every update, and it's easy to fix because it will mostly likely be only a few instructions or even just one that is broken.  
**NOTE: I originally created this just for me, but I think this could be useful for some People.**

## Setup
1. Clone this Repository into a Private repository of you.
2. Open the .github/workflows/workflow.yml and adjust the PATH if the panel isn't installed in `/var/www/pterodactyl`
3. Add all Github secrets that are needed for the workflow to work properly.
3.1 Add the SSH_IP secret that contains the Server IP where Pterodactyl is installed.
3.2 Add the SSH_USER secret that contains the username for the SSH User. (Don't use root!)
3.3 Add the SSH_PRIVATE_KEY or SSH_PASSWORD secret that contains the key or password for the SSH User. (I need to learn to use SSH Keys)
4. Give the SSH User all sudo permissions needed. (`chown`, `rm`)
5. Install Yarn

Now test the workflow and see if it works properly.
If the workflow had no errors, open your Panel and see if the Server Router has now Icons.
If it has, then everything works properly.

## Usage

See the [Addons folder](https://github.com/RaphaelIT7/pterodactyl-addons/tree/main/addons) that contains a list of all functions.
66 changes: 66 additions & 0 deletions addons/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Addons Function.

This project adds some LUA Functions to make it easier to edit files.

## Functions

#### ReplaceLine(file, line, replacement)
This function will replace the first occurrence of the given line with the given text.  
Arguments:  
        1. path = The path to the file like "routes/admin.php". All paths are relative to the panel folder.  
        2. line = The line to search for. NOTE: You currently need to have exactly the same spaces.  
        3. text = The text to replace the give line with.

#### AddAfterLine(file, line, text)
This function will add the given text to the first occurrence of the given line.
Arguments:
1. path = The path to the file like "routes/admin.php". All paths are relative to the panel folder.
2. line = The line to search for. NOTE: You currently need to have exactly the same spaces.
3. text = The text to add after the given line.

#### AddAboveLastLine(file, line, text)
This function will insert the given text above the last occurrence of the given line.
Arguments:
1. path = The path to the file like "routes/admin.php". All paths are relative to the panel folder.
2. line = The line to search for. NOTE: You currently need to have exactly the same spaces.
3. text = The text to add after the given line.

#### AddAboveLine(file, line, text)
This function will insert the given text above the first occurrence of the given line.
Arguments:
1. path = The path to the file like "routes/admin.php". All paths are relative to the panel folder.
2. line = The line to search for. NOTE: You currently need to have exactly the same spaces.
3. text = The text to add after the given line.

#### AppendFile(file, text)
This function will append the given text to the end of the file.
Arguments:
1. path = The path to the file like "routes/admin.php". All paths are relative to the panel folder.
2. text = The text to append to the end of the file.

#### CopyFolder(folder)
This function will copy all files and folder from the given path into the panel folder
Arguments:
1. folder = The folder containing all files/folders that should be copied into the panel folder.
2. additional = DO NOT ADD THIS ARGUMENT MANUALLY! If you add this argument, it will most likely break the whole function.

#### AddCommand(command)
This function will add a command that should be executed before the panel is compiled.
Arguments:
1. command = The command to execute before compiling the panel.

#### include(addon)
This function will load the given addon.
Arguments:
1. path = The path to the addon to load. All paths are relative to the addons folder.
**NOTE: This function should only be used in the addons.lua file!**

### Internal Functions
These are some functions that are used internally.

#### os.name()
Returns the name of the operating system.  
Can be "Windows", "Linux" or "MacOS".

#### string.Replace(string, replace, replacement)
This function searches in the given string (first argument) for the given string (second argument) and if it's found it replace it with the given replacement (third argument.)
4 changes: 4 additions & 0 deletions addons/addons.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off

lua addons.lua
pause
Loading

0 comments on commit 9057bf1

Please sign in to comment.