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/web/api/testmode/index.js | ghost/core/core/server/web/api/testmode/index.js | module.exports = require('./routes');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/testmode/routes.js | ghost/core/core/server/web/api/testmode/routes.js | const path = require('path');
const logging = require('@tryghost/logging');
const express = require('../../../../shared/express');
const jobsService = require('../../../services/jobs');
/** A bunch of helper routes for testing purposes */
module.exports = function testRoutes() {
const router = express.Router('test... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/testmode/jobs/cpu-hog.js | ghost/core/core/server/web/api/testmode/jobs/cpu-hog.js | const logging = require('@tryghost/logging');
(async () => {
let sum = 0;
logging.info(`Starting CPU intensive task at ${new Date()}`);
for (let i = 0; i < 100000000; i++) {
sum += Math.tan(Math.tan(i));
}
logging.info(`Calculation result: ${sum}`);
logging.info(`Finishing CPU inten... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/testmode/jobs/graceful-job.js | ghost/core/core/server/web/api/testmode/jobs/graceful-job.js | const {parentPort} = require('worker_threads');
const util = require('util');
let shutdown = false;
const postParentPortMessage = (message) => {
if (parentPort) {
parentPort.postMessage(message);
}
};
if (parentPort) {
parentPort.on('message', (message) => {
parentPort.postMessage(`parent... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/testmode/jobs/say-hello.js | ghost/core/core/server/web/api/testmode/jobs/say-hello.js | const logging = require('@tryghost/logging');
const helloJob = () => {
logging.info('Starting hello job');
logging.info('Gonna say "hi" in 5 seconds');
return new Promise((resolve) => {
setTimeout(() => {
logging.info('hi!');
logging.info('Ending hello job run.');
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/middleware/cors.js | ghost/core/core/server/web/api/middleware/cors.js | const cors = require('cors');
const url = require('url');
const os = require('os');
const urlUtils = require('../../../../shared/url-utils');
const config = require('../../../../shared/config');
let allowlist = [];
const ENABLE_CORS = {origin: true, maxAge: config.get('caching:cors:maxAge')};
const DISABLE_CORS = {ori... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/middleware/index.js | ghost/core/core/server/web/api/middleware/index.js | module.exports = {
cors: require('./cors'),
updateUserLastSeen: require('./update-user-last-seen'),
upload: require('./upload')
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/middleware/update-user-last-seen.js | ghost/core/core/server/web/api/middleware/update-user-last-seen.js | module.exports = function updateUserLastSeenMiddleware(req, res, next) {
if (!req.user) {
return next();
}
// Only update the last seen if it's been more than 1 hour
if (Date.now() - req.user.get('last_seen') < (1 * 60 * 60 * 1000)) {
return next();
}
req.user.updateLastSeen().... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/middleware/upload.js | ghost/core/core/server/web/api/middleware/upload.js | const path = require('path');
const os = require('os');
const multer = require('multer');
const fs = require('fs-extra');
const zlib = require('zlib');
const util = require('util');
const errors = require('@tryghost/errors');
const config = require('../../../../shared/config');
const tpl = require('@tryghost/tpl');
con... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/middleware/version-match.js | ghost/core/core/server/web/api/middleware/version-match.js | const semver = require('semver');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const messages = {
invalidClientVersionRange: 'Client request for {clientVersion} is invalid.',
versionMismatch: 'Client request for {clientVersion} does not match server version {serverVersion}.... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/endpoints/content/middleware.js | ghost/core/core/server/web/api/endpoints/content/middleware.js | const cors = require('cors');
const auth = require('../../../../services/auth');
const shared = require('../../../shared');
/**
* Auth Middleware Packages
*
* IMPORTANT
* - cors middleware MUST happen before pretty urls, because otherwise cors header can get lost on redirect
* - url redirects MUST happen after co... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/endpoints/content/app.js | ghost/core/core/server/web/api/endpoints/content/app.js | const debug = require('@tryghost/debug')('web:api:endpoints:content:app');
const boolParser = require('express-query-boolean');
const bodyParser = require('body-parser');
const express = require('../../../../../shared/express');
const sentry = require('../../../../../shared/sentry');
const config = require('../../../..... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/endpoints/content/routes.js | ghost/core/core/server/web/api/endpoints/content/routes.js | const express = require('../../../../../shared/express');
const cors = require('cors');
const api = require('../../../../api').endpoints;
const {http} = require('@tryghost/api-framework');
const mw = require('./middleware');
const config = require('../../../../../shared/config');
/**
* @returns {import('express').Rou... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/endpoints/admin/middleware.js | ghost/core/core/server/web/api/endpoints/admin/middleware.js | const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const auth = require('../../../../services/auth');
const shared = require('../../../shared');
const apiMw = require('../../middleware');
const messages = {
apiTokenBlocked: 'API tokens do not have permission to access this endpoint',... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/endpoints/admin/app.js | ghost/core/core/server/web/api/endpoints/admin/app.js | const debug = require('@tryghost/debug')('web:endpoints:admin:app');
const boolParser = require('express-query-boolean');
const bodyParser = require('body-parser');
const errorHandler = require('@tryghost/mw-error-handler');
const versionMatch = require('../../middleware/version-match');
const shared = require('../../... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/api/endpoints/admin/routes.js | ghost/core/core/server/web/api/endpoints/admin/routes.js | const express = require('../../../../../shared/express');
const api = require('../../../../api').endpoints;
const {http} = require('@tryghost/api-framework');
const apiMw = require('../../middleware');
const mw = require('./middleware');
const shared = require('../../../shared');
/**
* @returns {import('express').Ro... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/comments/index.js | ghost/core/core/server/web/comments/index.js | module.exports = require('./routes');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/comments/routes.js | ghost/core/core/server/web/comments/routes.js | const express = require('../../../shared/express');
const config = require('../../../shared/config');
const api = require('../../api').endpoints;
const {http} = require('@tryghost/api-framework');
const shared = require('../shared');
const bodyParser = require('body-parser');
const membersService = require('../../../s... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/parent/app.js | ghost/core/core/server/web/parent/app.js | const debug = require('@tryghost/debug')('web:parent');
const config = require('../../../shared/config');
const express = require('../../../shared/express');
const compress = require('compression');
const mw = require('./middleware');
/**
* @returns {import('express').Application}
*/
module.exports = function setupP... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/parent/backend.js | ghost/core/core/server/web/parent/backend.js | const debug = require('@tryghost/debug')('web:backend');
const express = require('../../../shared/express');
const {BASE_API_PATH} = require('../../../shared/url-utils');
/**
*
* @returns {import('express').Application}
*/
module.exports = () => {
debug('BackendApp setup start');
// BACKEND
// Wrap the ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/parent/frontend.js | ghost/core/core/server/web/parent/frontend.js | const debug = require('@tryghost/debug')('frontend');
const express = require('../../../shared/express');
const shared = require('../shared');
/**
*
* @param {import('../../../frontend/services/routing/RouterManager').RouterConfig} routerConfig
* @returns {import('express').Application}
*/
module.exports = (router... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/parent/middleware/request-id.js | ghost/core/core/server/web/parent/middleware/request-id.js | const crypto = require('crypto');
/**
* @TODO: move this middleware to Framework monorepo?
*
* @param {import('express').Request} req
* @param {import('express').Response} res
* @param {import('express').NextFunction} next
*/
module.exports = function requestIdMw(req, res, next) {
const requestId = req.get('... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/parent/middleware/index.js | ghost/core/core/server/web/parent/middleware/index.js | module.exports = {
emitEvents: require('./emit-events'),
ghostLocals: require('./ghost-locals'),
logRequest: require('./log-request'),
queueRequest: require('./queue-request'),
requestId: require('./request-id')
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/parent/middleware/log-request.js | ghost/core/core/server/web/parent/middleware/log-request.js | const logging = require('@tryghost/logging');
/**
* @TODO: move this middleware to Framework monorepo?
*
* @param {import('express').Request} req
* @param {import('express').Response} res
* @param {import('express').NextFunction} next
*/
module.exports = function logRequest(req, res, next) {
const startTime ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/parent/middleware/emit-events.js | ghost/core/core/server/web/parent/middleware/emit-events.js | const INVALIDATE_ALL = '/*';
// Emit the site.changed event, a special model event used for webhooks
const events = require('../../../lib/common/events');
/**
* @param {import('express').Request} req
* @param {import('express').Response} res
* @param {import('express').NextFunction} next
*/
module.exports = funct... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/parent/middleware/ghost-locals.js | ghost/core/core/server/web/parent/middleware/ghost-locals.js | const ghostVersion = require('@tryghost/version');
/**
* Expose the standard locals that every request will need to have available
*
* @param {import('express').Request} req
* @param {import('express').Response} res
* @param {import('express').NextFunction} next
*/
module.exports = function ghostLocals(req, res,... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/parent/middleware/queue-request.js | ghost/core/core/server/web/parent/middleware/queue-request.js | const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const path = require('node:path');
const expressQueue = require('express-queue');
const debug = (message) => {
logging.debug(`[queue-request] ${message}`);
};
module.exports = function queueRequest(
config,
queueFact... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/index.js | ghost/core/core/server/web/shared/index.js | module.exports = {
get middleware() {
return require('./middleware');
}
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/utils.js | ghost/core/core/server/web/shared/utils.js | const url = require('url');
const _private = {};
_private.removeDoubleCharacters = (character, string) => {
const stringArray = string.split('');
return stringArray.reduce((newString, currentCharacter, index) => {
if (
currentCharacter === character &&
stringArray[index + 1] =... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/middleware/cache-control.js | ghost/core/core/server/web/shared/middleware/cache-control.js | // # CacheControl Middleware
// Usage: cacheControl(profile), where profile is one of 'public' or 'private'
// After: checkIsPrivate
// Before: routes
// App: Admin|Site|API
//
// Allows each app to declare its own default caching rules
const isString = require('lodash/isString');
/**
* @param {'public'|'private'|'n... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/middleware/index.js | ghost/core/core/server/web/shared/middleware/index.js | module.exports = {
get api() {
return require('./api');
},
get brute() {
return require('./brute');
},
get cacheControl() {
return require('./cache-control');
},
get maxLimitCap() {
return require('./max-limit-cap');
},
get prettyUrls() {
r... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/middleware/brute.js | ghost/core/core/server/web/shared/middleware/brute.js | const url = require('url');
const spamPrevention = require('./api/spam-prevention');
/**
* We set ignoreIP to false, because we tell brute-knex to use `req.ip`.
* We can use `req.ip`, because express trust proxy option is enabled.
*/
module.exports = {
/**
* block per route per ip
*/
globalBlock(r... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/middleware/pretty-urls.js | ghost/core/core/server/web/shared/middleware/pretty-urls.js | // Pretty URL redirects
//
// These are three pieces of middleware that handle ensuring that
// URLs get formatted correctly.
// Slashes ensures that we get trailing slashes
// redirectAmpUrls removes /amp from the end of urls if it exists (AMP support removed in v6)
// Uncapitalise changes case to lowercase
// @TODO ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/middleware/uncapitalise.js | ghost/core/core/server/web/shared/middleware/uncapitalise.js | // # uncapitalise Middleware
// Usage: uncapitalise(req, res, next)
// After:
// Before:
// App: Admin|Site|API
//
// Detect upper case in req.path.
//
// Example req:
// req.originalUrl = /blog/ghost/signin/?asdAD=asdAS
// req.url = /ghost/signin/?asdAD=asdAS
// req.baseUrl = /blog
// req.path = /ghost/signin/
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/middleware/max-limit-cap.js | ghost/core/core/server/web/shared/middleware/max-limit-cap.js | const {applyLimitCap, limitConfig} = require('../../../../shared/max-limit-cap');
// Prior to Ghost 6.x we allowed any limit value, including 'all', but as sites
// grew in size it led to performance issues and mis-use of the API.
// After Ghost 6.x we only allow a max limit of 100. This middleware enforces
// that l... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/middleware/redirect-amp-urls.js | ghost/core/core/server/web/shared/middleware/redirect-amp-urls.js | const urlUtils = require('../../../../shared/url-utils');
const localUtils = require('../utils');
/**
* redirectAmpUrls middleware
*
* 1. Detect requests whose path ends with `/amp/` (case-insensitive) or `/amp` before a query-string
* 2. Issue a 301 redirect to the same URL without that suffix, preserving the que... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/middleware/url-redirects.js | ghost/core/core/server/web/shared/middleware/url-redirects.js | const url = require('url');
const path = require('path');
const debug = require('@tryghost/debug')('web:shared:mw:url-redirects');
const urlUtils = require('../../../../shared/url-utils');
const _private = {};
_private.redirectUrl = ({redirectTo, query, pathname}) => {
const parts = url.parse(redirectTo);
//... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/middleware/api/index.js | ghost/core/core/server/web/shared/middleware/api/index.js | module.exports = {
get spamPrevention() {
return require('./spam-prevention');
}
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/shared/middleware/api/spam-prevention.js | ghost/core/core/server/web/shared/middleware/api/spam-prevention.js | const moment = require('moment');
const extend = require('lodash/extend');
const pick = require('lodash/pick');
const errors = require('@tryghost/errors');
const config = require('../../../../../shared/config');
const tpl = require('@tryghost/tpl');
const logging = require('@tryghost/logging');
let spam = config.get('s... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/members/index.js | ghost/core/core/server/web/members/index.js | module.exports = require('./app');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/web/members/app.js | ghost/core/core/server/web/members/app.js | const debug = require('@tryghost/debug')('members');
const cors = require('cors');
const bodyParser = require('body-parser');
const express = require('../../../shared/express');
const sentry = require('../../../shared/sentry');
const membersService = require('../../services/members');
const stripeService = require('../... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/cli/generate-data.js | ghost/core/core/cli/generate-data.js | /* eslint-disable ghost/filenames/match-exported-class */
const Command = require('./command');
const DataGenerator = require('../server/data/seeders/DataGenerator');
const config = require('../shared/config');
const schemaTables = require('../server/data/schema').tables;
module.exports = class DataGeneratorCommand e... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/cli/timetravel.js | ghost/core/core/cli/timetravel.js | const Command = require('./command');
const chalk = require('chalk');
// we use logins as the basis for our offset
const datum = {
table: 'members_login_events',
column: 'created_at'
};
const helpText = `Updates the Ghost db and shifts all dates up to present day.
By default the offset is based on the date of... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/cli/repl.js | ghost/core/core/cli/repl.js | const Command = require('./command');
const chalk = require('chalk');
module.exports = class REPL extends Command {
setup() {
this.help('Launches a REPL environment with access to a configured db instance and models');
// this is only here to demo how to set a default value for an arg :)
th... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/cli/command.js | ghost/core/core/cli/command.js | const cli = require('@tryghost/pretty-cli');
const logging = cli.ui.log;
const chalk = require('chalk');
const errors = {
ERR_INVALID_COMMAND: 1,
ERR_INVALID_ENV: 2
};
module.exports = class Command {
constructor() {
this.checkEnv();
this.init();
this.setup();
}
/**
*... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/express.js | ghost/core/core/shared/express.js | const debug = require('@tryghost/debug')('shared:express');
const express = require('express');
const {createLazyRouter} = require('express-lazy-router');
const sentry = require('./sentry');
const lazyLoad = createLazyRouter();
/**
*
* @param {String} name
* @returns {import('express').Application}
*/
module.expo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/url-utils.js | ghost/core/core/shared/url-utils.js | const UrlUtils = require('@tryghost/url-utils');
const config = require('./config');
const BASE_API_PATH = '/ghost/api';
const urlUtils = new UrlUtils({
getSubdir: config.getSubdir,
getSiteUrl: config.getSiteUrl,
getAdminUrl: config.getAdminUrl,
assetBaseUrls: {
media: config.get('urls:media'),... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/SentryKnexTracingIntegration.js | ghost/core/core/shared/SentryKnexTracingIntegration.js | /**
* @typedef {import('knex').Knex.Client} KnexClient
*/
/**
* @typedef {import('@sentry/types').Integration} SentryIntegration
*/
/**
* Sentry Knex tracing integration
*
* @implements {SentryIntegration}
*/
class SentryKnexTracingIntegration {
static id = 'Knex';
name = SentryKnexTracingIntegration... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/sentry.js | ghost/core/core/shared/sentry.js | const config = require('./config');
const SentryKnexTracingIntegration = require('./SentryKnexTracingIntegration');
const sentryConfig = config.get('sentry');
const errors = require('@tryghost/errors');
/**
* @param {import('@sentry/node').Event} event
* @param {import('@sentry/node').EventHint} hint
* @returns {im... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/max-limit-cap.js | ghost/core/core/shared/max-limit-cap.js | const config = require('../shared/config');
// Prior to Ghost 6.x we allowed any limit value, including 'all', but as sites
// grew in size it led to performance issues and mis-use of the API.
// After Ghost 6.x we only allow a max limit of 100. This shared module provides
// the core limit capping logic that can be ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/prometheus-client.js | ghost/core/core/shared/prometheus-client.js | const {PrometheusClient} = require('@tryghost/prometheus-metrics');
const config = require('./config');
let prometheusClient;
if (!prometheusClient && config.get('prometheus:enabled')) {
const pushgatewayConfig = config.get('prometheus:pushgateway');
const prometheusConfig = {pushgateway: pushgatewayConfig};
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/labs.js | ghost/core/core/shared/labs.js | // Feature flags behaviour in tests:
// By default, all flags listed in GA_FEATURES, BETA_FEATURES, and ALPHA_FEATURES
// are globally enabled during E2E tests. This ensures flagged code paths are tested
// automatically.
// For more details, see the E2E testing documentation:
// https://www.notion.so/ghost/End-to-end-... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/custom-theme-settings-cache/CustomThemeSettingsService.js | ghost/core/core/shared/custom-theme-settings-cache/CustomThemeSettingsService.js | const _ = require('lodash');
const BREAD = require('./CustomThemeSettingsBREADService');
const nql = require('@tryghost/nql');
const tpl = require('@tryghost/tpl');
const {ValidationError} = require('@tryghost/errors');
const debug = require('@tryghost/debug')('custom-theme-settings-service');
const messages = {
p... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/custom-theme-settings-cache/index.js | ghost/core/core/shared/custom-theme-settings-cache/index.js | const CustomThemeSettingsCache = require('./CustomThemeSettingsCache');
module.exports = new CustomThemeSettingsCache();
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/custom-theme-settings-cache/CustomThemeSettingsBREADService.js | ghost/core/core/shared/custom-theme-settings-cache/CustomThemeSettingsBREADService.js | module.exports = class CustomThemeSettingsBREADService {
/**
* @param {Object} options
* @param {Object} options.model - Bookshelf model for custom theme settings
*/
constructor({model}) {
this.Model = model;
}
async browse(data, options = {}) {
return this.Model.findAll(... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/custom-theme-settings-cache/CustomThemeSettingsCache.js | ghost/core/core/shared/custom-theme-settings-cache/CustomThemeSettingsCache.js | module.exports = class CustomThemeSettingsCache {
constructor() {
this._content = new Object();
}
get(key) {
return this._content[key];
}
getAll() {
return Object.assign({}, this._content);
}
populate(settings) {
this.clear();
settings.forEach((set... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/settings-cache/public.js | ghost/core/core/shared/settings-cache/public.js | /**
* This file acts as an allowlist for "public" settings
*/
module.exports = {
title: 'title',
description: 'description',
logo: 'logo',
icon: 'icon',
accent_color: 'accent_color',
cover_image: 'cover_image',
facebook: 'facebook',
twitter: 'twitter',
lang: 'locale',
locale: ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/settings-cache/CacheManager.js | ghost/core/core/shared/settings-cache/CacheManager.js | // It's important to keep the requires absolutely minimal here,
// As this cache is used in SO many other areas, we may open ourselves to
// circular dependency bugs.
const debug = require('@tryghost/debug')('settings:cache');
const _ = require('lodash');
/**
* Why hasn't this been moved to @tryghost/settings-cache y... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/settings-cache/index.js | ghost/core/core/shared/settings-cache/index.js | const CacheManager = require('./CacheManager');
const publicSettings = require('./public');
const cacheManager = new CacheManager({publicSettings});
module.exports = cacheManager;
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/MemberUnsubscribeEvent.js | ghost/core/core/shared/events/MemberUnsubscribeEvent.js | /**
* @typedef {object} MemberUnsubscribeEventData
* @prop {string} memberId
* @prop {string} memberStatus
* @prop {string} entryId
* @prop {string} sourceUrl
*/
module.exports = class MemberUnsubscribeEvent {
/**
* @param {MemberUnsubscribeEventData} data
* @param {Date} timestamp
*/
cons... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/URLResourceUpdatedEvent.js | ghost/core/core/shared/events/URLResourceUpdatedEvent.js | module.exports = class URLResourceUpdatedEvent {
/**
* @readonly
* @type {Object}
*/
data;
/**
* @readonly
* @type {Date}
*/
timestamp;
/**
* @private
*/
constructor({timestamp, ...data}) {
this.data = data;
this.timestamp = timestamp;
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/MemberCommentEvent.js | ghost/core/core/shared/events/MemberCommentEvent.js | /**
* @typedef {object} MemberCommentEventData
* @prop {string} memberId
* @prop {string} commentId
* @prop {string} postId
*/
/**
* Server-side event firing on page views (page, post, tags...)
*/
module.exports = class MemberCommentEvent {
/**
* @param {MemberCommentEventData} data
* @param {Date... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/MemberPaidConversionEvent.js | ghost/core/core/shared/events/MemberPaidConversionEvent.js | /**
* @typedef {object} MemberPaidConversionEventData
* @prop {string} memberId
* @prop {string} memberStatus
* @prop {string} subscriptionId
* @prop {string} entryId
* @prop {string} sourceUrl
*/
module.exports = class MemberPaidConversionEvent {
/**
* @param {MemberPaidConversionEventData} data
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/MemberCreatedEvent.js | ghost/core/core/shared/events/MemberCreatedEvent.js | /**
* @typedef {object} MemberCreatedEventData
* @prop {string} memberId
* @prop {string} batchId
* @prop {'import' | 'system' | 'api' | 'admin' | 'member'} source
* @prop {import('@tryghost/member-attribution/lib/Attribution').Attribution} [attribution] Attribution
*/
module.exports = class MemberCreatedEvent {... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/MemberPaidCancellationEvent.js | ghost/core/core/shared/events/MemberPaidCancellationEvent.js | /**
* @typedef {object} MemberPaidCancellationEventData
* @prop {string} memberId
* @prop {string} memberStatus
* @prop {string} subscriptionId
* @prop {string} entryId
* @prop {string} sourceUrl
*/
module.exports = class MemberPaidCancellationEvent {
/**
* @param {MemberPaidCancellationEventData} data... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/MemberSubscribeEvent.js | ghost/core/core/shared/events/MemberSubscribeEvent.js | /**
* @typedef {object} MemberSubscribeEventData
* @prop {string} memberId
* @prop {'import' | 'system' | 'api' | 'admin' | 'member'} source
*/
module.exports = class MemberSubscribeEvent {
/**
* @param {MemberSubscribeEventData} 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/shared/events/SubscriptionCancelledEvent.js | ghost/core/core/shared/events/SubscriptionCancelledEvent.js | /**
* @typedef {object} SubscriptionCancelledEventData
* @prop {string} source
* @prop {string} memberId
* @prop {string} tierId
* @prop {string} subscriptionId
* @prop {boolean} cancelNow
* @prop {Date} expiryAt
* @prop {Date} canceledAt
*/
module.exports = class SubscriptionCancelledEvent {
/**
* @... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/index.js | ghost/core/core/shared/events/index.js | module.exports = {
MemberCommentEvent: require('./MemberCommentEvent'),
MemberCreatedEvent: require('./MemberCreatedEvent'),
MemberEntryViewEvent: require('./MemberEntryViewEvent'),
MemberLinkClickEvent: require('./MemberLinkClickEvent'),
MemberPageViewEvent: require('./MemberPageViewEvent'),
Me... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/MemberSignupEvent.js | ghost/core/core/shared/events/MemberSignupEvent.js | /**
* @typedef {object} MemberSignupEventData
* @prop {string} memberId
* @prop {string} entryId
* @prop {string} sourceUrl
*/
module.exports = class MemberSignupEvent {
/**
* @param {MemberSignupEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data =... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/SubscriptionActivatedEvent.js | ghost/core/core/shared/events/SubscriptionActivatedEvent.js | /**
* Fired when a subscription becomes active.
*
* @typedef {object} SubscriptionActivatedEventData
* @prop {string} source
* @prop {string} memberId
* @prop {string} batchId
* @prop {string} tierId
* @prop {string} subscriptionId
* @prop {string} attribution
* @prop {string} offerId
*/
module.exports = cl... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/MemberLinkClickEvent.js | ghost/core/core/shared/events/MemberLinkClickEvent.js | /**
* @typedef {object} MemberLinkClickEventData
* @prop {string} memberId
* @prop {string} memberLastSeenAt
* @prop {string} linkId
*/
/**
* Server-side event firing on page views (page, post, tags...)
*/
module.exports = class MemberLinkClickEvent {
/**
* @param {MemberLinkClickEventData} data
*... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/SubscriptionCreatedEvent.js | ghost/core/core/shared/events/SubscriptionCreatedEvent.js | /**
* Fired when a subscription is created. This can also happen when inactive subscriptions are created (incomplete, canceled...).
*
* @typedef {object} SubscriptionCreatedEventData
* @prop {string} source
* @prop {string} memberId
* @prop {string} batchId
* @prop {string} tierId
* @prop {string} subscriptionI... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/OfferRedemptionEvent.js | ghost/core/core/shared/events/OfferRedemptionEvent.js | /**
* @typedef {object} OfferRedemptionEventData
* @prop {string} memberId
* @prop {string} offerId
* @prop {string} subscriptionId
*/
/**
* Server-side event firing on page views (page, post, tags...)
*/
module.exports = class OfferRedemptionEvent {
/**
* @param {OfferRedemptionEventData} data
* ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/MemberPageViewEvent.js | ghost/core/core/shared/events/MemberPageViewEvent.js | /**
* @typedef {object} MemberPageViewEventData
* @prop {string} memberId
* @prop {string} memberLastSeenAt
* @prop {string} url
*/
/**
* Server-side event firing on page views (page, post, tags...)
*/
module.exports = class MemberPageViewEvent {
/**
* @param {MemberPageViewEventData} data
* @para... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/events/MemberEntryViewEvent.js | ghost/core/core/shared/events/MemberEntryViewEvent.js | /**
* @typedef {object} MemberEntryViewEventData
* @prop {string} memberId
* @prop {string} memberStatus
* @prop {string} entryId
* @prop {string} entryUrl
*/
module.exports = class MemberEntryViewEvent {
/**
* @param {MemberEntryViewEventData} data
* @param {Date} timestamp
*/
constructor... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/config/index.js | ghost/core/core/shared/config/index.js | const loader = require('./loader');
module.exports = loader.loadNconf();
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/config/loader.js | ghost/core/core/shared/config/loader.js | const Nconf = require('nconf');
const path = require('path');
const _debug = require('@tryghost/debug')._base;
const debug = _debug('ghost:config');
const localUtils = require('./utils');
const helpers = require('./helpers');
const urlHelpers = require('@tryghost/config-url-helpers');
/**
* @param {object} options
*... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/config/helpers.js | ghost/core/core/shared/config/helpers.js | const path = require('path');
const {URL} = require('url');
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
const DEFAULT_HOST_ARG = /.*/;
const getHostInfo = (config) => {
const frontendHost = new URL(config.getSiteUrl()).hostname;
const backendHost = config.getA... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/shared/config/utils.js | ghost/core/core/shared/config/utils.js | const path = require('path');
const fs = require('fs');
const jsonc = require('jsonc-parser');
/**
* transform all relative paths to absolute paths
* @TODO: re-write this function a little bit so we don't have to add the parent path - that is hard to understand
*
* Path must be string.
* Path must match minimum o... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/babel.config.js | babel.config.js | module.exports = function(api) {
api.cache(true);
let presets;
if (process.env.NODE_ENV === 'es') {
presets = [
[
"@babel/preset-env",
{
"modules": false
}
]
];
} else if (process.env.NODE_ENV === 'umd') {
presets = [
[
"@babel/preset-env"
]
];
}
return {
plugins: ['@... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/Sortable.js | Sortable.js | /**!
* Sortable 1.15.6
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(glo... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | true |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/Sortable.min.js | Sortable.min.js | /*! Sortable 1.15.6 - MIT | git://github.com/SortableJS/Sortable.git */
| javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | true |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/scripts/test-compat.js | scripts/test-compat.js | const createTestCafe = require('testcafe');
// Testcafe cannot test on IE < 11
// Testcafe testing on Chrome Android is currently broken (https://github.com/DevExpress/testcafe/issues/3948)
const browsers = [
'saucelabs:Internet Explorer@11.285:Windows 10',
'saucelabs:MicrosoftEdge@16.16299:Windows 10',
'saucelabs:i... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/scripts/test.js | scripts/test.js | const createTestCafe = require('testcafe');
let testcafe;
let runner;
let failedCount;
createTestCafe().then((tc) => {
testcafe = tc;
runner = tc.createRunner();
return runner
.src('./tests/Sortable.test.js')
.browsers('chrome:headless')
.concurrency(3)
.run();
}).then((actualFailedCount) => {
failedCoun... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/scripts/build.js | scripts/build.js | import babel from 'rollup-plugin-babel';
import json from 'rollup-plugin-json';
import resolve from 'rollup-plugin-node-resolve';
import banner from './banner.js';
export default {
output: {
banner,
name: 'Sortable'
},
plugins: [
json(),
babel(),
resolve()
]
};
| javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/scripts/banner.js | scripts/banner.js | import { version } from '../package.json';
export default `/**!
* Sortable ${ version }
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/`;
| javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/scripts/esm-build.js | scripts/esm-build.js | import build from './build.js';
export default ([
{
input: 'entry/entry-core.js',
output: Object.assign({}, build.output, {
file: 'modular/sortable.core.esm.js',
format: 'esm'
})
},
{
input: 'entry/entry-defaults.js',
output: Object.assign({}, build.output, {
file: 'modular/sortable.esm.js',
f... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/scripts/minify.js | scripts/minify.js | const UglifyJS = require('uglify-js'),
fs = require('fs'),
package = require('../package.json');
const banner = `/*! Sortable ${ package.version } - ${ package.license } | ${ package.repository.url } */\n`;
fs.writeFileSync(
`./Sortable.min.js`,
banner + UglifyJS.minify(fs.readFileSync(`./Sortable.js`, 'utf8')).... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/scripts/umd-build.js | scripts/umd-build.js | import build from './build.js';
export default ([
{
input: 'entry/entry-complete.js',
output: Object.assign({}, build.output, {
file: './Sortable.js',
format: 'umd'
})
}
]).map(config => {
let buildCopy = { ...build };
return Object.assign(buildCopy, config);
});
| javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/entry/entry-complete.js | entry/entry-complete.js | import Sortable from './entry-defaults.js';
import Swap from '../plugins/Swap';
import MultiDrag from '../plugins/MultiDrag';
Sortable.mount(new Swap());
Sortable.mount(new MultiDrag());
export default Sortable;
| javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/entry/entry-core.js | entry/entry-core.js | import Sortable from '../src/Sortable.js';
import AutoScroll from '../plugins/AutoScroll';
import OnSpill from '../plugins/OnSpill';
import Swap from '../plugins/Swap';
import MultiDrag from '../plugins/MultiDrag';
export default Sortable;
export {
Sortable,
// Default
AutoScroll,
OnSpill,
// Extra
Swap,
Mul... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/entry/entry-defaults.js | entry/entry-defaults.js | import Sortable from '../src/Sortable.js';
import AutoScroll from '../plugins/AutoScroll';
import { RemoveOnSpill, RevertOnSpill } from '../plugins/OnSpill';
// Extra
import Swap from '../plugins/Swap';
import MultiDrag from '../plugins/MultiDrag';
Sortable.mount(new AutoScroll());
Sortable.mount(RemoveOnSpill, Revert... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/src/Animation.js | src/Animation.js | import { getRect, css, matrix, isRectEqual, indexOfObject } from './utils.js';
import Sortable from './Sortable.js';
export default function AnimationStateManager() {
let animationStates = [],
animationCallbackId;
return {
captureAnimationState() {
animationStates = [];
if (!this.options.animation) return... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/src/Sortable.js | src/Sortable.js | /**!
* Sortable
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/
import { version } from '../package.json';
import { IE11OrLess, Edge, FireFox, Safari, IOS, ChromeForAndroid } from './BrowserInfo.js';
import AnimationStateManager from './Animation.js';
import Plu... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | true |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/src/EventDispatcher.js | src/EventDispatcher.js | import { IE11OrLess, Edge } from './BrowserInfo.js';
import { expando } from './utils.js';
import PluginManager from './PluginManager.js';
export default function dispatchEvent(
{
sortable, rootEl, name,
targetEl, cloneEl, toEl, fromEl,
oldIndex, newIndex,
oldDraggableIndex, newDraggableIndex,
originalEvent... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/src/PluginManager.js | src/PluginManager.js | let plugins = [];
const defaults = {
initializeByDefault: true
};
export default {
mount(plugin) {
// Set default static properties
for (let option in defaults) {
if (defaults.hasOwnProperty(option) && !(option in plugin)) {
plugin[option] = defaults[option];
}
}
plugins.forEach(p => {
if (p.p... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/src/utils.js | src/utils.js | import { IE11OrLess } from './BrowserInfo.js';
import Sortable from './Sortable.js';
const captureMode = {
capture: false,
passive: false
};
function on(el, event, fn) {
el.addEventListener(event, fn, !IE11OrLess && captureMode);
}
function off(el, event, fn) {
el.removeEventListener(event, fn, !IE11OrLess && c... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/src/BrowserInfo.js | src/BrowserInfo.js | function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
return !!/*@__PURE__*/navigator.userAgent.match(pattern);
}
}
export const IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
export const Edge = userAgent(/Edge/i);
export const FireFox = userAgent... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/tests/Sortable.compat.test.js | tests/Sortable.compat.test.js | import { Selector } from 'testcafe';
fixture `Simple Sorting`
.page `./single-list.html`;
let list1 = Selector('#list1');
test('Sort down list', async browser => {
const dragStartPosition = list1.child(0);
const dragEl = await dragStartPosition();
const dragEndPosition = list1.child(2);
const targetStartPositi... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
SortableJS/Sortable | https://github.com/SortableJS/Sortable/blob/3696da44b57c81dbe441aa48af28b0c38f6b11e2/tests/Sortable.test.js | tests/Sortable.test.js | import { Selector } from 'testcafe';
const itemHeight = 54; // px
const leeway = 1;
fixture `Simple Sorting`
.page `./single-list.html`;
let list1 = Selector('#list1');
test('Sort down list', async browser => {
const dragStartPosition = list1.child(0);
const dragEl = await dragStartPosition();
const dragEndPosi... | javascript | MIT | 3696da44b57c81dbe441aa48af28b0c38f6b11e2 | 2026-01-04T15:01:18.262442Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.