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,28 +42,26 @@
<!-- Page body -->
<div class="page-body">
<div class="container-xl">
<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="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">{{ __('Domains') }}</h3>
</div>
</div>
</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>
</div>
</div>
<footer class="footer footer-transparent d-print-none">

View file

@ -6,15 +6,19 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>{% block title %}{% endblock %} | Namingo</title>
<!-- CSS files -->
{% include 'partials/css.twig' %}
{% 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 {
--tblr-font-sans-serif: Inter, -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
--tblr-font-sans-serif: Inter, -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
}
</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">
@ -30,7 +34,7 @@
<div class="navbar-nav flex-row order-md-last">
<div class="nav-item d-none d-md-flex me-3">
<div class="btn-list">
<div class="dropdown">
<div class="dropdown">
<a href="#" class="btn dropdown-toggle" data-bs-toggle="dropdown"><span class="flag flag-country-gb-eng"></span>&nbsp;English</a>
<div class="dropdown-menu">
<a href="/lang?en_US" class="dropdown-item"><span class="flag flag-country-gb-eng"></span>&nbsp;English</a>
@ -41,12 +45,12 @@
</div>
<div class="d-none d-md-flex">
<a href="/mode" class="nav-link px-0 hide-theme-dark" title="Enable dark mode" data-bs-toggle="tooltip"
data-bs-placement="bottom">
data-bs-placement="bottom">
<!-- Download SVG icon from http://tabler-icons.io/i/moon -->
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /></svg>
</a>
<a href="/mode" class="nav-link px-0 hide-theme-light" title="Enable light mode" data-bs-toggle="tooltip"
data-bs-placement="bottom">
data-bs-placement="bottom">
<!-- Download SVG icon from http://tabler-icons.io/i/sun -->
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><circle cx="12" cy="12" r="4" /><path d="M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7" /></svg>
</a>

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);