Skip to content

Commit

Permalink
Updated deps, added in 8.3 to tests, and fixed the biggest bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BelleNottelling committed Nov 24, 2023
1 parent 77d3464 commit af93171
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php_version: [8.0, 8.1, 8.2]
php_version: [8.0, 8.1, 8.2, 8.3]

steps:
- uses: actions/checkout@v4
Expand Down
79 changes: 40 additions & 39 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/Plugins/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public function __construct()
{
$this->antAuth = new AntAuth;
$this->antTwig = new AntTwig;
}

public function checkAuth()
{
$this->antAuth->checkAuth();
}

Expand Down
11 changes: 11 additions & 0 deletions src/Plugins/Admin/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,66 +13,77 @@ public function registerRoutes(App $app)
$adminPlugin = new Admin;

$app->get('/admin', function (Request $request, Response $response) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->renderIndex();
});

$app->get('/admin/config', function (Request $request, Response $response) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->config();
});

$app->get('/admin/config/edit', function (Request $request, Response $response) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->editConfig();
});

$app->post('/admin/config/save', function (Request $request, Response $response) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->saveConfig();
});

$app->get('/admin/users', function (Request $request, Response $response) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->users();
});

$app->get('/admin/users/add', function (Request $request, Response $response) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->addUser();
});

$app->get('/admin/users/edit/{username}', function (Request $request, Response $response, array $args) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->editUser($args);
});

$app->get('/admin/users/resetpassword/{username}', function (Request $request, Response $response, array $args) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->resetpassword($args);
});

$app->post('/admin/user/save', function (Request $request, Response $response) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->saveUser();
});

$app->post('/admin/user/savenew', function (Request $request, Response $response) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->saveUser();
});

$app->get('/admin/pages/regenerate', function (Request $request, Response $response) use ($adminPlugin) {
$adminPlugin->checkAuth();
$adminPlugin->setRequest($request);
$adminPlugin->SetResponse($response);
return $adminPlugin->regeneratePages();
Expand Down
8 changes: 1 addition & 7 deletions src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
return $antCMS->serveContent();
});

$app->get('/', function (Request $request, Response $response) use ($antCMS) {
$app->get('/{path:.*}', function (Request $request, Response $response) use ($antCMS) {
if (!file_exists(antUsersList)) {
AntCMS::redirectWithoutRequest('/profile/firsttime');
}
Expand All @@ -65,10 +65,4 @@
return $antCMS->renderPage();
});

$app->get('/{path:.*}', function (Request $request, Response $response) use ($antCMS) {
$antCMS->setRequest($request);
$antCMS->SetResponse($response);
return $antCMS->renderPage();
});

$app->run();

0 comments on commit af93171

Please sign in to comment.