diff --git a/api/server/index.js b/api/server/index.js index 3e57ed546..c6d9978f5 100644 --- a/api/server/index.js +++ b/api/server/index.js @@ -3,6 +3,7 @@ const hapi = require('@hapi/hapi'); const hapiReactViews = require('hapi-react-views'); const joi = require('@hapi/joi'); const notifier = require('node-notifier'); +const path = require('path'); require('tuxharness'); @@ -54,7 +55,7 @@ function getViewsConfig() { isCached: true, path: './', partialsPath: './', - relativeTo: __dirname, + relativeTo: path.join(__dirname, '../../'), }; } diff --git a/api/server/plugins/album/lib/index.js b/api/server/plugins/album/lib/index.js index 7c2b66783..e011b4101 100644 --- a/api/server/plugins/album/lib/index.js +++ b/api/server/plugins/album/lib/index.js @@ -30,7 +30,7 @@ const handler = (request, reply) => new Promise((resolve) => { gallery, raw: isRaw = false, } = request.query; - const viewPath = 'plugins/album/components/page.jsx'; + const viewPath = 'api/server/plugins/album/components/page.jsx'; const applyCloud = (response) => ((cloud === 'dropbox') ? applyDropbox(response) : response); const handleResponse = (json) => ((isRaw) ? resolve(json) : resolve(reply.view(viewPath, json))); diff --git a/api/server/plugins/album/test/index.spec.js b/api/server/plugins/album/test/index.spec.js index 518ac9171..6a1a62c20 100644 --- a/api/server/plugins/album/test/index.spec.js +++ b/api/server/plugins/album/test/index.spec.js @@ -37,7 +37,7 @@ test('Verify /view/album route', { skip: false }, (describe) => { engines: { jsx: hapiReactViews, }, - relativeTo: path.join(__dirname, '../../../'), + relativeTo: path.join(__dirname, '../../../../../'), }; const request = { diff --git a/api/server/plugins/editAlbum/lib/index.js b/api/server/plugins/editAlbum/lib/index.js index 63c628a0a..f4401b85a 100644 --- a/api/server/plugins/editAlbum/lib/index.js +++ b/api/server/plugins/editAlbum/lib/index.js @@ -9,7 +9,7 @@ const handler = ({ query: { raw: isRaw } }, reply) => new Promise((resolve) => { return context; }; - const viewPath = 'plugins/editAlbum/components/page.jsx'; + const viewPath = 'api/server/plugins/editAlbum/components/page.jsx'; const handleResponse = ({ body: { galleries: json } }) => ((isRaw) ? resolve(reply(formatJson(json))) diff --git a/api/server/plugins/home/lib/index.js b/api/server/plugins/home/lib/index.js index 8cd858031..6eff6a451 100644 --- a/api/server/plugins/home/lib/index.js +++ b/api/server/plugins/home/lib/index.js @@ -2,7 +2,7 @@ const gallery = require('../../../../../app/src/galleries'); async function handler(request, reply) { const isRaw = request.query.raw; - const viewPath = 'plugins/home/components/page.jsx'; + const viewPath = 'api/server/plugins/home/components/page.jsx'; const { body: { galleries } } = await gallery.get(); const out = { galleries }; diff --git a/api/server/plugins/home/test/index.spec.js b/api/server/plugins/home/test/index.spec.js index a144e71a1..1ecad1bab 100644 --- a/api/server/plugins/home/test/index.spec.js +++ b/api/server/plugins/home/test/index.spec.js @@ -28,7 +28,7 @@ tape('Verify home / route', { skip: false }, (describe) => { engines: { jsx: hapiReactViews, }, - relativeTo: path.join(__dirname, '../../../'), + relativeTo: path.join(__dirname, '../../../../../'), }; const request = { diff --git a/api/server/plugins/video/lib/index.js b/api/server/plugins/video/lib/index.js index 59caed8c0..3007e1120 100644 --- a/api/server/plugins/video/lib/index.js +++ b/api/server/plugins/video/lib/index.js @@ -2,7 +2,7 @@ const validation = require('../../../lib/validation'); const handler = (request, reply) => new Promise((resolve) => { const isRaw = request.query.raw; - const viewPath = 'plugins/video/components/page.jsx'; + const viewPath = 'api/server/plugins/video/components/page.jsx'; const handleResponse = (json) => ((isRaw) ? resolve(json) : resolve(reply.view(viewPath, json))); handleResponse({ video: request.query }); diff --git a/api/server/plugins/video/test/index.spec.js b/api/server/plugins/video/test/index.spec.js index 8d7c1f2f6..671ee357c 100644 --- a/api/server/plugins/video/test/index.spec.js +++ b/api/server/plugins/video/test/index.spec.js @@ -33,7 +33,7 @@ tape('Verify /video route', { skip: false }, (describe) => { engines: { jsx: hapiReactViews, }, - relativeTo: path.join(__dirname, '../../../'), + relativeTo: path.join(__dirname, '../../../../../'), }; const request = { diff --git a/api/server/test/casesDefinition.js b/api/server/test/casesDefinition.js index 2bcda4fc3..c1e5d0e97 100644 --- a/api/server/test/casesDefinition.js +++ b/api/server/test/casesDefinition.js @@ -26,7 +26,7 @@ function execHapi({ engines: { jsx: hapiReactViews, }, - relativeTo: path.join(__dirname, '../../'), + relativeTo: path.join(__dirname, '../../../../'), }; try {