repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/data/importer/importers/RevueImporter.test.js | ghost/core/test/unit/server/data/importer/importers/RevueImporter.test.js | const assert = require('assert/strict');
const sinon = require('sinon');
const RevueImporter = require('../../../../../../core/server/data/importer/importers/importer-revue');
const JSONToHTML = require('../../../../../../core/server/data/importer/importers/json-to-html');
describe('Revue Importer', function () {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/data/importer/importers/ContentFileImporter.test.js | ghost/core/test/unit/server/data/importer/importers/ContentFileImporter.test.js | const assert = require('node:assert/strict');
const _ = require('lodash');
const sinon = require('sinon');
const ContentFileImporter = require('../../../../../../core/server/data/importer/importers/ContentFileImporter');
describe('ContentFileImporter', function () {
afterEach(function () {
sinon.restore()... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/data/importer/importers/data/newsletters.test.js | ghost/core/test/unit/server/data/importer/importers/data/newsletters.test.js | const should = require('should');
const NewslettersImporter = require('../../../../../../../core/server/data/importer/importers/data/NewslettersImporter');
const fakeNewsletters = [{
id: '1',
name: 'Daily newsletter',
slug: 'daily-newsletter',
description: '',
sender_name: 'Jamie',
sender_email... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/data/importer/importers/data/posts.test.js | ghost/core/test/unit/server/data/importer/importers/data/posts.test.js | const should = require('should');
const find = require('lodash/find');
const PostsImporter = require('../../../../../../../core/server/data/importer/importers/data/PostsImporter');
describe('PostsImporter', function () {
describe('#beforeImport', function () {
it('converts post.page to post.type', function... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/data/importer/importers/data/settings.test.js | ghost/core/test/unit/server/data/importer/importers/data/settings.test.js | const find = require('lodash/find');
const should = require('should');
const SettingsImporter = require('../../../../../../../core/server/data/importer/importers/data/SettingsImporter');
describe('SettingsImporter', function () {
describe('#beforeImport', function () {
it('Removes the password setting', fu... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/data/importer/importers/data/products.test.js | ghost/core/test/unit/server/data/importer/importers/data/products.test.js | const assert = require('assert/strict');
const ProductsImporter = require('../../../../../../../core/server/data/importer/importers/data/ProductsImporter');
const fakeProducts = [{
id: 'product_1',
name: 'New One',
slug: 'new-one',
active: 1,
welcome_page_url: null,
visibility: 'public',
tr... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/data/importer/handlers/ImporterContentFileHandler.test.js | ghost/core/test/unit/server/data/importer/handlers/ImporterContentFileHandler.test.js | const assert = require('assert/strict');
const ImporterContentFileHandler = require('../../../../../../core/server/data/importer/handlers/ImporterContentFileHandler');
describe('ImporterContentFileHandler', function () {
it('creates an instance', function () {
const contentFileImporter = new ImporterConten... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/data/importer/handlers/image.test.js | ghost/core/test/unit/server/data/importer/handlers/image.test.js | require('should');
const sinon = require('sinon');
const _ = require('lodash');
const ImageHandler = require('../../../../../../core/server/data/importer/handlers/image');
const storage = require('../../../../../../core/server/adapters/storage');
const configUtils = require('../../../../../utils/configUtils');
descri... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/admin/controller.test.js | ghost/core/test/unit/server/web/admin/controller.test.js | require('should');
const sinon = require('sinon');
const path = require('path');
const configUtils = require('../../../../utils/configUtils');
const controller = require('../../../../../core/server/web/admin/controller');
describe('Admin App', function () {
describe('controller', function () {
const req = ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/admin/middleware.test.js | ghost/core/test/unit/server/web/admin/middleware.test.js | const assert = require('node:assert/strict');
const sinon = require('sinon');
// Thing we are testing
const redirectAdminUrls = require('../../../../../core/server/web/admin/middleware/redirect-admin-urls');
describe('Admin App', function () {
afterEach(function () {
sinon.restore();
});
describe(... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/api/middleware/version-match.test.js | ghost/core/test/unit/server/web/api/middleware/version-match.test.js | require('should');
const sinon = require('sinon');
const versionMatch = require('../../../../../../core/server/web/api/middleware/version-match');
describe('Version Mismatch', function () {
let req;
let res;
let getStub;
let nextStub;
afterEach(function () {
sinon.restore();
});
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/api/middleware/upload.test.js | ghost/core/test/unit/server/web/api/middleware/upload.test.js | const should = require('should');
const validation = require('../../../../../../core/server/web/api/middleware/upload')._test;
const imageFixturePath = ('../../../../../utils/fixtures/images/');
const fs = require('fs');
const path = require('path');
const assert = require('assert/strict');
describe('web utils', funct... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/api/middleware/cors.test.js | ghost/core/test/unit/server/web/api/middleware/cors.test.js | const should = require('should');
const sinon = require('sinon');
const rewire = require('rewire');
const configUtils = require('../../../../../utils/configUtils');
let cors = rewire('../../../../../../core/server/web/api/middleware/cors')[1];
let corsCaching = rewire('../../../../../../core/server/web/api/middleware/... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/api/middleware/update-user-last-seen.test.js | ghost/core/test/unit/server/web/api/middleware/update-user-last-seen.test.js | const should = require('should');
const sinon = require('sinon');
const moment = require('moment');
const updateUserLastSeenMiddleware = require('../../../../../../core/server/web/api/middleware/update-user-last-seen');
describe('updateUserLastSeenMiddleware', function () {
afterEach(function () {
sinon.re... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/api/admin/middleware.test.js | ghost/core/test/unit/server/web/api/admin/middleware.test.js | const assert = require('node:assert/strict');
const sinon = require('sinon');
const errors = require('@tryghost/errors');
// Module under test
const middleware = require('../../../../../../core/server/web/api/endpoints/admin/middleware');
describe('Admin API Middleware', function () {
describe('tokenPermissionChe... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/api/canary/content/middleware.test.js | ghost/core/test/unit/server/web/api/canary/content/middleware.test.js | const should = require('should');
const middleware = require('../../../../../../../core/server/web/api/endpoints/content/middleware');
describe('Content API middleware', function () {
it('exports an authenticatePublic middleware', function () {
should.exist(middleware.authenticatePublic);
});
desc... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/parent/middleware/request-id.test.js | ghost/core/test/unit/server/web/parent/middleware/request-id.test.js | const should = require('should');
const sinon = require('sinon');
const validator = require('@tryghost/validator');
const requestId = require('../../../../../../core/server/web/parent/middleware/request-id');
describe('Request ID middleware', function () {
let res;
let req;
let next;
beforeEach(funct... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/parent/middleware/queue-request.test.js | ghost/core/test/unit/server/web/parent/middleware/queue-request.test.js | const assert = require('node:assert');
const sinon = require('sinon');
const queueRequest = require('../../../../../../core/server/web/parent/middleware/queue-request');
describe('Queue request middleware', function () {
let req, res, next, config, queueFactory, queue;
beforeEach(function () {
req = ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/parent/middleware/ghost-locals.test.js | ghost/core/test/unit/server/web/parent/middleware/ghost-locals.test.js | const should = require('should');
const sinon = require('sinon');
const ghostLocals = require('../../../../../../core/server/web/parent/middleware/ghost-locals');
describe('Theme Handler', function () {
let req;
let res;
let next;
beforeEach(function () {
req = sinon.spy();
res = sinon... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/shared/middleware/url-redirects.test.js | ghost/core/test/unit/server/web/shared/middleware/url-redirects.test.js | const should = require('should');
const sinon = require('sinon');
const rewire = require('rewire');
const configUtils = require('../../../../../utils/configUtils');
const urlRedirects = rewire('../../../../../../core/server/web/shared/middleware/url-redirects');
const {frontendSSLRedirect, adminSSLAndHostRedirect} = ur... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/shared/middleware/uncapitalise.test.js | ghost/core/test/unit/server/web/shared/middleware/uncapitalise.test.js | const should = require('should');
const sinon = require('sinon');
const uncapitalise = require('../../../../../../core/server/web/shared/middleware/uncapitalise');
// NOTE: all urls will have had trailing slashes added before uncapitalise is called
describe('Middleware: uncapitalise', function () {
let res;
l... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/shared/middleware/brute.test.js | ghost/core/test/unit/server/web/shared/middleware/brute.test.js | const should = require('should');
const sinon = require('sinon');
const brute = require('../../../../../../core/server/web/shared/middleware/brute');
describe('brute middleware', function () {
after(function () {
sinon.restore();
});
it('exports a contentApiKey method', function () {
shoul... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/shared/middleware/redirect-amp-urls.test.js | ghost/core/test/unit/server/web/shared/middleware/redirect-amp-urls.test.js | const sinon = require('sinon');
const redirectAmpUrls = require('../../../../../../core/server/web/shared/middleware/redirect-amp-urls');
describe('Middleware: redirectAmpUrls', function () {
let res;
let req;
let next;
beforeEach(function () {
res = {
redirect: sinon.spy(),
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/shared/middleware/max-limit-cap.test.js | ghost/core/test/unit/server/web/shared/middleware/max-limit-cap.test.js | const assert = require('assert/strict');
const sinon = require('sinon');
const configUtils = require('../../../../../utils/configUtils');
const maxLimitCap = require('../../../../../../core/server/web/shared/middleware/max-limit-cap');
describe('Max Limit Cap Middleware', function () {
let req;
let res;
le... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/shared/middleware/cache-control.test.js | ghost/core/test/unit/server/web/shared/middleware/cache-control.test.js | const should = require('should');
const sinon = require('sinon');
const cacheControl = require('../../../../../../core/server/web/shared/middleware/cache-control');
describe('Cache-Control middleware', function () {
let res;
beforeEach(function () {
res = {
set: sinon.spy()
};
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/server/web/shared/middleware/api/spam-prevention.test.js | ghost/core/test/unit/server/web/shared/middleware/api/spam-prevention.test.js | const should = require('should');
const spamPrevention = require('../../../../../../../core/server/web/shared/middleware/api/spam-prevention');
describe('Spam Prevention', function () {
it('exports a contentApiKey method', function () {
should.equal(typeof spamPrevention.contentApiKey, 'function');
});... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/sentry.test.js | ghost/core/test/unit/shared/sentry.test.js | const assert = require('assert/strict');
const sinon = require('sinon');
const configUtils = require('../../utils/configUtils');
const errors = require('@tryghost/errors');
const Sentry = require('@sentry/node');
const fakeDSN = 'https://aaabbbccc000111222333444555667@sentry.io/1234567';
let sentry;
describe('UNIT: ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/settings-cache.test.js | ghost/core/test/unit/shared/settings-cache.test.js | const should = require('should');
const sinon = require('sinon');
const _ = require('lodash');
const events = require('../../../core/server/lib/common/events');
// Testing the Private API
let CacheManager = require('../../../core/shared/settings-cache/CacheManager');
const publicSettings = require('../../../core/shar... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/max-limit-cap.test.js | ghost/core/test/unit/shared/max-limit-cap.test.js | const assert = require('assert/strict');
const sinon = require('sinon');
const rewire = require('rewire');
const configUtils = require('../../utils/configUtils');
describe('Shared Max Limit Cap', function () {
let maxLimitCap;
beforeEach(function () {
maxLimitCap = rewire('../../../core/shared/max-lim... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/labs.test.js | ghost/core/test/unit/shared/labs.test.js | const assert = require('assert/strict');
const sinon = require('sinon');
const configUtils = require('../../utils/configUtils');
const labs = require('../../../core/shared/labs');
const settingsCache = require('../../../core/shared/settings-cache');
function expectedLabsObject(obj) {
let enabledFlags = {};
l... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/custom-theme-settings-cache/cache.test.js | ghost/core/test/unit/shared/custom-theme-settings-cache/cache.test.js | const should = require('should');
const Cache = require('../../../../core/shared/custom-theme-settings-cache/CustomThemeSettingsCache');
describe('Cache', function () {
describe('populate()', function () {
it('fills cache from settings-like array', function () {
const cache = new Cache();
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/custom-theme-settings-cache/service.test.js | ghost/core/test/unit/shared/custom-theme-settings-cache/service.test.js | const should = require('should');
const _ = require('lodash');
const sinon = require('sinon');
const {ValidationError} = require('@tryghost/errors');
const nql = require('@tryghost/nql-lang');
const Cache = require('../../../../core/shared/custom-theme-settings-cache/CustomThemeSettingsCache');
const Service = requir... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/events/URLResourceUpdatedEvent.test.js | ghost/core/test/unit/shared/events/URLResourceUpdatedEvent.test.js | const assert = require('assert/strict');
const {URLResourceUpdatedEvent} = require('../../../../core/shared/events');
describe('URLResourceUpdatedEvent', function () {
it('exports a static create method to create instances', function () {
const event = URLResourceUpdatedEvent.create({
id: 'reso... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/config/utils.test.js | ghost/core/test/unit/shared/config/utils.test.js | const should = require('should');
const _ = require('lodash');
const configUtils = require('../../../../core/shared/config/utils');
let fakeConfig = {};
let fakeNconf = {};
let changedKey = [];
describe('Config Utils', function () {
describe('makePathsAbsolute', function () {
beforeEach(function () {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/config/loader.test.js | ghost/core/test/unit/shared/config/loader.test.js | const should = require('should');
const path = require('path');
const rewire = require('rewire');
const _ = require('lodash');
const configUtils = require('../../../utils/configUtils');
const sinon = require('sinon');
const localUtils = require('../../../../core/shared/config/utils');
describe('Config Loader', function... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/config/adapter_config.test.js | ghost/core/test/unit/shared/config/adapter_config.test.js | const should = require('should');
const path = require('path');
const configUtils = require('../../../utils/configUtils');
/**
* This is a somewhat legacy set of tests that check we get the right values for storage
* We should rethink what the purpose of these tests is.
*/
describe('Adapter Config', function () {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/unit/shared/config/helpers.test.js | ghost/core/test/unit/shared/config/helpers.test.js | require('should');
const configUtils = require('../../../utils/configUtils');
describe('vhost utils', function () {
beforeEach(function () {
configUtils.set('url', 'http://ghost.blog');
});
afterEach(async function () {
await configUtils.restore();
});
// url = 'https://ghost.blog... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/e2e-webhooks/site.test.js | ghost/core/test/e2e-webhooks/site.test.js | const {agentProvider, mockManager, fixtureManager, matchers} = require('../utils/e2e-framework');
const {anyGhostAgent, anyContentVersion, anyNumber} = matchers;
describe('site.* events', function () {
let adminAPIAgent;
let webhookMockReceiver;
before(async function () {
adminAPIAgent = await age... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/e2e-webhooks/members.test.js | ghost/core/test/e2e-webhooks/members.test.js | const {agentProvider, mockManager, fixtureManager, matchers} = require('../utils/e2e-framework');
const {anyGhostAgent, anyObjectId, anyISODateTime, anyUuid, anyContentVersion, anyNumber} = matchers;
const buildNewsletterSnapshot = () => {
const newsLetterSnapshot = {
id: anyObjectId
};
return new... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/e2e-webhooks/pages.test.js | ghost/core/test/e2e-webhooks/pages.test.js | const moment = require('moment-timezone');
const {
agentProvider,
mockManager,
fixtureManager,
matchers
} = require('../utils/e2e-framework');
const {
anyArray,
anyGhostAgent,
anyUuid,
anyLocalURL,
anyISODateTime,
anyObjectId,
anyContentVersion,
anyNumber
} = matchers;
c... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/e2e-webhooks/posts.test.js | ghost/core/test/e2e-webhooks/posts.test.js | const moment = require('moment-timezone');
const {agentProvider, mockManager, fixtureManager, matchers} = require('../utils/e2e-framework');
const {anyGhostAgent, anyArray, anyObjectId, anyISODateTime, anyUuid, anyContentVersion, anyNumber, anyLocalURL, anyString} = matchers;
const tierSnapshot = {
id: anyObjectId... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/test/e2e-webhooks/tags.test.js | ghost/core/test/e2e-webhooks/tags.test.js | const {agentProvider, mockManager, fixtureManager, matchers} = require('../utils/e2e-framework');
const {anyGhostAgent, anyObjectId, anyISODateTime, anyString, anyContentVersion, anyNumber, anyLocalURL} = matchers;
const tagSnapshot = {
created_at: anyISODateTime,
description: anyString,
id: anyObjectId,
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/bin/minify-assets.js | ghost/core/bin/minify-assets.js | #!/usr/bin/env node
/**
* Script to minify multiple JavaScript files using esbuild
* Supports per-file configuration for bundling and other options
*
* The tryghost/minifier package is not used because it is intended to be used at runtime,
* allowing for replacements to be made on the fly (e.g. for card-assets an... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/app.js | ghost/core/core/app.js | const sentry = require('./shared/sentry');
const express = require('./shared/express');
const config = require('./shared/config');
const logging = require('@tryghost/logging');
const urlService = require('./server/services/url');
const fs = require('fs');
const path = require('path');
const isMaintenanceModeEnabled =... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/boot.js | ghost/core/core/boot.js | // The Ghost Boot Sequence
// -----------------------
// - This is intentionally one big file at the moment, so that we don't have to follow boot logic all over the place
// - This file is FULL of debug statements so we can see timings for the various steps because the boot needs to be as fast as possible
// - As we ma... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/bridge.js | ghost/core/core/bridge.js | /**
* The Bridge
*
* The bridge is responsible for handing communication from the server to the frontend.
* Data should only be flowing server -> frontend.
* As the architecture improves, the number of cross requires here should go down
* Eventually, the aim is to make this a component that is initialized on boot... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/proxy.js | ghost/core/core/frontend/services/proxy.js | // This file contains everything that the helpers and frontend apps require from the core of Ghost
const settingsCache = require('../../shared/settings-cache');
const config = require('../../shared/config');
const settingsHelpers = require('../../server/services/settings-helpers');
// Require from the handlebars frame... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/handlebars.js | ghost/core/core/frontend/services/handlebars.js | /**
* This is a loose concept of a frontend handlebars toolkit
* Note: everything here gets deep-required from the theme-engine
* This indicates that the theme engine is a set of services, rather than a single service
* and could do with a further refactor.
*
* This at least keeps the deep requires in a single pl... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/apps/proxy.js | ghost/core/core/frontend/services/apps/proxy.js | const helperService = require('../../services/helpers');
const routingService = require('../../services/routing');
module.exports.getInstance = function getInstance() {
const appRouter = routingService.registry.getRouter('appRouter');
return {
helperService: {
registerAlias: helperService.... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/apps/index.js | ghost/core/core/frontend/services/apps/index.js | const debug = require('@tryghost/debug')('services:apps');
const tpl = require('@tryghost/tpl');
const logging = require('@tryghost/logging');
const errors = require('@tryghost/errors');
const config = require('../../../shared/config');
const loader = require('./loader');
const messages = {
appWillNotBeLoadedError... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/apps/loader.js | ghost/core/core/frontend/services/apps/loader.js | const path = require('path');
const _ = require('lodash');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const config = require('../../../shared/config');
const Proxy = require('./proxy');
const messages = {
noActivateMethodLoadingAppError: 'Error loading app named {name}; no ac... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rendering/render-entry.js | ghost/core/core/frontend/services/rendering/render-entry.js | const debug = require('@tryghost/debug')('services:routing:renderer:render-post');
const formatResponse = require('./format-response');
const renderer = require('./renderer');
/**
* @description Helper to handle rendering multiple resources.
*
* @param {Object} req
* @param {Object} res
* @returns {Closure)
*/
mo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rendering/index.js | ghost/core/core/frontend/services/rendering/index.js | module.exports = {
get renderEntries() {
return require('./render-entries');
},
get formatResponse() {
return require('./format-response');
},
get renderEntry() {
return require('./render-entry');
},
get renderer() {
return require('./renderer');
},
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rendering/error.js | ghost/core/core/frontend/services/rendering/error.js | /**
* @description Centralized error handling for API requests.
* @param {Function} next
* @returns {Function} handleErrorClosure
*/
function handleError(next) {
return function handleErrorClosure(err) {
// CASE: if we've thrown an error message of type: 'NotFound' then we found no path match, try next ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rendering/context.js | ghost/core/core/frontend/services/rendering/context.js | /**
* # Response context
*
* Figures out which context we are currently serving. The biggest challenge with determining this
* is that the only way to determine whether or not we are a post, or a page, is with data after all the
* data for the template has been retrieved.
*
* Contexts are determined based on 3 p... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rendering/format-response.js | ghost/core/core/frontend/services/rendering/format-response.js | const _ = require('lodash');
const hbs = require('../theme-engine/engine');
const {prepareContextResource} = require('../proxy');
const {isPage} = require('../data/checks');
/**
* @description Formats API response into handlebars/theme format.
*
* @return {Object} containing page variables
*/
function formatPageRe... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rendering/renderer.js | ghost/core/core/frontend/services/rendering/renderer.js | const path = require('path');
const debug = require('@tryghost/debug')('services:routing:renderer:renderer');
const {IncorrectUsageError} = require('@tryghost/errors');
const setContext = require('./context');
const templates = require('./templates');
const tpl = require('@tryghost/tpl');
const messages = {
couldNo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rendering/render-entries.js | ghost/core/core/frontend/services/rendering/render-entries.js | const debug = require('@tryghost/debug')('services:routing:renderer:render-entries');
const formatResponse = require('./format-response');
const renderer = require('./renderer');
/**
* @description Helper to handle rendering multiple resources.
*
* @param {Object} req
* @param {Object} res
* @returns {Closure)
*... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rendering/templates.js | ghost/core/core/frontend/services/rendering/templates.js | // # Templates
//
// Figure out which template should be used to render a request
// based on the templates which are allowed, and what is available in the theme
const _ = require('lodash');
const path = require('path');
const url = require('url');
const config = require('../../../shared/config');
const themeEngine = ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/ParentRouter.js | ghost/core/core/frontend/services/routing/ParentRouter.js | /**
* # Parent Router
*
* A wrapper around express.Router, which is controlled in Ghost.
*
* Intended to be extended anywhere that routes need to be registered in Ghost.
* Only allows for .use and .get at the moment - we don't have clear use-cases for anything else yet.
*/
const debug = require('@tryghost/debug... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/RSSRouter.js | ghost/core/core/frontend/services/routing/RSSRouter.js | const ParentRouter = require('./ParentRouter');
const urlUtils = require('../../../shared/url-utils');
const controllers = require('./controllers');
/**
* @description RSS Router, which should be used as a sub-router in other routes.
*
* "/rss" -> RSS Router
*/
class RSSRouter extends ParentRouter {
construct... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/StaticRoutesRouter.js | ghost/core/core/frontend/services/routing/StaticRoutesRouter.js | const debug = require('@tryghost/debug')('routing:static-routes-router');
const errors = require('@tryghost/errors');
const urlUtils = require('../../../shared/url-utils');
const RSSRouter = require('./RSSRouter');
const controllers = require('./controllers');
const middleware = require('./middleware');
const ParentRou... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/index.js | ghost/core/core/frontend/services/routing/index.js | const registry = require('./registry');
const RouterManager = require('./RouterManager');
const routerManager = new RouterManager({registry});
module.exports = {
routerManager: routerManager,
get registry() {
return registry;
}
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/registry.js | ghost/core/core/frontend/services/routing/registry.js | const _ = require('lodash');
let routes = [];
let routers = {};
/**
* @description The router registry is helpful for debugging purposes and let's you search existing routes and routers.
*/
module.exports = {
/**
* @description Get's called if you register a url pattern in express.
* @param {String} ro... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/UnsubscribeRouter.js | ghost/core/core/frontend/services/routing/UnsubscribeRouter.js | const ParentRouter = require('./ParentRouter');
const controllers = require('./controllers');
/**
* @description Unsubscribe Router.
*
* "/unsubscribe/" -> Unsubscribe Router
*/
class UnsubscribeRouter extends ParentRouter {
constructor() {
super('UnsubscribeRouter');
// @NOTE: hardcoded, not ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/config.js | ghost/core/core/frontend/services/routing/config.js | module.exports.QUERY = {
tag: {
controller: 'tagsPublic',
type: 'read',
resource: 'tags',
options: {
slug: '%s',
visibility: 'public'
}
},
author: {
controller: 'authorsPublic',
type: 'read',
resource: 'authors',
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/CollectionRouter.js | ghost/core/core/frontend/services/routing/CollectionRouter.js | const debug = require('@tryghost/debug')('routing:collection-router');
const urlUtils = require('../../../shared/url-utils');
const ParentRouter = require('./ParentRouter');
const controllers = require('./controllers');
const middleware = require('./middleware');
const RSSRouter = require('./RSSRouter');
/**
* @desc... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/RouterManager.js | ghost/core/core/frontend/services/routing/RouterManager.js | const debug = require('@tryghost/debug')('frontend:routing');
const _ = require('lodash');
const StaticRoutesRouter = require('./StaticRoutesRouter');
const StaticPagesRouter = require('./StaticPagesRouter');
const CollectionRouter = require('./CollectionRouter');
const TaxonomyRouter = require('./TaxonomyRouter');
con... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/PreviewRouter.js | ghost/core/core/frontend/services/routing/PreviewRouter.js | const ParentRouter = require('./ParentRouter');
const urlUtils = require('../../../shared/url-utils');
const controllers = require('./controllers');
/**
* @description Preview Router.
*/
class PreviewRouter extends ParentRouter {
constructor(RESOURCE_CONFIG) {
super('PreviewRouter');
this.RESOUR... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/EmailRouter.js | ghost/core/core/frontend/services/routing/EmailRouter.js | const ParentRouter = require('./ParentRouter');
const urlUtils = require('../../../shared/url-utils');
const controllers = require('./controllers');
/**
* @description Email Router.
*/
class EmailRouter extends ParentRouter {
constructor(RESOURCE_CONFIG) {
super('EmailRouter');
this.RESOURCE_CON... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/StaticPagesRouter.js | ghost/core/core/frontend/services/routing/StaticPagesRouter.js | const debug = require('@tryghost/debug')('routing:static-pages-router');
const urlUtils = require('../../../shared/url-utils');
const ParentRouter = require('./ParentRouter');
const controllers = require('./controllers');
/**
* @description Resource: pages
*/
class StaticPagesRouter extends ParentRouter {
constr... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/TaxonomyRouter.js | ghost/core/core/frontend/services/routing/TaxonomyRouter.js | const debug = require('@tryghost/debug')('routing:taxonomy-router');
const config = require('../../../shared/config');
const ParentRouter = require('./ParentRouter');
const RSSRouter = require('./RSSRouter');
const urlUtils = require('../../../shared/url-utils');
const controllers = require('./controllers');
const midd... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/middleware/page-param.js | ghost/core/core/frontend/services/routing/middleware/page-param.js | const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const urlUtils = require('../../../../shared/url-utils');
const messages = {
pageNotFound: 'Page not found.'
};
/**
* @description Middleware, which validates and interprets the page param e.g. /page/1
* @param {Object} req
* @pa... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/middleware/index.js | ghost/core/core/frontend/services/routing/middleware/index.js | module.exports = {
get pageParam() {
return require('./page-param');
}
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/controllers/unsubscribe.js | ghost/core/core/frontend/services/routing/controllers/unsubscribe.js | const debug = require('@tryghost/debug')('services:routing:controllers:unsubscribe');
const url = require('url');
const members = require('../../../../server/services/members');
const urlUtils = require('../../../../shared/url-utils');
const logging = require('@tryghost/logging');
const settingsHelpers = require('../..... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/controllers/email-post.js | ghost/core/core/frontend/services/routing/controllers/email-post.js | const debug = require('@tryghost/debug')('services:routing:controllers:emailpost');
const config = require('../../../../shared/config');
const {routerManager} = require('../');
const urlUtils = require('../../../../shared/url-utils');
const renderer = require('../../rendering');
/**
* @description Email Post Controll... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/controllers/index.js | ghost/core/core/frontend/services/routing/controllers/index.js | module.exports = {
get entry() {
return require('./entry');
},
get collection() {
return require('./collection');
},
get rss() {
return require('./rss');
},
get previews() {
return require('./previews');
},
get email() {
return require('./e... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/controllers/collection.js | ghost/core/core/frontend/services/routing/controllers/collection.js | const _ = require('lodash');
const debug = require('@tryghost/debug')('services:routing:controllers:collection');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const security = require('@tryghost/security');
const {routerManager} = require('../');
const themeEngine = require('../../t... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/controllers/channel.js | ghost/core/core/frontend/services/routing/controllers/channel.js | const debug = require('@tryghost/debug')('services:routing:controllers:channel');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const security = require('@tryghost/security');
const themeEngine = require('../../theme-engine');
const dataService = require('../../data');
const renderer... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/controllers/entry.js | ghost/core/core/frontend/services/routing/controllers/entry.js | const debug = require('@tryghost/debug')('services:routing:controllers:entry');
const url = require('url');
const config = require('../../../../shared/config');
const {routerManager} = require('../');
const urlUtils = require('../../../../shared/url-utils');
const dataService = require('../../data');
const renderer = r... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/controllers/previews.js | ghost/core/core/frontend/services/routing/controllers/previews.js | const debug = require('@tryghost/debug')('services:routing:controllers:preview');
const config = require('../../../../shared/config');
const {routerManager} = require('../');
const urlUtils = require('../../../../shared/url-utils');
const renderer = require('../../rendering');
/**
* @description Preview Controller.
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/controllers/static.js | ghost/core/core/frontend/services/routing/controllers/static.js | const _ = require('lodash');
const debug = require('@tryghost/debug')('services:routing:controllers:static');
const renderer = require('../../rendering');
function processQuery(query, locals) {
const api = require('../../proxy').api;
query = _.cloneDeep(query);
// CASE: If you define a single data key for... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/routing/controllers/rss.js | ghost/core/core/frontend/services/routing/controllers/rss.js | const _ = require('lodash');
const debug = require('@tryghost/debug')('services:routing:controllers:rss');
const url = require('url');
const security = require('@tryghost/security');
const settingsCache = require('../../../../shared/settings-cache');
const rssService = require('../../rss');
const renderer = require('..... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/helpers/index.js | ghost/core/core/frontend/services/helpers/index.js | const registry = require('./registry');
const path = require('path');
// Initialise Ghost's own helpers
// This is a weird place for this to live!
const init = async () => {
const helperPath = path.join(__dirname, '../../', 'helpers');
return await registry.registerDir(helperPath);
};
// Oh look! A framework... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/helpers/registry.js | ghost/core/core/frontend/services/helpers/registry.js | const glob = require('glob');
const path = require('path');
const handlebars = require('./handlebars');
// Internal Cache
const registry = {};
const registerHelper = (name, helperFn) => {
if (registry[name]) {
return;
}
registry[name] = helperFn;
if (helperFn.async) {
handlebars.reg... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/helpers/handlebars.js | ghost/core/core/frontend/services/helpers/handlebars.js | const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const {hbs} = require('../handlebars');
// Register an async handlebars helper for a given handlebars instance
function asyncHelperWrapper(hbsInstance, name, fn) {
hbsInstance.registerAsyncHelper(name, async function returnA... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/assets-minification/CardAssets.js | ghost/core/core/frontend/services/assets-minification/CardAssets.js | const debug = require('@tryghost/debug')('card-assets');
const _ = require('lodash');
const path = require('path');
const config = require('../../../shared/config');
const Minifier = require('./Minifier');
const AssetsMinificationBase = require('./AssetsMinificationBase');
module.exports = class CardAssets extends Ass... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/assets-minification/index.js | ghost/core/core/frontend/services/assets-minification/index.js | const CardAssets = require('./CardAssets');
const AdminAuthAssets = require('./AdminAuthAssets');
const cardAssets = new CardAssets();
const adminAuthAssets = new AdminAuthAssets();
module.exports = {
cardAssets,
adminAuthAssets
}; | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/assets-minification/AdminAuthAssets.js | ghost/core/core/frontend/services/assets-minification/AdminAuthAssets.js | // const debug = require('@tryghost/debug')('comments-counts-assets');
const path = require('path');
const fs = require('fs');
const logging = require('@tryghost/logging');
const config = require('../../../shared/config');
const urlUtils = require('../../../shared/url-utils');
const Minifier = require('./Minifier');
c... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/assets-minification/AssetsMinificationBase.js | ghost/core/core/frontend/services/assets-minification/AssetsMinificationBase.js | const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
module.exports = class AssetsMinificationBase {
minifier;
ready = false;
constructor(options = {}) {
this.options = options;
}
invalidate() {
this.ready = false;
}
generateGlobs() {... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/assets-minification/Minifier.js | ghost/core/core/frontend/services/assets-minification/Minifier.js | /**
* ```
* const Minifier = require('./Minifier');
* const minifier = new Minifier({
* src: 'my/src/path',
* dest: 'my/dest/path'
* });
*
* minifier.minify({
* 'some.css': '*.css',
* 'then.js': '!(other).js'
* });
* ```
*
* - Minfier constructor requires a src and a dest
* - minify() fun... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rss/generate-feed.js | ghost/core/core/frontend/services/rss/generate-feed.js | const downsize = require('downsize');
const RSS = require('rss');
const urlUtils = require('../../../shared/url-utils');
const {routerManager} = require('../routing');
const generateTags = function generateTags(data) {
if (data.tags) {
return data.tags.reduce(function (tags, tag) {
if (tag.visi... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rss/index.js | ghost/core/core/frontend/services/rss/index.js | module.exports = require('./renderer');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rss/cache.js | ghost/core/core/frontend/services/rss/cache.js | const crypto = require('crypto');
const generateFeed = require('./generate-feed');
const logging = require('@tryghost/logging');
const feedCache = {};
module.exports.getXML = function getFeedXml(baseUrl, data) {
const dataHash = crypto.createHash('md5').update(JSON.stringify(data)).digest('hex');
if (!feedCach... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/rss/renderer.js | ghost/core/core/frontend/services/rss/renderer.js | const _ = require('lodash');
const rssCache = require('./cache');
module.exports.render = function render(res, baseUrl, data) {
// Format data - this is the same as what Express does
const rssData = _.merge({}, res.locals, data);
// Fetch RSS from the cache
return rssCache
.getXML(baseUrl, rss... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/sitemap/UserMapGenerator.js | ghost/core/core/frontend/services/sitemap/UserMapGenerator.js | const _ = require('lodash');
const validator = require('@tryghost/validator');
const BaseMapGenerator = require('./BaseSiteMapGenerator');
class UserMapGenerator extends BaseMapGenerator {
constructor(opts) {
super();
this.name = 'authors';
_.extend(this, opts);
}
validateImageUrl... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/sitemap/SiteMapManager.js | ghost/core/core/frontend/services/sitemap/SiteMapManager.js | const DomainEvents = require('@tryghost/domain-events');
const {URLResourceUpdatedEvent} = require('../../../shared/events');
const IndexMapGenerator = require('./SiteMapIndexGenerator');
const PagesMapGenerator = require('./PageMapGenerator');
const PostsMapGenerator = require('./PostMapGenerator');
const UsersMapGene... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/sitemap/TagsMapGenerator.js | ghost/core/core/frontend/services/sitemap/TagsMapGenerator.js | const _ = require('lodash');
const BaseMapGenerator = require('./BaseSiteMapGenerator');
class TagsMapGenerator extends BaseMapGenerator {
constructor(opts) {
super();
this.name = 'tags';
_.extend(this, opts);
}
}
module.exports = TagsMapGenerator;
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/sitemap/PageMapGenerator.js | ghost/core/core/frontend/services/sitemap/PageMapGenerator.js | const _ = require('lodash');
const BaseMapGenerator = require('./BaseSiteMapGenerator');
class PageMapGenerator extends BaseMapGenerator {
constructor(opts) {
super();
this.name = 'pages';
_.extend(this, opts);
}
}
module.exports = PageMapGenerator;
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/frontend/services/sitemap/handler.js | ghost/core/core/frontend/services/sitemap/handler.js | const config = require('../../../shared/config');
const Manager = require('./SiteMapManager');
const manager = new Manager();
// Responsible for handling requests for sitemap files
module.exports = function handler(siteApp) {
const verifyResourceType = function verifyResourceType(req, res, next) {
const re... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.