B
Blueprint8mo ago
Bob

Correct web route

Hey, so what would be the correct web route, i am currently using /blueprint/web/adminauditlogs/log which says 405 (Method Not Allowed)
38 Replies
Emma
Emma8mo ago
Where did you get that route from?
Bob
BobOP8mo ago
I have tried multiple routes to make it work One of them Uh anyone?
Emma
Emma8mo ago
try /extensions/adminauditlogs/log
Bob
BobOP8mo ago
requests.js:1

POST http://redacted/extensions/adminauditlogs/log 419 (unknown status)
Emma
Emma8mo ago
how does your route look like
Bob
BobOP8mo ago
<?php

Route::post('/log', [Pterodactyl\Http\Controllers\Admin\adminauditlogsExtensionController::class, 'log'])
->name('admin.extensions.adminauditlogs.log');
<?php

Route::post('/log', [Pterodactyl\Http\Controllers\Admin\adminauditlogsExtensionController::class, 'log'])
->name('admin.extensions.adminauditlogs.log');
Oh sh- i forgot to close the php tag
Emma
Emma8mo ago
no thats not the issue you don't have to close those
Bob
BobOP8mo ago
Oh
Emma
Emma8mo ago
im so confused why is your route name admin.extensions.adminauditlogs.log wont question it okay uhhh lets see https://http.cat/419 does your requests.js even send the request
Bob
BobOP8mo ago
I asummed that would make /log only work in only admin area
Emma
Emma8mo ago
uhh no
Bob
BobOP8mo ago
👍 , that's the chrome console
Emma
Emma8mo ago
you'll have to check if your user is admin yourself probably through the route file or controller do you have the log function in your controller
Bob
BobOP8mo ago
if (!$request->user() || !$request->user()->root_admin) { return response()->json(['error' => 'Unauthorized'], 403); } this would do it?
Emma
Emma8mo ago
i dunno
Bob
BobOP8mo ago
Yup
Bob
BobOP8mo ago
No description
Emma
Emma8mo ago
try just returning something without all that other logic to see if it returns anything at all
Bob
BobOP8mo ago
Nope it's not
Emma
Emma8mo ago
is there anything else in your controller that could be screwing stuff up
Bob
BobOP8mo ago
There's this
No description
Emma
Emma8mo ago
1. what this is not how controllers work mate well specifically looking at $this->version
Bob
BobOP8mo ago
Ah yeah I am supposed to use: public function __construct( private ViewFactory $view, private BlueprintExtensionLibrary $blueprint, private ConfigRepository $config, private SettingsRepositoryInterface $settings, ){}
Emma
Emma8mo ago
why are you making a variable for root and then just putting it as $rootPath neither sigh could you not use AI for everything you can use it but dont just paste it in your code editor
Emma
Emma8mo ago
blueprint.zip
Powerful, fast and developer-friendly extension framework for Pterodactyl. Utilize extension APIs, inject HTML, modify stylesheets, package extensions and so much more.
Bob
BobOP8mo ago
<?php namespace Pterodactyl\Http\Controllers\Admin\Extensions\adminauditlogs; use Illuminate\Http\Request; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Extensions\Blueprint; class adminauditlogsExtensionController extends Controller { protected Blueprint $blueprint; protected string $version;
public function construct(Blueprint $blueprint) { parent::construct(); $this->blueprint = $blueprint; $this->version = config('blueprint.version', 'undefined'); } public function index(): View { return view('admin.extensions.adminauditlogs.admin', [ 'blueprint' => $this->blueprint, 'version' => $this->version, 'root' => '/admin/extensions/adminauditlogs' ]); } public function log(Request $request) { return response()->json(['message' => 'Test response']); } } This is the complete file
Emma
Emma8mo ago
yeah this is ai slop there is no Pterodactyl\Extensions\Blueprint there is no config('blueprint.version')
Bob
BobOP8mo ago
Ah mb
Emma
Emma8mo ago
refer to this for a proper controller bootstrap
Bob
BobOP8mo ago
I just let the AI do it this time unlike the subdomains domain manager one, MB Gonna remake it
<?php

namespace Pterodactyl\Http\Controllers\Admin\Extensions\adminauditlogs;

use Illuminate\View\View;
use Illuminate\View\Factory as ViewFactory;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Admin\BlueprintAdminLibrary as BlueprintExtensionLibrary;

class adminauditlogsExtensionController extends Controller
{
public function __construct(
private ViewFactory $view,
private BlueprintExtensionLibrary $blueprint,
) {}

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

public function log(Request $request): JsonResponse
{
return response()->json(['message' => 'Test response']);
}
}
<?php

namespace Pterodactyl\Http\Controllers\Admin\Extensions\adminauditlogs;

use Illuminate\View\View;
use Illuminate\View\Factory as ViewFactory;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Admin\BlueprintAdminLibrary as BlueprintExtensionLibrary;

class adminauditlogsExtensionController extends Controller
{
public function __construct(
private ViewFactory $view,
private BlueprintExtensionLibrary $blueprint,
) {}

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

public function log(Request $request): JsonResponse
{
return response()->json(['message' => 'Test response']);
}
}
This would do? I'll take my time remaking it without AI this time
Emma
Emma8mo ago
way better well not quite actually admin.extensions.adminauditlogs.admin should be admin.extensions.adminauditlogs.index
Bob
BobOP8mo ago
Uh, do you know how to remove the css in admin added by a blueprint extension
Emma
Emma8mo ago
any reason for doing so?
Bob
BobOP8mo ago
I messed it up a bit Happened few days ago (before subdomains manager was released), i was trying to make a admin theme and it i messed the css up
Emma
Emma8mo ago
can't you just like uninstall the theme
Bob
BobOP8mo ago
Nope it's not working The files got removed but the css didn't
Emma
Emma8mo ago
ctrl shift r?
Bob
BobOP8mo ago
Did that multiple times alr

Did you find this page helpful?