mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Moved server/web/site to frontend/web
- we're slowly trying to draw the lines between the backend and the frontend correctly - these files deal only with serving the frontend so they should live there - there are lots of mixed requires in these files, so having them in the right place makes that clear
This commit is contained in:
parent
8c9b4d18bf
commit
faea2da596
@ -88,7 +88,7 @@ class Bridge {
|
||||
reloadFrontend() {
|
||||
const apiVersion = this.getFrontendApiVersion();
|
||||
debug('reload frontend', apiVersion);
|
||||
const siteApp = require('./server/web/site/app');
|
||||
const siteApp = require('./frontend/web/app');
|
||||
siteApp.reload({apiVersion});
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
const debug = require('@tryghost/debug')('frontend');
|
||||
const path = require('path');
|
||||
const express = require('../../../shared/express');
|
||||
const express = require('../../shared/express');
|
||||
const cors = require('cors');
|
||||
const {URL} = require('url');
|
||||
const errors = require('@tryghost/errors');
|
||||
|
||||
// App requires
|
||||
const config = require('../../../shared/config');
|
||||
const config = require('../../shared/config');
|
||||
const constants = require('@tryghost/constants');
|
||||
const storage = require('../../adapters/storage');
|
||||
const urlService = require('../../services/url');
|
||||
const urlUtils = require('../../../shared/url-utils');
|
||||
const sitemapHandler = require('../../../frontend/services/sitemap/handler');
|
||||
const appService = require('../../../frontend/services/apps');
|
||||
const themeEngine = require('../../../frontend/services/theme-engine');
|
||||
const storage = require('../../server/adapters/storage');
|
||||
const urlService = require('../../server/services/url');
|
||||
const urlUtils = require('../../shared/url-utils');
|
||||
const sitemapHandler = require('../services/sitemap/handler');
|
||||
const appService = require('../services/apps');
|
||||
const themeEngine = require('../services/theme-engine');
|
||||
const themeMiddleware = themeEngine.middleware;
|
||||
const membersService = require('../../services/members');
|
||||
const offersService = require('../../services/offers');
|
||||
const membersService = require('../../server/services/members');
|
||||
const offersService = require('../../server/services/offers');
|
||||
const siteRoutes = require('./routes');
|
||||
const shared = require('../shared');
|
||||
const shared = require('../../server/web/shared');
|
||||
const mw = require('./middleware');
|
||||
|
||||
const STATIC_IMAGE_URL_PREFIX = `/${urlUtils.STATIC_IMAGE_URL_PREFIX}`;
|
@ -2,9 +2,9 @@ const _ = require('lodash');
|
||||
const path = require('path');
|
||||
const {GhostError} = require('@tryghost/errors');
|
||||
const imageTransform = require('@tryghost/image-transform');
|
||||
const storage = require('../../../adapters/storage');
|
||||
const activeTheme = require('../../../../frontend/services/theme-engine/active');
|
||||
const config = require('../../../../shared/config');
|
||||
const storage = require('../../../server/adapters/storage');
|
||||
const activeTheme = require('../../services/theme-engine/active');
|
||||
const config = require('../../../shared/config');
|
||||
|
||||
const SIZE_PATH_REGEX = /^\/size\/([^/]+)\//;
|
||||
const TRAILING_SLASH_REGEX = /\/+$/;
|
@ -1,6 +1,6 @@
|
||||
const express = require('../../../../shared/express');
|
||||
const config = require('../../../../shared/config');
|
||||
const urlUtils = require('../../../../shared/url-utils');
|
||||
const express = require('../../../shared/express');
|
||||
const config = require('../../../shared/config');
|
||||
const urlUtils = require('../../../shared/url-utils');
|
||||
|
||||
const adminRedirect = (path) => {
|
||||
return function doRedirect(req, res) {
|
@ -1,11 +1,11 @@
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
const config = require('../../../../shared/config');
|
||||
const {blogIcon} = require('../../../lib/image');
|
||||
const storage = require('../../../adapters/storage');
|
||||
const urlUtils = require('../../../../shared/url-utils');
|
||||
const settingsCache = require('../../../../shared/settings-cache');
|
||||
const config = require('../../../shared/config');
|
||||
const {blogIcon} = require('../../../server/lib/image');
|
||||
const storage = require('../../../server/adapters/storage');
|
||||
const urlUtils = require('../../../shared/url-utils');
|
||||
const settingsCache = require('../../../shared/settings-cache');
|
||||
|
||||
let content;
|
||||
|
@ -2,8 +2,8 @@ const crypto = require('crypto');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const errors = require('@tryghost/errors');
|
||||
const config = require('../../../../shared/config');
|
||||
const urlUtils = require('../../../../shared/url-utils');
|
||||
const config = require('../../../shared/config');
|
||||
const urlUtils = require('../../../shared/url-utils');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
|
||||
const messages = {
|
@ -1,8 +1,8 @@
|
||||
const path = require('path');
|
||||
const config = require('../../../../shared/config');
|
||||
const config = require('../../../shared/config');
|
||||
const constants = require('@tryghost/constants');
|
||||
const themeEngine = require('../../../../frontend/services/theme-engine');
|
||||
const express = require('../../../../shared/express');
|
||||
const themeEngine = require('../../services/theme-engine');
|
||||
const express = require('../../../shared/express');
|
||||
|
||||
function isBlackListedFileType(file) {
|
||||
const blackListedFileTypes = ['.hbs', '.md', '.json'];
|
@ -1,7 +1,9 @@
|
||||
const debug = require('@tryghost/debug')('routing');
|
||||
const routing = require('../../../frontend/services/routing');
|
||||
const urlService = require('../../services/url');
|
||||
const routeSettings = require('../../services/route-settings');
|
||||
|
||||
const routing = require('../services/routing');
|
||||
// NOTE: temporary import from the frontend, will become a backend service soon
|
||||
const urlService = require('../../server/services/url');
|
||||
const routeSettings = require('../../server/services/route-settings');
|
||||
|
||||
module.exports = function siteRoutes(options = {}) {
|
||||
debug('site Routes', options);
|
@ -19,7 +19,7 @@ module.exports = (options) => {
|
||||
frontendApp.use(shared.middlewares.urlRedirects.frontendSSLRedirect);
|
||||
|
||||
frontendApp.lazyUse('/members', require('../members'));
|
||||
frontendApp.use('/', require('../site')(options));
|
||||
frontendApp.use('/', require('../../../frontend/web')(options));
|
||||
|
||||
return frontendApp;
|
||||
};
|
||||
|
@ -1,8 +1,8 @@
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const storage = require('../../../../../../core/server/adapters/storage');
|
||||
const activeTheme = require('../../../../../../core/frontend/services/theme-engine/active');
|
||||
const handleImageSizes = require('../../../../../../core/server/web/site/middleware/handle-image-sizes.js');
|
||||
const storage = require('../../../../../core/server/adapters/storage');
|
||||
const activeTheme = require('../../../../../core/frontend/services/theme-engine/active');
|
||||
const handleImageSizes = require('../../../../../core/frontend/web/middleware/handle-image-sizes.js');
|
||||
|
||||
// @TODO make these tests lovely and non specific to implementation
|
||||
describe('handleImageSizes middleware', function () {
|
@ -1,10 +1,10 @@
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const express = require('../../../../../../core/shared/express');
|
||||
const serveFavicon = require('../../../../../../core/server/web/site/middleware/serve-favicon');
|
||||
const settingsCache = require('../../../../../../core/shared/settings-cache');
|
||||
const storage = require('../../../../../../core/server/adapters/storage');
|
||||
const configUtils = require('../../../../../utils/configUtils');
|
||||
const express = require('../../../../../core/shared/express');
|
||||
const serveFavicon = require('../../../../../core/frontend/web/middleware/serve-favicon');
|
||||
const settingsCache = require('../../../../../core/shared/settings-cache');
|
||||
const storage = require('../../../../../core/server/adapters/storage');
|
||||
const configUtils = require('../../../../utils/configUtils');
|
||||
const path = require('path');
|
||||
|
||||
describe('Serve Favicon', function () {
|
||||
@ -55,7 +55,7 @@ describe('Serve Favicon', function () {
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.png';
|
||||
|
||||
storage.getStorage().storagePath = path.join(__dirname, '../../../../../utils/fixtures/images/');
|
||||
storage.getStorage().storagePath = path.join(__dirname, '../../../../utils/fixtures/images/');
|
||||
localSettingsCache.icon = 'favicon.png';
|
||||
|
||||
res = {
|
||||
@ -75,7 +75,7 @@ describe('Serve Favicon', function () {
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.ico';
|
||||
|
||||
storage.getStorage().storagePath = path.join(__dirname, '../../../../../utils/fixtures/images/');
|
||||
storage.getStorage().storagePath = path.join(__dirname, '../../../../utils/fixtures/images/');
|
||||
localSettingsCache.icon = 'favicon.ico';
|
||||
|
||||
res = {
|
||||
@ -95,7 +95,7 @@ describe('Serve Favicon', function () {
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.ico';
|
||||
|
||||
storage.getStorage().storagePath = path.join(__dirname, '../../../../../utils/fixtures/images/');
|
||||
storage.getStorage().storagePath = path.join(__dirname, '../../../../utils/fixtures/images/');
|
||||
localSettingsCache.icon = 'myicon.ico';
|
||||
|
||||
res = {
|
||||
@ -135,7 +135,7 @@ describe('Serve Favicon', function () {
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.png';
|
||||
|
||||
configUtils.set('paths:contentPath', path.join(__dirname, '../../../../../test/utils/fixtures/'));
|
||||
configUtils.set('paths:contentPath', path.join(__dirname, '../../../../test/utils/fixtures/'));
|
||||
localSettingsCache.icon = 'favicon.ico';
|
||||
|
||||
res = {
|
||||
@ -152,7 +152,7 @@ describe('Serve Favicon', function () {
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.ico';
|
||||
|
||||
configUtils.set('paths:contentPath', path.join(__dirname, '../../../../../test/utils/fixtures/'));
|
||||
configUtils.set('paths:contentPath', path.join(__dirname, '../../../../test/utils/fixtures/'));
|
||||
localSettingsCache.icon = 'favicon.png';
|
||||
|
||||
res = {
|
||||
@ -169,7 +169,7 @@ describe('Serve Favicon', function () {
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.png';
|
||||
|
||||
configUtils.set('paths:publicFilePath', path.join(__dirname, '../../../../../test/utils/fixtures/'));
|
||||
configUtils.set('paths:publicFilePath', path.join(__dirname, '../../../../test/utils/fixtures/'));
|
||||
localSettingsCache.icon = '';
|
||||
|
||||
res = {
|
@ -1,7 +1,7 @@
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const fs = require('fs-extra');
|
||||
const servePublicFile = require('../../../../../../core/server/web/site/middleware/serve-public-file');
|
||||
const servePublicFile = require('../../../../../core/frontend/web/middleware/serve-public-file');
|
||||
|
||||
describe('servePublicFile', function () {
|
||||
let res;
|
@ -1,9 +1,9 @@
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
|
||||
const express = require('../../../../../../core/shared/express');
|
||||
const themeEngine = require('../../../../../../core/frontend/services/theme-engine');
|
||||
const staticTheme = require('../../../../../../core/server/web/site/middleware/static-theme');
|
||||
const express = require('../../../../../core/shared/express');
|
||||
const themeEngine = require('../../../../../core/frontend/services/theme-engine');
|
||||
const staticTheme = require('../../../../../core/frontend/web/middleware/static-theme');
|
||||
|
||||
describe('staticTheme', function () {
|
||||
let expressStaticStub;
|
Loading…
Reference in New Issue
Block a user