1
0
mirror of https://github.com/trambarhq/relaks-wordpress-example.git synced 2025-09-02 20:52:33 +02:00

Adjusted code for Cordova.

This commit is contained in:
Chung Leong
2019-02-06 19:23:46 +01:00
parent 231861e500
commit b5c8cf4fb0
15 changed files with 69 additions and 175007 deletions

View File

@@ -116,7 +116,7 @@ async function handlePageRequest(req, res, next) {
res.set({ 'Cache-Control': CACHE_CONTROL });
// remember the URLs used by the page
pageDependencies[path] = page.sourceURLs.map(addTrailingSlash);
pageDependencies[path] = page.sourceURLs;
}
res.type('html').send(page.html);
} catch (err) {
@@ -196,25 +196,6 @@ async function scheduleCachePurge() {
}
}
/**
* Add trailing slash to URL
*
* @param {String} url
*
* @return {String}
*/
function addTrailingSlash(url) {
let qi = url.indexOf('?');
if (qi === -1) {
qi = url.length;
}
let lc = url.charAt(qi - 1);
if (lc !== '/') {
url = url.substr(0, qi) + '/' + url.substr(qi);
}
return url;
}
// restart process when a source file changes
Object.keys(require.cache).forEach((path) => {
if (!/node_modules/.test(path)) {