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/core/server/models/member-login-event.js
ghost/core/core/server/models/member-login-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const MemberLoginEvent = ghostBookshelf.Model.extend({ tableName: 'members_login_events', member() { return this.belongsTo('Member', 'member_id', 'id'); } }, { async edit() { throw new errors.Incorrec...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/integration.js
ghost/core/core/server/models/integration.js
const _ = require('lodash'); const limitService = require('../services/limits'); const ghostBookshelf = require('./base'); const {NoPermissionError} = require('@tryghost/errors'); const Integration = ghostBookshelf.Model.extend({ tableName: 'integrations', actionsCollectCRUD: true, actionsResourceType: 'i...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/tag.js
ghost/core/core/server/models/tag.js
const ghostBookshelf = require('./base'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const urlUtils = require('../../shared/url-utils'); const messages = { tagNotFound: 'Tag not found.' }; let Tag; let Tags; Tag = ghostBookshelf.Model.extend({ tableName: 'tags', a...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/benefit.js
ghost/core/core/server/models/benefit.js
const ghostBookshelf = require('./base'); const Benefit = ghostBookshelf.Model.extend({ tableName: 'benefits', async onSaving(model, attr, options) { ghostBookshelf.Model.prototype.onSaving.call(this, model, attr, options); // Make sure name is trimmed of extra spaces let name = this....
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-subscribe-event.js
ghost/core/core/server/models/member-subscribe-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const MemberSubscribeEvent = ghostBookshelf.Model.extend({ tableName: 'members_subscribe_events', member() { return this.belongsTo('Member', 'member_id', 'id'); }, newsletter() { return this.belongsT...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/email.js
ghost/core/core/server/models/email.js
const crypto = require('crypto'); const ghostBookshelf = require('./base'); const Email = ghostBookshelf.Model.extend({ tableName: 'emails', defaults: function defaults() { return { uuid: crypto.randomUUID(), status: 'pending', recipient_filter: 'status:-free', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/offer-redemption.js
ghost/core/core/server/models/offer-redemption.js
const ghostBookshelf = require('./base'); const OfferRedemption = ghostBookshelf.Model.extend({ tableName: 'offer_redemptions' }); module.exports = { OfferRedemption: ghostBookshelf.model('OfferRedemption', OfferRedemption) };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/action.js
ghost/core/core/server/models/action.js
const ghostBookshelf = require('./base'); const Action = ghostBookshelf.Model.extend({ tableName: 'actions', candidates() { return Object.keys(ghostBookshelf.registry.models).map((key) => { const model = ghostBookshelf.registry.models[key]; return [model, model.prototype.tableN...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/stripe-product.js
ghost/core/core/server/models/stripe-product.js
const ghostBookshelf = require('./base'); const StripeProduct = ghostBookshelf.Model.extend({ tableName: 'stripe_products', product() { return this.belongsTo('Product', 'product_id', 'id'); }, stripePrices() { return this.hasMany('StripePrice', 'stripe_product_id', 'stripe_product_id'...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/mention.js
ghost/core/core/server/models/mention.js
const ghostBookshelf = require('./base'); const Mention = ghostBookshelf.Model.extend({ tableName: 'mentions', defaults: { deleted: false, verified: false }, defaultFilters() { return 'deleted:false'; } }, { permittedOptions(methodName) { let options = ghostBooks...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/session.js
ghost/core/core/server/models/session.js
const ghostBookshelf = require('./base'); const Session = ghostBookshelf.Model.extend({ tableName: 'sessions', parse(attrs) { attrs.session_data = JSON.parse(attrs.session_data); return attrs; }, format(attrs) { // CASE: format will be called when formatting all data for the D...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/email-batch.js
ghost/core/core/server/models/email-batch.js
const ghostBookshelf = require('./base'); const EmailBatch = ghostBookshelf.Model.extend({ tableName: 'email_batches', defaults() { return { status: 'pending', fallback_sending_domain: false }; }, email() { return this.belongsTo('Email', 'email_id'); ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/relations/authors.js
ghost/core/core/server/models/relations/authors.js
const _ = require('lodash'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const {sequence} = require('@tryghost/promise'); const {setIsRoles} = require('../role-utils'); const messages = { noUserFound: 'No user found', postNotFound: 'Post not found.', notEnoughPermissio...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/relations/index.js
ghost/core/core/server/models/relations/index.js
module.exports = { get authors() { return require('./authors'); } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/index.js
ghost/core/core/server/models/base/index.js
// # Base Model // This is the model from which all other Ghost models extend. The model is based on Bookshelf.Model, and provides // several basic behaviors such as UUIDs, as well as a set of Data methods for accessing information from the database. // // The models are internal to Ghost, only the API and some interna...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/listeners.js
ghost/core/core/server/models/base/listeners.js
const moment = require('moment-timezone'); const _ = require('lodash'); const models = require('../../models'); const logging = require('@tryghost/logging'); const errors = require('@tryghost/errors'); const {sequence} = require('@tryghost/promise'); // Listen to settings.timezone.edited and settings.notifications.edi...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/bookshelf.js
ghost/core/core/server/models/base/bookshelf.js
const _ = require('lodash'); const bookshelf = require('bookshelf'); const ObjectId = require('bson-objectid').default; const plugins = require('@tryghost/bookshelf-plugins'); const db = require('../../data/db'); // ### ghostBookshelf // Initializes a new Bookshelf instance called ghostBookshelf, for reference elsewh...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/utils.js
ghost/core/core/server/models/base/utils.js
/** * # Utils * Parts of the model code which can be split out and unit tested */ const _ = require('lodash'); const ObjectId = require('bson-objectid').default; const errors = require('@tryghost/errors'); /** * Attach wrapper (please never call attach manual!) * * We register the creating event to be able to h...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/raw-knex.js
ghost/core/core/server/models/base/plugins/raw-knex.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('models:base:raw-knex'); const plugins = require('@tryghost/bookshelf-plugins'); const schema = require('../../../data/schema'); /** * @param {import('bookshelf')} Bookshelf */ module.exports = function (Bookshelf) { Bookshelf.Model = Bookshe...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/overrides.js
ghost/core/core/server/models/base/plugins/overrides.js
const {PIVOT_PREFIX} = require('bookshelf/lib/constants'); const _ = require('lodash'); /** * @param {import('bookshelf')} Bookshelf */ module.exports = function (Bookshelf) { const ParentModel = Bookshelf.Model; Bookshelf.Model = Bookshelf.Model.extend({ /** * Bookshelf's .format() is run ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/relations.js
ghost/core/core/server/models/base/plugins/relations.js
const errors = require('@tryghost/errors'); /** * @param {import('bookshelf')} Bookshelf */ module.exports = function (Bookshelf) { Bookshelf.Model = Bookshelf.Model.extend({ /** * Return a relation, and load it if it hasn't been loaded already (or force a refresh with the forceRefresh option). ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/data-manipulation.js
ghost/core/core/server/models/base/plugins/data-manipulation.js
const moment = require('moment'); const schema = require('../../../data/schema'); /** * @param {import('bookshelf')} Bookshelf */ module.exports = function (Bookshelf) { Bookshelf.Model = Bookshelf.Model.extend({ getNullableStringProperties() { const table = schema.tables[this.tableName]; ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/generate-slug.js
ghost/core/core/server/models/base/plugins/generate-slug.js
const _ = require('lodash'); const security = require('@tryghost/security'); const urlUtils = require('../../../../shared/url-utils'); /** * @type {Bookshelf} Bookshelf */ module.exports = function (Bookshelf) { Bookshelf.Model = Bookshelf.Model.extend({}, { /** * ### Generate Slug * C...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/events.js
ghost/core/core/server/models/base/plugins/events.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('models:base:model-events'); const ObjectId = require('bson-objectid').default; const schema = require('../../../data/schema'); // This wires up our model event system const events = require('../../../lib/common/events'); // Run tests or developme...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/bulk-operations.js
ghost/core/core/server/models/base/plugins/bulk-operations.js
const _ = require('lodash'); const errors = require('@tryghost/errors'); const logging = require('@tryghost/logging'); const CHUNK_SIZE = 100; function createBulkOperation(singular, multiple) { return async function (knex, table, data, options) { const result = { successful: 0, uns...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/user-type.js
ghost/core/core/server/models/base/plugins/user-type.js
const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const messages = { missingContext: 'missing context' }; /** * @param {import('bookshelf')} Bookshelf */ module.exports = function (Bookshelf, pluginOptions) { Bookshelf.Model = Bookshelf.Model.extend({ getActor(options...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/filtered-collection.js
ghost/core/core/server/models/base/plugins/filtered-collection.js
/** * @param {import('bookshelf')} Bookshelf */ module.exports = function (Bookshelf) { Bookshelf.Model = Bookshelf.Model.extend({}, { getFilteredCollection: function getFilteredCollection(options) { const filteredCollection = this.forge(); // Apply model-specific query behavior ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/crud.js
ghost/core/core/server/models/base/plugins/crud.js
const _ = require('lodash'); const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const messages = { couldNotUnderstandRequest: 'Could not understand request.' }; // If user requested an excerpt we need to ensure plaintext and custom_excerpt is also included so we can include it when...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/actions.js
ghost/core/core/server/models/base/plugins/actions.js
const _ = require('lodash'); const errors = require('@tryghost/errors'); const logging = require('@tryghost/logging'); /** * This plugin is used to add actions to the database. It backs the "audit log" feature we have in Ghost. * * The functions here are triggered by the `onCreated`, `onUpdated`, `onDeleted` functi...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/base/plugins/sanitize.js
ghost/core/core/server/models/base/plugins/sanitize.js
const _ = require('lodash'); const errors = require('@tryghost/errors'); const moment = require('moment'); const tpl = require('@tryghost/tpl'); const schema = require('../../../data/schema'); const messages = { missingContext: 'missing context', invalidDate: 'Date format for `{key}` is invalid.' }; /** * @...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/index.js
ghost/core/core/server/api/index.js
module.exports.endpoints = require('./endpoints');
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/tinybird.js
ghost/core/core/server/api/endpoints/tinybird.js
const TinybirdServiceWrapper = require('../../services/tinybird'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'tinybird', token: { headers: { cacheInvalidate: false }, permissions: { docName: 'members', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/automated-emails.js
ghost/core/core/server/api/endpoints/automated-emails.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); const messages = { automatedEmailNotFound: 'Automated email not found.' }; /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'automated_emails', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/themes.js
ghost/core/core/server/api/endpoints/themes.js
const themeService = require('../../services/themes'); const limitService = require('../../services/limits'); const models = require('../../models'); // Used to emit theme.uploaded which is used in core/server/analytics-events const events = require('../../lib/common/events'); const {settingsCache} = require('../../se...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/comment-replies.js
ghost/core/core/server/api/endpoints/comment-replies.js
// This is a new endpoint for the admin API to return replies to a comment with pagination const commentsService = require('../../services/comments'); const ALLOWED_INCLUDES = ['member', 'replies', 'replies.member', 'replies.count.likes', 'replies.liked', 'count.replies', 'count.likes', 'liked', 'post', 'parent']; /*...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/pages-public.js
ghost/core/core/server/api/endpoints/pages-public.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const {mapQuery} = require('@tryghost/mongo-utils'); const models = require('../../models'); const ALLOWED_INCLUDES = ['tags', 'authors', 'tiers']; const messages = { pageNotFound: 'Page not found.' }; const rejectPrivateFieldsTran...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/invites.js
ghost/core/core/server/api/endpoints/invites.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const invites = require('../../services/invites'); const models = require('../../models'); const api = require('./index'); const ALLOWED_INCLUDES = []; const UNSAFE_ATTRS = ['role_id']; const messages = { inviteNotFound: 'Invite not ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/pages.js
ghost/core/core/server/api/endpoints/pages.js
const models = require('../../models'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const getPostServiceInstance = require('../../services/posts/posts-service'); const ALLOWED_INCLUDES = ['tags', 'authors', 'authors.roles', 'tiers', 'count.signups', 'count.paid_conversions', 'post_...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/email-previews.js
ghost/core/core/server/api/endpoints/email-previews.js
const emailService = require('../../services/email-service'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'email_previews', read: { headers: { cacheInvalidate: false }, options: [ 'fields', 'memberSegment...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/tags-public.js
ghost/core/core/server/api/endpoints/tags-public.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); const tagsPublicService = require('../../services/tags-public'); const ALLOWED_INCLUDES = ['count.posts']; const messages = { tagNotFound: 'Tag not found.' }; /** @type {import('@tryghost/api...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/email-post.js
ghost/core/core/server/api/endpoints/email-post.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); const ALLOWED_INCLUDES = ['authors', 'tags', 'tiers']; const messages = { postNotFound: 'Post not found.' }; /** @type {import('@tryghost/api-framework').Controller} */ const controller = { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/slack.js
ghost/core/core/server/api/endpoints/slack.js
// Used to call the slack ping service, iirc this was done to avoid circular deps a long time ago const events = require('../../lib/common/events'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'slack', sendTest: { headers: { cacheInvalidate: fal...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/posts.js
ghost/core/core/server/api/endpoints/posts.js
const urlUtils = require('../../../shared/url-utils'); const models = require('../../models'); const getPostServiceInstance = require('../../services/posts/posts-service'); const allowedIncludes = [ 'tags', 'authors', 'authors.roles', 'email', 'tiers', 'newsletter', 'count.conversions', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/integrations.js
ghost/core/core/server/api/endpoints/integrations.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); const getIntegrationsServiceInstance = require('../../services/integrations/integrations-service'); const messages = { resourceNotFound: '{resource} not found.' }; const integrationsService = ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/mail.js
ghost/core/core/server/api/endpoints/mail.js
const tpl = require('@tryghost/tpl'); const mailService = require('../../services/mail'); const api = require('./'); let mailer; let _private = {}; const messages = { unableToSendEmail: 'Ghost is currently unable to send email.', seeLinkForInstructions: 'See {link} for instructions.', testGhostEmail: 'Test...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/index.js
ghost/core/core/server/api/endpoints/index.js
const apiFramework = require('@tryghost/api-framework'); const localUtils = require('./utils'); // ESLint Override Notice // This is a valid index.js file - it just exports a lot of stuff! // Long term we would like to change the API architecture to reduce this file, // but that's not the problem the index.js max - li...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/notifications.js
ghost/core/core/server/api/endpoints/notifications.js
const {notifications} = require('../../services/notifications'); const settingsService = require('../../services/settings/settings-service'); const settingsBREADService = settingsService.getSettingsBREADServiceInstance(); const internalContext = {context: {internal: true}}; /** @type {import('@tryghost/api-framework')...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/images.js
ghost/core/core/server/api/endpoints/images.js
/* eslint-disable ghost/ghost-custom/max-api-complexity */ const path = require('path'); const errors = require('@tryghost/errors'); const imageTransform = require('@tryghost/image-transform'); const storage = require('../../adapters/storage'); const config = require('../../../shared/config'); /** @type {import('@try...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/recommendations-public.js
ghost/core/core/server/api/endpoints/recommendations-public.js
const recommendations = require('../../services/recommendations'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'recommendations', browse: { headers: { cacheInvalidate: false }, options: [ 'limit', 'order'...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/slugs.js
ghost/core/core/server/api/endpoints/slugs.js
const models = require('../../models'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const messages = { couldNotGenerateSlug: 'Could not generate slug.' }; const allowedTypes = { post: models.Post, tag: models.Tag, user: models.User }; /** @type {import('@tryghost...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/schedules.js
ghost/core/core/server/api/endpoints/schedules.js
const models = require('../../models'); const postSchedulingService = require('../../services/posts/post-scheduling-service')(); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'schedules', publish: { headers: { cacheInvalidate: false }, ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/identities.js
ghost/core/core/server/api/endpoints/identities.js
const logging = require('@tryghost/logging'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'identities', read: { headers: { cacheInvalidate: false }, permissions: true, async query(frame) { const IdentityTokenS...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/authors-public.js
ghost/core/core/server/api/endpoints/authors-public.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const {mapQuery} = require('@tryghost/mongo-utils'); const models = require('../../models'); const ALLOWED_INCLUDES = ['count.posts']; const messages = { notFound: 'Author not found.' }; const rejectPrivateFieldsTransformer = input ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/newsletters.js
ghost/core/core/server/api/endpoints/newsletters.js
const allowedIncludes = ['count.posts', 'count.members', 'count.active_members']; const newslettersService = require('../../services/newsletters'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'newsletters', browse: { headers: { cacheInvalidate...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/feedback-members.js
ghost/core/core/server/api/endpoints/feedback-members.js
const feedbackService = require('../../services/audience-feedback'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'feedback', browse: { headers: { cacheInvalidate: false }, data: [ 'id' ], options: [ ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/site.js
ghost/core/core/server/api/endpoints/site.js
const publicConfig = require('../../services/public-config'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'site', read: { headers: { cacheInvalidate: false }, permissions: false, query() { return publicConfig...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/comments.js
ghost/core/core/server/api/endpoints/comments.js
const models = require('../../models'); const commentsService = require('../../services/comments'); const errors = require('@tryghost/errors'); function handleCacheHeaders(model, frame) { if (model) { const postId = model.get('post_id'); const parentId = model.get('parent_id'); const pathsTo...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/custom-theme-settings.js
ghost/core/core/server/api/endpoints/custom-theme-settings.js
const customThemeSettingsService = require('../../services/custom-theme-settings'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'custom_theme_settings', browse: { headers: { cacheInvalidate: false }, permissions: true, q...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/explore.js
ghost/core/core/server/api/endpoints/explore.js
const exploreService = require('../../services/explore'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'explore', read: { headers: { cacheInvalidate: false }, permissions: true, query() { return exploreService...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/config.js
ghost/core/core/server/api/endpoints/config.js
const publicConfig = require('../../services/public-config'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'config', read: { headers: { cacheInvalidate: false }, permissions: false, query() { return publicConf...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/roles.js
ghost/core/core/server/api/endpoints/roles.js
const models = require('../../models'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'roles', browse: { headers: { cacheInvalidate: false }, options: [ 'permissions' ], validation: { options...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/webhooks.js
ghost/core/core/server/api/endpoints/webhooks.js
const models = require('../../models'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const getWebhooksServiceInstance = require('../../services/webhooks/webhooks-service'); const messages = { resourceNotFound: '{resource} not found.', noPermissionToEdit: { message: ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/tiers.js
ghost/core/core/server/api/endpoints/tiers.js
const tiersService = require('../../services/tiers'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'tiers', browse: { headers: { cacheInvalidate: false }, options: [ 'limit', 'fields', 'filter'...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/db.js
ghost/core/core/server/api/endpoints/db.js
const moment = require('moment-timezone'); const dbBackup = require('../../data/db/backup'); const exporter = require('../../data/exporter'); const importer = require('../../data/importer'); const mediaInliner = require('../../services/media-inliner'); const errors = require('@tryghost/errors'); const {pool} = require(...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/tags.js
ghost/core/core/server/api/endpoints/tags.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); const ALLOWED_INCLUDES = ['count.posts']; const messages = { tagNotFound: 'Tag not found.' }; /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'ta...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/posts-public.js
ghost/core/core/server/api/endpoints/posts-public.js
const models = require('../../models'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const {mapQuery} = require('@tryghost/mongo-utils'); const postsPublicService = require('../../services/posts-public'); const getPostServiceInstance = require('../../services/posts/posts-service'); ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/announcements.js
ghost/core/core/server/api/endpoints/announcements.js
const announcementBarSettings = require('../../services/announcement-bar-service'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'announcement', browse: { headers: { cacheInvalidate: false }, permissions: true, query(fram...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/users.js
ghost/core/core/server/api/endpoints/users.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); const permissionsService = require('../../services/permissions'); const dbBackup = require('../../data/db/backup'); const auth = require('../../services/auth'); const apiMail = require('./index').ma...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/previews.js
ghost/core/core/server/api/endpoints/previews.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); const logging = require('@tryghost/logging'); const ALLOWED_INCLUDES = ['authors', 'tags', 'tiers']; const ALLOWED_MEMBER_STATUSES = ['anonymous', 'free', 'paid']; const messages = { postNotFou...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/links.js
ghost/core/core/server/api/endpoints/links.js
const linkTrackingService = require('../../services/link-tracking'); const INVALIDATE_ALL_REDIRECTS = '/r/*'; /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'links', browse: { headers: { cacheInvalidate: false }, options: [ ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/search-index-public.js
ghost/core/core/server/api/endpoints/search-index-public.js
const models = require('../../models'); const getPostServiceInstance = require('../../services/posts/posts-service'); const postsService = getPostServiceInstance(); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'search_index', fetchPosts: { headers: { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/mentions.js
ghost/core/core/server/api/endpoints/mentions.js
const mentions = require('../../services/mentions'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'mentions', browse: { headers: { cacheInvalidate: false }, options: [ 'filter', 'fields', 'limit...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/oembed.js
ghost/core/core/server/api/endpoints/oembed.js
const oembed = require('../../services/oembed'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'oembed', read: { headers: { cacheInvalidate: false }, permissions: false, data: [ 'url', 'type' ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/tiers-public.js
ghost/core/core/server/api/endpoints/tiers-public.js
const tiersService = require('../../services/tiers'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'tiers', browse: { headers: { cacheInvalidate: false }, options: [ 'limit', 'fields', 'filter'...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/offers.js
ghost/core/core/server/api/endpoints/offers.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const offersService = require('../../services/offers'); const messages = { offerNotFound: 'Offer not found.' }; /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'offers', browse: { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/offers-public.js
ghost/core/core/server/api/endpoints/offers-public.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const offersService = require('../../services/offers'); const messages = { offerNotFound: 'Offer not found.' }; /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'offers', read: { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/settings-public.js
ghost/core/core/server/api/endpoints/settings-public.js
const settingsCache = require('../../../shared/settings-cache'); const urlUtils = require('../../../shared/url-utils'); const ghostVersion = require('@tryghost/version'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'settings', browse: { headers: { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/members.js
ghost/core/core/server/api/endpoints/members.js
// NOTE: We must not cache references to membersService.api // as it is a getter and may change during runtime. const moment = require('moment-timezone'); const errors = require('@tryghost/errors'); const logging = require('@tryghost/logging'); const models = require('../../models'); const membersService = require('../...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/redirects.js
ghost/core/core/server/api/endpoints/redirects.js
const path = require('path'); const customRedirects = require('../../services/custom-redirects'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'redirects', download: { headers: { disposition: { type: 'file', asyn...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/settings.js
ghost/core/core/server/api/endpoints/settings.js
const _ = require('lodash'); const models = require('../../models'); const routeSettings = require('../../services/route-settings'); const {BadRequestError} = require('@tryghost/errors'); const settingsService = require('../../services/settings/settings-service'); const membersService = require('../../services/members'...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/labels.js
ghost/core/core/server/api/endpoints/labels.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); const messages = { labelNotFound: 'Label not found.', labelAlreadyExists: 'Label already exists' }; const ALLOWED_INCLUDES = ['count.members']; /** @type {import('@tryghost/api-framework'...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/search-index.js
ghost/core/core/server/api/endpoints/search-index.js
const models = require('../../models'); const getPostServiceInstance = require('../../services/posts/posts-service'); const postsService = getPostServiceInstance(); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'search_index', fetchPosts: { headers: { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/newsletters-public.js
ghost/core/core/server/api/endpoints/newsletters-public.js
const models = require('../../models'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'newsletters', browse: { headers: { cacheInvalidate: false }, options: [ 'filter', 'fields', 'limit', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/actions.js
ghost/core/core/server/api/endpoints/actions.js
const models = require('../../models'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'actions', browse: { headers: { cacheInvalidate: false }, options: [ 'page', 'limit', 'fields', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/media.js
ghost/core/core/server/api/endpoints/media.js
const path = require('path'); const storage = require('../../adapters/storage'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'media', upload: { statusCode: 201, headers: { cacheInvalidate: false }, permissions: false, ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/snippets.js
ghost/core/core/server/api/endpoints/snippets.js
const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const models = require('../../models'); const messages = { snippetNotFound: 'Snippet not found.', snippetAlreadyExists: 'Snippet already exists.' }; /** @type {import('@tryghost/api-framework').Controller} */ const controller = ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/recommendations.js
ghost/core/core/server/api/endpoints/recommendations.js
const recommendations = require('../../services/recommendations'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'recommendations', browse: { headers: { cacheInvalidate: false }, options: [ 'limit', 'page',...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/comments-members.js
ghost/core/core/server/api/endpoints/comments-members.js
const commentsService = require('../../services/comments'); const ALLOWED_INCLUDES = ['member', 'replies', 'replies.member', 'replies.count.likes', 'replies.liked', 'count.replies', 'count.likes', 'liked', 'post', 'parent']; const UNSAFE_ATTRS = ['status']; /** @type {import('@tryghost/api-framework').Controller} */ c...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/files.js
ghost/core/core/server/api/endpoints/files.js
const storage = require('../../adapters/storage'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'files', upload: { statusCode: 201, headers: { cacheInvalidate: false }, permissions: false, async query(frame) { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/authentication.js
ghost/core/core/server/api/endpoints/authentication.js
const api = require('./index'); const config = require('../../../shared/config'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const logging = require('@tryghost/logging'); const web = require('../../web'); const models = require('../../models'); const auth = require('../../services...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/member-signin-urls.js
ghost/core/core/server/api/endpoints/member-signin-urls.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const membersService = require('../../services/members'); const messages = { memberNotFound: 'Member not found.' }; /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'member_signin_urls', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/members-stripe-connect.js
ghost/core/core/server/api/endpoints/members-stripe-connect.js
const membersService = require('../../services/members'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'members_stripe_connect', auth: { headers: { cacheInvalidate: false }, permissions: true, options: [ 'mode'...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/emails.js
ghost/core/core/server/api/endpoints/emails.js
const models = require('../../models'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const emailService = require('../../services/email-service'); const emailAnalytics = require('../../services/email-analytics'); const messages = { emailNotFound: 'Email not found.', retryNo...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/session.js
ghost/core/core/server/api/endpoints/session.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); const auth = require('../../services/auth'); const api = require('./index'); const messages = { accessDenied: 'Access Denied.' }; /** @type {import('@tryghost/api-framework').Controller} */ co...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/incoming-recommendations.js
ghost/core/core/server/api/endpoints/incoming-recommendations.js
const recommendations = require('../../services/recommendations'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'recommendations', browse: { headers: { cacheInvalidate: false }, options: [ 'limit', 'page' ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/stats.js
ghost/core/core/server/api/endpoints/stats.js
const statsService = require('../../services/stats'); /** @type {import('@tryghost/api-framework').Controller} */ const controller = { docName: 'stats', memberCountHistory: { headers: { cacheInvalidate: false }, permissions: { docName: 'members', meth...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/index.js
ghost/core/core/server/api/endpoints/utils/index.js
module.exports = { get permissions() { return require('./permissions'); }, get serializers() { return require('./serializers'); }, get validators() { return require('./validators'); }, /** * @description Does the request access the Content API? * * E...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/permissions.js
ghost/core/core/server/api/endpoints/utils/permissions.js
const debug = require('@tryghost/debug')('api:endpoints:utils:permissions'); const _ = require('lodash'); const permissions = require('../../../services/permissions'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const messages = { noPermissionToCall: 'You do not have permissio...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/index.js
ghost/core/core/server/api/endpoints/utils/serializers/index.js
module.exports = { get input() { return require('./input'); }, get output() { return require('./output'); } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/pages.js
ghost/core/core/server/api/endpoints/utils/serializers/input/pages.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:input:pages'); const {ValidationError} = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const url = require('./utils/url'); const slugFilterOrder = require('./utils/slug-filter-order'); const local...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false