Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Zip and Attach to Release
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Create ZIP archive
run: |
zip -r pterosort.blueprint . -x "*.git*" "*node_modules*" ".editorconfig"

- name: Extract JS from wrapper.blade.php
run: |
sed -n '/<script>/,/<\/script>/p' ./dashboard/wrapper.blade.php | \
sed '1d;$d' > pterosort.js

- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
files: |
pterosort.blueprint
pterosort.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1,161 changes: 0 additions & 1,161 deletions PteroSort.js

This file was deleted.

16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# PteroSort
Pterodactyl server sorter made for vannila/unmodified pterodactyl panel!

PteroSort can be installed as **browser add-on via Tapermonkey** or as **[blueprint](https://blueprint.zip/) extension**.

## PteroSort as blueprint extension

First, make sure you have [blueprint installed](https://blueprint.zip/docs/?page=getting-started/Installation) on your pterodactyl server.

Download the latest `pterosort.blueprint` file from the [release section](https://github.com/Ricman-MC/PteroSort/releases/latest) and place it inside your pterodactyl panel directory `/var/www/pterodactyl/`.

Then just run the command `blueprint -install pterosort` to install PteroSort to your panel.

To uninstall it, run `blueprint -r pterosort`.

## PteroSort as browser add-on via Tapermonkey

Use this version if you don't have admin access to the server or just want to use it on your browser as Add-on.

Script on [GreasyFork](https://greasyfork.org/cs/scripts/528298-pterosort-category) or you can download from releases on github and install it manually

[Tapermonkey](https://www.tampermonkey.net/) Required!!!
Expand Down
37 changes: 37 additions & 0 deletions conf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
info:
name: "PteroSort Category"
identifier: "pterosort"
description: "Pterodactyl server sorter with categories"
flags: ""
version: "1.3.0"
target: "beta-2024-12"
author: "Ricman"
icon: "folder_icon.png"
website: "https://github.com/Ricman-MC/PteroSort"

admin:
view: "view.blade.php"
controller: "controller.php"
css: ""
wrapper: ""

dashboard:
css: ""
wrapper: "dashboard/wrapper.blade.php"
components: ""

data:
directory: ""
public: ""
console: ""

requests:
views: ""
app: "controllers"
routers:
application: ""
client: ""
web: "routes.php"

database:
migrations: "migrations"
36 changes: 36 additions & 0 deletions controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
// Register namespace
namespace Pterodactyl\Http\Controllers\Admin\Extensions\{identifier};

use Illuminate\View\View;
use Illuminate\View\Factory as ViewFactory;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Admin\BlueprintAdminLibrary as BlueprintExtensionLibrary;
use Pterodactyl\Http\Requests\Admin\AdminFormRequest;
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Illuminate\Http\RedirectResponse;

// Register extension-specific ExtensionController class.
class {identifier}ExtensionController extends Controller
{
// Construct class variables.
public function __construct(
private ViewFactory $view,
private BlueprintExtensionLibrary $blueprint,
private ConfigRepository $config,
private SettingsRepositoryInterface $settings,
) {}

// Render page upon GET request.
public function index(): View
{
return $this->view->make(
'admin.extensions.{identifier}.index', [
'root' => "/admin/extensions/{identifier}",
'blueprint' => $this->blueprint,
]
);
}
}

102 changes: 102 additions & 0 deletions controllers/ExtensionDashboardController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php
// Register namespace
namespace Pterodactyl\BlueprintFramework\Extensions\{identifier};

use Illuminate\View\View;
use Illuminate\View\Factory as ViewFactory;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Admin\BlueprintAdminLibrary as BlueprintExtensionLibrary;
use Pterodactyl\Http\Requests\Admin\AdminFormRequest;
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\DB;

class ExtensionDashboardController extends Controller
{
// Construct class variables.
public function __construct(
private BlueprintExtensionLibrary $blueprint,
private ConfigRepository $config,
private SettingsRepositoryInterface $settings,
) {}

public function getDragLock() {
$user = auth()->user();
if ($user == null) {return response(null);}
$data = DB::table('{identifier}_userdata')->where('user_id', $user->id)->first();
if ($data == null) {return response(null);}
return response($data->dragLock);
}

public function getCategories() {
$user = auth()->user();
if ($user == null) {return response(null);}
$data = DB::table('{identifier}_userdata')->where('user_id', $user->id)->first();
if ($data == null) {return response(null);}
return response($data->categories);
}

public function getOrder() {
$user = auth()->user();
if ($user == null) {return response(null);}
$data = DB::table('{identifier}_userdata')->where('user_id', $user->id)->first();
if ($data == null) {return response(null);}
return response($data->order);
}

public function getCategoriesOthers() {
$user = auth()->user();
if ($user == null) {return response(null);}
$data = DB::table('{identifier}_userdata')->where('user_id', $user->id)->first();
if ($data == null) {return response(null);}
return response($data->categories_others);
}

public function getOrderOthers() {
$user = auth()->user();
if ($user == null) {return response(null);}
$data = DB::table('{identifier}_userdata')->where('user_id', $user->id)->first();
if ($data == null) {return response(null);}
return response($data->order_others);
}

public function update({identifier}SettingsFormRequest $request)
{

$userId = auth()->user()->id;
$valuesToUpdate = $request->normalize();

DB::table('{identifier}_userdata')
->updateOrInsert(
['user_id' => $userId],
$valuesToUpdate
);

return response()->json($valuesToUpdate);
}
}
class {identifier}SettingsFormRequest extends AdminFormRequest
{
public function rules(): array
{
return [
'dragLock' => 'nullable|numeric|min:0|max:1',
'categories' => 'nullable|string',
'order' => 'nullable|string',
'categories_others' => 'nullable|string',
'order_others' => 'nullable|string',
];
}

public function attributes(): array
{
return [
'dragLock' => 'DragLock',
'categories' => 'Categorie',
'order' => 'Order',
'categories_others' => 'Others Categorie',
'order_others' => 'Others Order',
];
}
}
Loading