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/services/media-inliner/service.js | ghost/core/core/server/services/media-inliner/service.js | module.exports = {
async init() {
const debug = require('@tryghost/debug')('mediaInliner');
const MediaInliner = require('./ExternalMediaInliner');
const models = require('../../models');
const jobsService = require('../jobs');
const mediaStorage = require('../../adapters/st... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/media-inliner/ExternalMediaInliner.js | ghost/core/core/server/services/media-inliner/ExternalMediaInliner.js | const mime = require('mime-types');
const FileType = require('file-type');
const request = require('@tryghost/request');
const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const string = require('@tryghost/string');
const path = require('path');
const convert = require('heic-conve... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/integrations/integrations-service.js | ghost/core/core/server/services/integrations/integrations-service.js | const {NotFoundError, InternalServerError} = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const messages = {
notFound: '{resource} not found.'
};
class IntegrationsService {
constructor({IntegrationModel, ApiKeyModel}) {
this.IntegrationModel = IntegrationModel;
this.ApiK... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/link-tracking/ClickEvent.js | ghost/core/core/server/services/link-tracking/ClickEvent.js | const ObjectID = require('bson-objectid').default;
module.exports = class ClickEvent {
/** @type {ObjectID} */
event_id;
/** @type {string} */
member_uuid;
/** @type {ObjectID} */
link_id;
constructor(data) {
if (!data.id) {
this.event_id = new ObjectID();
}
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/link-tracking/index.js | ghost/core/core/server/services/link-tracking/index.js | const LinkClickRepository = require('./LinkClickRepository');
const PostLinkRepository = require('./PostLinkRepository');
const errors = require('@tryghost/errors');
const urlUtils = require('../../../shared/url-utils');
class LinkTrackingServiceWrapper {
async init() {
if (this.service) {
// A... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/link-tracking/LinkClickTrackingService.js | ghost/core/core/server/services/link-tracking/LinkClickTrackingService.js | const RedirectEvent = require('../link-redirection/RedirectEvent');
const LinkClick = require('./ClickEvent');
const PostLink = require('./PostLink');
const ObjectID = require('bson-objectid').default;
const errors = require('@tryghost/errors');
const nql = require('@tryghost/nql');
const _ = require('lodash');
const t... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/link-tracking/LinkClickRepository.js | ghost/core/core/server/services/link-tracking/LinkClickRepository.js | const LinkClick = require('./ClickEvent');
const ObjectID = require('bson-objectid').default;
const sentry = require('../../../shared/sentry');
const config = require('../../../shared/config');
const _ = require('lodash');
module.exports = class LinkClickRepository {
/** @type {Object} */
#MemberLinkClickEvent... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/link-tracking/FullPostLink.js | ghost/core/core/server/services/link-tracking/FullPostLink.js | const ObjectID = require('bson-objectid').default;
/**
* @typedef {Object} FullPostLinkCount
* @property {number} clicks
*/
/**
* Stores the connection between a LinkRedirect and a Post
*/
module.exports = class FullPostLink {
/** @type {ObjectID} */
post_id;
/** @type {import('@tryghost/link-re... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/link-tracking/PostLinkRepository.js | ghost/core/core/server/services/link-tracking/PostLinkRepository.js | const FullPostLink = require('./FullPostLink');
const _ = require('lodash');
/**
* @typedef {import('bson-objectid').default} ObjectID
* @typedef {import('./PostLink')} PostLink
*/
module.exports = class PostLinkRepository {
/** @type {Object} */
#LinkRedirect;
/** @type {Object} */
#linkRedirectRe... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/link-tracking/PostLink.js | ghost/core/core/server/services/link-tracking/PostLink.js | const ObjectID = require('bson-objectid').default;
/**
* Stores the connection between a LinkRedirect and a Post
*/
module.exports = class PostLink {
/** @type {ObjectID} */
post_id;
/** @type {ObjectID} */
link_id;
/**
* @param {object} data
* @param {string|ObjectID} data.post_id
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/api-version-compatibility/mw-version-rewrites.js | ghost/core/core/server/services/api-version-compatibility/mw-version-rewrites.js | const legacyApiPathMatch = require('./legacy-api-path-match');
const urlUtils = require('../../../shared/url-utils');
/**
* If there is a version in the URL, and this is a valid API URL containing admin/content
* Rewrite the URL and add the accept-version & deprecation headers
* @param {import('express').Request} r... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/api-version-compatibility/index.js | ghost/core/core/server/services/api-version-compatibility/index.js | const ghostVersion = require('@tryghost/version');
/**
* Set Content-Version on the response, and add 'Accept-Version' to VARY as
* it effects response caching
* * TODO: move the method to mw once back-compatibility with 4.x is sorted *
* @param {import('express').Request} req
* @param {import('express').Response... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/api-version-compatibility/legacy-api-path-match.js | ghost/core/core/server/services/api-version-compatibility/legacy-api-path-match.js | const pathMatch = require('path-match')();
module.exports = (url) => {
let basePath = 'ghost/api';
let apiRouteMatcher = '/:version(v2|v3|v4|canary)?/:api(admin|content)/*';
let urlToMatch = url;
if (url.includes(basePath)) {
urlToMatch = url.split(basePath)[1];
}
if (!urlToMatch.ends... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/InMemoryTierRepository.js | ghost/core/core/server/services/tiers/InMemoryTierRepository.js | const nql = require('@tryghost/nql');
/**
* @typedef {import('./Tier')} Tier
*/
class InMemoryTierRepository {
/** @type {Tier[]} */
#store = [];
/** @type {Object.<string, true>} */
#ids = {};
/**
* @param {Tier} tier
* @returns {any}
*/
toPrimitive(tier) {
return {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/TierCreatedEvent.js | ghost/core/core/server/services/tiers/TierCreatedEvent.js | /**
* @typedef {object} TierCreatedEventData
* @prop {import('./Tier')} tier
*/
class TierCreatedEvent {
/** @type {TierCreatedEventData} */
data;
/** @type {Date} */
timestamp;
/**
* @param {TierCreatedEvent} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/index.js | ghost/core/core/server/services/tiers/index.js | module.exports = require('./service');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/TierArchivedEvent.js | ghost/core/core/server/services/tiers/TierArchivedEvent.js | /**
* @typedef {object} TierArchivedEventData
* @prop {import('./Tier')} tier
*/
class TierArchivedEvent {
/** @type {TierArchivedEventData} */
data;
/** @type {Date} */
timestamp;
/**
* @param {TierArchivedEvent} data
* @param {Date} timestamp
*/
constructor(data, timestamp)... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/service.js | ghost/core/core/server/services/tiers/service.js | class TiersServiceWrapper {
async init() {
if (this.api) {
// Already done
return;
}
const TiersAPI = require('./TiersAPI');
const DomainEvents = require('@tryghost/domain-events');
const models = require('../../models');
const TierRepository... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/TiersAPI.js | ghost/core/core/server/services/tiers/TiersAPI.js | const ObjectID = require('bson-objectid').default;
const {BadRequestError, IncorrectUsageError} = require('@tryghost/errors');
const Tier = require('./Tier');
/**
* @typedef {object} ITierRepository
* @prop {(id: ObjectID) => Promise<Tier>} getById
* @prop {(tier: Tier) => Promise<void>} save
* @prop {(options?: {... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/TierActivatedEvent.js | ghost/core/core/server/services/tiers/TierActivatedEvent.js | /**
* @typedef {object} TierActivatedEventData
* @prop {import('./Tier')} tier
*/
class TierActivatedEvent {
/** @type {TierActivatedEventData} */
data;
/** @type {Date} */
timestamp;
/**
* @param {TierActivatedEvent} data
* @param {Date} timestamp
*/
constructor(data, timest... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/Tier.js | ghost/core/core/server/services/tiers/Tier.js | const ObjectID = require('bson-objectid').default;
const {ValidationError} = require('@tryghost/errors');
const TierActivatedEvent = require('./TierActivatedEvent');
const TierArchivedEvent = require('./TierArchivedEvent');
const TierCreatedEvent = require('./TierCreatedEvent');
const TierNameChangeEvent = require('./... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/TierRepository.js | ghost/core/core/server/services/tiers/TierRepository.js | const Tier = require('./Tier');
const nql = require('@tryghost/nql');
/**
* @typedef {import('./TiersAPI').ITierRepository} ITierRepository
*/
/**
* @implements {ITierRepository}
*/
module.exports = class TierRepository {
/** @type {import('./Tier')[]} */
#store = [];
/** @type {Object.<string, true>}... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/TierPriceChangeEvent.js | ghost/core/core/server/services/tiers/TierPriceChangeEvent.js | /**
* @typedef {object} TierPriceChangeEventData
* @prop {import('./Tier')} tier
*/
class TierPriceChangeEvent {
/** @type {TierPriceChangeEventData} */
data;
/** @type {Date} */
timestamp;
/**
* @param {TierPriceChangeEvent} data
* @param {Date} timestamp
*/
constructor(data... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tiers/TierNameChangeEvent.js | ghost/core/core/server/services/tiers/TierNameChangeEvent.js | /**
* @typedef {object} TierNameChangeEventData
* @prop {import('./Tier')} tier
*/
class TierNameChangeEvent {
/** @type {TierNameChangeEventData} */
data;
/** @type {Date} */
timestamp;
/**
* @param {TierNameChangeEvent} data
* @param {Date} timestamp
*/
constructor(data, ti... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/outbox/index.js | ghost/core/core/server/services/outbox/index.js | const logging = require('@tryghost/logging');
const jobs = require('./jobs');
const StartOutboxProcessingEvent = require('./events/StartOutboxProcessingEvent');
const domainEvents = require('@tryghost/domain-events');
const processOutbox = require('./jobs/lib/process-outbox');
const {OUTBOX_LOG_KEY} = require('./jobs/l... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/outbox/jobs/outbox-job.js | ghost/core/core/server/services/outbox/jobs/outbox-job.js | const {parentPort} = require('worker_threads');
const StartOutboxProcessingEvent = require('../events/StartOutboxProcessingEvent');
function cancel() {
if (parentPort) {
parentPort.postMessage('Outbox job cancelled before completion');
parentPort.postMessage('cancelled');
} else {
setTi... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/outbox/jobs/index.js | ghost/core/core/server/services/outbox/jobs/index.js | const path = require('path');
const jobsService = require('../../jobs');
const config = require('../../../../shared/config');
let hasScheduled = {
processOutbox: false
};
module.exports = {
scheduleOutboxJob() {
const testInboxDisabled = !config.get('memberWelcomeEmailTestInbox');
const alread... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/outbox/jobs/lib/process-outbox.js | ghost/core/core/server/services/outbox/jobs/lib/process-outbox.js | const logging = require('@tryghost/logging');
const db = require('../../../../data/db');
const MemberCreatedEvent = require('../../../../../shared/events/MemberCreatedEvent');
const {OUTBOX_STATUSES} = require('../../../../models/outbox');
const {MESSAGES, MAX_ENTRIES_PER_JOB, BATCH_SIZE, OUTBOX_LOG_KEY} = require('./c... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/outbox/jobs/lib/constants.js | ghost/core/core/server/services/outbox/jobs/lib/constants.js | const BATCH_SIZE = 100;
const MAX_ENTRIES_PER_JOB = BATCH_SIZE * 10;
const MAX_RETRIES = 1;
const OUTBOX_LOG_KEY = '[OUTBOX]';
const MESSAGES = {
CANCELLED: 'Outbox processing cancelled',
NO_ENTRIES: 'No pending outbox entries to process'
};
module.exports = {
BATCH_SIZE,
MAX_ENTRIES_PER_JOB,
MAX_... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/outbox/jobs/lib/process-entries.js | ghost/core/core/server/services/outbox/jobs/lib/process-entries.js | const logging = require('@tryghost/logging');
const {MAX_RETRIES, OUTBOX_LOG_KEY} = require('./constants');
const {OUTBOX_STATUSES} = require('../../../../models/outbox');
const MemberCreatedEvent = require('../../../../../shared/events/MemberCreatedEvent');
const memberCreatedHandler = require('../../handlers/member-c... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/outbox/events/StartOutboxProcessingEvent.js | ghost/core/core/server/services/outbox/events/StartOutboxProcessingEvent.js | /**
* This is an event that is used to circumvent the job manager that currently isn't able to run scheduled jobs on the main thread (not offloaded).
* We simply emit this event in the job manager and listen for it on the main thread.
*/
module.exports = class StartOutboxProcessingEvent {
/**
* @param {any}... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/outbox/handlers/member-created.js | ghost/core/core/server/services/outbox/handlers/member-created.js | const {OUTBOX_LOG_KEY} = require('../jobs/lib/constants');
const memberWelcomeEmailService = require('../../member-welcome-emails/service');
const LOG_KEY = `${OUTBOX_LOG_KEY}[MEMBER-WELCOME-EMAIL]`;
async function handle({payload}) {
await memberWelcomeEmailService.api.send({member: payload, memberStatus: payloa... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mail/index.js | ghost/core/core/server/services/mail/index.js | const path = require('path');
const urlUtils = require('../../../shared/url-utils');
const settingsCache = require('../../../shared/settings-cache');
const EmailContentGenerator = require('../lib/EmailContentGenerator');
const emailContentGenerator = new EmailContentGenerator({
getSiteUrl: () => urlUtils.urlFor('h... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mail/GhostMailer.js | ghost/core/core/server/services/mail/GhostMailer.js | // # Mail
// Handles sending email for Ghost
const _ = require('lodash');
const config = require('../../../shared/config');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const settingsCache = require('../../../shared/settings-cache');
const urlUtils = require('../../../shared/url-uti... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/audience-feedback/AudienceFeedbackController.js | ghost/core/core/server/services/audience-feedback/AudienceFeedbackController.js | const Feedback = require('./Feedback');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const messages = {
invalidScore: 'Invalid feedback score. Only 1 or 0 is currently allowed.',
postNotFound: 'Post not found.',
memberNotFound: 'Member not found.'
};
/**
* @typedef {o... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/audience-feedback/AudienceFeedbackService.js | ghost/core/core/server/services/audience-feedback/AudienceFeedbackService.js | class AudienceFeedbackService {
/** @type URL */
#baseURL;
/** @type {Object} */
#urlService;
/**
* @param {object} deps
* @param {object} deps.config
* @param {URL} deps.config.baseURL
* @param {object} deps.urlService
*/
constructor(deps) {
this.#baseURL = deps... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/audience-feedback/FeedbackRepository.js | ghost/core/core/server/services/audience-feedback/FeedbackRepository.js | module.exports = class FeedbackRepository {
/** @type {object} */
#Member;
/** @type {object} */
#Post;
/** @type {object} */
#MemberFeedback;
/** @type {typeof Object} */
#Feedback;
/**
* @param {object} deps
* @param {object} deps.Member Bookshelf Model
* @param ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/audience-feedback/Feedback.js | ghost/core/core/server/services/audience-feedback/Feedback.js | const ObjectID = require('bson-objectid').default;
module.exports = class Feedback {
/** @type {ObjectID} */
id;
/** @type {number} */
score;
/** @type {ObjectID} */
memberId;
/** @type {ObjectID} */
postId;
constructor(data) {
if (!data.id) {
this.id = new Obje... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/audience-feedback/index.js | ghost/core/core/server/services/audience-feedback/index.js | const urlUtils = require('../../../shared/url-utils');
const urlService = require('../../services/url');
const AudienceFeedbackService = require('./AudienceFeedbackService');
const AudienceFeedbackController = require('./AudienceFeedbackController');
const Feedback = require('./Feedback');
const FeedbackRepository = r... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/frontend-data-service/index.js | ghost/core/core/server/services/frontend-data-service/index.js | const models = require('../../models');
const FrontendDataService = require('./FrontendDataService');
module.exports.init = () => {
return new FrontendDataService({IntegrationModel: models.Integration});
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/frontend-data-service/FrontendDataService.js | ghost/core/core/server/services/frontend-data-service/FrontendDataService.js | const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
class FrontendDataService {
constructor({IntegrationModel}) {
this.IntegrationModel = IntegrationModel;
this.frontendKey = null;
}
async getFrontendKey() {
if (this.frontendKey) {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/index.js | ghost/core/core/server/services/offers/index.js | module.exports = require('./service');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/service.js | ghost/core/core/server/services/offers/service.js | const DynamicRedirectManager = require('../lib/DynamicRedirectManager');
const config = require('../../../shared/config');
const urlUtils = require('../../../shared/url-utils');
const models = require('../../models');
const OfferBookshelfRepository = require('./OfferBookshelfRepository');
const OffersModule = require('... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/OfferBookshelfRepository.js | ghost/core/core/server/services/offers/OfferBookshelfRepository.js | const {flowRight} = require('lodash');
const {mapKeyValues, mapQuery} = require('@tryghost/mongo-utils');
const DomainEvents = require('@tryghost/domain-events');
const Offer = require('./domain/models/Offer');
const sentry = require('../../../shared/sentry');
const logger = require('@tryghost/logging');
const statusT... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/OffersModule.js | ghost/core/core/server/services/offers/OffersModule.js | /* eslint-disable max-lines */
// @TODO: Reduce file length and remove the line above
const DomainEvents = require('@tryghost/domain-events');
const OfferCodeChangeEvent = require('./domain/events/OfferCodeChangeEvent');
const OfferCreatedEvent = require('./domain/events/OfferCreatedEvent');
const Offer = require('./d... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/errors/index.js | ghost/core/core/server/services/offers/domain/errors/index.js | const {ValidationError} = require('@tryghost/errors');
class InvalidPropError extends ValidationError {
/** @param {any} options */
constructor(options) {
super({
statusCode: 400,
...options
});
this.errorType = this.constructor.name;
}
}
class InvalidOfferN... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferTitle.js | ghost/core/core/server/services/offers/domain/models/OfferTitle.js | const ValueObject = require('./shared/ValueObject');
const InvalidOfferTitle = require('../errors').InvalidOfferTitle;
/** @extends ValueObject<string> */
class OfferTitle extends ValueObject {
/** @param {unknown} title */
static create(title) {
if (title === null || title === undefined) {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferStatus.js | ghost/core/core/server/services/offers/domain/models/OfferStatus.js | const ValueObject = require('./shared/ValueObject');
const InvalidOfferStatus = require('../errors').InvalidOfferStatus;
/** @extends ValueObject<'active'|'archived'> */
class OfferStatus extends ValueObject {
/** @param {unknown} status */
static create(status) {
if (typeof status !== 'string') {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferCurrency.js | ghost/core/core/server/services/offers/domain/models/OfferCurrency.js | const ValueObject = require('./shared/ValueObject');
const InvalidOfferCurrency = require('../errors').InvalidOfferCurrency;
/** @extends ValueObject<string> */
class OfferCurrency extends ValueObject {
/** @param {unknown} currency */
static create(currency) {
if (typeof currency !== 'string') {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferCode.js | ghost/core/core/server/services/offers/domain/models/OfferCode.js | const {slugify} = require('@tryghost/string');
const ValueObject = require('./shared/ValueObject');
const InvalidOfferCode = require('../errors').InvalidOfferCode;
/** @extends ValueObject<string> */
class OfferCode extends ValueObject {
/** @param {unknown} code */
static create(code) {
if (!code || ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferCadence.js | ghost/core/core/server/services/offers/domain/models/OfferCadence.js | const ValueObject = require('./shared/ValueObject');
const InvalidOfferCadence = require('../errors').InvalidOfferCadence;
/**
* @extends ValueObject<'month'|'year'>
*/
class OfferCadence extends ValueObject {
/** @param {unknown} cadence */
static create(cadence) {
if (!cadence || typeof cadence !==... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferDescription.js | ghost/core/core/server/services/offers/domain/models/OfferDescription.js | const ValueObject = require('./shared/ValueObject');
const InvalidOfferDescription = require('../errors').InvalidOfferDescription;
/** @extends ValueObject<string> */
class OfferDescription extends ValueObject {
/** @param {unknown} description */
static create(description) {
if (description === null |... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferDuration.js | ghost/core/core/server/services/offers/domain/models/OfferDuration.js | const ValueObject = require('./shared/ValueObject');
const InvalidOfferDuration = require('../errors').InvalidOfferDuration;
/**
* @typedef {object} BasicDuration
* @prop {'once'|'forever'|'trial'} type
*/
/**
* @typedef {object} RepeatingDuration
* @prop {'repeating'} type
* @prop {number} months
*/
/**
* @... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferType.js | ghost/core/core/server/services/offers/domain/models/OfferType.js | const ValueObject = require('./shared/ValueObject');
const InvalidOfferType = require('../errors').InvalidOfferType;
/** @extends ValueObject<'fixed'|'percent'|'trial'> */
class OfferType extends ValueObject {
/** @param {unknown} type */
static create(type) {
if (!type || typeof type !== 'string') {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferName.js | ghost/core/core/server/services/offers/domain/models/OfferName.js | const ValueObject = require('./shared/ValueObject');
const InvalidOfferName = require('../errors').InvalidOfferName;
/** @extends ValueObject<string> */
class OfferName extends ValueObject {
/** @param {unknown} name */
static create(name) {
if (!name || typeof name !== 'string') {
throw ne... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferAmount.js | ghost/core/core/server/services/offers/domain/models/OfferAmount.js | const ValueObject = require('./shared/ValueObject');
const InvalidOfferAmount = require('../errors').InvalidOfferAmount;
/** @extends ValueObject<number> */
class OfferAmount extends ValueObject {}
class OfferPercentageAmount extends OfferAmount {
/** @param {unknown} amount */
static create(amount) {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/OfferCreatedAt.js | ghost/core/core/server/services/offers/domain/models/OfferCreatedAt.js | const ValueObject = require('./shared/ValueObject');
const InvalidOfferCreatedAt = require('../errors').InvalidOfferCreatedAt;
/** @extends ValueObject<string> */
class OfferCreatedAt extends ValueObject {
/** @param {Date} createdAt */
constructor(createdAt) {
super(createdAt.toISOString()); // Conver... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/StripeCoupon.js | ghost/core/core/server/services/offers/domain/models/StripeCoupon.js | const ValueObject = require('./shared/ValueObject');
const InvalidStripeCoupon = require('../errors').InvalidStripeCoupon;
/**
* @typedef {Object} StripeCouponInput
* @property {string} id
* @property {number} [percent_off]
* @property {number} [amount_off]
* @property {string} [currency]
* @property {string} d... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/Offer.js | ghost/core/core/server/services/offers/domain/models/Offer.js | const errors = require('../errors');
const ObjectID = require('bson-objectid').default;
const OfferName = require('./OfferName');
const OfferCode = require('./OfferCode');
const OfferAmount = require('./OfferAmount');
const OfferTitle = require('./OfferTitle');
const OfferDescription = require('./OfferDescription');
c... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/models/shared/ValueObject.js | ghost/core/core/server/services/offers/domain/models/shared/ValueObject.js | const {isEqual} = require('lodash');
/**
* @template T
*/
class ValueObject {
/** @type {{value: T}} */
props;
/** @type T */
get value() {
return this.props.value;
}
/**
* @protected
* @param {T} value
*/
constructor(value) {
/** @private */
this.p... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/events/OfferCodeChangeEvent.js | ghost/core/core/server/services/offers/domain/events/OfferCodeChangeEvent.js | /** @typedef {import('../models/OfferCode')} OfferCode */
/**
* @typedef {object} OfferCodeChangeEventData
* @prop {string} offerId
* @prop {OfferCode} previousCode
* @prop {OfferCode} currentCode
*/
module.exports = class OfferCodeChangeEvent {
/**
* @param {OfferCodeChangeEventData} data
* @param... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/domain/events/OfferCreatedEvent.js | ghost/core/core/server/services/offers/domain/events/OfferCreatedEvent.js | /** @typedef {import('../models/Offer')} Offer */
/**
* @typedef {object} OfferCreatedEventData
* @prop {Offer} offer
*/
module.exports = class OfferCreatedEvent {
/**
* @param {OfferCreatedEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/application/OfferMapper.js | ghost/core/core/server/services/offers/application/OfferMapper.js | /**
* @typedef {import('../domain/models/Offer')} Offer
*/
/**
* @typedef {object} OfferDTO
* @prop {string} id
* @prop {string} name
* @prop {string} code
*
* @prop {string} display_title
* @prop {string} display_description
*
* @prop {'percent'|'fixed'|'trial'} type
*
* @prop {'month'|'year'} cadence
*... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/application/OffersAPI.js | ghost/core/core/server/services/offers/application/OffersAPI.js | const Offer = require('../domain/models/Offer');
const OfferName = require('../domain/models/OfferName');
const OfferCode = require('../domain/models/OfferCode');
const OfferTitle = require('../domain/models/OfferTitle');
const OfferDescription = require('../domain/models/OfferDescription');
const OfferStatus = require... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/offers/application/UniqueChecker.js | ghost/core/core/server/services/offers/application/UniqueChecker.js | class UniqueChecker {
/**
* @param {import('./OfferRepository')} repository
* @param {import('knex').Transaction} transaction
*/
constructor(repository, transaction) {
this.repository = repository;
this.options = {
transacting: transaction
};
}
/**
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/identity-tokens/index.js | ghost/core/core/server/services/identity-tokens/index.js | module.exports = require('./IdentityTokenServiceWrapper');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/identity-tokens/IdentityTokenServiceWrapper.js | ghost/core/core/server/services/identity-tokens/IdentityTokenServiceWrapper.js | const {IdentityTokenService} = require('./IdentityTokenService');
module.exports = class IdentityTokenServiceWrapper {
/** @type IdentityTokenService */
static instance;
static async init() {
if (IdentityTokenServiceWrapper.instance) {
return;
}
const urlUtils = requir... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/settings-helpers/index.js | ghost/core/core/server/services/settings-helpers/index.js | const settingsCache = require('../../../shared/settings-cache');
const urlUtils = require('../../../shared/url-utils');
const config = require('../../../shared/config');
const SettingsHelpers = require('./SettingsHelpers');
const labs = require('../../../shared/labs');
const limitService = require('../limits');
module... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/settings-helpers/SettingsHelpers.js | ghost/core/core/server/services/settings-helpers/SettingsHelpers.js | const net = require('net');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const EmailAddressParser = require('../email-address/EmailAddressParser');
const logging = require('@tryghost/logging');
const crypto = require('crypto');
const debug = require('@tryghost/debug')('services:sett... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/settings/settings-utils.js | ghost/core/core/server/services/settings/settings-utils.js | const crypto = require('crypto');
const validator = require('@tryghost/validator');
const config = require('../../../shared/config');
const logging = require('@tryghost/logging');
// The string returned when a setting is set as write-only
const obfuscatedSetting = '••••••••';
/**
* @description // The function used ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/settings/index.js | ghost/core/core/server/services/settings/index.js | module.exports = require('./settings-service');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/settings/SettingsBREADService.js | ghost/core/core/server/services/settings/SettingsBREADService.js | const _ = require('lodash');
const tpl = require('@tryghost/tpl');
const {NotFoundError, NoPermissionError, BadRequestError, IncorrectUsageError, ValidationError} = require('@tryghost/errors');
const {obfuscatedSetting, isSecretSetting, hideValueIfSecret} = require('./settings-utils');
const logging = require('@tryghos... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/settings/settings-service.js | ghost/core/core/server/services/settings/settings-service.js | /**
* Settings Lib
* A collection of utilities for handling settings including a cache
*/
const events = require('../../lib/common/events');
const models = require('../../models');
const labs = require('../../../shared/labs');
const limits = require('../limits');
const config = require('../../../shared/config');
con... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/settings/emails/verify-email.js | ghost/core/core/server/services/settings/emails/verify-email.js | module.exports = ({email, url}) => `
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Confirm your email address</title>
<style>
/* -------------------------------------
RESPONSIVE A... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/Mention.js | ghost/core/core/server/services/mentions/Mention.js | const ObjectID = require('bson-objectid').default;
const {ValidationError} = require('@tryghost/errors');
const MentionCreatedEvent = require('./MentionCreatedEvent');
module.exports = class Mention {
/** @type {Array} */
events = [];
/** @type {ObjectID} */
#id;
get id() {
return this.#id... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/MentionCreatedEvent.js | ghost/core/core/server/services/mentions/MentionCreatedEvent.js | /**
* @typedef {object} MentionCreatedEventData
* @property {import('./Mention')} mention
*/
module.exports = class MentionCreatedEvent {
/**
* @param {MentionCreatedEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
this.timestamp = ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/index.js | ghost/core/core/server/services/mentions/index.js | module.exports = require('./service');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/BookshelfMentionRepository.js | ghost/core/core/server/services/mentions/BookshelfMentionRepository.js | const Mention = require('./Mention');
const logging = require('@tryghost/logging');
/**
* @typedef {import('./MentionsAPI').IMentionRepository} IMentionRepository
*/
/**
* @template Model
* @typedef {import('./MentionsAPI').Page<Model>} Page
*/
/**
* @typedef {import('./MentionsAPI').GetPageOptions} GetPageOpt... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/service.js | ghost/core/core/server/services/mentions/service.js | const MentionController = require('./MentionController');
const WebmentionMetadata = require('./WebmentionMetadata');
const MentionsAPI = require('./MentionsAPI');
const MentionSendingService = require('./MentionSendingService');
const MentionDiscoveryService = require('./MentionDiscoveryService');
const BookshelfMenti... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/RoutingService.js | ghost/core/core/server/services/mentions/RoutingService.js | const logging = require('@tryghost/logging');
/**
* @typedef {import('./MentionsAPI').IRoutingService} IRoutingService
* @typedef {import('./MentionsAPI').IResourceService} IResourceService
*/
/**
* @typedef {object} IUrlUtils
* @prop {() => string} getSiteUrl
* @prop {() => string} getSubdir
*/
/**
* @imple... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/MentionDiscoveryService.js | ghost/core/core/server/services/mentions/MentionDiscoveryService.js | const logging = require('@tryghost/logging');
module.exports = class MentionDiscoveryService {
#externalRequest;
constructor({externalRequest}) {
this.#externalRequest = externalRequest;
}
/**
* Fetches the given URL to identify the webmention endpoint
* @param {URL} url
* @ret... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/MentionController.js | ghost/core/core/server/services/mentions/MentionController.js | const logging = require('@tryghost/logging');
/**
* @typedef {import('./MentionsAPI')} MentionsAPI
* @typedef {import('./Mention')} Mention
*/
/**
* @template Model
* @typedef {import('./MentionsAPI').Page<Model>} Page<Model>
*/
/**
* @typedef {object} MentionResource
* @prop {import('bson-objectid').default... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/MentionsAPI.js | ghost/core/core/server/services/mentions/MentionsAPI.js | const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const Mention = require('./Mention');
/**
* @template Model
* @typedef {object} Page<Model>
* @prop {Model[]} data
* @prop {object} meta
* @prop {object} meta.pagination
* @prop {number} meta.pagination.page - The current p... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/MentionSendingService.js | ghost/core/core/server/services/mentions/MentionSendingService.js | const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
module.exports = class MentionSendingService {
#discoveryService;
#externalRequest;
#getSiteUrl;
#getPostUrl;
#isEnabled;
#jobService;
constructor({discoveryService, externalRequest, getSiteUrl, getPo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/InMemoryMentionRepository.js | ghost/core/core/server/services/mentions/InMemoryMentionRepository.js | const nql = require('@tryghost/nql');
const Mention = require('./Mention');
/**
* @typedef {import('./MentionsAPI').GetPageOptions} GetPageOptions
* @typedef {import('./MentionsAPI').IMentionRepository} IMentionRepository
*/
/**
* @template Model
* @typedef {import('./MentionsAPI').Page<Model>} Page<Model>
*/
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/ResourceService.js | ghost/core/core/server/services/mentions/ResourceService.js | const ObjectID = require('bson-objectid').default;
/**
* @typedef {import('./MentionsAPI').IResourceService} IResourceService
*/
/**
* @implements {IResourceService}
*/
module.exports = class ResourceService {
/** @type {import('@tryghost/url-utils/lib/url-utils')} */
#urlUtils;
/** @type {import('..... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/mentions/WebmentionMetadata.js | ghost/core/core/server/services/mentions/WebmentionMetadata.js | const oembedService = require('../oembed');
module.exports = class WebmentionMetadata {
/**
* Helpers that change the URL for which metadata for a given external resource is fetched. Return undefined to now handle the URL.
* @type {((url: URL) => URL|undefined)[]}
*/
#mappers = [];
/**
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/activitypub/ActivityPubServiceWrapper.js | ghost/core/core/server/services/activitypub/ActivityPubServiceWrapper.js | const {ActivityPubService} = require('./ActivityPubService');
module.exports = class ActivityPubServiceWrapper {
/** @type ActivityPubService */
static instance;
static initialised = false;
static async init() {
if (ActivityPubServiceWrapper.instance) {
return;
}
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/activitypub/index.js | ghost/core/core/server/services/activitypub/index.js | module.exports = require('./ActivityPubServiceWrapper');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/invitations/accept.js | ghost/core/core/server/services/invitations/accept.js | const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const models = require('../../models');
const security = require('@tryghost/security');
const messages = {
inviteNotFound: 'Invite not found.',
inviteExpired: 'Invite is expired.',
inviteEmailAlreadyExist: {
message: ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/invitations/index.js | ghost/core/core/server/services/invitations/index.js | module.exports = {
get accept() {
return require('./accept');
}
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members-events/LastSeenAtUpdater.js | ghost/core/core/server/services/members-events/LastSeenAtUpdater.js | const {MemberPageViewEvent, MemberCommentEvent, MemberLinkClickEvent} = require('../../../shared/events');
const moment = require('moment-timezone');
const {IncorrectUsageError} = require('@tryghost/errors');
const EmailOpenedEvent = require('../../services/email-service/events/EmailOpenedEvent');
const logging = requi... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members-events/index.js | ghost/core/core/server/services/members-events/index.js | const labsService = require('../../../shared/labs');
const DomainEvents = require('@tryghost/domain-events');
const events = require('../../lib/common/events');
const settingsCache = require('../../../shared/settings-cache');
const members = require('../members');
const config = require('../../../shared/config');
clas... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members-events/EventStorage.js | ghost/core/core/server/services/members-events/EventStorage.js | const {MemberCreatedEvent, SubscriptionCreatedEvent} = require('../../../shared/events');
/**
* Store events in the database
*/
class EventStorage {
/**
*
* @param {Object} deps
* @param {Object} deps.labsService
* @param {Object} deps.models
* @param {Object} deps.models.MemberCreatedEv... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members-events/LastSeenAtCache.js | ghost/core/core/server/services/members-events/LastSeenAtCache.js | const moment = require('moment-timezone');
/**
* A cache that stores the member ids that have been seen today. This cache is used to avoid having to query the database for the last_seen_at timestamp of a member multiple times in the same day.
*
* @constructor
* @param {Object} settingsCache - An instance of the s... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/stripe/WebhookManager.js | ghost/core/core/server/services/stripe/WebhookManager.js | /**
* @typedef {import('stripe').Stripe.WebhookEndpointCreateParams.EnabledEvent} WebhookEvent
* @typedef {import('./StripeAPI')} StripeAPI
*/
/**
* @typedef {object} StripeWebhookModel
* @prop {string} webhook_id
* @prop {string} secret
*/
/**
* @typedef {object} StripeWebhook
* @prop {(data: StripeWebhookM... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/stripe/StripeAPI.js | ghost/core/core/server/services/stripe/StripeAPI.js | // @ts-ignore
const {VersionMismatchError} = require('@tryghost/errors');
// @ts-ignore
const debug = require('@tryghost/debug')('stripe');
const Stripe = require('stripe').Stripe;
/* Stripe has the following rate limits:
* - For most APIs, 100 read requests per second in live mode, 25 read requests per second in tes... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/stripe/index.js | ghost/core/core/server/services/stripe/index.js | module.exports = require('./service');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/stripe/service.js | ghost/core/core/server/services/stripe/service.js | const _ = require('lodash');
const StripeService = require('./StripeService');
const logging = require('@tryghost/logging');
const membersService = require('../members');
const config = require('../../../shared/config');
const settings = require('../../../shared/settings-cache');
const urlUtils = require('../../../shar... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/stripe/config.js | ghost/core/core/server/services/stripe/config.js | const logging = require('@tryghost/logging');
const tpl = require('@tryghost/tpl');
const labs = require('../../../shared/labs');
const messages = {
remoteWebhooksInDevelopment: 'Cannot use remote webhooks in development. See https://ghost.org/docs/webhooks/#stripe-webhooks for developing with Stripe.'
};
// @TOD... | 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.