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

View file

@ -6,7 +6,11 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>{% block title %}{% endblock %} | Namingo</title>
<!-- 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' %}
{% endif %}
<style>
@import url('https://rsms.me/inter/inter.css');
:root {
@ -14,7 +18,7 @@
}
</style>
</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">
<!-- Navbar -->
<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'],
'database' => $db['mysql']['database'],
'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);
$response = $api->handle($request);