ghost 5.63.0 → 5.65.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 (161) hide show
  1. package/components/tryghost-adapter-cache-memory-ttl-5.65.0.tgz +0 -0
  2. package/components/{tryghost-adapter-cache-redis-5.63.0.tgz → tryghost-adapter-cache-redis-5.65.0.tgz} +0 -0
  3. package/components/{tryghost-adapter-manager-5.63.0.tgz → tryghost-adapter-manager-5.65.0.tgz} +0 -0
  4. package/components/{tryghost-announcement-bar-settings-5.63.0.tgz → tryghost-announcement-bar-settings-5.65.0.tgz} +0 -0
  5. package/components/tryghost-api-framework-5.65.0.tgz +0 -0
  6. package/components/{tryghost-api-version-compatibility-service-5.63.0.tgz → tryghost-api-version-compatibility-service-5.65.0.tgz} +0 -0
  7. package/components/{tryghost-audience-feedback-5.63.0.tgz → tryghost-audience-feedback-5.65.0.tgz} +0 -0
  8. package/components/tryghost-bookshelf-repository-5.65.0.tgz +0 -0
  9. package/components/tryghost-bootstrap-socket-5.65.0.tgz +0 -0
  10. package/components/tryghost-collections-5.65.0.tgz +0 -0
  11. package/components/{tryghost-constants-5.63.0.tgz → tryghost-constants-5.65.0.tgz} +0 -0
  12. package/components/tryghost-custom-theme-settings-service-5.65.0.tgz +0 -0
  13. package/components/{tryghost-data-generator-5.63.0.tgz → tryghost-data-generator-5.65.0.tgz} +0 -0
  14. package/components/{tryghost-domain-events-5.63.0.tgz → tryghost-domain-events-5.65.0.tgz} +0 -0
  15. package/components/{tryghost-donations-5.63.0.tgz → tryghost-donations-5.65.0.tgz} +0 -0
  16. package/components/tryghost-dynamic-routing-events-5.65.0.tgz +0 -0
  17. package/components/tryghost-email-analytics-provider-mailgun-5.65.0.tgz +0 -0
  18. package/components/{tryghost-email-analytics-service-5.63.0.tgz → tryghost-email-analytics-service-5.65.0.tgz} +0 -0
  19. package/components/{tryghost-email-content-generator-5.63.0.tgz → tryghost-email-content-generator-5.65.0.tgz} +0 -0
  20. package/components/tryghost-email-events-5.65.0.tgz +0 -0
  21. package/components/{tryghost-email-service-5.63.0.tgz → tryghost-email-service-5.65.0.tgz} +0 -0
  22. package/components/tryghost-email-suppression-list-5.65.0.tgz +0 -0
  23. package/components/tryghost-event-aware-cache-wrapper-5.65.0.tgz +0 -0
  24. package/components/tryghost-express-dynamic-redirects-5.65.0.tgz +0 -0
  25. package/components/{tryghost-external-media-inliner-5.63.0.tgz → tryghost-external-media-inliner-5.65.0.tgz} +0 -0
  26. package/components/{tryghost-extract-api-key-5.63.0.tgz → tryghost-extract-api-key-5.65.0.tgz} +0 -0
  27. package/components/{tryghost-html-to-plaintext-5.63.0.tgz → tryghost-html-to-plaintext-5.65.0.tgz} +0 -0
  28. package/components/tryghost-i18n-5.65.0.tgz +0 -0
  29. package/components/tryghost-importer-handler-content-files-5.65.0.tgz +0 -0
  30. package/components/{tryghost-importer-revue-5.63.0.tgz → tryghost-importer-revue-5.65.0.tgz} +0 -0
  31. package/components/tryghost-in-memory-repository-5.65.0.tgz +0 -0
  32. package/components/{tryghost-job-manager-5.63.0.tgz → tryghost-job-manager-5.65.0.tgz} +0 -0
  33. package/components/{tryghost-link-redirects-5.63.0.tgz → tryghost-link-redirects-5.65.0.tgz} +0 -0
  34. package/components/{tryghost-link-replacer-5.63.0.tgz → tryghost-link-replacer-5.65.0.tgz} +0 -0
  35. package/components/{tryghost-link-tracking-5.63.0.tgz → tryghost-link-tracking-5.65.0.tgz} +0 -0
  36. package/components/{tryghost-magic-link-5.63.0.tgz → tryghost-magic-link-5.65.0.tgz} +0 -0
  37. package/components/tryghost-mail-events-5.65.0.tgz +0 -0
  38. package/components/{tryghost-mailgun-client-5.63.0.tgz → tryghost-mailgun-client-5.65.0.tgz} +0 -0
  39. package/components/{tryghost-member-attribution-5.63.0.tgz → tryghost-member-attribution-5.65.0.tgz} +0 -0
  40. package/components/{tryghost-member-events-5.63.0.tgz → tryghost-member-events-5.65.0.tgz} +0 -0
  41. package/components/tryghost-members-api-5.65.0.tgz +0 -0
  42. package/components/{tryghost-members-csv-5.63.0.tgz → tryghost-members-csv-5.65.0.tgz} +0 -0
  43. package/components/{tryghost-members-events-service-5.63.0.tgz → tryghost-members-events-service-5.65.0.tgz} +0 -0
  44. package/components/{tryghost-members-importer-5.63.0.tgz → tryghost-members-importer-5.65.0.tgz} +0 -0
  45. package/components/{tryghost-members-offers-5.63.0.tgz → tryghost-members-offers-5.65.0.tgz} +0 -0
  46. package/components/{tryghost-members-payments-5.63.0.tgz → tryghost-members-payments-5.65.0.tgz} +0 -0
  47. package/components/tryghost-members-ssr-5.65.0.tgz +0 -0
  48. package/components/{tryghost-members-stripe-service-5.63.0.tgz → tryghost-members-stripe-service-5.65.0.tgz} +0 -0
  49. package/components/tryghost-mentions-email-report-5.65.0.tgz +0 -0
  50. package/components/tryghost-milestones-5.65.0.tgz +0 -0
  51. package/components/tryghost-minifier-5.65.0.tgz +0 -0
  52. package/components/tryghost-model-to-domain-event-interceptor-5.65.0.tgz +0 -0
  53. package/components/{tryghost-mw-api-version-mismatch-5.63.0.tgz → tryghost-mw-api-version-mismatch-5.65.0.tgz} +0 -0
  54. package/components/tryghost-mw-cache-control-5.65.0.tgz +0 -0
  55. package/components/{tryghost-mw-error-handler-5.63.0.tgz → tryghost-mw-error-handler-5.65.0.tgz} +0 -0
  56. package/components/{tryghost-mw-session-from-token-5.63.0.tgz → tryghost-mw-session-from-token-5.65.0.tgz} +0 -0
  57. package/components/tryghost-mw-update-user-last-seen-5.65.0.tgz +0 -0
  58. package/components/tryghost-mw-version-match-5.65.0.tgz +0 -0
  59. package/components/tryghost-mw-vhost-5.65.0.tgz +0 -0
  60. package/components/tryghost-nql-filter-expansions-5.65.0.tgz +0 -0
  61. package/components/tryghost-oembed-service-5.65.0.tgz +0 -0
  62. package/components/{tryghost-package-json-5.63.0.tgz → tryghost-package-json-5.65.0.tgz} +0 -0
  63. package/components/{tryghost-post-events-5.63.0.tgz → tryghost-post-events-5.65.0.tgz} +0 -0
  64. package/components/{tryghost-post-revisions-5.63.0.tgz → tryghost-post-revisions-5.65.0.tgz} +0 -0
  65. package/components/tryghost-posts-service-5.65.0.tgz +0 -0
  66. package/components/tryghost-recommendations-5.65.0.tgz +0 -0
  67. package/components/tryghost-referrers-5.65.0.tgz +0 -0
  68. package/components/tryghost-security-5.65.0.tgz +0 -0
  69. package/components/tryghost-session-service-5.65.0.tgz +0 -0
  70. package/components/tryghost-settings-path-manager-5.65.0.tgz +0 -0
  71. package/components/tryghost-slack-notifications-5.65.0.tgz +0 -0
  72. package/components/{tryghost-staff-service-5.63.0.tgz → tryghost-staff-service-5.65.0.tgz} +0 -0
  73. package/components/{tryghost-stats-service-5.63.0.tgz → tryghost-stats-service-5.65.0.tgz} +0 -0
  74. package/components/{tryghost-tiers-5.63.0.tgz → tryghost-tiers-5.65.0.tgz} +0 -0
  75. package/components/{tryghost-update-check-service-5.63.0.tgz → tryghost-update-check-service-5.65.0.tgz} +0 -0
  76. package/components/tryghost-verification-trigger-5.65.0.tgz +0 -0
  77. package/components/{tryghost-version-notifications-data-service-5.63.0.tgz → tryghost-version-notifications-data-service-5.65.0.tgz} +0 -0
  78. package/components/tryghost-webmentions-5.65.0.tgz +0 -0
  79. package/core/built/admin/assets/admin-x-settings/CodeEditorView-2b332315.mjs +2347 -0
  80. package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +6 -0
  81. package/core/built/admin/assets/admin-x-settings/index-4a560e9e.mjs +19693 -0
  82. package/core/built/admin/assets/admin-x-settings/index-9cc1df42.mjs +13955 -0
  83. package/core/built/admin/assets/admin-x-settings/index-b8cc4f2e.mjs +3465 -0
  84. package/core/built/admin/assets/admin-x-settings/limit-service-7694c0d4.mjs +12902 -0
  85. package/core/built/admin/assets/admin-x-settings/modals-2073207d.mjs +11518 -0
  86. package/core/built/admin/assets/{chunk.143.1c5d21facf1f9b9beef9.js → chunk.143.c91dc1d2a8a5a1f318ec.js} +5 -5
  87. package/core/built/admin/assets/{chunk.178.43b03c9ac011a54262b0.js → chunk.178.d921de78463d288f3bcd.js} +4 -4
  88. package/core/built/admin/assets/{chunk.237.9b7032162949850f6c76.js → chunk.518.396deed1a0c759d1f403.js} +1136 -1077
  89. package/core/built/admin/assets/{ghost-7c3f2de2ec83e591ad9f9db5165b2733.js → ghost-38746349a72536a92f4d8235a582d716.js} +58 -57
  90. package/core/built/admin/assets/ghost-761b67711827277b7095ebc7acc5c49f.css +1 -0
  91. package/core/built/admin/assets/ghost-dark-d3f636c30e80bdd7f21d3fb4770073c9.css +1 -0
  92. package/core/built/admin/assets/{vendor-f8ce8bd43cf5dad6608f828ab48cee9b.js → vendor-240cd1dbd84a2e07709b867442c41840.js} +4 -4
  93. package/core/built/admin/index.html +6 -6
  94. package/core/frontend/src/cards/css/collection.css +42 -12
  95. package/core/server/api/endpoints/collections.js +5 -1
  96. package/core/server/api/endpoints/posts-public.js +63 -0
  97. package/core/server/api/endpoints/recommendations-public.js +1 -1
  98. package/core/server/api/endpoints/recommendations.js +20 -5
  99. package/core/server/api/endpoints/utils/serializers/output/config.js +0 -1
  100. package/core/server/api/endpoints/utils/serializers/output/site.js +1 -1
  101. package/core/server/data/migrations/versions/5.64/2023-09-19-04-25-40-truncate-stale-built-in-collections-posts.js +10 -0
  102. package/core/server/data/migrations/versions/5.64/2023-09-19-04-34-10-repopulate-built-in-collection-posts.js +10 -0
  103. package/core/server/data/migrations/versions/5.65/2023-09-22-06-42-15-truncate-stale-built-in-collections-posts.js +12 -0
  104. package/core/server/data/migrations/versions/5.65/2023-09-22-06-42-55-repopulate-built-in-featured-collection-posts.js +49 -0
  105. package/core/server/data/schema/fixtures/fixtures.json +0 -14
  106. package/core/server/lib/lexical.js +22 -3
  107. package/core/server/lib/request-external.js +10 -4
  108. package/core/server/models/post.js +71 -1
  109. package/core/server/models/relations/authors.js +1 -1
  110. package/core/server/services/collections/BookshelfCollectionsRepository.js +85 -38
  111. package/core/server/services/collections/PostsRepository.js +5 -0
  112. package/core/server/services/collections/service.js +7 -3
  113. package/core/server/services/members/content-gating.js +11 -7
  114. package/core/server/services/mentions/WebmentionMetadata.js +14 -2
  115. package/core/server/services/public-config/site.js +1 -1
  116. package/core/server/services/recommendations/RecommendationServiceWrapper.js +3 -2
  117. package/core/server/web/api/endpoints/admin/routes.js +2 -1
  118. package/core/shared/config/defaults.json +0 -4
  119. package/core/shared/labs.js +1 -1
  120. package/package.json +160 -159
  121. package/yarn.lock +361 -364
  122. package/components/tryghost-adapter-cache-memory-ttl-5.63.0.tgz +0 -0
  123. package/components/tryghost-api-framework-5.63.0.tgz +0 -0
  124. package/components/tryghost-bookshelf-repository-5.63.0.tgz +0 -0
  125. package/components/tryghost-bootstrap-socket-5.63.0.tgz +0 -0
  126. package/components/tryghost-collections-5.63.0.tgz +0 -0
  127. package/components/tryghost-custom-theme-settings-service-5.63.0.tgz +0 -0
  128. package/components/tryghost-dynamic-routing-events-5.63.0.tgz +0 -0
  129. package/components/tryghost-email-analytics-provider-mailgun-5.63.0.tgz +0 -0
  130. package/components/tryghost-email-events-5.63.0.tgz +0 -0
  131. package/components/tryghost-email-suppression-list-5.63.0.tgz +0 -0
  132. package/components/tryghost-event-aware-cache-wrapper-5.63.0.tgz +0 -0
  133. package/components/tryghost-express-dynamic-redirects-5.63.0.tgz +0 -0
  134. package/components/tryghost-i18n-5.63.0.tgz +0 -0
  135. package/components/tryghost-importer-handler-content-files-5.63.0.tgz +0 -0
  136. package/components/tryghost-in-memory-repository-5.63.0.tgz +0 -0
  137. package/components/tryghost-mail-events-5.63.0.tgz +0 -0
  138. package/components/tryghost-members-api-5.63.0.tgz +0 -0
  139. package/components/tryghost-members-ssr-5.63.0.tgz +0 -0
  140. package/components/tryghost-mentions-email-report-5.63.0.tgz +0 -0
  141. package/components/tryghost-milestones-5.63.0.tgz +0 -0
  142. package/components/tryghost-minifier-5.63.0.tgz +0 -0
  143. package/components/tryghost-model-to-domain-event-interceptor-5.63.0.tgz +0 -0
  144. package/components/tryghost-mw-cache-control-5.63.0.tgz +0 -0
  145. package/components/tryghost-mw-update-user-last-seen-5.63.0.tgz +0 -0
  146. package/components/tryghost-mw-version-match-5.63.0.tgz +0 -0
  147. package/components/tryghost-mw-vhost-5.63.0.tgz +0 -0
  148. package/components/tryghost-nql-filter-expansions-5.63.0.tgz +0 -0
  149. package/components/tryghost-oembed-service-5.63.0.tgz +0 -0
  150. package/components/tryghost-posts-service-5.63.0.tgz +0 -0
  151. package/components/tryghost-recommendations-5.63.0.tgz +0 -0
  152. package/components/tryghost-referrers-5.63.0.tgz +0 -0
  153. package/components/tryghost-security-5.63.0.tgz +0 -0
  154. package/components/tryghost-session-service-5.63.0.tgz +0 -0
  155. package/components/tryghost-settings-path-manager-5.63.0.tgz +0 -0
  156. package/components/tryghost-slack-notifications-5.63.0.tgz +0 -0
  157. package/components/tryghost-verification-trigger-5.63.0.tgz +0 -0
  158. package/components/tryghost-webmentions-5.63.0.tgz +0 -0
  159. package/core/built/admin/assets/ghost-33664cad4cd6664a8b5fa56e62c5005f.css +0 -1
  160. package/core/built/admin/assets/ghost-dark-0452daeaee3a9b16dcd954ea60dad518.css +0 -1
  161. /package/core/built/admin/assets/{chunk.237.9b7032162949850f6c76.js.LICENSE.txt → chunk.518.396deed1a0c759d1f403.js.LICENSE.txt} +0 -0
