From d5baa8b8487cbff9dae00f69bd19a45cac5647a8 Mon Sep 17 00:00:00 2001 From: Yannick Reekmans Date: Wed, 3 Nov 2021 09:23:43 +0000 Subject: [PATCH] Add v3.42.7 --- ...t.min-c2286c1da1671730ae28b70205449d2f.js} | 59 +++++++++++-------- core/server/api/canary/config.js | 3 +- core/server/api/v3/config.js | 3 +- core/server/web/admin/controller.js | 11 ++++ core/server/web/admin/views/default-prod.html | 2 +- core/server/web/admin/views/default.html | 2 +- package.json | 2 +- 7 files changed, 53 insertions(+), 29 deletions(-) rename core/built/assets/{ghost.min-fc6277154fa6217cd103de2019eb4352.js => ghost.min-c2286c1da1671730ae28b70205449d2f.js} (99%) diff --git a/core/built/assets/ghost.min-fc6277154fa6217cd103de2019eb4352.js b/core/built/assets/ghost.min-c2286c1da1671730ae28b70205449d2f.js similarity index 99% rename from core/built/assets/ghost.min-fc6277154fa6217cd103de2019eb4352.js rename to core/built/assets/ghost.min-c2286c1da1671730ae28b70205449d2f.js index 821db5e349..4eac0b8d8b 100644 --- a/core/built/assets/ghost.min-fc6277154fa6217cd103de2019eb4352.js +++ b/core/built/assets/ghost.min-c2286c1da1671730ae28b70205449d2f.js @@ -90,10 +90,17 @@ super(...arguments),e=this,t="dropdown",s=this,(n=a)&&Object.defineProperty(e,t, var l,d,u,m,c,p,h=Ember._setComponentTemplate(i,o) e.default=h})),define("ghost-admin/components/gh-billing-iframe",["exports"],(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 const t=Ember.HTMLBars.template({id:"cEwCQjwt",block:'{"symbols":[],"statements":[[10,"iframe"],[14,1,"billing-frame"],[14,0,"billing-frame"],[14,"frameborder","0"],[12],[13]],"hasEval":false,"upvars":[]}',meta:{moduleName:"ghost-admin/components/gh-billing-iframe.hbs"}}) -var n=Ember._setComponentTemplate(t,Ember.Component.extend({billing:Ember.inject.service(),config:Ember.inject.service(),ghostPaths:Ember.inject.service(),ajax:Ember.inject.service(),didInsertElement(){let e=!1 +var n=Ember._setComponentTemplate(t,Ember.Component.extend({billing:Ember.inject.service(),config:Ember.inject.service(),ghostPaths:Ember.inject.service(),ajax:Ember.inject.service(),notifications:Ember.inject.service(),isOwner:null,didInsertElement(){this._super(...arguments) +let e=!1 this.billing.getBillingIframe().src=this.billing.getIframeURL(),window.addEventListener("message",(t=>{let n if(t&&t.data&&"token"===t.data.request){const t=this.get("ghostPaths.url").api("identities") -this.ajax.request(t).then((e=>{n=e&&e.identities&&e.identities[0]&&e.identities[0].token,this.billing.getBillingIframe().contentWindow.postMessage({request:"token",response:n},"*")})),e||this.billing.get("subscription")||!n||(e=!0,this.billing.getBillingIframe().contentWindow.postMessage({query:"getSubscription",response:"subscription"},"*"))}t&&t.data&&t.data.subscription&&this.billing.set("subscription",t.data.subscription)}))}})) +this.ajax.request(t).then((e=>{n=e&&e.identities&&e.identities[0]&&e.identities[0].token,this.billing.getBillingIframe().contentWindow.postMessage({request:"token",response:n},"*"),this.set("isOwner",!0)})).catch((e=>{var t,n +if(null===(t=e.payload)||void 0===t||!t.errors||"NoPermissionError"!==(null===(n=e.payload.errors[0])||void 0===n?void 0:n.type))throw e +this.set("isOwner",!1),this.billing.getBillingIframe().contentWindow.postMessage({request:"token",response:null},"*")})),e||this.billing.get("subscription")||!n||(e=!0,this.billing.getBillingIframe().contentWindow.postMessage({query:"getSubscription",response:"subscription"},"*"))}if(t&&t.data&&"forceUpgradeInfo"===t.data.request){let e=null +const t=this.billing.get("ownerUser") +t&&(e={name:t.get("name"),email:t.get("email")}),this.billing.getBillingIframe().contentWindow.postMessage({request:"forceUpgradeInfo",response:{forceUpgrade:this.config.get("forceUpgrade"),isOwner:this.get("isOwner"),ownerUser:e}},"*")}var s,a,r,i,o +if(t&&t.data&&t.data.subscription)if(this.billing.set("subscription",t.data.subscription),this.billing.set("checkoutRoute",(null===(s=t.data)||void 0===s?void 0:s.checkoutRoute)||"/plans"),"active"===t.data.subscription.status&&this.config.get("forceUpgrade")&&this.config.set("forceUpgrade",!1),"past_due"===t.data.subscription.status||"unpaid"===t.data.subscription.status?this.notifications.showAlert("Billing error: This site is queued for suspension. The owner of this site must update payment information.",{type:"error",key:"billing.overdue"}):this.notifications.closeAlerts("billing.overdue"),null!==(a=t.data)&&void 0!==a&&a.exceededLimits&&null!==(r=t.data)&&void 0!==r&&r.exceededLimits.length&&(null===(i=t.data)||void 0===i?void 0:i.exceededLimits.indexOf("members"))>=0&&null!==(o=t.data)&&void 0!==o&&o.checkoutRoute){const e=this.billing.get("billingRouteRoot")+"?action=checkout" +this.notifications.showAlert(Ember.String.htmlSafe(`Your audience has grown! To continue publishing, the site owner must confirm pricing for this number of members here`),{type:"warn",key:"billing.exceeded"})}else this.notifications.closeAlerts("billing.exceeded")}))}})) e.default=n})),define("ghost-admin/components/gh-billing-modal",["exports"],(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 const t=Ember.HTMLBars.template({id:"UTF+FkW9",block:'{"symbols":[],"statements":[[10,"div"],[15,0,[31,[[32,0,["visibilityClass"]]]]],[12],[2,"\\n "],[10,"div"],[14,0,"gh-billing-container"],[12],[2,"\\n\\n "],[8,"gh-billing-iframe",[],[[],[]],[["default"],[{"statements":[],"parameters":[]}]]],[2,"\\n "],[13],[2,"\\n"],[13]],"hasEval":false,"upvars":[]}',meta:{moduleName:"ghost-admin/components/gh-billing-modal.hbs"}}) var n=Ember._setComponentTemplate(t,Ember.Component.extend({billing:Ember.inject.service(),visibilityClass:Ember.computed("billing.billingWindowOpen",(function(){return this.billing.get("billingWindowOpen")?"gh-billing":"gh-billing closed"})),didInsertElement(){this._super(...arguments),this._setupShortcuts()},willDestroyElement(){this._super(...arguments),this._removeShortcuts()},_setupShortcuts(){Ember.run((function(){document.activeElement.blur()})),this._previousKeymasterScope=key.getScope(),key("enter","modal",(()=>{this.send("confirm")})),key.setScope("modal")},_removeShortcuts(){key.unbind("enter","modal"),key.setScope(this._previousKeymasterScope)}})) @@ -676,8 +683,8 @@ return this.get("clock.second"),e?(0,t.default)().tz(e).format("HH:mm:ss"):(0,t. e.default=s})),define("ghost-admin/components/gh-token-input",["exports","ghost-admin/utils/computed-fallback-if-undefined","ember-power-select/utils/group-utils","@ember-decorators/component","ember-concurrency"],(function(e,t,n,s,a){var r,i,o,l,d,u,m,c,p,h,g,f,b,v,y,w,E,_,k,x,P,j,T,M,S,O,C,A function D(e,t,n,s){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(s):void 0})}function I(e,t,n,s,a){var r={} return Object.keys(s).forEach((function(e){r[e]=s[e]})),r.enumerable=!!r.enumerable,r.configurable=!!r.configurable,("value"in r||r.initializer)&&(r.writable=!0),r=n.slice().reverse().reduce((function(n,s){return s(e,t,n)||n}),r),a&&void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(a):void 0,r.initializer=void 0),void 0===r.initializer&&(Object.defineProperty(e,t,r),r=null),r}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 -const N=Ember.HTMLBars.template({id:"DRFngbBr",block:'{"symbols":["option","@class","@triggerRole","@ariaDescribedBy","@ariaInvalid","@ariaLabel","@ariaLabelledBy","@afterOptionsComponent","@allowClear","@beforeOptionsComponent","@buildSelection","@calculatePosition","@destination","@disabled","@dropdownClass","@extra","@groupComponent","@horizontalPosition","@initiallyOpened","@loadingMessage","@matchTriggerWidth","@noMatchesMessage","@onClose","@onInput","@onOpen","@placeholder","@placeholderComponent","@preventScroll","@registerAPI","@renderInPlace","@required","@scrollTo","@searchMessage","@searchPlaceholder","@selected","@selectedItemComponent","@eventType","@title","@triggerClass","@triggerId","@verticalPosition","@tabindex"],"statements":[[8,"gh-token-input/select-multiple",[[16,0,[30,[36,1],["gh-token-input ",[32,2]],null]]],[["@triggerRole","@ariaDescribedBy","@ariaInvalid","@ariaLabel","@ariaLabelledBy","@afterOptionsComponent","@allowClear","@beforeOptionsComponent","@buildSelection","@calculatePosition","@closeOnSelect","@defaultHighlighted","@destination","@disabled","@dropdownClass","@extra","@groupComponent","@horizontalPosition","@initiallyOpened","@loadingMessage","@matcher","@matchTriggerWidth","@noMatchesMessage","@onBlur","@onChange","@onClose","@onFocus","@onInput","@onKeydown","@onOpen","@options","@optionsComponent","@placeholder","@placeholderComponent","@preventScroll","@registerAPI","@renderInPlace","@required","@scrollTo","@search","@searchEnabled","@searchField","@searchMessage","@searchPlaceholder","@selected","@selectedItemComponent","@eventType","@title","@triggerClass","@triggerComponent","@triggerId","@verticalPosition","@tabindex"],[[32,3],[32,4],[32,5],[32,6],[32,7],[32,8],[32,9],[32,10],[32,11],[32,12],[32,0,["closeOnSelect"]],[32,0,["defaultHighlighted"]],[32,13],[32,14],[32,15],[32,16],[32,17],[32,18],[32,19],[32,20],[32,0,["matcher"]],[32,21],[32,22],[32,0,["handleBlur"]],[32,0,["selectOrCreate"]],[32,23],[32,0,["handleFocus"]],[32,24],[32,0,["handleKeydown"]],[32,25],[32,0,["optionsWithoutSelected"]],[32,0,["optionsComponent"]],[32,26],[32,27],[32,28],[32,29],[32,30],[32,31],[32,32],[32,0,["searchAndSuggest"]],true,[32,0,["searchField"]],[32,33],[32,34],[32,35],[32,36],[32,37],[32,38],[32,39],[32,0,["triggerComponent"]],[32,40],[32,41],[32,42]]],[["default"],[{"statements":[[2,"\\n"],[6,[37,2],[[32,1,["__isSuggestion__"]]],null,[["default","else"],[{"statements":[[2," "],[8,"gh-token-input/suggested-option",[],[["@option"],[[32,1]]],null],[2,"\\n"]],"parameters":[]},{"statements":[[2," "],[1,[30,[36,0],[[32,1],[32,0,["labelField"]]],null]],[2,"\\n"]],"parameters":[]}]]]],"parameters":[1]}]]]],"hasEval":false,"upvars":["get","concat","if"]}',meta:{moduleName:"ghost-admin/components/gh-token-input.hbs"}}),{Handlebars:U}=Ember -let z=(r=(0,s.tagName)(""),i=(0,t.default)(!0),o=(0,t.default)(!1),l=(0,t.default)("name"),d=(0,t.default)(n.defaultMatcher),u=(0,t.default)("name"),m=(0,t.default)("gh-token-input/trigger"),c=(0,t.default)("power-select-vertical-collection-options"),p=Ember.computed("options.[]","selected.[]"),h=Ember._action,g=Ember._action,f=Ember._action,b=Ember._action,v=Ember._action,y=(0,a.task)((function*(){let e=yield this.options,t=yield this.selected +const U=Ember.HTMLBars.template({id:"DRFngbBr",block:'{"symbols":["option","@class","@triggerRole","@ariaDescribedBy","@ariaInvalid","@ariaLabel","@ariaLabelledBy","@afterOptionsComponent","@allowClear","@beforeOptionsComponent","@buildSelection","@calculatePosition","@destination","@disabled","@dropdownClass","@extra","@groupComponent","@horizontalPosition","@initiallyOpened","@loadingMessage","@matchTriggerWidth","@noMatchesMessage","@onClose","@onInput","@onOpen","@placeholder","@placeholderComponent","@preventScroll","@registerAPI","@renderInPlace","@required","@scrollTo","@searchMessage","@searchPlaceholder","@selected","@selectedItemComponent","@eventType","@title","@triggerClass","@triggerId","@verticalPosition","@tabindex"],"statements":[[8,"gh-token-input/select-multiple",[[16,0,[30,[36,1],["gh-token-input ",[32,2]],null]]],[["@triggerRole","@ariaDescribedBy","@ariaInvalid","@ariaLabel","@ariaLabelledBy","@afterOptionsComponent","@allowClear","@beforeOptionsComponent","@buildSelection","@calculatePosition","@closeOnSelect","@defaultHighlighted","@destination","@disabled","@dropdownClass","@extra","@groupComponent","@horizontalPosition","@initiallyOpened","@loadingMessage","@matcher","@matchTriggerWidth","@noMatchesMessage","@onBlur","@onChange","@onClose","@onFocus","@onInput","@onKeydown","@onOpen","@options","@optionsComponent","@placeholder","@placeholderComponent","@preventScroll","@registerAPI","@renderInPlace","@required","@scrollTo","@search","@searchEnabled","@searchField","@searchMessage","@searchPlaceholder","@selected","@selectedItemComponent","@eventType","@title","@triggerClass","@triggerComponent","@triggerId","@verticalPosition","@tabindex"],[[32,3],[32,4],[32,5],[32,6],[32,7],[32,8],[32,9],[32,10],[32,11],[32,12],[32,0,["closeOnSelect"]],[32,0,["defaultHighlighted"]],[32,13],[32,14],[32,15],[32,16],[32,17],[32,18],[32,19],[32,20],[32,0,["matcher"]],[32,21],[32,22],[32,0,["handleBlur"]],[32,0,["selectOrCreate"]],[32,23],[32,0,["handleFocus"]],[32,24],[32,0,["handleKeydown"]],[32,25],[32,0,["optionsWithoutSelected"]],[32,0,["optionsComponent"]],[32,26],[32,27],[32,28],[32,29],[32,30],[32,31],[32,32],[32,0,["searchAndSuggest"]],true,[32,0,["searchField"]],[32,33],[32,34],[32,35],[32,36],[32,37],[32,38],[32,39],[32,0,["triggerComponent"]],[32,40],[32,41],[32,42]]],[["default"],[{"statements":[[2,"\\n"],[6,[37,2],[[32,1,["__isSuggestion__"]]],null,[["default","else"],[{"statements":[[2," "],[8,"gh-token-input/suggested-option",[],[["@option"],[[32,1]]],null],[2,"\\n"]],"parameters":[]},{"statements":[[2," "],[1,[30,[36,0],[[32,1],[32,0,["labelField"]]],null]],[2,"\\n"]],"parameters":[]}]]]],"parameters":[1]}]]]],"hasEval":false,"upvars":["get","concat","if"]}',meta:{moduleName:"ghost-admin/components/gh-token-input.hbs"}}),{Handlebars:N}=Ember +let R=(r=(0,s.tagName)(""),i=(0,t.default)(!0),o=(0,t.default)(!1),l=(0,t.default)("name"),d=(0,t.default)(n.defaultMatcher),u=(0,t.default)("name"),m=(0,t.default)("gh-token-input/trigger"),c=(0,t.default)("power-select-vertical-collection-options"),p=Ember.computed("options.[]","selected.[]"),h=Ember._action,g=Ember._action,f=Ember._action,b=Ember._action,v=Ember._action,y=(0,a.task)((function*(){let e=yield this.options,t=yield this.selected return e.filter((e=>!t.includes(e)))})),w=(0,a.task)((function*(e,t){let n=(yield this.optionsWithoutSelected).toArray() if(0===e.length)return n let s=this.search @@ -690,9 +697,9 @@ let s=e.find((e=>e.__isSuggestion__)) s?this.onCreate(s.__value__,t):this.onChange(e,t),t.actions.search("")}defaultHighlighted(e){let{results:t}=e,s=(0,n.advanceSelectableOption)(t,void 0,1) return t.length>1&&s.__isSuggestion__&&(s=(0,n.advanceSelectableOption)(t,s,1)),s}_addCreateOption(e,t){this._shouldShowCreateOption(e,t)&&t.unshift(this._buildSuggestionForTerm(e))}_shouldShowCreateOption(e,t){return!!this.allowCreation&&(this.showCreateWhen?this.showCreateWhen(e,t):this._hideCreateOptionOnSameTerm(e,t))}_buildSuggestionForTerm(e){return{__isSuggestion__:!0,__value__:e,text:this._buildSuggestionLabel(e)}}_hideCreateOptionOnSameTerm(e,t){let n=this.searchField return!t.findBy(n,e)}_filter(e,t){let s -return s=this.searchField?(e,t)=>this.matcher(Ember.get(e,this.searchField),t):(e,t)=>this.matcher(e,t),(0,n.filterOptions)(e||[],t,s)}_buildSuggestionLabel(e){return this.buildSuggestion?this.buildSuggestion(e):Ember.String.htmlSafe(`Add "${U.Utils.escapeExpression(e)}"...`)}},k=I((_=A).prototype,"allowCreation",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),x=I(_.prototype,"closeOnSelect",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),P=I(_.prototype,"labelField",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),j=I(_.prototype,"matcher",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),T=I(_.prototype,"searchField",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),M=I(_.prototype,"triggerComponent",[m],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),S=I(_.prototype,"optionsComponent",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),I(_.prototype,"optionsWithoutSelected",[p],Object.getOwnPropertyDescriptor(_.prototype,"optionsWithoutSelected"),_.prototype),I(_.prototype,"handleKeydown",[h],Object.getOwnPropertyDescriptor(_.prototype,"handleKeydown"),_.prototype),I(_.prototype,"handleFocus",[g],Object.getOwnPropertyDescriptor(_.prototype,"handleFocus"),_.prototype),I(_.prototype,"handleBlur",[f],Object.getOwnPropertyDescriptor(_.prototype,"handleBlur"),_.prototype),I(_.prototype,"searchAndSuggest",[b],Object.getOwnPropertyDescriptor(_.prototype,"searchAndSuggest"),_.prototype),I(_.prototype,"selectOrCreate",[v],Object.getOwnPropertyDescriptor(_.prototype,"selectOrCreate"),_.prototype),O=I(_.prototype,"optionsWithoutSelectedTask",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),C=I(_.prototype,"searchAndSuggestTask",[w],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),E=_))||E) -var R=Ember._setComponentTemplate(N,z) -e.default=R})),define("ghost-admin/components/gh-token-input/label-token",["exports","ember-drag-drop/components/draggable-object"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 +return s=this.searchField?(e,t)=>this.matcher(Ember.get(e,this.searchField),t):(e,t)=>this.matcher(e,t),(0,n.filterOptions)(e||[],t,s)}_buildSuggestionLabel(e){return this.buildSuggestion?this.buildSuggestion(e):Ember.String.htmlSafe(`Add "${N.Utils.escapeExpression(e)}"...`)}},k=I((_=A).prototype,"allowCreation",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),x=I(_.prototype,"closeOnSelect",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),P=I(_.prototype,"labelField",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),j=I(_.prototype,"matcher",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),T=I(_.prototype,"searchField",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),M=I(_.prototype,"triggerComponent",[m],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),S=I(_.prototype,"optionsComponent",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),I(_.prototype,"optionsWithoutSelected",[p],Object.getOwnPropertyDescriptor(_.prototype,"optionsWithoutSelected"),_.prototype),I(_.prototype,"handleKeydown",[h],Object.getOwnPropertyDescriptor(_.prototype,"handleKeydown"),_.prototype),I(_.prototype,"handleFocus",[g],Object.getOwnPropertyDescriptor(_.prototype,"handleFocus"),_.prototype),I(_.prototype,"handleBlur",[f],Object.getOwnPropertyDescriptor(_.prototype,"handleBlur"),_.prototype),I(_.prototype,"searchAndSuggest",[b],Object.getOwnPropertyDescriptor(_.prototype,"searchAndSuggest"),_.prototype),I(_.prototype,"selectOrCreate",[v],Object.getOwnPropertyDescriptor(_.prototype,"selectOrCreate"),_.prototype),O=I(_.prototype,"optionsWithoutSelectedTask",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),C=I(_.prototype,"searchAndSuggestTask",[w],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),E=_))||E) +var z=Ember._setComponentTemplate(U,R) +e.default=z})),define("ghost-admin/components/gh-token-input/label-token",["exports","ember-drag-drop/components/draggable-object"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 const n=Ember.HTMLBars.template({id:"PKCFtPBX",block:'{"symbols":["&default"],"statements":[[18,1,null],[2,"\\n"]],"hasEval":false,"upvars":[]}',meta:{moduleName:"ghost-admin/components/gh-token-input/label-token.hbs"}}) var s=Ember._setComponentTemplate(n,t.default.extend({attributeBindings:["title"],classNames:["label-token"],title:"Label"})) e.default=s})),define("ghost-admin/components/gh-token-input/select-multiple",["exports","jquery","ember-power-select/components/power-select-multiple","@ember-decorators/component"],(function(e,t,n,s){var a,r,i,o,l,d @@ -1120,25 +1127,25 @@ var t=Ember.Controller.extend({ui:Ember.inject.service()}) e.default=t})),define("ghost-admin/controllers/error",["exports"],(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 var t=Ember.Controller.extend({stack:!1,error:Ember.computed.readOnly("model"),code:Ember.computed("error.status",(function(){return this.get("error.status")>200?this.get("error.status"):500})),message:Ember.computed("error.statusText",(function(){return 404===this.code?"Page not found":"error"!==this.get("error.statusText")?this.get("error.statusText"):"Internal Server Error"}))}) e.default=t})) -define("ghost-admin/controllers/member",["exports","ghost-admin/utils/bound-one-way","moment","ember-concurrency-decorators"],(function(e,t,n,s){var a,r,i,o,l,d,u,m,c,p,h,g,f,b,v,y,w,E,_,k,x,P,j,T,M,S,O,C,A,D,I,N -function U(e,t,n,s){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(s):void 0})}function z(e,t,n,s,a){var r={} +define("ghost-admin/controllers/member",["exports","ghost-admin/utils/bound-one-way","moment","ember-concurrency-decorators"],(function(e,t,n,s){var a,r,i,o,l,d,u,m,c,p,h,g,f,b,v,y,w,E,_,k,x,P,j,T,M,S,O,C,A,D,I,U +function N(e,t,n,s){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(s):void 0})}function R(e,t,n,s,a){var r={} return Object.keys(s).forEach((function(e){r[e]=s[e]})),r.enumerable=!!r.enumerable,r.configurable=!!r.configurable,("value"in r||r.initializer)&&(r.writable=!0),r=n.slice().reverse().reduce((function(n,s){return s(e,t,n)||n}),r),a&&void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(a):void 0,r.initializer=void 0),void 0===r.initializer&&(Object.defineProperty(e,t,r),r=null),r}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 -const R=["name","email","note"] -let L=(a=Ember.inject.controller,r=Ember.inject.service,i=Ember.inject.service,o=Ember.inject.service,l=Ember.inject.service,d=Ember.inject.service,u=Ember.inject.service,m=Ember._tracked,c=Ember._tracked,p=Ember._tracked,h=Ember._tracked,g=Ember._action,f=Ember._action,b=Ember._action,v=Ember._action,y=Ember._action,w=Ember._action,E=Ember._action,_=(0,s.task)({drop:!0}),N=class extends Ember.Controller{constructor(...e){super(...e),U(this,"members",x,this),U(this,"session",P,this),U(this,"dropdown",j,this),U(this,"membersStats",T,this),U(this,"notifications",M,this),U(this,"router",S,this),U(this,"store",O,this),U(this,"isLoading",C,this),U(this,"showDeleteMemberModal",A,this),U(this,"showImpersonateMemberModal",D,this),U(this,"showUnsavedChangesModal",I,this),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"leaveScreenTransition",null)}get member(){return this.model}set member(e){this.model=e}get scratchMember(){let e=Ember.Object.create({member:this.member}) -return R.forEach((n=>Ember.defineProperty(e,n,(0,t.default)(`member.${n}`)))),e}get subscribedAt(){let e=(0,n.default)(this.member.get("createdAtUTC")).from((0,n.default)()) +const z=["name","email","note"] +let L=(a=Ember.inject.controller,r=Ember.inject.service,i=Ember.inject.service,o=Ember.inject.service,l=Ember.inject.service,d=Ember.inject.service,u=Ember.inject.service,m=Ember._tracked,c=Ember._tracked,p=Ember._tracked,h=Ember._tracked,g=Ember._action,f=Ember._action,b=Ember._action,v=Ember._action,y=Ember._action,w=Ember._action,E=Ember._action,_=(0,s.task)({drop:!0}),U=class extends Ember.Controller{constructor(...e){super(...e),N(this,"members",x,this),N(this,"session",P,this),N(this,"dropdown",j,this),N(this,"membersStats",T,this),N(this,"notifications",M,this),N(this,"router",S,this),N(this,"store",O,this),N(this,"isLoading",C,this),N(this,"showDeleteMemberModal",A,this),N(this,"showImpersonateMemberModal",D,this),N(this,"showUnsavedChangesModal",I,this),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"leaveScreenTransition",null)}get member(){return this.model}set member(e){this.model=e}get scratchMember(){let e=Ember.Object.create({member:this.member}) +return z.forEach((n=>Ember.defineProperty(e,n,(0,t.default)(`member.${n}`)))),e}get subscribedAt(){let e=(0,n.default)(this.member.get("createdAtUTC")).from((0,n.default)()) return`${(0,n.default)(this.member.get("createdAtUTC")).format("D MMM YYYY")} (${e})`}setProperty(e,t){this._saveMemberProperty(e,t)}toggleDeleteMemberModal(){this.showDeleteMemberModal=!this.showDeleteMemberModal}toggleImpersonateMemberModal(){this.showImpersonateMemberModal=!this.showImpersonateMemberModal}save(){return this.saveTask.perform()}deleteMember(e=!1){let t={adapterOptions:{cancel:e}} return this.member.destroyRecord(t).then((()=>(this.members.refreshData(),this.transitionToRoute("members"))),(e=>this.notifications.showAPIError(e,{key:"member.delete"})))}toggleUnsavedChangesModal(e){let t=this.leaveScreenTransition if(!e&&this.showUnsavedChangesModal)return this.leaveScreenTransition=null,void(this.showUnsavedChangesModal=!1) if(!t||e.targetName===t.targetName){if(this.leaveScreenTransition=e,this.save.isRunning)return this.save.last.then((()=>{e.retry()})) -this.showUnsavedChangesModal=!0}}leaveScreen(){return this.member.rollbackAttributes(),this.leaveScreenTransition.retry()}*saveTask(){let{member:e,scratchMember:t}=this,n=t.getProperties(R) +this.showUnsavedChangesModal=!0}}leaveScreen(){return this.member.rollbackAttributes(),this.leaveScreenTransition.retry()}*saveTask(){let{member:e,scratchMember:t}=this,n=t.getProperties(z) e.setProperties(n) try{return yield e.save(),e.updateLabels(),this.members.refreshData(),this.replaceRoute("member",e),e}catch(s){s&&this.notifications.showAPIError(s,{key:"member.save"})}}*fetchMemberTask(e){this.isLoading=!0,this.member=yield this.store.findRecord("member",e,{reload:!0}),this.isLoading=!1}_saveMemberProperty(e,t){let n=this.member.get(e) -t&&(t=t.trim()),(!1===t||t||n)&&this.member.set(e,t)}},x=z((k=N).prototype,"members",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),P=z(k.prototype,"session",[r],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),j=z(k.prototype,"dropdown",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),T=z(k.prototype,"membersStats",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),M=z(k.prototype,"notifications",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),S=z(k.prototype,"router",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),O=z(k.prototype,"store",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),C=z(k.prototype,"isLoading",[m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),A=z(k.prototype,"showDeleteMemberModal",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),D=z(k.prototype,"showImpersonateMemberModal",[p],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),I=z(k.prototype,"showUnsavedChangesModal",[h],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),z(k.prototype,"setProperty",[g],Object.getOwnPropertyDescriptor(k.prototype,"setProperty"),k.prototype),z(k.prototype,"toggleDeleteMemberModal",[f],Object.getOwnPropertyDescriptor(k.prototype,"toggleDeleteMemberModal"),k.prototype),z(k.prototype,"toggleImpersonateMemberModal",[b],Object.getOwnPropertyDescriptor(k.prototype,"toggleImpersonateMemberModal"),k.prototype),z(k.prototype,"save",[v],Object.getOwnPropertyDescriptor(k.prototype,"save"),k.prototype),z(k.prototype,"deleteMember",[y],Object.getOwnPropertyDescriptor(k.prototype,"deleteMember"),k.prototype),z(k.prototype,"toggleUnsavedChangesModal",[w],Object.getOwnPropertyDescriptor(k.prototype,"toggleUnsavedChangesModal"),k.prototype),z(k.prototype,"leaveScreen",[E],Object.getOwnPropertyDescriptor(k.prototype,"leaveScreen"),k.prototype),z(k.prototype,"saveTask",[_],Object.getOwnPropertyDescriptor(k.prototype,"saveTask"),k.prototype),z(k.prototype,"fetchMemberTask",[s.task],Object.getOwnPropertyDescriptor(k.prototype,"fetchMemberTask"),k.prototype),k) -e.default=L})),define("ghost-admin/controllers/members",["exports","ghost-admin/utils/ghost-paths","moment","ghost-admin/helpers/gh-pluralize","ember-concurrency-decorators","ember-concurrency"],(function(e,t,n,s,a,r){var i,o,l,d,u,m,c,p,h,g,f,b,v,y,w,E,_,k,x,P,j,T,M,S,O,C,A,D,I,N,U,z,R,L,B,V,F,H,q,$,W,K,Y,G,J,Z,Q,X,ee,te +t&&(t=t.trim()),(!1===t||t||n)&&this.member.set(e,t)}},x=R((k=U).prototype,"members",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),P=R(k.prototype,"session",[r],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),j=R(k.prototype,"dropdown",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),T=R(k.prototype,"membersStats",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),M=R(k.prototype,"notifications",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),S=R(k.prototype,"router",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),O=R(k.prototype,"store",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),C=R(k.prototype,"isLoading",[m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),A=R(k.prototype,"showDeleteMemberModal",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),D=R(k.prototype,"showImpersonateMemberModal",[p],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),I=R(k.prototype,"showUnsavedChangesModal",[h],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),R(k.prototype,"setProperty",[g],Object.getOwnPropertyDescriptor(k.prototype,"setProperty"),k.prototype),R(k.prototype,"toggleDeleteMemberModal",[f],Object.getOwnPropertyDescriptor(k.prototype,"toggleDeleteMemberModal"),k.prototype),R(k.prototype,"toggleImpersonateMemberModal",[b],Object.getOwnPropertyDescriptor(k.prototype,"toggleImpersonateMemberModal"),k.prototype),R(k.prototype,"save",[v],Object.getOwnPropertyDescriptor(k.prototype,"save"),k.prototype),R(k.prototype,"deleteMember",[y],Object.getOwnPropertyDescriptor(k.prototype,"deleteMember"),k.prototype),R(k.prototype,"toggleUnsavedChangesModal",[w],Object.getOwnPropertyDescriptor(k.prototype,"toggleUnsavedChangesModal"),k.prototype),R(k.prototype,"leaveScreen",[E],Object.getOwnPropertyDescriptor(k.prototype,"leaveScreen"),k.prototype),R(k.prototype,"saveTask",[_],Object.getOwnPropertyDescriptor(k.prototype,"saveTask"),k.prototype),R(k.prototype,"fetchMemberTask",[s.task],Object.getOwnPropertyDescriptor(k.prototype,"fetchMemberTask"),k.prototype),k) +e.default=L})),define("ghost-admin/controllers/members",["exports","ghost-admin/utils/ghost-paths","moment","ghost-admin/helpers/gh-pluralize","ember-concurrency-decorators","ember-concurrency"],(function(e,t,n,s,a,r){var i,o,l,d,u,m,c,p,h,g,f,b,v,y,w,E,_,k,x,P,j,T,M,S,O,C,A,D,I,U,N,R,z,L,B,V,F,H,q,$,W,K,Y,G,J,Z,Q,X,ee,te function ne(e,t,n,s){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(s):void 0})}function se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ae(e,t,n,s,a){var r={} return Object.keys(s).forEach((function(e){r[e]=s[e]})),r.enumerable=!!r.enumerable,r.configurable=!!r.configurable,("value"in r||r.initializer)&&(r.writable=!0),r=n.slice().reverse().reduce((function(n,s){return s(e,t,n)||n}),r),a&&void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(a):void 0,r.initializer=void 0),void 0===r.initializer&&(Object.defineProperty(e,t,r),r=null),r}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 const re=[{name:"All members",value:null},{name:"Free members",value:"false"},{name:"Paid members",value:"true"}] -let ie=(i=Ember.inject.service,o=Ember.inject.service,l=Ember.inject.service,d=Ember.inject.service,u=Ember.inject.service,m=Ember.inject.service,c=Ember.inject.service,p=Ember._tracked,h=Ember._tracked,g=Ember._tracked,f=Ember._tracked,b=Ember._tracked,v=Ember._tracked,y=Ember._tracked,w=Ember._tracked,E=Ember._tracked,_=Ember._tracked,k=Ember._action,x=Ember._action,P=Ember._action,j=Ember._action,T=Ember._action,M=Ember._action,S=Ember._action,O=Ember._action,C=Ember._action,A=Ember._action,D=Ember._action,I=(0,a.task)({restartable:!0}),N=(0,a.task)({restartable:!0}),U=(0,a.task)({drop:!0}),te=class extends Ember.Controller{constructor(){super(...arguments),ne(this,"ajax",R,this),ne(this,"config",L,this),ne(this,"ellaSparse",B,this),ne(this,"feature",V,this),ne(this,"ghostPaths",F,this),ne(this,"membersStats",H,this),ne(this,"store",q,this),se(this,"queryParams",["label",{paidParam:"paid"},{searchParam:"search"},{orderParam:"order"}]),ne(this,"members",$,this),ne(this,"searchText",W,this),ne(this,"searchParam",K,this),ne(this,"paidParam",Y,this),ne(this,"label",G,this),ne(this,"orderParam",J,this),ne(this,"modalLabel",Z,this),ne(this,"showLabelModal",Q,this),ne(this,"showDeleteMembersModal",X,this),ne(this,"_availableLabels",ee,this),se(this,"paidParams",re),this._availableLabels=this.store.peekAll("label")}get listHeader(){let{searchText:e,selectedLabel:t,members:n}=this +let ie=(i=Ember.inject.service,o=Ember.inject.service,l=Ember.inject.service,d=Ember.inject.service,u=Ember.inject.service,m=Ember.inject.service,c=Ember.inject.service,p=Ember._tracked,h=Ember._tracked,g=Ember._tracked,f=Ember._tracked,b=Ember._tracked,v=Ember._tracked,y=Ember._tracked,w=Ember._tracked,E=Ember._tracked,_=Ember._tracked,k=Ember._action,x=Ember._action,P=Ember._action,j=Ember._action,T=Ember._action,M=Ember._action,S=Ember._action,O=Ember._action,C=Ember._action,A=Ember._action,D=Ember._action,I=(0,a.task)({restartable:!0}),U=(0,a.task)({restartable:!0}),N=(0,a.task)({drop:!0}),te=class extends Ember.Controller{constructor(){super(...arguments),ne(this,"ajax",z,this),ne(this,"config",L,this),ne(this,"ellaSparse",B,this),ne(this,"feature",V,this),ne(this,"ghostPaths",F,this),ne(this,"membersStats",H,this),ne(this,"store",q,this),se(this,"queryParams",["label",{paidParam:"paid"},{searchParam:"search"},{orderParam:"order"}]),ne(this,"members",$,this),ne(this,"searchText",W,this),ne(this,"searchParam",K,this),ne(this,"paidParam",Y,this),ne(this,"label",G,this),ne(this,"orderParam",J,this),ne(this,"modalLabel",Z,this),ne(this,"showLabelModal",Q,this),ne(this,"showDeleteMembersModal",X,this),ne(this,"_availableLabels",ee,this),se(this,"paidParams",re),this._availableLabels=this.store.peekAll("label")}get listHeader(){let{searchText:e,selectedLabel:t,members:n}=this if(n.loading)return"Loading..." if(e)return"Search result" let a=(0,s.ghPluralize)(n.length,"member") @@ -1157,7 +1164,7 @@ let i=new Date,o=!e||t!==this._lastLabel||s!==this._lastPaidParam||a!==this._las if(this._lastLabel=t,this._lastPaidParam=s,this._lastSearchParam=a,this._lastOrderParam=r,!o&&this._startDate&&!(this._startDate-i>6e4))return this.members this._startDate=i,this.members=yield this.ellaSparse.array(((e={},i={})=>{const o=t?`label:'${t}'+`:"",l=s?{paid:s}:{},d=a?{search:a}:{},u=r?`${r} desc`:"created_at desc" return i=Object.assign({order:u,limit:e.length,page:e.page,filter:`${o}created_at:<='${n.default.utc(this._startDate).format("YYYY-MM-DD HH:mm:ss")}'`},l,d,i),this.store.query("member",i).then((e=>({data:e,total:e.meta.pagination.total})))}),{limit:50})}*deleteMembersTask(){let{label:e,paidParam:t,searchParam:n}=this,s=e?`label:${e}`:"",a=t?{paid:t}:{},r=n?{search:n}:{},i=e||t||n?{}:{all:!0},o=new URLSearchParams(Object.assign({},{filter:s},a,r,i)),l=`${this.ghostPaths.url.api("members")}?${o}`,d=yield this.ajax.del(l) -return this.store.unloadAll("member"),this.reload(),d.meta.stats}resetSearch(){this.searchText=""}reload(){this.membersStats.invalidate(),this.membersStats.fetch(),this.fetchMembersTask.perform()}},R=ae((z=te).prototype,"ajax",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),L=ae(z.prototype,"config",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),B=ae(z.prototype,"ellaSparse",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),V=ae(z.prototype,"feature",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),F=ae(z.prototype,"ghostPaths",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),H=ae(z.prototype,"membersStats",[m],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),q=ae(z.prototype,"store",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),$=ae(z.prototype,"members",[p],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Ember.A([])}}),W=ae(z.prototype,"searchText",[h],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),K=ae(z.prototype,"searchParam",[g],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Y=ae(z.prototype,"paidParam",[f],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),G=ae(z.prototype,"label",[b],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),J=ae(z.prototype,"orderParam",[v],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Z=ae(z.prototype,"modalLabel",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Q=ae(z.prototype,"showLabelModal",[w],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),X=ae(z.prototype,"showDeleteMembersModal",[E],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),ee=ae(z.prototype,"_availableLabels",[_],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Ember.A([])}}),ae(z.prototype,"refreshData",[k],Object.getOwnPropertyDescriptor(z.prototype,"refreshData"),z.prototype),ae(z.prototype,"changeOrder",[x],Object.getOwnPropertyDescriptor(z.prototype,"changeOrder"),z.prototype),ae(z.prototype,"search",[P],Object.getOwnPropertyDescriptor(z.prototype,"search"),z.prototype),ae(z.prototype,"exportData",[j],Object.getOwnPropertyDescriptor(z.prototype,"exportData"),z.prototype),ae(z.prototype,"changeLabel",[T],Object.getOwnPropertyDescriptor(z.prototype,"changeLabel"),z.prototype),ae(z.prototype,"addLabel",[M],Object.getOwnPropertyDescriptor(z.prototype,"addLabel"),z.prototype),ae(z.prototype,"editLabel",[S],Object.getOwnPropertyDescriptor(z.prototype,"editLabel"),z.prototype),ae(z.prototype,"toggleLabelModal",[O],Object.getOwnPropertyDescriptor(z.prototype,"toggleLabelModal"),z.prototype),ae(z.prototype,"changePaidParam",[C],Object.getOwnPropertyDescriptor(z.prototype,"changePaidParam"),z.prototype),ae(z.prototype,"toggleDeleteMembersModal",[A],Object.getOwnPropertyDescriptor(z.prototype,"toggleDeleteMembersModal"),z.prototype),ae(z.prototype,"deleteMembers",[D],Object.getOwnPropertyDescriptor(z.prototype,"deleteMembers"),z.prototype),ae(z.prototype,"searchTask",[I],Object.getOwnPropertyDescriptor(z.prototype,"searchTask"),z.prototype),ae(z.prototype,"fetchLabelsTask",[a.task],Object.getOwnPropertyDescriptor(z.prototype,"fetchLabelsTask"),z.prototype),ae(z.prototype,"fetchMembersTask",[N],Object.getOwnPropertyDescriptor(z.prototype,"fetchMembersTask"),z.prototype),ae(z.prototype,"deleteMembersTask",[U],Object.getOwnPropertyDescriptor(z.prototype,"deleteMembersTask"),z.prototype),z) +return this.store.unloadAll("member"),this.reload(),d.meta.stats}resetSearch(){this.searchText=""}reload(){this.membersStats.invalidate(),this.membersStats.fetch(),this.fetchMembersTask.perform()}},z=ae((R=te).prototype,"ajax",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),L=ae(R.prototype,"config",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),B=ae(R.prototype,"ellaSparse",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),V=ae(R.prototype,"feature",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),F=ae(R.prototype,"ghostPaths",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),H=ae(R.prototype,"membersStats",[m],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),q=ae(R.prototype,"store",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),$=ae(R.prototype,"members",[p],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Ember.A([])}}),W=ae(R.prototype,"searchText",[h],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),K=ae(R.prototype,"searchParam",[g],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Y=ae(R.prototype,"paidParam",[f],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),G=ae(R.prototype,"label",[b],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),J=ae(R.prototype,"orderParam",[v],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Z=ae(R.prototype,"modalLabel",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Q=ae(R.prototype,"showLabelModal",[w],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),X=ae(R.prototype,"showDeleteMembersModal",[E],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),ee=ae(R.prototype,"_availableLabels",[_],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Ember.A([])}}),ae(R.prototype,"refreshData",[k],Object.getOwnPropertyDescriptor(R.prototype,"refreshData"),R.prototype),ae(R.prototype,"changeOrder",[x],Object.getOwnPropertyDescriptor(R.prototype,"changeOrder"),R.prototype),ae(R.prototype,"search",[P],Object.getOwnPropertyDescriptor(R.prototype,"search"),R.prototype),ae(R.prototype,"exportData",[j],Object.getOwnPropertyDescriptor(R.prototype,"exportData"),R.prototype),ae(R.prototype,"changeLabel",[T],Object.getOwnPropertyDescriptor(R.prototype,"changeLabel"),R.prototype),ae(R.prototype,"addLabel",[M],Object.getOwnPropertyDescriptor(R.prototype,"addLabel"),R.prototype),ae(R.prototype,"editLabel",[S],Object.getOwnPropertyDescriptor(R.prototype,"editLabel"),R.prototype),ae(R.prototype,"toggleLabelModal",[O],Object.getOwnPropertyDescriptor(R.prototype,"toggleLabelModal"),R.prototype),ae(R.prototype,"changePaidParam",[C],Object.getOwnPropertyDescriptor(R.prototype,"changePaidParam"),R.prototype),ae(R.prototype,"toggleDeleteMembersModal",[A],Object.getOwnPropertyDescriptor(R.prototype,"toggleDeleteMembersModal"),R.prototype),ae(R.prototype,"deleteMembers",[D],Object.getOwnPropertyDescriptor(R.prototype,"deleteMembers"),R.prototype),ae(R.prototype,"searchTask",[I],Object.getOwnPropertyDescriptor(R.prototype,"searchTask"),R.prototype),ae(R.prototype,"fetchLabelsTask",[a.task],Object.getOwnPropertyDescriptor(R.prototype,"fetchLabelsTask"),R.prototype),ae(R.prototype,"fetchMembersTask",[U],Object.getOwnPropertyDescriptor(R.prototype,"fetchMembersTask"),R.prototype),ae(R.prototype,"deleteMembersTask",[N],Object.getOwnPropertyDescriptor(R.prototype,"deleteMembersTask"),R.prototype),R) e.default=ie})),define("ghost-admin/controllers/members/import",["exports","ghost-admin/helpers/reset-query-params"],(function(e,t){var n,s,a,r,i,o,l,d function u(e,t,n,s){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(s):void 0})}function m(e,t,n,s,a){var r={} return Object.keys(s).forEach((function(e){r[e]=s[e]})),r.enumerable=!!r.enumerable,r.configurable=!!r.configurable,("value"in r||r.initializer)&&(r.writable=!0),r=n.slice().reverse().reduce((function(n,s){return s(e,t,n)||n}),r),a&&void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(a):void 0,r.initializer=void 0),void 0===r.initializer&&(Object.defineProperty(e,t,r),r=null),r}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 @@ -1693,14 +1700,14 @@ var n=t.default.extend({buildRouteInfoMetadata:()=>({titleToken:"About"})}) e.default=n})),define("ghost-admin/routes/application",["exports","ember-simple-auth/mixins/application-route-mixin","ember-simple-auth/configuration","ghost-admin/mixins/shortcuts-route","ghost-admin/utils/ctrl-or-cmd","ghost-admin/utils/window-proxy","ember-ajax/errors","ghost-admin/services/ajax"],(function(e,t,n,s,a,r,i,o){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 let l={esc:{action:"closeMenus",scope:"default"}} l[`${a.default}+s`]={action:"save",scope:"all"} -var d=Ember.Route.extend(t.default,s.default,{ajax:Ember.inject.service(),config:Ember.inject.service(),feature:Ember.inject.service(),ghostPaths:Ember.inject.service(),notifications:Ember.inject.service(),router:Ember.inject.service(),settings:Ember.inject.service(),tour:Ember.inject.service(),ui:Ember.inject.service(),whatsNew:Ember.inject.service(),shortcuts:l,routeAfterAuthentication:"home",init(){this._super(...arguments),this.router.on("routeDidChange",(()=>{this.notifications.displayDelayed()}))},beforeModel(){return this.config.fetchUnauthenticated()},afterModel(e,t){if(this._super(...arguments),this.get("session.isAuthenticated"))return this.set("appLoadTransition",t),t.send("loadServerNotifications"),Ember.RSVP.all([this.config.fetchAuthenticated(),this.feature.fetch(),this.settings.fetch(),this.tour.fetchViewed()]).then((e=>(this._appLoaded=!0,this.whatsNew.fetchLatest.perform(),e))) +var d=Ember.Route.extend(t.default,s.default,{ajax:Ember.inject.service(),config:Ember.inject.service(),feature:Ember.inject.service(),ghostPaths:Ember.inject.service(),notifications:Ember.inject.service(),router:Ember.inject.service(),settings:Ember.inject.service(),tour:Ember.inject.service(),ui:Ember.inject.service(),whatsNew:Ember.inject.service(),billing:Ember.inject.service(),shortcuts:l,routeAfterAuthentication:"home",init(){this._super(...arguments),this.router.on("routeDidChange",(()=>{this.notifications.displayDelayed()}))},beforeModel(){return this.config.fetchUnauthenticated()},afterModel(e,t){if(this._super(...arguments),this.get("session.isAuthenticated"))return this.set("appLoadTransition",t),t.send("loadServerNotifications"),Ember.RSVP.all([this.config.fetchAuthenticated(),this.feature.fetch(),this.settings.fetch(),this.tour.fetchViewed()]).then((e=>(this._appLoaded=!0,this.whatsNew.fetchLatest.perform(),e))) this._appLoaded=!0},actions:{closeMenus(){this.ui.closeMenus()},didTransition(){this.set("appLoadTransition",null),this.send("closeMenus")},signedIn(){this.notifications.clearAll(),this.send("loadServerNotifications",!0)},authorizationFailed(){r.default.replaceLocation(n.default.rootURL)},loadServerNotifications(e){this.get("session.isAuthenticated")&&this.get("session.user").then((t=>{t.get("isAuthorOrContributor")||this.store.findAll("notification",{reload:!0}).then((t=>{t.forEach((t=>{t.get("top")||t.get("custom")?this.notifications.handleNotification(t,e):this.upgradeStatus.handleUpgradeNotification(t)}))}))}))},save:function(){return this},error(e,t){if((0,i.isUnauthorizedError)(e))return!1 if((0,i.isNotFoundError)(e)){t&&t.abort() let e=t.to,n=this.router,s=[] for(let t of Object.keys(e.params))s.push(e.params[t]) let a=n.urlFor(e.name,...s).replace(/^#\//,"").replace(/^\//,"").replace(/^ghost\//,"") return this.replaceWith("error404",a)}return(!(0,o.isVersionMismatchError)(e)||(t&&t.abort(),this.upgradeStatus.requireUpgrade(),!this._appLoaded))&&((!(0,o.isMaintenanceError)(e)||(t&&t.abort(),this.upgradeStatus.maintenanceAlert(),!this._appLoaded))&&!(((0,i.isAjaxError)(e)||e&&e.payload&&Ember.isArray(e.payload.errors))&&(this.notifications.showAPIError(e),!t)))}},sessionAuthenticated(){this.get("session.skipAuthSuccessHandler")||(this._super(...arguments),this.get("session.user").then((e=>{this.send("signedIn",e)})))},sessionInvalidated(){let e=this.appLoadTransition -e?e.send("authorizationFailed"):Ember.run.scheduleOnce("routerTransitions",this,"send","authorizationFailed")}}) +e?e.send("authorizationFailed"):Ember.run.scheduleOnce("routerTransitions",this,"send","authorizationFailed"),this.config.get("forceUpgrade")&&this.billing.openBillingWindow(this.router.currentURL,"/pro")}}) e.default=d})),define("ghost-admin/routes/authenticated",["exports","ember-simple-auth/mixins/authenticated-route-mixin"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 var n=Ember.Route.extend(t.default,{authenticationRoute:"signin"}) e.default=n})),define("ghost-admin/routes/editor",["exports","jquery","ghost-admin/routes/authenticated","ghost-admin/mixins/shortcuts-route","ghost-admin/utils/ctrl-or-cmd"],(function(e,t,n,s,a){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 @@ -1756,7 +1763,7 @@ break case"scheduled":t="scheduled"}return{status:t}},_filterString:e=>Object.keys(e).map((t=>{let n=e[t] if(!Ember.isBlank(n))return`${t}:${e[t]}`})).compact().join("+")}) e.default=n})),define("ghost-admin/routes/pro",["exports","ghost-admin/routes/authenticated"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 -var n=t.default.extend({billing:Ember.inject.service(),ui:Ember.inject.service(),queryParams:{action:{refreshModel:!0}},beforeModel(e){return this._super(...arguments),this.session.user.then((t=>{if(!t.isOwner)return this.transitionTo("home") +var n=t.default.extend({billing:Ember.inject.service(),ui:Ember.inject.service(),session:Ember.inject.service(),config:Ember.inject.service(),queryParams:{action:{refreshModel:!0}},beforeModel(e){return this._super(...arguments),this.session.user.then((t=>{if(!t.get("isOwner")&&!this.config.get("forceUpgrade"))return this.transitionTo("home") this.billing.set("previousTransition",e)}))},model(e){e.action&&this.billing.set("action",e.action),this.billing.toggleProWindow(!0)},activate(){this.ui.set("showTour",!1)},deactivate(){this.ui.set("showTour",!0)},actions:{willTransition(e){let t=!1 if(e){let n="string"==typeof e.to?e.to:e.intent?e.intent.url:"" null!=n&&n.includes("/pro")&&(t=!0)}this.billing.toggleProWindow(t)}},buildRouteInfoMetadata:()=>({titleToken:"Ghost(Pro)"})}) @@ -1934,10 +1941,13 @@ e&&(Ember.isArray(e)||(e=[e]),n.errors=e.map((function(e){return"string"==typeof k.reopen({contentType:"application/json; charset=UTF-8"}) var x=k e.default=x})),define("ghost-admin/services/billing",["exports"],(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 -var t=Ember.Service.extend({router:Ember.inject.service(),config:Ember.inject.service(),ghostPaths:Ember.inject.service(),billingRouteRoot:"#/pro",billingWindowOpen:!1,subscription:null,previousRoute:null,init(){this._super(...arguments),this.config.get("billingUrl")&&window.addEventListener("message",(e=>{e&&e.data&&e.data.route&&this.handleRouteChangeInIframe(e.data.route)}))},handleRouteChangeInIframe(e){if(this.get("billingWindowOpen")){let t=this.get("billingRouteRoot") -"/"!==e&&(t+=e),window.location.hash!==t&&window.history.replaceState(window.history.state,"",t)}},getIframeURL(){let e=this.config.get("billingUrl") +var t=Ember.Service.extend({router:Ember.inject.service(),config:Ember.inject.service(),ghostPaths:Ember.inject.service(),store:Ember.inject.service(),billingRouteRoot:"#/pro",billingWindowOpen:!1,subscription:null,previousRoute:null,action:null,ownerUser:null,init(){this._super(...arguments),this.config.get("billingUrl")&&window.addEventListener("message",(e=>{e&&e.data&&e.data.route&&this.handleRouteChangeInIframe(e.data.route)}))},handleRouteChangeInIframe(e){if(this.get("billingWindowOpen")){let t=this.get("billingRouteRoot") +"/"!==e&&(t+=e),window.location.hash!==t&&window.history.replaceState(window.history.state,"",t)}},getIframeURL(){this.getOwnerUser() +let e=this.config.get("billingUrl") if(window.location.hash&&window.location.hash.includes(this.get("billingRouteRoot"))){let t=window.location.hash.replace(this.get("billingRouteRoot"),"") -t&&(e+=t)}return e},toggleProWindow(e){this.get("billingWindowOpen")&&e||this.set("billingWindowOpen",e)},openBillingWindow(e,t){this.get("billingWindowOpen")||(this.set("previousRoute",e),window.location.hash=t||"/pro",this.router.transitionTo(t||"/pro"))},getBillingIframe:()=>document.getElementById("billing-frame")}) +t&&(e+=t)}return e},async getOwnerUser(){if(!this.get("ownerUser")){let e=this.store.peekAll("user").findBy("isOwner",!0) +e||(await this.store.findAll("user",{reload:!0}),e=this.store.peekAll("user").findBy("isOwner",!0)),this.set("ownerUser",e)}return this.get("ownerUser")},sendRouteUpdate(){const e=this.get("action") +e&&("checkout"===e&&this.getBillingIframe().contentWindow.postMessage({query:"routeUpdate",response:this.get("checkoutRoute")},"*"),this.set("action",null))},toggleProWindow(e){this.get("billingWindowOpen")&&e&&!this.get("action")||(this.sendRouteUpdate(),this.set("billingWindowOpen",e))},openBillingWindow(e,t){this.getOwnerUser(),this.get("billingWindowOpen")||(this.set("previousRoute",e),window.location.hash=t||"/pro",this.sendRouteUpdate(),this.router.transitionTo(t||"/pro"))},getBillingIframe(){return this.getOwnerUser(),document.getElementById("billing-frame")}}) e.default=t})),define("ghost-admin/services/clock",["exports","ghost-admin/config/environment","moment"],(function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0 var s=Ember.Service.extend({second:null,minute:null,hour:null,init(){this._super(...arguments),this.tick()},tick(){let e=(0,n.default)().utc() this.setProperties({second:e.seconds(),minute:e.minutes(),hour:e.hours()}),"test"!==t.default.environment&&Ember.run.later((()=>{this.tick()}),1e3)}}) @@ -2308,7 +2318,8 @@ return i} const t=/[aeiou]$/i,n=/[bcdfghjklmnpqrstvwxyz]$/i function s(e,t){var n,a,r,i=new Uint8Array(t) for(n in r=i,window.crypto.getRandomValues(r),i)if(Object.prototype.hasOwnProperty.call(i,n)&&(a=i[n])>e&&a{this[t]&&this[t](e)})),this.passed},invalidate(){this.set("passed",!1)}}) diff --git a/core/server/api/canary/config.js b/core/server/api/canary/config.js index 44e513e10d..8f68a17351 100644 --- a/core/server/api/canary/config.js +++ b/core/server/api/canary/config.js @@ -23,7 +23,8 @@ module.exports = { enableDeveloperExperiments: config.get('enableDeveloperExperiments') || false, stripeDirect: config.get('stripeDirect'), mailgunIsConfigured: config.get('bulkEmail') && config.get('bulkEmail').mailgun, - emailAnalytics: config.get('emailAnalytics') + emailAnalytics: config.get('emailAnalytics'), + forceUpgrade: config.get('host_settings:forceUpgrade') || false }; if (billingUrl) { response.billingUrl = billingUrl; diff --git a/core/server/api/v3/config.js b/core/server/api/v3/config.js index 44e513e10d..8f68a17351 100644 --- a/core/server/api/v3/config.js +++ b/core/server/api/v3/config.js @@ -23,7 +23,8 @@ module.exports = { enableDeveloperExperiments: config.get('enableDeveloperExperiments') || false, stripeDirect: config.get('stripeDirect'), mailgunIsConfigured: config.get('bulkEmail') && config.get('bulkEmail').mailgun, - emailAnalytics: config.get('emailAnalytics') + emailAnalytics: config.get('emailAnalytics'), + forceUpgrade: config.get('host_settings:forceUpgrade') || false }; if (billingUrl) { response.billingUrl = billingUrl; diff --git a/core/server/web/admin/controller.js b/core/server/web/admin/controller.js index 26963a4301..731b952e93 100644 --- a/core/server/web/admin/controller.js +++ b/core/server/web/admin/controller.js @@ -1,5 +1,7 @@ const debug = require('ghost-ignition').debug('web:admin:controller'); const path = require('path'); +const fs = require('fs'); +const crypto = require('crypto'); const config = require('../../../shared/config'); const updateCheck = require('../../update-check'); const logging = require('../../../shared/logging'); @@ -25,6 +27,15 @@ module.exports = function adminController(req, res) { const templatePath = path.resolve(config.get('paths').adminViews, defaultTemplate); const headers = {}; + // Generate our own ETag header + // `sendFile` by default uses filesize+lastmod date to generate an etag. + // That doesn't work for admin templates because the filesize doesn't change between versions + // and `npm pack` sets a fixed lastmod date for every file meaning the default etag never changes + const fileBuffer = fs.readFileSync(templatePath); + const hashSum = crypto.createHash('md5'); + hashSum.update(fileBuffer); + headers.ETag = hashSum.digest('hex'); + if (config.get('adminFrameProtection')) { headers['X-Frame-Options'] = 'sameorigin'; } diff --git a/core/server/web/admin/views/default-prod.html b/core/server/web/admin/views/default-prod.html index ea1821955e..d97ff06314 100644 --- a/core/server/web/admin/views/default-prod.html +++ b/core/server/web/admin/views/default-prod.html @@ -53,7 +53,7 @@ - + diff --git a/core/server/web/admin/views/default.html b/core/server/web/admin/views/default.html index ea1821955e..d97ff06314 100644 --- a/core/server/web/admin/views/default.html +++ b/core/server/web/admin/views/default.html @@ -53,7 +53,7 @@ - + diff --git a/package.json b/package.json index d3be770cb6..2a984e7bde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghost", - "version": "3.42.6", + "version": "3.42.7", "description": "The professional publishing platform", "author": "Ghost Foundation", "homepage": "https://ghost.org",