CodeIgniter 4 website:
- Catalog 999 SGK (lớp 1-12) từ API, lọc theo lớp/môn/NXB, tìm kiếm
- Trang chủ grouped browse (bậc học -> lớp -> môn, ưu tiên môn quan trọng)
- Chi tiết sách: metadata đầy đủ, cover nghệ thuật /thumb/{W}x{H}/
- Đọc online qua gate captcha + countdown, PDF viewer pdf.js
- Download: captcha + token một lần + auto cache-bust version
- Tự đồng bộ catalog/cover khi API thay đổi (refresh:catalog)
- Legal: DMCA, miễn trừ trách nhiệm, điều khoản, bảo mật, liên hệ
35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
|
|
use CodeIgniter\Router\RouteCollection;
|
|
|
|
/** @var RouteCollection $routes */
|
|
|
|
// Home = catalog
|
|
$routes->get('/', 'Books::index');
|
|
|
|
// Books
|
|
$routes->get('/sach', 'Books::index');
|
|
$routes->get('/sach/(:segment)', 'Books::show/$1');
|
|
|
|
// Media proxy (viewer-only PDF + covers) & on-demand thumbnails
|
|
$routes->get('/media/cover/(:segment)', 'Media::cover/$1');
|
|
$routes->get('/media/pdf/(:segment)', 'Media::pdf/$1');
|
|
$routes->get('/thumb/(:any)/(:any)', 'Thumb::serve/$1/$2');
|
|
|
|
// Reader: /doc/{id} — captcha gate then online reading page
|
|
$routes->get('/doc/(:segment)', 'Download::page/$1');
|
|
$routes->post('/doc/(:segment)', 'Download::page/$1');
|
|
$routes->post('/pdf-token/(:segment)', 'Download::token/$1');
|
|
$routes->get('/captcha', 'Download::captcha');
|
|
$routes->get('/tai-ve/(:segment)/(:segment)', 'Download::fetch/$1/$2');
|
|
|
|
// Static pages + contact
|
|
$routes->get('/lien-he', 'Pages::contact');
|
|
$routes->post('/lien-he', 'Pages::contact');
|
|
$routes->get('/(:segment)', 'Pages::view/$1');
|
|
|
|
// API health
|
|
$routes->get('/api/health', static function () {
|
|
return service('response')->setJSON(['ok' => true, 'time' => date(DATE_ATOM)]);
|
|
});
|