@@ -11984,7 +11984,7 @@ const D=Ember.HTMLBars.template({id:"kGwCX25o",block:'{"symbols":["card","sugges
11984
11984
  let I=(i=Ember.inject.service,o=Ember.inject.service,a=Ember.inject.service,s=Ember.inject.service,l=Ember.inject.service,u=Ember._tracked,c=Ember._tracked,d=Ember._tracked,h=Ember._action,p=Ember._action,f=Ember._action,m=Ember._action,g=Ember._action,b=Ember._action,v=Ember._action,y=Ember._action,_=(0,n.task)({restartable:!0}),k=class extends t.default{get isEmpty(){const{buttonText:e,buttonUrl:t}=this.args.payload
11985
11985
  return Ember.isBlank(e)&&Ember.isBlank(t)}get isIncomplete(){const{buttonText:e,buttonUrl:t}=this.args.payload
11986
11986
  return Ember.isBlank(e)||Ember.isBlank(t)}get toolbar(){return!this.args.isEditing&&{items:[{buttonClass:"fw4 flex items-center white",icon:"koenig/kg-edit",iconClass:"fill-white-no-conflict",title:"Edit",text:"",action:Ember.run.bind(this,this.args.editCard)}]}}get suggestedUrls(){const e=[]
11987
- return e.push({name:"Homepage",url:this.config.getSiteUrl("/")},{name:"Free signup",url:"#/portal/signup/free"}),this.membersUtils.paidMembersEnabled&&e.push({name:"Paid signup",url:"#/portal/signup"},{name:"Upgrade or change plan",url:"#/portal/account/plans"}),this.feature.tipsAndDonations&&this.settings.donationsEnabled&&e.push({name:"Tip or donation",url:"#/portal/support"}),this.offers&&this.offers.forEach((t=>{e.push({name:`Offer - ${t.name}`,url:this.config.getSiteUrl(t.code)})})),e}constructor(){super(...arguments),A(this,"feature",E,this),A(this,"store",w,this),A(this,"settings",x,this),A(this,"membersUtils",O,this),A(this,"ui",C,this),A(this,"config",T,this),A(this,"buttonFocused",S,this),A(this,"contentFocused",P,this),A(this,"offers",M,this),R(this,"linkScrollerTimeout",null),this.args.registerComponent(this)
11987
+ return e.push({name:"Homepage",url:this.config.getSiteUrl("/")},{name:"Free signup",url:"#/portal/signup/free"}),this.membersUtils.paidMembersEnabled&&e.push({name:"Paid signup",url:"#/portal/signup"},{name:"Upgrade or change plan",url:"#/portal/account/plans"}),this.feature.tipsAndDonations&&this.settings.donationsEnabled&&e.push({name:"Tip or donation",url:"#/portal/support"}),this.settings.recommendationsEnabled&&e.push({name:"Recommendations",url:"#/portal/recommendations"}),this.offers&&this.offers.forEach((t=>{e.push({name:`Offer - ${t.name}`,url:this.config.getSiteUrl(t.code)})})),e}constructor(){super(...arguments),A(this,"feature",E,this),A(this,"store",w,this),A(this,"settings",x,this),A(this,"membersUtils",O,this),A(this,"ui",C,this),A(this,"config",T,this),A(this,"buttonFocused",S,this),A(this,"contentFocused",P,this),A(this,"offers",M,this),R(this,"linkScrollerTimeout",null),this.args.registerComponent(this)
11988
11988
  Object.entries({alignment:"center"}).forEach((([e,t])=>{void 0===this.args.payload[e]&&this._updatePayloadAttr(e,t)})),this.fetchOffersTask.perform()}registerElement(e){this.element=e}setButtonText(e){this._updatePayloadAttr("buttonText",e.target.value)}setButtonUrl(e){this._updatePayloadAttr("buttonUrl",e)}setAlignment(e,t){t.preventDefault(),this._updatePayloadAttr("alignment",e)}leaveEditMode(){this.isEmpty&&Ember.run.scheduleOnce("afterRender",this,this.args.deleteCard)}focusElement(e,t){t.preventDefault(),document.querySelector(e)?.focus()}enterLinkURL(e){e.stopPropagation()
11989
11989
  const t=e.target,r=e.target.querySelector("span")
11990
11990
  clearTimeout(this.linkScrollerTimeout),r.offsetWidth>t.offsetWidth&&(this.linkScrollerTimeout=setTimeout((()=>{t.classList.add("scroller"),r.style.transform=`translateX(-${r.offsetWidth-t.offsetWidth+8}px)`}),100))}leaveLinkURL(e){e.stopPropagation(),clearTimeout(this.linkScrollerTimeout)
@@ -12038,7 +12038,7 @@ let V=(a=Ember.inject.service,s=Ember.inject.service,l=Ember.inject.service,u=Em
12038
12038
  return t?Ember.isBlank(e)&&Ember.isBlank(r)&&Ember.isBlank(n):Ember.isBlank(e)}get formattedHtml(){return(0,n.formatTextReplacementHtml)(this.args.payload.html)}get segments(){return[{name:"free members",filter:"status:free"},{name:"paid members",filter:"status:-free"}]}get selectedSegment(){return this.segments.find((e=>e.filter===this.args.payload.segment))}get toolbar(){if(this.args.isEditing)return!1
12039
12039
  const e=[]
12040
12040
  return e.push({buttonClass:"fw4 flex items-center white",icon:"koenig/kg-edit",iconClass:"fill-white-no-conflict",title:"Edit",text:"",action:Ember.run.bind(this,this.args.editCard)}),{items:e}}get suggestedUrls(){const e=[]
12041
- return e.push({name:"Homepage",url:this.config.getSiteUrl("/")},{name:"Free signup",url:"#/portal/signup/free"}),this.membersUtils.paidMembersEnabled&&e.push({name:"Paid signup",url:"#/portal/signup"},{name:"Upgrade or change plan",url:"#/portal/account/plans"}),this.feature.tipsAndDonations&&this.settings.donationsEnabled&&e.push({name:"Tip or donation",url:"#/portal/support"}),this.offers&&this.offers.forEach((t=>{e.push({name:`Offer - ${t.name}`,url:this.config.getSiteUrl(t.code)})})),e}constructor(){super(...arguments),z(this,"feature",M,this),z(this,"store",A,this),z(this,"settings",R,this),z(this,"membersUtils",j,this),z(this,"ui",D,this),z(this,"config",I,this),z(this,"buttonFocused",N,this),z(this,"contentFocused",L,this),z(this,"offers",F,this),B(this,"buttonTextInputId","button-text-input-"+Ember.guidFor(this)),B(this,"urlInputId","url-input-"+Ember.guidFor(this)),B(this,"linkScrollerTimeout",null),this.args.registerComponent(this)
12041
+ return e.push({name:"Homepage",url:this.config.getSiteUrl("/")},{name:"Free signup",url:"#/portal/signup/free"}),this.membersUtils.paidMembersEnabled&&e.push({name:"Paid signup",url:"#/portal/signup"},{name:"Upgrade or change plan",url:"#/portal/account/plans"}),this.feature.tipsAndDonations&&this.settings.donationsEnabled&&e.push({name:"Tip or donation",url:"#/portal/support"}),this.settings.recommendationsEnabled&&e.push({name:"Recommendations",url:"#/portal/recommendations"}),this.offers&&this.offers.forEach((t=>{e.push({name:`Offer - ${t.name}`,url:this.config.getSiteUrl(t.code)})})),e}constructor(){super(...arguments),z(this,"feature",M,this),z(this,"store",A,this),z(this,"settings",R,this),z(this,"membersUtils",j,this),z(this,"ui",D,this),z(this,"config",I,this),z(this,"buttonFocused",N,this),z(this,"contentFocused",L,this),z(this,"offers",F,this),B(this,"buttonTextInputId","button-text-input-"+Ember.guidFor(this)),B(this,"urlInputId","url-input-"+Ember.guidFor(this)),B(this,"linkScrollerTimeout",null),this.args.registerComponent(this)
12042
12042
  Object.entries({showButton:!1,showDividers:!0,segment:"status:free",alignment:"left"}).forEach((([e,t])=>{void 0===this.args.payload[e]&&this._updatePayloadAttr(e,t)})),this.fetchOffersTask.perform()}registerElement(e){this.element=e}updateHtml(e){this._updatePayloadAttr("html",e)}setSegment(e){this._updatePayloadAttr("segment",e.filter)}toggleButton(){this._updatePayloadAttr("showButton",!this.args.payload.showButton),this.args.payload.showButton&&Ember.run.schedule("afterRender",this,(function(){document.getElementById(this.buttonTextInputId)?.focus()}))}setButtonText(e){this._updatePayloadAttr("buttonText",e.target.value)}setButtonUrl(e){this._updatePayloadAttr("buttonUrl",e)}setAlignment(e,t){t.preventDefault(),this._updatePayloadAttr("alignment",e)}toggleDividers(){this._updatePayloadAttr("showDividers",!this.args.payload.showDividers)}registerEditor(e){let t={"META+ENTER":Ember.run.bind(this,this._enter,"meta"),"CTRL+ENTER":Ember.run.bind(this,this._enter,"ctrl")}
12043
12043
  Object.keys(t).forEach((r=>{e.registerKeyCommand({str:r,run:()=>t[r](e,r)})})),this._textReplacementEditor=e,Ember.run.scheduleOnce("afterRender",this,this._placeCursorAtEnd)}leaveEditMode(){this.isEmpty&&Ember.run.scheduleOnce("afterRender",this,this.args.deleteCard)}blurElement(e){e.preventDefault(),e.target.blur()}focusElement(e,t){t.preventDefault(),document.querySelector(e)?.focus()}enterLinkURL(e){e.stopPropagation()
12044
12044
  const t=e.target,r=e.target.querySelector("span")
@@ -12187,7 +12187,7 @@ let F=(o=Ember.inject.service,a=Ember.inject.service,s=Ember.inject.service,l=Em
12187
12187
  return!e||!t}get isEmpty(){const{header:e,subheader:t,buttonUrl:r,buttonText:n,buttonEnabled:i}=this.args.payload
12188
12188
  return Ember.isBlank(e)&&Ember.isBlank(t)&&(!i||Ember.isBlank(r)||Ember.isBlank(n))}get isIncomplete(){const{header:e}=this.args.payload
12189
12189
  return Ember.isBlank(e)}get toolbar(){return!this.args.isEditing&&{items:[{buttonClass:"fw4 flex items-center white",icon:"koenig/kg-edit",iconClass:"fill-white-no-conflict",title:"Edit",text:"",action:Ember.run.bind(this,this.args.editCard)}]}}get hasSubheader(){return this.args.payload.subheader&&Boolean(this.args.payload.subheader.replace(/(<br *\/?>)+$/gi,"").trim())}get backgroundImageStyle(){return this.args.payload.backgroundImageSrc?` background-image: url(${this.args.payload.backgroundImageSrc});`:""}get suggestedUrls(){const e=[]
12190
- return e.push({name:"Homepage",url:this.config.getSiteUrl("/")},{name:"Free signup",url:"#/portal/signup/free"}),this.membersUtils.paidMembersEnabled&&e.push({name:"Paid signup",url:"#/portal/signup"},{name:"Upgrade or change plan",url:"#/portal/account/plans"}),this.feature.tipsAndDonations&&this.settings.donationsEnabled&&e.push({name:"Tip or donation",url:"#/portal/support"}),this.offers&&this.offers.forEach((t=>{e.push({name:`Offer - ${t.name}`,url:this.config.getSiteUrl(t.code)})})),e}constructor(){super(...arguments),D(this,"feature",S,this),D(this,"store",P,this),D(this,"settings",M,this),D(this,"membersUtils",A,this),D(this,"ui",R,this),D(this,"config",j,this),I(this,"imageExtensions",n.IMAGE_EXTENSIONS),I(this,"imageMimeTypes",n.IMAGE_MIME_TYPES),this.args.registerComponent(this)
12190
+ return e.push({name:"Homepage",url:this.config.getSiteUrl("/")},{name:"Free signup",url:"#/portal/signup/free"}),this.membersUtils.paidMembersEnabled&&e.push({name:"Paid signup",url:"#/portal/signup"},{name:"Upgrade or change plan",url:"#/portal/account/plans"}),this.feature.tipsAndDonations&&this.settings.donationsEnabled&&e.push({name:"Tip or donation",url:"#/portal/support"}),this.settings.recommendationsEnabled&&e.push({name:"Recommendations",url:"#/portal/recommendations"}),this.offers&&this.offers.forEach((t=>{e.push({name:`Offer - ${t.name}`,url:this.config.getSiteUrl(t.code)})})),e}constructor(){super(...arguments),D(this,"feature",S,this),D(this,"store",P,this),D(this,"settings",M,this),D(this,"membersUtils",A,this),D(this,"ui",R,this),D(this,"config",j,this),I(this,"imageExtensions",n.IMAGE_EXTENSIONS),I(this,"imageMimeTypes",n.IMAGE_MIME_TYPES),this.args.registerComponent(this)
12191
12191
  Object.entries({size:"small",style:"dark",buttonEnabled:!1}).forEach((([e,t])=>{void 0===this.args.payload[e]&&this._updatePayloadAttr(e,t)}))}registerElement(e){this.element=e}registerHeaderEditor(e){let t={ENTER:this.handleHeaderTab.bind(this),TAB:this.handleHeaderTab.bind(this),"META+ENTER":Ember.run.bind(this,this._enter,"meta"),"CTRL+ENTER":Ember.run.bind(this,this._enter,"ctrl")}
12192
12192
  Object.keys(t).forEach((r=>{e.registerKeyCommand({str:r,run:()=>t[r](e,r)})})),this._textReplacementEditor=e,Ember.run.scheduleOnce("afterRender",this,this._afterRender)}handleHeaderTab(){let e=this.element.querySelector(".kg-header-card-subheader .koenig-basic-html-input__editor")
12193
12193
  e&&e.focus()}registerSubheaderEditor(e){let t={"META+ENTER":Ember.run.bind(this,this._enter,"meta"),"CTRL+ENTER":Ember.run.bind(this,this._enter,"ctrl")}
@@ -13616,4 +13616,4 @@ e.default=class{constructor(e){if(this._data=new t.default,e)for(let t=0;t<e.len
13616
13616
  return this}get(e){let t=this._data[e]
13617
13617
  return t===r.UNDEFINED_KEY?void 0:t}set(e,t){return this._data[e]=t,this}delete(e){return this._data[e]=r.UNDEFINED_KEY,!0}}}))
13618
13618
 
13619
- //# sourceMappingURL=vendor-f8ce8bd43cf5dad6608f828ab48cee9b.map
13619
+ //# sourceMappingURL=vendor-240cd1dbd84a2e07709b867442c41840.map
@@ -8,7 +8,7 @@
8
8
  <title>Ghost Admin</title>
9
9
 
10
10
 
11
- <meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22cdnUrl%22%3A%22%22%2C%22rootURL%22%3A%22%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%225.63%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22ember-websockets%22%3A%7B%22socketIO%22%3Atrue%7D%2C%22%40sentry%2Fember%22%3A%7B%22disablePerformance%22%3Atrue%2C%22sentry%22%3A%7B%7D%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%7D" />
11
+ <meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22cdnUrl%22%3A%22%22%2C%22rootURL%22%3A%22%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%225.65%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22ember-websockets%22%3A%7B%22socketIO%22%3Atrue%7D%2C%22%40sentry%2Fember%22%3A%7B%22disablePerformance%22%3Atrue%2C%22sentry%22%3A%7B%7D%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%7D" />
12
12
 
13
13
  <meta name="HandheldFriendly" content="True" />
14
14
  <meta name="MobileOptimized" content="320" />
@@ -37,7 +37,7 @@
37
37
  </style>
38
38
 
39
39
  <link integrity="" rel="stylesheet" href="assets/vendor-3e6947aa681f0fb82b193090e520dc73.css">
40
- <link integrity="" rel="stylesheet" href="assets/ghost-33664cad4cd6664a8b5fa56e62c5005f.css" title="light">
40
+ <link integrity="" rel="stylesheet" href="assets/ghost-761b67711827277b7095ebc7acc5c49f.css" title="light">
41
41
 
42
42
 
43
43
  </head>
@@ -56,9 +56,9 @@
56
56
 
57
57
  <div id="ember-basic-dropdown-wormhole"></div>
58
58
 
59
- <script src="assets/vendor-f8ce8bd43cf5dad6608f828ab48cee9b.js"></script>
60
- <script src="assets/chunk.237.9b7032162949850f6c76.js"></script>
61
- <script src="assets/chunk.143.1c5d21facf1f9b9beef9.js"></script>
62
- <script src="assets/ghost-7c3f2de2ec83e591ad9f9db5165b2733.js"></script>
59
+ <script src="assets/vendor-240cd1dbd84a2e07709b867442c41840.js"></script>
60
+ <script src="assets/chunk.518.396deed1a0c759d1f403.js"></script>
61
+ <script src="assets/chunk.143.c91dc1d2a8a5a1f318ec.js"></script>
62
+ <script src="assets/ghost-38746349a72536a92f4d8235a582d716.js"></script>
63
63
  </body>
64
64
  </html>
@@ -1,16 +1,32 @@
1
1
  .kg-collection-card {
2
2
  width: 100%;
3
+ margin-top: 6vmin;
4
+ }
5
+
6
+ .kg-collection-card + * {
7
+ margin-top: 6vmin;
3
8
  }
4
9
 
5
10
  .kg-collection-card-title {
6
- padding: .8rem 0 1.6rem 0;
11
+ margin: .8rem 0 1.6rem 0;
7
12
  font-size: 1.5rem;
13
+ font-weight: 700;
8
14
  text-transform: uppercase;
9
15
  }
10
16
 
17
+ a.kg-collection-card-post-wrapper {
18
+ text-decoration: none;
19
+ color: var(--text-color);
20
+ }
21
+
22
+ a.kg-collection-card-post-wrapper:hover {
23
+ opacity: 1;
24
+ }
25
+
26
+
11
27
  .kg-collection-card-post {
12
28
  display: flex;
13
- gap: 2rem;
29
+ gap: 3.2rem;
14
30
  }
15
31
 
16
32
  .kg-collection-card-img {
@@ -26,14 +42,20 @@
26
42
  object-fit: cover;
27
43
  }
28
44
 
45
+ a.kg-collection-card-post-wrapper:hover img {
46
+ opacity: .92;
47
+ transition: all .2s ease;
48
+ }
49
+
29
50
  .kg-collection-card-content {
30
51
  display: flex;
31
52
  flex-direction: column;
32
- font-size: 1.45rem;
53
+ font-size: 1.6rem;
33
54
  }
34
55
 
35
56
  h2.kg-collection-card-post-title {
36
- font-size: 1.9rem;
57
+ margin: 0;
58
+ font-size: 2.4rem;
37
59
  overflow: hidden;
38
60
  display: -webkit-box;
39
61
  -webkit-box-orient: vertical;
@@ -41,7 +63,7 @@ h2.kg-collection-card-post-title {
41
63
  }
42
64
 
43
65
  p.kg-collection-card-post-excerpt {
44
- margin-top: .8rem;
66
+ margin-top: 1.2rem;
45
67
  overflow: hidden;
46
68
  display: -webkit-box;
47
69
  -webkit-box-orient: vertical;
@@ -52,7 +74,9 @@ p.kg-collection-card-post-excerpt {
52
74
  .kg-collection-card-post-meta {
53
75
  display: flex;
54
76
  opacity: .5;
55
- margin-top: .8rem;
77
+ margin-top: 1.2rem;
78
+ font-size: 1.3rem;
79
+ font-weight: 500;
56
80
  }
57
81
 
58
82
  /* List layout */
@@ -60,7 +84,7 @@ p.kg-collection-card-post-excerpt {
60
84
  .kg-collection-card-list {
61
85
  display: flex;
62
86
  flex-direction: column;
63
- gap: 2rem;
87
+ gap: 3.2rem;
64
88
  }
65
89
 
66
90
  @media (max-width: 767px) {
@@ -153,6 +177,10 @@ p.kg-collection-card-post-excerpt {
153
177
  font-size: 1.7rem;
154
178
  }
155
179
 
180
+ .kg-collection-card-grid .kg-collection-card-post-meta {
181
+ font-size: 1.25rem;
182
+ }
183
+
156
184
  @media (min-width: 640px) {
157
185
  .kg-collection-card-grid h2.kg-collection-card-post-title {
158
186
  font-size: 1.9rem;
@@ -161,13 +189,11 @@ p.kg-collection-card-post-excerpt {
161
189
  .kg-collection-card-grid.columns-1 h2.kg-collection-card-post-title {
162
190
  font-size: 2.4rem;
163
191
  }
164
- }
165
192
 
166
- /* @media (min-width: 768px) {
167
- .kg-collection-card-grid.columns-1 h2.kg-collection-card-post-title {
168
- font-size: 2.4rem;
193
+ .kg-collection-card-grid:not(.columns-3):not(.columns-4) .kg-collection-card-post-meta {
194
+ font-size: 1.3rem;
169
195
  }
170
- } */
196
+ }
171
197
 
172
198
  @media (min-width: 1024px) {
173
199
  .kg-collection-card-grid.columns-1 h2.kg-collection-card-post-title {
@@ -177,6 +203,10 @@ p.kg-collection-card-post-excerpt {
177
203
  .kg-collection-card-grid.columns-2 h2.kg-collection-card-post-title {
178
204
  font-size: 2.4rem;
179
205
  }
206
+
207
+ .kg-collection-card-grid.columns-1 .kg-collection-card-post-meta {
208
+ font-size: 1.4rem;
209
+ }
180
210
  }
181
211
 
182
212
  @media (min-width: 1280px) {
@@ -29,7 +29,11 @@ module.exports = {
29
29
  },
30
30
  permissions: true,
31
31
  query(frame) {
32
- return collectionsService.api.getAll(frame.options);
32
+ return collectionsService.api.getAll({
33
+ filter: frame.options.filter,
34
+ limit: frame.options.limit,
35
+ page: frame.options.page
36
+ });
33
37
  }
34
38
  },
35
39
 
@@ -23,6 +23,34 @@ const rejectPrivateFieldsTransformer = input => mapQuery(input, function (value,
23
23
  };
24
24
  });
25
25
 
26
+ function generateOptionsData(frame, options) {
27
+ return options.reduce((memo, option) => {
28
+ let value = frame.options?.[option];
29
+ if (['include', 'fields', 'formats'].includes(option)) {
30
+ value = value?.split(',').sort();
31
+ }
32
+
33
+ if (option === 'page') {
34
+ value = value || 1;
35
+ }
36
+
37
+ return {
38
+ ...memo,
39
+ [option]: value
40
+ };
41
+ }, {});
42
+ }
43
+
44
+ function generateAuthData(frame) {
45
+ if (frame.options?.context?.member) {
46
+ return {
47
+ free: frame.options?.context?.member.status === 'free',
48
+ tiers: frame.options?.context?.member.products?.map((product) => {
49
+ return product.slug;
50
+ }).sort()
51
+ };
52
+ }
53
+ }
26
54
  module.exports = {
27
55
  docName: 'posts',
28
56
 
@@ -31,6 +59,23 @@ module.exports = {
31
59
  cacheInvalidate: false
32
60
  },
33
61
  cache: postsPublicService.api?.cache,
62
+ generateCacheKeyData(frame) {
63
+ return {
64
+ options: generateOptionsData(frame, [
65
+ 'include',
66
+ 'filter',
67
+ 'fields',
68
+ 'formats',
69
+ 'limit',
70
+ 'order',
71
+ 'page',
72
+ 'absolute_urls',
73
+ 'collection'
74
+ ]),
75
+ auth: generateAuthData(frame),
76
+ method: 'browse'
77
+ };
78
+ },
34
79
  options: [
35
80
  'include',
36
81
  'filter',
@@ -67,6 +112,24 @@ module.exports = {
67
112
  headers: {
68
113
  cacheInvalidate: false
69
114
  },
115
+ cache: postsPublicService.api?.cache,
116
+ generateCacheKeyData(frame) {
117
+ return {
118
+ options: generateOptionsData(frame, [
119
+ 'include',
120
+ 'fields',
121
+ 'formats',
122
+ 'absolute_urls'
123
+ ]),
124
+ auth: generateAuthData(frame),
125
+ method: 'read',
126
+ identifier: {
127
+ id: frame.data.id,
128
+ slug: frame.data.slug,
129
+ uuid: frame.data.uuid
130
+ }
131
+ };
132
+ },
70
133
  options: [
71
134
  'include',
72
135
  'fields',
@@ -15,7 +15,7 @@ module.exports = {
15
15
  permissions: true,
16
16
  validation: {},
17
17
  async query(frame) {
18
- return await recommendations.controller.listRecommendations(frame);
18
+ return await recommendations.controller.browse(frame);
19
19
  }
20
20
  },
21
21
 
@@ -10,12 +10,27 @@ module.exports = {
10
10
  options: [
11
11
  'limit',
12
12
  'page',
13
- 'include'
13
+ 'include',
14
+ 'filter'
14
15
  ],
15
16
  permissions: true,
16
17
  validation: {},
17
18
  async query(frame) {
18
- return await recommendations.controller.listRecommendations(frame);
19
+ return await recommendations.controller.browse(frame);
20
+ }
21
+ },
22
+
23
+ read: {
24
+ headers: {
25
+ cacheInvalidate: false
26
+ },
27
+ options: [
28
+ 'id'
29
+ ],
30
+ permissions: true,
31
+ validation: {},
32
+ async query(frame) {
33
+ return await recommendations.controller.read(frame);
19
34
  }
20
35
  },
21
36
 
@@ -28,7 +43,7 @@ module.exports = {
28
43
  validation: {},
29
44
  permissions: true,
30
45
  async query(frame) {
31
- return await recommendations.controller.addRecommendation(frame);
46
+ return await recommendations.controller.add(frame);
32
47
  }
33
48
  },
34
49
 
@@ -48,7 +63,7 @@ module.exports = {
48
63
  },
49
64
  permissions: true,
50
65
  async query(frame) {
51
- return await recommendations.controller.editRecommendation(frame);
66
+ return await recommendations.controller.edit(frame);
52
67
  }
53
68
  },
54
69
 
@@ -69,7 +84,7 @@ module.exports = {
69
84
  },
70
85
  permissions: true,
71
86
  query(frame) {
72
- return recommendations.controller.deleteRecommendation(frame);
87
+ return recommendations.controller.destroy(frame);
73
88
  }
74
89
  }
75
90
  };
@@ -21,7 +21,6 @@ module.exports = {
21
21
  'tenor',
22
22
  'editor',
23
23
  'pintura',
24
- 'adminX',
25
24
  'signupForm'
26
25
  ];
27
26
 
@@ -16,7 +16,7 @@ module.exports = {
16
16
  'locale',
17
17
  'url',
18
18
  'version',
19
- 'allow_self_signup',
19
+ 'allow_external_signup',
20
20
  'sentry_dsn',
21
21
  'sentry_env'
22
22
  ])
@@ -0,0 +1,10 @@
1
+ const logging = require('@tryghost/logging');
2
+
3
+ module.exports = {
4
+ async up() {
5
+ logging.warn('Skipping migration - noop');
6
+ },
7
+ async down() {
8
+ logging.warn('Skipping migration - noop');
9
+ }
10
+ };
@@ -0,0 +1,10 @@
1
+ const logging = require('@tryghost/logging');
2
+
3
+ module.exports = {
4
+ async up() {
5
+ logging.warn('Skipping migration - noop');
6
+ },
7
+ async down() {
8
+ logging.warn('Skipping migration - noop');
9
+ }
10
+ };
@@ -0,0 +1,12 @@
1
+ const logging = require('@tryghost/logging');
2
+ const {createNonTransactionalMigration} = require('../../utils');
3
+
4
+ module.exports = createNonTransactionalMigration(
5
+ async function up(knex) {
6
+ logging.info('Clearing collections_posts table');
7
+ await knex('collections_posts').truncate();
8
+ },
9
+ async function down() {
10
+ logging.info('Not doing anything - collections_posts table has been truncated');
11
+ }
12
+ );
@@ -0,0 +1,49 @@
1
+ const logging = require('@tryghost/logging');
2
+ const {default: ObjectID} = require('bson-objectid');
3
+ const {createTransactionalMigration} = require('../../utils');
4
+
5
+ const insertPostCollections = async (knex, collectionId, postIds) => {
6
+ logging.warn(`Batch inserting ${postIds.length} collection posts for collection ${collectionId}`);
7
+
8
+ const collectionPosts = postIds.map((postId) => {
9
+ return {
10
+ id: (new ObjectID()).toHexString(),
11
+ collection_id: collectionId,
12
+ post_id: postId,
13
+ sort_order: 0
14
+ };
15
+ });
16
+
17
+ await knex.batchInsert('collections_posts', collectionPosts, 1000);
18
+ };
19
+
20
+ module.exports = createTransactionalMigration(
21
+ async function up(knex) {
22
+ logging.info('Populating built-in featured collection');
23
+
24
+ const existingFeaturedCollection = await knex('collections')
25
+ .where({
26
+ slug: 'featured'
27
+ })
28
+ .first();
29
+
30
+ if (!existingFeaturedCollection) {
31
+ logging.warn('Featured collection does not exist, skipping');
32
+ } else {
33
+ const featuredPostsRows = await knex('posts')
34
+ .select('id')
35
+ .where({
36
+ featured: true,
37
+ type: 'post'
38
+ });
39
+
40
+ const featuredPostsIds = featuredPostsRows.map(row => row.id);
41
+
42
+ await insertPostCollections(knex, existingFeaturedCollection.id, featuredPostsIds);
43
+ }
44
+ },
45
+ async function down(knex) {
46
+ logging.info('Clearing collections_posts table');
47
+ await knex('collections_posts').truncate();
48
+ }
49
+ );
@@ -975,20 +975,6 @@
975
975
  "coming-soon": ["News"]
976
976
  }
977
977
  },
978
- {
979
- "from": {
980
- "model": "Collection",
981
- "match": "slug",
982
- "relation": "posts"
983
- },
984
- "to": {
985
- "model": "Post",
986
- "match": "slug"
987
- },
988
- "entries": {
989
- "latest": ["coming-soon"]
990
- }
991
- },
992
978
  {
993
979
  "from": {
994
980
  "model": "User",
@@ -8,6 +8,7 @@ let nodes;
8
8
  let lexicalHtmlRenderer;
9
9
  let urlTransformMap;
10
10
  let postsService;
11
+ let serializePosts;
11
12
 
12
13
  function populateNodes() {
13
14
  const {DEFAULT_NODES} = require('@tryghost/kg-default-nodes');
@@ -33,17 +34,35 @@ module.exports = {
33
34
  const getPostServiceInstance = require('../services/posts/posts-service');
34
35
  postsService = getPostServiceInstance();
35
36
  }
37
+ if (!serializePosts) {
38
+ serializePosts = require('../api/endpoints/utils/serializers/output/posts').all;
39
+ }
36
40
 
37
41
  const getCollectionPosts = async (collectionSlug, postCount) => {
42
+ const frame = {
43
+ options: {
44
+ columns: ['url','excerpt','reading_time']
45
+ },
46
+ original: {
47
+ context: {
48
+ member: {
49
+ status: 'paid'
50
+ }
51
+ }
52
+ },
53
+ apiType: 'content',
54
+ response: {}
55
+ };
56
+
38
57
  const transacting = userOptions.transacting;
39
- const {data} = await postsService.browsePosts({
58
+ const response = await postsService.browsePosts({
40
59
  context: {public: true}, // mimic Content API request
41
60
  collection: collectionSlug,
42
61
  limit: postCount,
43
62
  transacting
44
63
  });
45
- let posts = data.map(p => p.toJSON());
46
- return posts;
64
+ await serializePosts(response, null, frame);
65
+ return frame.response.posts;
47
66
  };
48
67
 
49
68
  const options = Object.assign({
@@ -46,6 +46,15 @@ async function errorIfInvalidUrl(options) {
46
46
  }
47
47
  }
48
48
 
49
+ async function disableRetries(options) {
50
+ // Force disable retries
51
+ options.retry = {
52
+ limit: 0,
53
+ calculateDelay: () => 0
54
+ };
55
+ options.timeout = 5000;
56
+ }
57
+
49
58
  // same as our normal request lib but if any request in a redirect chain resolves
50
59
  // to a private IP address it will be blocked before the request is made.
51
60
  const gotOpts = {
@@ -54,13 +63,10 @@ const gotOpts = {
54
63
  },
55
64
  timeout: 10000, // default is no timeout
56
65
  hooks: {
66
+ init: process.env.NODE_ENV?.startsWith('test') ? [disableRetries] : [],
57
67
  beforeRequest: [errorIfInvalidUrl, errorIfHostnameResolvesToPrivateIp],
58
68
  beforeRedirect: [errorIfHostnameResolvesToPrivateIp]
59
69
  }
60
70
  };
61
71
 
62
- if (process.env.NODE_ENV?.startsWith('test')) {
63
- gotOpts.retry = 0;
64
- }
65
-
66
72
  module.exports = got.extend(gotOpts);