ghost 4.25.0 → 4.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/content/themes/casper/assets/built/screen.css +1 -1
  2. package/content/themes/casper/assets/built/screen.css.map +1 -1
  3. package/content/themes/casper/assets/css/screen.css +54 -10
  4. package/content/themes/casper/package.json +1 -1
  5. package/core/app.js +8 -4
  6. package/core/boot.js +50 -23
  7. package/core/built/assets/{chunk.3.8f95b516d88ff4eec64c.js → chunk.3.e54be01b5124e4e27958.js} +7 -7
  8. package/core/built/assets/ghost-dark-ae67fe157509b6e82c607ba560fc52e9.css +1 -0
  9. package/core/built/assets/{ghost.min-bc72f685c1c9adc9885925c1412435a5.js → ghost.min-2d534cce15c43c646814b26f4beefb78.js} +134 -131
  10. package/core/built/assets/ghost.min-b1e58e098721e467388682a85a7c187d.css +1 -0
  11. package/core/built/assets/{vendor.min-d1234c632a54502777c34e50752fa3fc.js → vendor.min-e433aa7d5620e7837f30e170cd43f84e.js} +597 -563
  12. package/core/frontend/apps/amp/lib/views/amp.hbs +67 -0
  13. package/core/frontend/helpers/url.js +18 -1
  14. package/core/frontend/src/cards/css/audio.css +258 -0
  15. package/core/frontend/src/cards/css/blockquote.css +23 -0
  16. package/core/frontend/src/cards/css/callout.css +13 -4
  17. package/core/frontend/src/cards/css/product.css +101 -0
  18. package/core/frontend/src/cards/css/toggle.css +42 -20
  19. package/core/frontend/src/cards/js/audio.js +147 -0
  20. package/core/frontend/web/site.js +1 -1
  21. package/core/server/notify.js +1 -2
  22. package/core/server/services/mega/template.js +31 -5
  23. package/core/server/services/members/api.js +2 -2
  24. package/core/server/services/members/emails/signup-paid.js +4 -4
  25. package/core/server/services/nft-oembed.js +1 -1
  26. package/core/server/services/oembed.js +9 -1
  27. package/core/server/services/twitter-embed.js +3 -1
  28. package/core/server/web/admin/views/default-prod.html +4 -4
  29. package/core/server/web/admin/views/default.html +4 -4
  30. package/core/server/web/parent/app.js +2 -22
  31. package/core/server/web/parent/backend.js +2 -0
  32. package/core/shared/express.js +1 -1
  33. package/core/shared/labs.js +6 -4
  34. package/package.json +36 -36
  35. package/yarn.lock +362 -447
  36. package/core/built/assets/ghost-dark-d690e732e17ffc794e2e59c1467ca282.css +0 -1
  37. package/core/built/assets/ghost.min-043bb7480a0810109b130f13b2a4235e.css +0 -1
package/core/boot.js CHANGED
@@ -106,16 +106,19 @@ async function initCore({ghostServer, config, bootLogger, frontend}) {
106
106
  });
107
107
  debug('End: Url Service');
108
108
 
109
- // Job Service allows parts of Ghost to run in the background
110
- debug('Begin: Job Service');
111
- const jobService = require('./server/services/jobs');
112
- ghostServer.registerCleanupTask(async () => {
113
- await jobService.shutdown();
114
- });
115
- ghostServer.registerCleanupTask(async () => {
116
- await urlService.shutdown();
117
- });
118
- debug('End: Job Service');
109
+ if (ghostServer) {
110
+ // Job Service allows parts of Ghost to run in the background
111
+ debug('Begin: Job Service');
112
+ const jobService = require('./server/services/jobs');
113
+ ghostServer.registerCleanupTask(async () => {
114
+ await jobService.shutdown();
115
+ });
116
+ debug('End: Job Service');
117
+
118
+ ghostServer.registerCleanupTask(async () => {
119
+ await urlService.shutdown();
120
+ });
121
+ }
119
122
 
120
123
  debug('End: initCore');
121
124
  }
