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/member-attribution/UrlHistory.js | ghost/core/core/server/services/member-attribution/UrlHistory.js | /**
* @typedef {Object} UrlHistoryItem
* @prop {string} [path]
* @prop {string} [id]
* @prop {string} [type]
* @prop {string} [referrerSource]
* @prop {string} [referrerMedium]
* @prop {string} [referrerUrl]
* @prop {string} [utmSource]
* @prop {string} [utmMedium]
* @prop {string} [utmCampaign]
* @prop {str... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/member-attribution/OutboundLinkTagger.js | ghost/core/core/server/services/member-attribution/OutboundLinkTagger.js | const {slugify} = require('@tryghost/string');
const LinkReplacer = require('../lib/link-replacer');
const blockedReferrerDomains = [
// Facebook has some restrictions on the 'ref' attribute (max 15 chars + restricted character set) that breaks links if we add ?ref=longer-string
'facebook.com',
'www.facebo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/member-attribution/index.js | ghost/core/core/server/services/member-attribution/index.js | const urlService = require('../url');
const urlUtils = require('../../../shared/url-utils');
const settingsCache = require('../../../shared/settings-cache');
const config = require('../../../shared/config');
class MemberAttributionServiceWrapper {
init() {
if (this.service) {
// Already done
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/member-attribution/UrlTranslator.js | ghost/core/core/server/services/member-attribution/UrlTranslator.js | /**
* @typedef {Object} UrlService
* @prop {(resourceId: string, options) => Object} getResource
* @prop {(resourceId: string, options) => string} getUrlByResourceId
*
*/
/**
* Translate a url into, (id+type), or a resource, and vice versa
*/
class UrlTranslator {
/**
*
* @param {Object} 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/member-attribution/ReferrerTranslator.js | ghost/core/core/server/services/member-attribution/ReferrerTranslator.js | /**
* @typedef {Object} ReferrerData
* @prop {string|null} [referrerSource]
* @prop {string|null} [referrerMedium]
* @prop {string|null} [referrerUrl]
* @prop {string|null} [utmSource]
* @prop {string|null} [utmMedium]
* @prop {string|null} [utmCampaign]
* @prop {string|null} [utmTerm]
* @prop {string|null} [u... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/member-attribution/AttributionBuilder.js | ghost/core/core/server/services/member-attribution/AttributionBuilder.js | /**
* @typedef {object} AttributionResource
* @prop {string|null} id
* @prop {string|null} url (absolute URL)
* @prop {'page'|'post'|'author'|'tag'|'url'|null} type
* @prop {string|null} title
* @prop {string|null} referrerSource
* @prop {string|null} referrerMedium
* @prop {string|null} referrerUrl
* @prop {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/notifications/index.js | ghost/core/core/server/services/notifications/index.js | const settingsCache = require('../../../shared/settings-cache');
const Notifications = require('./Notifications');
const models = require('../../models');
module.exports.notifications = new Notifications({
settingsCache,
SettingsModel: models.Settings
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/notifications/Notifications.js | ghost/core/core/server/services/notifications/Notifications.js | const moment = require('moment-timezone');
const semver = require('semver');
const _ = require('lodash');
const errors = require('@tryghost/errors');
const ghostVersion = require('@tryghost/version');
const tpl = require('@tryghost/tpl');
const ObjectId = require('bson-objectid').default;
const messages = {
noPerm... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/lib/EmailContentGenerator.js | ghost/core/core/server/services/lib/EmailContentGenerator.js | const _ = require('lodash').runInContext();
const fs = require('fs-extra');
const path = require('path');
_.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
class EmailContentGenerator {
/**
*
* @param {Object} options
* @param {function} options.getSiteUrl
* @param {function} options.getSite... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/lib/MailgunClient.js | ghost/core/core/server/services/lib/MailgunClient.js | const _ = require('lodash');
const debug = require('@tryghost/debug');
const logging = require('@tryghost/logging');
const metrics = require('@tryghost/metrics');
const errors = require('@tryghost/errors');
module.exports = class MailgunClient {
#config;
#settings;
#labs;
static DEFAULT_BATCH_SIZE = 1... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/lib/DynamicRedirectManager.js | ghost/core/core/server/services/lib/DynamicRedirectManager.js | const express = require('express');
const {parse: parseURL, format: formatURL} = require('url');
const {parse: parseQuerystring, stringify: formatQuerystring} = require('querystring');
class DynamicRedirectManager {
/**
* @param {object} config
* @param {number} config.permanentMaxAge
* @param {func... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/lib/link-replacer.js | ghost/core/core/server/services/lib/link-replacer.js | class LinkReplacer {
/**
* Replaces the links in the provided HTML
* @param {string} html
* @param {(url: URL, originalPath: string) => Promise<URL|string|false>} replaceLink
* @param {object} options
* @param {string} [options.base] If you want to replace relative links, this will replace ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/lib/magic-link/MagicLink.js | ghost/core/core/server/services/lib/magic-link/MagicLink.js | const {IncorrectUsageError, BadRequestError} = require('@tryghost/errors');
const {isEmail} = require('@tryghost/validator');
const tpl = require('@tryghost/tpl');
const messages = {
invalidEmail: 'Email is not valid'
};
/**
* @typedef { import('nodemailer').Transporter } MailTransporter
* @typedef { import('no... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/explore/ExploreService.js | ghost/core/core/server/services/explore/ExploreService.js | const ghostVersion = require('@tryghost/version');
module.exports = class ExploreService {
/**
* @param {Object} options
* @param {Object} options.MembersService
* @param {Object} options.PostsService
* @param {Object} options.PublicConfigService
* @param {Object} options.StatsService
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/explore/index.js | ghost/core/core/server/services/explore/index.js | const ExploreService = require('./ExploreService');
const MembersService = require('../members');
const PostsService = require('../posts/posts-service')();
const PublicConfigService = require('../public-config');
const StatsService = require('../stats');
const StripeService = require('../stripe');
const models = requ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/adapter-manager/index.js | ghost/core/core/server/services/adapter-manager/index.js | const AdapterManager = require('./AdapterManager');
const getAdapterServiceConfig = require('./config');
const resolveAdapterOptions = require('./options-resolver');
const config = require('../../../shared/config');
const adapterManager = new AdapterManager({
loadAdapterFromPath: require,
pathsToAdapters: [
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/adapter-manager/options-resolver.js | ghost/core/core/server/services/adapter-manager/options-resolver.js | /**
* Resolves full configuration for an adapter. Combining base class configurations
* along with feature-specific ones
*
* @param {String} name
* @param {Object} adapterServiceConfig
*
* @returns {{adapterClassName: String, adapterConfig: Object}}
*/
const resolveAdapterOptions = (name, adapterServiceConfi... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/adapter-manager/config.js | ghost/core/core/server/services/adapter-manager/config.js | /**
* Maps configuration from the config file to a unified adapter config in following form:
* {
* [adapterType]: {
* active: [adapterName],
* [adapterName]: {}
* }
* }
*/
module.exports = function getAdapterServiceConfig(config) {
const adapterServiceConfig = config.get('adapters');
if (!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/adapter-manager/AdapterManager.js | ghost/core/core/server/services/adapter-manager/AdapterManager.js | const path = require('path');
const errors = require('@tryghost/errors');
const resolveAdapterExport = (moduleExport) => {
if (!moduleExport) {
return moduleExport;
}
if (typeof moduleExport === 'function') {
return moduleExport;
}
if (typeof moduleExport === 'object' && typeof mo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/tagged-template-fns.js | ghost/core/core/server/services/koenig/render-utils/tagged-template-fns.js | function _oneline(string) {
return string
.replace(/\n\s+/g, ' ') // Replace newlines + whitespace with single space
.replace(/>\s+</g, '><') // Remove spaces between closing and opening tags
.replace(/\s+>/g, '>') // Remove unnecessary whitespace inside tag
.trim();
}
const oneline... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/get-resized-image-dimensions.js | ghost/core/core/server/services/koenig/render-utils/get-resized-image-dimensions.js | const getResizedImageDimensions = function (image, {width: desiredWidth, height: desiredHeight} = {}) {
const {width, height} = image;
const ratio = width / height;
if (desiredWidth) {
const resizedHeight = Math.round(desiredWidth / ratio);
return {
width: desiredWidth,
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/slugify.js | ghost/core/core/server/services/koenig/render-utils/slugify.js | function slugify(str) {
// Remove HTML tags
str = str.replace(/<[^>]*>?/gm, '');
// Remove any non-word character with whitespace
str = str.replace(/[^\w\s]/gi, '');
// Replace any whitespace character with a dash
str = str.replace(/\s+/g, '-');
// Convert to lowercase
str = str.toLow... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/escape-html.js | ghost/core/core/server/services/koenig/render-utils/escape-html.js | /**
* Escape HTML special characters
* @param {string} unsafe
* @returns string
*/
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
module.exports = {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/size-byte-converter.js | ghost/core/core/server/services/koenig/render-utils/size-byte-converter.js | function sizeToBytes(size) {
if (!size) {
return 0;
}
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
const sizeParts = size.split(' ');
const sizeNumber = parseFloat(sizeParts[0]);
const sizeUnit = sizeParts[1];
const sizeUnitIndex = sizes.indexOf(sizeUnit);
if (sizeUnitIndex =... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/is-local-content-image.js | ghost/core/core/server/services/koenig/render-utils/is-local-content-image.js | const isLocalContentImage = function (url, siteUrl = '') {
const normalizedSiteUrl = siteUrl.replace(/\/$/, '');
const imagePath = url.replace(normalizedSiteUrl, '');
return /^(\/.*|__GHOST_URL__)\/?content\/images\//.test(imagePath);
};
module.exports = {
isLocalContentImage
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/srcset-attribute.js | ghost/core/core/server/services/koenig/render-utils/srcset-attribute.js | const {isLocalContentImage} = require('./is-local-content-image');
const {getAvailableImageWidths} = require('./get-available-image-widths');
const {isUnsplashImage} = require('./is-unsplash-image');
// default content sizes: [600, 1000, 1600, 2400]
const getSrcsetAttribute = function ({src, width, options}) {
if... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/build-clean-basic-html-for-element.js | ghost/core/core/server/services/koenig/render-utils/build-clean-basic-html-for-element.js | const cleanBasicHtml = require('@tryghost/kg-clean-basic-html');
function buildCleanBasicHtmlForElement(domNode) {
return function _cleanBasicHtml(html, additionalOptions = {}) {
const cleanedHtml = cleanBasicHtml(html, {
createDocument: (_html) => {
const newDoc = domNode.owner... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/get-available-image-widths.js | ghost/core/core/server/services/koenig/render-utils/get-available-image-widths.js | const getAvailableImageWidths = function (image, imageSizes) {
// get a sorted list of the available responsive widths
const imageWidths = Object.values(imageSizes)
.map(({width}) => width)
.sort((a, b) => a - b);
// select responsive widths that are usable based on the image width
cons... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/replacement-strings.js | ghost/core/core/server/services/koenig/render-utils/replacement-strings.js | /**
* Removes consecutive whitespaces and newlines
* @param {string} html
* @returns {string}
*/
function removeSpaces(html) {
return html.replace(/\n/g, ' ').replace(/\s+/g, ' ').trim();
}
/**
* Wraps replacement strings with %%
* This helps to prevent conflicts between code samples and our replacement stri... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/render-empty-container.js | ghost/core/core/server/services/koenig/render-utils/render-empty-container.js | /*
* Renders an empty container element
* In the returned object, `type: 'inner'` is picked up by the `@tryghost/kg-lexical-html-renderer` package
* to render the inner content of the container element (in this case, nothing)
*
* @see @tryghost/kg-lexical-html-renderer package
* @see https://github.com/TryGhost/K... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/is-unsplash-image.js | ghost/core/core/server/services/koenig/render-utils/is-unsplash-image.js | const isUnsplashImage = function (url) {
return /images\.unsplash\.com/.test(url);
};
module.exports = {
isUnsplashImage
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/add-create-document-option.js | ghost/core/core/server/services/koenig/render-utils/add-create-document-option.js | // If we're in a browser environment, we can use the global document object,
// but if we're in a non-browser environment, we need to be passed a `createDocument` function
function addCreateDocumentOption(options) {
if (!options.createDocument && options.dom) {
options.createDocument = function () {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/truncate.js | ghost/core/core/server/services/koenig/render-utils/truncate.js | const {escapeHtml} = require('./escape-html');
function truncateText(text, maxLength) {
if (text && text.length > maxLength) {
return text.substring(0, maxLength - 1).trim() + '…';
} else {
return text ?? '';
}
}
function truncateHtml(text, maxLength, maxLengthMobile) {
// If no mobile... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/clean-dom.js | ghost/core/core/server/services/koenig/render-utils/clean-dom.js | function cleanDOM(node, allowedTags) {
for (let i = 0; i < node.childNodes.length; i++) {
let child = node.childNodes[i];
if (child.nodeType === 1 && !allowedTags.includes(child.tagName)) {
while (child.firstChild) {
node.insertBefore(child.firstChild, child);
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/visibility.js | ghost/core/core/server/services/koenig/render-utils/visibility.js | const {renderEmptyContainer} = require('./render-empty-container');
const ALL_MEMBERS_SEGMENT = 'status:free,status:-free';
const PAID_MEMBERS_SEGMENT = 'status:-free'; // paid + comped
const FREE_MEMBERS_SEGMENT = 'status:free';
const NO_MEMBERS_SEGMENT = '';
const DEFAULT_VISIBILITY = {
web: {
nonMember... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-utils/stylex.js | ghost/core/core/server/services/koenig/render-utils/stylex.js | /**
* Converts a camelCase string to kebab-case
* @param {string} str - The string to convert
* @returns {string} The kebab-case string
*/
function toKebabCase(str) {
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
}
/**
* Formats a CSS value, adding units where necessary
* @param {string} k... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/render-partials/email-button.js | ghost/core/core/server/services/koenig/render-partials/email-button.js | const clsx = require('clsx');
const {textColorForBackgroundColor} = require('@tryghost/color-utils');
const {html} = require('../render-utils/tagged-template-fns.js');
const stylex = require('../render-utils/stylex.js');
/**
* @typedef {Object} EmailButtonOptions
* @property {string} [url=''] - The URL the button li... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/button-renderer.js | ghost/core/core/server/services/koenig/node-renderers/button-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
const {renderEmailButton} = require('../render-partials/email-button');
const {html} = require('../render-utils/tagged-template-fns.js');
function 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/koenig/node-renderers/image-renderer.js | ghost/core/core/server/services/koenig/node-renderers/image-renderer.js | const {getAvailableImageWidths} = require('../render-utils/get-available-image-widths');
const {isLocalContentImage} = require('../render-utils/is-local-content-image');
const {setSrcsetAttribute} = require('../render-utils/srcset-attribute');
const {getResizedImageDimensions} = require('../render-utils/get-resized-ima... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/header-v1-renderer.js | ghost/core/core/server/services/koenig/node-renderers/header-v1-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
const {slugify} = require('../render-utils/slugify');
const {html} = require('../render-utils/tagged-template-fns');
function renderHeaderNodeV1(nod... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/paywall-renderer.js | ghost/core/core/server/services/koenig/node-renderers/paywall-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
function renderPaywallNode(_, options = {}) {
addCreateDocumentOption(options);
const document = options.createDocument();
const element = document.createElement('div');
element.innerHTML = '<!--members-only-->';
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/index.js | ghost/core/core/server/services/koenig/node-renderers/index.js | /**
* Custom renderers for lexical nodes
*
* Export an object where keys are node types and values are renderer functions.
* Example:
* module.exports = {
* image: (node, options) => ({ element: customImageElement, type: 'inner' })
* };
*/
module.exports = {
audio: require('./audio-renderer'),
bookmar... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/html-renderer.js | ghost/core/core/server/services/koenig/node-renderers/html-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
const {renderWithVisibility} = require('../render-utils/visibility');
const {wrapReplacementStrings} = require('../render-utils/replacement-strings')... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/markdown-renderer.js | ghost/core/core/server/services/koenig/node-renderers/markdown-renderer.js | const markdownHtmlRenderer = require('@tryghost/kg-markdown-html-renderer');
const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
function renderMarkdownNode(node, options = {}) {
addCreateDocumentOption(options);
const document = options.createDocument();
const html = ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/codeblock-renderer.js | ghost/core/core/server/services/koenig/node-renderers/codeblock-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
function renderCodeBlockNode(node, options = {}) {
addCreateDocumentOption(options);
const document = options.createDocument();
if (!no... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/video-renderer.js | ghost/core/core/server/services/koenig/node-renderers/video-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
function renderVideoNode(node, options = {}) {
addCreateDocumentOption(options);
const document = options.createDocument();
if (!node.... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/toggle-renderer.js | ghost/core/core/server/services/koenig/node-renderers/toggle-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {html} = require('../render-utils/tagged-template-fns.js');
function cardTemplate({node}) {
return (
`
<div class="kg-card kg-toggle-card" data-kg-toggle-state="close">
<div class="kg-toggle-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/koenig/node-renderers/product-renderer.js | ghost/core/core/server/services/koenig/node-renderers/product-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
const {getResizedImageDimensions} = require('../render-utils/get-resized-image-dimensions');
const {renderEmailButton} = require('../render-partials/... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/signup-renderer.js | ghost/core/core/server/services/koenig/node-renderers/signup-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
// ref https://ghost.org/docs/themes/members#signup-forms
function cardTemplate(nodeData) {
const cardClasses = getCardClasses(nodeData).join(' ');
const backgroundAccent = getAccentClass(nodeData); // don't apply accent... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/audio-renderer.js | ghost/core/core/server/services/koenig/node-renderers/audio-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
function renderAudioNode(node, options = {}) {
addCreateDocumentOption(options);
const document = options.createDocument();
if (!node.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/koenig/node-renderers/file-renderer.js | ghost/core/core/server/services/koenig/node-renderers/file-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
const {escapeHtml} = require('../render-utils/escape-html');
const {bytesToSize} = require('../render-utils/size-byte-converter');
function renderFi... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/horizontalrule-renderer.js | ghost/core/core/server/services/koenig/node-renderers/horizontalrule-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {html} = require('../render-utils/tagged-template-fns');
function horizontalRuleFrontendTemplate() {
return html`<hr />`;
}
function horizontalRuleEmailTemplate() {
// Outlook doesn't support HR tags so we need to u... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/email-renderer.js | ghost/core/core/server/services/koenig/node-renderers/email-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {removeSpaces, removeCodeWrappersFromHelpers, wrapReplacementStrings} = require('../render-utils/replacement-strings');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
function renderEmailNo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/gallery-renderer.js | ghost/core/core/server/services/koenig/node-renderers/gallery-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {getAvailableImageWidths} = require('../render-utils/get-available-image-widths');
const {isLocalContentImage} = require('../render-utils/is-local-content-image');
const {isUnsplashImage} = require('../render-utils/is-unsplas... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/header-v2-renderer.js | ghost/core/core/server/services/koenig/node-renderers/header-v2-renderer.js | const {renderEmailButton} = require('../render-partials/email-button');
const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {slugify} = require('../render-utils/slugify');
const {getSrcsetAttribute} = require('../render-utils/srcset-attribute');
// TODO: nodeData.buttonTextCo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/bookmark-renderer.js | ghost/core/core/server/services/koenig/node-renderers/bookmark-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
const {escapeHtml} = require('../render-utils/escape-html');
const {truncateHtml} = require('../render-utils/truncate');
function renderBookmarkNode... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/callout-renderer.js | ghost/core/core/server/services/koenig/node-renderers/callout-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {cleanDOM} = require('../render-utils/clean-dom');
function renderCalloutNode(node, options = {}) {
addCreateDocumentOption(options);
const document = options.createDocument();
const element = document.createElem... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/call-to-action-renderer.js | ghost/core/core/server/services/koenig/node-renderers/call-to-action-renderer.js | const {renderEmailButton} = require('../render-partials/email-button');
const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderWithVisibility} = require('../render-utils/visibility');
const {getResizedImageDimensions} = require('../render-utils/get-resized-image-dimensions... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/koenig/node-renderers/embed-renderer.js | ghost/core/core/server/services/koenig/node-renderers/embed-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {renderEmptyContainer} = require('../render-utils/render-empty-container');
const twitterRenderer = require('./embed/types/twitter');
function renderEmbedNode(node, options = {}) {
addCreateDocumentOption(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/koenig/node-renderers/email-cta-renderer.js | ghost/core/core/server/services/koenig/node-renderers/email-cta-renderer.js | const {addCreateDocumentOption} = require('../render-utils/add-create-document-option');
const {removeCodeWrappersFromHelpers, removeSpaces, wrapReplacementStrings} = require('../render-utils/replacement-strings');
const {escapeHtml} = require('../render-utils/escape-html');
const {renderEmptyContainer} = require('../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/koenig/node-renderers/embed/types/twitter.js | ghost/core/core/server/services/koenig/node-renderers/embed/types/twitter.js | const {DateTime} = require('luxon');
const _ = require('lodash');
function render(node, document, options) {
const metadata = node.metadata;
const figure = document.createElement('figure');
figure.setAttribute('class', 'kg-card kg-embed-card');
let html = node.html;
const tweetData = metadata &&... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/EmailBodyCache.js | ghost/core/core/server/services/email-service/EmailBodyCache.js | /**
* This is a cache provider that lives very short in memory, there is no need for persistence.
* It is created when scheduling an email in the batch sending service, and is then passed to the sending service. The sending service
* can optionally use a passed cache provider to reuse the email body for each batch w... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/EmailEventStorage.js | ghost/core/core/server/services/email-service/EmailEventStorage.js | const moment = require('moment-timezone');
const logging = require('@tryghost/logging');
const config = require('../../../shared/config');
class EmailEventStorage {
#db;
#membersRepository;
#models;
#emailSuppressionList;
#prometheusClient;
#pendingUpdates;
constructor({db, models, members... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/index.js | ghost/core/core/server/services/email-service/index.js | const EmailServiceWrapper = require('./EmailServiceWrapper');
module.exports = new EmailServiceWrapper();
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/EmailRenderer.js | ghost/core/core/server/services/email-service/EmailRenderer.js | /* eslint-disable no-unused-vars */
/* eslint-disable no-shadow */
const logging = require('@tryghost/logging');
const fs = require('fs').promises;
const path = require('path');
const clsx = require('clsx');
const {isUnsplashImage} = require('@tryghost/kg-default-cards/lib/utils');
const {textColorForBackgroundColor, ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | true |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/BatchSendingService.js | ghost/core/core/server/services/email-service/BatchSendingService.js | const logging = require('@tryghost/logging');
const ObjectID = require('bson-objectid').default;
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const EmailBodyCache = require('./EmailBodyCache');
const messages = {
emailErrorPartialFailure: 'An error occurred, and your newsletter... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | true |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/EmailEventProcessor.js | ghost/core/core/server/services/email-service/EmailEventProcessor.js | const logging = require('@tryghost/logging');
const EmailDeliveredEvent = require('./events/EmailDeliveredEvent');
const EmailOpenedEvent = require('./events/EmailOpenedEvent');
const EmailBouncedEvent = require('./events/EmailBouncedEvent');
const EmailTemporaryBouncedEvent = require('./events/EmailTemporaryBouncedEv... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/SendingService.js | ghost/core/core/server/services/email-service/SendingService.js | const validator = require('@tryghost/validator');
const logging = require('@tryghost/logging');
/**
* @typedef {object} EmailData
* @prop {string} html
* @prop {string} plaintext
* @prop {string} subject
* @prop {string} from
* @prop {string} emailId
* @prop {string} [replyTo]
* @prop {string} [domainOverride]... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/MailgunEmailProvider.js | ghost/core/core/server/services/email-service/MailgunEmailProvider.js | const logging = require('@tryghost/logging');
const errors = require('@tryghost/errors');
const debug = require('@tryghost/debug')('email-service:mailgun-provider-service');
/**
* @typedef {object} Recipient
* @prop {string} email
* @prop {Replacement[]} replacements
*/
/**
* @typedef {object} Replacement
* @pr... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/EmailController.js | ghost/core/core/server/services/email-service/EmailController.js | const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const messages = {
postNotFound: 'Post not found.',
noEmailsProvided: 'No emails provided.',
emailNotFound: 'Email not found.',
tooManyEmailsProvided: 'Too many emails provided. Maximum of 1 test email can be sent at once... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/EmailServiceWrapper.js | ghost/core/core/server/services/email-service/EmailServiceWrapper.js | const debug = require('@tryghost/debug')('i18n');
const logging = require('@tryghost/logging');
const url = require('../../api/endpoints/utils/serializers/output/utils/url');
const events = require('../../lib/common/events');
class EmailServiceWrapper {
getPostUrl(post) {
const jsonModel = post.toJSON();
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/EmailSegmenter.js | ghost/core/core/server/services/email-service/EmailSegmenter.js | const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const messages = {
noneFilterError: 'Cannot send email to "none" recipient filter',
newsletterVisibilityError: 'Unexpected visibility value "{value}". Use one of the valid: "members", "paid".'
};
/**
* @typedef {object} Members... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/EmailService.js | ghost/core/core/server/services/email-service/EmailService.js | /* eslint-disable no-unused-vars */
/**
* @typedef {object} Post
* @typedef {object} Email
* @typedef {object} LimitService
* @typedef {{checkVerificationRequired(): Promise<boolean>}} VerificationTrigger
* @typedef {import ('./DomainWarmingService').DomainWarmingService} DomainWarmingService
*/
const BatchSend... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/helpers/register-helpers.js | ghost/core/core/server/services/email-service/helpers/register-helpers.js | module.exports = {
registerHelpers(handlebars, labs, thist) {
handlebars.registerHelper('if', function (conditional, options) {
if (conditional) {
return options.fn(this);
} else {
return options.inverse(this);
}
});
handle... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/events/EmailTemporaryBouncedEvent.js | ghost/core/core/server/services/email-service/events/EmailTemporaryBouncedEvent.js | module.exports = class EmailTemporaryBouncedEvent {
/**
* @readonly
* @type {string}
*/
id;
/**
* @readonly
* @type {string}
*/
email;
/**
* @readonly
* @type {string}
*/
memberId;
/**
* @readonly
* @type {string}
*/
emailId;... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/events/EmailDeliveredEvent.js | ghost/core/core/server/services/email-service/events/EmailDeliveredEvent.js | module.exports = class EmailDeliveredEvent {
/**
* @readonly
* @type {string}
*/
email;
/**
* @readonly
* @type {string}
*/
memberId;
/**
* @readonly
* @type {string}
*/
emailId;
/**
* @readonly
* @type {string}
*/
emailRecip... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/events/SpamComplaintEvent.js | ghost/core/core/server/services/email-service/events/SpamComplaintEvent.js | module.exports = class SpamComplaintEvent {
/**
* @readonly
* @type {string}
*/
email;
/**
* @readonly
* @type {string}
*/
memberId;
/**
* @readonly
* @type {string}
*/
emailId;
/**
* @readonly
* @type {Date}
*/
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/email-service/events/EmailBouncedEvent.js | ghost/core/core/server/services/email-service/events/EmailBouncedEvent.js | module.exports = class EmailBouncedEvent {
/**
* @readonly
* @type {string}
*/
id;
/**
* @readonly
* @type {string}
*/
email;
/**
* @readonly
* @type {string}
*/
memberId;
/**
* @readonly
* @type {string}
*/
emailId;
/**... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-service/events/EmailUnsubscribedEvent.js | ghost/core/core/server/services/email-service/events/EmailUnsubscribedEvent.js | module.exports = class EmailUnsubscribedEvent {
/**
* @readonly
* @type {string}
*/
email;
/**
* @readonly
* @type {string}
*/
memberId;
/**
* @readonly
* @type {string}
*/
emailId;
/**
* @readonly
* @type {Date}
*/
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/email-service/events/EmailOpenedEvent.js | ghost/core/core/server/services/email-service/events/EmailOpenedEvent.js | module.exports = class EmailOpenedEvent {
/**
* @readonly
* @type {string}
*/
email;
/**
* @readonly
* @type {string}
*/
memberId;
/**
* @readonly
* @type {string}
*/
emailId;
/**
* @readonly
* @type {string}
*/
emailRecipien... | 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-jobs/index.js | ghost/core/core/server/services/mentions-jobs/index.js | module.exports = require('./job-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-jobs/job-service.js | ghost/core/core/server/services/mentions-jobs/job-service.js | /**
* Minimal wrapper around our external lib
* Intended for passing any Ghost internals such as logging and config
*/
const JobManager = require('@tryghost/job-manager');
const logging = require('@tryghost/logging');
const models = require('../../models');
const sentry = require('../../../shared/sentry');
const do... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tinybird/TinybirdService.js | ghost/core/core/server/services/tinybird/TinybirdService.js | const jwt = require('jsonwebtoken');
/**
* @typedef {Object} TinybirdConfig
* @property {string} workspaceId - The Tinybird workspace ID
* @property {string} adminToken - The admin token for JWT signing
* @property {Object} [stats] - Statistics configuration
* @property {string} [stats.id] - Stats ID (deprecated)... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tinybird/index.js | ghost/core/core/server/services/tinybird/index.js | module.exports = require('./TinybirdServiceWrapper'); | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/tinybird/TinybirdServiceWrapper.js | ghost/core/core/server/services/tinybird/TinybirdServiceWrapper.js | const TinybirdService = require('./TinybirdService');
module.exports = class TinybirdServiceWrapper {
/** @type TinybirdService */
static instance;
static init() {
const config = require('../../../shared/config');
const settingsCache = require('../../../shared/settings-cache');
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/tags-public/index.js | ghost/core/core/server/services/tags-public/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/tags-public/service.js | ghost/core/core/server/services/tags-public/service.js | class TagsPublicServiceWrapper {
async init() {
if (this.api) {
// Already done
return;
}
// Wire up all the dependencies
const adapterManager = require('../adapter-manager');
const config = require('../../../shared/config');
const EventRegist... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-analytics/EmailAnalyticsProviderMailgun.js | ghost/core/core/server/services/email-analytics/EmailAnalyticsProviderMailgun.js | const MailgunClient = require('../lib/MailgunClient');
const DEFAULT_EVENT_FILTER = 'delivered OR opened OR failed OR unsubscribed OR complained';
const PAGE_LIMIT = 300;
const DEFAULT_TAGS = ['bulk-email'];
class EmailAnalyticsProviderMailgun {
mailgunClient;
constructor({config, settings, labs}) {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-analytics/index.js | ghost/core/core/server/services/email-analytics/index.js | const EmailAnalyticsServiceWrapper = require('./EmailAnalyticsServiceWrapper');
module.exports = new EmailAnalyticsServiceWrapper();
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-analytics/EmailAnalyticsService.js | ghost/core/core/server/services/email-analytics/EmailAnalyticsService.js | const EventProcessingResult = require('./EventProcessingResult');
const logging = require('@tryghost/logging');
const errors = require('@tryghost/errors');
/**
* @typedef {import('../email-service/EmailEventProcessor')} EmailEventProcessor
*/
/**
* @typedef {object} FetchData
* @property {boolean} running
* @pro... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-analytics/EmailAnalyticsServiceWrapper.js | ghost/core/core/server/services/email-analytics/EmailAnalyticsServiceWrapper.js | const logging = require('@tryghost/logging');
const metrics = require('@tryghost/metrics');
const config = require('../../../shared/config');
class EmailAnalyticsServiceWrapper {
init() {
if (this.service) {
return;
}
const EmailAnalyticsService = require('./EmailAnalyticsServi... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-analytics/EventProcessingResult.js | ghost/core/core/server/services/email-analytics/EventProcessingResult.js | class EventProcessingResult {
/**
* @param {object} result
* @param {number} [result.delivered]
* @param {number} [result.opened]
* @param {number} [result.temporaryFailed]
* @param {number} [result.permanentFailed]
* @param {number} [result.unsubscribed]
* @param {number} [result... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-analytics/jobs/index.js | ghost/core/core/server/services/email-analytics/jobs/index.js | const path = require('path');
const moment = require('moment');
const config = require('../../../../shared/config');
const models = require('../../../models');
const jobsService = require('../../jobs');
let hasScheduled = false;
module.exports = {
async scheduleRecurringJobs(skipEmailCheck = false) {
if (... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-analytics/jobs/fetch-latest/index.js | ghost/core/core/server/services/email-analytics/jobs/fetch-latest/index.js | const {parentPort} = require('worker_threads');
const StartEmailAnalyticsJobEvent = require('../../events/StartEmailAnalyticsJobEvent');
// recurring job to fetch analytics since the most recently seen event timestamp
// Exit early when cancelled to prevent stalling shutdown. No cleanup needed when cancelling as ever... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-analytics/jobs/update-member-email-analytics/index.js | ghost/core/core/server/services/email-analytics/jobs/update-member-email-analytics/index.js | const queries = require('../../lib/queries');
/**
* Updates email analytics for a specific member
*
* @param {Object} options - The options object
* @param {string} options.memberId - The ID of the member to update analytics for
* @returns {Promise<Object>} The result of the aggregation query (1/0)
*/
module.exp... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js | ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.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 StartEmailAnalyticsJobEvent {
/**
* @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/email-analytics/lib/queries.js | ghost/core/core/server/services/email-analytics/lib/queries.js | const _ = require('lodash');
const debug = require('@tryghost/debug')('services:email-analytics');
const db = require('../../../data/db');
const logging = require('@tryghost/logging');
const {default: ObjectID} = require('bson-objectid');
const MIN_EMAIL_COUNT_FOR_OPEN_RATE = 5;
/** @typedef {'email-analytics-latest-... | 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/RequestIntegrityTokenProvider.js | ghost/core/core/server/services/members/RequestIntegrityTokenProvider.js | const crypto = require('crypto');
class RequestIntegrityTokenProvider {
#themeSecret;
#tokenDuration;
/**
* @param {object} options
* @param {string} options.themeSecret
* @param {number} options.tokenDuration - in milliseconds
*/
constructor(options) {
this.#themeSecret = ... | 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/MembersConfigProvider.js | ghost/core/core/server/services/members/MembersConfigProvider.js | const logging = require('@tryghost/logging');
const {URL} = require('url');
const createKeypair = require('keypair');
class MembersConfigProvider {
/**
* @param {object} options
* @param {{get: (key: string) => any}} options.settingsCache
* @param {{getDefaultEmailDomain(): string, getMembersSupport... | 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/index.js | ghost/core/core/server/services/members/index.js | module.exports = require('./service');
| 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.