From 41d64ec897495d39c17038c9abaae2c44e579fb4 Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Wed, 16 Dec 2020 10:27:59 +0000 Subject: [PATCH] Bundled output for commit d27495351cb0555560c4a63067879e5f48ee05e9 [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 091563f..89170bb 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=27)}([function(t,n){t.exports=flarum.core.compat.Model},function(t,n){t.exports=flarum.core.compat["components/Button"]},function(t,n,a){"use strict";function s(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}a.d(n,"a",(function(){return s}))},function(t,n){t.exports=flarum.core.compat["components/Alert"]},function(t,n){t.exports=flarum.core.compat["helpers/punctuateSeries"]},function(t,n,a){"use strict";a.d(n,"a",(function(){return f}));var s=a(2),e=a(9),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["utils/Stream"]},function(t,n){t.exports=flarum.core.compat.extend},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["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["helpers/username"]},function(t,n,a){"use strict";function s(){return(s=Object.assign||function(t){for(var n=1;n (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 dismissible: false,\n }, app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n }))\n : Alert.component({\n dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.forum.modal.ban_ip_no_users'))\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['utils/Stream'];","module.exports = flarum.core.compat['extend'];","import Button from 'flarum/components/Button';\nimport Alert from 'flarum/components/Alert';\nimport punctuateSeries from 'flarum/helpers/punctuateSeries';\nimport username from 'flarum/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 dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.lib.modal.unbanned_ips', { ips: punctuateSeries(this.bannedIPs) }))}\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 dismissible: false,\n }, app.translator.transChoice('fof-ban-ips.lib.modal.unban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n }))\n : Alert.component({\n dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.lib.modal.unban_ip_no_users'))\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['components/Modal'];","import Model from 'flarum/Model';\nimport mixin from 'flarum/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['helpers/username'];","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","module.exports = flarum.core.compat['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['components/PermissionGrid'];","module.exports = flarum.core.compat['components/AdminNav'];","module.exports = flarum.core.compat['components/AdminLinkButton'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Placeholder'];","module.exports = flarum.core.compat['components/Page'];","module.exports = flarum.core.compat['Component'];","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Alert from 'flarum/components/Alert';\nimport punctuateSeries from 'flarum/helpers/punctuateSeries';\nimport username from 'flarum/helpers/username';\nimport Stream from 'flarum/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 dismissible: false,\n }, app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n }))\n : Alert.component({\n dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.admin.modal.ban_ip_no_users'))\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/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Stream from 'flarum/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/Component';\nimport Button from 'flarum/components/Button';\nimport username from 'flarum/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/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Placeholder from 'flarum/components/Placeholder';\nimport Page from 'flarum/components/Page';\n\nimport BanIPModal from './BanIPModal';\nimport SettingsPageItem from './SettingsPageItem';\n\nexport default class SettingsPage extends Page {\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 view() {\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

{app.translator.trans('fof-ban-ips.admin.nav.desc')}

\n {Button.component({\n className: 'Button Button--primary',\n icon: 'fas fa-plus',\n onclick: () => app.modal.show(BanIPModal),\n }, app.translator.trans('fof-ban-ips.admin.page.create_button'))}\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 Model from 'flarum/Model';\n\nimport BannedIP from '../common/models/BannedIP';\nimport addPermissions from './addPermissions';\nimport addSettingsPage from './addSettingsPage';\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 addPermissions();\n addSettingsPage();\n});\n\n// Expose compat API\nimport extCompat from './compat';\nimport { compat } from '@flarum/core/admin';\n\nObject.assign(compat, extCompat);\n","import { extend } from 'flarum/extend';\nimport PermissionGrid from 'flarum/components/PermissionGrid';\n\nexport default () => {\n extend(PermissionGrid.prototype, 'moderateItems', (items) => {\n items.add('viewBannedIPList', {\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\n items.add('banIP', {\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 });\n};\n","import { extend } from 'flarum/extend';\nimport AdminNav from 'flarum/components/AdminNav';\nimport AdminLinkButton from 'flarum/components/AdminLinkButton';\n\nimport SettingsPage from './components/SettingsPage';\n\nexport default () => {\n app.routes['fof-ban-ips'] = { path: '/fof/ban-ips', component: SettingsPage };\n\n app.extensionSettings['fof-ban-ips'] = () => m.route.set(app.route('fof-ban-ips'));\n\n extend(AdminNav.prototype, 'items', (items) => {\n items.add(\n 'fof-ban-ips',\n AdminLinkButton.component({\n href: app.route('fof-ban-ips'),\n icon: 'fas fa-gavel',\n description: app.translator.trans('fof-ban-ips.admin.nav.desc'),\n }, app.translator.trans('fof-ban-ips.admin.nav.title'))\n );\n });\n};\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/ban-ips/webpack/bootstrap","webpack://@fof/ban-ips/external \"flarum.core.compat['Model']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['components/Button']\"","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/ban-ips/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['helpers/punctuateSeries']\"","webpack://@fof/ban-ips/./src/common/components/BanIPModal.js","webpack://@fof/ban-ips/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/ban-ips/./src/common/components/UnbanIPModal.js","webpack://@fof/ban-ips/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/ban-ips/./src/common/models/BannedIP.js","webpack://@fof/ban-ips/external \"flarum.core.compat['helpers/username']\"","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://@fof/ban-ips/external \"flarum.core.compat['app']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['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['components/LoadingIndicator']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['components/Placeholder']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['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","_inheritsLoose","subClass","superClass","constructor","__proto__","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","_extends","assign","target","arguments","source","apply","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","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,oBAA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2CAA4C6G,EAC5C,sCAAuCW,EACvC,0CAA2CT,I,QCL/CtG,IAAI2I,aAAaC,IAAI,eAAe,WAChC5I,IAAIC,MAAMyE,OAAOP,WAAaa,IAE9BhF,IAAIC,MAAMyE,OAAOzC,MAAMtD,UAAUoF,UAAYoB,IAAM0D,QAAQ,cAE3D7I,IAAI8I,cAAJ,IAAsB,eACrBC,mBAAmB,CAClBrC,KAAM,eACNsC,MAAOhJ,IAAIa,WAAWC,MAAM,2DAC5BmI,WAAY,gCACX,YACFF,mBAAmB,CAClBrC,KAAM,eACNsC,MAAOhJ,IAAIa,WAAWC,MAAM,8CAC5BmI,WAAY,qBACX,YACFC,aAAanC,MAOlBtJ,OAAA,IAAAA,CAAcwB,SAAQkK","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['Model'];","module.exports = flarum.core.compat['components/Button'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['helpers/punctuateSeries'];","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Alert from 'flarum/components/Alert';\nimport Stream from 'flarum/utils/Stream';\nimport punctuateSeries from 'flarum/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 dismissible: false,\n }, app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n }))\n : Alert.component({\n dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.forum.modal.ban_ip_no_users'))\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['utils/Stream'];","import Button from 'flarum/components/Button';\nimport Alert from 'flarum/components/Alert';\nimport punctuateSeries from 'flarum/helpers/punctuateSeries';\nimport username from 'flarum/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 dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.lib.modal.unbanned_ips', { ips: punctuateSeries(this.bannedIPs) }))}\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 dismissible: false,\n }, app.translator.transChoice('fof-ban-ips.lib.modal.unban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n }))\n : Alert.component({\n dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.lib.modal.unban_ip_no_users'))\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['components/Modal'];","import Model from 'flarum/Model';\nimport mixin from 'flarum/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['helpers/username'];","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['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['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Placeholder'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['Component'];","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Alert from 'flarum/components/Alert';\nimport punctuateSeries from 'flarum/helpers/punctuateSeries';\nimport username from 'flarum/helpers/username';\nimport Stream from 'flarum/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 dismissible: false,\n }, app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n }))\n : Alert.component({\n dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.admin.modal.ban_ip_no_users'))\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/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Stream from 'flarum/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/Component';\nimport Button from 'flarum/components/Button';\nimport username from 'flarum/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/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Placeholder from 'flarum/components/Placeholder';\nimport ExtensionPage from 'flarum/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 className: 'Button Button--primary',\n icon: 'fas fa-plus',\n onclick: () => app.modal.show(BanIPModal),\n }, app.translator.trans('fof-ban-ips.admin.page.create_button'))}\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/app';\nimport Model from 'flarum/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.for('fof-ban-ips')\n .registerPermission({\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 }, 'moderate')\n .registerPermission({\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 }, 'moderate')\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 diff --git a/js/dist/forum.js b/js/dist/forum.js index 627c6ba..cb5136e 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=28)}([function(t,n){t.exports=flarum.core.compat.Model},function(t,n){t.exports=flarum.core.compat["components/Button"]},function(t,n,a){"use strict";function s(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}a.d(n,"a",(function(){return s}))},function(t,n){t.exports=flarum.core.compat["components/Alert"]},function(t,n){t.exports=flarum.core.compat["helpers/punctuateSeries"]},function(t,n,a){"use strict";a.d(n,"a",(function(){return b}));var s=a(2),e=a(9),r=a.n(e),i=a(1),o=a.n(i),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(o.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}(r.a)},function(t,n){t.exports=flarum.core.compat["utils/Stream"]},function(t,n){t.exports=flarum.core.compat.extend},function(t,n,a){"use strict";a.d(n,"a",(function(){return u}));var s=a(2),e=a(1),r=a.n(e),i=a(3),o=a.n(i),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"},o.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?o.a.component({dismissible:!1},app.translator.transChoice("fof-ban-ips.lib.modal.unban_ip_users",a.length,{users:d()(a)})):o.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(r.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["components/Modal"]},function(t,n,a){"use strict";a.d(n,"a",(function(){return o}));var s=a(2),e=a(0),r=a.n(e),i=a(13),o=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(i)()(r.a,{creator:r.a.hasOne("creator"),user:r.a.hasOne("user"),address:r.a.attribute("address"),reason:r.a.attribute("reason"),createdAt:r.a.attribute("createdAt",r.a.transformDate),deletedAt:r.a.attribute("deletedAt",r.a.transformDate)}))},function(t,n){t.exports=flarum.core.compat["helpers/username"]},function(t,n,a){"use strict";function s(){return(s=Object.assign||function(t){for(var n=1;n (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 dismissible: false,\n }, app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n }))\n : Alert.component({\n dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.forum.modal.ban_ip_no_users'))\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['utils/Stream'];","module.exports = flarum.core.compat['extend'];","import Button from 'flarum/components/Button';\nimport Alert from 'flarum/components/Alert';\nimport punctuateSeries from 'flarum/helpers/punctuateSeries';\nimport username from 'flarum/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 dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.lib.modal.unbanned_ips', { ips: punctuateSeries(this.bannedIPs) }))}\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 dismissible: false,\n }, app.translator.transChoice('fof-ban-ips.lib.modal.unban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n }))\n : Alert.component({\n dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.lib.modal.unban_ip_no_users'))\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['components/Modal'];","import Model from 'flarum/Model';\nimport mixin from 'flarum/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['helpers/username'];","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","module.exports = flarum.core.compat['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['utils/PostControls'];","module.exports = flarum.core.compat['utils/UserControls'];","module.exports = flarum.core.compat['models/User'];","module.exports = flarum.core.compat['components/Badge'];","import Model from 'flarum/Model';\n\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/extend';\nimport PostControls from 'flarum/utils/PostControls';\nimport UserControls from 'flarum/utils/UserControls';\nimport Button from 'flarum/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 icon: 'fas fa-gavel',\n onclick: () => app.modal.show(isBanned ? UnbanIPModal : BanIPModal, { post }),\n }, app.translator.trans(`fof-ban-ips.forum.${prefix}ban_ip_button`))\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 icon: 'fas fa-gavel',\n onclick: () => app.modal.show(isBanned ? UnbanIPModal : BanIPModal, { post }),\n }, app.translator.trans(`fof-ban-ips.forum.user_controls.${prefix}ban_button`))\n );\n });\n};\n","import { extend } from 'flarum/extend';\nimport User from 'flarum/models/User';\nimport Badge from 'flarum/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,"sources":["webpack://@fof/ban-ips/webpack/bootstrap","webpack://@fof/ban-ips/external \"flarum.core.compat['Model']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['components/Button']\"","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/ban-ips/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['helpers/punctuateSeries']\"","webpack://@fof/ban-ips/./src/common/components/BanIPModal.js","webpack://@fof/ban-ips/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/ban-ips/./src/common/components/UnbanIPModal.js","webpack://@fof/ban-ips/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/ban-ips/./src/common/models/BannedIP.js","webpack://@fof/ban-ips/external \"flarum.core.compat['helpers/username']\"","webpack://@fof/ban-ips/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://@fof/ban-ips/external \"flarum.core.compat['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['extend']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['utils/PostControls']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['utils/UserControls']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['models/User']\"","webpack://@fof/ban-ips/external \"flarum.core.compat['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","_inheritsLoose","subClass","superClass","constructor","__proto__","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","_extends","assign","target","arguments","source","apply","initializers","add","posts","canBanIP","hasMany","extend","PostControls","items","prefix","isHidden","session","contentType","Button","icon","modal","show","UserControls","User","Badge","label","extCompat"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG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AAMC,KAAK1C,EAAWE,IAAe/E,IAAY,CAAEM,cACvEG,IAAIa,WAAWC,MAAf,mCAAwDyF,EAAxD,oBCjCXH,iBAAOY,IAAKrI,UAAW,UAAU,SAAU2H,GACnC5G,KAAK0E,YACLkC,EAAMN,IACF,SACAiB,IAAMnF,UAAU,CACZ8E,KAAM,eACNvF,KAAM,SACN6F,MAAOlH,IAAIa,WAAWC,MAAM,wDFahDrD,OAAA,IAAAA,CAAcwB,SAAQkI","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['Model'];","module.exports = flarum.core.compat['components/Button'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['helpers/punctuateSeries'];","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport Alert from 'flarum/components/Alert';\nimport Stream from 'flarum/utils/Stream';\nimport punctuateSeries from 'flarum/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 dismissible: false,\n }, app.translator.transChoice('fof-ban-ips.lib.modal.ban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n }))\n : Alert.component({\n dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.forum.modal.ban_ip_no_users'))\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['utils/Stream'];","import Button from 'flarum/components/Button';\nimport Alert from 'flarum/components/Alert';\nimport punctuateSeries from 'flarum/helpers/punctuateSeries';\nimport username from 'flarum/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 dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.lib.modal.unbanned_ips', { ips: punctuateSeries(this.bannedIPs) }))}\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 dismissible: false,\n }, app.translator.transChoice('fof-ban-ips.lib.modal.unban_ip_users', usernames.length, {\n users: punctuateSeries(usernames),\n }))\n : Alert.component({\n dismissible: false,\n type: 'success',\n }, app.translator.trans('fof-ban-ips.lib.modal.unban_ip_no_users'))\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['components/Modal'];","import Model from 'flarum/Model';\nimport mixin from 'flarum/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['helpers/username'];","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","module.exports = flarum.core.compat['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['extend'];","module.exports = flarum.core.compat['utils/PostControls'];","module.exports = flarum.core.compat['utils/UserControls'];","module.exports = flarum.core.compat['models/User'];","module.exports = flarum.core.compat['components/Badge'];","import Model from 'flarum/Model';\n\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/extend';\nimport PostControls from 'flarum/utils/PostControls';\nimport UserControls from 'flarum/utils/UserControls';\nimport Button from 'flarum/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 icon: 'fas fa-gavel',\n onclick: () => app.modal.show(isBanned ? UnbanIPModal : BanIPModal, { post }),\n }, app.translator.trans(`fof-ban-ips.forum.${prefix}ban_ip_button`))\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 icon: 'fas fa-gavel',\n onclick: () => app.modal.show(isBanned ? UnbanIPModal : BanIPModal, { post }),\n }, app.translator.trans(`fof-ban-ips.forum.user_controls.${prefix}ban_button`))\n );\n });\n};\n","import { extend } from 'flarum/extend';\nimport User from 'flarum/models/User';\nimport Badge from 'flarum/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