From be159630b0f064413a8c9e6b05a8ae9a97cc5ece Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Sat, 26 Feb 2022 22:06:03 +0000 Subject: [PATCH] Bundled output for commit ae96bb504e65b440b5cb0966a0bfcaaa12c18feb Includes transpiled JS/TS. [skip ci] --- js/dist/admin.js | 2 +- js/dist/admin.js.map | 2 +- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/dist/admin.js b/js/dist/admin.js index ba7bedd..29695ef 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -module.exports=function(t){var n={};function a(s){if(n[s])return n[s].exports;var e=n[s]={i:s,l:!1,exports:{}};return t[s].call(e.exports,e,e.exports,a),e.l=!0,e.exports}return a.m=t,a.c=n,a.d=function(t,n,s){a.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:s})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,n){if(1&n&&(t=a(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)a.d(s,e,function(n){return t[n]}.bind(null,e));return s},a.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(n,"a",n),n},a.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},a.p="",a(a.s=25)}([function(t,n){t.exports=flarum.core.compat["common/Model"]},function(t,n){t.exports=flarum.core.compat["common/components/Button"]},function(t,n,a){"use strict";function s(t,n){return(s=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function e(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,s(t,n)}a.d(n,"a",(function(){return e}))},function(t,n){t.exports=flarum.core.compat["common/components/Alert"]},function(t,n){t.exports=flarum.core.compat["common/helpers/punctuateSeries"]},function(t,n,a){"use strict";a.d(n,"a",(function(){return f}));var s=a(2),e=a(8),i=a.n(e),o=a(1),r=a.n(o),p=a(3),d=a.n(p),l=a(6),u=a.n(l),c=a(4),h=a.n(c),f=function(t){function n(){return t.apply(this,arguments)||this}Object(s.a)(n,t);var a=n.prototype;return a.oninit=function(n){if(t.prototype.oninit.call(this,n),this.address=this.attrs.address,this.post=this.attrs.post,this.user=this.attrs.user||this.post&&this.post.user(),!this.user&&this.address){var a=app.store.getBy("banned_ips","address",this.address);a&&(this.user=a.user())}this.banOptions=[],(this.post&&this.post.ipAddress()||this.address)&&this.banOptions.push("only"),this.user&&this.banOptions.push("all"),this.banOption=u()(this.banOptions[0]),this.reason=u()(""),this.otherUsers={},this.loading=!1},a.className=function(){return"Modal--medium"},a.title=function(){return app.translator.trans("fof-ban-ips.lib.modal.title")},a.content=function(){var t=this,n=this.otherUsers[this.banOption()],a=n&&n.map((function(t){return t&&t.displayName()||app.translator.trans("core.lib.username.deleted_text")}));return m("div",{className:"Modal-body"},m("p",null,app.translator.trans("fof-ban-ips.lib.modal.ban_ip_confirmation")),m("div",{className:"Form-group"},this.banOptions.map((function(n){return m("div",null,m("input",{type:"radio",name:"ban-option",id:"ban-option-"+n,checked:t.banOption()===n,onclick:t.banOption.bind(t,n)})," ",m("label",{htmlFor:"ban-option-"+n},app.translator.trans("fof-ban-ips.forum.modal.ban_options_"+n+"_ip",{user:t.user,ip:t.address||t.post&&t.post.ipAddress()})))}))),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-ban-ips.lib.modal.reason_label")),m("input",{type:"text",className:"FormControl",bidi:this.reason})),n?n.length?d.a.component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.ban_ip_users",a.length,{users:h()(a)})):d.a.component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.forum.modal.ban_ip_no_users")):"",n&&m("br",null),m("div",{className:"Form-group"},m(r.a,{className:"Button Button--primary",type:"submit",loading:this.loading},a?app.translator.trans("fof-ban-ips.lib.modal.ban_button"):app.translator.trans("fof-ban-ips.lib.modal.check_button"))))},a.onsubmit=function(t){var n=this;if(t.preventDefault(),this.loading=!0,void 0===this.otherUsers[this.banOption()])return this.getOtherUsers();var a={reason:this.reason(),userId:this.user.id()};"only"===this.banOption()?(a.address=this.post.ipAddress(),app.store.createRecord("banned_ips").save(a).then(this.hide.bind(this)).catch(this.onerror.bind(this)).then(this.loaded.bind(this))):"all"===this.banOption()&&app.request({body:{data:{attributes:a}},url:""+app.forum.attribute("apiUrl")+this.user.apiEndpoint()+"/ban",method:"POST",errorHandler:this.onerror.bind(this)}).then((function(t){return app.store.pushPayload(t).forEach(n.done.bind(n))})).then(this.hide.bind(this)).catch((function(){})).then(this.loaded.bind(this))},a.getOtherUsers=function(){var t=this,n={};"only"===this.banOption()&&(n.ip=this.address||this.post.ipAddress()),app.request({params:n,url:app.forum.attribute("apiUrl")+"/fof/ban-ips/check-users/"+this.user.id(),method:"GET",errorHandler:this.onerror.bind(this)}).then((function(n){t.otherUsers[t.banOption()]=n.data.map((function(t){return app.store.pushObject(t)})).filter((function(t){return 0===t.bannedIPs().length})),t.loading=!1})).catch((function(){})).then(this.loaded.bind(this))},a.done=function(t){var n={type:"banned_ips",id:t.id()};this.post&&(this.post.data.relationships.banned_ip={data:n}),this.user.data.relationships.banned_ips||(this.user.data.relationships.banned_ips={data:[]}),this.user.data.relationships.banned_ips.data.push(n),this.user.data.attributes.isBanned=!0,app.store.pushObject(this.user.data)},n}(i.a)},function(t,n){t.exports=flarum.core.compat["common/utils/Stream"]},function(t,n,a){"use strict";a.d(n,"a",(function(){return l}));var s=a(2),e=a(1),i=a.n(e),o=a(3),r=a.n(o),p=a(4),d=a.n(p),l=(a(11),function(t){function n(){return t.apply(this,arguments)||this}Object(s.a)(n,t);var a=n.prototype;return a.title=function(){return app.translator.trans("fof-ban-ips.lib.modal.unban_title")},a.content=function(){var t=this,n=this.otherUsers[this.banOption()],a=n&&n.map((function(t){return t&&t.displayName()||app.translator.trans("core.lib.username.deleted_text")}));return this.bannedIPs?m("div",{className:"Modal-body"},r.a.component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.lib.modal.unbanned_ips",{ips:d()(this.bannedIPs)}))):m("div",{className:"Modal-body"},m("p",null,app.translator.trans("fof-ban-ips.lib.modal.unban_ip_confirmation")),m("div",{className:"Form-group"},this.banOptions.map((function(n){return m("div",null,m("input",{type:"radio",name:"ban-option",id:"ban-option-"+n,checked:t.banOption()===n,onclick:t.banOption.bind(t,n)})," ",m("label",{htmlFor:"ban-option-"+n},app.translator.trans("fof-ban-ips.lib.modal.unban_options_"+n+"_ip",{user:t.user,ip:t.address||t.post&&t.post.ipAddress()})))}))),n?n.length?r.a.component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.unban_ip_users",a.length,{users:d()(a)})):r.a.component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.lib.modal.unban_ip_no_users")):"",n&&m("br",null),m("div",{className:"Form-group"},m(i.a,{className:"Button Button--primary",type:"submit",loading:this.loading},a?app.translator.trans("fof-ban-ips.lib.modal.unban_button"):app.translator.trans("fof-ban-ips.lib.modal.check_button"))))},a.onsubmit=function(t){if(t.preventDefault(),this.loading=!0,void 0===this.otherUsers[this.banOption()])return this.getOtherUsers();var n={};if("only"===this.banOption()){n.address=this.address||this.post.ipAddress();var a=this.post?this.post.bannedIP():app.store.getBy("banned_ips","address",this.address);a.delete().then(this.done.bind(this,a)).catch(this.onerror.bind(this)).then(this.hide.bind(this))}else"all"===this.banOption()&&app.request({body:{data:{attributes:n}},url:""+app.forum.attribute("apiUrl")+this.user.apiEndpoint()+"/unban",method:"POST",errorHandler:this.onerror.bind(this)}).then(this.done.bind(this)).catch(this.onerror.bind(this)).then(this.hide.bind(this))},a.getOtherUsers=function(){var t=this,n={};"only"===this.banOption()&&(n.ip=this.address||this.post.ipAddress(),n.skipValidation=!0);var a=app.forum.attribute("apiUrl")+"/fof/ban-ips/check-users";this.user&&(a+="/"+this.user.id()),app.request({params:n,url:a,method:"GET",errorHandler:this.onerror.bind(this)}).then((function(n){var a=app.store.pushPayload(n);t.otherUsers[t.banOption()]=a.filter((function(t){return 1===t.bannedIPs().length})),t.loading=!1,m.redraw()})).catch((function(){})).then(this.loaded.bind(this))},a.done=function(t){this.loading=!1,this.post&&delete this.post.data.relationships.banned_ip,!this.user||this.user.data.relationships||t?this.user&&t instanceof app.store.models.banned_ips&&(this.user.data.relationships.banned_ips={data:this.user.data.relationships.banned_ips.data.filter((function(n){return n.id!==t.id()}))},this.user.data.attributes.isBanned=0!==this.user.data.relationships.banned_ips.data.length):(this.user.data.relationships.banned_ips.data=[],this.user.data.attributes.isBanned=!1),t&&Array.isArray(t.data)&&(this.bannedIPs=t.data.map((function(t){return t.attributes.address})),this.loading=!1,m.redraw())},a.hide=function(){t.prototype.hide.call(this),this.attrs.redraw||location.reload()},n}(a(5).a))},function(t,n){t.exports=flarum.core.compat["common/components/Modal"]},function(t,n,a){"use strict";a.d(n,"a",(function(){return r}));var s=a(2),e=a(0),i=a.n(e),o=a(13),r=function(t){function n(){return t.apply(this,arguments)||this}return Object(s.a)(n,t),n.prototype.apiEndpoint=function(){return"/fof/ban-ips"+(this.exists?"/"+this.id():"")},n}(a.n(o)()(i.a,{creator:i.a.hasOne("creator"),user:i.a.hasOne("user"),address:i.a.attribute("address"),reason:i.a.attribute("reason"),createdAt:i.a.attribute("createdAt",i.a.transformDate),deletedAt:i.a.attribute("deletedAt",i.a.transformDate)}))},,function(t,n){t.exports=flarum.core.compat["common/helpers/username"]},function(t,n){t.exports=flarum.core.compat["admin/app"]},function(t,n){t.exports=flarum.core.compat["common/utils/mixin"]},function(t,n,a){"use strict";var s=a(5),e=a(7),i=a(9);n.a={"fof/ban-ips/components/BanIPModal":s.a,"fof/ban-ips/components/UnbanIPModal":e.a,"fof/ban-ips/models/BannedIP":i.a}},function(t,n){t.exports=flarum.core},,,,,,function(t,n){t.exports=flarum.core.compat["common/components/LoadingIndicator"]},function(t,n){t.exports=flarum.core.compat["common/components/Placeholder"]},function(t,n){t.exports=flarum.core.compat["admin/components/ExtensionPage"]},function(t,n){t.exports=flarum.core.compat["common/Component"]},function(t,n,a){"use strict";a.r(n);var s=a(12),e=a.n(s),i=a(0),o=a.n(i),r=a(9),p=a(2),d=a(1),l=a.n(d),u=a(21),c=a.n(u),h=a(22),f=a.n(h),b=a(23),g=a.n(b),_=a(8),v=a.n(_),y=a(3),O=a.n(y),N=a(4),A=a.n(N),P=a(11),x=a.n(P),B=a(6),F=a.n(B),j=function(t){function n(){return t.apply(this,arguments)||this}Object(p.a)(n,t);var a=n.prototype;return a.oninit=function(n){t.prototype.oninit.call(this,n),this.address=F()(""),this.reason=F()(""),this.usersBanned={},this.loading=!1},a.className=function(){return"Modal--medium"},a.title=function(){return app.translator.trans("fof-ban-ips.lib.modal.title")},a.content=function(){var t=this.usersBanned[this.address()],n=t&&t.map(x.a);return m("div",{className:"Modal-body"},m("p",null,app.translator.trans("fof-ban-ips.lib.modal.ban_ip_confirmation")),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-ban-ips.lib.modal.address_label")),m("input",{type:"text",className:"FormControl",bidi:this.address,required:!0,pattern:"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\\-]*[A-Za-z0-9])$|^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$"})),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-ban-ips.lib.modal.reason_label")),m("input",{type:"text",className:"FormControl",bidi:this.reason})),t?t.length?O.a.component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.ban_ip_users",n.length,{users:A()(n)})):O.a.component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.admin.modal.ban_ip_no_users")):"",t&&m("br",null),m("div",{className:"Form-group"},m(l.a,{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:app.store.getBy("banned_ips","address",this.address())},n?app.translator.trans("fof-ban-ips.lib.modal.ban_button"):app.translator.trans("fof-ban-ips.lib.modal.check_button"))))},a.onsubmit=function(t){if(t.preventDefault(),this.address()){if(this.loading=!0,void 0===this.usersBanned[this.address()])return this.getOtherUsers();var n={address:this.address(),reason:this.reason()};app.store.createRecord("banned_ips").save(n).then(this.hide.bind(this),this.onerror.bind(this),this.loaded.bind(this))}},a.getOtherUsers=function(){var t=this,n={ip:this.address()};app.request({params:n,url:app.forum.attribute("apiUrl")+"/fof/ban-ips/check-users",method:"GET"}).then((function(n){t.usersBanned[t.address()]=n.data.map((function(t){return app.store.pushObject(t)})),m.redraw()})).then(this.loaded.bind(this)).catch((function(n){t.onerror(n),t.loading=!1}))},n}(v.a),I=a(24),M=a.n(I),U=a(7),k=function(t){function n(){return t.apply(this,arguments)||this}Object(p.a)(n,t);var a=n.prototype;return a.oninit=function(n){t.prototype.oninit.call(this,n),this.item=this.attrs.item,this.reason=F()(this.item.reason())},a.className=function(){return"Modal--medium"},a.title=function(){return app.translator.trans("fof-ban-ips.admin.modal.update_title")},a.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-ban-ips.lib.modal.reason_label")),m("input",{type:"text",className:"FormControl",bidi:this.reason})),m("div",{className:"Form-group"},m(l.a,{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:this.reason()===this.item.reason()},app.translator.trans("fof-ban-ips.lib.modal.save_button"))))},a.onsubmit=function(t){t.preventDefault(),this.reason()&&(this.loading=!0,this.item.save({reason:this.reason()}).then(this.hide.bind(this)).catch(this.onerror.bind(this)).then(this.loaded.bind(this)))},n}(v.a),S=function(t){function n(){return t.apply(this,arguments)||this}Object(p.a)(n,t);var a=n.prototype;return a.oninit=function(n){t.prototype.oninit.call(this,n),this.item=this.attrs.bannedIP},a.view=function(){var t=this;return m("tr",null,m("td",null,this.item.id()),m("td",null,x()(this.item.creator())),m("td",null,this.item.user()&&x()(this.item.user())),m("td",null,this.item.address()),m("td",null,this.item.reason()),m("td",null,this.item.createdAt().toLocaleDateString()),m("td",null,m("div",{className:"Button--group"},l.a.component({className:"Button Button--warning",icon:"fas fa-pencil-alt",disabled:this.item.creator()!==app.session.user,onclick:function(){return app.modal.show(k,{item:t.item})}}),l.a.component({className:"Button Button--danger",icon:"fas fa-times",onclick:function(){return app.modal.show(U.a,{address:t.item.address(),redraw:!0})}}))))},n}(M.a),w=function(t){function n(){return t.apply(this,arguments)||this}Object(p.a)(n,t);var a=n.prototype;return a.oninit=function(n){t.prototype.oninit.call(this,n),this.loading=!0,this.page=0,this.pageSize=20},a.oncreate=function(n){t.prototype.oncreate.call(this,n),this.refresh()},a.content=function(){var t,n;return!0===this.nextResults&&(t=l.a.component({className:"Button Button--PageList-next",icon:"fas fa-angle-right",onclick:this.loadNext.bind(this)})),!0===this.prevResults&&(n=l.a.component({className:"Button Button--PageList-prev",icon:"fas fa-angle-left",onclick:this.loadPrev.bind(this)})),m("div",{className:"BannedIPsPage"},m("div",{className:"BannedIPsPage-header"},m("div",{className:"container"},l.a.component({className:"Button Button--primary",icon:"fas fa-plus",onclick:function(){return app.modal.show(j)}},app.translator.trans("fof-ban-ips.admin.page.create_button")))),m("br",null),m("div",{className:"BannedIpsPage-table"},m("div",{className:"container"},this.loading?c.a.component():app.store.all("banned_ips").length?m("table",{style:{width:"100%",textAlign:"left"},className:"table"},m("thead",null,m("tr",null,m("th",null,"#"),m("th",null,app.translator.trans("fof-ban-ips.admin.page.creator_label")),m("th",null,app.translator.trans("fof-ban-ips.admin.page.user_label")),m("th",null,app.translator.trans("fof-ban-ips.admin.page.address_label")),m("th",null,app.translator.trans("fof-ban-ips.admin.page.reason_label")),m("th",null,app.translator.trans("fof-ban-ips.admin.page.date_label")),m("th",null))),m("tbody",null,app.store.all("banned_ips").slice(this.page,this.page+this.pageSize).map((function(t){return S.component({bannedIP:t})})))):m("div",null,f.a.component({text:app.translator.trans("fof-ban-ips.admin.empty_text")})))),m("div",null,t,n))},a.refresh=function(){return this.loadResults().then(this.parseResults.bind(this))},a.loadResults=function(){var t=this.page*this.pageSize;return app.store.find("fof/ban-ips",{page:{offset:t,limit:this.pageSize}})},a.loadNext=function(){!0===this.nextResults&&(this.page++,this.refresh())},a.loadPrev=function(){!0===this.prevResults&&(this.page--,this.refresh())},a.parseResults=function(t){this.loading=!1,this.nextResults=!!t.payload.links.next,this.prevResults=!!t.payload.links.prev,m.redraw()},n}(g.a),z=a(14),R=Object.assign(z.a,{"fof/ban-ips/components/BanIPModal":j,"fof/ban-ips/components/ChangeReasonModal":k,"fof/ban-ips/components/SettingsPage":w,"fof/ban-ips/components/SettingsPageItem":S}),C=a(15);e.a.initializers.add("fof/ban-ips",(function(){e.a.store.models.banned_ips=r.a,e.a.store.models.users.prototype.bannedIPs=o.a.hasMany("banned_ips"),e.a.extensionData.for("fof-ban-ips").registerPermission({icon:"fas fa-gavel",label:e.a.translator.trans("fof-ban-ips.admin.permissions.view_banned_ip_list_label"),permission:"fof.ban-ips.viewBannedIPList"},"moderate").registerPermission({icon:"fas fa-gavel",label:e.a.translator.trans("fof-ban-ips.admin.permissions.ban_ip_label"),permission:"fof.ban-ips.banIP"},"moderate").registerPage(w)})),Object.assign(C.compat,R)}]); +(()=>{var t={n:a=>{var s=a&&a.__esModule?()=>a.default:()=>a;return t.d(s,{a:s}),s},d:(a,s)=>{for(var n in s)t.o(s,n)&&!t.o(a,n)&&Object.defineProperty(a,n,{enumerable:!0,get:s[n]})},o:(t,a)=>Object.prototype.hasOwnProperty.call(t,a),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},a={};(()=>{"use strict";t.r(a);const s=flarum.core.compat["admin/app"];var n=t.n(s);const e=flarum.core.compat["common/Model"];var i=t.n(e);function o(t,a){return o=Object.setPrototypeOf||function(t,a){return t.__proto__=a,t},o(t,a)}function r(t,a){t.prototype=Object.create(a.prototype),t.prototype.constructor=t,o(t,a)}const p=flarum.core.compat["common/utils/mixin"];var d=function(t){function a(){return t.apply(this,arguments)||this}return r(a,t),a.prototype.apiEndpoint=function(){return"/fof/ban-ips"+(this.exists?"/"+this.id():"")},a}(t.n(p)()(i(),{creator:i().hasOne("creator"),user:i().hasOne("user"),address:i().attribute("address"),reason:i().attribute("reason"),createdAt:i().attribute("createdAt",i().transformDate),deletedAt:i().attribute("deletedAt",i().transformDate)}));const l=flarum.core.compat["common/components/Button"];var u=t.n(l);const h=flarum.core.compat["common/components/LoadingIndicator"];var c=t.n(h);const b=flarum.core.compat["common/components/Placeholder"];var f=t.n(b);const g=flarum.core.compat["admin/components/ExtensionPage"];var v=t.n(g);const _=flarum.core.compat["common/components/Modal"];var y=t.n(_);const N=flarum.core.compat["common/components/Alert"];var O=t.n(N);const A=flarum.core.compat["common/helpers/punctuateSeries"];var P=t.n(A);const B=flarum.core.compat["common/helpers/username"];var F=t.n(B);const x=flarum.core.compat["common/utils/Stream"];var I=t.n(x),U=function(t){function a(){return t.apply(this,arguments)||this}r(a,t);var s=a.prototype;return s.oninit=function(a){t.prototype.oninit.call(this,a),this.address=I()(""),this.reason=I()(""),this.usersBanned={},this.loading=!1},s.className=function(){return"Modal--medium"},s.title=function(){return app.translator.trans("fof-ban-ips.lib.modal.title")},s.content=function(){var t=this.usersBanned[this.address()],a=t&&t.map(F());return m("div",{className:"Modal-body"},m("p",null,app.translator.trans("fof-ban-ips.lib.modal.ban_ip_confirmation")),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-ban-ips.lib.modal.address_label")),m("input",{type:"text",className:"FormControl",bidi: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6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$"})),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-ban-ips.lib.modal.reason_label")),m("input",{type:"text",className:"FormControl",bidi:this.reason})),t?t.length?O().component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.ban_ip_users",a.length,{users:P()(a)})):O().component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.admin.modal.ban_ip_no_users")):"",t&&m("br",null),m("div",{className:"Form-group"},m(u(),{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:app.store.getBy("banned_ips","address",this.address())},a?app.translator.trans("fof-ban-ips.lib.modal.ban_button"):app.translator.trans("fof-ban-ips.lib.modal.check_button"))))},s.onsubmit=function(t){if(t.preventDefault(),this.address()){if(this.loading=!0,void 0===this.usersBanned[this.address()])return this.getOtherUsers();var a={address:this.address(),reason:this.reason()};app.store.createRecord("banned_ips").save(a).then(this.hide.bind(this),this.onerror.bind(this),this.loaded.bind(this))}},s.getOtherUsers=function(){var t=this,a={ip:this.address()};app.request({params:a,url:app.forum.attribute("apiUrl")+"/fof/ban-ips/check-users",method:"GET"}).then((function(a){t.usersBanned[t.address()]=a.data.map((function(t){return app.store.pushObject(t)})),m.redraw()})).then(this.loaded.bind(this)).catch((function(a){t.onerror(a),t.loading=!1}))},a}(y());const k=flarum.core.compat["common/Component"];var M=t.n(k),S=function(t){function a(){return t.apply(this,arguments)||this}r(a,t);var s=a.prototype;return s.oninit=function(a){if(t.prototype.oninit.call(this,a),this.address=this.attrs.address,this.post=this.attrs.post,this.user=this.attrs.user||this.post&&this.post.user(),!this.user&&this.address){var s=app.store.getBy("banned_ips","address",this.address);s&&(this.user=s.user())}this.banOptions=[],(this.post&&this.post.ipAddress()||this.address)&&this.banOptions.push("only"),this.user&&this.banOptions.push("all"),this.banOption=I()(this.banOptions[0]),this.reason=I()(""),this.otherUsers={},this.loading=!1},s.className=function(){return"Modal--medium"},s.title=function(){return app.translator.trans("fof-ban-ips.lib.modal.title")},s.content=function(){var t=this,a=this.otherUsers[this.banOption()],s=a&&a.map((function(t){return t&&t.displayName()||app.translator.trans("core.lib.username.deleted_text")}));return m("div",{className:"Modal-body"},m("p",null,app.translator.trans("fof-ban-ips.lib.modal.ban_ip_confirmation")),m("div",{className:"Form-group"},this.banOptions.map((function(a){return m("div",null,m("input",{type:"radio",name:"ban-option",id:"ban-option-"+a,checked:t.banOption()===a,onclick:t.banOption.bind(t,a)})," ",m("label",{htmlFor:"ban-option-"+a},app.translator.trans("fof-ban-ips.forum.modal.ban_options_"+a+"_ip",{user:t.user,ip:t.address||t.post&&t.post.ipAddress()})))}))),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-ban-ips.lib.modal.reason_label")),m("input",{type:"text",className:"FormControl",bidi:this.reason})),a?a.length?O().component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.ban_ip_users",s.length,{users:P()(s)})):O().component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.forum.modal.ban_ip_no_users")):"",a&&m("br",null),m("div",{className:"Form-group"},m(u(),{className:"Button Button--primary",type:"submit",loading:this.loading},s?app.translator.trans("fof-ban-ips.lib.modal.ban_button"):app.translator.trans("fof-ban-ips.lib.modal.check_button"))))},s.onsubmit=function(t){var a=this;if(t.preventDefault(),this.loading=!0,void 0===this.otherUsers[this.banOption()])return this.getOtherUsers();var s={reason:this.reason(),userId:this.user.id()};"only"===this.banOption()?(s.address=this.post.ipAddress(),app.store.createRecord("banned_ips").save(s).then(this.hide.bind(this)).catch(this.onerror.bind(this)).then(this.loaded.bind(this))):"all"===this.banOption()&&app.request({body:{data:{attributes:s}},url:""+app.forum.attribute("apiUrl")+this.user.apiEndpoint()+"/ban",method:"POST",errorHandler:this.onerror.bind(this)}).then((function(t){return app.store.pushPayload(t).forEach(a.done.bind(a))})).then(this.hide.bind(this)).catch((function(){})).then(this.loaded.bind(this))},s.getOtherUsers=function(){var t=this,a={};"only"===this.banOption()&&(a.ip=this.address||this.post.ipAddress()),app.request({params:a,url:app.forum.attribute("apiUrl")+"/fof/ban-ips/check-users/"+this.user.id(),method:"GET",errorHandler:this.onerror.bind(this)}).then((function(a){t.otherUsers[t.banOption()]=a.data.map((function(t){return app.store.pushObject(t)})).filter((function(t){return 0===t.bannedIPs().length})),t.loading=!1})).catch((function(){})).then(this.loaded.bind(this))},s.done=function(t){var a={type:"banned_ips",id:t.id()};this.post&&(this.post.data.relationships.banned_ip={data:a}),this.user.data.relationships.banned_ips||(this.user.data.relationships.banned_ips={data:[]}),this.user.data.relationships.banned_ips.data.push(a),this.user.data.attributes.isBanned=!0,app.store.pushObject(this.user.data)},a}(y()),w=function(t){function a(){return t.apply(this,arguments)||this}r(a,t);var s=a.prototype;return s.title=function(){return app.translator.trans("fof-ban-ips.lib.modal.unban_title")},s.content=function(){var t=this,a=this.otherUsers[this.banOption()],s=a&&a.map((function(t){return t&&t.displayName()||app.translator.trans("core.lib.username.deleted_text")}));return this.bannedIPs?m("div",{className:"Modal-body"},O().component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.lib.modal.unbanned_ips",{ips:P()(this.bannedIPs)}))):m("div",{className:"Modal-body"},m("p",null,app.translator.trans("fof-ban-ips.lib.modal.unban_ip_confirmation")),m("div",{className:"Form-group"},this.banOptions.map((function(a){return m("div",null,m("input",{type:"radio",name:"ban-option",id:"ban-option-"+a,checked:t.banOption()===a,onclick:t.banOption.bind(t,a)})," ",m("label",{htmlFor:"ban-option-"+a},app.translator.trans("fof-ban-ips.lib.modal.unban_options_"+a+"_ip",{user:t.user,ip:t.address||t.post&&t.post.ipAddress()})))}))),a?a.length?O().component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.unban_ip_users",s.length,{users:P()(s)})):O().component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.lib.modal.unban_ip_no_users")):"",a&&m("br",null),m("div",{className:"Form-group"},m(u(),{className:"Button Button--primary",type:"submit",loading:this.loading},s?app.translator.trans("fof-ban-ips.lib.modal.unban_button"):app.translator.trans("fof-ban-ips.lib.modal.check_button"))))},s.onsubmit=function(t){if(t.preventDefault(),this.loading=!0,void 0===this.otherUsers[this.banOption()])return this.getOtherUsers();var a={};if("only"===this.banOption()){a.address=this.address||this.post.ipAddress();var s=this.post?this.post.bannedIP():app.store.getBy("banned_ips","address",this.address);s.delete().then(this.done.bind(this,s)).catch(this.onerror.bind(this)).then(this.hide.bind(this))}else"all"===this.banOption()&&app.request({body:{data:{attributes:a}},url:""+app.forum.attribute("apiUrl")+this.user.apiEndpoint()+"/unban",method:"POST",errorHandler:this.onerror.bind(this)}).then(this.done.bind(this)).catch(this.onerror.bind(this)).then(this.hide.bind(this))},s.getOtherUsers=function(){var t=this,a={};"only"===this.banOption()&&(a.ip=this.address||this.post.ipAddress(),a.skipValidation=!0);var s=app.forum.attribute("apiUrl")+"/fof/ban-ips/check-users";this.user&&(s+="/"+this.user.id()),app.request({params:a,url:s,method:"GET",errorHandler:this.onerror.bind(this)}).then((function(a){var s=app.store.pushPayload(a);t.otherUsers[t.banOption()]=s.filter((function(t){return 1===t.bannedIPs().length})),t.loading=!1,m.redraw()})).catch((function(){})).then(this.loaded.bind(this))},s.done=function(t){this.loading=!1,this.post&&delete this.post.data.relationships.banned_ip,!this.user||this.user.data.relationships||t?this.user&&t instanceof app.store.models.banned_ips&&(this.user.data.relationships.banned_ips={data:this.user.data.relationships.banned_ips.data.filter((function(a){return a.id!==t.id()}))},this.user.data.attributes.isBanned=0!==this.user.data.relationships.banned_ips.data.length):(this.user.data.relationships.banned_ips.data=[],this.user.data.attributes.isBanned=!1),t&&Array.isArray(t.data)&&(this.bannedIPs=t.data.map((function(t){return t.attributes.address})),this.loading=!1,m.redraw())},s.hide=function(){t.prototype.hide.call(this),this.attrs.redraw||location.reload()},a}(S),z=function(t){function a(){return t.apply(this,arguments)||this}r(a,t);var s=a.prototype;return s.oninit=function(a){t.prototype.oninit.call(this,a),this.item=this.attrs.item,this.reason=I()(this.item.reason())},s.className=function(){return"Modal--medium"},s.title=function(){return app.translator.trans("fof-ban-ips.admin.modal.update_title")},s.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-ban-ips.lib.modal.reason_label")),m("input",{type:"text",className:"FormControl",bidi:this.reason})),m("div",{className:"Form-group"},m(u(),{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:this.reason()===this.item.reason()},app.translator.trans("fof-ban-ips.lib.modal.save_button"))))},s.onsubmit=function(t){t.preventDefault(),this.reason()&&(this.loading=!0,this.item.save({reason:this.reason()}).then(this.hide.bind(this)).catch(this.onerror.bind(this)).then(this.loaded.bind(this)))},a}(y()),R=function(t){function a(){return t.apply(this,arguments)||this}r(a,t);var s=a.prototype;return s.oninit=function(a){t.prototype.oninit.call(this,a),this.item=this.attrs.bannedIP},s.view=function(){var t=this;return m("tr",null,m("td",null,this.item.id()),m("td",null,F()(this.item.creator())),m("td",null,this.item.user()&&F()(this.item.user())),m("td",null,this.item.address()),m("td",null,this.item.reason()),m("td",null,this.item.createdAt().toLocaleDateString()),m("td",null,m("div",{className:"Button--group"},u().component({className:"Button Button--warning",icon:"fas fa-pencil-alt",disabled:this.item.creator()!==app.session.user,onclick:function(){return app.modal.show(z,{item:t.item})}}),u().component({className:"Button Button--danger",icon:"fas fa-times",onclick:function(){return app.modal.show(w,{address:t.item.address(),redraw:!0})}}))))},a}(M()),j=function(t){function a(){return t.apply(this,arguments)||this}r(a,t);var s=a.prototype;return s.oninit=function(a){t.prototype.oninit.call(this,a),this.loading=!0,this.page=0,this.pageSize=20},s.oncreate=function(a){t.prototype.oncreate.call(this,a),this.refresh()},s.content=function(){var t,a;return!0===this.nextResults&&(t=u().component({className:"Button Button--PageList-next",icon:"fas fa-angle-right",onclick:this.loadNext.bind(this)})),!0===this.prevResults&&(a=u().component({className:"Button Button--PageList-prev",icon:"fas fa-angle-left",onclick:this.loadPrev.bind(this)})),m("div",{className:"BannedIPsPage"},m("div",{className:"BannedIPsPage-header"},m("div",{className:"container"},u().component({className:"Button Button--primary",icon:"fas fa-plus",onclick:function(){return app.modal.show(U)}},app.translator.trans("fof-ban-ips.admin.page.create_button")))),m("br",null),m("div",{className:"BannedIpsPage-table"},m("div",{className:"container"},this.loading?c().component():app.store.all("banned_ips").length?m("table",{style:{width:"100%",textAlign:"left"},className:"table"},m("thead",null,m("tr",null,m("th",null,"#"),m("th",null,app.translator.trans("fof-ban-ips.admin.page.creator_label")),m("th",null,app.translator.trans("fof-ban-ips.admin.page.user_label")),m("th",null,app.translator.trans("fof-ban-ips.admin.page.address_label")),m("th",null,app.translator.trans("fof-ban-ips.admin.page.reason_label")),m("th",null,app.translator.trans("fof-ban-ips.admin.page.date_label")),m("th",null))),m("tbody",null,app.store.all("banned_ips").slice(this.page,this.page+this.pageSize).map((function(t){return R.component({bannedIP:t})})))):m("div",null,f().component({text:app.translator.trans("fof-ban-ips.admin.empty_text")})))),m("div",null,t,a))},s.refresh=function(){return this.loadResults().then(this.parseResults.bind(this))},s.loadResults=function(){var t=this.page*this.pageSize;return app.store.find("fof/ban-ips",{page:{offset:t,limit:this.pageSize}})},s.loadNext=function(){!0===this.nextResults&&(this.page++,this.refresh())},s.loadPrev=function(){!0===this.prevResults&&(this.page--,this.refresh())},s.parseResults=function(t){this.loading=!1,this.nextResults=!!t.payload.links.next,this.prevResults=!!t.payload.links.prev,m.redraw()},a}(v());const C={"fof/ban-ips/components/BanIPModal":S,"fof/ban-ips/components/UnbanIPModal":w,"fof/ban-ips/models/BannedIP":d},D=Object.assign(C,{"fof/ban-ips/components/BanIPModal":U,"fof/ban-ips/components/ChangeReasonModal":z,"fof/ban-ips/components/SettingsPage":j,"fof/ban-ips/components/SettingsPageItem":R}),E=flarum.core;n().initializers.add("fof/ban-ips",(function(){n().store.models.banned_ips=d,n().store.models.users.prototype.bannedIPs=i().hasMany("banned_ips"),n().extensionData.for("fof-ban-ips").registerPermission({icon:"fas fa-gavel",label:n().translator.trans("fof-ban-ips.admin.permissions.view_banned_ip_list_label"),permission:"fof.ban-ips.viewBannedIPList"},"moderate").registerPermission({icon:"fas fa-gavel",label:n().translator.trans("fof-ban-ips.admin.permissions.ban_ip_label"),permission:"fof.ban-ips.banIP"},"moderate").registerPage(j)})),Object.assign(E.compat,D)})(),module.exports=a})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index 97b77f2..7d4caac 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@fof/ban-ips/webpack/bootstrap","webpack://@fof/ban-ips/external \"flarum.core.compat['common/Model']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/components/Button']\"","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/ban-ips/external \"flarum.core.compat['common/components/Alert']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@fof/ban-ips/./src/common/components/BanIPModal.js","webpack://@fof/ban-ips/external \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/ban-ips/./src/common/components/UnbanIPModal.js","webpack://@fof/ban-ips/external \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/ban-ips/./src/common/models/BannedIP.js","webpack://@fof/ban-ips/external \"flarum.core.compat['common/helpers/username']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['admin/app']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/utils/mixin']\"","webpack://@fof/ban-ips/./src/common/compat.js","webpack://@fof/ban-ips/external \"flarum.core\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/components/Placeholder']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/Component']\"","webpack://@fof/ban-ips/./src/admin/components/BanIPModal.js","webpack://@fof/ban-ips/./src/admin/components/ChangeReasonModal.js","webpack://@fof/ban-ips/./src/admin/components/SettingsPageItem.js","webpack://@fof/ban-ips/./src/admin/components/SettingsPage.js","webpack://@fof/ban-ips/./src/admin/compat.js","webpack://@fof/ban-ips/./src/admin/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","BanIPModal","oninit","vnode","this","address","attrs","post","user","bannedIP","app","store","getBy","banOptions","ipAddress","push","banOption","Stream","reason","otherUsers","loading","className","title","translator","trans","content","otherUsersBanned","usernames","map","u","displayName","type","id","checked","onclick","htmlFor","ip","bidi","length","Alert","component","dismissible","transChoice","users","punctuateSeries","onsubmit","e","preventDefault","getOtherUsers","userId","createRecord","save","then","hide","onerror","loaded","request","body","data","attributes","url","forum","attribute","apiEndpoint","method","errorHandler","res","pushPayload","forEach","done","params","pushObject","filter","bannedIPs","obj","relationships","banned_ip","banned_ips","isBanned","Modal","UnbanIPModal","ips","skipValidation","redraw","models","Array","isArray","b","location","reload","BannedIP","exists","mixin","Model","creator","hasOne","createdAt","transformDate","deletedAt","usersBanned","username","required","pattern","disabled","ChangeReasonModal","item","SettingsPageItem","view","toLocaleDateString","Button","icon","session","modal","show","Component","SettingsPage","page","pageSize","oncreate","refresh","next","prev","nextResults","loadNext","prevResults","loadPrev","LoadingIndicator","all","style","width","textAlign","slice","Placeholder","text","loadResults","parseResults","offset","find","limit","results","payload","links","ExtensionPage","assign","initializers","add","hasMany","extensionData","registerPermission","label","permission","registerPage","extCompat"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EA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B,Q,EAS1DkI,YAAA,WACI,IAAME,EAASpI,KAAKgH,KAAOhH,KAAKiH,SAEhC,OAAO3G,IAAIC,MAAM8H,KAAK,cAAe,CAAErB,KAAM,CAAEoB,SAAQE,MAAOtI,KAAKiH,a,EAQvEM,SAAA,YAC6B,IAArBvH,KAAKsH,cACLtH,KAAKgH,OACLhH,KAAKmH,Y,EASbM,SAAA,YAC6B,IAArBzH,KAAKwH,cACLxH,KAAKgH,OACLhH,KAAKmH,Y,EAUbgB,aAAA,SAAaI,GACTvI,KAAKgB,SAAU,EAEfhB,KAAKsH,cAAgBiB,EAAQC,QAAQC,MAAMrB,KAC3CpH,KAAKwH,cAAgBe,EAAQC,QAAQC,MAAMpB,KAE3C9J,EAAEwH,U,GA3IgC2D,K,QCD3B7K,SAAO8K,OAAOtJ,IAAQ,CACjC,oCAAqCQ,EACrC,2CAA4CuG,EAC5C,sCAAuCW,EACvC,0CAA2CT,I,QCL/ChG,IAAIsI,aAAaC,IAAI,eAAe,WAChCvI,IAAIC,MAAMyE,OAAOP,WAAaa,IAE9BhF,IAAIC,MAAMyE,OAAOzC,MAAMxD,UAAUsF,UAAYoB,IAAMqD,QAAQ,cAE3DxI,IAAIyI,cAAJ,IACS,eACJC,mBACG,CACItC,KAAM,eACNuC,MAAO3I,IAAIa,WAAWC,MAAM,2DAC5B8H,WAAY,gCAEhB,YAEHF,mBACG,CACItC,KAAM,eACNuC,MAAO3I,IAAIa,WAAWC,MAAM,8CAC5B8H,WAAY,qBAEhB,YAEHC,aAAapC,MAOtBlJ,OAAO8K,OAAOtJ,SAAQ+J","file":"admin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 25);\n","module.exports = flarum.core.compat['common/Model'];","module.exports = flarum.core.compat['common/components/Button'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","module.exports = flarum.core.compat['common/components/Alert'];","module.exports = flarum.core.compat['common/helpers/punctuateSeries'];","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport Stream from 'flarum/common/utils/Stream';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\n\nexport default class BanIPModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.address = this.attrs.address;\n this.post = this.attrs.post;\n this.user = this.attrs.user || (this.post && this.post.user());\n\n if (!this.user && this.address) {\n const bannedIP = app.store.getBy('banned_ips', 'address', this.address);\n\n if (bannedIP) this.user = bannedIP.user();\n }\n\n this.banOptions = [];\n\n if ((this.post && this.post.ipAddress()) || this.address) this.banOptions.push('only');\n if (this.user) this.banOptions.push('all');\n\n this.banOption = Stream(this.banOptions[0]);\n this.reason = Stream('');\n\n this.otherUsers = {};\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--medium';\n }\n\n title() {\n return app.translator.trans('fof-ban-ips.lib.modal.title');\n }\n\n content() {\n const otherUsersBanned = this.otherUsers[this.banOption()];\n const usernames =\n otherUsersBanned && otherUsersBanned.map((u) => (u && u.displayName()) || app.translator.trans('core.lib.username.deleted_text'));\n\n return (\n
\n

{app.translator.trans('fof-ban-ips.lib.modal.ban_ip_confirmation')}

\n\n
\n {this.banOptions.map((key) => (\n
\n \n  \n \n
\n ))}\n
\n\n
\n \n \n
\n\n {otherUsersBanned\n ? otherUsersBanned.length\n ? Alert.component(\n {\n dismissible: false,\n },\n app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n })\n )\n : Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.forum.modal.ban_ip_no_users')\n )\n : ''}\n\n {otherUsersBanned &&
}\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n if (typeof this.otherUsers[this.banOption()] === 'undefined') return this.getOtherUsers();\n\n const attrs = {\n reason: this.reason(),\n userId: this.user.id(),\n };\n\n if (this.banOption() === 'only') {\n attrs.address = this.post.ipAddress();\n\n app.store.createRecord('banned_ips').save(attrs).then(this.hide.bind(this)).catch(this.onerror.bind(this)).then(this.loaded.bind(this));\n } else if (this.banOption() === 'all') {\n app.request({\n body: {\n data: {\n attributes: attrs,\n },\n },\n url: `${app.forum.attribute('apiUrl')}${this.user.apiEndpoint()}/ban`,\n method: 'POST',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => app.store.pushPayload(res).forEach(this.done.bind(this)))\n .then(this.hide.bind(this))\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n }\n\n getOtherUsers() {\n const data = {};\n\n if (this.banOption() === 'only') data.ip = this.address || this.post.ipAddress();\n\n app.request({\n params: data,\n url: `${app.forum.attribute('apiUrl')}/fof/ban-ips/check-users/${this.user.id()}`,\n method: 'GET',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => {\n this.otherUsers[this.banOption()] = res.data.map((e) => app.store.pushObject(e)).filter((e) => e.bannedIPs().length === 0);\n this.loading = false;\n })\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n\n done(bannedIP) {\n const obj = {\n type: 'banned_ips',\n id: bannedIP.id(),\n };\n\n if (this.post) {\n this.post.data.relationships.banned_ip = {\n data: obj,\n };\n }\n\n if (!this.user.data.relationships.banned_ips)\n this.user.data.relationships.banned_ips = {\n data: [],\n };\n\n this.user.data.relationships.banned_ips.data.push(obj);\n this.user.data.attributes.isBanned = true;\n\n app.store.pushObject(this.user.data);\n }\n}\n","module.exports = flarum.core.compat['common/utils/Stream'];","import Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\n\nimport BanIPModal from './BanIPModal';\n\nexport default class UnbanIPModal extends BanIPModal {\n title() {\n return app.translator.trans('fof-ban-ips.lib.modal.unban_title');\n }\n\n content() {\n const otherUsers = this.otherUsers[this.banOption()];\n const usernames = otherUsers && otherUsers.map((u) => (u && u.displayName()) || app.translator.trans('core.lib.username.deleted_text'));\n\n if (this.bannedIPs) {\n return (\n
\n {Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.lib.modal.unbanned_ips', { ips: punctuateSeries(this.bannedIPs) })\n )}\n
\n );\n }\n\n return (\n
\n

{app.translator.trans('fof-ban-ips.lib.modal.unban_ip_confirmation')}

\n\n
\n {this.banOptions.map((key) => (\n
\n \n  \n \n
\n ))}\n
\n\n {otherUsers\n ? otherUsers.length\n ? Alert.component(\n {\n dismissible: false,\n },\n app.translator.transChoice('fof-ban-ips.lib.modal.unban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n })\n )\n : Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.lib.modal.unban_ip_no_users')\n )\n : ''}\n\n {otherUsers &&
}\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n if (typeof this.otherUsers[this.banOption()] === 'undefined') return this.getOtherUsers();\n\n const attrs = {};\n\n if (this.banOption() === 'only') {\n attrs.address = this.address || this.post.ipAddress();\n\n const bannedIP = this.post ? this.post.bannedIP() : app.store.getBy('banned_ips', 'address', this.address);\n\n bannedIP.delete().then(this.done.bind(this, bannedIP)).catch(this.onerror.bind(this)).then(this.hide.bind(this));\n } else if (this.banOption() === 'all') {\n app.request({\n body: {\n data: {\n attributes: attrs,\n },\n },\n url: `${app.forum.attribute('apiUrl')}${this.user.apiEndpoint()}/unban`,\n method: 'POST',\n errorHandler: this.onerror.bind(this),\n })\n .then(this.done.bind(this))\n .catch(this.onerror.bind(this))\n .then(this.hide.bind(this));\n }\n }\n\n getOtherUsers() {\n const data = {};\n\n if (this.banOption() === 'only') {\n data.ip = this.address || this.post.ipAddress();\n data.skipValidation = true;\n }\n\n let url = `${app.forum.attribute('apiUrl')}/fof/ban-ips/check-users`;\n\n if (this.user) url += `/${this.user.id()}`;\n\n app.request({\n params: data,\n url: url,\n method: 'GET',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => {\n const data = app.store.pushPayload(res);\n\n this.otherUsers[this.banOption()] = data.filter((e) => e.bannedIPs().length === 1);\n this.loading = false;\n\n m.redraw();\n })\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n\n done(bannedIP) {\n this.loading = false;\n\n if (this.post) delete this.post.data.relationships.banned_ip;\n\n if (this.user && !this.user.data.relationships && !bannedIP) {\n this.user.data.relationships.banned_ips.data = [];\n this.user.data.attributes.isBanned = false;\n } else if (this.user && bannedIP instanceof app.store.models.banned_ips) {\n this.user.data.relationships.banned_ips = {\n data: this.user.data.relationships.banned_ips.data.filter((e) => e.id !== bannedIP.id()),\n };\n this.user.data.attributes.isBanned = this.user.data.relationships.banned_ips.data.length !== 0;\n }\n\n if (bannedIP && Array.isArray(bannedIP.data)) {\n this.bannedIPs = bannedIP.data.map((b) => b.attributes.address);\n this.loading = false;\n\n m.redraw();\n }\n }\n\n hide() {\n super.hide();\n\n if (!this.attrs.redraw) {\n location.reload();\n }\n }\n}\n","module.exports = flarum.core.compat['common/components/Modal'];","import Model from 'flarum/common/Model';\nimport mixin from 'flarum/common/utils/mixin';\n\nexport default class BannedIP extends mixin(Model, {\n creator: Model.hasOne('creator'),\n user: Model.hasOne('user'),\n address: Model.attribute('address'),\n reason: Model.attribute('reason'),\n createdAt: Model.attribute('createdAt', Model.transformDate),\n deletedAt: Model.attribute('deletedAt', Model.transformDate),\n}) {\n apiEndpoint() {\n return `/fof/ban-ips${this.exists ? `/${this.id()}` : ''}`;\n }\n}\n","module.exports = flarum.core.compat['common/helpers/username'];","module.exports = flarum.core.compat['admin/app'];","module.exports = flarum.core.compat['common/utils/mixin'];","import BanIPModal from './components/BanIPModal';\nimport UnbanIPModal from './components/UnbanIPModal';\nimport BannedIP from './models/BannedIP';\n\nexport default {\n 'fof/ban-ips/components/BanIPModal': BanIPModal,\n 'fof/ban-ips/components/UnbanIPModal': UnbanIPModal,\n 'fof/ban-ips/models/BannedIP': BannedIP,\n};\n","module.exports = flarum.core;","module.exports = flarum.core.compat['common/components/LoadingIndicator'];","module.exports = flarum.core.compat['common/components/Placeholder'];","module.exports = flarum.core.compat['admin/components/ExtensionPage'];","module.exports = flarum.core.compat['common/Component'];","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\nimport Stream from 'flarum/common/utils/Stream';\n\nexport default class BanIPModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.address = Stream('');\n this.reason = Stream('');\n\n this.usersBanned = {};\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--medium';\n }\n\n title() {\n return app.translator.trans('fof-ban-ips.lib.modal.title');\n }\n\n content() {\n const usersBanned = this.usersBanned[this.address()];\n const usernames = usersBanned && usersBanned.map(username);\n\n return (\n
\n

{app.translator.trans('fof-ban-ips.lib.modal.ban_ip_confirmation')}

\n\n
\n \n \n
\n\n
\n \n \n
\n\n {usersBanned\n ? usersBanned.length\n ? Alert.component(\n {\n dismissible: false,\n },\n app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n })\n )\n : Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.admin.modal.ban_ip_no_users')\n )\n : ''}\n\n {usersBanned &&
}\n\n
\n \n {usernames\n ? app.translator.trans('fof-ban-ips.lib.modal.ban_button')\n : app.translator.trans('fof-ban-ips.lib.modal.check_button')}\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (!this.address()) return;\n\n this.loading = true;\n\n if (typeof this.usersBanned[this.address()] === 'undefined') return this.getOtherUsers();\n\n const attrs = {\n address: this.address(),\n reason: this.reason(),\n };\n\n app.store.createRecord('banned_ips').save(attrs).then(this.hide.bind(this), this.onerror.bind(this), this.loaded.bind(this));\n }\n\n getOtherUsers() {\n const data = {\n ip: this.address(),\n };\n\n app.request({\n params: data,\n url: `${app.forum.attribute('apiUrl')}/fof/ban-ips/check-users`,\n method: 'GET',\n })\n .then((res) => {\n this.usersBanned[this.address()] = res.data.map((e) => app.store.pushObject(e));\n\n m.redraw();\n })\n .then(this.loaded.bind(this))\n .catch((e) => {\n this.onerror(e);\n this.loading = false;\n });\n }\n}\n","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Stream from 'flarum/common/utils/Stream';\n\nexport default class ChangeReasonModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.item = this.attrs.item;\n\n this.reason = Stream(this.item.reason());\n }\n\n className() {\n return 'Modal--medium';\n }\n\n title() {\n return app.translator.trans('fof-ban-ips.admin.modal.update_title');\n }\n\n content() {\n return (\n
\n
\n \n \n
\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (!this.reason()) return;\n\n this.loading = true;\n\n this.item\n .save({\n reason: this.reason(),\n })\n .then(this.hide.bind(this))\n .catch(this.onerror.bind(this))\n .then(this.loaded.bind(this));\n }\n}\n","import Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport username from 'flarum/common/helpers/username';\n\nimport UnbanIPModal from '../../common/components/UnbanIPModal';\nimport ChangeReasonModal from './ChangeReasonModal';\n\nexport default class SettingsPageItem extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.item = this.attrs.bannedIP;\n }\n\n view() {\n return (\n \n {this.item.id()}\n {username(this.item.creator())}\n {this.item.user() && username(this.item.user())}\n {this.item.address()}\n {this.item.reason()}\n {this.item.createdAt().toLocaleDateString()}\n \n
\n {Button.component({\n className: 'Button Button--warning',\n icon: 'fas fa-pencil-alt',\n disabled: this.item.creator() !== app.session.user,\n onclick: () => app.modal.show(ChangeReasonModal, { item: this.item }),\n })}\n {Button.component({\n className: 'Button Button--danger',\n icon: 'fas fa-times',\n onclick: () => app.modal.show(UnbanIPModal, { address: this.item.address(), redraw: true }),\n })}\n
\n \n \n );\n }\n}\n","import Button from 'flarum/common/components/Button';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Placeholder from 'flarum/common/components/Placeholder';\nimport ExtensionPage from 'flarum/admin/components/ExtensionPage';\n\nimport BanIPModal from './BanIPModal';\nimport SettingsPageItem from './SettingsPageItem';\n\nexport default class SettingsPage extends ExtensionPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = true;\n\n this.page = 0;\n this.pageSize = 20;\n }\n\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.refresh();\n }\n\n content() {\n let next, prev;\n\n if (this.nextResults === true) {\n next = Button.component({\n className: 'Button Button--PageList-next',\n icon: 'fas fa-angle-right',\n onclick: this.loadNext.bind(this),\n });\n }\n\n if (this.prevResults === true) {\n prev = Button.component({\n className: 'Button Button--PageList-prev',\n icon: 'fas fa-angle-left',\n onclick: this.loadPrev.bind(this),\n });\n }\n\n return (\n
\n
\n
\n {Button.component(\n {\n className: 'Button Button--primary',\n icon: 'fas fa-plus',\n onclick: () => app.modal.show(BanIPModal),\n },\n app.translator.trans('fof-ban-ips.admin.page.create_button')\n )}\n
\n
\n
\n
\n
\n {this.loading ? (\n LoadingIndicator.component()\n ) : app.store.all('banned_ips').length ? (\n \n \n \n \n \n \n \n \n \n \n \n \n {app.store\n .all('banned_ips')\n .slice(this.page, this.page + this.pageSize)\n .map((bannedIP) => SettingsPageItem.component({ bannedIP }))}\n \n
#{app.translator.trans('fof-ban-ips.admin.page.creator_label')}{app.translator.trans('fof-ban-ips.admin.page.user_label')}{app.translator.trans('fof-ban-ips.admin.page.address_label')}{app.translator.trans('fof-ban-ips.admin.page.reason_label')}{app.translator.trans('fof-ban-ips.admin.page.date_label')}\n
\n ) : (\n
{Placeholder.component({ text: app.translator.trans('fof-ban-ips.admin.empty_text') })}
\n )}\n
\n
\n
\n {next}\n {prev}\n
\n
\n );\n }\n\n refresh() {\n return this.loadResults().then(this.parseResults.bind(this));\n }\n\n /**\n * Load a new page of Pages results.\n *\n * @param {Integer} page number.\n * @return {Promise}\n */\n loadResults() {\n const offset = this.page * this.pageSize;\n\n return app.store.find('fof/ban-ips', { page: { offset, limit: this.pageSize } });\n }\n\n /**\n * Load the next page of results.\n *\n * @public\n */\n loadNext() {\n if (this.nextResults === true) {\n this.page++;\n this.refresh();\n }\n }\n\n /**\n * Load the previous page of results.\n *\n * @public\n */\n loadPrev() {\n if (this.prevResults === true) {\n this.page--;\n this.refresh();\n }\n }\n\n /**\n * Parse results and append them to the page list.\n *\n * @param {Page[]} results\n * @return {Page[]}\n */\n parseResults(results) {\n this.loading = false;\n\n this.nextResults = !!results.payload.links.next;\n this.prevResults = !!results.payload.links.prev;\n\n m.redraw();\n }\n}\n","import compat from '../common/compat';\n\nimport BanIPModal from './components/BanIPModal';\nimport ChangeReasonModal from './components/ChangeReasonModal';\nimport SettingsPage from './components/SettingsPage';\nimport SettingsPageItem from './components/SettingsPageItem';\n\nexport default Object.assign(compat, {\n 'fof/ban-ips/components/BanIPModal': BanIPModal,\n 'fof/ban-ips/components/ChangeReasonModal': ChangeReasonModal,\n 'fof/ban-ips/components/SettingsPage': SettingsPage,\n 'fof/ban-ips/components/SettingsPageItem': SettingsPageItem,\n});\n","import app from 'flarum/admin/app';\nimport Model from 'flarum/common/Model';\n\nimport BannedIP from '../common/models/BannedIP';\nimport SettingsPage from './components/SettingsPage';\n\napp.initializers.add('fof/ban-ips', () => {\n app.store.models.banned_ips = BannedIP;\n\n app.store.models.users.prototype.bannedIPs = Model.hasMany('banned_ips');\n\n app.extensionData\n .for('fof-ban-ips')\n .registerPermission(\n {\n icon: 'fas fa-gavel',\n label: app.translator.trans('fof-ban-ips.admin.permissions.view_banned_ip_list_label'),\n permission: 'fof.ban-ips.viewBannedIPList',\n },\n 'moderate'\n )\n .registerPermission(\n {\n icon: 'fas fa-gavel',\n label: app.translator.trans('fof-ban-ips.admin.permissions.ban_ip_label'),\n permission: 'fof.ban-ips.banIP',\n },\n 'moderate'\n )\n .registerPage(SettingsPage);\n});\n\n// Expose compat API\nimport extCompat from './compat';\nimport { compat } from '@flarum/core/admin';\n\nObject.assign(compat, extCompat);\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,M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YAC2B,IAArBvH,KAAKsH,cACPtH,KAAKgH,OACLhH,KAAKmH,Y,EASTM,SAAA,YAC2B,IAArBzH,KAAKwH,cACPxH,KAAKgH,OACLhH,KAAKmH,Y,EAUTiB,aAAA,SAAaI,GACXxI,KAAKgB,SAAU,EAEfhB,KAAKsH,cAAgBkB,EAAQC,QAAQC,MAAMtB,KAC3CpH,KAAKwH,cAAgBgB,EAAQC,QAAQC,MAAMrB,KAE3CxD,EAAEC,U,EA3IeiD,CAAqB4B,KCJ1C,SACE,oCAAqChI,EACrC,sCAAuCgF,EACvC,8BAA+B7F,GCAjC,EAAexB,OAAOsK,OAAOxJ,EAAQ,CACnC,oCAAqCuB,EACrC,2CAA4CyF,EAC5C,sCAAuCW,EACvC,0CAA2CT,ICXvC,EAA+BpH,OAAOC,KCM5CgC,IAAAA,aAAAA,IAAqB,eAAe,WAClCA,IAAAA,MAAAA,OAAAA,WAA8BrB,EAE9BqB,IAAAA,MAAAA,OAAAA,MAAAA,UAAAA,UAA6Cf,IAAAA,QAAc,cAE3De,IAAAA,cAAAA,IACO,eACJ0H,mBACC,CACEnC,KAAM,eACNoC,MAAO3H,IAAAA,WAAAA,MAAqB,2DAC5B4H,WAAY,gCAEd,YAEDF,mBACC,CACEnC,KAAM,eACNoC,MAAO3H,IAAAA,WAAAA,MAAqB,8CAC5B4H,WAAY,qBAEd,YAEDC,aAAajC,MAOlBzI,OAAOsK,OAAOxJ,EAAAA,OAAQ6J,I","sources":["webpack://@fof/ban-ips/webpack/bootstrap","webpack://@fof/ban-ips/webpack/runtime/compat get default export","webpack://@fof/ban-ips/webpack/runtime/define property getters","webpack://@fof/ban-ips/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/ban-ips/webpack/runtime/make namespace object","webpack://@fof/ban-ips/external root \"flarum.core.compat['admin/app']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/Model']\"","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/utils/mixin']\"","webpack://@fof/ban-ips/./src/common/models/BannedIP.js","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/components/Button']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/components/Placeholder']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/components/Alert']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/ban-ips/./src/admin/components/BanIPModal.js","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/Component']\"","webpack://@fof/ban-ips/./src/common/components/BanIPModal.js","webpack://@fof/ban-ips/./src/common/components/UnbanIPModal.js","webpack://@fof/ban-ips/./src/admin/components/ChangeReasonModal.js","webpack://@fof/ban-ips/./src/admin/components/SettingsPageItem.js","webpack://@fof/ban-ips/./src/admin/components/SettingsPage.js","webpack://@fof/ban-ips/./src/common/compat.js","webpack://@fof/ban-ips/./src/admin/compat.js","webpack://@fof/ban-ips/external assign \"flarum.core\"","webpack://@fof/ban-ips/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/mixin'];","import Model from 'flarum/common/Model';\nimport mixin from 'flarum/common/utils/mixin';\n\nexport default class BannedIP extends mixin(Model, {\n creator: Model.hasOne('creator'),\n user: Model.hasOne('user'),\n address: Model.attribute('address'),\n reason: Model.attribute('reason'),\n createdAt: Model.attribute('createdAt', Model.transformDate),\n deletedAt: Model.attribute('deletedAt', Model.transformDate),\n}) {\n apiEndpoint() {\n return `/fof/ban-ips${this.exists ? `/${this.id()}` : ''}`;\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Placeholder'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/ExtensionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Alert'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/punctuateSeries'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\nimport Stream from 'flarum/common/utils/Stream';\n\nexport default class BanIPModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.address = Stream('');\n this.reason = Stream('');\n\n this.usersBanned = {};\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--medium';\n }\n\n title() {\n return app.translator.trans('fof-ban-ips.lib.modal.title');\n }\n\n content() {\n const usersBanned = this.usersBanned[this.address()];\n const usernames = usersBanned && usersBanned.map(username);\n\n return (\n
\n