@@ -166,10 +169,27 @@ async function initFrontend() {
166
169
  * @param {Object} options
167
170
  * @param {Boolean} options.backend
168
171
  * @param {Boolean} options.frontend
172
+ * @param {Object} options.config
169
173
  */
170
- async function initExpressApps(options) {
174
+ async function initExpressApps({frontend, backend, config}) {
171
175
  debug('Begin: initExpressApps');
172
- const parentApp = require('./server/web/parent/app')(options);
176
+
177
+ const parentApp = require('./server/web/parent/app')();
178
+ const vhost = require('@tryghost/vhost-middleware');
179
+
180
+ // Mount the express apps on the parentApp
181
+ if (backend) {
182
+ // ADMIN + API
183
+ const backendApp = require('./server/web/parent/backend')();
184
+ parentApp.use(vhost(config.getBackendMountPath(), backendApp));
185
+ }
186
+
187
+ if (frontend) {
188
+ // SITE + MEMBERS
189
+ const frontendApp = require('./server/web/parent/frontend')({});
190
+ parentApp.use(vhost(config.getFrontendMountPath(), frontendApp));
191
+ }
192
+
173
193
  debug('End: initExpressApps');
174
194
  return parentApp;
175
195
  }
@@ -303,7 +323,7 @@ async function initBackgroundServices({config}) {
303
323
 
304
324
  * @returns {Promise<object>} ghostServer
305
325
  */
306
- async function bootGhost({backend = true, frontend = true} = {}) {
326
+ async function bootGhost({backend = true, frontend = true, server = true} = {}) {
307
327
  // Metrics
308
328
  const startTime = Date.now();
309
329
  debug('Begin Boot');
@@ -351,13 +371,15 @@ async function bootGhost({backend = true, frontend = true} = {}) {
351
371
 
352
372
  // Step 2 - Start server with minimal app in global maintenance mode
353
373
  debug('Begin: load server + minimal app');
354
- const rootApp = require('./app');
355
-
356
- const GhostServer = require('./server/ghost-server');
357
- ghostServer = new GhostServer({url: config.getSiteUrl()});
358
- await ghostServer.start(rootApp);
359
- bootLogger.log('server started');
360
- debug('End: load server + minimal app');
374
+ const rootApp = require('./app')();
375
+
376
+ if (server) {
377
+ const GhostServer = require('./server/ghost-server');
378
+ ghostServer = new GhostServer({url: config.getSiteUrl()});
379
+ await ghostServer.start(rootApp);
380
+ bootLogger.log('server started');
381
+ debug('End: load server + minimal app');
382
+ }
361
383
 
362
384
  // Step 3 - Get the DB ready
363
385
  debug('Begin: Get DB ready');
@@ -373,7 +395,7 @@ async function bootGhost({backend = true, frontend = true} = {}) {
373
395
  if (frontend) {
374
396
  await initFrontend();
375
397
  }
376
- const ghostApp = await initExpressApps({frontend, backend});
398
+ const ghostApp = await initExpressApps({frontend, backend, config});
377
399
 
378
400
  if (frontend) {
379
401
  await initDynamicRouting();
@@ -397,8 +419,13 @@ async function bootGhost({backend = true, frontend = true} = {}) {
397
419
  initBackgroundServices({config});
398
420
 
399
421
  // We return the server purely for testing purposes
400
- debug('End Boot: Returning Ghost Server');
401
- return ghostServer;
422
+ if (server) {
423
+ debug('End Boot: Returning Ghost Server');
424
+ return ghostServer;
425
+ } else {
426
+ debug('End boot: Returning Root App');
427
+ return rootApp;
428
+ }
402
429
  } catch (error) {
403
430
  const errors = require('@tryghost/errors');
404
431
 
@@ -46,7 +46,7 @@ if(n){var i=Object(d.e)(m.b),a=Object(d.e)(n.startTime)
46
46
  r.b.log("[Measurements] Adding FID"),t._measurements.fid={value:e.value},t._measurements["mark.fid"]={value:i+a}}}))},t}()
47
47
  function E(t){var e=t.transaction,n=t.entry,i=t.event,a=t.timeOrigin,r=t.eventEnd,s=t.description,o=r?n[r]:n[i+"End"],c=n[i+"Start"]
48
48
  c&&o&&x(e,{op:"browser",description:null!=s?s:i,startTimestamp:a+Object(d.e)(c),endTimestamp:a+Object(d.e)(o)})}function x(t,e){var n=e.startTimestamp,i=Object(a.d)(e,["startTimestamp"])
49
- return n&&t.startTimestamp>n&&(t.startTimestamp=n),t.startChild(Object(a.a)({startTimestamp:n},i))}function I(t){return"number"==typeof t&&isFinite(t)}var C=n(13),k=n(92),w=n(4),R={traceFetch:!0,traceXHR:!0,tracingOrigins:["localhost",/^\//]}
49
+ return n&&t.startTimestamp>n&&(t.startTimestamp=n),t.startChild(Object(a.a)({startTimestamp:n},i))}function I(t){return"number"==typeof t&&isFinite(t)}var C=n(13),k=n(91),w=n(4),R={traceFetch:!0,traceXHR:!0,tracingOrigins:["localhost",/^\//]}
50
50
  function A(t){var e=Object(a.a)(Object(a.a)({},R),t),n=e.traceFetch,i=e.traceXHR,r=e.tracingOrigins,s=e.shouldCreateSpanForRequest,o={},c=function(t){if(o[t])return o[t]
51
51
  var e=r
52
52
  return o[t]=e.some((function(e){return Object(C.b)(t,e)}))&&!Object(C.b)(t,"sentry_key"),o[t]},p=c
@@ -115,7 +115,7 @@ return t.call.apply(t,Object(a.e)([this],u.slice(0,-1),[function(t,e){var n
115
115
  null===(n=v)||void 0===n||n.finish(),p(t,e)}]))}}))}},t.prototype._getSpanContextFromOperationArguments=function(t,e,n){var i={collectionName:t.collectionName,dbName:t.dbName,namespace:t.namespace},r={op:"db",description:e,data:i},s=U[e],o=Array.isArray(this._describeOperations)?this._describeOperations.includes(e):this._describeOperations
116
116
  if(!s||!o)return r
117
117
  try{if("mapReduce"===e){var c=Object(a.c)(n,2),u=c[0],d=c[1]
118
- i[s[0]]="string"==typeof u?u:u.name||"<anonymous>",i[s[1]]="string"==typeof d?d:d.name||"<anonymous>"}else for(var p=0;p<s.length;p++)i[s[p]]=JSON.stringify(n[p])}catch(t){}return r},t.id="Mongo",t}(),W=n(616),J=n(617),G=n(84),X=Object(a.a)(Object(a.a)({},i),{BrowserTracing:D})
118
+ i[s[0]]="string"==typeof u?u:u.name||"<anonymous>",i[s[1]]="string"==typeof d?d:d.name||"<anonymous>"}else for(var p=0;p<s.length;p++)i[s[p]]=JSON.stringify(n[p])}catch(t){}return r},t.id="Mongo",t}(),W=n(616),J=n(617),G=n(83),X=Object(a.a)(Object(a.a)({},i),{BrowserTracing:D})
119
119
  Object(o.a)()},612:function(t,e,n){"use strict"
120
120
  n.d(e,"a",(function(){return a})),n.d(e,"d",(function(){return r})),n.d(e,"b",(function(){return s})),n.d(e,"c",(function(){return o})),n.d(e,"e",(function(){return c})),n.d(e,"f",(function(){return u}))
121
121
  var i=n(611),a=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$")
@@ -136,7 +136,7 @@ default:return t.InvalidArgument}if(e>=500&&e<600)switch(e){case 501:return t.Un
136
136
  case 503:return t.Unavailable
137
137
  case 504:return t.DeadlineExceeded
138
138
  default:return t.InternalError}return t.UnknownError}}(i||(i={}))},614:function(t,e,n){"use strict";(function(t){n.d(e,"b",(function(){return f})),n.d(e,"a",(function(){return v}))
139
- var i=n(0),a=n(611),r=n(93),s=n(19),o=n(18),c=n(619),u=n(615),d=n(617),p=n(612)
139
+ var i=n(0),a=n(611),r=n(92),s=n(19),o=n(18),c=n(619),u=n(615),d=n(617),p=n(612)
140
140
  function l(){var t=this.getScope()
141
141
  if(t){var e=t.getSpan()
142
142
  if(e)return{"sentry-trace":e.toTraceparent()}}return{}}function m(t,e,n){return Object(p.d)(e)?void 0!==t.sampled?(t.setMetadata({transactionSampling:{method:r.a.Explicit}}),t):("function"==typeof e.tracesSampler?(i=e.tracesSampler(n),t.setMetadata({transactionSampling:{method:r.a.Sampler,rate:Number(i)}})):void 0!==n.parentSampled?(i=n.parentSampled,t.setMetadata({transactionSampling:{method:r.a.Inheritance}})):(i=e.tracesSampleRate,t.setMetadata({transactionSampling:{method:r.a.Rate,rate:Number(i)}})),function(t){return isNaN(t)||"number"!=typeof t&&"boolean"!=typeof t?(s.b.warn("[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got "+JSON.stringify(t)+" of type "+JSON.stringify(typeof t)+"."),!1):!(t<0||t>1)||(s.b.warn("[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got "+t+"."),!1)}(i)?i?(t.sampled=Math.random()<i,t.sampled?(s.b.log("[Tracing] starting "+t.op+" transaction - "+t.name),t):(s.b.log("[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = "+Number(i)+")"),t)):(s.b.log("[Tracing] Discarding transaction because "+("function"==typeof e.tracesSampler?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0")),t.sampled=!1,t):(s.b.warn("[Tracing] Discarding transaction because of invalid sample rate."),t.sampled=!1,t)):(t.sampled=!1,t)
@@ -166,7 +166,7 @@ r.b.log("pinging Heartbeat -> current counter: "+this._heartbeatCounter),setTime
166
166
  function l(t){if(t){var e=t.getScope()
167
167
  e&&e.getTransaction()&&e.setSpan(void 0)}}},616:function(t,e,n){"use strict"
168
168
  n.d(e,"b",(function(){return c})),n.d(e,"a",(function(){return u}))
169
- var i=n(0),a=n(84),r=n(82),s=n(7),o=n(613),c=function(){function t(t){void 0===t&&(t=1e3),this.spans=[],this._maxlen=t}return t.prototype.add=function(t){this.spans.length>this._maxlen?t.spanRecorder=void 0:this.spans.push(t)},t}(),u=function(){function t(t){if(this.traceId=Object(a.j)(),this.spanId=Object(a.j)().substring(16),this.startTimestamp=Object(r.e)(),this.tags={},this.data={},!t)return this
169
+ var i=n(0),a=n(83),r=n(82),s=n(7),o=n(613),c=function(){function t(t){void 0===t&&(t=1e3),this.spans=[],this._maxlen=t}return t.prototype.add=function(t){this.spans.length>this._maxlen?t.spanRecorder=void 0:this.spans.push(t)},t}(),u=function(){function t(t){if(this.traceId=Object(a.j)(),this.spanId=Object(a.j)().substring(16),this.startTimestamp=Object(r.e)(),this.tags={},this.data={},!t)return this
170
170
  t.traceId&&(this.traceId=t.traceId),t.spanId&&(this.spanId=t.spanId),t.parentSpanId&&(this.parentSpanId=t.parentSpanId),"sampled"in t&&(this.sampled=t.sampled),t.op&&(this.op=t.op),t.description&&(this.description=t.description),t.data&&(this.data=t.data),t.tags&&(this.tags=t.tags),t.status&&(this.status=t.status),t.startTimestamp&&(this.startTimestamp=t.startTimestamp),t.endTimestamp&&(this.endTimestamp=t.endTimestamp)}return t.prototype.child=function(t){return this.startChild(t)},t.prototype.startChild=function(e){var n=new t(Object(i.a)(Object(i.a)({},e),{parentSpanId:this.spanId,sampled:this.sampled,traceId:this.traceId}))
171
171
  return n.spanRecorder=this.spanRecorder,n.spanRecorder&&n.spanRecorder.add(n),n.transaction=this.transaction,n},t.prototype.setTag=function(t,e){var n
172
172
  return this.tags=Object(i.a)(Object(i.a)({},this.tags),((n={})[t]=e,n)),this},t.prototype.setData=function(t,e){var n
@@ -176,7 +176,7 @@ return e!==o.a.UnknownError&&this.setStatus(e),this},t.prototype.isSuccess=funct
176
176
  return void 0!==this.sampled&&(t=this.sampled?"-1":"-0"),this.traceId+"-"+this.spanId+t},t.prototype.toContext=function(){return Object(s.a)({data:this.data,description:this.description,endTimestamp:this.endTimestamp,op:this.op,parentSpanId:this.parentSpanId,sampled:this.sampled,spanId:this.spanId,startTimestamp:this.startTimestamp,status:this.status,tags:this.tags,traceId:this.traceId})},t.prototype.updateWithContext=function(t){var e,n,i,a,r
177
177
  return this.data=null!=(e=t.data)?e:{},this.description=t.description,this.endTimestamp=t.endTimestamp,this.op=t.op,this.parentSpanId=t.parentSpanId,this.sampled=t.sampled,this.spanId=null!=(n=t.spanId)?n:this.spanId,this.startTimestamp=null!=(i=t.startTimestamp)?i:this.startTimestamp,this.status=t.status,this.tags=null!=(a=t.tags)?a:{},this.traceId=null!=(r=t.traceId)?r:this.traceId,this},t.prototype.getTraceContext=function(){return Object(s.a)({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,trace_id:this.traceId})},t.prototype.toJSON=function(){return Object(s.a)({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,start_timestamp:this.startTimestamp,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,timestamp:this.endTimestamp,trace_id:this.traceId})},t}()},617:function(t,e,n){"use strict"
178
178
  n.d(e,"a",(function(){return d}))
179
- var i=n(0),a=n(611),r=n(89),s=n(4),o=n(19),c=n(7),u=n(616),d=function(t){function e(e,n){var i=t.call(this,e)||this
179
+ var i=n(0),a=n(611),r=n(88),s=n(4),o=n(19),c=n(7),u=n(616),d=function(t){function e(e,n){var i=t.call(this,e)||this
180
180
  return i._measurements={},i._hub=Object(a.b)(),Object(s.g)(n,a.a)&&(i._hub=n),i.name=e.name||"",i.metadata=e.metadata||{},i._trimEnd=e.trimEnd,i.transaction=i,i}return Object(i.b)(e,t),e.prototype.setName=function(t){this.name=t},e.prototype.initSpanRecorder=function(t){void 0===t&&(t=1e3),this.spanRecorder||(this.spanRecorder=new u.b(t)),this.spanRecorder.add(this)},e.prototype.setMeasurements=function(t){this._measurements=Object(i.a)({},t)},e.prototype.setMetadata=function(t){this.metadata=Object(i.a)(Object(i.a)({},this.metadata),t)},e.prototype.finish=function(e){var n,i,a,s,c,u=this
181
181
  if(void 0===this.endTimestamp){if(this.name||(o.b.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this.name="<unlabeled transaction>"),t.prototype.finish.call(this,e),!0!==this.sampled)return o.b.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),void(null===(c=null===(a=null===(n=this._hub.getClient())||void 0===n?void 0:(i=n).getTransport)||void 0===a?void 0:(s=a.call(i)).recordLostEvent)||void 0===c||c.call(s,r.a.SampleRate,"transaction"))
182
182
  var d=this.spanRecorder?this.spanRecorder.spans.filter((function(t){return t!==u&&t.endTimestamp})):[]
@@ -186,8 +186,8 @@ return Object.keys(this._measurements).length>0&&(o.b.log("[Measurements] Adding
186
186
  return Object(c.a)(Object(i.a)(Object(i.a)({},e),{name:this.name,trimEnd:this._trimEnd}))},e.prototype.updateWithContext=function(e){var n
187
187
  return t.prototype.updateWithContext.call(this,e),this.name=null!=(n=e.name)?n:"",this._trimEnd=e.trimEnd,this},e}(u.a)},619:function(t,e,n){"use strict"
188
188
  n.d(e,"a",(function(){return o}))
189
- var i=n(92),a=n(19),r=n(613),s=n(612)
189
+ var i=n(91),a=n(19),r=n(613),s=n(612)
190
190
  function o(){Object(i.a)({callback:c,type:"error"}),Object(i.a)({callback:c,type:"unhandledrejection"})}function c(){var t=Object(s.c)()
191
191
  t&&(a.b.log("[Tracing] Transaction: "+r.a.InternalError+" -> Global error occured"),t.setStatus(r.a.InternalError))}}}])
192
192
 
193
- //# sourceMappingURL=chunk.3.8f95b516d88ff4eec64c.map
193
+ //# sourceMappingURL=chunk.3.e54be01b5124e4e27958.map