mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-08 04:03:12 +03:00
17 lines
531 B
JavaScript
17 lines
531 B
JavaScript
|
var debug = require('debug')('ghost:admin:serviceworker'),
|
||
|
path = require('path');
|
||
|
|
||
|
// Route: index
|
||
|
// Path: /ghost/sw.js|sw-registration.js
|
||
|
// Method: GET
|
||
|
module.exports = function adminController(req, res) {
|
||
|
/*jslint unparam:true*/
|
||
|
debug('serviceworker called');
|
||
|
|
||
|
var sw = path.join(__dirname, '..', '..', 'built', 'assets', 'sw.js'),
|
||
|
swr = path.join(__dirname, '..', '..', 'built', 'assets', 'sw-registration.js'),
|
||
|
fileToSend = req.url === '/sw.js' ? sw : swr;
|
||
|
|
||
|
res.sendFile(fileToSend);
|
||
|
};
|