{app.translator.trans('fof-ban-ips.lib.modal.ban_ip_confirmation')}

\n\n
\n \n \n
\n\n
\n \n \n
\n\n {usersBanned\n ? usersBanned.length\n ? Alert.component(\n {\n dismissible: false,\n },\n app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n })\n )\n : Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.admin.modal.ban_ip_no_users')\n )\n : ''}\n\n {usersBanned &&
}\n\n
\n \n {usernames ? app.translator.trans('fof-ban-ips.lib.modal.ban_button') : app.translator.trans('fof-ban-ips.lib.modal.check_button')}\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (!this.address()) return;\n\n this.loading = true;\n\n if (typeof this.usersBanned[this.address()] === 'undefined') return this.getOtherUsers();\n\n const attrs = {\n address: this.address(),\n reason: this.reason(),\n };\n\n app.store.createRecord('banned_ips').save(attrs).then(this.hide.bind(this), this.onerror.bind(this), this.loaded.bind(this));\n }\n\n getOtherUsers() {\n const data = {\n ip: this.address(),\n };\n\n app\n .request({\n params: data,\n url: `${app.forum.attribute('apiUrl')}/fof/ban-ips/check-users`,\n method: 'GET',\n })\n .then((res) => {\n this.usersBanned[this.address()] = res.data.map((e) => app.store.pushObject(e));\n\n m.redraw();\n })\n .then(this.loaded.bind(this))\n .catch((e) => {\n this.onerror(e);\n this.loading = false;\n });\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport Stream from 'flarum/common/utils/Stream';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\n\nexport default class BanIPModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.address = this.attrs.address;\n this.post = this.attrs.post;\n this.user = this.attrs.user || (this.post && this.post.user());\n\n if (!this.user && this.address) {\n const bannedIP = app.store.getBy('banned_ips', 'address', this.address);\n\n if (bannedIP) this.user = bannedIP.user();\n }\n\n this.banOptions = [];\n\n if ((this.post && this.post.ipAddress()) || this.address) this.banOptions.push('only');\n if (this.user) this.banOptions.push('all');\n\n this.banOption = Stream(this.banOptions[0]);\n this.reason = Stream('');\n\n this.otherUsers = {};\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--medium';\n }\n\n title() {\n return app.translator.trans('fof-ban-ips.lib.modal.title');\n }\n\n content() {\n const otherUsersBanned = this.otherUsers[this.banOption()];\n const usernames =\n otherUsersBanned && otherUsersBanned.map((u) => (u && u.displayName()) || app.translator.trans('core.lib.username.deleted_text'));\n\n return (\n
\n

{app.translator.trans('fof-ban-ips.lib.modal.ban_ip_confirmation')}

\n\n
\n {this.banOptions.map((key) => (\n
\n \n  \n \n
\n ))}\n
\n\n
\n \n \n
\n\n {otherUsersBanned\n ? otherUsersBanned.length\n ? Alert.component(\n {\n dismissible: false,\n },\n app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n })\n )\n : Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.forum.modal.ban_ip_no_users')\n )\n : ''}\n\n {otherUsersBanned &&
}\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n if (typeof this.otherUsers[this.banOption()] === 'undefined') return this.getOtherUsers();\n\n const attrs = {\n reason: this.reason(),\n userId: this.user.id(),\n };\n\n if (this.banOption() === 'only') {\n attrs.address = this.post.ipAddress();\n\n app.store.createRecord('banned_ips').save(attrs).then(this.hide.bind(this)).catch(this.onerror.bind(this)).then(this.loaded.bind(this));\n } else if (this.banOption() === 'all') {\n app\n .request({\n body: {\n data: {\n attributes: attrs,\n },\n },\n url: `${app.forum.attribute('apiUrl')}${this.user.apiEndpoint()}/ban`,\n method: 'POST',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => app.store.pushPayload(res).forEach(this.done.bind(this)))\n .then(this.hide.bind(this))\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n }\n\n getOtherUsers() {\n const data = {};\n\n if (this.banOption() === 'only') data.ip = this.address || this.post.ipAddress();\n\n app\n .request({\n params: data,\n url: `${app.forum.attribute('apiUrl')}/fof/ban-ips/check-users/${this.user.id()}`,\n method: 'GET',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => {\n this.otherUsers[this.banOption()] = res.data.map((e) => app.store.pushObject(e)).filter((e) => e.bannedIPs().length === 0);\n this.loading = false;\n })\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n\n done(bannedIP) {\n const obj = {\n type: 'banned_ips',\n id: bannedIP.id(),\n };\n\n if (this.post) {\n this.post.data.relationships.banned_ip = {\n data: obj,\n };\n }\n\n if (!this.user.data.relationships.banned_ips)\n this.user.data.relationships.banned_ips = {\n data: [],\n };\n\n this.user.data.relationships.banned_ips.data.push(obj);\n this.user.data.attributes.isBanned = true;\n\n app.store.pushObject(this.user.data);\n }\n}\n","import Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\n\nimport BanIPModal from './BanIPModal';\n\nexport default class UnbanIPModal extends BanIPModal {\n title() {\n return app.translator.trans('fof-ban-ips.lib.modal.unban_title');\n }\n\n content() {\n const otherUsers = this.otherUsers[this.banOption()];\n const usernames = otherUsers && otherUsers.map((u) => (u && u.displayName()) || app.translator.trans('core.lib.username.deleted_text'));\n\n if (this.bannedIPs) {\n return (\n
\n {Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.lib.modal.unbanned_ips', { ips: punctuateSeries(this.bannedIPs) })\n )}\n
\n );\n }\n\n return (\n
\n

{app.translator.trans('fof-ban-ips.lib.modal.unban_ip_confirmation')}

\n\n
\n {this.banOptions.map((key) => (\n
\n \n  \n \n
\n ))}\n
\n\n {otherUsers\n ? otherUsers.length\n ? Alert.component(\n {\n dismissible: false,\n },\n app.translator.transChoice('fof-ban-ips.lib.modal.unban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n })\n )\n : Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.lib.modal.unban_ip_no_users')\n )\n : ''}\n\n {otherUsers &&
}\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n if (typeof this.otherUsers[this.banOption()] === 'undefined') return this.getOtherUsers();\n\n const attrs = {};\n\n if (this.banOption() === 'only') {\n attrs.address = this.address || this.post.ipAddress();\n\n const bannedIP = this.post ? this.post.bannedIP() : app.store.getBy('banned_ips', 'address', this.address);\n\n bannedIP.delete().then(this.done.bind(this, bannedIP)).catch(this.onerror.bind(this)).then(this.hide.bind(this));\n } else if (this.banOption() === 'all') {\n app\n .request({\n body: {\n data: {\n attributes: attrs,\n },\n },\n url: `${app.forum.attribute('apiUrl')}${this.user.apiEndpoint()}/unban`,\n method: 'POST',\n errorHandler: this.onerror.bind(this),\n })\n .then(this.done.bind(this))\n .catch(this.onerror.bind(this))\n .then(this.hide.bind(this));\n }\n }\n\n getOtherUsers() {\n const data = {};\n\n if (this.banOption() === 'only') {\n data.ip = this.address || this.post.ipAddress();\n data.skipValidation = true;\n }\n\n let url = `${app.forum.attribute('apiUrl')}/fof/ban-ips/check-users`;\n\n if (this.user) url += `/${this.user.id()}`;\n\n app\n .request({\n params: data,\n url: url,\n method: 'GET',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => {\n const data = app.store.pushPayload(res);\n\n this.otherUsers[this.banOption()] = data.filter((e) => e.bannedIPs().length === 1);\n this.loading = false;\n\n m.redraw();\n })\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n\n done(bannedIP) {\n this.loading = false;\n\n if (this.post) delete this.post.data.relationships.banned_ip;\n\n if (this.user && !this.user.data.relationships && !bannedIP) {\n this.user.data.relationships.banned_ips.data = [];\n this.user.data.attributes.isBanned = false;\n } else if (this.user && bannedIP instanceof app.store.models.banned_ips) {\n this.user.data.relationships.banned_ips = {\n data: this.user.data.relationships.banned_ips.data.filter((e) => e.id !== bannedIP.id()),\n };\n this.user.data.attributes.isBanned = this.user.data.relationships.banned_ips.data.length !== 0;\n }\n\n if (bannedIP && Array.isArray(bannedIP.data)) {\n this.bannedIPs = bannedIP.data.map((b) => b.attributes.address);\n this.loading = false;\n\n m.redraw();\n }\n }\n\n hide() {\n super.hide();\n\n if (!this.attrs.redraw) {\n location.reload();\n }\n }\n}\n","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Stream from 'flarum/common/utils/Stream';\n\nexport default class ChangeReasonModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.item = this.attrs.item;\n\n this.reason = Stream(this.item.reason());\n }\n\n className() {\n return 'Modal--medium';\n }\n\n title() {\n return app.translator.trans('fof-ban-ips.admin.modal.update_title');\n }\n\n content() {\n return (\n
\n
\n \n \n
\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (!this.reason()) return;\n\n this.loading = true;\n\n this.item\n .save({\n reason: this.reason(),\n })\n .then(this.hide.bind(this))\n .catch(this.onerror.bind(this))\n .then(this.loaded.bind(this));\n }\n}\n","import Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport username from 'flarum/common/helpers/username';\n\nimport UnbanIPModal from '../../common/components/UnbanIPModal';\nimport ChangeReasonModal from './ChangeReasonModal';\n\nexport default class SettingsPageItem extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.item = this.attrs.bannedIP;\n }\n\n view() {\n return (\n \n {this.item.id()}\n {username(this.item.creator())}\n {this.item.user() && username(this.item.user())}\n {this.item.address()}\n {this.item.reason()}\n {this.item.createdAt().toLocaleDateString()}\n \n
\n {Button.component({\n className: 'Button Button--warning',\n icon: 'fas fa-pencil-alt',\n disabled: this.item.creator() !== app.session.user,\n onclick: () => app.modal.show(ChangeReasonModal, { item: this.item }),\n })}\n {Button.component({\n className: 'Button Button--danger',\n icon: 'fas fa-times',\n onclick: () => app.modal.show(UnbanIPModal, { address: this.item.address(), redraw: true }),\n })}\n
\n \n \n );\n }\n}\n","import Button from 'flarum/common/components/Button';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Placeholder from 'flarum/common/components/Placeholder';\nimport ExtensionPage from 'flarum/admin/components/ExtensionPage';\n\nimport BanIPModal from './BanIPModal';\nimport SettingsPageItem from './SettingsPageItem';\n\nexport default class SettingsPage extends ExtensionPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = true;\n\n this.page = 0;\n this.pageSize = 20;\n }\n\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.refresh();\n }\n\n content() {\n let next, prev;\n\n if (this.nextResults === true) {\n next = Button.component({\n className: 'Button Button--PageList-next',\n icon: 'fas fa-angle-right',\n onclick: this.loadNext.bind(this),\n });\n }\n\n if (this.prevResults === true) {\n prev = Button.component({\n className: 'Button Button--PageList-prev',\n icon: 'fas fa-angle-left',\n onclick: this.loadPrev.bind(this),\n });\n }\n\n return (\n
\n
\n
\n {Button.component(\n {\n className: 'Button Button--primary',\n icon: 'fas fa-plus',\n onclick: () => app.modal.show(BanIPModal),\n },\n app.translator.trans('fof-ban-ips.admin.page.create_button')\n )}\n
\n
\n
\n
\n
\n {this.loading ? (\n LoadingIndicator.component()\n ) : app.store.all('banned_ips').length ? (\n \n \n \n \n \n \n \n \n \n \n \n \n {app.store\n .all('banned_ips')\n .slice(this.page, this.page + this.pageSize)\n .map((bannedIP) => SettingsPageItem.component({ bannedIP }))}\n \n
#{app.translator.trans('fof-ban-ips.admin.page.creator_label')}{app.translator.trans('fof-ban-ips.admin.page.user_label')}{app.translator.trans('fof-ban-ips.admin.page.address_label')}{app.translator.trans('fof-ban-ips.admin.page.reason_label')}{app.translator.trans('fof-ban-ips.admin.page.date_label')}\n
\n ) : (\n
{Placeholder.component({ text: app.translator.trans('fof-ban-ips.admin.empty_text') })}
\n )}\n
\n
\n
\n {next}\n {prev}\n
\n
\n );\n }\n\n refresh() {\n return this.loadResults().then(this.parseResults.bind(this));\n }\n\n /**\n * Load a new page of Pages results.\n *\n * @param {Integer} page number.\n * @return {Promise}\n */\n loadResults() {\n const offset = this.page * this.pageSize;\n\n return app.store.find('fof/ban-ips', { page: { offset, limit: this.pageSize } });\n }\n\n /**\n * Load the next page of results.\n *\n * @public\n */\n loadNext() {\n if (this.nextResults === true) {\n this.page++;\n this.refresh();\n }\n }\n\n /**\n * Load the previous page of results.\n *\n * @public\n */\n loadPrev() {\n if (this.prevResults === true) {\n this.page--;\n this.refresh();\n }\n }\n\n /**\n * Parse results and append them to the page list.\n *\n * @param {Page[]} results\n * @return {Page[]}\n */\n parseResults(results) {\n this.loading = false;\n\n this.nextResults = !!results.payload.links.next;\n this.prevResults = !!results.payload.links.prev;\n\n m.redraw();\n }\n}\n","import BanIPModal from './components/BanIPModal';\nimport UnbanIPModal from './components/UnbanIPModal';\nimport BannedIP from './models/BannedIP';\n\nexport default {\n 'fof/ban-ips/components/BanIPModal': BanIPModal,\n 'fof/ban-ips/components/UnbanIPModal': UnbanIPModal,\n 'fof/ban-ips/models/BannedIP': BannedIP,\n};\n","import compat from '../common/compat';\n\nimport BanIPModal from './components/BanIPModal';\nimport ChangeReasonModal from './components/ChangeReasonModal';\nimport SettingsPage from './components/SettingsPage';\nimport SettingsPageItem from './components/SettingsPageItem';\n\nexport default Object.assign(compat, {\n 'fof/ban-ips/components/BanIPModal': BanIPModal,\n 'fof/ban-ips/components/ChangeReasonModal': ChangeReasonModal,\n 'fof/ban-ips/components/SettingsPage': SettingsPage,\n 'fof/ban-ips/components/SettingsPageItem': SettingsPageItem,\n});\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core;","import app from 'flarum/admin/app';\nimport Model from 'flarum/common/Model';\n\nimport BannedIP from '../common/models/BannedIP';\nimport SettingsPage from './components/SettingsPage';\n\napp.initializers.add('fof/ban-ips', () => {\n app.store.models.banned_ips = BannedIP;\n\n app.store.models.users.prototype.bannedIPs = Model.hasMany('banned_ips');\n\n app.extensionData\n .for('fof-ban-ips')\n .registerPermission(\n {\n icon: 'fas fa-gavel',\n label: app.translator.trans('fof-ban-ips.admin.permissions.view_banned_ip_list_label'),\n permission: 'fof.ban-ips.viewBannedIPList',\n },\n 'moderate'\n )\n .registerPermission(\n {\n icon: 'fas fa-gavel',\n label: app.translator.trans('fof-ban-ips.admin.permissions.ban_ip_label'),\n permission: 'fof.ban-ips.banIP',\n },\n 'moderate'\n )\n .registerPage(SettingsPage);\n});\n\n// Expose compat API\nimport extCompat from './compat';\nimport { compat } from '@flarum/core/admin';\n\nObject.assign(compat, extCompat);\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","create","constructor","BannedIP","apiEndpoint","this","exists","id","mixin","Model","creator","user","address","reason","createdAt","deletedAt","BanIPModal","oninit","vnode","Stream","usersBanned","loading","className","title","app","translator","trans","content","usernames","map","username","type","bidi","required","pattern","length","Alert","dismissible","transChoice","users","punctuateSeries","disabled","store","getBy","onsubmit","e","preventDefault","getOtherUsers","attrs","createRecord","save","then","hide","bind","onerror","loaded","data","ip","request","params","url","forum","attribute","method","res","pushObject","m","redraw","Modal","post","bannedIP","banOptions","ipAddress","push","banOption","otherUsers","otherUsersBanned","u","displayName","name","checked","onclick","htmlFor","userId","body","attributes","errorHandler","pushPayload","forEach","done","filter","bannedIPs","relationships","banned_ip","banned_ips","isBanned","UnbanIPModal","ips","skipValidation","models","Array","isArray","b","location","reload","ChangeReasonModal","item","SettingsPageItem","view","toLocaleDateString","Button","icon","session","modal","show","Component","SettingsPage","page","pageSize","oncreate","refresh","next","prev","nextResults","loadNext","prevResults","loadPrev","LoadingIndicator","all","style","width","textAlign","slice","component","Placeholder","text","loadResults","parseResults","offset","find","limit","results","payload","links","ExtensionPage","assign","registerPermission","label","permission","registerPage","extCompat"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index b27c3b5..cc2884b 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(t){var n={};function a(s){if(n[s])return n[s].exports;var e=n[s]={i:s,l:!1,exports:{}};return t[s].call(e.exports,e,e.exports,a),e.l=!0,e.exports}return a.m=t,a.c=n,a.d=function(t,n,s){a.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:s})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,n){if(1&n&&(t=a(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)a.d(s,e,function(n){return t[n]}.bind(null,e));return s},a.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(n,"a",n),n},a.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},a.p="",a(a.s=26)}([function(t,n){t.exports=flarum.core.compat["common/Model"]},function(t,n){t.exports=flarum.core.compat["common/components/Button"]},function(t,n,a){"use strict";function s(t,n){return(s=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function e(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,s(t,n)}a.d(n,"a",(function(){return e}))},function(t,n){t.exports=flarum.core.compat["common/components/Alert"]},function(t,n){t.exports=flarum.core.compat["common/helpers/punctuateSeries"]},function(t,n,a){"use strict";a.d(n,"a",(function(){return b}));var s=a(2),e=a(8),o=a.n(e),r=a(1),i=a.n(r),p=a(3),d=a.n(p),u=a(6),l=a.n(u),c=a(4),h=a.n(c),b=function(t){function n(){return t.apply(this,arguments)||this}Object(s.a)(n,t);var a=n.prototype;return a.oninit=function(n){if(t.prototype.oninit.call(this,n),this.address=this.attrs.address,this.post=this.attrs.post,this.user=this.attrs.user||this.post&&this.post.user(),!this.user&&this.address){var a=app.store.getBy("banned_ips","address",this.address);a&&(this.user=a.user())}this.banOptions=[],(this.post&&this.post.ipAddress()||this.address)&&this.banOptions.push("only"),this.user&&this.banOptions.push("all"),this.banOption=l()(this.banOptions[0]),this.reason=l()(""),this.otherUsers={},this.loading=!1},a.className=function(){return"Modal--medium"},a.title=function(){return app.translator.trans("fof-ban-ips.lib.modal.title")},a.content=function(){var t=this,n=this.otherUsers[this.banOption()],a=n&&n.map((function(t){return t&&t.displayName()||app.translator.trans("core.lib.username.deleted_text")}));return m("div",{className:"Modal-body"},m("p",null,app.translator.trans("fof-ban-ips.lib.modal.ban_ip_confirmation")),m("div",{className:"Form-group"},this.banOptions.map((function(n){return m("div",null,m("input",{type:"radio",name:"ban-option",id:"ban-option-"+n,checked:t.banOption()===n,onclick:t.banOption.bind(t,n)})," ",m("label",{htmlFor:"ban-option-"+n},app.translator.trans("fof-ban-ips.forum.modal.ban_options_"+n+"_ip",{user:t.user,ip:t.address||t.post&&t.post.ipAddress()})))}))),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-ban-ips.lib.modal.reason_label")),m("input",{type:"text",className:"FormControl",bidi:this.reason})),n?n.length?d.a.component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.ban_ip_users",a.length,{users:h()(a)})):d.a.component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.forum.modal.ban_ip_no_users")):"",n&&m("br",null),m("div",{className:"Form-group"},m(i.a,{className:"Button Button--primary",type:"submit",loading:this.loading},a?app.translator.trans("fof-ban-ips.lib.modal.ban_button"):app.translator.trans("fof-ban-ips.lib.modal.check_button"))))},a.onsubmit=function(t){var n=this;if(t.preventDefault(),this.loading=!0,void 0===this.otherUsers[this.banOption()])return this.getOtherUsers();var a={reason:this.reason(),userId:this.user.id()};"only"===this.banOption()?(a.address=this.post.ipAddress(),app.store.createRecord("banned_ips").save(a).then(this.hide.bind(this)).catch(this.onerror.bind(this)).then(this.loaded.bind(this))):"all"===this.banOption()&&app.request({body:{data:{attributes:a}},url:""+app.forum.attribute("apiUrl")+this.user.apiEndpoint()+"/ban",method:"POST",errorHandler:this.onerror.bind(this)}).then((function(t){return app.store.pushPayload(t).forEach(n.done.bind(n))})).then(this.hide.bind(this)).catch((function(){})).then(this.loaded.bind(this))},a.getOtherUsers=function(){var t=this,n={};"only"===this.banOption()&&(n.ip=this.address||this.post.ipAddress()),app.request({params:n,url:app.forum.attribute("apiUrl")+"/fof/ban-ips/check-users/"+this.user.id(),method:"GET",errorHandler:this.onerror.bind(this)}).then((function(n){t.otherUsers[t.banOption()]=n.data.map((function(t){return app.store.pushObject(t)})).filter((function(t){return 0===t.bannedIPs().length})),t.loading=!1})).catch((function(){})).then(this.loaded.bind(this))},a.done=function(t){var n={type:"banned_ips",id:t.id()};this.post&&(this.post.data.relationships.banned_ip={data:n}),this.user.data.relationships.banned_ips||(this.user.data.relationships.banned_ips={data:[]}),this.user.data.relationships.banned_ips.data.push(n),this.user.data.attributes.isBanned=!0,app.store.pushObject(this.user.data)},n}(o.a)},function(t,n){t.exports=flarum.core.compat["common/utils/Stream"]},function(t,n,a){"use strict";a.d(n,"a",(function(){return u}));var s=a(2),e=a(1),o=a.n(e),r=a(3),i=a.n(r),p=a(4),d=a.n(p),u=(a(11),function(t){function n(){return t.apply(this,arguments)||this}Object(s.a)(n,t);var a=n.prototype;return a.title=function(){return app.translator.trans("fof-ban-ips.lib.modal.unban_title")},a.content=function(){var t=this,n=this.otherUsers[this.banOption()],a=n&&n.map((function(t){return t&&t.displayName()||app.translator.trans("core.lib.username.deleted_text")}));return this.bannedIPs?m("div",{className:"Modal-body"},i.a.component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.lib.modal.unbanned_ips",{ips:d()(this.bannedIPs)}))):m("div",{className:"Modal-body"},m("p",null,app.translator.trans("fof-ban-ips.lib.modal.unban_ip_confirmation")),m("div",{className:"Form-group"},this.banOptions.map((function(n){return m("div",null,m("input",{type:"radio",name:"ban-option",id:"ban-option-"+n,checked:t.banOption()===n,onclick:t.banOption.bind(t,n)})," ",m("label",{htmlFor:"ban-option-"+n},app.translator.trans("fof-ban-ips.lib.modal.unban_options_"+n+"_ip",{user:t.user,ip:t.address||t.post&&t.post.ipAddress()})))}))),n?n.length?i.a.component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.unban_ip_users",a.length,{users:d()(a)})):i.a.component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.lib.modal.unban_ip_no_users")):"",n&&m("br",null),m("div",{className:"Form-group"},m(o.a,{className:"Button Button--primary",type:"submit",loading:this.loading},a?app.translator.trans("fof-ban-ips.lib.modal.unban_button"):app.translator.trans("fof-ban-ips.lib.modal.check_button"))))},a.onsubmit=function(t){if(t.preventDefault(),this.loading=!0,void 0===this.otherUsers[this.banOption()])return this.getOtherUsers();var n={};if("only"===this.banOption()){n.address=this.address||this.post.ipAddress();var a=this.post?this.post.bannedIP():app.store.getBy("banned_ips","address",this.address);a.delete().then(this.done.bind(this,a)).catch(this.onerror.bind(this)).then(this.hide.bind(this))}else"all"===this.banOption()&&app.request({body:{data:{attributes:n}},url:""+app.forum.attribute("apiUrl")+this.user.apiEndpoint()+"/unban",method:"POST",errorHandler:this.onerror.bind(this)}).then(this.done.bind(this)).catch(this.onerror.bind(this)).then(this.hide.bind(this))},a.getOtherUsers=function(){var t=this,n={};"only"===this.banOption()&&(n.ip=this.address||this.post.ipAddress(),n.skipValidation=!0);var a=app.forum.attribute("apiUrl")+"/fof/ban-ips/check-users";this.user&&(a+="/"+this.user.id()),app.request({params:n,url:a,method:"GET",errorHandler:this.onerror.bind(this)}).then((function(n){var a=app.store.pushPayload(n);t.otherUsers[t.banOption()]=a.filter((function(t){return 1===t.bannedIPs().length})),t.loading=!1,m.redraw()})).catch((function(){})).then(this.loaded.bind(this))},a.done=function(t){this.loading=!1,this.post&&delete this.post.data.relationships.banned_ip,!this.user||this.user.data.relationships||t?this.user&&t instanceof app.store.models.banned_ips&&(this.user.data.relationships.banned_ips={data:this.user.data.relationships.banned_ips.data.filter((function(n){return n.id!==t.id()}))},this.user.data.attributes.isBanned=0!==this.user.data.relationships.banned_ips.data.length):(this.user.data.relationships.banned_ips.data=[],this.user.data.attributes.isBanned=!1),t&&Array.isArray(t.data)&&(this.bannedIPs=t.data.map((function(t){return t.attributes.address})),this.loading=!1,m.redraw())},a.hide=function(){t.prototype.hide.call(this),this.attrs.redraw||location.reload()},n}(a(5).a))},function(t,n){t.exports=flarum.core.compat["common/components/Modal"]},function(t,n,a){"use strict";a.d(n,"a",(function(){return i}));var s=a(2),e=a(0),o=a.n(e),r=a(13),i=function(t){function n(){return t.apply(this,arguments)||this}return Object(s.a)(n,t),n.prototype.apiEndpoint=function(){return"/fof/ban-ips"+(this.exists?"/"+this.id():"")},n}(a.n(r)()(o.a,{creator:o.a.hasOne("creator"),user:o.a.hasOne("user"),address:o.a.attribute("address"),reason:o.a.attribute("reason"),createdAt:o.a.attribute("createdAt",o.a.transformDate),deletedAt:o.a.attribute("deletedAt",o.a.transformDate)}))},function(t,n){t.exports=flarum.core.compat["common/app"]},function(t,n){t.exports=flarum.core.compat["common/helpers/username"]},,function(t,n){t.exports=flarum.core.compat["common/utils/mixin"]},function(t,n,a){"use strict";var s=a(5),e=a(7),o=a(9);n.a={"fof/ban-ips/components/BanIPModal":s.a,"fof/ban-ips/components/UnbanIPModal":e.a,"fof/ban-ips/models/BannedIP":o.a}},function(t,n){t.exports=flarum.core},function(t,n){t.exports=flarum.core.compat["common/extend"]},function(t,n){t.exports=flarum.core.compat["forum/utils/PostControls"]},function(t,n){t.exports=flarum.core.compat["forum/utils/UserControls"]},function(t,n){t.exports=flarum.core.compat["common/models/User"]},function(t,n){t.exports=flarum.core.compat["common/components/Badge"]},,,,,,function(t,n,a){"use strict";a.r(n);var s=a(10),e=a.n(s),o=a(0),r=a.n(o),i=a(16),p=a(17),d=a.n(p),u=a(18),l=a.n(u),c=a(1),h=a.n(c),b=a(5),m=a(7),f=a(9),y=a(19),_=a.n(y),O=a(20),v=a.n(O),g=a(14),x=a(15);e.a.initializers.add("fof/ban-ips",(function(){e.a.store.models.posts.prototype.canBanIP=r.a.attribute("canBanIP"),e.a.store.models.posts.prototype.ipAddress=r.a.attribute("ipAddress"),e.a.store.models.posts.prototype.bannedIP=r.a.hasOne("banned_ip"),e.a.store.models.users.prototype.canBanIP=r.a.attribute("canBanIP"),e.a.store.models.users.prototype.isBanned=r.a.attribute("isBanned"),e.a.store.models.users.prototype.bannedIPs=r.a.hasMany("banned_ips"),e.a.store.models.banned_ips=f.a,Object(i.extend)(d.a,"userControls",(function(t,n){if(n&&n.user()){var a=n.user().isBanned(),s=a?"un":"";n.canBanIP()&&!n.isHidden()&&n.user()!==app.session.user&&"comment"===n.contentType()&&t.add(s+"ban",h.a.component({icon:"fas fa-gavel",onclick:function(){return app.modal.show(a?m.a:b.a,{post:n})}},app.translator.trans("fof-ban-ips.forum."+s+"ban_ip_button")))}})),Object(i.extend)(l.a,"moderationControls",(function(t,n){if(n.canBanIP()&&n!==app.session.user){var a=n.isBanned(),s=a?"un":"";t.add(s+"ban",h.a.component({icon:"fas fa-gavel",onclick:function(){return app.modal.show(a?m.a:b.a,{post:post})}},app.translator.trans("fof-ban-ips.forum.user_controls."+s+"ban_button")))}})),Object(i.extend)(_.a.prototype,"badges",(function(t){this.isBanned()&&t.add("banned",v.a.component({icon:"fas fa-gavel",type:"banned",label:app.translator.trans("fof-ban-ips.forum.user_badge.banned_tooltip")}))}))})),Object.assign(x.compat,g.a)}]); +(()=>{var t={n:s=>{var n=s&&s.__esModule?()=>s.default:()=>s;return t.d(n,{a:n}),n},d:(s,n)=>{for(var a in n)t.o(n,a)&&!t.o(s,a)&&Object.defineProperty(s,a,{enumerable:!0,get:n[a]})},o:(t,s)=>Object.prototype.hasOwnProperty.call(t,s),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},s={};(()=>{"use strict";t.r(s);const n=flarum.core.compat["common/app"];var a=t.n(n);const e=flarum.core.compat["common/Model"];var o=t.n(e);const r=flarum.core.compat["common/extend"],i=flarum.core.compat["forum/utils/PostControls"];var p=t.n(i);const d=flarum.core.compat["forum/utils/UserControls"];var l=t.n(d);const u=flarum.core.compat["common/components/Button"];var h=t.n(u);function c(t,s){return c=Object.setPrototypeOf||function(t,s){return t.__proto__=s,t},c(t,s)}function b(t,s){t.prototype=Object.create(s.prototype),t.prototype.constructor=t,c(t,s)}const f=flarum.core.compat["common/components/Modal"];var y=t.n(f);const _=flarum.core.compat["common/components/Alert"];var v=t.n(_);const O=flarum.core.compat["common/utils/Stream"];var g=t.n(O);const P=flarum.core.compat["common/helpers/punctuateSeries"];var B=t.n(P),I=function(t){function s(){return t.apply(this,arguments)||this}b(s,t);var n=s.prototype;return n.oninit=function(s){if(t.prototype.oninit.call(this,s),this.address=this.attrs.address,this.post=this.attrs.post,this.user=this.attrs.user||this.post&&this.post.user(),!this.user&&this.address){var n=app.store.getBy("banned_ips","address",this.address);n&&(this.user=n.user())}this.banOptions=[],(this.post&&this.post.ipAddress()||this.address)&&this.banOptions.push("only"),this.user&&this.banOptions.push("all"),this.banOption=g()(this.banOptions[0]),this.reason=g()(""),this.otherUsers={},this.loading=!1},n.className=function(){return"Modal--medium"},n.title=function(){return app.translator.trans("fof-ban-ips.lib.modal.title")},n.content=function(){var t=this,s=this.otherUsers[this.banOption()],n=s&&s.map((function(t){return t&&t.displayName()||app.translator.trans("core.lib.username.deleted_text")}));return m("div",{className:"Modal-body"},m("p",null,app.translator.trans("fof-ban-ips.lib.modal.ban_ip_confirmation")),m("div",{className:"Form-group"},this.banOptions.map((function(s){return m("div",null,m("input",{type:"radio",name:"ban-option",id:"ban-option-"+s,checked:t.banOption()===s,onclick:t.banOption.bind(t,s)})," ",m("label",{htmlFor:"ban-option-"+s},app.translator.trans("fof-ban-ips.forum.modal.ban_options_"+s+"_ip",{user:t.user,ip:t.address||t.post&&t.post.ipAddress()})))}))),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-ban-ips.lib.modal.reason_label")),m("input",{type:"text",className:"FormControl",bidi:this.reason})),s?s.length?v().component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.ban_ip_users",n.length,{users:B()(n)})):v().component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.forum.modal.ban_ip_no_users")):"",s&&m("br",null),m("div",{className:"Form-group"},m(h(),{className:"Button Button--primary",type:"submit",loading:this.loading},n?app.translator.trans("fof-ban-ips.lib.modal.ban_button"):app.translator.trans("fof-ban-ips.lib.modal.check_button"))))},n.onsubmit=function(t){var s=this;if(t.preventDefault(),this.loading=!0,void 0===this.otherUsers[this.banOption()])return this.getOtherUsers();var n={reason:this.reason(),userId:this.user.id()};"only"===this.banOption()?(n.address=this.post.ipAddress(),app.store.createRecord("banned_ips").save(n).then(this.hide.bind(this)).catch(this.onerror.bind(this)).then(this.loaded.bind(this))):"all"===this.banOption()&&app.request({body:{data:{attributes:n}},url:""+app.forum.attribute("apiUrl")+this.user.apiEndpoint()+"/ban",method:"POST",errorHandler:this.onerror.bind(this)}).then((function(t){return app.store.pushPayload(t).forEach(s.done.bind(s))})).then(this.hide.bind(this)).catch((function(){})).then(this.loaded.bind(this))},n.getOtherUsers=function(){var t=this,s={};"only"===this.banOption()&&(s.ip=this.address||this.post.ipAddress()),app.request({params:s,url:app.forum.attribute("apiUrl")+"/fof/ban-ips/check-users/"+this.user.id(),method:"GET",errorHandler:this.onerror.bind(this)}).then((function(s){t.otherUsers[t.banOption()]=s.data.map((function(t){return app.store.pushObject(t)})).filter((function(t){return 0===t.bannedIPs().length})),t.loading=!1})).catch((function(){})).then(this.loaded.bind(this))},n.done=function(t){var s={type:"banned_ips",id:t.id()};this.post&&(this.post.data.relationships.banned_ip={data:s}),this.user.data.relationships.banned_ips||(this.user.data.relationships.banned_ips={data:[]}),this.user.data.relationships.banned_ips.data.push(s),this.user.data.attributes.isBanned=!0,app.store.pushObject(this.user.data)},s}(y());flarum.core.compat["common/helpers/username"];var U=function(t){function s(){return t.apply(this,arguments)||this}b(s,t);var n=s.prototype;return n.title=function(){return app.translator.trans("fof-ban-ips.lib.modal.unban_title")},n.content=function(){var t=this,s=this.otherUsers[this.banOption()],n=s&&s.map((function(t){return t&&t.displayName()||app.translator.trans("core.lib.username.deleted_text")}));return this.bannedIPs?m("div",{className:"Modal-body"},v().component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.lib.modal.unbanned_ips",{ips:B()(this.bannedIPs)}))):m("div",{className:"Modal-body"},m("p",null,app.translator.trans("fof-ban-ips.lib.modal.unban_ip_confirmation")),m("div",{className:"Form-group"},this.banOptions.map((function(s){return m("div",null,m("input",{type:"radio",name:"ban-option",id:"ban-option-"+s,checked:t.banOption()===s,onclick:t.banOption.bind(t,s)})," ",m("label",{htmlFor:"ban-option-"+s},app.translator.trans("fof-ban-ips.lib.modal.unban_options_"+s+"_ip",{user:t.user,ip:t.address||t.post&&t.post.ipAddress()})))}))),s?s.length?v().component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.unban_ip_users",n.length,{users:B()(n)})):v().component({dismissible:!1,type:"success"},app.translator.trans("fof-ban-ips.lib.modal.unban_ip_no_users")):"",s&&m("br",null),m("div",{className:"Form-group"},m(h(),{className:"Button Button--primary",type:"submit",loading:this.loading},n?app.translator.trans("fof-ban-ips.lib.modal.unban_button"):app.translator.trans("fof-ban-ips.lib.modal.check_button"))))},n.onsubmit=function(t){if(t.preventDefault(),this.loading=!0,void 0===this.otherUsers[this.banOption()])return this.getOtherUsers();var s={};if("only"===this.banOption()){s.address=this.address||this.post.ipAddress();var n=this.post?this.post.bannedIP():app.store.getBy("banned_ips","address",this.address);n.delete().then(this.done.bind(this,n)).catch(this.onerror.bind(this)).then(this.hide.bind(this))}else"all"===this.banOption()&&app.request({body:{data:{attributes:s}},url:""+app.forum.attribute("apiUrl")+this.user.apiEndpoint()+"/unban",method:"POST",errorHandler:this.onerror.bind(this)}).then(this.done.bind(this)).catch(this.onerror.bind(this)).then(this.hide.bind(this))},n.getOtherUsers=function(){var t=this,s={};"only"===this.banOption()&&(s.ip=this.address||this.post.ipAddress(),s.skipValidation=!0);var n=app.forum.attribute("apiUrl")+"/fof/ban-ips/check-users";this.user&&(n+="/"+this.user.id()),app.request({params:s,url:n,method:"GET",errorHandler:this.onerror.bind(this)}).then((function(s){var n=app.store.pushPayload(s);t.otherUsers[t.banOption()]=n.filter((function(t){return 1===t.bannedIPs().length})),t.loading=!1,m.redraw()})).catch((function(){})).then(this.loaded.bind(this))},n.done=function(t){this.loading=!1,this.post&&delete this.post.data.relationships.banned_ip,!this.user||this.user.data.relationships||t?this.user&&t instanceof app.store.models.banned_ips&&(this.user.data.relationships.banned_ips={data:this.user.data.relationships.banned_ips.data.filter((function(s){return s.id!==t.id()}))},this.user.data.attributes.isBanned=0!==this.user.data.relationships.banned_ips.data.length):(this.user.data.relationships.banned_ips.data=[],this.user.data.attributes.isBanned=!1),t&&Array.isArray(t.data)&&(this.bannedIPs=t.data.map((function(t){return t.attributes.address})),this.loading=!1,m.redraw())},n.hide=function(){t.prototype.hide.call(this),this.attrs.redraw||location.reload()},s}(I);const A=flarum.core.compat["common/utils/mixin"];var N=function(t){function s(){return t.apply(this,arguments)||this}return b(s,t),s.prototype.apiEndpoint=function(){return"/fof/ban-ips"+(this.exists?"/"+this.id():"")},s}(t.n(A)()(o(),{creator:o().hasOne("creator"),user:o().hasOne("user"),address:o().attribute("address"),reason:o().attribute("reason"),createdAt:o().attribute("createdAt",o().transformDate),deletedAt:o().attribute("deletedAt",o().transformDate)}));const M=flarum.core.compat["common/models/User"];var k=t.n(M);const x=flarum.core.compat["common/components/Badge"];var j=t.n(x);const S={"fof/ban-ips/components/BanIPModal":I,"fof/ban-ips/components/UnbanIPModal":U,"fof/ban-ips/models/BannedIP":N},F=flarum.core;a().initializers.add("fof/ban-ips",(function(){a().store.models.posts.prototype.canBanIP=o().attribute("canBanIP"),a().store.models.posts.prototype.ipAddress=o().attribute("ipAddress"),a().store.models.posts.prototype.bannedIP=o().hasOne("banned_ip"),a().store.models.users.prototype.canBanIP=o().attribute("canBanIP"),a().store.models.users.prototype.isBanned=o().attribute("isBanned"),a().store.models.users.prototype.bannedIPs=o().hasMany("banned_ips"),a().store.models.banned_ips=N,(0,r.extend)(p(),"userControls",(function(t,s){if(s&&s.user()){var n=s.user().isBanned(),a=n?"un":"";s.canBanIP()&&!s.isHidden()&&s.user()!==app.session.user&&"comment"===s.contentType()&&t.add(a+"ban",h().component({icon:"fas fa-gavel",onclick:function(){return app.modal.show(n?U:I,{post:s})}},app.translator.trans("fof-ban-ips.forum."+a+"ban_ip_button")))}})),(0,r.extend)(l(),"moderationControls",(function(t,s){if(s.canBanIP()&&s!==app.session.user){var n=s.isBanned(),a=n?"un":"";t.add(a+"ban",h().component({icon:"fas fa-gavel",onclick:function(){return app.modal.show(n?U:I,{user:s})}},app.translator.trans("fof-ban-ips.forum.user_controls."+a+"ban_button")))}})),(0,r.extend)(k().prototype,"badges",(function(t){this.isBanned()&&t.add("banned",j().component({icon:"fas fa-gavel",type:"banned",label:app.translator.trans("fof-ban-ips.forum.user_badge.banned_tooltip")}))}))})),Object.assign(F.compat,S)})(),module.exports=s})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index a7777f8..b9beb51 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@fof/ban-ips/webpack/bootstrap","webpack://@fof/ban-ips/external \"flarum.core.compat['common/Model']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/components/Button']\"","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/ban-ips/external \"flarum.core.compat['common/components/Alert']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@fof/ban-ips/./src/common/components/BanIPModal.js","webpack://@fof/ban-ips/external \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/ban-ips/./src/common/components/UnbanIPModal.js","webpack://@fof/ban-ips/external \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/ban-ips/./src/common/models/BannedIP.js","webpack://@fof/ban-ips/external \"flarum.core.compat['common/app']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/helpers/username']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/utils/mixin']\"","webpack://@fof/ban-ips/./src/common/compat.js","webpack://@fof/ban-ips/external \"flarum.core\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/extend']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['forum/utils/UserControls']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/models/User']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['common/components/Badge']\"","webpack://@fof/ban-ips/./src/forum/index.js","webpack://@fof/ban-ips/./src/forum/addBanIPControl.js","webpack://@fof/ban-ips/./src/forum/addBannedBadge.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","BanIPModal","oninit","vnode","this","address","attrs","post","user","bannedIP","app","store","getBy","banOptions","ipAddress","push","banOption","Stream","reason","otherUsers","loading","className","title","translator","trans","content","otherUsersBanned","usernames","map","u","displayName","type","id","checked","onclick","htmlFor","ip","bidi","length","Alert","component","dismissible","transChoice","users","punctuateSeries","onsubmit","e","preventDefault","getOtherUsers","userId","createRecord","save","then","hide","onerror","loaded","request","body","data","attributes","url","forum","attribute","apiEndpoint","method","errorHandler","res","pushPayload","forEach","done","params","pushObject","filter","bannedIPs","obj","relationships","banned_ip","banned_ips","isBanned","Modal","UnbanIPModal","ips","skipValidation","redraw","models","Array","isArray","b","location","reload","BannedIP","exists","mixin","Model","creator","hasOne","createdAt","transformDate","deletedAt","initializers","add","posts","canBanIP","hasMany","extend","PostControls","items","prefix","isHidden","session","contentType","Button","icon","modal","show","UserControls","User","Badge","label","assign","extCompat"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG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SAAUuH,GACnCtG,KAAK0E,YACL4B,EAAMN,IACF,SACAiB,IAAM7E,UAAU,CACZwE,KAAM,eACNjF,KAAM,SACNuF,MAAO5G,IAAIa,WAAWC,MAAM,wDFahDvD,OAAOsJ,OAAO9H,SAAQ+H","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 26);\n","module.exports = flarum.core.compat['common/Model'];","module.exports = flarum.core.compat['common/components/Button'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","module.exports = flarum.core.compat['common/components/Alert'];","module.exports = flarum.core.compat['common/helpers/punctuateSeries'];","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport Stream from 'flarum/common/utils/Stream';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\n\nexport default class BanIPModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.address = this.attrs.address;\n this.post = this.attrs.post;\n this.user = this.attrs.user || (this.post && this.post.user());\n\n if (!this.user && this.address) {\n const bannedIP = app.store.getBy('banned_ips', 'address', this.address);\n\n if (bannedIP) this.user = bannedIP.user();\n }\n\n this.banOptions = [];\n\n if ((this.post && this.post.ipAddress()) || this.address) this.banOptions.push('only');\n if (this.user) this.banOptions.push('all');\n\n this.banOption = Stream(this.banOptions[0]);\n this.reason = Stream('');\n\n this.otherUsers = {};\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--medium';\n }\n\n title() {\n return app.translator.trans('fof-ban-ips.lib.modal.title');\n }\n\n content() {\n const otherUsersBanned = this.otherUsers[this.banOption()];\n const usernames =\n otherUsersBanned && otherUsersBanned.map((u) => (u && u.displayName()) || app.translator.trans('core.lib.username.deleted_text'));\n\n return (\n
\n

