diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0111090..005bbfd 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -1569,6 +1569,8 @@ $routes->get('app/nursing/(:any)', 'Api\v1\NursingApi::pwaIndex'); $routes->get('app/doctor', 'Api\v1\DoctorApi::pwaIndex'); $routes->get('app/doctor/(:any)', 'Api\v1\DoctorApi::pwaIndex'); $routes->get('app/queue', 'Api\v1\DoctorApi::queueIndex'); +$routes->get('app/queue/sw.js', 'Api\v1\DoctorApi::queueSw'); +$routes->get('app/queue/manifest.json', 'Api\v1\DoctorApi::queueManifest'); $routes->get('app/queue/(:any)', 'Api\v1\DoctorApi::queueIndex'); // Dedicated RESTful JSON API v1 Group for React PWAs & Mobile Apps diff --git a/app/Controllers/Api/v1/DoctorApi.php b/app/Controllers/Api/v1/DoctorApi.php index 6fadb7e..0ee5208 100644 --- a/app/Controllers/Api/v1/DoctorApi.php +++ b/app/Controllers/Api/v1/DoctorApi.php @@ -676,6 +676,33 @@ class DoctorApi extends BaseController return redirect()->to(base_url('app')); } + /** + * Serves the Service Worker script for /app/queue + */ + public function queueSw() + { + $swPath = FCPATH . 'App/Queue/sw.js'; + if (file_exists($swPath)) { + return $this->response->setHeader('Content-Type', 'application/javascript') + ->setHeader('Service-Worker-Allowed', '/') + ->setBody(file_get_contents($swPath)); + } + return $this->response->setStatusCode(404); + } + + /** + * Serves manifest.json for /app/queue + */ + public function queueManifest() + { + $manifestPath = FCPATH . 'App/Queue/manifest.json'; + if (file_exists($manifestPath)) { + return $this->response->setHeader('Content-Type', 'application/json') + ->setBody(file_get_contents($manifestPath)); + } + return $this->response->setStatusCode(404); + } + /** * GET api/v1/opd/queue/live * Returns real-time OPD Tokens & Hospital Showcase Ads for TV Queue Display diff --git a/public/App/Queue/index.html b/public/App/Queue/index.html index ceef0a6..cb0981e 100644 --- a/public/App/Queue/index.html +++ b/public/App/Queue/index.html @@ -4,7 +4,7 @@