ghost 5.119.2 → 5.120.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-i18n-5.120.0.tgz +0 -0
- package/core/boot.js +0 -2
- package/core/built/admin/assets/admin-x-activitypub/admin-x-activitypub.js +7555 -7216
- package/core/built/admin/assets/admin-x-settings/{CodeEditorView-60ce658c.mjs → CodeEditorView-1c5b0683.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-8480baa8.mjs → index-14e518a7.mjs} +3 -3
- package/core/built/admin/assets/admin-x-settings/{index-a2648c61.mjs → index-fc9f985b.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{modals-6900c1d5.mjs → modals-15bc6a0f.mjs} +7192 -6656
- package/core/built/admin/assets/{chunk.137.c9bf40f01afeeadb4660.js → chunk.383.25fca2f09b4896656125.js} +76 -59
- package/core/built/admin/assets/chunk.524.1657b12c0ab25dd9fb79.js +28 -0
- package/core/built/admin/assets/{chunk.582.98a820cbc4bb65f2e685.js → chunk.582.09869b1f1a3cc0ab81f6.js} +19 -26
- package/core/built/admin/assets/{ghost-843572e9507d099162ae744d791daba1.js → ghost-b3b44421acca3b3eec76bfbb6ba0e81b.js} +3 -3
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.js +12578 -12352
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.umd.js +423 -211
- package/core/built/admin/assets/posts/posts.js +13680 -13671
- package/core/built/admin/assets/stats/stats.js +16457 -16635
- package/core/built/admin/assets/{vendor-8f805740fee4db959a5b2119001a56b1.js → vendor-4ce6d282a2a00fe486a0951e0591da19.js} +11 -9
- package/core/built/admin/index.html +5 -5
- package/core/frontend/helpers/match.js +6 -0
- package/core/frontend/services/routing/ParentRouter.js +1 -1
- package/core/frontend/services/routing/controllers/email-post.js +0 -2
- package/core/frontend/services/routing/controllers/previews.js +0 -3
- package/core/frontend/web/middleware/frontend-caching.js +2 -2
- package/core/server/api/endpoints/authentication.js +37 -73
- package/core/server/api/endpoints/authors-public.js +8 -9
- package/core/server/api/endpoints/db.js +34 -35
- package/core/server/api/endpoints/emails.js +8 -10
- package/core/server/api/endpoints/integrations.js +20 -18
- package/core/server/api/endpoints/invites.js +8 -10
- package/core/server/api/endpoints/labels.js +19 -23
- package/core/server/api/endpoints/notifications.js +3 -4
- package/core/server/api/endpoints/pages-public.js +8 -10
- package/core/server/api/endpoints/pages.js +14 -18
- package/core/server/api/endpoints/posts-public.js +8 -10
- package/core/server/api/endpoints/posts.js +6 -8
- package/core/server/api/endpoints/previews.js +8 -10
- package/core/server/api/endpoints/redirects.js +7 -8
- package/core/server/api/endpoints/schedules.js +5 -7
- package/core/server/api/endpoints/slugs.js +7 -9
- package/core/server/api/endpoints/snippets.js +16 -20
- package/core/server/api/endpoints/tags-public.js +8 -10
- package/core/server/api/endpoints/tags.js +19 -23
- package/core/server/api/endpoints/themes.js +6 -8
- package/core/server/api/endpoints/users.js +31 -36
- package/core/server/api/endpoints/utils/permissions.js +10 -10
- package/core/server/api/endpoints/utils/serializers/output/roles.js +9 -10
- package/core/server/api/endpoints/utils/validators/input/images.js +43 -52
- package/core/server/api/endpoints/utils/validators/input/invites.js +6 -8
- package/core/server/api/endpoints/webhooks.js +38 -42
- package/core/server/data/migrations/versions/5.120/2025-05-07-14-57-38-add-newsletters-button-corners-column.js +8 -0
- package/core/server/data/migrations/versions/5.120/2025-05-13-17-36-56-add-newsletters-button-style-column.js +8 -0
- package/core/server/data/migrations/versions/5.120/2025-05-14-20-00-15-add-newsletters-setting-columns.js +22 -0
- package/core/server/data/schema/schema.js +6 -1
- package/core/server/lib/image/Gravatar.js +12 -13
- package/core/server/lib/lexical.js +3 -1
- package/core/server/models/newsletter.js +6 -1
- package/core/server/services/api-version-compatibility/index.js +1 -33
- package/core/server/services/auth/session/emails/signin.js +3 -3
- package/core/server/services/email-address/EmailAddressParser.js +52 -0
- package/core/server/services/email-address/EmailAddressParser.js.d.ts +13 -0
- package/core/server/services/email-address/EmailAddressService.js +142 -0
- package/core/server/services/email-address/EmailAddressService.ts +183 -0
- package/core/server/services/email-address/EmailAddressServiceWrapper.js +2 -4
- package/core/server/services/email-analytics/EmailAnalyticsService.js +1 -1
- package/core/server/services/email-analytics/EmailAnalyticsServiceWrapper.js +2 -1
- package/core/server/services/email-service/BatchSendingService.js +703 -0
- package/core/server/services/email-service/EmailBodyCache.js +20 -0
- package/core/server/services/email-service/EmailController.js +94 -0
- package/core/server/services/email-service/EmailEventProcessor.js +267 -0
- package/core/server/services/email-service/EmailEventStorage.js +187 -0
- package/core/server/services/email-service/EmailRenderer.js +1263 -0
- package/core/server/services/email-service/EmailSegmenter.js +74 -0
- package/core/server/services/email-service/EmailService.js +310 -0
- package/core/server/services/email-service/EmailServiceWrapper.js +9 -2
- package/core/server/services/email-service/MailgunEmailProvider.js +191 -0
- package/core/server/services/email-service/SendingService.js +173 -0
- package/core/server/services/email-service/email-templates/partials/feedback-button.hbs +7 -0
- package/core/server/services/email-service/email-templates/partials/latest-posts.hbs +39 -0
- package/core/server/services/email-service/email-templates/partials/paywall.hbs +20 -0
- package/core/server/services/email-service/email-templates/partials/styles.hbs +2348 -0
- package/core/server/services/email-service/email-templates/template.hbs +238 -0
- package/core/server/services/email-service/events/EmailBouncedEvent.js +63 -0
- package/core/server/services/email-service/events/EmailDeliveredEvent.js +49 -0
- package/core/server/services/email-service/events/EmailOpenedEvent.js +49 -0
- package/core/server/services/email-service/events/EmailTemporaryBouncedEvent.js +63 -0
- package/core/server/services/email-service/events/EmailUnsubscribedEvent.js +42 -0
- package/core/server/services/email-service/events/SpamComplaintEvent.js +42 -0
- package/core/server/services/email-service/helpers/register-helpers.js +59 -0
- package/core/server/services/email-suppression-list/MailgunEmailSuppressionList.js +2 -1
- package/core/server/services/explore-ping/index.js +2 -1
- package/core/server/services/mail/GhostMailer.js +1 -1
- package/core/server/services/media-inliner/ExternalMediaInliner.js +2 -1
- package/core/server/services/members/api.js +15 -15
- package/core/server/services/members/emails/signin.js +4 -4
- package/core/server/services/members/emails/signup-paid.js +3 -4
- package/core/server/services/members/emails/signup.js +3 -3
- package/core/server/services/members/emails/subscribe.js +3 -3
- package/core/server/services/members/members-api/controllers/RouterController.js +50 -36
- package/core/server/services/members/members-api/repositories/MemberRepository.js +92 -92
- package/core/server/services/members-events/LastSeenAtUpdater.js +1 -1
- package/core/server/services/settings-helpers/SettingsHelpers.js +1 -1
- package/core/server/services/staff/StaffServiceEmails.js +1 -1
- package/core/server/services/stats/PostsStatsService.js +28 -7
- package/core/server/web/api/app.js +0 -1
- package/core/server/web/api/endpoints/admin/app.js +0 -2
- package/core/server/web/api/endpoints/content/app.js +0 -2
- package/core/server/web/api/middleware/upload.js +2 -2
- package/core/shared/custom-theme-settings-cache/CustomThemeSettingsService.js +2 -1
- package/package.json +39 -97
- package/tsconfig.tsbuildinfo +1 -1
- package/yarn.lock +385 -517
- package/components/tryghost-api-framework-5.119.2.tgz +0 -0
- package/components/tryghost-custom-fonts-5.119.2.tgz +0 -0
- package/components/tryghost-domain-events-5.119.2.tgz +0 -0
- package/components/tryghost-email-addresses-5.119.2.tgz +0 -0
- package/components/tryghost-email-service-5.119.2.tgz +0 -0
- package/components/tryghost-html-to-plaintext-5.119.2.tgz +0 -0
- package/components/tryghost-i18n-5.119.2.tgz +0 -0
- package/components/tryghost-job-manager-5.119.2.tgz +0 -0
- package/components/tryghost-members-csv-5.119.2.tgz +0 -0
- package/components/tryghost-mw-error-handler-5.119.2.tgz +0 -0
- package/components/tryghost-mw-vhost-5.119.2.tgz +0 -0
- package/components/tryghost-prometheus-metrics-5.119.2.tgz +0 -0
- package/components/tryghost-security-5.119.2.tgz +0 -0
- package/core/built/admin/assets/chunk.524.b8545af3bb714bc4f820.js +0 -35
- package/core/server/services/api-version-compatibility/APIVersionCompatibilityService.js +0 -99
- package/core/server/services/api-version-compatibility/VersionNotificationsDataService.js +0 -80
- package/core/server/services/api-version-compatibility/extract-api-key.js +0 -57
- package/core/server/services/api-version-compatibility/mw-api-version-mismatch.js +0 -31
- /package/core/built/admin/assets/{chunk.137.c9bf40f01afeeadb4660.js.LICENSE.txt → chunk.383.25fca2f09b4896656125.js.LICENSE.txt} +0 -0
|
@@ -128,7 +128,7 @@ return null==i?"!="===t:!t||(i+="","="===t?i===r:"!="===t?i!==r:"^="===t?r&&0===
|
|
|
128
128
|
return 1===n&&0===i?function(e){return!!e.parentNode}:function(t,r,l){var u,c,d,h,p,f,m=o!==s?"nextSibling":"previousSibling",g=t.parentNode,b=a&&t.nodeName.toLowerCase(),v=!l&&!a,y=!1
|
|
129
129
|
if(g){if(o){for(;m;){for(h=t;h=h[m];)if(a?h.nodeName.toLowerCase()===b:1===h.nodeType)return!1
|
|
130
130
|
f=m="only"===e&&!f&&"nextSibling"}return!0}if(f=[s?g.firstChild:g.lastChild],s&&v){for(y=(p=(u=(c=(d=(h=g)[_]||(h[_]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]||[])[0]===E&&u[1])&&u[2],h=p&&g.childNodes[p];h=++p&&h&&h[m]||(y=p=0)||f.pop();)if(1===h.nodeType&&++y&&h===t){c[e]=[E,p,y]
|
|
131
|
-
break}}else if(v&&(y=p=(u=(c=(d=(h=t)[_]||(h[_]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]||[])[0]===E&&u[1]),!1===y)for(;(h=++p&&h&&h[m]||(y=p=0)||f.pop())&&((a?h.nodeName.toLowerCase()!==b:1!==h.nodeType)||!++y||(v&&((c=(d=h[_]||(h[_]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]=[E,y]),h!==t)););return(y-=i)===n||y%n
|
|
131
|
+
break}}else if(v&&(y=p=(u=(c=(d=(h=t)[_]||(h[_]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]||[])[0]===E&&u[1]),!1===y)for(;(h=++p&&h&&h[m]||(y=p=0)||f.pop())&&((a?h.nodeName.toLowerCase()!==b:1!==h.nodeType)||!++y||(v&&((c=(d=h[_]||(h[_]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]=[E,y]),h!==t)););return(y-=i)===n||y%n===0&&y/n>=0}}},PSEUDO:function(e,t){var r,i=n.pseudos[e]||n.setFilters[e.toLowerCase()]||ae.error("unsupported pseudo: "+e)
|
|
132
132
|
return i[_]?i(t):i.length>1?(r=[e,e,"",t],n.setFilters.hasOwnProperty(e.toLowerCase())?ue((function(e,r){for(var n,o=i(e,t),s=o.length;s--;)e[n=D(e,o[s])]=!(r[n]=o[s])})):function(e){return i(e,0,r)}):i}},pseudos:{not:ue((function(e){var t=[],r=[],n=a(e.replace(V,"$1"))
|
|
133
133
|
return n[_]?ue((function(e,t,r,i){for(var o,s=n(e,null,i,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))})):function(e,i,o){return t[0]=e,n(t,null,o,r),t[0]=null,!r.pop()}})),has:ue((function(e){return function(t){return ae(e,t).length>0}})),contains:ue((function(e){return e=e.replace(te,re),function(t){return(t.textContent||i(t)).indexOf(e)>-1}})),lang:ue((function(e){return G.test(e||"")||ae.error("unsupported lang: "+e),e=e.replace(te,re).toLowerCase(),function(t){var r
|
|
134
134
|
do{if(r=m?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(r=r.toLowerCase())===e||0===r.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType)
|
|
@@ -461,7 +461,7 @@ return this},abort:function(e){var t=e||x
|
|
|
461
461
|
return n&&n.abort(t),M(0,t),this}}
|
|
462
462
|
if(b.promise(k),p.url=((t||p.url||Et.href)+"").replace(Dt,Et.protocol+"//"),p.type=r.method||r.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(D)||[""],null==p.crossDomain){l=g.createElement("a")
|
|
463
463
|
try{l.href=p.url,l.href=l.href,p.crossDomain=zt.protocol+"//"+zt.host!=l.protocol+"//"+l.host}catch(O){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=w.param(p.data,p.traditional)),Ht(Nt,p,r,k),u)return k
|
|
464
|
-
for(d in(c=w.event&&p.global)&&0
|
|
464
|
+
for(d in(c=w.event&&p.global)&&0===w.active++&&w.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!It.test(p.type),i=p.url.replace(At,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(St,"+")):(h=p.url.slice(i.length),p.data&&(p.processData||"string"==typeof p.data)&&(i+=(kt.test(i)?"&":"?")+p.data,delete p.data),!1===p.cache&&(i=i.replace(Rt,"$1"),h=(kt.test(i)?"&":"?")+"_="+xt.guid+++h),p.url=i+h),p.ifModified&&(w.lastModified[i]&&k.setRequestHeader("If-Modified-Since",w.lastModified[i]),w.etag[i]&&k.setRequestHeader("If-None-Match",w.etag[i])),(p.data&&p.hasContent&&!1!==p.contentType||r.contentType)&&k.setRequestHeader("Content-Type",p.contentType),k.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Ft+"; q=0.01":""):p.accepts["*"]),p.headers)k.setRequestHeader(d,p.headers[d])
|
|
465
465
|
if(p.beforeSend&&(!1===p.beforeSend.call(f,k,p)||u))return k.abort()
|
|
466
466
|
if(x="abort",v.add(p.complete),k.done(p.success),k.fail(p.error),n=Ht(Lt,p,r,k)){if(k.readyState=1,c&&m.trigger("ajaxSend",[k,p]),u)return k
|
|
467
467
|
p.async&&p.timeout>0&&(a=e.setTimeout((function(){k.abort("timeout")}),p.timeout))
|
|
@@ -1118,7 +1118,7 @@ null!==o&&(o.isInitializing()||o.isPrototypeMeta(e))||(N(e,r),F<=0&&A(),L in e&&
|
|
|
1118
1118
|
P=[]}())}function V(e){B()
|
|
1119
1119
|
try{e()}finally{H()}}function q(e,t,r,n){return void 0===t?(t=0,r=n=-1):(void 0===r&&(r=-1),void 0===n&&(n=-1)),g(e,"@array:before",[e,t,r,n]),e}function U(e,r,n,i,o=!0){void 0===r?(r=0,n=i=-1):(void 0===n&&(n=-1),void 0===i&&(i=-1))
|
|
1120
1120
|
var s=(0,t.peekMeta)(e)
|
|
1121
|
-
if(o&&((i<0||n<0||i-n
|
|
1121
|
+
if(o&&((i<0||n<0||i-n!==0)&&z(e,"length",s),z(e,"[]",s)),g(e,"@array:change",[e,r,n,i]),null!==s){var a=-1===n?0:n,l=e.length-((-1===i?0:i)-a),u=r<0?l+r:r
|
|
1122
1122
|
if(void 0!==s.revisionFor("firstObject")&&0===u&&z(e,"firstObject",s),void 0!==s.revisionFor("lastObject"))l-1<u+a&&z(e,"lastObject",s)}return e}var $=Object.freeze([])
|
|
1123
1123
|
function W(e,t){return Array.isArray(e)?e[t]:e.objectAt(t)}var G=6e4
|
|
1124
1124
|
function Y(e,t,r,n){if(q(e,t,r,n.length),n.length<=G)e.splice(t,r,...n)
|
|
@@ -2478,8 +2478,10 @@ var e=this.handle
|
|
|
2478
2478
|
return this.handle+=3,e}finishMalloc(e,t){this.table[e+1]=l(t,0)}size(){return this.offset}getaddr(e){return this.table[e]}gethandle(e){this.table.push(e,l(0,3),0)
|
|
2479
2479
|
var t=this.handle
|
|
2480
2480
|
return this.handle+=3,t}sizeof(e){return f(this.table,e)}scopesizeof(e){return m(this.table,e)}free(e){var t=this.table[e+1]
|
|
2481
|
-
this.table[e+1]=u(t,1)}compact(){for(var e=0,{table:t,table:{length:r},heap:n}=this,i=0;i<r;i+=3){
|
|
2482
|
-
t[i]=
|
|
2481
|
+
this.table[e+1]=u(t,1)}compact(){for(var e=0,{table:t,table:{length:r},heap:n}=this,i=0;i<r;i+=3){var o=t[i],s=t[i+1],a=s&Size.SIZE_MASK,l=0&s
|
|
2482
|
+
if(2!==l)if(1===l)t[i+1]=u(s,2),e+=a
|
|
2483
|
+
else if(0===l){for(var c=o;c<=i+a;c++)n[c-e]=n[c]
|
|
2484
|
+
t[i]=o-e}else 3===l&&(t[i]=o-e)}this.offset=this.offset-e}pushPlaceholder(e){this.sizeCheck()
|
|
2483
2485
|
var t=this.offset++
|
|
2484
2486
|
this.heap[t]=2147483647,this.placeholders.push([t,e])}pushStdlib(e){this.sizeCheck()
|
|
2485
2487
|
var t=this.offset++
|
|
@@ -3855,7 +3857,7 @@ return t[2]+=t[2]*e,this.setValues("hwb",t),this},greyscale:function(){var e=thi
|
|
|
3855
3857
|
return this.setValues("rgb",[t,t,t]),this},clearer:function(e){var t=this.values.alpha
|
|
3856
3858
|
return this.setValues("alpha",t-t*e),this},opaquer:function(e){var t=this.values.alpha
|
|
3857
3859
|
return this.setValues("alpha",t+t*e),this},rotate:function(e){var t=this.values.hsl,r=(t[0]+e)%360
|
|
3858
|
-
return t[0]=r<0?360+r:r,this.setValues("hsl",t),this},mix:function(e,t){var r=this,n=e,i=void 0===t?.5:t,o=2*i-1,s=r.alpha()-n.alpha(),a=((o*s
|
|
3860
|
+
return t[0]=r<0?360+r:r,this.setValues("hsl",t),this},mix:function(e,t){var r=this,n=e,i=void 0===t?.5:t,o=2*i-1,s=r.alpha()-n.alpha(),a=((o*s===-1?o:(o+s)/(1+o*s))+1)/2,l=1-a
|
|
3859
3861
|
return this.rgb(a*r.red()+l*n.red(),a*r.green()+l*n.green(),a*r.blue()+l*n.blue()).alpha(r.alpha()*i+n.alpha()*(1-i))},toJSON:function(){return this.rgb()},clone:function(){var e,t,r=new _,n=this.values,i=r.values
|
|
3860
3862
|
for(var o in n)n.hasOwnProperty(o)&&(e=n[o],"[object Array]"===(t={}.toString.call(e))?i[o]=e.slice(0):"[object Number]"===t?i[o]=e:console.error("unexpected color value:",e))
|
|
3861
3863
|
return r}},_.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},_.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},_.prototype.getValues=function(e){for(var t=this.values,r={},n=0;n<e.length;n++)r[e.charAt(n)]=t[e][n]
|
|
@@ -3934,7 +3936,7 @@ case"%":e/=100}return t*e},toPadding:function(e){var t,r,n,i
|
|
|
3934
3936
|
return M.isObject(e)?(t=+e.top||0,r=+e.right||0,n=+e.bottom||0,i=+e.left||0):t=r=n=i=+e||0,{top:t,right:r,bottom:n,left:i,height:t+n,width:i+r}},_parseFont:function(e){var t=L.global,r=F(e.fontSize,t.defaultFontSize),n={family:F(e.fontFamily,t.defaultFontFamily),lineHeight:M.options.toLineHeight(F(e.lineHeight,t.defaultLineHeight),r),size:r,style:F(e.fontStyle,t.defaultFontStyle),weight:null,string:""}
|
|
3935
3937
|
return n.string=function(e){return!e||M.isNullOrUndef(e.size)||M.isNullOrUndef(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}(n),n},resolve:function(e,t,r,n){var i,o,s,a=!0
|
|
3936
3938
|
for(i=0,o=e.length;i<o;++i)if(void 0!==(s=e[i])&&(void 0!==t&&"function"==typeof s&&(s=s(t),a=!1),void 0!==r&&M.isArray(s)&&(s=s[r],a=!1),void 0!==s))return n&&!a&&(n.cacheable=!1),s}},B={_factorize:function(e){var t,r=[],n=Math.sqrt(e)
|
|
3937
|
-
for(t=1;t<n;t++)e%t
|
|
3939
|
+
for(t=1;t<n;t++)e%t===0&&(r.push(t),r.push(e/t))
|
|
3938
3940
|
return n===(0|n)&&r.push(n),r.sort((function(e,t){return e-t})).pop(),r},log10:Math.log10||function(e){var t=Math.log(e)*Math.LOG10E,r=Math.round(t)
|
|
3939
3941
|
return e===Math.pow(10,r)?r:t}},H=B
|
|
3940
3942
|
M.log10=B.log10
|
|
@@ -4478,7 +4480,7 @@ s.min=q.isFinite(s.min)?s.min:null,s.max=q.isFinite(s.max)?s.max:null,s.minNotZe
|
|
|
4478
4480
|
e.min=Ir(t.min,e.min),e.max=Ir(t.max,e.max),e.min===e.max&&(0!==e.min&&null!==e.min?(e.min=Math.pow(10,Math.floor(Rr(e.min))-1),e.max=Math.pow(10,Math.floor(Rr(e.max))+1)):(e.min=1,e.max=10)),null===e.min&&(e.min=Math.pow(10,Math.floor(Rr(e.max))-1)),null===e.max&&(e.max=0!==e.min?Math.pow(10,Math.floor(Rr(e.min))+1):10),null===e.minNotZero&&(e.min>0?e.minNotZero=e.min:e.max<1?e.minNotZero=Math.pow(10,Math.floor(Rr(e.max))):e.minNotZero=1)},buildTicks:function(){var e=this,t=e.options.ticks,r=!e.isHorizontal(),n={min:Ir(t.min),max:Ir(t.max)},i=e.ticks=function(e,t){var r,n,i=[],o=Ar(e.min,Math.pow(10,Math.floor(Rr(t.min)))),s=Math.floor(Rr(t.max)),a=Math.ceil(t.max/Math.pow(10,s))
|
|
4479
4481
|
0===o?(r=Math.floor(Rr(t.minNotZero)),n=Math.floor(t.minNotZero/Math.pow(10,r)),i.push(o),o=n*Math.pow(10,r)):(r=Math.floor(Rr(o)),n=Math.floor(o/Math.pow(10,r)))
|
|
4480
4482
|
var l=r<0?Math.pow(10,Math.abs(r)):1
|
|
4481
|
-
do{i.push(o),10
|
|
4483
|
+
do{i.push(o),10===++n&&(n=1,l=++r>=0?1:l),o=Math.round(n*Math.pow(10,r)*l)/l}while(r<s||r===s&&n<a)
|
|
4482
4484
|
var u=Ar(e.max,o)
|
|
4483
4485
|
return i.push(u),i}(n,e)
|
|
4484
4486
|
e.max=q.max(i),e.min=q.min(i),t.reverse?(r=!r,e.start=e.max,e.end=e.min):(e.start=e.min,e.end=e.max),r&&i.reverse()},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),yr.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(e,t){return this._getScaleLabel(this.chart.data.datasets[t].data[e])},getPixelForTick:function(e){var t=this.tickValues
|
|
@@ -9530,4 +9532,4 @@ e.default=class{constructor(e){if(this._data=new t.default,e)for(let t=0;t<e.len
|
|
|
9530
9532
|
return this}get(e){let t=this._data[e]
|
|
9531
9533
|
return t===r.UNDEFINED_KEY?void 0:t}set(e,t){return this._data[e]=t,this}delete(e){return this._data[e]=r.UNDEFINED_KEY,!0}}}))
|
|
9532
9534
|
|
|
9533
|
-
//# sourceMappingURL=vendor-
|
|
9535
|
+
//# sourceMappingURL=vendor-4eea12268950223b9f6bb502155705a3.map
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>Ghost</title>
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22cdnUrl%22%3A%22%22%2C%22editorUrl%22%3A%22%22%2C%22rootURL%22%3A%22%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%225.
|
|
9
|
+
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22cdnUrl%22%3A%22%22%2C%22editorUrl%22%3A%22%22%2C%22rootURL%22%3A%22%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%225.120%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%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%2C%22editorFilename%22%3A%22koenig-lexical.umd.js%22%2C%22editorHash%22%3A%2210c69cd1d2%22%2C%22adminXSettingsFilename%22%3A%22admin-x-settings.js%22%2C%22adminXSettingsHash%22%3A%229883f7a6b7%22%2C%22adminXActivitypubFilename%22%3A%22admin-x-activitypub.js%22%2C%22adminXActivitypubHash%22%3A%224b70ed3fa5%22%2C%22postsFilename%22%3A%22posts.js%22%2C%22postsHash%22%3A%224cb6a562de%22%2C%22statsFilename%22%3A%22stats.js%22%2C%22statsHash%22%3A%22d147424fb5%22%2C%22adminXActivitypubCustomUrl%22%3A%22https%3A%2F%2Fcdn.jsdelivr.net%2Fghost%2Fadmin-x-activitypub%400%2Fdist%2Fadmin-x-activitypub.js%22%7D" />
|
|
10
10
|
|
|
11
11
|
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1, minimal-ui, viewport-fit=cover" />
|
|
12
12
|
<meta name="pinterest" content="nopin" />
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
|
|
48
48
|
<div id="ember-basic-dropdown-wormhole"></div>
|
|
49
49
|
|
|
50
|
-
<script src="assets/vendor-
|
|
51
|
-
<script src="assets/chunk.
|
|
52
|
-
<script src="assets/chunk.524.
|
|
53
|
-
<script src="assets/ghost-
|
|
50
|
+
<script src="assets/vendor-4ce6d282a2a00fe486a0951e0591da19.js"></script>
|
|
51
|
+
<script src="assets/chunk.383.25fca2f09b4896656125.js"></script>
|
|
52
|
+
<script src="assets/chunk.524.1657b12c0ab25dd9fb79.js"></script>
|
|
53
|
+
<script src="assets/ghost-b3b44421acca3b3eec76bfbb6ba0e81b.js"></script>
|
|
54
54
|
</body>
|
|
55
55
|
</html>
|
|
@@ -57,6 +57,12 @@ const handleMatch = (data, operator, value) => {
|
|
|
57
57
|
case '<=':
|
|
58
58
|
result = data <= value;
|
|
59
59
|
break;
|
|
60
|
+
case '~^':
|
|
61
|
+
result = _.isString(data) && _.isString(value) && data.startsWith(value);
|
|
62
|
+
break;
|
|
63
|
+
case '~$':
|
|
64
|
+
result = _.isString(data) && _.isString(value) && data.endsWith(value);
|
|
65
|
+
break;
|
|
60
66
|
default:
|
|
61
67
|
result = data === value;
|
|
62
68
|
}
|
|
@@ -166,7 +166,7 @@ class ParentRouter {
|
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* @description Very important function to get the actual express router, which satisfies express.
|
|
169
|
-
* @returns {
|
|
169
|
+
* @returns {import('express').Router}
|
|
170
170
|
*/
|
|
171
171
|
router() {
|
|
172
172
|
return this._router;
|
|
@@ -51,8 +51,6 @@ module.exports = function emailPostController(req, res, next) {
|
|
|
51
51
|
return urlUtils.redirect301(res, routerManager.getUrlByResourceId(post.id, {withSubdirectory: true}));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
post.access = !!post.html;
|
|
55
|
-
|
|
56
54
|
return renderer.renderEntry(req, res)(post);
|
|
57
55
|
})
|
|
58
56
|
.catch(renderer.handleError(next));
|
|
@@ -27,7 +27,6 @@ module.exports = function previewController(req, res, next) {
|
|
|
27
27
|
.read(params)
|
|
28
28
|
.then(function then(result) {
|
|
29
29
|
const post = result[res.routerOptions.query.resource][0];
|
|
30
|
-
|
|
31
30
|
if (!post) {
|
|
32
31
|
return next();
|
|
33
32
|
}
|
|
@@ -60,8 +59,6 @@ module.exports = function previewController(req, res, next) {
|
|
|
60
59
|
return urlUtils.redirect301(res, urlUtils.urlJoin('/email', post.uuid, '/'));
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
post.access = !!post.html;
|
|
64
|
-
|
|
65
62
|
return renderer.renderEntry(req, res)(post);
|
|
66
63
|
})
|
|
67
64
|
.catch(renderer.handleError(next));
|
|
@@ -15,7 +15,7 @@ function calculateMemberTier(member, freeTier) {
|
|
|
15
15
|
const activeSubscriptions = member.subscriptions.filter(sub => sub.status === 'active');
|
|
16
16
|
if (activeSubscriptions.length === 0) {
|
|
17
17
|
return freeTier;
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
if (activeSubscriptions.length === 1) {
|
|
20
20
|
return activeSubscriptions[0].tier;
|
|
21
21
|
}
|
|
@@ -29,7 +29,7 @@ function calculateMemberTier(member, freeTier) {
|
|
|
29
29
|
/**
|
|
30
30
|
* Returns the frontend caching middleware.
|
|
31
31
|
* @param {GetFreeTier} [getFreeTier] - Async function that takes no arguments and resolves to the free tier object.
|
|
32
|
-
* @returns {
|
|
32
|
+
* @returns {Promise<import('express').RequestHandler>} Middleware function.
|
|
33
33
|
*/
|
|
34
34
|
const getMiddleware = async (getFreeTier = async () => {
|
|
35
35
|
const {tiers} = await api.tiers.browse();
|
|
@@ -84,36 +84,28 @@ const controller = {
|
|
|
84
84
|
headers: {
|
|
85
85
|
cacheInvalidate: true
|
|
86
86
|
},
|
|
87
|
-
permissions: (frame) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
});
|
|
87
|
+
permissions: async (frame) => {
|
|
88
|
+
const owner = await models.User.findOne({role: 'Owner', status: 'all'});
|
|
89
|
+
if (owner.id !== frame.options.context.user) {
|
|
90
|
+
throw new errors.NoPermissionError({message: tpl(messages.notTheBlogOwner)});
|
|
91
|
+
}
|
|
94
92
|
},
|
|
95
93
|
validation: {
|
|
96
94
|
docName: 'setup'
|
|
97
95
|
},
|
|
98
|
-
query(frame) {
|
|
99
|
-
|
|
100
|
-
.then(() => {
|
|
101
|
-
return auth.setup.assertSetupCompleted(true)();
|
|
102
|
-
})
|
|
103
|
-
.then(() => {
|
|
104
|
-
const setupDetails = {
|
|
105
|
-
name: frame.data.setup[0].name,
|
|
106
|
-
email: frame.data.setup[0].email,
|
|
107
|
-
password: frame.data.setup[0].password,
|
|
108
|
-
blogTitle: frame.data.setup[0].blogTitle,
|
|
109
|
-
status: 'active'
|
|
110
|
-
};
|
|
96
|
+
async query(frame) {
|
|
97
|
+
await auth.setup.assertSetupCompleted(true)();
|
|
111
98
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
.
|
|
115
|
-
|
|
116
|
-
|
|
99
|
+
const setupDetails = {
|
|
100
|
+
name: frame.data.setup[0].name,
|
|
101
|
+
email: frame.data.setup[0].email,
|
|
102
|
+
password: frame.data.setup[0].password,
|
|
103
|
+
blogTitle: frame.data.setup[0].blogTitle,
|
|
104
|
+
status: 'active'
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const data = await auth.setup.setupUser(setupDetails);
|
|
108
|
+
return auth.setup.doSettings(data, api.settings);
|
|
117
109
|
}
|
|
118
110
|
},
|
|
119
111
|
|
|
@@ -145,17 +137,10 @@ const controller = {
|
|
|
145
137
|
options: [
|
|
146
138
|
'email'
|
|
147
139
|
],
|
|
148
|
-
query(frame) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
})
|
|
153
|
-
.then(() => {
|
|
154
|
-
return auth.passwordreset.generateToken(frame.data.password_reset[0].email, api.settings);
|
|
155
|
-
})
|
|
156
|
-
.then((token) => {
|
|
157
|
-
return auth.passwordreset.sendResetNotification(token, api.mail);
|
|
158
|
-
});
|
|
140
|
+
async query(frame) {
|
|
141
|
+
await auth.setup.assertSetupCompleted(true)();
|
|
142
|
+
const token = await auth.passwordreset.generateToken(frame.data.password_reset[0].email, api.settings);
|
|
143
|
+
return auth.passwordreset.sendResetNotification(token, api.mail);
|
|
159
144
|
}
|
|
160
145
|
},
|
|
161
146
|
|
|
@@ -174,25 +159,15 @@ const controller = {
|
|
|
174
159
|
options: [
|
|
175
160
|
'ip'
|
|
176
161
|
],
|
|
177
|
-
query(frame) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
return auth.passwordreset.protectBruteForce(params);
|
|
187
|
-
})
|
|
188
|
-
.then(({options, tokenParts}) => {
|
|
189
|
-
options = Object.assign(options, {context: {internal: true}});
|
|
190
|
-
return auth.passwordreset.doReset(options, tokenParts, api.settings)
|
|
191
|
-
.then((params) => {
|
|
192
|
-
web.shared.middleware.api.spamPrevention.userLogin().reset(frame.options.ip, `${tokenParts.email}login`);
|
|
193
|
-
return params;
|
|
194
|
-
});
|
|
195
|
-
});
|
|
162
|
+
async query(frame) {
|
|
163
|
+
await auth.setup.assertSetupCompleted(true)();
|
|
164
|
+
const params = await auth.passwordreset.extractTokenParts(frame);
|
|
165
|
+
const {options, tokenParts} = await auth.passwordreset.protectBruteForce(params);
|
|
166
|
+
const internalOptions = Object.assign(options, {context: {internal: true}});
|
|
167
|
+
|
|
168
|
+
const doResetParams = await auth.passwordreset.doReset(internalOptions, tokenParts, api.settings);
|
|
169
|
+
web.shared.middleware.api.spamPrevention.userLogin().reset(frame.options.ip, `${tokenParts.email}login`);
|
|
170
|
+
return doResetParams;
|
|
196
171
|
}
|
|
197
172
|
},
|
|
198
173
|
|
|
@@ -204,14 +179,9 @@ const controller = {
|
|
|
204
179
|
docName: 'invitations'
|
|
205
180
|
},
|
|
206
181
|
permissions: false,
|
|
207
|
-
query(frame) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return auth.setup.assertSetupCompleted(true)();
|
|
211
|
-
})
|
|
212
|
-
.then(() => {
|
|
213
|
-
return invitations.accept(frame.data);
|
|
214
|
-
});
|
|
182
|
+
async query(frame) {
|
|
183
|
+
await auth.setup.assertSetupCompleted(true)();
|
|
184
|
+
return invitations.accept(frame.data);
|
|
215
185
|
}
|
|
216
186
|
},
|
|
217
187
|
|
|
@@ -226,16 +196,10 @@ const controller = {
|
|
|
226
196
|
docName: 'invitations'
|
|
227
197
|
},
|
|
228
198
|
permissions: false,
|
|
229
|
-
query(frame) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
})
|
|
234
|
-
.then(() => {
|
|
235
|
-
const email = frame.data.email;
|
|
236
|
-
|
|
237
|
-
return models.Invite.findOne({email: email, status: 'sent'}, frame.options);
|
|
238
|
-
});
|
|
199
|
+
async query(frame) {
|
|
200
|
+
await auth.setup.assertSetupCompleted(true)();
|
|
201
|
+
const email = frame.data.email;
|
|
202
|
+
return models.Invite.findOne({email, status: 'sent'}, frame.options);
|
|
239
203
|
}
|
|
240
204
|
},
|
|
241
205
|
|
|
@@ -75,21 +75,20 @@ const controller = {
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
permissions: true,
|
|
78
|
-
query(frame) {
|
|
78
|
+
async query(frame) {
|
|
79
79
|
const options = {
|
|
80
80
|
...frame.options,
|
|
81
81
|
mongoTransformer: rejectPrivateFieldsTransformer
|
|
82
82
|
};
|
|
83
|
-
return models.Author.findOne(frame.data, options)
|
|
84
|
-
.then((model) => {
|
|
85
|
-
if (!model) {
|
|
86
|
-
return Promise.reject(new errors.NotFoundError({
|
|
87
|
-
message: tpl(messages.notFound)
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
83
|
|
|
91
|
-
|
|
84
|
+
const model = await models.Author.findOne(frame.data, options);
|
|
85
|
+
if (!model) {
|
|
86
|
+
throw new errors.NotFoundError({
|
|
87
|
+
message: tpl(messages.notFound)
|
|
92
88
|
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return model;
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
};
|
|
@@ -56,6 +56,7 @@ const controller = {
|
|
|
56
56
|
cacheInvalidate: false
|
|
57
57
|
},
|
|
58
58
|
permissions: true,
|
|
59
|
+
// eslint-disable-next-line ghost/ghost-custom/max-api-complexity
|
|
59
60
|
async query(frame) {
|
|
60
61
|
if (frame.options.filename) {
|
|
61
62
|
let backup = await dbBackup.readBackup(frame.options.filename);
|
|
@@ -67,11 +68,11 @@ const controller = {
|
|
|
67
68
|
return backup;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
try {
|
|
72
|
+
return exporter.doExport({include: frame.options.withRelated});
|
|
73
|
+
} catch (err) {
|
|
74
|
+
throw new errors.InternalServerError({err: err});
|
|
75
|
+
}
|
|
75
76
|
}
|
|
76
77
|
},
|
|
77
78
|
|
|
@@ -132,7 +133,9 @@ const controller = {
|
|
|
132
133
|
},
|
|
133
134
|
statusCode: 204,
|
|
134
135
|
permissions: true,
|
|
135
|
-
query() {
|
|
136
|
+
async query() {
|
|
137
|
+
await dbBackup.backup();
|
|
138
|
+
|
|
136
139
|
/**
|
|
137
140
|
* @NOTE:
|
|
138
141
|
* We fetch all posts with `columns:id` to increase the speed of this endpoint.
|
|
@@ -141,36 +144,32 @@ const controller = {
|
|
|
141
144
|
* - model layer can't trigger event e.g. `post.page` to trigger `post|page.unpublished`.
|
|
142
145
|
* - `onDestroyed` or `onDestroying` can contain custom logic
|
|
143
146
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
.then((response) => {
|
|
155
|
-
return pool(response.models.map(post => () => {
|
|
156
|
-
return models.Post.destroy(Object.assign({id: post.id}, queryOpts));
|
|
157
|
-
}), 100);
|
|
158
|
-
})
|
|
159
|
-
.then(() => models.Tag.findAll(queryOpts))
|
|
160
|
-
.then((response) => {
|
|
161
|
-
return pool(response.models.map(tag => () => {
|
|
162
|
-
return models.Tag.destroy(Object.assign({id: tag.id}, queryOpts));
|
|
163
|
-
}), 100);
|
|
164
|
-
})
|
|
165
|
-
.catch((err) => {
|
|
166
|
-
throw new errors.InternalServerError({
|
|
167
|
-
err: err
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
}
|
|
147
|
+
await models.Base.transaction(async (transacting) => {
|
|
148
|
+
const queryOpts = {
|
|
149
|
+
columns: 'id',
|
|
150
|
+
context: {internal: true},
|
|
151
|
+
destroyAll: true,
|
|
152
|
+
transacting
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
const allPosts = await models.Post.findAll(queryOpts);
|
|
172
157
|
|
|
173
|
-
|
|
158
|
+
await pool(allPosts.map(post => () => {
|
|
159
|
+
return models.Post.destroy(Object.assign({id: post.id}, queryOpts));
|
|
160
|
+
}), 100);
|
|
161
|
+
|
|
162
|
+
const allTags = await models.Tag.findAll(queryOpts);
|
|
163
|
+
|
|
164
|
+
await pool(allTags.map(tag => () => {
|
|
165
|
+
return models.Tag.destroy(Object.assign({id: tag.id}, queryOpts));
|
|
166
|
+
}), 100);
|
|
167
|
+
} catch (err) {
|
|
168
|
+
throw new errors.InternalServerError({
|
|
169
|
+
err
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
175
|
};
|
|
@@ -49,17 +49,15 @@ const controller = {
|
|
|
49
49
|
'id'
|
|
50
50
|
],
|
|
51
51
|
permissions: true,
|
|
52
|
-
query(frame) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
message: tpl(messages.emailNotFound)
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return model;
|
|
52
|
+
async query(frame) {
|
|
53
|
+
const model = await models.Email.findOne(frame.data, frame.options);
|
|
54
|
+
if (!model) {
|
|
55
|
+
throw new errors.NotFoundError({
|
|
56
|
+
message: tpl(messages.emailNotFound)
|
|
62
57
|
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return model;
|
|
63
61
|
}
|
|
64
62
|
},
|
|
65
63
|
|
|
@@ -58,15 +58,16 @@ const controller = {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
|
-
query({data, options}) {
|
|
62
|
-
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
}
|
|
61
|
+
async query({data, options}) {
|
|
62
|
+
try {
|
|
63
|
+
return models.Integration.findOne(data, Object.assign(options, {require: true}));
|
|
64
|
+
} catch (e) {
|
|
65
|
+
if (e instanceof models.Integration.NotFoundError) {
|
|
66
|
+
throw new errors.NotFoundError({
|
|
67
|
+
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
70
71
|
}
|
|
71
72
|
},
|
|
72
73
|
edit: {
|
|
@@ -152,15 +153,16 @@ const controller = {
|
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
},
|
|
155
|
-
query({options}) {
|
|
156
|
-
|
|
157
|
-
.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
})
|
|
162
|
-
}
|
|
163
|
-
}
|
|
156
|
+
async query({options}) {
|
|
157
|
+
try {
|
|
158
|
+
return models.Integration.destroy(Object.assign(options, {require: true}));
|
|
159
|
+
} catch (e) {
|
|
160
|
+
if (e instanceof models.Integration.NotFoundError) {
|
|
161
|
+
throw new errors.NotFoundError({
|
|
162
|
+
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
168
|
};
|
|
@@ -55,17 +55,15 @@ const controller = {
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
permissions: true,
|
|
58
|
-
query(frame) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
message: tpl(messages.inviteNotFound)
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return model;
|
|
58
|
+
async query(frame) {
|
|
59
|
+
const model = await models.Invite.findOne(frame.data, frame.options);
|
|
60
|
+
if (!model) {
|
|
61
|
+
throw new errors.NotFoundError({
|
|
62
|
+
message: tpl(messages.inviteNotFound)
|
|
68
63
|
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return model;
|
|
69
67
|
}
|
|
70
68
|
},
|
|
71
69
|
|
|
@@ -59,17 +59,15 @@ const controller = {
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
permissions: true,
|
|
62
|
-
query(frame) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
message: tpl(messages.labelNotFound)
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return model;
|
|
62
|
+
async query(frame) {
|
|
63
|
+
const model = await models.Label.findOne(frame.data, frame.options);
|
|
64
|
+
if (!model) {
|
|
65
|
+
throw new errors.NotFoundError({
|
|
66
|
+
message: tpl(messages.labelNotFound)
|
|
72
67
|
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return model;
|
|
73
71
|
}
|
|
74
72
|
},
|
|
75
73
|
|
|
@@ -120,21 +118,19 @@ const controller = {
|
|
|
120
118
|
}
|
|
121
119
|
},
|
|
122
120
|
permissions: true,
|
|
123
|
-
query(frame) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
121
|
+
async query(frame) {
|
|
122
|
+
const model = await models.Label.edit(frame.data.labels[0], frame.options);
|
|
123
|
+
if (!model) {
|
|
124
|
+
throw new errors.NotFoundError({
|
|
125
|
+
message: tpl(messages.labelNotFound)
|
|
126
|
+
});
|
|
127
|
+
}
|
|
131
128
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
if (model.wasChanged()) {
|
|
130
|
+
frame.setHeader('X-Cache-Invalidate', '/*');
|
|
131
|
+
}
|
|
135
132
|
|
|
136
|
-
|
|
137
|
-
});
|
|
133
|
+
return model;
|
|
138
134
|
}
|
|
139
135
|
},
|
|
140
136
|
|