{app.translator.trans('fof-ban-ips.lib.modal.ban_ip_confirmation')}

\n\n
\n {this.banOptions.map((key) => (\n
\n \n  \n \n
\n ))}\n
\n\n
\n \n \n
\n\n {otherUsersBanned\n ? otherUsersBanned.length\n ? Alert.component(\n {\n dismissible: false,\n },\n app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n })\n )\n : Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.forum.modal.ban_ip_no_users')\n )\n : ''}\n\n {otherUsersBanned &&
}\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n if (typeof this.otherUsers[this.banOption()] === 'undefined') return this.getOtherUsers();\n\n const attrs = {\n reason: this.reason(),\n userId: this.user.id(),\n };\n\n if (this.banOption() === 'only') {\n attrs.address = this.post.ipAddress();\n\n app.store.createRecord('banned_ips').save(attrs).then(this.hide.bind(this)).catch(this.onerror.bind(this)).then(this.loaded.bind(this));\n } else if (this.banOption() === 'all') {\n app.request({\n body: {\n data: {\n attributes: attrs,\n },\n },\n url: `${app.forum.attribute('apiUrl')}${this.user.apiEndpoint()}/ban`,\n method: 'POST',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => app.store.pushPayload(res).forEach(this.done.bind(this)))\n .then(this.hide.bind(this))\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n }\n\n getOtherUsers() {\n const data = {};\n\n if (this.banOption() === 'only') data.ip = this.address || this.post.ipAddress();\n\n app.request({\n params: data,\n url: `${app.forum.attribute('apiUrl')}/fof/ban-ips/check-users/${this.user.id()}`,\n method: 'GET',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => {\n this.otherUsers[this.banOption()] = res.data.map((e) => app.store.pushObject(e)).filter((e) => e.bannedIPs().length === 0);\n this.loading = false;\n })\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n\n done(bannedIP) {\n const obj = {\n type: 'banned_ips',\n id: bannedIP.id(),\n };\n\n if (this.post) {\n this.post.data.relationships.banned_ip = {\n data: obj,\n };\n }\n\n if (!this.user.data.relationships.banned_ips)\n this.user.data.relationships.banned_ips = {\n data: [],\n };\n\n this.user.data.relationships.banned_ips.data.push(obj);\n this.user.data.attributes.isBanned = true;\n\n app.store.pushObject(this.user.data);\n }\n}\n","module.exports = flarum.core.compat['common/utils/Stream'];","import Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\n\nimport BanIPModal from './BanIPModal';\n\nexport default class UnbanIPModal extends BanIPModal {\n title() {\n return app.translator.trans('fof-ban-ips.lib.modal.unban_title');\n }\n\n content() {\n const otherUsers = this.otherUsers[this.banOption()];\n const usernames = otherUsers && otherUsers.map((u) => (u && u.displayName()) || app.translator.trans('core.lib.username.deleted_text'));\n\n if (this.bannedIPs) {\n return (\n
\n {Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.lib.modal.unbanned_ips', { ips: punctuateSeries(this.bannedIPs) })\n )}\n
\n );\n }\n\n return (\n
\n

{app.translator.trans('fof-ban-ips.lib.modal.unban_ip_confirmation')}

\n\n
\n {this.banOptions.map((key) => (\n
\n \n  \n \n
\n ))}\n
\n\n {otherUsers\n ? otherUsers.length\n ? Alert.component(\n {\n dismissible: false,\n },\n app.translator.transChoice('fof-ban-ips.lib.modal.unban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n })\n )\n : Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.lib.modal.unban_ip_no_users')\n )\n : ''}\n\n {otherUsers &&
}\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n if (typeof this.otherUsers[this.banOption()] === 'undefined') return this.getOtherUsers();\n\n const attrs = {};\n\n if (this.banOption() === 'only') {\n attrs.address = this.address || this.post.ipAddress();\n\n const bannedIP = this.post ? this.post.bannedIP() : app.store.getBy('banned_ips', 'address', this.address);\n\n bannedIP.delete().then(this.done.bind(this, bannedIP)).catch(this.onerror.bind(this)).then(this.hide.bind(this));\n } else if (this.banOption() === 'all') {\n app.request({\n body: {\n data: {\n attributes: attrs,\n },\n },\n url: `${app.forum.attribute('apiUrl')}${this.user.apiEndpoint()}/unban`,\n method: 'POST',\n errorHandler: this.onerror.bind(this),\n })\n .then(this.done.bind(this))\n .catch(this.onerror.bind(this))\n .then(this.hide.bind(this));\n }\n }\n\n getOtherUsers() {\n const data = {};\n\n if (this.banOption() === 'only') {\n data.ip = this.address || this.post.ipAddress();\n data.skipValidation = true;\n }\n\n let url = `${app.forum.attribute('apiUrl')}/fof/ban-ips/check-users`;\n\n if (this.user) url += `/${this.user.id()}`;\n\n app.request({\n params: data,\n url: url,\n method: 'GET',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => {\n const data = app.store.pushPayload(res);\n\n this.otherUsers[this.banOption()] = data.filter((e) => e.bannedIPs().length === 1);\n this.loading = false;\n\n m.redraw();\n })\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n\n done(bannedIP) {\n this.loading = false;\n\n if (this.post) delete this.post.data.relationships.banned_ip;\n\n if (this.user && !this.user.data.relationships && !bannedIP) {\n this.user.data.relationships.banned_ips.data = [];\n this.user.data.attributes.isBanned = false;\n } else if (this.user && bannedIP instanceof app.store.models.banned_ips) {\n this.user.data.relationships.banned_ips = {\n data: this.user.data.relationships.banned_ips.data.filter((e) => e.id !== bannedIP.id()),\n };\n this.user.data.attributes.isBanned = this.user.data.relationships.banned_ips.data.length !== 0;\n }\n\n if (bannedIP && Array.isArray(bannedIP.data)) {\n this.bannedIPs = bannedIP.data.map((b) => b.attributes.address);\n this.loading = false;\n\n m.redraw();\n }\n }\n\n hide() {\n super.hide();\n\n if (!this.attrs.redraw) {\n location.reload();\n }\n }\n}\n","module.exports = flarum.core.compat['common/components/Modal'];","import Model from 'flarum/common/Model';\nimport mixin from 'flarum/common/utils/mixin';\n\nexport default class BannedIP extends mixin(Model, {\n creator: Model.hasOne('creator'),\n user: Model.hasOne('user'),\n address: Model.attribute('address'),\n reason: Model.attribute('reason'),\n createdAt: Model.attribute('createdAt', Model.transformDate),\n deletedAt: Model.attribute('deletedAt', Model.transformDate),\n}) {\n apiEndpoint() {\n return `/fof/ban-ips${this.exists ? `/${this.id()}` : ''}`;\n }\n}\n","module.exports = flarum.core.compat['common/app'];","module.exports = flarum.core.compat['common/helpers/username'];","module.exports = flarum.core.compat['common/utils/mixin'];","import BanIPModal from './components/BanIPModal';\nimport UnbanIPModal from './components/UnbanIPModal';\nimport BannedIP from './models/BannedIP';\n\nexport default {\n 'fof/ban-ips/components/BanIPModal': BanIPModal,\n 'fof/ban-ips/components/UnbanIPModal': UnbanIPModal,\n 'fof/ban-ips/models/BannedIP': BannedIP,\n};\n","module.exports = flarum.core;","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['forum/utils/PostControls'];","module.exports = flarum.core.compat['forum/utils/UserControls'];","module.exports = flarum.core.compat['common/models/User'];","module.exports = flarum.core.compat['common/components/Badge'];","import app from 'flarum/common/app';\nimport Model from 'flarum/common/Model';\nimport addBanIPControl from './addBanIPControl';\nimport BannedIP from '../common/models/BannedIP';\nimport addBannedBadge from './addBannedBadge';\n\napp.initializers.add('fof/ban-ips', () => {\n app.store.models.posts.prototype.canBanIP = Model.attribute('canBanIP');\n app.store.models.posts.prototype.ipAddress = Model.attribute('ipAddress');\n app.store.models.posts.prototype.bannedIP = Model.hasOne('banned_ip');\n\n app.store.models.users.prototype.canBanIP = Model.attribute('canBanIP');\n app.store.models.users.prototype.isBanned = Model.attribute('isBanned');\n app.store.models.users.prototype.bannedIPs = Model.hasMany('banned_ips');\n\n app.store.models.banned_ips = BannedIP;\n\n addBanIPControl();\n addBannedBadge();\n});\n\n// Expose compat API\nimport extCompat from '../common/compat';\nimport { compat } from '@flarum/core/forum';\n\nObject.assign(compat, extCompat);\n","import { extend } from 'flarum/common/extend';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport UserControls from 'flarum/forum/utils/UserControls';\nimport Button from 'flarum/common/components/Button';\n\nimport BanIPModal from '../common/components/BanIPModal';\nimport UnbanIPModal from '../common/components/UnbanIPModal';\n\nexport default () => {\n extend(PostControls, 'userControls', function (items, post) {\n if (!post || !post.user()) return;\n\n const isBanned = post.user().isBanned();\n const prefix = isBanned ? 'un' : '';\n\n // Removes ability to ban thyself and also does permission check.\n if (!post.canBanIP() || post.isHidden() || post.user() === app.session.user || post.contentType() !== 'comment') return;\n\n items.add(\n `${prefix}ban`,\n Button.component(\n {\n icon: 'fas fa-gavel',\n onclick: () => app.modal.show(isBanned ? UnbanIPModal : BanIPModal, { post }),\n },\n app.translator.trans(`fof-ban-ips.forum.${prefix}ban_ip_button`)\n )\n );\n });\n\n extend(UserControls, 'moderationControls', function (items, user) {\n if (!user.canBanIP() || user === app.session.user) return;\n\n const isBanned = user.isBanned();\n const prefix = isBanned ? 'un' : '';\n\n items.add(\n `${prefix}ban`,\n Button.component(\n {\n icon: 'fas fa-gavel',\n onclick: () => app.modal.show(isBanned ? UnbanIPModal : BanIPModal, { post }),\n },\n app.translator.trans(`fof-ban-ips.forum.user_controls.${prefix}ban_button`)\n )\n );\n });\n};\n","import { extend } from 'flarum/common/extend';\nimport User from 'flarum/common/models/User';\nimport Badge from 'flarum/common/components/Badge';\n\nexport default () => {\n extend(User.prototype, 'badges', function (items) {\n if (this.isBanned()) {\n items.add(\n 'banned',\n Badge.component({\n icon: 'fas fa-gavel',\n type: 'banned',\n label: app.translator.trans('fof-ban-ips.forum.user_badge.banned_tooltip'),\n })\n );\n }\n });\n};\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,+BCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,c,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,gB,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAzC,SAASC,EAAgBhB,EAAGiB,GAMzC,OALAD,EAAkBf,OAAOiB,gBAAkB,SAAyBlB,EAAGiB,GAErE,OADAjB,EAAEmB,UAA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AnB,CAEA,IAAMsE,EAAWvE,EAAKC,OAAOsE,WACvBuB,EAASvB,EAAW,KAAO,GAG5BvE,EAAK+F,aAAc/F,EAAKgG,YAAchG,EAAKC,SAAWE,IAAI8F,QAAQhG,MAA+B,YAAvBD,EAAKkG,eAEpFL,EAAMM,IACDL,EADL,MAEEM,IAAAA,UACE,CACEC,KAAM,eACNzE,QAAS,kBAAMzB,IAAImG,MAAMC,KAAKhC,EAAWE,EAAe/E,EAAY,CAAEM,KAAAA,MAExEG,IAAIa,WAAWC,MAAf,qBAA0C6E,EAA1C,wBAKNH,EAAAA,EAAAA,QAAOa,IAAc,sBAAsB,SAAUX,EAAO5F,GAC1D,GAAKA,EAAK8F,YAAc9F,IAASE,IAAI8F,QAAQhG,KAA7C,CAEA,IAAMsE,EAAWtE,EAAKsE,WAChBuB,EAASvB,EAAW,KAAO,GAEjCsB,EAAMM,IACDL,EADL,MAEEM,IAAAA,UACE,CACEC,KAAM,eACNzE,QAAS,kBAAMzB,IAAImG,MAAMC,KAAKhC,EAAWE,EAAe/E,EAAY,CAAEO,KAAAA,MAExEE,IAAIa,WAAWC,MAAf,mCAAwD6E,EAAxD,qBKtCNH,EAAAA,EAAAA,QAAOc,IAAAA,UAAgB,UAAU,SAAUZ,GACrChG,KAAK0E,YACPsB,EAAMM,IACJ,SACAO,IAAAA,UAAgB,CACdL,KAAM,eACN7E,KAAM,SACNmF,MAAOxG,IAAIa,WAAWC,MAAM,wDGatC/C,OAAO0I,OAAO5H,EAAAA,OAAQ6H,I","sources":["webpack://@fof/ban-ips/webpack/bootstrap","webpack://@fof/ban-ips/webpack/runtime/compat get default export","webpack://@fof/ban-ips/webpack/runtime/define property getters","webpack://@fof/ban-ips/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/ban-ips/webpack/runtime/make namespace object","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/app']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/Model']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/extend']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['forum/utils/UserControls']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/components/Button']\"","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/components/Alert']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@fof/ban-ips/./src/common/components/BanIPModal.js","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@fof/ban-ips/./src/common/components/UnbanIPModal.js","webpack://@fof/ban-ips/./src/forum/addBanIPControl.js","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/utils/mixin']\"","webpack://@fof/ban-ips/./src/common/models/BannedIP.js","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/models/User']\"","webpack://@fof/ban-ips/external root \"flarum.core.compat['common/components/Badge']\"","webpack://@fof/ban-ips/./src/forum/addBannedBadge.js","webpack://@fof/ban-ips/./src/common/compat.js","webpack://@fof/ban-ips/external assign \"flarum.core\"","webpack://@fof/ban-ips/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/UserControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Alert'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/punctuateSeries'];","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport Stream from 'flarum/common/utils/Stream';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\n\nexport default class BanIPModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.address = this.attrs.address;\n this.post = this.attrs.post;\n this.user = this.attrs.user || (this.post && this.post.user());\n\n if (!this.user && this.address) {\n const bannedIP = app.store.getBy('banned_ips', 'address', this.address);\n\n if (bannedIP) this.user = bannedIP.user();\n }\n\n this.banOptions = [];\n\n if ((this.post && this.post.ipAddress()) || this.address) this.banOptions.push('only');\n if (this.user) this.banOptions.push('all');\n\n this.banOption = Stream(this.banOptions[0]);\n this.reason = Stream('');\n\n this.otherUsers = {};\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--medium';\n }\n\n title() {\n return app.translator.trans('fof-ban-ips.lib.modal.title');\n }\n\n content() {\n const otherUsersBanned = this.otherUsers[this.banOption()];\n const usernames =\n otherUsersBanned && otherUsersBanned.map((u) => (u && u.displayName()) || app.translator.trans('core.lib.username.deleted_text'));\n\n return (\n
\n

{app.translator.trans('fof-ban-ips.lib.modal.ban_ip_confirmation')}

\n\n
\n {this.banOptions.map((key) => (\n
\n \n  \n \n
\n ))}\n
\n\n
\n \n \n
\n\n {otherUsersBanned\n ? otherUsersBanned.length\n ? Alert.component(\n {\n dismissible: false,\n },\n app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n })\n )\n : Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.forum.modal.ban_ip_no_users')\n )\n : ''}\n\n {otherUsersBanned &&
}\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n if (typeof this.otherUsers[this.banOption()] === 'undefined') return this.getOtherUsers();\n\n const attrs = {\n reason: this.reason(),\n userId: this.user.id(),\n };\n\n if (this.banOption() === 'only') {\n attrs.address = this.post.ipAddress();\n\n app.store.createRecord('banned_ips').save(attrs).then(this.hide.bind(this)).catch(this.onerror.bind(this)).then(this.loaded.bind(this));\n } else if (this.banOption() === 'all') {\n app\n .request({\n body: {\n data: {\n attributes: attrs,\n },\n },\n url: `${app.forum.attribute('apiUrl')}${this.user.apiEndpoint()}/ban`,\n method: 'POST',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => app.store.pushPayload(res).forEach(this.done.bind(this)))\n .then(this.hide.bind(this))\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n }\n\n getOtherUsers() {\n const data = {};\n\n if (this.banOption() === 'only') data.ip = this.address || this.post.ipAddress();\n\n app\n .request({\n params: data,\n url: `${app.forum.attribute('apiUrl')}/fof/ban-ips/check-users/${this.user.id()}`,\n method: 'GET',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => {\n this.otherUsers[this.banOption()] = res.data.map((e) => app.store.pushObject(e)).filter((e) => e.bannedIPs().length === 0);\n this.loading = false;\n })\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n\n done(bannedIP) {\n const obj = {\n type: 'banned_ips',\n id: bannedIP.id(),\n };\n\n if (this.post) {\n this.post.data.relationships.banned_ip = {\n data: obj,\n };\n }\n\n if (!this.user.data.relationships.banned_ips)\n this.user.data.relationships.banned_ips = {\n data: [],\n };\n\n this.user.data.relationships.banned_ips.data.push(obj);\n this.user.data.attributes.isBanned = true;\n\n app.store.pushObject(this.user.data);\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","import Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\n\nimport BanIPModal from './BanIPModal';\n\nexport default class UnbanIPModal extends BanIPModal {\n title() {\n return app.translator.trans('fof-ban-ips.lib.modal.unban_title');\n }\n\n content() {\n const otherUsers = this.otherUsers[this.banOption()];\n const usernames = otherUsers && otherUsers.map((u) => (u && u.displayName()) || app.translator.trans('core.lib.username.deleted_text'));\n\n if (this.bannedIPs) {\n return (\n
\n {Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.lib.modal.unbanned_ips', { ips: punctuateSeries(this.bannedIPs) })\n )}\n
\n );\n }\n\n return (\n
\n

{app.translator.trans('fof-ban-ips.lib.modal.unban_ip_confirmation')}

\n\n
\n {this.banOptions.map((key) => (\n
\n \n  \n \n
\n ))}\n
\n\n {otherUsers\n ? otherUsers.length\n ? Alert.component(\n {\n dismissible: false,\n },\n app.translator.transChoice('fof-ban-ips.lib.modal.unban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n })\n )\n : Alert.component(\n {\n dismissible: false,\n type: 'success',\n },\n app.translator.trans('fof-ban-ips.lib.modal.unban_ip_no_users')\n )\n : ''}\n\n {otherUsers &&
}\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n if (typeof this.otherUsers[this.banOption()] === 'undefined') return this.getOtherUsers();\n\n const attrs = {};\n\n if (this.banOption() === 'only') {\n attrs.address = this.address || this.post.ipAddress();\n\n const bannedIP = this.post ? this.post.bannedIP() : app.store.getBy('banned_ips', 'address', this.address);\n\n bannedIP.delete().then(this.done.bind(this, bannedIP)).catch(this.onerror.bind(this)).then(this.hide.bind(this));\n } else if (this.banOption() === 'all') {\n app\n .request({\n body: {\n data: {\n attributes: attrs,\n },\n },\n url: `${app.forum.attribute('apiUrl')}${this.user.apiEndpoint()}/unban`,\n method: 'POST',\n errorHandler: this.onerror.bind(this),\n })\n .then(this.done.bind(this))\n .catch(this.onerror.bind(this))\n .then(this.hide.bind(this));\n }\n }\n\n getOtherUsers() {\n const data = {};\n\n if (this.banOption() === 'only') {\n data.ip = this.address || this.post.ipAddress();\n data.skipValidation = true;\n }\n\n let url = `${app.forum.attribute('apiUrl')}/fof/ban-ips/check-users`;\n\n if (this.user) url += `/${this.user.id()}`;\n\n app\n .request({\n params: data,\n url: url,\n method: 'GET',\n errorHandler: this.onerror.bind(this),\n })\n .then((res) => {\n const data = app.store.pushPayload(res);\n\n this.otherUsers[this.banOption()] = data.filter((e) => e.bannedIPs().length === 1);\n this.loading = false;\n\n m.redraw();\n })\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n\n done(bannedIP) {\n this.loading = false;\n\n if (this.post) delete this.post.data.relationships.banned_ip;\n\n if (this.user && !this.user.data.relationships && !bannedIP) {\n this.user.data.relationships.banned_ips.data = [];\n this.user.data.attributes.isBanned = false;\n } else if (this.user && bannedIP instanceof app.store.models.banned_ips) {\n this.user.data.relationships.banned_ips = {\n data: this.user.data.relationships.banned_ips.data.filter((e) => e.id !== bannedIP.id()),\n };\n this.user.data.attributes.isBanned = this.user.data.relationships.banned_ips.data.length !== 0;\n }\n\n if (bannedIP && Array.isArray(bannedIP.data)) {\n this.bannedIPs = bannedIP.data.map((b) => b.attributes.address);\n this.loading = false;\n\n m.redraw();\n }\n }\n\n hide() {\n super.hide();\n\n if (!this.attrs.redraw) {\n location.reload();\n }\n }\n}\n","import { extend } from 'flarum/common/extend';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport UserControls from 'flarum/forum/utils/UserControls';\nimport Button from 'flarum/common/components/Button';\n\nimport BanIPModal from '../common/components/BanIPModal';\nimport UnbanIPModal from '../common/components/UnbanIPModal';\n\nexport default () => {\n extend(PostControls, 'userControls', function (items, post) {\n if (!post || !post.user()) return;\n\n const isBanned = post.user().isBanned();\n const prefix = isBanned ? 'un' : '';\n\n // Removes ability to ban thyself and also does permission check.\n if (!post.canBanIP() || post.isHidden() || post.user() === app.session.user || post.contentType() !== 'comment') return;\n\n items.add(\n `${prefix}ban`,\n Button.component(\n {\n icon: 'fas fa-gavel',\n onclick: () => app.modal.show(isBanned ? UnbanIPModal : BanIPModal, { post }),\n },\n app.translator.trans(`fof-ban-ips.forum.${prefix}ban_ip_button`)\n )\n );\n });\n\n extend(UserControls, 'moderationControls', function (items, user) {\n if (!user.canBanIP() || user === app.session.user) return;\n\n const isBanned = user.isBanned();\n const prefix = isBanned ? 'un' : '';\n\n items.add(\n `${prefix}ban`,\n Button.component(\n {\n icon: 'fas fa-gavel',\n onclick: () => app.modal.show(isBanned ? UnbanIPModal : BanIPModal, { user }),\n },\n app.translator.trans(`fof-ban-ips.forum.user_controls.${prefix}ban_button`)\n )\n );\n });\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/mixin'];","import Model from 'flarum/common/Model';\nimport mixin from 'flarum/common/utils/mixin';\n\nexport default class BannedIP extends mixin(Model, {\n creator: Model.hasOne('creator'),\n user: Model.hasOne('user'),\n address: Model.attribute('address'),\n reason: Model.attribute('reason'),\n createdAt: Model.attribute('createdAt', Model.transformDate),\n deletedAt: Model.attribute('deletedAt', Model.transformDate),\n}) {\n apiEndpoint() {\n return `/fof/ban-ips${this.exists ? `/${this.id()}` : ''}`;\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/User'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Badge'];","import { extend } from 'flarum/common/extend';\nimport User from 'flarum/common/models/User';\nimport Badge from 'flarum/common/components/Badge';\n\nexport default () => {\n extend(User.prototype, 'badges', function (items) {\n if (this.isBanned()) {\n items.add(\n 'banned',\n Badge.component({\n icon: 'fas fa-gavel',\n type: 'banned',\n label: app.translator.trans('fof-ban-ips.forum.user_badge.banned_tooltip'),\n })\n );\n }\n });\n};\n","import BanIPModal from './components/BanIPModal';\nimport UnbanIPModal from './components/UnbanIPModal';\nimport BannedIP from './models/BannedIP';\n\nexport default {\n 'fof/ban-ips/components/BanIPModal': BanIPModal,\n 'fof/ban-ips/components/UnbanIPModal': UnbanIPModal,\n 'fof/ban-ips/models/BannedIP': BannedIP,\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core;","import app from 'flarum/common/app';\nimport Model from 'flarum/common/Model';\nimport addBanIPControl from './addBanIPControl';\nimport BannedIP from '../common/models/BannedIP';\nimport addBannedBadge from './addBannedBadge';\n\napp.initializers.add('fof/ban-ips', () => {\n app.store.models.posts.prototype.canBanIP = Model.attribute('canBanIP');\n app.store.models.posts.prototype.ipAddress = Model.attribute('ipAddress');\n app.store.models.posts.prototype.bannedIP = Model.hasOne('banned_ip');\n\n app.store.models.users.prototype.canBanIP = Model.attribute('canBanIP');\n app.store.models.users.prototype.isBanned = Model.attribute('isBanned');\n app.store.models.users.prototype.bannedIPs = Model.hasMany('banned_ips');\n\n app.store.models.banned_ips = BannedIP;\n\n addBanIPControl();\n addBannedBadge();\n});\n\n// Expose compat API\nimport extCompat from '../common/compat';\nimport { compat } from '@flarum/core/forum';\n\nObject.assign(compat, extCompat);\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","create","constructor","BanIPModal","oninit","vnode","this","address","attrs","post","user","bannedIP","app","store","getBy","banOptions","ipAddress","push","banOption","Stream","reason","otherUsers","loading","className","title","translator","trans","content","otherUsersBanned","usernames","map","u","displayName","type","name","id","checked","onclick","bind","htmlFor","ip","bidi","length","Alert","dismissible","transChoice","users","punctuateSeries","onsubmit","e","preventDefault","getOtherUsers","userId","createRecord","save","then","hide","onerror","loaded","request","body","data","attributes","url","forum","attribute","apiEndpoint","method","errorHandler","res","pushPayload","forEach","done","params","pushObject","filter","bannedIPs","relationships","banned_ip","banned_ips","isBanned","Modal","UnbanIPModal","ips","skipValidation","m","redraw","models","Array","isArray","b","location","reload","BannedIP","exists","mixin","Model","creator","createdAt","deletedAt","extend","PostControls","items","prefix","canBanIP","isHidden","session","contentType","add","Button","icon","modal","show","UserControls","User","Badge","label","assign","extCompat"],"sourceRoot":""} \ No newline at end of file