#Correct web route

1 messages · Page 1 of 1 (latest)

tall pewter
#

Hey, so what would be the correct web route, i am currently using /blueprint/web/adminauditlogs/log which says 405 (Method Not Allowed)

pale zenith
#

Where did you get that route from?

tall pewter
#

One of them

tall pewter
#

Uh anyone?

pale zenith
#

try /extensions/adminauditlogs/log

tall pewter
pale zenith
tall pewter
#
<?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

pale zenith
#

no thats not the issue

#

you don't have to close those

tall pewter
#

Oh

pale zenith
#

im so confused

#

why is your route name admin.extensions.adminauditlogs.log

#

wont question it

#

okay uhhh lets see

#

does your requests.js even send the request

tall pewter
pale zenith
#

uhh no

tall pewter
pale zenith
#

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

tall pewter
#

if (!$request->user() || !$request->user()->root_admin) {
return response()->json(['error' => 'Unauthorized'], 403);
}

this would do it?

pale zenith
#

i dunno

pale zenith
#

try just returning something without all that other logic

#

to see if it returns anything at all

tall pewter
#

Nope it's not

pale zenith
#

is there anything else in your controller that could be screwing stuff up

tall pewter
#

There's this

pale zenith
#
  1. what
#

this is not how controllers work mate

#

well specifically looking at $this->version

tall pewter
#

Ah yeah

#

I am supposed to use:
public function __construct(
private ViewFactory $view,
private BlueprintExtensionLibrary $blueprint,
private ConfigRepository $config,
private SettingsRepositoryInterface $settings,
){}

pale zenith
#

why are you making a variable for root and then just putting it as $rootPath

pale zenith
#

sigh could you not use AI for everything

#

you can use it but dont just paste it in your code editor

tall pewter
#

<?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

pale zenith
#

yeah this is ai slop

#

there is no Pterodactyl\Extensions\Blueprint

#

there is no config('blueprint.version')

tall pewter
#

Ah mb

pale zenith
tall pewter
#

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']);
    }
}
#

This would do?

#

I'll take my time remaking it without AI this time

pale zenith
#

way better

#

well not quite actually

#

admin.extensions.adminauditlogs.admin should be admin.extensions.adminauditlogs.index

tall pewter
tall pewter
#

Happened few days ago (before subdomains manager was released), i was trying to make a admin theme and it i messed the css up

pale zenith
#

can't you just like uninstall the theme

tall pewter
#

The files got removed but the css didn't

pale zenith
#

ctrl shift r?