ghost 5.46.0 → 5.47.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.
- package/components/tryghost-adapter-cache-memory-ttl-5.47.0.tgz +0 -0
- package/components/tryghost-adapter-cache-redis-5.47.0.tgz +0 -0
- package/components/tryghost-adapter-manager-5.47.0.tgz +0 -0
- package/components/{tryghost-announcement-bar-settings-5.46.0.tgz → tryghost-announcement-bar-settings-5.47.0.tgz} +0 -0
- package/components/{tryghost-api-framework-5.46.0.tgz → tryghost-api-framework-5.47.0.tgz} +0 -0
- package/components/tryghost-api-version-compatibility-service-5.47.0.tgz +0 -0
- package/components/{tryghost-audience-feedback-5.46.0.tgz → tryghost-audience-feedback-5.47.0.tgz} +0 -0
- package/components/tryghost-bootstrap-socket-5.47.0.tgz +0 -0
- package/components/{tryghost-constants-5.46.0.tgz → tryghost-constants-5.47.0.tgz} +0 -0
- package/components/tryghost-custom-theme-settings-service-5.47.0.tgz +0 -0
- package/components/tryghost-data-generator-5.47.0.tgz +0 -0
- package/components/tryghost-domain-events-5.47.0.tgz +0 -0
- package/components/tryghost-dynamic-routing-events-5.47.0.tgz +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-5.47.0.tgz +0 -0
- package/components/{tryghost-email-analytics-service-5.46.0.tgz → tryghost-email-analytics-service-5.47.0.tgz} +0 -0
- package/components/tryghost-email-content-generator-5.47.0.tgz +0 -0
- package/components/tryghost-email-events-5.47.0.tgz +0 -0
- package/components/{tryghost-email-service-5.46.0.tgz → tryghost-email-service-5.47.0.tgz} +0 -0
- package/components/{tryghost-email-suppression-list-5.46.0.tgz → tryghost-email-suppression-list-5.47.0.tgz} +0 -0
- package/components/{tryghost-event-aware-cache-wrapper-5.46.0.tgz → tryghost-event-aware-cache-wrapper-5.47.0.tgz} +0 -0
- package/components/{tryghost-express-dynamic-redirects-5.46.0.tgz → tryghost-express-dynamic-redirects-5.47.0.tgz} +0 -0
- package/components/tryghost-external-media-inliner-5.47.0.tgz +0 -0
- package/components/tryghost-extract-api-key-5.47.0.tgz +0 -0
- package/components/{tryghost-html-to-plaintext-5.46.0.tgz → tryghost-html-to-plaintext-5.47.0.tgz} +0 -0
- package/components/tryghost-i18n-5.47.0.tgz +0 -0
- package/components/tryghost-importer-handler-content-files-5.47.0.tgz +0 -0
- package/components/tryghost-importer-revue-5.47.0.tgz +0 -0
- package/components/tryghost-job-manager-5.47.0.tgz +0 -0
- package/components/tryghost-link-redirects-5.47.0.tgz +0 -0
- package/components/{tryghost-link-replacer-5.46.0.tgz → tryghost-link-replacer-5.47.0.tgz} +0 -0
- package/components/{tryghost-link-tracking-5.46.0.tgz → tryghost-link-tracking-5.47.0.tgz} +0 -0
- package/components/{tryghost-magic-link-5.46.0.tgz → tryghost-magic-link-5.47.0.tgz} +0 -0
- package/components/tryghost-mailgun-client-5.47.0.tgz +0 -0
- package/components/{tryghost-member-attribution-5.46.0.tgz → tryghost-member-attribution-5.47.0.tgz} +0 -0
- package/components/tryghost-member-events-5.47.0.tgz +0 -0
- package/components/tryghost-members-api-5.47.0.tgz +0 -0
- package/components/tryghost-members-csv-5.47.0.tgz +0 -0
- package/components/{tryghost-members-events-service-5.46.0.tgz → tryghost-members-events-service-5.47.0.tgz} +0 -0
- package/components/tryghost-members-importer-5.47.0.tgz +0 -0
- package/components/{tryghost-members-offers-5.46.0.tgz → tryghost-members-offers-5.47.0.tgz} +0 -0
- package/components/tryghost-members-payments-5.47.0.tgz +0 -0
- package/components/{tryghost-members-ssr-5.46.0.tgz → tryghost-members-ssr-5.47.0.tgz} +0 -0
- package/components/tryghost-members-stripe-service-5.47.0.tgz +0 -0
- package/components/{tryghost-mentions-email-report-5.46.0.tgz → tryghost-mentions-email-report-5.47.0.tgz} +0 -0
- package/components/tryghost-milestones-5.47.0.tgz +0 -0
- package/components/tryghost-minifier-5.47.0.tgz +0 -0
- package/components/tryghost-mw-api-version-mismatch-5.47.0.tgz +0 -0
- package/components/{tryghost-mw-cache-control-5.46.0.tgz → tryghost-mw-cache-control-5.47.0.tgz} +0 -0
- package/components/tryghost-mw-error-handler-5.47.0.tgz +0 -0
- package/components/{tryghost-mw-session-from-token-5.46.0.tgz → tryghost-mw-session-from-token-5.47.0.tgz} +0 -0
- package/components/tryghost-mw-update-user-last-seen-5.47.0.tgz +0 -0
- package/components/tryghost-mw-version-match-5.47.0.tgz +0 -0
- package/components/tryghost-mw-vhost-5.47.0.tgz +0 -0
- package/components/tryghost-oembed-service-5.47.0.tgz +0 -0
- package/components/tryghost-package-json-5.47.0.tgz +0 -0
- package/components/tryghost-post-revisions-5.47.0.tgz +0 -0
- package/components/tryghost-posts-service-5.47.0.tgz +0 -0
- package/components/tryghost-referrers-5.47.0.tgz +0 -0
- package/components/{tryghost-security-5.46.0.tgz → tryghost-security-5.47.0.tgz} +0 -0
- package/components/tryghost-session-service-5.47.0.tgz +0 -0
- package/components/tryghost-settings-path-manager-5.47.0.tgz +0 -0
- package/components/{tryghost-slack-notifications-5.46.0.tgz → tryghost-slack-notifications-5.47.0.tgz} +0 -0
- package/components/{tryghost-staff-service-5.46.0.tgz → tryghost-staff-service-5.47.0.tgz} +0 -0
- package/components/{tryghost-stats-service-5.46.0.tgz → tryghost-stats-service-5.47.0.tgz} +0 -0
- package/components/tryghost-tiers-5.47.0.tgz +0 -0
- package/components/{tryghost-update-check-service-5.46.0.tgz → tryghost-update-check-service-5.47.0.tgz} +0 -0
- package/components/tryghost-verification-trigger-5.47.0.tgz +0 -0
- package/components/{tryghost-version-notifications-data-service-5.46.0.tgz → tryghost-version-notifications-data-service-5.47.0.tgz} +0 -0
- package/components/{tryghost-webmentions-5.46.0.tgz → tryghost-webmentions-5.47.0.tgz} +0 -0
- package/core/built/admin/assets/{chunk.143.eb5b2f48c7cdf62400d4.js → chunk.143.75a36ae8bf1b94136477.js} +5 -5
- package/core/built/admin/assets/{chunk.178.2d0be6bf932cdb53766e.js → chunk.178.17fa23714a161c31e38c.js} +4 -4
- package/core/built/admin/assets/{chunk.604.e25172fcbbcc8ddcbdec.js → chunk.604.078e94b787281bfcb588.js} +4110 -4415
- package/core/built/admin/assets/{ghost-2e3d55ca4212a50f87aba88c26b55945.js → ghost-96fca705b542a53a85d10e656a39065d.js} +393 -443
- package/core/built/admin/assets/{ghost-dark-4948d897bf814756a3870ef564ba6a6d.css → ghost-dark-164c6b54da62c0988a3411d458c9a4a5.css} +1 -1
- package/core/built/admin/assets/{ghost-c3187d2bb18193c111d376a110c8c80d.css → ghost-ecce94abc3cc85a5281d047aa07403e6.css} +1 -1
- package/core/built/admin/assets/{vendor-e3de790ee48087482d42c1686d5fefd9.js → vendor-39356907c39237f12c305e1d3ca46c85.js} +11 -11
- package/core/built/admin/index.html +6 -6
- package/core/frontend/public/ghost.min.css +1 -1
- package/core/server/api/endpoints/authors-public.js +22 -2
- package/core/server/api/endpoints/pages-public.js +22 -2
- package/core/server/api/endpoints/posts-public.js +22 -2
- package/core/server/api/endpoints/utils/serializers/output/members.js +1 -4
- package/core/server/models/base/plugins/actions.js +104 -29
- package/core/server/models/base/plugins/bulk-operations.js +28 -7
- package/core/server/models/post.js +20 -6
- package/core/server/services/members/utils.js +1 -3
- package/core/server/services/oembed/twitter-embed.js +1 -1
- package/core/server/services/users.js +1 -1
- package/core/server/web/members/app.js +1 -1
- package/core/shared/config/defaults.json +1 -1
- package/core/shared/labs.js +0 -3
- package/package.json +142 -141
- package/yarn.lock +535 -363
- package/components/tryghost-adapter-cache-memory-ttl-5.46.0.tgz +0 -0
- package/components/tryghost-adapter-cache-redis-5.46.0.tgz +0 -0
- package/components/tryghost-adapter-manager-5.46.0.tgz +0 -0
- package/components/tryghost-api-version-compatibility-service-5.46.0.tgz +0 -0
- package/components/tryghost-bootstrap-socket-5.46.0.tgz +0 -0
- package/components/tryghost-custom-theme-settings-service-5.46.0.tgz +0 -0
- package/components/tryghost-data-generator-5.46.0.tgz +0 -0
- package/components/tryghost-domain-events-5.46.0.tgz +0 -0
- package/components/tryghost-dynamic-routing-events-5.46.0.tgz +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-5.46.0.tgz +0 -0
- package/components/tryghost-email-content-generator-5.46.0.tgz +0 -0
- package/components/tryghost-email-events-5.46.0.tgz +0 -0
- package/components/tryghost-external-media-inliner-5.46.0.tgz +0 -0
- package/components/tryghost-extract-api-key-5.46.0.tgz +0 -0
- package/components/tryghost-i18n-5.46.0.tgz +0 -0
- package/components/tryghost-importer-handler-content-files-5.46.0.tgz +0 -0
- package/components/tryghost-importer-revue-5.46.0.tgz +0 -0
- package/components/tryghost-job-manager-5.46.0.tgz +0 -0
- package/components/tryghost-link-redirects-5.46.0.tgz +0 -0
- package/components/tryghost-mailgun-client-5.46.0.tgz +0 -0
- package/components/tryghost-member-events-5.46.0.tgz +0 -0
- package/components/tryghost-members-api-5.46.0.tgz +0 -0
- package/components/tryghost-members-csv-5.46.0.tgz +0 -0
- package/components/tryghost-members-importer-5.46.0.tgz +0 -0
- package/components/tryghost-members-payments-5.46.0.tgz +0 -0
- package/components/tryghost-members-stripe-service-5.46.0.tgz +0 -0
- package/components/tryghost-milestones-5.46.0.tgz +0 -0
- package/components/tryghost-minifier-5.46.0.tgz +0 -0
- package/components/tryghost-mw-api-version-mismatch-5.46.0.tgz +0 -0
- package/components/tryghost-mw-error-handler-5.46.0.tgz +0 -0
- package/components/tryghost-mw-update-user-last-seen-5.46.0.tgz +0 -0
- package/components/tryghost-mw-version-match-5.46.0.tgz +0 -0
- package/components/tryghost-mw-vhost-5.46.0.tgz +0 -0
- package/components/tryghost-oembed-service-5.46.0.tgz +0 -0
- package/components/tryghost-package-json-5.46.0.tgz +0 -0
- package/components/tryghost-post-revisions-5.46.0.tgz +0 -0
- package/components/tryghost-posts-service-5.46.0.tgz +0 -0
- package/components/tryghost-referrers-5.46.0.tgz +0 -0
- package/components/tryghost-session-service-5.46.0.tgz +0 -0
- package/components/tryghost-settings-path-manager-5.46.0.tgz +0 -0
- package/components/tryghost-tiers-5.46.0.tgz +0 -0
- package/components/tryghost-verification-trigger-5.46.0.tgz +0 -0
- /package/core/built/admin/assets/{chunk.604.e25172fcbbcc8ddcbdec.js.LICENSE.txt → chunk.604.078e94b787281bfcb588.js.LICENSE.txt} +0 -0
|
@@ -12411,25 +12411,25 @@ Object.keys(t).forEach((r=>{e.registerKeyCommand({str:r,run:()=>t[r](e,r)})})),t
|
|
|
12411
12411
|
Ember.set(r,e,t),n(r,!1)}_enter(e){this.isEditing&&("meta"===e||"ctrl"===e&&t.default.isWin())&&this.editCard()}_placeCursorAtEnd(){if(!this._textReplacementEditor)return
|
|
12412
12412
|
let e=this._textReplacementEditor.post.tailPosition().toRange()
|
|
12413
12413
|
this._textReplacementEditor.selectRange(e)}},d(u.prototype,"isEmpty",[n],Object.getOwnPropertyDescriptor(u.prototype,"isEmpty"),u.prototype),d(u.prototype,"formattedHtml",[i],Object.getOwnPropertyDescriptor(u.prototype,"formattedHtml"),u.prototype),d(u.prototype,"toolbar",[o],Object.getOwnPropertyDescriptor(u.prototype,"toolbar"),u.prototype),d(u.prototype,"updateHtml",[a],Object.getOwnPropertyDescriptor(u.prototype,"updateHtml"),u.prototype),d(u.prototype,"registerEditor",[s],Object.getOwnPropertyDescriptor(u.prototype,"registerEditor"),u.prototype),d(u.prototype,"leaveEditMode",[l],Object.getOwnPropertyDescriptor(u.prototype,"leaveEditMode"),u.prototype),u)
|
|
12414
|
-
e.default=p,Ember._setComponentTemplate(h,p)})),define("koenig-editor/components/koenig-card-embed",["exports","koenig-editor/components/koenig-editor","@tryghost/helpers","ember-concurrency"],(function(e,t,r,n){"use strict"
|
|
12415
|
-
var
|
|
12416
|
-
function
|
|
12414
|
+
e.default=p,Ember._setComponentTemplate(h,p)})),define("koenig-editor/components/koenig-card-embed",["exports","koenig-editor/components/koenig-editor","@tryghost/helpers","ember-ajax/errors","ember-concurrency"],(function(e,t,r,n,i){"use strict"
|
|
12415
|
+
var o,a,s,l,u,c,d,h,p,f,m,g,v,b,y,_
|
|
12416
|
+
function k(e,t,r,n){r&&Object.defineProperty(e,t,{enumerable:r.enumerable,configurable:r.configurable,writable:r.writable,value:r.initializer?r.initializer.call(n):void 0})}function E(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e
|
|
12417
12417
|
var r=e[Symbol.toPrimitive]
|
|
12418
12418
|
if(void 0!==r){var n=r.call(e,t||"default")
|
|
12419
12419
|
if("object"!=typeof n)return n
|
|
12420
12420
|
throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string")
|
|
12421
|
-
return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function
|
|
12421
|
+
return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(e,t,r,n,i){var o={}
|
|
12422
12422
|
return Object.keys(n).forEach((function(e){o[e]=n[e]})),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=r.slice().reverse().reduce((function(r,n){return n(e,t,r)||r}),o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(e,t,o),o=null),o}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
12423
|
-
const
|
|
12424
|
-
let
|
|
12423
|
+
const x=Ember.HTMLBars.template({id:"Y21xPSLE",block:'{"symbols":["card"],"statements":[[8,"koenig-card",[],[["@class","@isSelected","@isEditing","@selectCard","@deselectCard","@onDeselect","@editCard","@saveAsSnippet","@toolbar","@hasEditMode","@showSelectedOutline","@addParagraphAfterCard","@moveCursorToPrevSection","@moveCursorToNextSection","@editor"],["flex flex-column",[32,0,["isSelected"]],[32,0,["isEditing"]],[30,[36,0],[[32,0],[32,0,["selectCard"]]],null],[30,[36,0],[[32,0],[32,0,["deselectCard"]]],null],[30,[36,0],[[32,0],"onDeselect"],null],[30,[36,0],[[32,0],[32,0,["editCard"]]],null],[30,[36,2],[[32,0,["payload","type"]],[32,0,["saveAsSnippet"]]],null],[32,0,["toolbar"]],false,[32,0,["payload","type"]],[32,0,["addParagraphAfterCard"]],[32,0,["moveCursorToPrevSection"]],[32,0,["moveCursorToNextSection"]],[32,0,["editor"]]]],[["default"],[{"statements":[[2,"\\n"],[6,[37,2],[[32,0,["payload","type"]]],null,[["default","else"],[{"statements":[[2," "],[10,"div"],[14,0,"kg-card-hover"],[12],[2,"\\n "],[10,"div"],[15,0,[31,["koenig-embed-",[32,0,["payload","type"]]," flex justify-center relative"]]],[14,"data-kg-embed",""],[12],[2,"\\n"],[6,[37,2],[[30,[36,3],[[32,0,["payload","type"]],"nft"],null]],null,[["default","else"],[{"statements":[[2," "],[8,"koenig-card-embed/nft",[],[["@payload"],[[32,0,["payload"]]]],null],[2,"\\n"]],"parameters":[]},{"statements":[[2," "],[10,"iframe"],[14,0,"bn miw-100"],[14,"scrolling","no"],[12],[13],[2,"\\n"]],"parameters":[]}]]],[2," "],[10,"div"],[14,0,"koenig-card-click-overlay ba b--transparent"],[14,"data-kg-overlay",""],[12],[13],[2,"\\n "],[13],[2,"\\n\\n"],[6,[37,2],[[30,[36,5],[[32,0,["isSelected"]],[30,[36,4],[[32,0,["payload","caption"]]],null]],null]],null,[["default"],[{"statements":[[2," "],[8,[32,1,["CaptionInput"]],[],[["@caption","@update","@placeholder"],[[32,0,["payload","caption"]],[30,[36,0],[[32,0],"updateCaption"],null],"Type caption for embed (optional)"]],null],[2,"\\n"]],"parameters":[]}]]],[2," "],[13],[2,"\\n"]],"parameters":[]},{"statements":[[6,[37,2],[[32,0,["convertUrl","isRunning"]]],null,[["default","else"],[{"statements":[[2," "],[10,"div"],[14,0,"miw-100 pa2 ba br2 b--lightgrey-d1 flex items-center justify-center bg-whitegrey-l2 f6 lh-title h10"],[12],[2,"\\n "],[10,"div"],[14,0,"ghost-spinner spinner-blue"],[12],[13],[2," \\n "],[13],[2,"\\n"]],"parameters":[]},{"statements":[[6,[37,2],[[32,0,["isUnauthorized"]]],null,[["default","else"],[{"statements":[[2," "],[10,"div"],[14,0,"miw-100 flex flex-row pa2 pl3 ba br2 b--red-l3 red bg-error-red f7 fw4 lh-title h10 items-center"],[12],[2,"\\n "],[10,"span"],[14,0,"mr3"],[12],[2,"The owner of this URL has disabled embedding."],[13],[2,"\\n "],[11,"button"],[24,0,"red-d2 mr3 fw6 hover-red"],[24,4,"button"],[4,[38,0],[[32,0],"retry"],null],[12],[10,"span"],[14,0,"underline"],[12],[2,"Retry"],[13],[13],[2,"\\n "],[11,"button"],[24,0,"red-d2 mr-auto fw6 underline hover-red"],[24,4,"button"],[4,[38,0],[[32,0],"insertAsLink"],null],[12],[10,"span"],[14,0,"underline"],[12],[2,"Paste URL as link"],[13],[13],[2,"\\n "],[11,"button"],[24,0,"nudge-right--2"],[24,4,"button"],[4,[38,0],[[32,0],[32,0,["deleteCard"]]],null],[12],[2,"\\n "],[1,[30,[36,1],["close"],[["class"],["w3 stroke-red-l3"]]]],[2,"\\n "],[13],[2,"\\n "],[13],[2,"\\n"]],"parameters":[]},{"statements":[[6,[37,2],[[32,0,["hasError"]]],null,[["default","else"],[{"statements":[[2," "],[10,"div"],[14,0,"miw-100 flex flex-row pa2 pl3 ba br2 b--red-l3 red bg-error-red f7 fw4 lh-title h10 items-center"],[12],[2,"\\n "],[10,"span"],[14,0,"mr3"],[12],[2,"There was an error when parsing the URL."],[13],[2,"\\n "],[11,"button"],[24,0,"red-d2 mr3 fw6 hover-red"],[24,4,"button"],[4,[38,0],[[32,0],"retry"],null],[12],[10,"span"],[14,0,"underline"],[12],[2,"Retry"],[13],[13],[2,"\\n "],[11,"button"],[24,0,"red-d2 mr-auto fw6 underline hover-red"],[24,4,"button"],[4,[38,0],[[32,0],"insertAsLink"],null],[12],[10,"span"],[14,0,"underline"],[12],[2,"Paste URL as link"],[13],[13],[2,"\\n "],[11,"button"],[24,0,"nudge-right--2"],[24,4,"button"],[4,[38,0],[[32,0],[32,0,["deleteCard"]]],null],[12],[2,"\\n "],[1,[30,[36,1],["close"],[["class"],["w3 stroke-red-l3"]]]],[2,"\\n "],[13],[2,"\\n "],[13],[2,"\\n"]],"parameters":[]},{"statements":[[2," "],[10,"input"],[15,2,[32,0,["payload","url"]]],[14,3,"url"],[14,"placeholder","Paste URL to add embedded content..."],[14,0,"miw-100 pa2 ba br2 b--lightgrey-d2 f7 form-text lh-title tracked-2 h10 nl2 nr2"],[15,"oninput",[30,[36,0],[[32,0],"updateUrl"],null]],[15,"onkeydown",[30,[36,0],[[32,0],"urlKeydown"],null]],[14,4,"text"],[12],[13],[2,"\\n "]],"parameters":[]}]]]],"parameters":[]}]]]],"parameters":[]}]]]],"parameters":[]}]]]],"parameters":[1]}]]],[2,"\\n"]],"hasEval":false,"upvars":["action","svg-jar","if","eq","clean-basic-html","or"]}',moduleName:"koenig-editor/components/koenig-card-embed.hbs"}),{countWords:O}=r.utils
|
|
12424
|
+
let C=(o=Ember.inject.service,a=Ember.inject.service,s=Ember.computed("payload.html"),l=Ember.computed("payload.{html,caption}"),u=Ember._action,c=Ember._action,d=Ember._action,h=Ember._action,p=Ember._action,f=Ember._action,m=Ember._action,g=(0,i.task)((function*(e){if(Ember.isBlank(e))this.deleteCard()
|
|
12425
12425
|
else try{let t=this.ghostPaths.url.api("oembed"),r={url:e}
|
|
12426
12426
|
this.payload.isDirectUrl||(r.type="embed")
|
|
12427
12427
|
let n=yield this.ajax.request(t,{data:r})
|
|
12428
12428
|
if("bookmark"===n.type)return void this.send("insertAsBookmark",n)
|
|
12429
12429
|
if(!n.html&&"nft"!==n.type)throw"No HTML returned"
|
|
12430
12430
|
Ember.set(this.payload,"linkOnError",void 0),Ember.set(this.payload,"isDirectUrl",void 0),Ember.set(this.payload,"html",n.html),delete n.html,Ember.set(this.payload,"type",n.type),delete n.type,Ember.set(this.payload,"metadata",n),this.saveCard(this.payload,!1),Ember.run.schedule("afterRender",this,this._populateIframe)}catch(t){if(this.payload.linkOnError)return void this.send("insertAsLink",{linkOnError:!0})
|
|
12431
|
-
this.set("hasError",!0)}})).drop(),
|
|
12432
|
-
Ember.set(this.payload,"url",t)}urlKeydown(e){"Enter"===e.key&&(e.preventDefault(),this.convertUrl.perform(this.payload.url)),"Escape"===e.key&&(e.target.blur(),this.deleteCard())}updateCaption(e){Ember.set(this.payload,"caption",e),this.saveCard(this.payload,!1)}retry(){this.set("hasError",!1)}insertAsLink(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{linkOnError:!1},{range:t}=this.editor
|
|
12431
|
+
this.set("hasError",!0),(0,n.isUnauthorizedError)(t)&&this.set("isUnauthorized",!0)}})).drop(),v=class extends Ember.Component{constructor(){super(...arguments),k(this,"ajax",b,this),k(this,"ghostPaths",y,this),E(this,"payload",null),E(this,"isSelected",!1),E(this,"isEditing",!1),E(this,"hasError",!1),E(this,"isUnauthorized",!1),k(this,"convertUrl",_,this)}selectCard(){}deselectCard(){}editCard(){}saveCard(){}deleteCard(){}moveCursorToNextSection(){}moveCursorToPrevSection(){}addParagraphAfterCard(){}registerComponent(){}get isEmpty(){return Ember.isBlank(this.payload.html)&&"nft"!==this.payload.type}get counts(){return{imageCount:this.payload.html?1:0,wordCount:O(this.payload.caption)}}init(){super.init(...arguments),this.payload.url&&!this.payload.html&&this.convertUrl.perform(this.payload.url),this.registerComponent(this)}didInsertElement(){super.didInsertElement(...arguments),this._populateIframe(),this._focusInput()}willDestroyElement(){super.willDestroyElement(...arguments),Ember.run.cancel(this._resizeDebounce),this._iframeMutationObserver&&this._iframeMutationObserver.disconnect(),window.removeEventListener("resize",this._windowResizeHandler)}onDeselect(){!this.payload.url||this.payload.html||this.hasError?!this.isEmpty||this.convertUrl.isRunning||this.hasError||this.deleteCard(t.NO_CURSOR_MOVEMENT):this.convertUrl.perform(this.payload.url)}updateUrl(e){let t=e.target.value
|
|
12432
|
+
Ember.set(this.payload,"url",t)}urlKeydown(e){"Enter"===e.key&&(e.preventDefault(),this.convertUrl.perform(this.payload.url)),"Escape"===e.key&&(e.target.blur(),this.deleteCard())}updateCaption(e){Ember.set(this.payload,"caption",e),this.saveCard(this.payload,!1)}retry(){this.set("hasError",!1),this.set("isUnauthorized",!1)}insertAsLink(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{linkOnError:!1},{range:t}=this.editor
|
|
12433
12433
|
this.editor.run((r=>{let{builder:n}=r,i=this.env.postModel,o=n.createMarkupSection("p"),a=n.createMarkup("a",{href:this.payload.url})
|
|
12434
12434
|
r.replaceSection(i,o),r.insertTextWithMarkup(o.toRange().head,this.payload.url,[a]),t.headSection!==i&&r.setRange(t),e.linkOnError&&r.cancelSnapshot()}))}insertAsBookmark(e){let{range:t}=this.editor
|
|
12435
12435
|
this.editor.run((r=>{let n=this.env.postModel,i=r.builder.createCardSection("bookmark",e)
|
|
@@ -12445,8 +12445,8 @@ if("IFRAME"===t.tagName){if(-1===t.getAttribute("width").indexOf("%")){const r=p
|
|
|
12445
12445
|
if(r&&n){const i=r/n,o=e.offsetWidth/i
|
|
12446
12446
|
return t.style.height=`${o}px`,void(e.style.height=`${o}px`)}}if(-1===t.getAttribute("height").indexOf("%")){const r=parseInt(t.getAttribute("height"))
|
|
12447
12447
|
return void(e.style.height=`${r}px`)}}const r=e.contentDocument.scrollingElement.scrollHeight
|
|
12448
|
-
e.style.height=`${r}px`}_setupWindowResizeHandler(e){window.removeEventListener("resize",this._windowResizeHandler),this._windowResizeHandler=Ember.run.bind(this,this._resizeIframe,e),window.addEventListener("resize",this._windowResizeHandler,{passive:!0})}},
|
|
12449
|
-
e.default=
|
|
12448
|
+
e.style.height=`${r}px`}_setupWindowResizeHandler(e){window.removeEventListener("resize",this._windowResizeHandler),this._windowResizeHandler=Ember.run.bind(this,this._resizeIframe,e),window.addEventListener("resize",this._windowResizeHandler,{passive:!0})}},b=w(v.prototype,"ajax",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),y=w(v.prototype,"ghostPaths",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),w(v.prototype,"isEmpty",[s],Object.getOwnPropertyDescriptor(v.prototype,"isEmpty"),v.prototype),w(v.prototype,"counts",[l],Object.getOwnPropertyDescriptor(v.prototype,"counts"),v.prototype),w(v.prototype,"onDeselect",[u],Object.getOwnPropertyDescriptor(v.prototype,"onDeselect"),v.prototype),w(v.prototype,"updateUrl",[c],Object.getOwnPropertyDescriptor(v.prototype,"updateUrl"),v.prototype),w(v.prototype,"urlKeydown",[d],Object.getOwnPropertyDescriptor(v.prototype,"urlKeydown"),v.prototype),w(v.prototype,"updateCaption",[h],Object.getOwnPropertyDescriptor(v.prototype,"updateCaption"),v.prototype),w(v.prototype,"retry",[p],Object.getOwnPropertyDescriptor(v.prototype,"retry"),v.prototype),w(v.prototype,"insertAsLink",[f],Object.getOwnPropertyDescriptor(v.prototype,"insertAsLink"),v.prototype),w(v.prototype,"insertAsBookmark",[m],Object.getOwnPropertyDescriptor(v.prototype,"insertAsBookmark"),v.prototype),_=w(v.prototype,"convertUrl",[g],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),v)
|
|
12449
|
+
e.default=C,Ember._setComponentTemplate(x,C)})),define("koenig-editor/components/koenig-card-embed/nft",["exports"],(function(e){"use strict"
|
|
12450
12450
|
function t(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e
|
|
12451
12451
|
var r=e[Symbol.toPrimitive]
|
|
12452
12452
|
if(void 0!==r){var n=r.call(e,t||"default")
|
|
@@ -14082,4 +14082,4 @@ return void 0===n&&(n=(0,t.createStorage)(null,(()=>!1)),r.set(e,n)),n}dirtyStor
|
|
|
14082
14082
|
r&&(0,t.setValue)(r,null)}constructor(e){o(this,"storages",new WeakMap),o(this,"vals",void 0),this.vals=new WeakSet(e)}has(e){return(0,t.getValue)(this.storageFor(e)),this.vals.has(e)}add(e){return this.vals.add(e),this.dirtyStorageFor(e),this}delete(e){return this.dirtyStorageFor(e),this.vals.delete(e)}get[i](){return this.vals[Symbol.toStringTag]}}e.TrackedWeakSet=s,Object.setPrototypeOf(s.prototype,WeakSet.prototype)})),define("tracked-built-ins/index",["exports","tracked-built-ins/-private/decorator","tracked-built-ins/-private/array","tracked-built-ins/-private/object","tracked-built-ins/-private/map","tracked-built-ins/-private/set"],(function(e,t,r,n,i,o){"use strict"
|
|
14083
14083
|
Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"TrackedArray",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"TrackedMap",{enumerable:!0,get:function(){return i.TrackedMap}}),Object.defineProperty(e,"TrackedObject",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"TrackedSet",{enumerable:!0,get:function(){return o.TrackedSet}}),Object.defineProperty(e,"TrackedWeakMap",{enumerable:!0,get:function(){return i.TrackedWeakMap}}),Object.defineProperty(e,"TrackedWeakSet",{enumerable:!0,get:function(){return o.TrackedWeakSet}}),Object.defineProperty(e,"tracked",{enumerable:!0,get:function(){return t.default}})}))
|
|
14084
14084
|
|
|
14085
|
-
//# sourceMappingURL=vendor-
|
|
14085
|
+
//# sourceMappingURL=vendor-39356907c39237f12c305e1d3ca46c85.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%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.
|
|
11
|
+
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%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.47%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-
|
|
40
|
+
<link integrity="" rel="stylesheet" href="assets/ghost-ecce94abc3cc85a5281d047aa07403e6.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-
|
|
60
|
-
<script src="assets/chunk.604.
|
|
61
|
-
<script src="assets/chunk.143.
|
|
62
|
-
<script src="assets/ghost-
|
|
59
|
+
<script src="assets/vendor-39356907c39237f12c305e1d3ca46c85.js"></script>
|
|
60
|
+
<script src="assets/chunk.604.078e94b787281bfcb588.js"></script>
|
|
61
|
+
<script src="assets/chunk.143.75a36ae8bf1b94136477.js"></script>
|
|
62
|
+
<script src="assets/ghost-96fca705b542a53a85d10e656a39065d.js"></script>
|
|
63
63
|
</body>
|
|
64
64
|
</html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100
|
|
1
|
+
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}.black{color:#15171a}.darkgrey{color:#394047}.midgrey{color:#7c8b9a}.lightgrey{color:#ced4d9}.blue{color:#14b8ff}.red{color:#f50b23}.orange{color:#ffb41f}.green{color:#30cf43}.darkgrey-hover:hover{color:#394047}.midgrey-hover:hover{color:#7c8b9a}.lightgrey-hover:hover{color:#ced4d9}.blue-hover:hover{color:#14b8ff}.red-hover:hover{color:#f50b23}.orange-hover:hover{color:#ffb41f}.green-hover:hover{color:#30cf43}*,:after,:before{box-sizing:border-box}html{overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:62.5%;line-height:1.65;letter-spacing:.2px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body,html{width:100%;height:100%}body{overflow:auto;overflow-x:hidden;color:#343f44;font-size:1.4rem}.gh-view{-ms-flex-positive:1;flex-grow:1;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}h1,h2{margin:0 0 .3em;color:#343f44;line-height:1.15em;text-rendering:optimizeLegibility;text-indent:-1px;font-size:2.9rem}@media (max-width:500px){h1{font-size:2.4rem}}.gh-input{display:block;padding:10px 12px;width:100%;height:40px;border:1px solid #d6e3eb;border-radius:4px;color:#4b5b62;font-size:1.6rem;line-height:1em;font-weight:300;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;transition:border-color .15s linear;-webkit-appearance:none}.gh-input:focus{outline:0;border-color:#b4cbda}.gh-btn{display:inline-block;outline:none;border:1px solid #d6e3eb;color:#829aa8;text-decoration:none!important;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;fill:#829aa8;border-radius:5px;transition:all .2s ease;-webkit-font-smoothing:subpixel-antialiased}.gh-btn span{display:block;padding:0 12px;height:33px;font-size:1.3rem;line-height:33px;font-weight:400;text-align:center;letter-spacing:.2px;border-radius:4px}.gh-btn:hover{border-color:#b4cbda}.gh-btn-hover-blue:hover{border-color:#3eb0ef;color:#3eb0ef}.gh-btn-blue{padding:1px;border:0;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.1);fill:#fff;background:linear-gradient(#3da1d6,#2288bf);box-shadow:0 1px 0 rgba(0,0,0,.12);transition:none!important}.gh-btn-blue span{background:linear-gradient(#4ab6f0,#2fa5e4 60%,#2fa5e4 90%,#38a9e5);box-shadow:inset 0 1px 0 hsla(0,0%,100%,.1)}.gh-btn-blue:active,.gh-btn-blue:focus{background:#1e78a9}.gh-btn-blue:active span,.gh-btn-blue:focus span{background:#29a0e0;box-shadow:none}.gh-btn-block{display:block;width:100%}.gh-input-icon{position:relative;display:block}.gh-input-icon svg{position:absolute;top:50%;left:10px;z-index:2;height:14px;width:auto;fill:color(var(--midgrey) l(15%));transform:translateY(-7px)}.gh-input-icon input{padding-left:35px}.gh-app{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:hidden;height:100%}.gh-viewport{overflow:hidden;max-height:100%}.gh-main,.gh-viewport{-ms-flex-positive:1;flex-grow:1;display:-ms-flexbox;display:flex}.gh-main{position:relative;background:#fff;overflow-y:auto}.gh-flow{overflow-y:auto;min-height:100%;background:linear-gradient(315deg,#efefef,#fff)}.gh-flow,.gh-flow-content-wrap{flex-grow:1;display:flex;flex-direction:column}.gh-flow-content-wrap{flex-shrink:0;justify-content:center;align-items:center;margin:0 24px;padding-bottom:8vh}.gh-flow-content-wrap .site-icon{width:70px;height:70px;border-radius:3px}.gh-flow-content{display:flex;flex-direction:column;max-width:520px;width:100%;margin:4rem 0 6rem;padding:40px;background:#fff;color:var(--darkgrey);font-size:1.9rem;line-height:1.5em;font-weight:300;border-radius:3px;box-shadow:0 2.8px 2.2px rgba(0,0,0,.02),0 6.7px 5.3px rgba(0,0,0,.02),0 12.5px 10px rgba(0,0,0,.02),0 22.3px 17.9px rgba(0,0,0,.03),0 41.8px 33.4px rgba(0,0,0,.03),0 100px 80px rgba(0,0,0,.05)}.gh-flow-content.unsubscribe{align-items:center;justify-content:center;max-width:560px;min-height:200px;margin:4rem 0;text-align:center}@media (max-width:500px){.gh-flow-content{padding:0;background:transparent;box-shadow:none}}.gh-flow-content header{display:flex;flex-direction:column;align-items:center}.gh-flow-content h1{margin-bottom:24px;color:#15171a;font-size:4.1rem;font-weight:700;line-height:1.15em}.gh-flow-content.unsubscribe h1{font-size:3.2rem}@media (max-width:600px){.gh-flow-content.unsubscribe h1,.gh-flow-content h1{font-size:6vw}}.gh-flow-content.unsubscribe p{margin:0 0 .4em;color:#394047;font-size:1.8rem}@media (max-width:500px){.gh-flow-content.unsubscribe p{font-size:1.6rem;line-height:1.5}}.gh-flow-content .gh-btn{display:block;margin:20px auto 0;max-width:400px}.gh-flow-content .form-group{position:relative;margin-bottom:2.5rem}.gh-flow-content .form-group.error .gh-input{border-color:#f50b23;box-shadow:0 0 0 3px rgba(239,24,24,.15)}.gh-flow-content .main-error{position:absolute;right:0;margin:0;color:#7c8b9a;font-size:1.35rem;font-weight:400;text-align:center;user-select:text}.gh-flow-em{font-weight:500}.unsubscribe-footer{text-align:center;font-size:1.5rem}@media (max-width:500px){.unsubscribe-footer{padding:0 24px;font-size:1.4rem;line-height:1.4em}}.unsubscribe-footer p{color:#7c8b9a;margin:0 0 .4rem}.unsubscribe-footer a{color:#15171a;text-decoration:none}.unsubscribe-footer a:hover{text-decoration:underline}.gh-signin{margin-bottom:1.5rem}.gh-signin .gh-input,.gh-signin .gh-input:-webkit-autofill:first-line{height:54px;padding:12px 16px;font-size:1.8rem;border-radius:8px}.gh-signin .gh-input::placeholder{color:#abb4be;font-weight:400;opacity:1}.gh-signin .gh-input::-webkit-input-placeholder{color:#abb4be;font-weight:400}.gh-signin .gh-input:-ms-input-placeholder{color:#abb4be;font-weight:400}.gh-signin .gh-input::-moz-placeholder{color:#abb4be;font-weight:400;opacity:1}.gh-signin .gh-input:focus{border-color:#30cf43;box-shadow:0 0 0 3px rgba(26,170,96,.15)}.gh-signin .gh-btn{margin:0;width:100%;height:54px;max-width:unset;margin-top:32px;background:#15171a;font-weight:300;line-height:54px;border-radius:8px;transition:all .4s ease;-webkit-font-smoothing:subpixel-antialiased}.gh-signin .gh-btn span{color:#fff;font-size:1.8rem}.error-content{flex-grow:1;justify-content:center;user-select:text;padding:8vw}.error-content,.error-details{display:flex;align-items:center}.error-details{margin-bottom:4rem}.error-ghost{margin:15px;height:115px}@media (max-width:630px){.error-ghost{display:none}}.error-code{margin:0;color:#c5d2d9;font-size:10vw;font-weight:600;line-height:.9em;letter-spacing:-.4vw}.error-description{margin:0;padding:0;border:none;color:#54666d;font-size:2.3rem;font-weight:300;line-height:1.3em}.error-message{display:flex;flex-direction:column;margin:15px;align-items:center}.error-message a{font-size:1.4rem;line-height:1;margin:8px 0}.error-link{background-color:transparent;color:#5ba4e5;transition:background .3s,color .3s;text-decoration:none}.error-stack{margin:1rem auto;padding:2rem;max-width:800px;background-color:hsla(0,0%,100%,.3)}.error-stack-list{margin:0;padding:0;list-style-type:none}.error-stack-list li{display:block}.error-stack-list li:before{content:"\21AA";display:inline-block;margin-right:.5rem;color:#bbb;font-size:1.2rem}.error-stack-function{font-weight:700}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const Promise = require('bluebird');
|
|
2
2
|
const tpl = require('@tryghost/tpl');
|
|
3
3
|
const errors = require('@tryghost/errors');
|
|
4
|
+
const {mapQuery} = require('@tryghost/mongo-utils');
|
|
4
5
|
const models = require('../../models');
|
|
5
6
|
const ALLOWED_INCLUDES = ['count.posts'];
|
|
6
7
|
|
|
@@ -8,6 +9,17 @@ const messages = {
|
|
|
8
9
|
notFound: 'Author not found.'
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const rejectPrivateFieldsTransformer = input => mapQuery(input, function (value, key) {
|
|
13
|
+
const lowerCaseKey = key.toLowerCase();
|
|
14
|
+
if (lowerCaseKey.startsWith('password') || lowerCaseKey.startsWith('email')) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
[key]: value
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
|
|
11
23
|
module.exports = {
|
|
12
24
|
docName: 'authors',
|
|
13
25
|
|
|
@@ -29,7 +41,11 @@ module.exports = {
|
|
|
29
41
|
},
|
|
30
42
|
permissions: true,
|
|
31
43
|
query(frame) {
|
|
32
|
-
|
|
44
|
+
const options = {
|
|
45
|
+
...frame.options,
|
|
46
|
+
mongoTransformer: rejectPrivateFieldsTransformer
|
|
47
|
+
};
|
|
48
|
+
return models.Author.findPage(options);
|
|
33
49
|
}
|
|
34
50
|
},
|
|
35
51
|
|
|
@@ -54,7 +70,11 @@ module.exports = {
|
|
|
54
70
|
},
|
|
55
71
|
permissions: true,
|
|
56
72
|
query(frame) {
|
|
57
|
-
|
|
73
|
+
const options = {
|
|
74
|
+
...frame.options,
|
|
75
|
+
mongoTransformer: rejectPrivateFieldsTransformer
|
|
76
|
+
};
|
|
77
|
+
return models.Author.findOne(frame.data, options)
|
|
58
78
|
.then((model) => {
|
|
59
79
|
if (!model) {
|
|
60
80
|
return Promise.reject(new errors.NotFoundError({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const tpl = require('@tryghost/tpl');
|
|
2
2
|
const errors = require('@tryghost/errors');
|
|
3
|
+
const {mapQuery} = require('@tryghost/mongo-utils');
|
|
3
4
|
const models = require('../../models');
|
|
4
5
|
|
|
5
6
|
const ALLOWED_INCLUDES = ['tags', 'authors', 'tiers'];
|
|
@@ -8,6 +9,17 @@ const messages = {
|
|
|
8
9
|
pageNotFound: 'Page not found.'
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const rejectPrivateFieldsTransformer = input => mapQuery(input, function (value, key) {
|
|
13
|
+
let lowerCaseKey = key.toLowerCase();
|
|
14
|
+
if (lowerCaseKey.startsWith('authors.password') || lowerCaseKey.startsWith('authors.email')) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
[key]: value
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
|
|
11
23
|
module.exports = {
|
|
12
24
|
docName: 'pages',
|
|
13
25
|
|
|
@@ -35,7 +47,11 @@ module.exports = {
|
|
|
35
47
|
},
|
|
36
48
|
permissions: true,
|
|
37
49
|
query(frame) {
|
|
38
|
-
|
|
50
|
+
const options = {
|
|
51
|
+
...frame.options,
|
|
52
|
+
mongoTransformer: rejectPrivateFieldsTransformer
|
|
53
|
+
};
|
|
54
|
+
return models.Post.findPage(options);
|
|
39
55
|
}
|
|
40
56
|
},
|
|
41
57
|
|
|
@@ -64,7 +80,11 @@ module.exports = {
|
|
|
64
80
|
},
|
|
65
81
|
permissions: true,
|
|
66
82
|
query(frame) {
|
|
67
|
-
|
|
83
|
+
const options = {
|
|
84
|
+
...frame.options,
|
|
85
|
+
mongoTransformer: rejectPrivateFieldsTransformer
|
|
86
|
+
};
|
|
87
|
+
return models.Post.findOne(frame.data, options)
|
|
68
88
|
.then((model) => {
|
|
69
89
|
if (!model) {
|
|
70
90
|
throw new errors.NotFoundError({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const models = require('../../models');
|
|
2
2
|
const tpl = require('@tryghost/tpl');
|
|
3
3
|
const errors = require('@tryghost/errors');
|
|
4
|
+
const {mapQuery} = require('@tryghost/mongo-utils');
|
|
4
5
|
const postsPublicService = require('../../services/posts-public');
|
|
5
6
|
|
|
6
7
|
const allowedIncludes = ['tags', 'authors', 'tiers', 'sentiment'];
|
|
@@ -9,6 +10,17 @@ const messages = {
|
|
|
9
10
|
postNotFound: 'Post not found.'
|
|
10
11
|
};
|
|
11
12
|
|
|
13
|
+
const rejectPrivateFieldsTransformer = input => mapQuery(input, function (value, key) {
|
|
14
|
+
const lowerCaseKey = key.toLowerCase();
|
|
15
|
+
if (lowerCaseKey.startsWith('authors.password') || lowerCaseKey.startsWith('authors.email')) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
[key]: value
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
12
24
|
module.exports = {
|
|
13
25
|
docName: 'posts',
|
|
14
26
|
|
|
@@ -37,7 +49,11 @@ module.exports = {
|
|
|
37
49
|
},
|
|
38
50
|
permissions: true,
|
|
39
51
|
query(frame) {
|
|
40
|
-
|
|
52
|
+
const options = {
|
|
53
|
+
...frame.options,
|
|
54
|
+
mongoTransformer: rejectPrivateFieldsTransformer
|
|
55
|
+
};
|
|
56
|
+
return models.Post.findPage(options);
|
|
41
57
|
}
|
|
42
58
|
},
|
|
43
59
|
|
|
@@ -66,7 +82,11 @@ module.exports = {
|
|
|
66
82
|
},
|
|
67
83
|
permissions: true,
|
|
68
84
|
query(frame) {
|
|
69
|
-
|
|
85
|
+
const options = {
|
|
86
|
+
...frame.options,
|
|
87
|
+
mongoTransformer: rejectPrivateFieldsTransformer
|
|
88
|
+
};
|
|
89
|
+
return models.Post.findOne(frame.data, options)
|
|
70
90
|
.then((model) => {
|
|
71
91
|
if (!model) {
|
|
72
92
|
throw new errors.NotFoundError({
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:members');
|
|
3
3
|
const {unparse} = require('@tryghost/members-csv');
|
|
4
4
|
const mappers = require('./mappers');
|
|
5
|
-
const labs = require('../../../../../../shared/labs');
|
|
6
5
|
|
|
7
6
|
module.exports = {
|
|
8
7
|
browse: createSerializer('browse', paginatedMembers),
|
|
@@ -172,9 +171,7 @@ function serializeMember(member, options) {
|
|
|
172
171
|
delete subscription.price.product;
|
|
173
172
|
}
|
|
174
173
|
|
|
175
|
-
|
|
176
|
-
serialized.email_suppression = json.email_suppression;
|
|
177
|
-
}
|
|
174
|
+
serialized.email_suppression = json.email_suppression;
|
|
178
175
|
|
|
179
176
|
if (json.newsletters) {
|
|
180
177
|
serialized.newsletters = json.newsletters
|
|
@@ -6,6 +6,54 @@ const logging = require('@tryghost/logging');
|
|
|
6
6
|
* @param {import('bookshelf')} Bookshelf
|
|
7
7
|
*/
|
|
8
8
|
module.exports = function (Bookshelf) {
|
|
9
|
+
const insertAction = (data, options) => {
|
|
10
|
+
// CASE: model does not support action for target event
|
|
11
|
+
if (!data) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const insert = (action) => {
|
|
16
|
+
Bookshelf.model('Action')
|
|
17
|
+
.add(action, {autoRefresh: false})
|
|
18
|
+
.catch((err) => {
|
|
19
|
+
if (_.isArray(err)) {
|
|
20
|
+
err = err[0];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
logging.error(new errors.InternalServerError({
|
|
24
|
+
err
|
|
25
|
+
}));
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (options.transacting) {
|
|
30
|
+
options.transacting.once('committed', (committed) => {
|
|
31
|
+
if (!committed) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
insert(data);
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
insert(data);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// We need this addAction accessible from the static model and instances
|
|
43
|
+
const addAction = (model, event, options) => {
|
|
44
|
+
if (!model.wasChanged()) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// CASE: model does not support actions at all
|
|
49
|
+
if (!model.getAction) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const data = model.getAction(event, options);
|
|
54
|
+
insertAction(data, options);
|
|
55
|
+
};
|
|
56
|
+
|
|
9
57
|
Bookshelf.Model = Bookshelf.Model.extend({
|
|
10
58
|
/**
|
|
11
59
|
* Constructs data to be stored in the database with info
|
|
@@ -33,7 +81,9 @@ module.exports = function (Bookshelf) {
|
|
|
33
81
|
return;
|
|
34
82
|
}
|
|
35
83
|
|
|
36
|
-
let context = {
|
|
84
|
+
let context = {
|
|
85
|
+
action_name: options.actionName
|
|
86
|
+
};
|
|
37
87
|
|
|
38
88
|
if (this.actionsExtraContext && Array.isArray(this.actionsExtraContext)) {
|
|
39
89
|
for (const c of this.actionsExtraContext) {
|
|
@@ -74,48 +124,73 @@ module.exports = function (Bookshelf) {
|
|
|
74
124
|
*
|
|
75
125
|
* We could embed adding actions more nicely in the future e.g. plugin.
|
|
76
126
|
*/
|
|
77
|
-
addAction
|
|
78
|
-
|
|
127
|
+
addAction
|
|
128
|
+
}, {
|
|
129
|
+
addAction,
|
|
130
|
+
async addActions(event, ids, options) {
|
|
131
|
+
if (ids.length === 1) {
|
|
132
|
+
// We want to store an event for a single model in the actions table
|
|
133
|
+
// This is so we can include the name
|
|
134
|
+
const model = await this.findOne({[options.column ?? 'id']: ids[0]}, {require: true, transacting: options.transacting, context: {internal: true}});
|
|
135
|
+
this.addAction(model, event, options);
|
|
79
136
|
return;
|
|
80
137
|
}
|
|
81
138
|
|
|
82
|
-
|
|
83
|
-
|
|
139
|
+
const existingAction = this.getBulkAction(event, ids.length, options);
|
|
140
|
+
insertAction(existingAction, options);
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Constructs data to be stored in the database with info
|
|
145
|
+
* on particular actions
|
|
146
|
+
*/
|
|
147
|
+
getBulkAction(event, count, options) {
|
|
148
|
+
const actor = this.prototype.getActor(options);
|
|
149
|
+
|
|
150
|
+
// @NOTE: we ignore internal updates (`options.context.internal`) for now
|
|
151
|
+
if (!actor) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (!this.prototype.actionsCollectCRUD) {
|
|
84
156
|
return;
|
|
85
157
|
}
|
|
86
158
|
|
|
87
|
-
|
|
159
|
+
let resourceType = this.prototype.actionsResourceType;
|
|
160
|
+
|
|
161
|
+
if (typeof resourceType === 'function') {
|
|
162
|
+
resourceType = resourceType.bind(this)();
|
|
163
|
+
}
|
|
88
164
|
|
|
89
|
-
|
|
90
|
-
if (!existingAction) {
|
|
165
|
+
if (!resourceType) {
|
|
91
166
|
return;
|
|
92
167
|
}
|
|
93
168
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
.catch((err) => {
|
|
98
|
-
if (_.isArray(err)) {
|
|
99
|
-
err = err[0];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
logging.error(new errors.InternalServerError({
|
|
103
|
-
err
|
|
104
|
-
}));
|
|
105
|
-
});
|
|
169
|
+
let context = {
|
|
170
|
+
count,
|
|
171
|
+
action_name: options.actionName
|
|
106
172
|
};
|
|
107
173
|
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
174
|
+
if (this.getBulkActionExtraContext && typeof this.getBulkActionExtraContext === 'function') {
|
|
175
|
+
context = {
|
|
176
|
+
...context,
|
|
177
|
+
...this.getBulkActionExtraContext.bind(this)(options)
|
|
178
|
+
};
|
|
179
|
+
}
|
|
113
180
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
181
|
+
const data = {
|
|
182
|
+
event,
|
|
183
|
+
resource_id: null,
|
|
184
|
+
resource_type: resourceType,
|
|
185
|
+
actor_id: actor.id,
|
|
186
|
+
actor_type: actor.type
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
if (context && Object.keys(context).length) {
|
|
190
|
+
data.context = context;
|
|
118
191
|
}
|
|
192
|
+
|
|
193
|
+
return data;
|
|
119
194
|
}
|
|
120
195
|
});
|
|
121
196
|
};
|
|
@@ -60,7 +60,7 @@ async function editSingle(knex, table, id, options) {
|
|
|
60
60
|
if (options.transacting) {
|
|
61
61
|
k = k.transacting(options.transacting);
|
|
62
62
|
}
|
|
63
|
-
await k.where('id', id).update(options.data);
|
|
63
|
+
await k.where(options.column ?? 'id', id).update(options.data);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
async function editMultiple(knex, table, chunk, options) {
|
|
@@ -68,7 +68,7 @@ async function editMultiple(knex, table, chunk, options) {
|
|
|
68
68
|
if (options.transacting) {
|
|
69
69
|
k = k.transacting(options.transacting);
|
|
70
70
|
}
|
|
71
|
-
await k.whereIn('id', chunk).update(options.data);
|
|
71
|
+
await k.whereIn(options.column ?? 'id', chunk).update(options.data);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
async function delSingle(knex, table, id, options) {
|
|
@@ -112,23 +112,44 @@ module.exports = function (Bookshelf) {
|
|
|
112
112
|
return insert(Bookshelf.knex, tableName, data, options);
|
|
113
113
|
},
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
/**
|
|
116
|
+
*
|
|
117
|
+
* @param {*} ids
|
|
118
|
+
* @param {*} tableName
|
|
119
|
+
* @param {object} options
|
|
120
|
+
* @param {object} [options.data] Data change you want to apply to the rows
|
|
121
|
+
* @param {string} [options.column] Update the rows where this column equals the ids (defaults to 'id')
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
bulkEdit: async function bulkEdit(ids, tableName, options = {}) {
|
|
116
125
|
tableName = tableName || this.prototype.tableName;
|
|
117
126
|
|
|
118
|
-
|
|
127
|
+
const result = await edit(Bookshelf.knex, tableName, ids, options);
|
|
128
|
+
|
|
129
|
+
if (result.successful > 0 && tableName === this.prototype.tableName) {
|
|
130
|
+
await this.addActions('edited', ids, options);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return result;
|
|
119
134
|
},
|
|
120
135
|
|
|
121
136
|
/**
|
|
122
137
|
*
|
|
123
|
-
* @param {string[]}
|
|
138
|
+
* @param {string[]} ids List of ids to delete
|
|
124
139
|
* @param {*} tableName
|
|
125
140
|
* @param {Object} [options]
|
|
126
141
|
* @param {string} [options.column] Delete the rows where this column equals the ids in `data` (defaults to 'id')
|
|
127
142
|
* @returns
|
|
128
143
|
*/
|
|
129
|
-
bulkDestroy: async function bulkDestroy(
|
|
144
|
+
bulkDestroy: async function bulkDestroy(ids, tableName, options = {}) {
|
|
130
145
|
tableName = tableName || this.prototype.tableName;
|
|
131
|
-
|
|
146
|
+
|
|
147
|
+
if (tableName === this.prototype.tableName) {
|
|
148
|
+
// Needs to happen before, otherwise we cannot fetch the names of the deleted items
|
|
149
|
+
await this.addActions('deleted', ids, options);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return await del(Bookshelf.knex, tableName, ids, options);
|
|
132
153
|
}
|
|
133
154
|
});
|
|
134
155
|
};
|