Added domains page

- Added api security fixes
- GUI updates
This commit is contained in:
Pinga 2023-08-30 14:33:12 +03:00
parent dd893c2822
commit 54fb9c26f2
12 changed files with 62 additions and 29 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3
cp/public/assets/js/tabulator.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{% extends "layouts/app.twig" %} {% extends "layouts/app.twig" %}
{% block title %}Domains{% endblock %} {% block title %}{{ __('Domains') }}{% endblock %}
{% block content %} {% block content %}
<div class="page-wrapper"> <div class="page-wrapper">
@ -14,7 +14,7 @@
Overview Overview
</div> </div>
<h2 class="page-title"> <h2 class="page-title">
Domains {{ __('Domains') }}
</h2> </h2>
</div> </div>
<!-- Page title actions --> <!-- Page title actions -->
@ -42,25 +42,23 @@
<!-- Page body --> <!-- Page body -->
<div class="page-body"> <div class="page-body">
<div class="container-xl"> <div class="container-xl">
<div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-header">
<div id="table-default" class="table-responsive"> <h3 class="card-title">{{ __('Domains') }}</h3>
<table id="domainTable" class="table"> </div>
<thead> <div class="card-body border-bottom py-3">
<tr> <div class="d-flex">
<th><button class="table-sort" data-sort="sort-id">ID</button></th> <div class="ms-auto text-secondary">
<th><button class="table-sort" data-sort="sort-name">Name</button></th> Search:
<th><button class="table-sort" data-sort="sort-crdate">Creation Date</button></th> <div class="ms-2 d-inline-block">
<th><button class="table-sort" data-sort="sort-exdate">Expiration Date</button></th> <input id="search-input" type="text" class="form-control form-control-sm" aria-label="Search invoice">
<th><button class="table-sort" data-sort="sort-registrant">Registrant</button></th> </div>
<th><button class="table-sort" data-sort="sort-status">Status</button></th> </div>
<th>Actions</th> </div>
</tr> </div>
</thead> <div class="table-responsive">
<tbody class="table-tbody"> <div id="domainTable"></div>
<!-- Rows will be added here dynamically -->
</tbody>
</table>
</div> </div>
</div> </div>
</div> </div>

View file

@ -6,7 +6,11 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge"/> <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>{% block title %}{% endblock %} | Namingo</title> <title>{% block title %}{% endblock %} | Namingo</title>
<!-- CSS files --> <!-- CSS files -->
{% if route_is('domains') or route_is('contacts') or route_is('hosts') or route_is('logs') %}
{% include 'partials/css-tables.twig' %}
{% else %}
{% include 'partials/css.twig' %} {% include 'partials/css.twig' %}
{% endif %}
<style> <style>
@import url('https://rsms.me/inter/inter.css'); @import url('https://rsms.me/inter/inter.css');
:root { :root {
@ -14,7 +18,7 @@
} }
</style> </style>
</head> </head>
<body class="layout-fluid"{% if screen_mode == 'dark' %} data-bs-theme="dark"{% endif %}> <body{% if screen_mode == 'dark' %} data-bs-theme="dark"{% endif %}>
<div class="page"> <div class="page">
<!-- Navbar --> <!-- Navbar -->
<header class="navbar navbar-expand-md navbar-light d-print-none"> <header class="navbar navbar-expand-md navbar-light d-print-none">

View file

@ -0,0 +1,6 @@
<link href="/assets/css/tabler.min.css" rel="stylesheet"/>
<link href="/assets/css/tabler-flags.min.css" rel="stylesheet"/>
<link href="/assets/css/tabler-payments.min.css" rel="stylesheet"/>
<link href="/assets/css/tabler-vendors.min.css" rel="stylesheet"/>
<link href="/assets/css/tabulator.min.css" rel="stylesheet">
<link href="/assets/css/tabulator_bootstrap5.min.css" rel="stylesheet">

View file

@ -62,6 +62,17 @@ $app->any('/api[/{params:.*}]', function (
'password' => $db['mysql']['password'], 'password' => $db['mysql']['password'],
'database' => $db['mysql']['database'], 'database' => $db['mysql']['database'],
'basePath' => '/api', 'basePath' => '/api',
'middlewares' => 'authorization,sanitation',
'authorization.tableHandler' => function ($operation, $tableName) {
$restrictedTables = ['users', 'contact_authInfo', 'contact_postalInfo', 'domain_authInfo', 'secdns'];
return !in_array($tableName, $restrictedTables);
},
'authorization.columnHandler' => function ($operation, $tableName, $columnName) {
return !($tableName == 'registrar' && $columnName == 'pw');
},
'sanitation.handler' => function ($operation, $tableName, $column, $value) {
return is_string($value) ? strip_tags($value) : $value;
},
]); ]);
$api = new Api($config); $api = new Api($config);
$response = $api->handle($request); $response = $api->handle($request);