diff --git a/js/dist/admin.js b/js/dist/admin.js index 353124ff..c5280f38 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -module.exports=function(t){var e={};function a(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},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,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)a.d(n,o,function(e){return t[e]}.bind(null,o));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=27)}([function(t,e){t.exports=flarum.core.compat["common/app"]},function(t,e){t.exports=flarum.core.compat["common/utils/withAttr"]},,function(t,e,a){"use strict";function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}a.d(e,"a",(function(){return o}))},function(t,e){t.exports=flarum.core.compat["common/components/Button"]},,function(t,e){t.exports=flarum.core.compat["common/utils/Stream"]},function(t,e){t.exports=flarum.core.compat["common/components/Select"]},,function(t,e){t.exports=flarum.core.compat["common/components/Alert"]},function(t,e){t.exports=flarum.core.compat["common/components/Switch"]},,,,,,,,,,,,function(t,e){t.exports=flarum.core.compat["admin/utils/saveSettings"]},function(t,e){t.exports=flarum.core.compat["admin/components/UploadImageButton"]},function(t,e){t.exports=flarum.core.compat["admin/components/ExtensionPage"]},function(t,e){t.exports=flarum.core.compat["common/utils/ItemList"]},,function(t,e,a){"use strict";a.r(e),a.d(e,"components",(function(){return k}));var n=a(0),o=a.n(n),s=a(3),i=a(4),l=a.n(i),r=a(22),u=a.n(r),p=a(9),d=a.n(p),f=a(7),c=a.n(f),h=a(10),b=a.n(h),v=a(23),g=a.n(v),y=a(1),w=a.n(y),x=a(6),T=a.n(x),_=a(24),M=a.n(_),S=a(25),O=a.n(S),P=function(t){function e(){return t.apply(this,arguments)||this}Object(s.a)(e,t);var a=e.prototype;return a.oninit=function(e){var a=this;t.prototype.oninit.call(this,e),this.loading=!1,this.fields=["resizeMaxWidth","cdnUrl","maxFileSize","whitelistedClientExtensions","composerButtonVisiblity","watermark","watermarkPosition","imgurClientId","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3ACL","qiniuKey","qiniuSecret","qiniuBucket"],this.checkboxes=["mustResize","addsWatermarks","disableHotlinkProtection","disableDownloadLogging","awsS3UsePathStyleEndpoint"],this.objects=["mimeTypes"],this.watermarkPositions={"top-left":"top-left","top-right":"top-right","bottom-left":"bottom-left","bottom-right":"bottom-right",center:"center",left:"left",top:"top",right:"right",bottom:"bottom"},this.composerButtonVisiblityOptions={both:o.a.translator.trans("fof-upload.admin.labels.composer_buttons.options.both"),"upload-btn":o.a.translator.trans("fof-upload.admin.labels.composer_buttons.options.upload-btn"),"media-btn":o.a.translator.trans("fof-upload.admin.labels.composer_buttons.options.media-btn")};var n=o.a.data.settings;this.settingsPrefix="fof-upload",this.uploadMethodOptions=n[this.addPrefix("availableUploadMethods")]||{},this.templateOptions=n[this.addPrefix("availableTemplates")]||{},this.values={},this.fields.forEach((function(t){return a.values[t]=T()(n[a.addPrefix(t)])})),this.checkboxes.forEach((function(t){return a.values[t]=T()("1"===n[a.addPrefix(t)])})),this.objects.forEach((function(t){return a.values[t]=n[a.addPrefix(t)]?T()(JSON.parse(n[a.addPrefix(t)])):T()()})),this.defaultAdap=Object.keys(this.uploadMethodOptions)[Object.keys(this.uploadMethodOptions).length-1],this.values.mimeTypes()||(this.values.mimeTypes=T()({"^image\\/.*":{adapter:this.defaultAdap,template:"image-preview"}})),this.newMimeType={regex:T()(""),adapter:T()(this.defaultAdap),template:T()("file")}},a.content=function(){var t=this;return[m(".UploadPage",[m(".container",[m("form",{onsubmit:this.onsubmit.bind(this)},[m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.preferences.title")),m("label",o.a.translator.trans("fof-upload.admin.labels.preferences.max_file_size")),m("input.FormControl",{value:this.values.maxFileSize()||2048,oninput:w()("value",this.values.maxFileSize),type:"number",min:"0"}),m("label",o.a.translator.trans("fof-upload.admin.labels.preferences.mime_types")),m(".MimeTypes--Container",Object.keys(this.values.mimeTypes()).map((function(e){var a=t.values.mimeTypes()[e];return"object"!=typeof a&&(a={adapter:a,template:"file"}),m("div",[m("input.FormControl.MimeTypes",{value:e,oninput:w()("value",t.updateMimeTypeKey.bind(t,e))}),c.a.component({options:t.uploadMethodOptions,onchange:t.updateMimeTypeAdapter.bind(t,e,a),value:a.adapter||"local"}),c.a.component({options:t.getTemplateOptionsForInput(),onchange:t.updateMimeTypeTemplate.bind(t,e,a),value:a.template||"local"}),l.a.component({type:"button",className:"Button Button--warning",onclick:t.deleteMimeType.bind(t,e)},"x")])})),m("br"),m("div",[m("input.FormControl.MimeTypes.add-MimeType-key",{value:this.newMimeType.regex(),oninput:w()("value",this.newMimeType.regex)}),c.a.component({options:this.uploadMethodOptions,className:"add-MimeType-value",oninput:w()("value",this.newMimeType.adapter),value:this.newMimeType.adapter()}),c.a.component({options:this.getTemplateOptionsForInput(),className:"add-MimeType-value",oninput:w()("value",this.newMimeType.template),value:this.newMimeType.template()}),l.a.component({type:"button",className:"Button Button--warning",onclick:this.addMimeType.bind(this)},"+")])),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.mime_types")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.download_templates")),this.templateOptionsDescriptions()]),m("fieldset.composerButtons",[m("legend",o.a.translator.trans("fof-upload.admin.labels.composer_buttons.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.composer_buttons")),m("div",[c.a.component({options:this.composerButtonVisiblityOptions,onchange:this.values.composerButtonVisiblity,value:this.values.composerButtonVisiblity()||"both"})])]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.resize.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.resize")),b.a.component({state:this.values.mustResize()||!1,onchange:this.values.mustResize},o.a.translator.trans("fof-upload.admin.labels.resize.toggle")),m("label",o.a.translator.trans("fof-upload.admin.labels.resize.max_width")),m("input",{className:"FormControl",value:this.values.resizeMaxWidth()||100,oninput:w()("value",this.values.resizeMaxWidth),disabled:!this.values.mustResize(),type:"number",min:"0"})]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.client_extension.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.client_extension")),m("input",{className:"FormControl",value:this.values.whitelistedClientExtensions()||"",oninput:w()("value",this.values.whitelistedClientExtensions)})]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.watermark.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.watermark")),b.a.component({state:this.values.addsWatermarks()||!1,onchange:this.values.addsWatermarks},o.a.translator.trans("fof-upload.admin.labels.watermark.toggle")),m("label",o.a.translator.trans("fof-upload.admin.labels.watermark.position")),m("div",[c.a.component({options:this.watermarkPositions,onchange:this.values.watermarkPosition,value:this.values.watermarkPosition()||"bottom-right"})]),m("label",{},o.a.translator.trans("fof-upload.admin.labels.watermark.file")),g.a.component({name:"fof/watermark"})]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.disable-hotlink-protection.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.disable-hotlink-protection")),b.a.component({state:this.values.disableHotlinkProtection()||!1,onchange:this.values.disableHotlinkProtection},o.a.translator.trans("fof-upload.admin.labels.disable-hotlink-protection.toggle")),m("legend",o.a.translator.trans("fof-upload.admin.labels.disable-download-logging.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.disable-download-logging")),b.a.component({state:this.values.disableDownloadLogging()||!1,onchange:this.values.disableDownloadLogging},o.a.translator.trans("fof-upload.admin.labels.disable-download-logging.toggle"))]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.local.title")),m("label",o.a.translator.trans("fof-upload.admin.labels.local.cdn_url")),m("input.FormControl",{value:this.values.cdnUrl()||"",oninput:w()("value",this.values.cdnUrl)})]),this.adaptorItems().toArray(),l.a.component({type:"submit",className:"Button Button--primary",loading:this.loading,disabled:!this.changed()},o.a.translator.trans("core.admin.settings.submit_button"))])])])]},a.adaptorItems=function(){var t=new O.a;return void 0!==this.uploadMethodOptions.imgur&&t.add("imgur",m(".imgur",[m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.imgur.title")),m("label",o.a.translator.trans("fof-upload.admin.labels.imgur.client_id")),m("input.FormControl",{value:this.values.imgurClientId()||"",oninput:w()("value",this.values.imgurClientId)})])])),void 0!==this.uploadMethodOptions.qiniu&&t.add("qiniu",m(".qiniu",[m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.qiniu.title")),m("label",o.a.translator.trans("fof-upload.admin.labels.qiniu.key")),m("input.FormControl",{value:this.values.qiniuKey()||"",oninput:w()("value",this.values.qiniuKey)}),m("label",{},o.a.translator.trans("fof-upload.admin.labels.qiniu.secret")),m("input.FormControl",{value:this.values.qiniuSecret()||"",oninput:w()("value",this.values.qiniuSecret)}),m("label",{},o.a.translator.trans("fof-upload.admin.labels.qiniu.bucket")),m("input.FormControl",{value:this.values.qiniuBucket()||"",oninput:w()("value",this.values.qiniuBucket)})])])),void 0!==this.uploadMethodOptions["aws-s3"]&&t.add("aws-s3",m(".aws",[m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.aws-s3.title")),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.key")),m("input.FormControl",{value:this.values.awsS3Key()||"",oninput:w()("value",this.values.awsS3Key)}),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.secret")),m("input.FormControl",{value:this.values.awsS3Secret()||"",oninput:w()("value",this.values.awsS3Secret)}),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.bucket")),m("input.FormControl",{value:this.values.awsS3Bucket()||"",oninput:w()("value",this.values.awsS3Bucket)}),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.region")),m("input.FormControl",{value:this.values.awsS3Region()||"",oninput:w()("value",this.values.awsS3Region)})]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.aws-s3.advanced_title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.s3_compatible_storage")),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.endpoint")),m("input.FormControl",{value:this.values.awsS3Endpoint()||"",oninput:w()("value",this.values.awsS3Endpoint)}),b.a.component({state:this.values.awsS3UsePathStyleEndpoint()||!1,onchange:this.values.awsS3UsePathStyleEndpoint},o.a.translator.trans("fof-upload.admin.labels.aws-s3.use_path_style_endpoint")),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.acl")),m("input.FormControl",{value:this.values.awsS3ACL()||"",oninput:w()("value",this.values.awsS3ACL)}),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.s3_acl"))])])),t},a.getTemplateOptionsForInput=function(){var t={};for(var e in this.templateOptions)this.templateOptions.hasOwnProperty(e)&&(t[e]=this.templateOptions[e].name);return t},a.updateMimeTypeKey=function(t,e){this.values.mimeTypes()[e]=this.values.mimeTypes()[t],this.deleteMimeType(t)},a.updateMimeTypeAdapter=function(t,e,a){e.adapter=a,this.values.mimeTypes()[t]=e},a.updateMimeTypeTemplate=function(t,e,a){e.template=a,this.values.mimeTypes()[t]=e},a.deleteMimeType=function(t){delete this.values.mimeTypes()[t]},a.templateOptionsDescriptions=function(){var t=[];for(var e in this.templateOptions)this.templateOptions.hasOwnProperty(e)&&t.push(m("li",null,this.templateOptions[e].name,": ",m.trust(this.templateOptions[e].description)));return m("ul",t)},a.addMimeType=function(){this.values.mimeTypes()[this.newMimeType.regex()]={adapter:this.newMimeType.adapter(),template:this.newMimeType.template()},this.newMimeType.regex(""),this.newMimeType.adapter("local"),this.newMimeType.template("file")},a.changed=function(){var t=this,e=this.fields.some((function(e){return t.values[e]()!==o.a.data.settings[t.addPrefix(e)]})),a=this.checkboxes.some((function(e){return t.values[e]()!==("1"===o.a.data.settings[t.addPrefix(e)])})),n=this.objects.some((function(e){return JSON.stringify(t.values[e]())!==o.a.data.settings[t.addPrefix(e)]}));return e||a||n},a.onsubmit=function(t){var e=this;if(t.preventDefault(),!this.loading){this.loading=!0,o.a.alerts.dismiss(this.successAlert);var a={};this.fields.forEach((function(t){return a[e.addPrefix(t)]=e.values[t]()})),this.checkboxes.forEach((function(t){return a[e.addPrefix(t)]=e.values[t]()})),this.objects.forEach((function(t){return a[e.addPrefix(t)]=JSON.stringify(e.values[t]())})),u()(a).then((function(){e.successAlert=o.a.alerts.show(d.a,{type:"success"},o.a.translator.trans("core.admin.settings.saved_message"))})).catch((function(){})).then((function(){e.loading=!1,m.redraw()}))}},a.addPrefix=function(t){return this.settingsPrefix+"."+t},e}(M.a),k={UploadPage:P};o.a.initializers.add("fof-upload",(function(t){t.extensionData.for("fof-upload").registerPage(P).registerPermission({icon:"far fa-file",label:t.translator.trans("fof-upload.admin.permissions.upload_label"),permission:"fof-upload.upload"},"start",50).registerPermission({icon:"fas fa-download",label:t.translator.trans("fof-upload.admin.permissions.download_label"),permission:"fof-upload.download",allowGuest:!0},"view",50).registerPermission({icon:"fas fa-eye",label:t.translator.trans("fof-upload.admin.permissions.view_user_uploads_label"),permission:"fof-upload.viewUserUploads"},"moderate",50).registerPermission({icon:"fas fa-trash",label:t.translator.trans("fof-upload.admin.permissions.delete_uploads_of_others_label"),permission:"fof-upload.deleteUserUploads"},"moderate",50)}))}]); +module.exports=function(t){var e={};function a(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},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,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)a.d(n,o,function(e){return t[e]}.bind(null,o));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=28)}([function(t,e){t.exports=flarum.core.compat["common/app"]},function(t,e){t.exports=flarum.core.compat["common/utils/withAttr"]},,function(t,e,a){"use strict";function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}a.d(e,"a",(function(){return o}))},function(t,e){t.exports=flarum.core.compat["common/components/Button"]},,function(t,e){t.exports=flarum.core.compat["common/utils/Stream"]},function(t,e){t.exports=flarum.core.compat["common/components/Select"]},,function(t,e){t.exports=flarum.core.compat["common/components/Alert"]},function(t,e){t.exports=flarum.core.compat["common/components/Switch"]},,,,,,,,,,,,,function(t,e){t.exports=flarum.core.compat["admin/utils/saveSettings"]},function(t,e){t.exports=flarum.core.compat["admin/components/UploadImageButton"]},function(t,e){t.exports=flarum.core.compat["admin/components/ExtensionPage"]},function(t,e){t.exports=flarum.core.compat["common/utils/ItemList"]},,function(t,e,a){"use strict";a.r(e),a.d(e,"components",(function(){return k}));var n=a(0),o=a.n(n),s=a(3),i=a(4),l=a.n(i),r=a(23),u=a.n(r),p=a(9),d=a.n(p),f=a(7),c=a.n(f),h=a(10),b=a.n(h),v=a(24),g=a.n(v),y=a(1),w=a.n(y),x=a(6),T=a.n(x),_=a(25),M=a.n(_),S=a(26),O=a.n(S),P=function(t){function e(){return t.apply(this,arguments)||this}Object(s.a)(e,t);var a=e.prototype;return a.oninit=function(e){var a=this;t.prototype.oninit.call(this,e),this.loading=!1,this.fields=["resizeMaxWidth","cdnUrl","maxFileSize","whitelistedClientExtensions","composerButtonVisiblity","watermark","watermarkPosition","imgurClientId","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3ACL","qiniuKey","qiniuSecret","qiniuBucket"],this.checkboxes=["mustResize","addsWatermarks","disableHotlinkProtection","disableDownloadLogging","awsS3UsePathStyleEndpoint"],this.objects=["mimeTypes"],this.watermarkPositions={"top-left":"top-left","top-right":"top-right","bottom-left":"bottom-left","bottom-right":"bottom-right",center:"center",left:"left",top:"top",right:"right",bottom:"bottom"},this.composerButtonVisiblityOptions={both:o.a.translator.trans("fof-upload.admin.labels.composer_buttons.options.both"),"upload-btn":o.a.translator.trans("fof-upload.admin.labels.composer_buttons.options.upload-btn"),"media-btn":o.a.translator.trans("fof-upload.admin.labels.composer_buttons.options.media-btn")};var n=o.a.data.settings;this.settingsPrefix="fof-upload",this.uploadMethodOptions=n[this.addPrefix("availableUploadMethods")]||{},this.templateOptions=n[this.addPrefix("availableTemplates")]||{},this.values={},this.fields.forEach((function(t){return a.values[t]=T()(n[a.addPrefix(t)])})),this.checkboxes.forEach((function(t){return a.values[t]=T()("1"===n[a.addPrefix(t)])})),this.objects.forEach((function(t){return a.values[t]=n[a.addPrefix(t)]?T()(JSON.parse(n[a.addPrefix(t)])):T()()})),this.defaultAdap=Object.keys(this.uploadMethodOptions)[Object.keys(this.uploadMethodOptions).length-1],this.values.mimeTypes()||(this.values.mimeTypes=T()({"^image\\/.*":{adapter:this.defaultAdap,template:"image-preview"}})),this.newMimeType={regex:T()(""),adapter:T()(this.defaultAdap),template:T()("file")}},a.content=function(){var t=this;return[m(".UploadPage",[m(".container",[m("form",{onsubmit:this.onsubmit.bind(this)},[m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.preferences.title")),m("label",o.a.translator.trans("fof-upload.admin.labels.preferences.max_file_size")),m("input.FormControl",{value:this.values.maxFileSize()||2048,oninput:w()("value",this.values.maxFileSize),type:"number",min:"0"}),m("label",o.a.translator.trans("fof-upload.admin.labels.preferences.mime_types")),m(".MimeTypes--Container",Object.keys(this.values.mimeTypes()).map((function(e){var a=t.values.mimeTypes()[e];return"object"!=typeof a&&(a={adapter:a,template:"file"}),m("div",[m("input.FormControl.MimeTypes",{value:e,oninput:w()("value",t.updateMimeTypeKey.bind(t,e))}),c.a.component({options:t.uploadMethodOptions,onchange:t.updateMimeTypeAdapter.bind(t,e,a),value:a.adapter||"local"}),c.a.component({options:t.getTemplateOptionsForInput(),onchange:t.updateMimeTypeTemplate.bind(t,e,a),value:a.template||"local"}),l.a.component({type:"button",className:"Button Button--warning",onclick:t.deleteMimeType.bind(t,e)},"x")])})),m("br"),m("div",[m("input.FormControl.MimeTypes.add-MimeType-key",{value:this.newMimeType.regex(),oninput:w()("value",this.newMimeType.regex)}),c.a.component({options:this.uploadMethodOptions,className:"add-MimeType-value",oninput:w()("value",this.newMimeType.adapter),value:this.newMimeType.adapter()}),c.a.component({options:this.getTemplateOptionsForInput(),className:"add-MimeType-value",oninput:w()("value",this.newMimeType.template),value:this.newMimeType.template()}),l.a.component({type:"button",className:"Button Button--warning",onclick:this.addMimeType.bind(this)},"+")])),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.mime_types")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.download_templates")),this.templateOptionsDescriptions()]),m("fieldset.composerButtons",[m("legend",o.a.translator.trans("fof-upload.admin.labels.composer_buttons.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.composer_buttons")),m("div",[c.a.component({options:this.composerButtonVisiblityOptions,onchange:this.values.composerButtonVisiblity,value:this.values.composerButtonVisiblity()||"both"})])]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.resize.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.resize")),b.a.component({state:this.values.mustResize()||!1,onchange:this.values.mustResize},o.a.translator.trans("fof-upload.admin.labels.resize.toggle")),m("label",o.a.translator.trans("fof-upload.admin.labels.resize.max_width")),m("input",{className:"FormControl",value:this.values.resizeMaxWidth()||100,oninput:w()("value",this.values.resizeMaxWidth),disabled:!this.values.mustResize(),type:"number",min:"0"})]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.client_extension.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.client_extension")),m("input",{className:"FormControl",value:this.values.whitelistedClientExtensions()||"",oninput:w()("value",this.values.whitelistedClientExtensions)})]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.watermark.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.watermark")),b.a.component({state:this.values.addsWatermarks()||!1,onchange:this.values.addsWatermarks},o.a.translator.trans("fof-upload.admin.labels.watermark.toggle")),m("label",o.a.translator.trans("fof-upload.admin.labels.watermark.position")),m("div",[c.a.component({options:this.watermarkPositions,onchange:this.values.watermarkPosition,value:this.values.watermarkPosition()||"bottom-right"})]),m("label",{},o.a.translator.trans("fof-upload.admin.labels.watermark.file")),g.a.component({name:"fof/watermark"})]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.disable-hotlink-protection.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.disable-hotlink-protection")),b.a.component({state:this.values.disableHotlinkProtection()||!1,onchange:this.values.disableHotlinkProtection},o.a.translator.trans("fof-upload.admin.labels.disable-hotlink-protection.toggle")),m("legend",o.a.translator.trans("fof-upload.admin.labels.disable-download-logging.title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.disable-download-logging")),b.a.component({state:this.values.disableDownloadLogging()||!1,onchange:this.values.disableDownloadLogging},o.a.translator.trans("fof-upload.admin.labels.disable-download-logging.toggle"))]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.local.title")),m("label",o.a.translator.trans("fof-upload.admin.labels.local.cdn_url")),m("input.FormControl",{value:this.values.cdnUrl()||"",oninput:w()("value",this.values.cdnUrl)})]),this.adaptorItems().toArray(),l.a.component({type:"submit",className:"Button Button--primary",loading:this.loading,disabled:!this.changed()},o.a.translator.trans("core.admin.settings.submit_button"))])])])]},a.adaptorItems=function(){var t=new O.a;return void 0!==this.uploadMethodOptions.imgur&&t.add("imgur",m(".imgur",[m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.imgur.title")),m("label",o.a.translator.trans("fof-upload.admin.labels.imgur.client_id")),m("input.FormControl",{value:this.values.imgurClientId()||"",oninput:w()("value",this.values.imgurClientId)})])])),void 0!==this.uploadMethodOptions.qiniu&&t.add("qiniu",m(".qiniu",[m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.qiniu.title")),m("label",o.a.translator.trans("fof-upload.admin.labels.qiniu.key")),m("input.FormControl",{value:this.values.qiniuKey()||"",oninput:w()("value",this.values.qiniuKey)}),m("label",{},o.a.translator.trans("fof-upload.admin.labels.qiniu.secret")),m("input.FormControl",{value:this.values.qiniuSecret()||"",oninput:w()("value",this.values.qiniuSecret)}),m("label",{},o.a.translator.trans("fof-upload.admin.labels.qiniu.bucket")),m("input.FormControl",{value:this.values.qiniuBucket()||"",oninput:w()("value",this.values.qiniuBucket)})])])),void 0!==this.uploadMethodOptions["aws-s3"]&&t.add("aws-s3",m(".aws",[m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.aws-s3.title")),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.key")),m("input.FormControl",{value:this.values.awsS3Key()||"",oninput:w()("value",this.values.awsS3Key)}),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.secret")),m("input.FormControl",{value:this.values.awsS3Secret()||"",oninput:w()("value",this.values.awsS3Secret)}),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.bucket")),m("input.FormControl",{value:this.values.awsS3Bucket()||"",oninput:w()("value",this.values.awsS3Bucket)}),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.region")),m("input.FormControl",{value:this.values.awsS3Region()||"",oninput:w()("value",this.values.awsS3Region)})]),m("fieldset",[m("legend",o.a.translator.trans("fof-upload.admin.labels.aws-s3.advanced_title")),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.s3_compatible_storage")),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.endpoint")),m("input.FormControl",{value:this.values.awsS3Endpoint()||"",oninput:w()("value",this.values.awsS3Endpoint)}),b.a.component({state:this.values.awsS3UsePathStyleEndpoint()||!1,onchange:this.values.awsS3UsePathStyleEndpoint},o.a.translator.trans("fof-upload.admin.labels.aws-s3.use_path_style_endpoint")),m("label",o.a.translator.trans("fof-upload.admin.labels.aws-s3.acl")),m("input.FormControl",{value:this.values.awsS3ACL()||"",oninput:w()("value",this.values.awsS3ACL)}),m(".helpText",o.a.translator.trans("fof-upload.admin.help_texts.s3_acl"))])])),t},a.getTemplateOptionsForInput=function(){var t={};for(var e in this.templateOptions)this.templateOptions.hasOwnProperty(e)&&(t[e]=this.templateOptions[e].name);return t},a.updateMimeTypeKey=function(t,e){this.values.mimeTypes()[e]=this.values.mimeTypes()[t],this.deleteMimeType(t)},a.updateMimeTypeAdapter=function(t,e,a){e.adapter=a,this.values.mimeTypes()[t]=e},a.updateMimeTypeTemplate=function(t,e,a){e.template=a,this.values.mimeTypes()[t]=e},a.deleteMimeType=function(t){delete this.values.mimeTypes()[t]},a.templateOptionsDescriptions=function(){var t=[];for(var e in this.templateOptions)this.templateOptions.hasOwnProperty(e)&&t.push(m("li",null,this.templateOptions[e].name,": ",m.trust(this.templateOptions[e].description)));return m("ul",t)},a.addMimeType=function(){this.values.mimeTypes()[this.newMimeType.regex()]={adapter:this.newMimeType.adapter(),template:this.newMimeType.template()},this.newMimeType.regex(""),this.newMimeType.adapter("local"),this.newMimeType.template("file")},a.changed=function(){var t=this,e=this.fields.some((function(e){return t.values[e]()!==o.a.data.settings[t.addPrefix(e)]})),a=this.checkboxes.some((function(e){return t.values[e]()!==("1"===o.a.data.settings[t.addPrefix(e)])})),n=this.objects.some((function(e){return JSON.stringify(t.values[e]())!==o.a.data.settings[t.addPrefix(e)]}));return e||a||n},a.onsubmit=function(t){var e=this;if(t.preventDefault(),!this.loading){this.loading=!0,o.a.alerts.dismiss(this.successAlert);var a={};this.fields.forEach((function(t){return a[e.addPrefix(t)]=e.values[t]()})),this.checkboxes.forEach((function(t){return a[e.addPrefix(t)]=e.values[t]()})),this.objects.forEach((function(t){return a[e.addPrefix(t)]=JSON.stringify(e.values[t]())})),u()(a).then((function(){e.successAlert=o.a.alerts.show(d.a,{type:"success"},o.a.translator.trans("core.admin.settings.saved_message"))})).catch((function(){})).then((function(){e.loading=!1,m.redraw()}))}},a.addPrefix=function(t){return this.settingsPrefix+"."+t},e}(M.a),k={UploadPage:P};o.a.initializers.add("fof-upload",(function(t){t.extensionData.for("fof-upload").registerPage(P).registerPermission({icon:"far fa-file",label:t.translator.trans("fof-upload.admin.permissions.upload_label"),permission:"fof-upload.upload"},"start",50).registerPermission({icon:"fas fa-download",label:t.translator.trans("fof-upload.admin.permissions.download_label"),permission:"fof-upload.download",allowGuest:!0},"view",50).registerPermission({icon:"fas fa-eye",label:t.translator.trans("fof-upload.admin.permissions.view_user_uploads_label"),permission:"fof-upload.viewUserUploads"},"moderate",50).registerPermission({icon:"fas fa-trash",label:t.translator.trans("fof-upload.admin.permissions.delete_uploads_of_others_label"),permission:"fof-upload.deleteUserUploads"},"moderate",50)}))}]); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index 136736f4..f4ebcf3f 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/external \"flarum.core.compat['common/app']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/withAttr']\"","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/external \"flarum.core.compat['common/components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Select']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Switch']\"","webpack://@fof/upload/external \"flarum.core.compat['admin/utils/saveSettings']\"","webpack://@fof/upload/external \"flarum.core.compat['admin/components/UploadImageButton']\"","webpack://@fof/upload/external \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/ItemList']\"","webpack://@fof/upload/./src/admin/components/UploadPage.js","webpack://@fof/upload/./src/admin/components/index.js","webpack://@fof/upload/./src/admin/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","UploadPage","oninit","vnode","this","loading","fields","checkboxes","objects","watermarkPositions","center","left","top","right","bottom","composerButtonVisiblityOptions","both","app","translator","trans","settings","data","settingsPrefix","uploadMethodOptions","addPrefix","templateOptions","values","forEach","Stream","JSON","parse","defaultAdap","keys","length","mimeTypes","adapter","template","newMimeType","regex","content","onsubmit","maxFileSize","oninput","withAttr","type","min","map","mime","config","updateMimeTypeKey","Select","component","options","onchange","updateMimeTypeAdapter","getTemplateOptionsForInput","updateMimeTypeTemplate","Button","className","onclick","deleteMimeType","addMimeType","templateOptionsDescriptions","composerButtonVisiblity","Switch","state","mustResize","resizeMaxWidth","disabled","whitelistedClientExtensions","addsWatermarks","watermarkPosition","UploadImageButton","disableHotlinkProtection","disableDownloadLogging","cdnUrl","adaptorItems","toArray","changed","items","ItemList","undefined","add","imgurClientId","qiniuKey","qiniuSecret","qiniuBucket","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3UsePathStyleEndpoint","awsS3ACL","option","children","push","trust","description","fieldsCheck","some","checkboxesCheck","objectsCheck","stringify","e","preventDefault","alerts","dismiss","successAlert","saveSettings","then","show","Alert","redraw","ExtensionPage","components","initializers","extensionData","registerPage","registerPermission","icon","label","permission","allowGuest"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OA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IAAIyF,OAAOK,KAAKC,IAAO,CAAEpE,KAAM,WAAa3B,IAAIC,WAAWC,MAAM,yCAH7F,OAKW,eACN2F,MAAK,WAEF,EAAKzG,SAAU,EACf1C,EAAEsJ,c,EASdzF,UAAA,SAAU1C,GACN,OAAOsB,KAAKkB,eAAiB,IAAMxC,G,GAtgBHoI,KCZ3BC,EAAa,CACtBlH,cCEJgB,IAAImG,aAAalC,IAAI,cAAc,SAACjE,GAChCA,EAAIoG,cAAJ,IACS,cACJC,aAAarH,GACbsH,mBACG,CACIC,KAAM,cACNC,MAAOxG,EAAIC,WAAWC,MAAM,6CAC5BuG,WAAY,qBAEhB,QACA,IAEHH,mBACG,CACIC,KAAM,kBACNC,MAAOxG,EAAIC,WAAWC,MAAM,+CAC5BuG,WAAY,sBACZC,YAAY,GAEhB,OACA,IAEHJ,mBACG,CACIC,KAAM,aACNC,MAAOxG,EAAIC,WAAWC,MAAM,wDAC5BuG,WAAY,8BAEhB,WACA,IAEHH,mBACG,CACIC,KAAM,eACNC,MAAOxG,EAAIC,WAAWC,MAAM,+DAC5BuG,WAAY,gCAEhB,WACA","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 = 27);\n","module.exports = flarum.core.compat['common/app'];","module.exports = flarum.core.compat['common/utils/withAttr'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","module.exports = flarum.core.compat['common/components/Button'];","module.exports = flarum.core.compat['common/utils/Stream'];","module.exports = flarum.core.compat['common/components/Select'];","module.exports = flarum.core.compat['common/components/Alert'];","module.exports = flarum.core.compat['common/components/Switch'];","module.exports = flarum.core.compat['admin/utils/saveSettings'];","module.exports = flarum.core.compat['admin/components/UploadImageButton'];","module.exports = flarum.core.compat['admin/components/ExtensionPage'];","module.exports = flarum.core.compat['common/utils/ItemList'];","import app from 'flarum/common/app';\nimport Button from 'flarum/common/components/Button';\nimport saveSettings from 'flarum/admin/utils/saveSettings';\nimport Alert from 'flarum/common/components/Alert';\nimport Select from 'flarum/common/components/Select';\nimport Switch from 'flarum/common/components/Switch';\nimport UploadImageButton from 'flarum/admin/components/UploadImageButton';\nimport withAttr from 'flarum/common/utils/withAttr';\nimport Stream from 'flarum/common/utils/Stream';\nimport ExtensionPage from 'flarum/admin/components/ExtensionPage';\nimport ItemList from 'flarum/common/utils/ItemList';\n\n/* global m */\n\nexport default class UploadPage extends ExtensionPage {\n oninit(vnode) {\n super.oninit(vnode);\n // whether we are saving the settings or not right now\n this.loading = false;\n\n // the fields we need to watch and to save\n this.fields = [\n // image\n 'resizeMaxWidth',\n 'cdnUrl',\n 'maxFileSize',\n 'whitelistedClientExtensions',\n 'composerButtonVisiblity',\n // watermark\n 'watermark',\n 'watermarkPosition',\n // Imgur\n 'imgurClientId',\n // AWS\n 'awsS3Key',\n 'awsS3Secret',\n 'awsS3Bucket',\n 'awsS3Region',\n 'awsS3Endpoint',\n 'awsS3ACL',\n // QIniu\n 'qiniuKey',\n 'qiniuSecret',\n 'qiniuBucket',\n ];\n\n // the checkboxes we need to watch and to save.\n this.checkboxes = ['mustResize', 'addsWatermarks', 'disableHotlinkProtection', 'disableDownloadLogging', 'awsS3UsePathStyleEndpoint'];\n\n // fields that are objects\n this.objects = ['mimeTypes'];\n\n // watermark positions\n this.watermarkPositions = {\n 'top-left': 'top-left',\n 'top-right': 'top-right',\n 'bottom-left': 'bottom-left',\n 'bottom-right': 'bottom-right',\n center: 'center',\n left: 'left',\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n };\n\n // Composer button options\n this.composerButtonVisiblityOptions = {\n both: app.translator.trans('fof-upload.admin.labels.composer_buttons.options.both'),\n 'upload-btn': app.translator.trans('fof-upload.admin.labels.composer_buttons.options.upload-btn'),\n 'media-btn': app.translator.trans('fof-upload.admin.labels.composer_buttons.options.media-btn'),\n };\n\n // get the saved settings from the database\n const settings = app.data.settings;\n\n // our package prefix (to be added to every field and checkbox in the setting table)\n this.settingsPrefix = 'fof-upload';\n\n // Options for the Upload methods dropdown menu.\n this.uploadMethodOptions = settings[this.addPrefix('availableUploadMethods')] || {};\n // Options for the Template dropdown menu.\n this.templateOptions = settings[this.addPrefix('availableTemplates')] || {};\n // Contains current values.\n this.values = {};\n // bind the values of the fields and checkboxes to the getter/setter functions\n this.fields.forEach((key) => (this.values[key] = Stream(settings[this.addPrefix(key)])));\n this.checkboxes.forEach((key) => (this.values[key] = Stream(settings[this.addPrefix(key)] === '1')));\n this.objects.forEach(\n (key) => (this.values[key] = settings[this.addPrefix(key)] ? Stream(JSON.parse(settings[this.addPrefix(key)])) : Stream())\n );\n\n // Set a sane default in case no mimeTypes have been configured yet.\n // Since 'local' (or others) can now be disabled, pick the last entry in the object for default\n this.defaultAdap = Object.keys(this.uploadMethodOptions)[Object.keys(this.uploadMethodOptions).length - 1];\n this.values.mimeTypes() ||\n (this.values.mimeTypes = Stream({\n '^image\\\\/.*': {\n adapter: this.defaultAdap,\n template: 'image-preview',\n },\n }));\n\n this.newMimeType = {\n regex: Stream(''),\n adapter: Stream(this.defaultAdap),\n template: Stream('file'),\n };\n }\n\n /**\n * Show the actual ImageUploadPage.\n *\n * @returns {*}\n */\n content() {\n return [\n m('.UploadPage', [\n m('.container', [\n m(\n 'form',\n {\n onsubmit: this.onsubmit.bind(this),\n },\n [\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.preferences.title')),\n m('label', app.translator.trans('fof-upload.admin.labels.preferences.max_file_size')),\n m('input.FormControl', {\n value: this.values.maxFileSize() || 2048,\n oninput: withAttr('value', this.values.maxFileSize),\n type: 'number',\n min: '0',\n }),\n m('label', app.translator.trans('fof-upload.admin.labels.preferences.mime_types')),\n m(\n '.MimeTypes--Container',\n Object.keys(this.values.mimeTypes()).map((mime) => {\n let config = this.values.mimeTypes()[mime];\n // Compatibility for older versions.\n if (typeof config !== 'object') {\n config = {\n adapter: config,\n template: 'file',\n };\n }\n\n return m('div', [\n m('input.FormControl.MimeTypes', {\n value: mime,\n oninput: withAttr('value', this.updateMimeTypeKey.bind(this, mime)),\n }),\n Select.component({\n options: this.uploadMethodOptions,\n onchange: this.updateMimeTypeAdapter.bind(this, mime, config),\n value: config.adapter || 'local',\n }),\n Select.component({\n options: this.getTemplateOptionsForInput(),\n onchange: this.updateMimeTypeTemplate.bind(this, mime, config),\n value: config.template || 'local',\n }),\n Button.component(\n {\n type: 'button',\n className: 'Button Button--warning',\n onclick: this.deleteMimeType.bind(this, mime),\n },\n 'x'\n ),\n ]);\n }),\n m('br'),\n m('div', [\n m('input.FormControl.MimeTypes.add-MimeType-key', {\n value: this.newMimeType.regex(),\n oninput: withAttr('value', this.newMimeType.regex),\n }),\n Select.component({\n options: this.uploadMethodOptions,\n className: 'add-MimeType-value',\n oninput: withAttr('value', this.newMimeType.adapter),\n value: this.newMimeType.adapter(),\n }),\n Select.component({\n options: this.getTemplateOptionsForInput(),\n className: 'add-MimeType-value',\n oninput: withAttr('value', this.newMimeType.template),\n value: this.newMimeType.template(),\n }),\n Button.component(\n {\n type: 'button',\n className: 'Button Button--warning',\n onclick: this.addMimeType.bind(this),\n },\n '+'\n ),\n ])\n ),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.mime_types')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.download_templates')),\n this.templateOptionsDescriptions(),\n ]),\n m('fieldset.composerButtons', [\n m('legend', app.translator.trans('fof-upload.admin.labels.composer_buttons.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.composer_buttons')),\n m('div', [\n Select.component({\n options: this.composerButtonVisiblityOptions,\n onchange: this.values.composerButtonVisiblity,\n value: this.values.composerButtonVisiblity() || 'both',\n }),\n ]),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.resize.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.resize')),\n Switch.component(\n {\n state: this.values.mustResize() || false,\n onchange: this.values.mustResize,\n },\n app.translator.trans('fof-upload.admin.labels.resize.toggle')\n ),\n m('label', app.translator.trans('fof-upload.admin.labels.resize.max_width')),\n m('input', {\n className: 'FormControl',\n value: this.values.resizeMaxWidth() || 100,\n oninput: withAttr('value', this.values.resizeMaxWidth),\n disabled: !this.values.mustResize(),\n type: 'number',\n min: '0',\n }),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.client_extension.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.client_extension')),\n m('input', {\n className: 'FormControl',\n value: this.values.whitelistedClientExtensions() || '',\n oninput: withAttr('value', this.values.whitelistedClientExtensions),\n }),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.watermark.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.watermark')),\n Switch.component(\n {\n state: this.values.addsWatermarks() || false,\n onchange: this.values.addsWatermarks,\n },\n app.translator.trans('fof-upload.admin.labels.watermark.toggle')\n ),\n m('label', app.translator.trans('fof-upload.admin.labels.watermark.position')),\n m('div', [\n Select.component({\n options: this.watermarkPositions,\n onchange: this.values.watermarkPosition,\n value: this.values.watermarkPosition() || 'bottom-right',\n }),\n ]),\n m('label', {}, app.translator.trans('fof-upload.admin.labels.watermark.file')),\n UploadImageButton.component({\n name: 'fof/watermark',\n }),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.disable-hotlink-protection.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.disable-hotlink-protection')),\n Switch.component(\n {\n state: this.values.disableHotlinkProtection() || false,\n onchange: this.values.disableHotlinkProtection,\n },\n app.translator.trans('fof-upload.admin.labels.disable-hotlink-protection.toggle')\n ),\n m('legend', app.translator.trans('fof-upload.admin.labels.disable-download-logging.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.disable-download-logging')),\n Switch.component(\n {\n state: this.values.disableDownloadLogging() || false,\n onchange: this.values.disableDownloadLogging,\n },\n app.translator.trans('fof-upload.admin.labels.disable-download-logging.toggle')\n ),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.local.title')),\n m('label', app.translator.trans('fof-upload.admin.labels.local.cdn_url')),\n m('input.FormControl', {\n value: this.values.cdnUrl() || '',\n oninput: withAttr('value', this.values.cdnUrl),\n }),\n ]),\n\n this.adaptorItems().toArray(),\n\n Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.loading,\n disabled: !this.changed(),\n },\n app.translator.trans('core.admin.settings.submit_button')\n ),\n ]\n ),\n ]),\n ]),\n ];\n }\n\n adaptorItems() {\n const items = new ItemList();\n\n if (this.uploadMethodOptions['imgur'] !== undefined) {\n items.add(\n 'imgur',\n m('.imgur', [\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.imgur.title')),\n m('label', app.translator.trans('fof-upload.admin.labels.imgur.client_id')),\n m('input.FormControl', {\n value: this.values.imgurClientId() || '',\n oninput: withAttr('value', this.values.imgurClientId),\n }),\n ]),\n ])\n );\n }\n\n if (this.uploadMethodOptions['qiniu'] !== undefined) {\n items.add(\n 'qiniu',\n m('.qiniu', [\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.qiniu.title')),\n m('label', app.translator.trans('fof-upload.admin.labels.qiniu.key')),\n m('input.FormControl', {\n value: this.values.qiniuKey() || '',\n oninput: withAttr('value', this.values.qiniuKey),\n }),\n m('label', {}, app.translator.trans('fof-upload.admin.labels.qiniu.secret')),\n m('input.FormControl', {\n value: this.values.qiniuSecret() || '',\n oninput: withAttr('value', this.values.qiniuSecret),\n }),\n m('label', {}, app.translator.trans('fof-upload.admin.labels.qiniu.bucket')),\n m('input.FormControl', {\n value: this.values.qiniuBucket() || '',\n oninput: withAttr('value', this.values.qiniuBucket),\n }),\n ]),\n ])\n );\n }\n\n if (this.uploadMethodOptions['aws-s3'] !== undefined) {\n items.add(\n 'aws-s3',\n m('.aws', [\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.aws-s3.title')),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.key')),\n m('input.FormControl', {\n value: this.values.awsS3Key() || '',\n oninput: withAttr('value', this.values.awsS3Key),\n }),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.secret')),\n m('input.FormControl', {\n value: this.values.awsS3Secret() || '',\n oninput: withAttr('value', this.values.awsS3Secret),\n }),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.bucket')),\n m('input.FormControl', {\n value: this.values.awsS3Bucket() || '',\n oninput: withAttr('value', this.values.awsS3Bucket),\n }),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.region')),\n m('input.FormControl', {\n value: this.values.awsS3Region() || '',\n oninput: withAttr('value', this.values.awsS3Region),\n }),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.aws-s3.advanced_title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.s3_compatible_storage')),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.endpoint')),\n m('input.FormControl', {\n value: this.values.awsS3Endpoint() || '',\n oninput: withAttr('value', this.values.awsS3Endpoint),\n }),\n Switch.component(\n {\n state: this.values.awsS3UsePathStyleEndpoint() || false,\n onchange: this.values.awsS3UsePathStyleEndpoint,\n },\n app.translator.trans('fof-upload.admin.labels.aws-s3.use_path_style_endpoint')\n ),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.acl')),\n m('input.FormControl', {\n value: this.values.awsS3ACL() || '',\n oninput: withAttr('value', this.values.awsS3ACL),\n }),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.s3_acl')),\n ]),\n ])\n );\n }\n\n return items;\n }\n\n getTemplateOptionsForInput() {\n const options = {};\n\n for (let option in this.templateOptions) {\n if (!this.templateOptions.hasOwnProperty(option)) {\n continue;\n }\n\n options[option] = this.templateOptions[option].name;\n }\n\n return options;\n }\n\n updateMimeTypeKey(mime, value) {\n this.values.mimeTypes()[value] = this.values.mimeTypes()[mime];\n\n this.deleteMimeType(mime);\n }\n\n updateMimeTypeAdapter(mime, config, value) {\n config.adapter = value;\n this.values.mimeTypes()[mime] = config;\n }\n\n updateMimeTypeTemplate(mime, config, value) {\n config.template = value;\n this.values.mimeTypes()[mime] = config;\n }\n\n deleteMimeType(mime) {\n delete this.values.mimeTypes()[mime];\n }\n\n templateOptionsDescriptions() {\n const children = [];\n\n for (let template in this.templateOptions) {\n if (!this.templateOptions.hasOwnProperty(template)) {\n continue;\n }\n\n children.push(
  • {this.templateOptions[template].name}: {m.trust(this.templateOptions[template].description)}
  • );\n }\n\n return m('ul', children);\n }\n\n addMimeType() {\n this.values.mimeTypes()[this.newMimeType.regex()] = {\n adapter: this.newMimeType.adapter(),\n template: this.newMimeType.template(),\n };\n\n this.newMimeType.regex('');\n this.newMimeType.adapter('local');\n this.newMimeType.template('file');\n }\n\n /**\n * Checks if the values of the fields and checkboxes are different from\n * the ones stored in the database\n *\n * @returns boolean\n */\n changed() {\n const fieldsCheck = this.fields.some((key) => this.values[key]() !== app.data.settings[this.addPrefix(key)]);\n const checkboxesCheck = this.checkboxes.some((key) => this.values[key]() !== (app.data.settings[this.addPrefix(key)] === '1'));\n const objectsCheck = this.objects.some((key) => JSON.stringify(this.values[key]()) !== app.data.settings[this.addPrefix(key)]);\n\n return fieldsCheck || checkboxesCheck || objectsCheck;\n }\n\n /**\n * Saves the settings to the database and redraw the page\n *\n * @param e\n */\n onsubmit(e) {\n // prevent the usual form submit behaviour\n e.preventDefault();\n\n // if the page is already saving, do nothing\n if (this.loading) return;\n\n // prevents multiple savings\n this.loading = true;\n\n // remove previous success popup\n app.alerts.dismiss(this.successAlert);\n\n const settings = {};\n\n // gets all the values from the form\n this.fields.forEach((key) => (settings[this.addPrefix(key)] = this.values[key]()));\n this.checkboxes.forEach((key) => (settings[this.addPrefix(key)] = this.values[key]()));\n this.objects.forEach((key) => (settings[this.addPrefix(key)] = JSON.stringify(this.values[key]())));\n\n // actually saves everything in the database\n saveSettings(settings)\n .then(() => {\n // on success, show popup\n this.successAlert = app.alerts.show(Alert, { type: 'success' }, app.translator.trans('core.admin.settings.saved_message'));\n })\n .catch(() => {})\n .then(() => {\n // return to the initial state and redraw the page\n this.loading = false;\n m.redraw();\n });\n }\n\n /**\n * Adds the prefix `this.settingsPrefix` at the beginning of `key`\n *\n * @returns string\n */\n addPrefix(key) {\n return this.settingsPrefix + '.' + key;\n }\n}\n","import UploadPage from './UploadPage';\n\nexport const components = {\n UploadPage,\n};\n","import app from 'flarum/common/app';\nimport UploadPage from './components/UploadPage';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', (app) => {\n app.extensionData\n .for('fof-upload')\n .registerPage(UploadPage)\n .registerPermission(\n {\n icon: 'far fa-file',\n label: app.translator.trans('fof-upload.admin.permissions.upload_label'),\n permission: 'fof-upload.upload',\n },\n 'start',\n 50\n )\n .registerPermission(\n {\n icon: 'fas fa-download',\n label: app.translator.trans('fof-upload.admin.permissions.download_label'),\n permission: 'fof-upload.download',\n allowGuest: true,\n },\n 'view',\n 50\n )\n .registerPermission(\n {\n icon: 'fas fa-eye',\n label: app.translator.trans('fof-upload.admin.permissions.view_user_uploads_label'),\n permission: 'fof-upload.viewUserUploads',\n },\n 'moderate',\n 50\n )\n .registerPermission(\n {\n icon: 'fas fa-trash',\n label: app.translator.trans('fof-upload.admin.permissions.delete_uploads_of_others_label'),\n permission: 'fof-upload.deleteUserUploads',\n },\n 'moderate',\n 50\n );\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/external \"flarum.core.compat['common/app']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/withAttr']\"","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/external \"flarum.core.compat['common/components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Select']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Switch']\"","webpack://@fof/upload/external \"flarum.core.compat['admin/utils/saveSettings']\"","webpack://@fof/upload/external \"flarum.core.compat['admin/components/UploadImageButton']\"","webpack://@fof/upload/external \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/ItemList']\"","webpack://@fof/upload/./src/admin/components/UploadPage.js","webpack://@fof/upload/./src/admin/components/index.js","webpack://@fof/upload/./src/admin/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","UploadPage","oninit","vnode","this","loading","fields","checkboxes","objects","watermarkPositions","center","left","top","right","bottom","composerButtonVisiblityOptions","both","app","translator","trans","settings","data","settingsPrefix","uploadMethodOptions","addPrefix","templateOptions","values","forEach","Stream","JSON","parse","defaultAdap","keys","length","mimeTypes","adapter","template","newMimeType","regex","content","onsubmit","maxFileSize","oninput","withAttr","type","min","map","mime","config","updateMimeTypeKey","Select","component","options","onchange","updateMimeTypeAdapter","getTemplateOptionsForInput","updateMimeTypeTemplate","Button","className","onclick","deleteMimeType","addMimeType","templateOptionsDescriptions","composerButtonVisiblity","Switch","state","mustResize","resizeMaxWidth","disabled","whitelistedClientExtensions","addsWatermarks","watermarkPosition","UploadImageButton","disableHotlinkProtection","disableDownloadLogging","cdnUrl","adaptorItems","toArray","changed","items","ItemList","undefined","add","imgurClientId","qiniuKey","qiniuSecret","qiniuBucket","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3UsePathStyleEndpoint","awsS3ACL","option","children","push","trust","description","fieldsCheck","some","checkboxesCheck","objectsCheck","stringify","e","preventDefault","alerts","dismiss","successAlert","saveSettings","then","show","Alert","redraw","ExtensionPage","components","initializers","extensionData","registerPage","registerPermission","icon","label","permission","allowGuest"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAA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GAAD,OAAUsC,EAAS,EAAKI,UAAU1C,IAAQ+C,KAAK0E,UAAU,EAAK7E,OAAO5C,SAG1F+H,IAAazF,GACR0F,MAAK,WAEF,EAAKF,aAAe3F,IAAIyF,OAAOK,KAAKC,IAAO,CAAEpE,KAAM,WAAa3B,IAAIC,WAAWC,MAAM,yCAH7F,OAKW,eACN2F,MAAK,WAEF,EAAKzG,SAAU,EACf1C,EAAEsJ,c,EASdzF,UAAA,SAAU1C,GACN,OAAOsB,KAAKkB,eAAiB,IAAMxC,G,GAtgBHoI,KCZ3BC,EAAa,CACtBlH,cCEJgB,IAAImG,aAAalC,IAAI,cAAc,SAACjE,GAChCA,EAAIoG,cAAJ,IACS,cACJC,aAAarH,GACbsH,mBACG,CACIC,KAAM,cACNC,MAAOxG,EAAIC,WAAWC,MAAM,6CAC5BuG,WAAY,qBAEhB,QACA,IAEHH,mBACG,CACIC,KAAM,kBACNC,MAAOxG,EAAIC,WAAWC,MAAM,+CAC5BuG,WAAY,sBACZC,YAAY,GAEhB,OACA,IAEHJ,mBACG,CACIC,KAAM,aACNC,MAAOxG,EAAIC,WAAWC,MAAM,wDAC5BuG,WAAY,8BAEhB,WACA,IAEHH,mBACG,CACIC,KAAM,eACNC,MAAOxG,EAAIC,WAAWC,MAAM,+DAC5BuG,WAAY,gCAEhB,WACA","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 = 28);\n","module.exports = flarum.core.compat['common/app'];","module.exports = flarum.core.compat['common/utils/withAttr'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","module.exports = flarum.core.compat['common/components/Button'];","module.exports = flarum.core.compat['common/utils/Stream'];","module.exports = flarum.core.compat['common/components/Select'];","module.exports = flarum.core.compat['common/components/Alert'];","module.exports = flarum.core.compat['common/components/Switch'];","module.exports = flarum.core.compat['admin/utils/saveSettings'];","module.exports = flarum.core.compat['admin/components/UploadImageButton'];","module.exports = flarum.core.compat['admin/components/ExtensionPage'];","module.exports = flarum.core.compat['common/utils/ItemList'];","import app from 'flarum/common/app';\nimport Button from 'flarum/common/components/Button';\nimport saveSettings from 'flarum/admin/utils/saveSettings';\nimport Alert from 'flarum/common/components/Alert';\nimport Select from 'flarum/common/components/Select';\nimport Switch from 'flarum/common/components/Switch';\nimport UploadImageButton from 'flarum/admin/components/UploadImageButton';\nimport withAttr from 'flarum/common/utils/withAttr';\nimport Stream from 'flarum/common/utils/Stream';\nimport ExtensionPage from 'flarum/admin/components/ExtensionPage';\nimport ItemList from 'flarum/common/utils/ItemList';\n\n/* global m */\n\nexport default class UploadPage extends ExtensionPage {\n oninit(vnode) {\n super.oninit(vnode);\n // whether we are saving the settings or not right now\n this.loading = false;\n\n // the fields we need to watch and to save\n this.fields = [\n // image\n 'resizeMaxWidth',\n 'cdnUrl',\n 'maxFileSize',\n 'whitelistedClientExtensions',\n 'composerButtonVisiblity',\n // watermark\n 'watermark',\n 'watermarkPosition',\n // Imgur\n 'imgurClientId',\n // AWS\n 'awsS3Key',\n 'awsS3Secret',\n 'awsS3Bucket',\n 'awsS3Region',\n 'awsS3Endpoint',\n 'awsS3ACL',\n // QIniu\n 'qiniuKey',\n 'qiniuSecret',\n 'qiniuBucket',\n ];\n\n // the checkboxes we need to watch and to save.\n this.checkboxes = ['mustResize', 'addsWatermarks', 'disableHotlinkProtection', 'disableDownloadLogging', 'awsS3UsePathStyleEndpoint'];\n\n // fields that are objects\n this.objects = ['mimeTypes'];\n\n // watermark positions\n this.watermarkPositions = {\n 'top-left': 'top-left',\n 'top-right': 'top-right',\n 'bottom-left': 'bottom-left',\n 'bottom-right': 'bottom-right',\n center: 'center',\n left: 'left',\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n };\n\n // Composer button options\n this.composerButtonVisiblityOptions = {\n both: app.translator.trans('fof-upload.admin.labels.composer_buttons.options.both'),\n 'upload-btn': app.translator.trans('fof-upload.admin.labels.composer_buttons.options.upload-btn'),\n 'media-btn': app.translator.trans('fof-upload.admin.labels.composer_buttons.options.media-btn'),\n };\n\n // get the saved settings from the database\n const settings = app.data.settings;\n\n // our package prefix (to be added to every field and checkbox in the setting table)\n this.settingsPrefix = 'fof-upload';\n\n // Options for the Upload methods dropdown menu.\n this.uploadMethodOptions = settings[this.addPrefix('availableUploadMethods')] || {};\n // Options for the Template dropdown menu.\n this.templateOptions = settings[this.addPrefix('availableTemplates')] || {};\n // Contains current values.\n this.values = {};\n // bind the values of the fields and checkboxes to the getter/setter functions\n this.fields.forEach((key) => (this.values[key] = Stream(settings[this.addPrefix(key)])));\n this.checkboxes.forEach((key) => (this.values[key] = Stream(settings[this.addPrefix(key)] === '1')));\n this.objects.forEach(\n (key) => (this.values[key] = settings[this.addPrefix(key)] ? Stream(JSON.parse(settings[this.addPrefix(key)])) : Stream())\n );\n\n // Set a sane default in case no mimeTypes have been configured yet.\n // Since 'local' (or others) can now be disabled, pick the last entry in the object for default\n this.defaultAdap = Object.keys(this.uploadMethodOptions)[Object.keys(this.uploadMethodOptions).length - 1];\n this.values.mimeTypes() ||\n (this.values.mimeTypes = Stream({\n '^image\\\\/.*': {\n adapter: this.defaultAdap,\n template: 'image-preview',\n },\n }));\n\n this.newMimeType = {\n regex: Stream(''),\n adapter: Stream(this.defaultAdap),\n template: Stream('file'),\n };\n }\n\n /**\n * Show the actual ImageUploadPage.\n *\n * @returns {*}\n */\n content() {\n return [\n m('.UploadPage', [\n m('.container', [\n m(\n 'form',\n {\n onsubmit: this.onsubmit.bind(this),\n },\n [\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.preferences.title')),\n m('label', app.translator.trans('fof-upload.admin.labels.preferences.max_file_size')),\n m('input.FormControl', {\n value: this.values.maxFileSize() || 2048,\n oninput: withAttr('value', this.values.maxFileSize),\n type: 'number',\n min: '0',\n }),\n m('label', app.translator.trans('fof-upload.admin.labels.preferences.mime_types')),\n m(\n '.MimeTypes--Container',\n Object.keys(this.values.mimeTypes()).map((mime) => {\n let config = this.values.mimeTypes()[mime];\n // Compatibility for older versions.\n if (typeof config !== 'object') {\n config = {\n adapter: config,\n template: 'file',\n };\n }\n\n return m('div', [\n m('input.FormControl.MimeTypes', {\n value: mime,\n oninput: withAttr('value', this.updateMimeTypeKey.bind(this, mime)),\n }),\n Select.component({\n options: this.uploadMethodOptions,\n onchange: this.updateMimeTypeAdapter.bind(this, mime, config),\n value: config.adapter || 'local',\n }),\n Select.component({\n options: this.getTemplateOptionsForInput(),\n onchange: this.updateMimeTypeTemplate.bind(this, mime, config),\n value: config.template || 'local',\n }),\n Button.component(\n {\n type: 'button',\n className: 'Button Button--warning',\n onclick: this.deleteMimeType.bind(this, mime),\n },\n 'x'\n ),\n ]);\n }),\n m('br'),\n m('div', [\n m('input.FormControl.MimeTypes.add-MimeType-key', {\n value: this.newMimeType.regex(),\n oninput: withAttr('value', this.newMimeType.regex),\n }),\n Select.component({\n options: this.uploadMethodOptions,\n className: 'add-MimeType-value',\n oninput: withAttr('value', this.newMimeType.adapter),\n value: this.newMimeType.adapter(),\n }),\n Select.component({\n options: this.getTemplateOptionsForInput(),\n className: 'add-MimeType-value',\n oninput: withAttr('value', this.newMimeType.template),\n value: this.newMimeType.template(),\n }),\n Button.component(\n {\n type: 'button',\n className: 'Button Button--warning',\n onclick: this.addMimeType.bind(this),\n },\n '+'\n ),\n ])\n ),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.mime_types')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.download_templates')),\n this.templateOptionsDescriptions(),\n ]),\n m('fieldset.composerButtons', [\n m('legend', app.translator.trans('fof-upload.admin.labels.composer_buttons.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.composer_buttons')),\n m('div', [\n Select.component({\n options: this.composerButtonVisiblityOptions,\n onchange: this.values.composerButtonVisiblity,\n value: this.values.composerButtonVisiblity() || 'both',\n }),\n ]),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.resize.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.resize')),\n Switch.component(\n {\n state: this.values.mustResize() || false,\n onchange: this.values.mustResize,\n },\n app.translator.trans('fof-upload.admin.labels.resize.toggle')\n ),\n m('label', app.translator.trans('fof-upload.admin.labels.resize.max_width')),\n m('input', {\n className: 'FormControl',\n value: this.values.resizeMaxWidth() || 100,\n oninput: withAttr('value', this.values.resizeMaxWidth),\n disabled: !this.values.mustResize(),\n type: 'number',\n min: '0',\n }),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.client_extension.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.client_extension')),\n m('input', {\n className: 'FormControl',\n value: this.values.whitelistedClientExtensions() || '',\n oninput: withAttr('value', this.values.whitelistedClientExtensions),\n }),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.watermark.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.watermark')),\n Switch.component(\n {\n state: this.values.addsWatermarks() || false,\n onchange: this.values.addsWatermarks,\n },\n app.translator.trans('fof-upload.admin.labels.watermark.toggle')\n ),\n m('label', app.translator.trans('fof-upload.admin.labels.watermark.position')),\n m('div', [\n Select.component({\n options: this.watermarkPositions,\n onchange: this.values.watermarkPosition,\n value: this.values.watermarkPosition() || 'bottom-right',\n }),\n ]),\n m('label', {}, app.translator.trans('fof-upload.admin.labels.watermark.file')),\n UploadImageButton.component({\n name: 'fof/watermark',\n }),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.disable-hotlink-protection.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.disable-hotlink-protection')),\n Switch.component(\n {\n state: this.values.disableHotlinkProtection() || false,\n onchange: this.values.disableHotlinkProtection,\n },\n app.translator.trans('fof-upload.admin.labels.disable-hotlink-protection.toggle')\n ),\n m('legend', app.translator.trans('fof-upload.admin.labels.disable-download-logging.title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.disable-download-logging')),\n Switch.component(\n {\n state: this.values.disableDownloadLogging() || false,\n onchange: this.values.disableDownloadLogging,\n },\n app.translator.trans('fof-upload.admin.labels.disable-download-logging.toggle')\n ),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.local.title')),\n m('label', app.translator.trans('fof-upload.admin.labels.local.cdn_url')),\n m('input.FormControl', {\n value: this.values.cdnUrl() || '',\n oninput: withAttr('value', this.values.cdnUrl),\n }),\n ]),\n\n this.adaptorItems().toArray(),\n\n Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.loading,\n disabled: !this.changed(),\n },\n app.translator.trans('core.admin.settings.submit_button')\n ),\n ]\n ),\n ]),\n ]),\n ];\n }\n\n adaptorItems() {\n const items = new ItemList();\n\n if (this.uploadMethodOptions['imgur'] !== undefined) {\n items.add(\n 'imgur',\n m('.imgur', [\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.imgur.title')),\n m('label', app.translator.trans('fof-upload.admin.labels.imgur.client_id')),\n m('input.FormControl', {\n value: this.values.imgurClientId() || '',\n oninput: withAttr('value', this.values.imgurClientId),\n }),\n ]),\n ])\n );\n }\n\n if (this.uploadMethodOptions['qiniu'] !== undefined) {\n items.add(\n 'qiniu',\n m('.qiniu', [\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.qiniu.title')),\n m('label', app.translator.trans('fof-upload.admin.labels.qiniu.key')),\n m('input.FormControl', {\n value: this.values.qiniuKey() || '',\n oninput: withAttr('value', this.values.qiniuKey),\n }),\n m('label', {}, app.translator.trans('fof-upload.admin.labels.qiniu.secret')),\n m('input.FormControl', {\n value: this.values.qiniuSecret() || '',\n oninput: withAttr('value', this.values.qiniuSecret),\n }),\n m('label', {}, app.translator.trans('fof-upload.admin.labels.qiniu.bucket')),\n m('input.FormControl', {\n value: this.values.qiniuBucket() || '',\n oninput: withAttr('value', this.values.qiniuBucket),\n }),\n ]),\n ])\n );\n }\n\n if (this.uploadMethodOptions['aws-s3'] !== undefined) {\n items.add(\n 'aws-s3',\n m('.aws', [\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.aws-s3.title')),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.key')),\n m('input.FormControl', {\n value: this.values.awsS3Key() || '',\n oninput: withAttr('value', this.values.awsS3Key),\n }),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.secret')),\n m('input.FormControl', {\n value: this.values.awsS3Secret() || '',\n oninput: withAttr('value', this.values.awsS3Secret),\n }),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.bucket')),\n m('input.FormControl', {\n value: this.values.awsS3Bucket() || '',\n oninput: withAttr('value', this.values.awsS3Bucket),\n }),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.region')),\n m('input.FormControl', {\n value: this.values.awsS3Region() || '',\n oninput: withAttr('value', this.values.awsS3Region),\n }),\n ]),\n m('fieldset', [\n m('legend', app.translator.trans('fof-upload.admin.labels.aws-s3.advanced_title')),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.s3_compatible_storage')),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.endpoint')),\n m('input.FormControl', {\n value: this.values.awsS3Endpoint() || '',\n oninput: withAttr('value', this.values.awsS3Endpoint),\n }),\n Switch.component(\n {\n state: this.values.awsS3UsePathStyleEndpoint() || false,\n onchange: this.values.awsS3UsePathStyleEndpoint,\n },\n app.translator.trans('fof-upload.admin.labels.aws-s3.use_path_style_endpoint')\n ),\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.acl')),\n m('input.FormControl', {\n value: this.values.awsS3ACL() || '',\n oninput: withAttr('value', this.values.awsS3ACL),\n }),\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.s3_acl')),\n ]),\n ])\n );\n }\n\n return items;\n }\n\n getTemplateOptionsForInput() {\n const options = {};\n\n for (let option in this.templateOptions) {\n if (!this.templateOptions.hasOwnProperty(option)) {\n continue;\n }\n\n options[option] = this.templateOptions[option].name;\n }\n\n return options;\n }\n\n updateMimeTypeKey(mime, value) {\n this.values.mimeTypes()[value] = this.values.mimeTypes()[mime];\n\n this.deleteMimeType(mime);\n }\n\n updateMimeTypeAdapter(mime, config, value) {\n config.adapter = value;\n this.values.mimeTypes()[mime] = config;\n }\n\n updateMimeTypeTemplate(mime, config, value) {\n config.template = value;\n this.values.mimeTypes()[mime] = config;\n }\n\n deleteMimeType(mime) {\n delete this.values.mimeTypes()[mime];\n }\n\n templateOptionsDescriptions() {\n const children = [];\n\n for (let template in this.templateOptions) {\n if (!this.templateOptions.hasOwnProperty(template)) {\n continue;\n }\n\n children.push(
  • {this.templateOptions[template].name}: {m.trust(this.templateOptions[template].description)}
  • );\n }\n\n return m('ul', children);\n }\n\n addMimeType() {\n this.values.mimeTypes()[this.newMimeType.regex()] = {\n adapter: this.newMimeType.adapter(),\n template: this.newMimeType.template(),\n };\n\n this.newMimeType.regex('');\n this.newMimeType.adapter('local');\n this.newMimeType.template('file');\n }\n\n /**\n * Checks if the values of the fields and checkboxes are different from\n * the ones stored in the database\n *\n * @returns boolean\n */\n changed() {\n const fieldsCheck = this.fields.some((key) => this.values[key]() !== app.data.settings[this.addPrefix(key)]);\n const checkboxesCheck = this.checkboxes.some((key) => this.values[key]() !== (app.data.settings[this.addPrefix(key)] === '1'));\n const objectsCheck = this.objects.some((key) => JSON.stringify(this.values[key]()) !== app.data.settings[this.addPrefix(key)]);\n\n return fieldsCheck || checkboxesCheck || objectsCheck;\n }\n\n /**\n * Saves the settings to the database and redraw the page\n *\n * @param e\n */\n onsubmit(e) {\n // prevent the usual form submit behaviour\n e.preventDefault();\n\n // if the page is already saving, do nothing\n if (this.loading) return;\n\n // prevents multiple savings\n this.loading = true;\n\n // remove previous success popup\n app.alerts.dismiss(this.successAlert);\n\n const settings = {};\n\n // gets all the values from the form\n this.fields.forEach((key) => (settings[this.addPrefix(key)] = this.values[key]()));\n this.checkboxes.forEach((key) => (settings[this.addPrefix(key)] = this.values[key]()));\n this.objects.forEach((key) => (settings[this.addPrefix(key)] = JSON.stringify(this.values[key]())));\n\n // actually saves everything in the database\n saveSettings(settings)\n .then(() => {\n // on success, show popup\n this.successAlert = app.alerts.show(Alert, { type: 'success' }, app.translator.trans('core.admin.settings.saved_message'));\n })\n .catch(() => {})\n .then(() => {\n // return to the initial state and redraw the page\n this.loading = false;\n m.redraw();\n });\n }\n\n /**\n * Adds the prefix `this.settingsPrefix` at the beginning of `key`\n *\n * @returns string\n */\n addPrefix(key) {\n return this.settingsPrefix + '.' + key;\n }\n}\n","import UploadPage from './UploadPage';\n\nexport const components = {\n UploadPage,\n};\n","import app from 'flarum/common/app';\nimport UploadPage from './components/UploadPage';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', (app) => {\n app.extensionData\n .for('fof-upload')\n .registerPage(UploadPage)\n .registerPermission(\n {\n icon: 'far fa-file',\n label: app.translator.trans('fof-upload.admin.permissions.upload_label'),\n permission: 'fof-upload.upload',\n },\n 'start',\n 50\n )\n .registerPermission(\n {\n icon: 'fas fa-download',\n label: app.translator.trans('fof-upload.admin.permissions.download_label'),\n permission: 'fof-upload.download',\n allowGuest: true,\n },\n 'view',\n 50\n )\n .registerPermission(\n {\n icon: 'fas fa-eye',\n label: app.translator.trans('fof-upload.admin.permissions.view_user_uploads_label'),\n permission: 'fof-upload.viewUserUploads',\n },\n 'moderate',\n 50\n )\n .registerPermission(\n {\n icon: 'fas fa-trash',\n label: app.translator.trans('fof-upload.admin.permissions.delete_uploads_of_others_label'),\n permission: 'fof-upload.deleteUserUploads',\n },\n 'moderate',\n 50\n );\n});\n"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 18346258..caa5eaee 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(t){var e={};function i(o){if(e[o])return e[o].exports;var a=e[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)i.d(o,a,function(e){return t[e]}.bind(null,a));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=26)}([function(t,e){t.exports=flarum.core.compat["common/app"]},,function(t,e){t.exports=flarum.core.compat["common/Model"]},function(t,e,i){"use strict";function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}i.d(e,"a",(function(){return a}))},function(t,e){t.exports=flarum.core.compat["common/components/Button"]},function(t,e){t.exports=flarum.core.compat["common/extend"]},,,function(t,e){t.exports=flarum.core.compat["common/Component"]},function(t,e){t.exports=flarum.core.compat["common/components/Alert"]},,function(t,e){t.exports=flarum.core.compat["common/components/LoadingIndicator"]},function(t,e){t.exports=flarum.core.compat["common/components/TextEditor"]},function(t,e){t.exports=flarum.core.compat["forum/components/UserPage"]},function(t,e){t.exports=flarum.core.compat["common/utils/classList"]},function(t,e){t.exports=flarum.core.compat["common/components/Tooltip"]},function(t,e){t.exports=flarum.core.compat["common/utils/extractText"]},function(t,e){t.exports=flarum.core.compat["common/models/User"]},function(t,e){t.exports=flarum.core.compat["common/components/LinkButton"]},function(t,e){t.exports=flarum.core.compat["common/utils/mixin"]},function(t,e){t.exports=flarum.core.compat["forum/components/Post"]},function(t,e){t.exports=flarum.core.compat["common/components/Modal"]},,,,,function(t,e,i){"use strict";i.r(e),i.d(e,"components",(function(){return X}));var o=i(5),a=i(0),n=i.n(a),s=i(13),r=i.n(s),l=i(18),u=i.n(l),d=i(3),p=i(2),c=i.n(p),f=i(19),h=function(t){function e(){return t.apply(this,arguments)||this}return Object(d.a)(e,t),e.prototype.apiEndpoint=function(){return"/fof/uploads"+(this.exists?"/"+this.data.id:"")},e}(i.n(f)()(c.a,{baseName:c.a.attribute("baseName"),path:c.a.attribute("path"),url:c.a.attribute("url"),type:c.a.attribute("type"),size:c.a.attribute("size"),humanSize:c.a.attribute("humanSize"),createdAt:c.a.attribute("createdAt"),uuid:c.a.attribute("uuid"),tag:c.a.attribute("tag"),hidden:c.a.attribute("hidden"),bbcode:c.a.attribute("bbcode")})),g=function(){function t(){this.user=null,this.files=[],this.moreResults=!1,this.loading=!1}var e=t.prototype;return e.setUser=function(t){t!==this.user&&(this.user=t,this.files=[],this.loadResults())},e.loadResults=function(t){if(void 0===t&&(t=0),this.user)return this.loading=!0,n.a.store.find("fof/uploads",{filter:{user:this.user.id()},page:{offset:t}}).then(this.parseResults.bind(this))},e.loadMore=function(){this.loading=!0,this.loadResults(this.files.length).then(this.parseResults.bind(this))},e.parseResults=function(t){var e;return(e=this.files).push.apply(e,t),this.loading=!1,this.moreResults=!!t.payload.links&&!!t.payload.links.next,m.redraw(),t},e.addToList=function(t){var e;Array.isArray(t)?(e=this.files).unshift.apply(e,t):this.files.unshift(t)},e.hasFiles=function(){return this.files.length>0},e.isLoading=function(){return this.loading},e.hasMoreResults=function(){return this.moreResults},e.empty=function(){return!this.hasFiles()&&!this.isLoading()},t}(),b=i(20),v=i.n(b),y=i(12),x=i.n(y),F=i(8),w=i.n(F),_=i(4),N=i.n(_),O=i(11),B=i.n(O),M=i(14),L=i.n(M),S=i(15),k=i.n(S),j=function(t){function e(){return t.apply(this,arguments)||this}Object(d.a)(e,t);var i=e.prototype;return i.oninit=function(e){var i=this;t.prototype.oninit.call(this,e),this.attrs.uploader.on("uploaded",(function(){i.$("form")[0].reset(),m.redraw()})),this.isMediaUploadButton=e.attrs.isMediaUploadButton||!1},i.view=function(){var t=this.attrs.uploader.uploading?n.a.translator.trans("fof-upload.forum.states.loading"):n.a.translator.trans("fof-upload.forum.buttons.upload");return m(k.a,{text:t},m(N.a,{className:L()(["Button","hasIcon","fof-upload-button",!this.isMediaUploadButton&&!this.attrs.uploader.uploading&&"Button--icon",!this.isMediaUploadButton&&!this.attrs.uploader.uploading&&"Button--link",this.attrs.uploader.uploading&&"uploading"]),icon:!this.attrs.uploader.uploading&&"fas fa-file-upload",onclick:this.uploadButtonClicked.bind(this),disabled:this.attrs.disabled},this.attrs.uploader.uploading&&m(B.a,{size:"tiny",className:"LoadingIndicator--inline Button-icon"}),(this.isMediaUploadButton||this.attrs.uploader.uploading)&&m("span",{className:"Button-label"},t),m("form",null,m("input",{type:"file",multiple:!0,onchange:this.process.bind(this)}))))},i.process=function(t){var e=this.$("input").prop("files");0!==e.length&&this.attrs.uploader.upload(e,!this.isMediaUploadButton)},i.uploadButtonClicked=function(t){this.$("input").click()},e}(w.a),T=function(){function t(t,e){this.upload=t,this.composerElement=e,this.handlers={},this.supportsFileDragging()&&(this.composerElement.addEventListener("dragover",this.handlers.in=this.in.bind(this)),this.composerElement.addEventListener("dragleave",this.handlers.out=this.out.bind(this)),this.composerElement.addEventListener("dragend",this.handlers.out),this.composerElement.addEventListener("drop",this.handlers.dropping=this.dropping.bind(this)))}var e=t.prototype;return e.supportsFileDragging=function(){var t=document.createElement("div");return("draggable"in t||"ondragstart"in t&&"ondrop"in t)&&"FormData"in window&&"FileReader"in window},e.unload=function(){this.handlers.in&&(this.composerElement.removeEventListener("dragover",this.handlers.in),this.composerElement.removeEventListener("dragleave",this.handlers.out),this.composerElement.removeEventListener("dragend",this.handlers.out),this.composerElement.removeEventListener("drop",this.handlers.dropping))},e.isNotFile=function(t){if(t.dataTransfer.items)for(var e=0;e0&&(t.preventDefault(),this.upload(i))}},t}(),U=function(){function t(){this.callbacks={success:[],failure:[],uploading:[],uploaded:[]},this.uploading=!1}var e=t.prototype;return e.on=function(t,e){this.callbacks[t].push(e)},e.dispatch=function(t,e){this.callbacks[t].forEach((function(t){return t(e)}))},e.upload=function(t,e){var i=this;void 0===e&&(e=!0),this.uploading=!0,this.dispatch("uploading",t),m.redraw();for(var o=new FormData,a=0;a=0?"far fa-file-archive":"application/pdf"===i?"far fa-file-pdf":q.indexOf(i)>=0?"far fa-file-word":i.includes("audio/")?"far fa-file-audio":$.indexOf(i)>=0?"far fa-file-code":"far fa-file"),a=!t.restrictFileType||t.isSelectable(e),n=L()(["fof-file","image"===o&&"fof-file-type-image",t.attrs.selectedFiles&&t.attrs.selectedFiles.indexOf(e.id())>=0&&"fof-file-selected"]),s=e.baseName(),r=t.filesBeingHidden.includes(e.uuid());return m("li",{"aria-busy":r},app.session.user&&(t.user===app.session.user||app.session.user.deleteOthersMediaLibrary())&&m(N.a,{className:"Button Button--icon fof-file-delete",icon:"far fa-trash-alt","aria-label":app.translator.trans("fof-upload.forum.file_list.delete_file_a11y_label",{fileName:s}),disabled:r,onclick:t.hideFile.bind(t,e)}),m("button",{className:n,onclick:function(){return t.onFileClick(e)},disabled:!a||r,"aria-label":P()(app.translator.trans("fof-upload.forum.file_list.select_file_a11y_label",{fileName:s}))},m("figure",null,"image"===o?m("img",{src:e.url(),className:"fof-file-image-preview",draggable:!1,alt:""}):m("span",{className:"fof-file-icon",role:"presentation"},m("i",{className:"fa-fw "+o})),m("figcaption",{className:"fof-file-name"},s),r&&m("span",{class:"fof-file-loading",role:"status","aria-label":app.translator.trans("fof-upload.forum.file_list.hide_file.loading")},m(B.a,null)))))}))),e.hasMoreResults()&&m("div",{className:"fof-load-more-files"},m(N.a,{className:"Button Button--primary",disabled:e.isLoading(),loading:e.isLoading(),onclick:function(){return e.loadMore()}},app.translator.trans("fof-upload.forum.file_list.load_more_files_btn"))))},i.onFileClick=function(t){this.attrs.onFileSelect?this.attrs.onFileSelect(t):this.attrs.downloadOnClick&&window.open(t.url())},i.isSelectable=function(t){var e=t.type();return Array.isArray(this.restrictFileType)?this.restrictFileType.indexOf(e)>=0:"image"===this.restrictFileType?e.includes("image/"):"audio"===this.restrictFileType?e.includes("audio/"):"video"===this.restrictFileType&&e.includes("video/")},i.hideFile=function(t){var e=this,i=t.uuid();if(!this.filesBeingHidden.includes(i))if(this.filesBeingHidden.push(i),confirm(P()(app.translator.trans("fof-upload.forum.file_list.hide_file.hide_confirmation",{fileName:t.baseName()}))))app.request({method:"PATCH",url:app.forum.attribute("apiUrl")+"/fof/upload/hide",body:{uuid:i}}).then((function(){app.alerts.show(R.a,{type:"success"},app.translator.trans("fof-upload.forum.file_list.hide_file.hide_success"))})).catch((function(){app.alerts.show(R.a,{type:"error"},app.translator.trans("fof-upload.forum.file_list.hide_file.hide_fail",{fileName:t.fileName()}))})).then((function(){var t=app.fileListState,o=t.files.findIndex((function(t){return i===t.uuid()}));t.files.splice(o,1);var a=e.filesBeingHidden.indexOf(i);e.filesBeingHidden.splice(a,1)}));else{var o=this.filesBeingHidden.indexOf(i);this.filesBeingHidden.splice(o,1)}},e}(w.a),G=function(t){function e(){return t.apply(this,arguments)||this}Object(d.a)(e,t);var i=e.prototype;return i.oninit=function(e){t.prototype.oninit.call(this,e),this.uploader=e.attrs.uploader,this.selectedFiles=[],this.multiSelect=e.attrs.multiSelect||!0,this.restrictFileType=e.attrs.restrictFileType||null,this.dragDrop=null,this.onUpload()},i.className=function(){return"Modal--large fof-file-manager-modal"},i.oncreate=function(e){var i=this;t.prototype.oncreate.call(this,e),this.dragDrop=new T((function(t){return i.uploader.upload(t,!1)}),this.$().find(".Modal-content")[0])},i.onremove=function(){this.dragDrop&&this.dragDrop.unload()},i.view=function(){var t=this.selectedFiles.length;return m("div",{className:"Modal modal-dialog "+this.className()},m("div",{className:"Modal-content"},m("div",{className:"fof-modal-buttons App-backControl"},m(j,{uploader:this.uploader,disabled:app.fileListState.isLoading(),isMediaUploadButton:!0})),m("div",{className:"fof-drag-and-drop"},m("div",{className:"fof-drag-and-drop-release"},m("i",{className:"fas fa-cloud-upload-alt"}),app.translator.trans("fof-upload.forum.file_list.release_to_upload"))),m("div",{className:"Modal-header"},m("h3",{className:"App-titleControl App-titleControl--text"},app.translator.trans("fof-upload.forum.media_manager"))),this.alertAttrs&&m("div",{className:"Modal-alert"},m(Alert,this.alertAttrs)),m("div",{className:"Modal-body"},m(V,{user:this.attrs.user,selectable:!0,onFileSelect:this.onFileSelect.bind(this),selectedFiles:this.selectedFiles,restrictFileType:this.restrictFileType})),m("div",{className:"Modal-footer"},m(N.a,{onclick:this.hide.bind(this),className:"Button"},app.translator.trans("fof-upload.forum.buttons.cancel")),m(N.a,{onclick:this.onSelect.bind(this),disabled:0===this.selectedFiles.length||!this.multiSelect&&this.selectedFiles.length>1,className:"Button Button--primary"},app.translator.trans("fof-upload.forum.file_list.confirm_selection_btn",{fileCount:t})))))},i.onFileSelect=function(t){var e=this.selectedFiles.indexOf(t.id());e>=0?this.selectedFiles.splice(e,1):this.multiSelect?this.selectedFiles.push(t.id()):this.selectedFiles=[t.id()]},i.onUpload=function(){var t=this;this.uploader.on("success",(function(e){var i=e.file;t.multiSelect?t.selectedFiles.push(i.id()):t.selectedFiles=[i.id()]}))},i.onSelect=function(){this.hide(),this.attrs.onSelect?this.attrs.onSelect(this.selectedFiles):this.selectedFiles.map((function(t){var e=app.store.getById("files",t);app.composer.editor.insertAtCursor(e.bbcode()+"\n",!1)}))},e}(A.a),J=function(t){function e(){return t.apply(this,arguments)||this}Object(d.a)(e,t);var i=e.prototype;return i.view=function(){return m(k.a,{text:n.a.translator.trans("fof-upload.forum.buttons.media")},N.a.component({className:"Button fof-upload-button Button--icon",onclick:this.fileManagerButtonClicked.bind(this),icon:"fas fa-photo-video"}))},i.fileManagerButtonClicked=function(t){t.preventDefault(),n.a.modal.show(G,{uploader:this.attrs.uploader})},e}(w.a),K=function(t){function e(){return t.apply(this,arguments)||this}Object(d.a)(e,t);var i=e.prototype;return i.oninit=function(e){t.prototype.oninit.call(this,e),this.user=null,this.loadUser(m.route.param("username"))},i.content=function(){return app.session.user&&(app.session.user.viewOthersMediaLibrary()||this.user===app.session.user)?this.user&&V.component({user:this.user,selectable:!1,downloadOnClick:!0}):null},i.show=function(e){t.prototype.show.call(this,e),this.user=e},e}(r.a),Q=i(17),W=i.n(Q),X={DragAndDrop:T,FileManagerButton:J,FileManagerModal:G,UserFileList:V,Uploader:U};n.a.initializers.add("fof-upload",(function(){W.a.prototype.viewOthersMediaLibrary=c.a.attribute("fof-upload-viewOthersMediaLibrary"),W.a.prototype.deleteOthersMediaLibrary=c.a.attribute("fof-upload-deleteOthersMediaLibrary"),Object(o.extend)(x.a.prototype,"oninit",(function(){this.uploader=new U})),Object(o.extend)(x.a.prototype,"controlItems",(function(t){if(n.a.forum.attribute("fof-upload.canUpload")){var e=n.a.forum.attribute("fof-upload.composerButtonVisiblity");"both"!==e&&"media-btn"!==e||t.add("fof-upload-media",J.component({uploader:this.uploader})),"both"!==e&&"upload-btn"!==e||t.add("fof-upload",j.component({uploader:this.uploader}))}})),Object(o.extend)(x.a.prototype,"oncreate",(function(t,e){var i=this;n.a.forum.attribute("fof-upload.canUpload")&&(this.uploader.on("success",(function(t){var e=t.file;if(t.addBBcode&&(i.attrs.composer.editor.insertAtCursor(e.bbcode()+"\n",!1),"function"==typeof i.attrs.preview)){var o=n.a.composer.isFullScreen;n.a.composer.isFullScreen=function(){return!1},i.attrs.preview(),n.a.composer.isFullScreen=o}})),this.dragAndDrop=new T((function(t){return i.uploader.upload(t)}),this.$().parents(".Composer")[0]),new E((function(t){return i.uploader.upload(t)}),this.$(".TextEditor-editor")[0]))})),Object(o.extend)(x.a.prototype,"onremove",(function(t,e){n.a.forum.attribute("fof-upload.canUpload")&&this.dragAndDrop.unload()})),Object(o.extend)(v.a.prototype,"oncreate",(function(){var t=this;this.$("[data-fof-upload-download-uuid]").unbind("click").on("click",(function(e){if(e.preventDefault(),e.stopPropagation(),n.a.forum.attribute("fof-upload.canDownload")){var i=n.a.forum.attribute("apiUrl")+"/fof/download";i+="/"+e.currentTarget.dataset.fofUploadDownloadUuid,i+="/"+t.attrs.post.id(),i+="/"+n.a.session.csrfToken,window.open(i)}else alert(n.a.translator.trans("fof-upload.forum.states.unauthorized"))}))})),n.a.store.models.files=h,n.a.fileListState=new g,n.a.routes["user.uploads"]={path:"/u/:username/uploads",component:K},Object(o.extend)(r.a.prototype,"navItems",(function(t){n.a.session.user&&(n.a.session.user.viewOthersMediaLibrary()||this.user===n.a.session.user)&&t.add("uploads",u.a.component({href:n.a.route("user.uploads",{username:this.user.username()}),name:"uploads",icon:"fas fa-file-upload"},this.user===n.a.session.user?n.a.translator.trans("fof-upload.forum.buttons.media"):n.a.translator.trans("fof-upload.forum.buttons.user_uploads")),80)}))}))}]); +module.exports=function(t){var e={};function i(o){if(e[o])return e[o].exports;var a=e[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)i.d(o,a,function(e){return t[e]}.bind(null,a));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=27)}([function(t,e){t.exports=flarum.core.compat["common/app"]},,function(t,e){t.exports=flarum.core.compat["common/Model"]},function(t,e,i){"use strict";function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}i.d(e,"a",(function(){return a}))},function(t,e){t.exports=flarum.core.compat["common/components/Button"]},function(t,e){t.exports=flarum.core.compat["common/extend"]},,,function(t,e){t.exports=flarum.core.compat["common/Component"]},function(t,e){t.exports=flarum.core.compat["common/components/Alert"]},,function(t,e){t.exports=flarum.core.compat["common/components/LoadingIndicator"]},function(t,e){t.exports=flarum.core.compat["common/components/TextEditor"]},function(t,e){t.exports=flarum.core.compat["forum/components/UserPage"]},function(t,e){t.exports=flarum.core.compat["common/utils/classList"]},function(t,e){t.exports=flarum.core.compat["common/components/Tooltip"]},function(t,e){t.exports=flarum.core.compat["forum/app"]},function(t,e){t.exports=flarum.core.compat["common/utils/extractText"]},function(t,e){t.exports=flarum.core.compat["common/models/User"]},function(t,e){t.exports=flarum.core.compat["common/components/LinkButton"]},function(t,e){t.exports=flarum.core.compat["common/utils/mixin"]},function(t,e){t.exports=flarum.core.compat["forum/components/Post"]},function(t,e){t.exports=flarum.core.compat["common/components/Modal"]},,,,,function(t,e,i){"use strict";i.r(e),i.d(e,"components",(function(){return Z}));var o=i(5),a=i(0),n=i.n(a),s=i(13),r=i.n(s),l=i(19),u=i.n(l),p=i(3),d=i(2),c=i.n(d),f=i(20),h=function(t){function e(){return t.apply(this,arguments)||this}return Object(p.a)(e,t),e.prototype.apiEndpoint=function(){return"/fof/uploads"+(this.exists?"/"+this.data.id:"")},e}(i.n(f)()(c.a,{baseName:c.a.attribute("baseName"),path:c.a.attribute("path"),url:c.a.attribute("url"),type:c.a.attribute("type"),size:c.a.attribute("size"),humanSize:c.a.attribute("humanSize"),createdAt:c.a.attribute("createdAt"),uuid:c.a.attribute("uuid"),tag:c.a.attribute("tag"),hidden:c.a.attribute("hidden"),bbcode:c.a.attribute("bbcode")})),g=function(){function t(){this.user=null,this.files=[],this.moreResults=!1,this.loading=!1}var e=t.prototype;return e.setUser=function(t){t!==this.user&&(this.user=t,this.files=[],this.loadResults())},e.loadResults=function(t){if(void 0===t&&(t=0),this.user)return this.loading=!0,n.a.store.find("fof/uploads",{filter:{user:this.user.id()},page:{offset:t}}).then(this.parseResults.bind(this))},e.loadMore=function(){this.loading=!0,this.loadResults(this.files.length).then(this.parseResults.bind(this))},e.parseResults=function(t){var e;return(e=this.files).push.apply(e,t),this.loading=!1,this.moreResults=!!t.payload.links&&!!t.payload.links.next,m.redraw(),t},e.addToList=function(t){var e;Array.isArray(t)?(e=this.files).unshift.apply(e,t):this.files.unshift(t)},e.hasFiles=function(){return this.files.length>0},e.isLoading=function(){return this.loading},e.hasMoreResults=function(){return this.moreResults},e.empty=function(){return!this.hasFiles()&&!this.isLoading()},t}(),b=i(21),v=i.n(b),y=i(12),x=i.n(y),F=i(16),w=i.n(F),_=i(8),N=i.n(_),O=i(4),B=i.n(O),M=i(11),L=i.n(M),S=i(14),k=i.n(S),j=i(15),T=i.n(j),E=function(t){function e(){return t.apply(this,arguments)||this}Object(p.a)(e,t);var i=e.prototype;return i.oninit=function(e){var i=this;t.prototype.oninit.call(this,e),this.attrs.uploader.on("uploaded",(function(){i.$("form")[0].reset(),m.redraw()})),this.isMediaUploadButton=e.attrs.isMediaUploadButton||!1},i.view=function(){var t=this.attrs.uploader.uploading?w.a.translator.trans("fof-upload.forum.states.loading"):w.a.translator.trans("fof-upload.forum.buttons.upload");return m(T.a,{text:t},m(B.a,{className:k()(["Button","hasIcon","fof-upload-button",!this.isMediaUploadButton&&!this.attrs.uploader.uploading&&"Button--icon",!this.isMediaUploadButton&&!this.attrs.uploader.uploading&&"Button--link",this.attrs.uploader.uploading&&"uploading"]),icon:!this.attrs.uploader.uploading&&"fas fa-file-upload",onclick:this.uploadButtonClicked.bind(this),disabled:this.attrs.disabled},this.attrs.uploader.uploading&&m(L.a,{size:"small",display:"inline",className:"Button-icon"}),(this.isMediaUploadButton||this.attrs.uploader.uploading)&&m("span",{className:"Button-label"},t),m("form",null,m("input",{type:"file",multiple:!0,onchange:this.process.bind(this)}))))},i.process=function(t){var e=this.$("input").prop("files");0!==e.length&&this.attrs.uploader.upload(e,!this.isMediaUploadButton)},i.uploadButtonClicked=function(t){this.$("input").click()},e}(N.a),U=function(){function t(t,e){this.upload=t,this.composerElement=e,this.handlers={},this.supportsFileDragging()&&(this.composerElement.addEventListener("dragover",this.handlers.in=this.in.bind(this)),this.composerElement.addEventListener("dragleave",this.handlers.out=this.out.bind(this)),this.composerElement.addEventListener("dragend",this.handlers.out),this.composerElement.addEventListener("drop",this.handlers.dropping=this.dropping.bind(this)))}var e=t.prototype;return e.supportsFileDragging=function(){var t=document.createElement("div");return("draggable"in t||"ondragstart"in t&&"ondrop"in t)&&"FormData"in window&&"FileReader"in window},e.unload=function(){this.handlers.in&&(this.composerElement.removeEventListener("dragover",this.handlers.in),this.composerElement.removeEventListener("dragleave",this.handlers.out),this.composerElement.removeEventListener("dragend",this.handlers.out),this.composerElement.removeEventListener("drop",this.handlers.dropping))},e.isNotFile=function(t){if(t.dataTransfer.items)for(var e=0;e0&&(t.preventDefault(),this.upload(i))}},t}(),A=function(){function t(){this.callbacks={success:[],failure:[],uploading:[],uploaded:[]},this.uploading=!1}var e=t.prototype;return e.on=function(t,e){this.callbacks[t].push(e)},e.dispatch=function(t,e){this.callbacks[t].forEach((function(t){return t(e)}))},e.upload=function(t,e){var i=this;void 0===e&&(e=!0),this.uploading=!0,this.dispatch("uploading",t),m.redraw();for(var o=new FormData,a=0;a=0?"far fa-file-archive":"application/pdf"===i?"far fa-file-pdf":G.indexOf(i)>=0?"far fa-file-word":i.includes("audio/")?"far fa-file-audio":V.indexOf(i)>=0?"far fa-file-code":"far fa-file"),a=!t.restrictFileType||t.isSelectable(e),n=k()(["fof-file","image"===o&&"fof-file-type-image",t.attrs.selectedFiles&&t.attrs.selectedFiles.indexOf(e.id())>=0&&"fof-file-selected"]),s=e.baseName(),r=t.filesBeingHidden.includes(e.uuid());return m("li",{"aria-busy":r},app.session.user&&(t.user===app.session.user||app.session.user.deleteOthersMediaLibrary())&&m(B.a,{className:"Button Button--icon fof-file-delete",icon:"far fa-trash-alt","aria-label":app.translator.trans("fof-upload.forum.file_list.delete_file_a11y_label",{fileName:s}),disabled:r,onclick:t.hideFile.bind(t,e)}),m("button",{className:n,onclick:function(){return t.onFileClick(e)},disabled:!a||r,"aria-label":$()(app.translator.trans("fof-upload.forum.file_list.select_file_a11y_label",{fileName:s}))},m("figure",null,"image"===o?m("img",{src:e.url(),className:"fof-file-image-preview",draggable:!1,alt:""}):m("span",{className:"fof-file-icon",role:"presentation"},m("i",{className:"fa-fw "+o})),m("figcaption",{className:"fof-file-name"},s),r&&m("span",{class:"fof-file-loading",role:"status","aria-label":app.translator.trans("fof-upload.forum.file_list.hide_file.loading")},m(L.a,null)))))}))),e.hasMoreResults()&&m("div",{className:"fof-load-more-files"},m(B.a,{className:"Button Button--primary",disabled:e.isLoading(),loading:e.isLoading(),onclick:function(){return e.loadMore()}},app.translator.trans("fof-upload.forum.file_list.load_more_files_btn"))))},i.onFileClick=function(t){this.attrs.onFileSelect?this.attrs.onFileSelect(t):this.attrs.downloadOnClick&&window.open(t.url())},i.isSelectable=function(t){var e=t.type();return Array.isArray(this.restrictFileType)?this.restrictFileType.indexOf(e)>=0:"image"===this.restrictFileType?e.includes("image/"):"audio"===this.restrictFileType?e.includes("audio/"):"video"===this.restrictFileType&&e.includes("video/")},i.hideFile=function(t){var e=this,i=t.uuid();if(!this.filesBeingHidden.includes(i))if(this.filesBeingHidden.push(i),confirm($()(app.translator.trans("fof-upload.forum.file_list.hide_file.hide_confirmation",{fileName:t.baseName()}))))app.request({method:"PATCH",url:app.forum.attribute("apiUrl")+"/fof/upload/hide",body:{uuid:i}}).then((function(){app.alerts.show(P.a,{type:"success"},app.translator.trans("fof-upload.forum.file_list.hide_file.hide_success"))})).catch((function(){app.alerts.show(P.a,{type:"error"},app.translator.trans("fof-upload.forum.file_list.hide_file.hide_fail",{fileName:t.fileName()}))})).then((function(){var t=app.fileListState,o=t.files.findIndex((function(t){return i===t.uuid()}));t.files.splice(o,1);var a=e.filesBeingHidden.indexOf(i);e.filesBeingHidden.splice(a,1)}));else{var o=this.filesBeingHidden.indexOf(i);this.filesBeingHidden.splice(o,1)}},e}(N.a),K=function(t){function e(){return t.apply(this,arguments)||this}Object(p.a)(e,t);var i=e.prototype;return i.oninit=function(e){t.prototype.oninit.call(this,e),this.uploader=e.attrs.uploader,this.selectedFiles=[],this.multiSelect=e.attrs.multiSelect||!0,this.restrictFileType=e.attrs.restrictFileType||null,this.dragDrop=null,this.onUpload()},i.className=function(){return"Modal--large fof-file-manager-modal"},i.oncreate=function(e){var i=this;t.prototype.oncreate.call(this,e),this.dragDrop=new U((function(t){return i.uploader.upload(t,!1)}),this.$().find(".Modal-content")[0])},i.onremove=function(){this.dragDrop&&this.dragDrop.unload()},i.view=function(){var t=this.selectedFiles.length;return m("div",{className:"Modal modal-dialog "+this.className()},m("div",{className:"Modal-content"},m("div",{className:"fof-modal-buttons App-backControl"},m(E,{uploader:this.uploader,disabled:app.fileListState.isLoading(),isMediaUploadButton:!0})),m("div",{className:"fof-drag-and-drop"},m("div",{className:"fof-drag-and-drop-release"},m("i",{className:"fas fa-cloud-upload-alt"}),app.translator.trans("fof-upload.forum.file_list.release_to_upload"))),m("div",{className:"Modal-header"},m("h3",{className:"App-titleControl App-titleControl--text"},app.translator.trans("fof-upload.forum.media_manager"))),this.alertAttrs&&m("div",{className:"Modal-alert"},m(Alert,this.alertAttrs)),m("div",{className:"Modal-body"},m(J,{user:this.attrs.user,selectable:!0,onFileSelect:this.onFileSelect.bind(this),selectedFiles:this.selectedFiles,restrictFileType:this.restrictFileType})),m("div",{className:"Modal-footer"},m(B.a,{onclick:this.hide.bind(this),className:"Button"},app.translator.trans("fof-upload.forum.buttons.cancel")),m(B.a,{onclick:this.onSelect.bind(this),disabled:0===this.selectedFiles.length||!this.multiSelect&&this.selectedFiles.length>1,className:"Button Button--primary"},app.translator.trans("fof-upload.forum.file_list.confirm_selection_btn",{fileCount:t})))))},i.onFileSelect=function(t){var e=this.selectedFiles.indexOf(t.id());e>=0?this.selectedFiles.splice(e,1):this.multiSelect?this.selectedFiles.push(t.id()):this.selectedFiles=[t.id()]},i.onUpload=function(){var t=this;this.uploader.on("success",(function(e){var i=e.file;t.multiSelect?t.selectedFiles.push(i.id()):t.selectedFiles=[i.id()]}))},i.onSelect=function(){this.hide(),this.attrs.onSelect?this.attrs.onSelect(this.selectedFiles):this.selectedFiles.map((function(t){var e=app.store.getById("files",t);app.composer.editor.insertAtCursor(e.bbcode()+"\n",!1)}))},e}(R.a),Q=function(t){function e(){return t.apply(this,arguments)||this}Object(p.a)(e,t);var i=e.prototype;return i.view=function(){return m(T.a,{text:n.a.translator.trans("fof-upload.forum.buttons.media")},B.a.component({className:"Button fof-upload-button Button--icon",onclick:this.fileManagerButtonClicked.bind(this),icon:"fas fa-photo-video"}))},i.fileManagerButtonClicked=function(t){t.preventDefault(),n.a.modal.show(K,{uploader:this.attrs.uploader})},e}(N.a),W=function(t){function e(){return t.apply(this,arguments)||this}Object(p.a)(e,t);var i=e.prototype;return i.oninit=function(e){t.prototype.oninit.call(this,e),this.user=null,this.loadUser(m.route.param("username"))},i.content=function(){return app.session.user&&(app.session.user.viewOthersMediaLibrary()||this.user===app.session.user)?this.user&&J.component({user:this.user,selectable:!1,downloadOnClick:!0}):null},i.show=function(e){t.prototype.show.call(this,e),this.user=e},e}(r.a),X=i(18),Y=i.n(X),Z={DragAndDrop:U,FileManagerButton:Q,FileManagerModal:K,UserFileList:J,Uploader:A};n.a.initializers.add("fof-upload",(function(){Y.a.prototype.viewOthersMediaLibrary=c.a.attribute("fof-upload-viewOthersMediaLibrary"),Y.a.prototype.deleteOthersMediaLibrary=c.a.attribute("fof-upload-deleteOthersMediaLibrary"),Object(o.extend)(x.a.prototype,"oninit",(function(){this.uploader=new A})),Object(o.extend)(x.a.prototype,"controlItems",(function(t){if(n.a.forum.attribute("fof-upload.canUpload")){var e=n.a.forum.attribute("fof-upload.composerButtonVisiblity");"both"!==e&&"media-btn"!==e||t.add("fof-upload-media",Q.component({uploader:this.uploader})),"both"!==e&&"upload-btn"!==e||t.add("fof-upload",E.component({uploader:this.uploader}))}})),Object(o.extend)(x.a.prototype,"oncreate",(function(t,e){var i=this;n.a.forum.attribute("fof-upload.canUpload")&&(this.uploader.on("success",(function(t){var e=t.file;if(t.addBBcode&&(i.attrs.composer.editor.insertAtCursor(e.bbcode()+"\n",!1),"function"==typeof i.attrs.preview)){var o=n.a.composer.isFullScreen;n.a.composer.isFullScreen=function(){return!1},i.attrs.preview(),n.a.composer.isFullScreen=o}})),this.dragAndDrop=new U((function(t){return i.uploader.upload(t)}),this.$().parents(".Composer")[0]),new D((function(t){return i.uploader.upload(t)}),this.$(".TextEditor-editor")[0]))})),Object(o.extend)(x.a.prototype,"onremove",(function(t,e){n.a.forum.attribute("fof-upload.canUpload")&&this.dragAndDrop.unload()})),Object(o.extend)(v.a.prototype,"oncreate",(function(){var t=this;this.$("[data-fof-upload-download-uuid]").unbind("click").on("click",(function(e){if(e.preventDefault(),e.stopPropagation(),n.a.forum.attribute("fof-upload.canDownload")){var i=n.a.forum.attribute("apiUrl")+"/fof/download";i+="/"+e.currentTarget.dataset.fofUploadDownloadUuid,i+="/"+t.attrs.post.id(),i+="/"+n.a.session.csrfToken,window.open(i)}else alert(n.a.translator.trans("fof-upload.forum.states.unauthorized"))}))})),n.a.store.models.files=h,n.a.fileListState=new g,n.a.routes["user.uploads"]={path:"/u/:username/uploads",component:W},Object(o.extend)(r.a.prototype,"navItems",(function(t){n.a.session.user&&(n.a.session.user.viewOthersMediaLibrary()||this.user===n.a.session.user)&&t.add("uploads",u.a.component({href:n.a.route("user.uploads",{username:this.user.username()}),name:"uploads",icon:"fas fa-file-upload"},this.user===n.a.session.user?n.a.translator.trans("fof-upload.forum.buttons.media"):n.a.translator.trans("fof-upload.forum.buttons.user_uploads")),80)}))}))}]); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index acaddd24..fc0bdbc0 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/external \"flarum.core.compat['common/app']\"","webpack://@fof/upload/external \"flarum.core.compat['common/Model']\"","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/external \"flarum.core.compat['common/components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['common/extend']\"","webpack://@fof/upload/external \"flarum.core.compat['common/Component']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['forum/components/UserPage']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Tooltip']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/extractText']\"","webpack://@fof/upload/external \"flarum.core.compat['common/models/User']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/LinkButton']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/mixin']\"","webpack://@fof/upload/external \"flarum.core.compat['forum/components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/UploadsUserPage.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","File","apiEndpoint","this","exists","data","id","mixin","Model","baseName","attribute","path","url","type","size","humanSize","createdAt","uuid","tag","hidden","bbcode","FileListState","user","files","moreResults","loading","setUser","loadResults","offset","app","store","find","filter","page","then","parseResults","loadMore","length","results","push","payload","links","next","redraw","addToList","Array","isArray","unshift","hasFiles","isLoading","hasMoreResults","empty","UploadButton","oninit","vnode","attrs","uploader","on","$","reset","isMediaUploadButton","view","buttonText","uploading","translator","trans","text","className","classList","icon","onclick","uploadButtonClicked","disabled","multiple","onchange","process","e","prop","upload","click","Component","DragAndDrop","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","unload","removeEventListener","isNotFile","event","dataTransfer","items","kind","preventDefault","over","add","remove","PasteClipboard","element","paste","clipboardData","indexOf","getAsFile","Uploader","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","addBBcode","body","FormData","append","request","method","forum","serialize","raw","result","error","file","fileObj","pushObject","fileListState","image","archive","code","word","UserFileList","session","inModal","selectable","restrictFileType","downloadOnClick","filesBeingHidden","state","aria-live","screen","map","fileType","fileIcon","includes","fileSelectable","isSelectable","fileClassNames","selectedFiles","fileName","isFileHiding","aria-busy","deleteOthersMediaLibrary","aria-label","hideFile","onFileClick","extractText","src","draggable","alt","role","class","onFileSelect","open","confirm","alerts","show","Alert","index","findIndex","splice","FileManagerModal","multiSelect","dragDrop","onUpload","oncreate","onremove","fileCount","alertAttrs","hide","onSelect","itemPosition","fileId","getById","composer","editor","insertAtCursor","Modal","FileManagerButton","Button","component","fileManagerButtonClicked","modal","UploadsUserPage","loadUser","route","param","content","viewOthersMediaLibrary","UserPage","components","initializers","User","extend","TextEditor","composerButtonVisiblity","f_","preview","originalIsFullScreen","isFullScreen","dragAndDrop","parents","Post","unbind","stopPropagation","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","alert","models","routes","LinkButton","href","username"],"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,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WAC3CgB,KAAKuD,EAAE,mCACFiK,OAAO,SACPlK,GAAG,SAAS,SAACmB,GAIV,GAHAA,EAAEuB,iBACFvB,EAAEgJ,kBAEG/L,IAAI+F,MAAMlH,UAAU,0BAAzB,CAKA,IAAIE,EAAMiB,IAAI+F,MAAMlH,UAAU,UAAY,gBAE1CE,GAAO,IAAMgE,EAAEiJ,cAAcC,QAAQC,sBACrCnN,GAAO,IAAM,EAAK2C,MAAMyK,KAAK1N,KAC7BM,GAAO,IAAMiB,IAAI6G,QAAQuF,UAEzBtI,OAAO8E,KAAK7J,QAVRsN,MAAMrM,IAAImC,WAAWC,MAAM,+CFQ3CpC,IAAIC,MAAMqM,OAAO5M,MAAQtB,EAGzB4B,IAAIuG,cAAgB,IAAI/G,EAGxBQ,IAAIuM,OAAO,gBAAkB,CACzBzN,KAAM,uBACNyL,UAAWG,GAIfU,iBAAOJ,IAAS1N,UAAW,YAAY,SAAU8G,GACzCpE,IAAI6G,QAAQpH,OAASO,IAAI6G,QAAQpH,KAAKsL,0BAA4BzM,KAAKmB,OAASO,IAAI6G,QAAQpH,OAC5F2E,EAAMI,IACF,UACAgI,IAAWjC,UACP,CACIkC,KAAMzM,IAAI4K,MAAM,eAAgB,CAC5B8B,SAAUpO,KAAKmB,KAAKiN,aAExBzQ,KAAM,UACNuG,KAAM,sBAEVlE,KAAKmB,OAASO,IAAI6G,QAAQpH,KACpBO,IAAImC,WAAWC,MAAM,kCACrBpC,IAAImC,WAAWC,MAAM,0CAE/B","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 26);\n","module.exports = flarum.core.compat['common/app'];","module.exports = flarum.core.compat['common/Model'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","module.exports = flarum.core.compat['common/components/Button'];","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['common/Component'];","module.exports = flarum.core.compat['common/components/Alert'];","module.exports = flarum.core.compat['common/components/LoadingIndicator'];","module.exports = flarum.core.compat['common/components/TextEditor'];","module.exports = flarum.core.compat['forum/components/UserPage'];","module.exports = flarum.core.compat['common/utils/classList'];","module.exports = flarum.core.compat['common/components/Tooltip'];","module.exports = flarum.core.compat['common/utils/extractText'];","module.exports = flarum.core.compat['common/models/User'];","module.exports = flarum.core.compat['common/components/LinkButton'];","module.exports = flarum.core.compat['common/utils/mixin'];","module.exports = flarum.core.compat['forum/components/Post'];","module.exports = flarum.core.compat['common/components/Modal'];","import Model from 'flarum/common/Model';\nimport mixin from 'flarum/common/utils/mixin';\n\nexport default class File extends mixin(Model, {\n baseName: Model.attribute('baseName'),\n path: Model.attribute('path'),\n url: Model.attribute('url'),\n type: Model.attribute('type'),\n size: Model.attribute('size'),\n humanSize: Model.attribute('humanSize'),\n createdAt: Model.attribute('createdAt'),\n uuid: Model.attribute('uuid'),\n tag: Model.attribute('tag'),\n hidden: Model.attribute('hidden'),\n bbcode: Model.attribute('bbcode'),\n}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","import app from 'flarum/common/app';\n\nexport default class FileListState {\n constructor() {\n this.user = null;\n\n this.files = [];\n\n this.moreResults = false;\n\n this.loading = false;\n }\n\n /**\n * Set user and load list\n *\n * @param user A user to populate the media manager\n */\n setUser(user) {\n // Keep previous state\n if (user === this.user) return;\n\n // Set user\n this.user = user;\n\n // Reset file list\n this.files = [];\n\n // Load user files\n this.loadResults();\n }\n\n /**\n * Load more user files\n *\n * @param offset The index to start the page at.\n */\n loadResults(offset = 0) {\n if (!this.user) return;\n\n this.loading = true;\n\n return app.store\n .find('fof/uploads', {\n filter: {\n user: this.user.id(),\n },\n page: {\n offset,\n },\n })\n .then(this.parseResults.bind(this));\n }\n\n /**\n * Load the next page of discussion results.\n */\n loadMore() {\n this.loading = true;\n\n this.loadResults(this.files.length).then(this.parseResults.bind(this));\n }\n\n /**\n * Parse results and append them to the file list.\n */\n parseResults(results) {\n this.files.push(...results);\n\n this.loading = false;\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n\n m.redraw();\n\n return results;\n }\n\n /**\n * Add files to the beginning of the list\n */\n addToList(files) {\n if (Array.isArray(files)) {\n this.files.unshift(...files);\n } else {\n this.files.unshift(files);\n }\n }\n\n /**\n * Are there any files in the list?\n */\n hasFiles() {\n return this.files.length > 0;\n }\n\n /**\n * Is the file list loading?\n */\n isLoading() {\n return this.loading;\n }\n\n /**\n * Does this user has more files?\n */\n hasMoreResults() {\n return this.moreResults;\n }\n\n /**\n * Does this user have any files?\n */\n empty() {\n return !this.hasFiles() && !this.isLoading();\n }\n}\n","import app from 'flarum/common/app';\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport classList from 'flarum/common/utils/classList';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default class UploadButton extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.attrs.uploader.on('uploaded', () => {\n // reset the button for a new upload\n this.$('form')[0].reset();\n\n // redraw to reflect uploader.loading in the DOM\n m.redraw();\n });\n\n this.isMediaUploadButton = vnode.attrs.isMediaUploadButton || false;\n }\n\n view() {\n const buttonText = this.attrs.uploader.uploading\n ? app.translator.trans('fof-upload.forum.states.loading')\n : app.translator.trans('fof-upload.forum.buttons.upload');\n\n return (\n \n \n {this.attrs.uploader.uploading && }\n {(this.isMediaUploadButton || this.attrs.uploader.uploading) && {buttonText}}\n
    \n \n
    \n \n
    \n );\n }\n\n /**\n * Process the upload event.\n *\n * @param e\n */\n process(e) {\n // get the file from the input field\n const files = this.$('input').prop('files');\n\n if (files.length === 0) {\n // We've got no files to upload, so trying\n // to begin an upload will show an error\n // to the user.\n return;\n }\n\n this.attrs.uploader.upload(files, !this.isMediaUploadButton);\n }\n\n /**\n * Event handler for upload button being clicked\n *\n * @param {PointerEvent} e\n */\n uploadButtonClicked(e) {\n // Trigger click on hidden input element\n // (Opens file dialog)\n this.$('input').click();\n }\n}\n","export default class DragAndDrop {\n constructor(upload, composerElement) {\n this.upload = upload;\n this.composerElement = composerElement;\n\n // Keep references to the bound methods so we can remove the event listeners later\n this.handlers = {};\n\n if (!this.supportsFileDragging()) {\n return;\n }\n\n this.composerElement.addEventListener('dragover', (this.handlers.in = this.in.bind(this)));\n\n this.composerElement.addEventListener('dragleave', (this.handlers.out = this.out.bind(this)));\n this.composerElement.addEventListener('dragend', this.handlers.out);\n\n this.composerElement.addEventListener('drop', (this.handlers.dropping = this.dropping.bind(this)));\n }\n\n supportsFileDragging() {\n // Based on https://css-tricks.com/drag-and-drop-file-uploading/\n const div = document.createElement('div');\n\n return ('draggable' in div || ('ondragstart' in div && 'ondrop' in div)) && 'FormData' in window && 'FileReader' in window;\n }\n\n unload() {\n // If the handlers were not set (drag and drop not supported), we skip removing them\n if (!this.handlers.in) {\n return;\n }\n\n this.composerElement.removeEventListener('dragover', this.handlers.in);\n\n this.composerElement.removeEventListener('dragleave', this.handlers.out);\n this.composerElement.removeEventListener('dragend', this.handlers.out);\n\n this.composerElement.removeEventListener('drop', this.handlers.dropping);\n }\n\n isNotFile(event) {\n // Checking event.dataTransfer.files.length does not work on dragover event, it's always zero\n // So we use the dataTransfer.items property to check whether any file is being dragged\n if (event.dataTransfer.items) {\n for (let i = 0; i < event.dataTransfer.items.length; i++) {\n if (event.dataTransfer.items[i].kind !== 'file') {\n return true;\n }\n }\n }\n\n return false;\n }\n\n in(event) {\n if (this.isNotFile(event)) {\n return;\n }\n\n event.preventDefault();\n\n if (!this.over) {\n this.composerElement.classList.add('fof-upload-dragging');\n this.over = true;\n }\n }\n\n out(event) {\n if (this.isNotFile(event)) {\n return;\n }\n\n event.preventDefault();\n\n if (this.over) {\n this.composerElement.classList.remove('fof-upload-dragging');\n this.over = false;\n }\n }\n\n dropping(event) {\n if (this.isNotFile(event)) {\n return;\n }\n\n event.preventDefault();\n\n this.upload(event.dataTransfer.files);\n\n this.composerElement.classList.remove('fof-upload-dragging');\n }\n}\n","export default class PasteClipboard {\n constructor(upload, element) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they'll get removed when the DOM does.\n element.addEventListener('paste', this.paste.bind(this));\n }\n\n paste(e) {\n if (e.clipboardData && e.clipboardData.items) {\n const items = e.clipboardData.items;\n\n const files = [];\n\n for (let i = 0; i < items.length; i++) {\n if (items[i].type.indexOf('image') !== -1) {\n files.push(items[i].getAsFile());\n }\n }\n\n if (files.length > 0) {\n e.preventDefault();\n\n this.upload(files);\n }\n }\n }\n}\n","import app from 'flarum/common/app';\n\nexport default class Uploader {\n constructor() {\n this.callbacks = {\n success: [],\n failure: [],\n uploading: [],\n uploaded: [],\n };\n this.uploading = false;\n }\n\n on(type, callback) {\n this.callbacks[type].push(callback);\n }\n\n dispatch(type, response) {\n this.callbacks[type].forEach((callback) => callback(response));\n }\n\n upload(files, addBBcode = true) {\n this.uploading = true;\n this.dispatch('uploading', files);\n\n m.redraw(); // Forcing a redraw so that the button also updates if uploadFiles() is called from DragAndDrop or PasteClipboard\n\n const body = new FormData();\n\n for (let i = 0; i < files.length; i++) {\n body.append('files[]', files[i]);\n }\n\n // send a POST request to the api\n return app\n .request({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/fof/upload',\n // prevent JSON.stringify'ing the form data in the XHR call\n serialize: (raw) => raw,\n body,\n })\n .then((result) => this.uploaded(result, addBBcode))\n .catch((error) => {\n this.uploading = false;\n m.redraw();\n\n throw error;\n });\n }\n\n uploaded(result, addBBcode = false) {\n this.uploading = false;\n\n result.data.forEach((file) => {\n const fileObj = app.store.pushObject(file);\n\n // Add file to media manager\n app.fileListState.addToList(fileObj);\n\n // Dispatch\n this.dispatch('success', {\n file: fileObj,\n addBBcode,\n });\n });\n\n this.dispatch('uploaded');\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml', 'image/gif'];\nconst archive = ['application/zip', 'application/x-7z-compressed', 'application/gzip', 'application/vnd.rar', 'application/x-rar-compressed'];\nconst code = ['text/html', 'text/css', 'text/javascript', 'application/json', 'application/ld+json', 'text/javascript', 'application/x-httpd-php'];\nconst word = [\n 'application/x-abiword',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'application/pdf',\n];\n\n/**\n * Returns a FontAwesome icon class for a specified MIME type.\n *\n * If it's a known image type, it returns `image` instead.\n *\n * @param {string} fileType MIME type\n * @returns {string} Icon for MIME type\n */\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.includes(fileType)) {\n return 'image';\n }\n // Display image icon for other types\n else if (fileType.includes('image/')) {\n return 'far fa-file-image';\n }\n // Video icon\n else if (fileType.includes('video/')) {\n return 'far fa-file-video';\n }\n // Archive icon\n else if (archive.indexOf(fileType) >= 0) {\n return 'far fa-file-archive';\n }\n // PDF icon\n else if (fileType === 'application/pdf') {\n return 'far fa-file-pdf';\n }\n // Word\n else if (word.indexOf(fileType) >= 0) {\n return 'far fa-file-word';\n }\n // Audio icon\n else if (fileType.includes('audio/')) {\n return 'far fa-file-audio';\n }\n // Code files\n else if (code.indexOf(fileType) >= 0) {\n return 'far fa-file-code';\n }\n\n return 'far fa-file';\n}\n","import Component from 'flarum/common/Component';\n\nimport Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nimport classList from 'flarum/common/utils/classList';\nimport extractText from 'flarum/common/utils/extractText';\n\nimport mimeToIcon from '../../common/mimeToIcon';\n\nexport default class UserFileList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Load file list\n app.fileListState.setUser(vnode.attrs.user || app.session.user);\n\n this.inModal = vnode.attrs.selectable;\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n this.downloadOnClick = this.attrs.downloadOnClick || false;\n /**\n * @type {string[]} List of file UUIDs currently being hidden.\n */\n this.filesBeingHidden = [];\n\n /**\n * The user who's media we are dealing with\n */\n this.user = app.fileListState.user;\n }\n\n view() {\n /**\n * @type {{empty(): boolean, files: import('../../common/models/File').default[]}}\n */\n const state = app.fileListState;\n\n return (\n
    \n {/* Loading */}\n {state.isLoading() && state.files.length === 0 && (\n
    \n {app.translator.trans('fof-upload.forum.file_list.loading')}\n\n \n
    \n )}\n\n {/* Empty personal file list */}\n {this.inModal && state.empty() && (\n

    \n \n\n {app.translator.trans(`fof-upload.forum.file_list.modal_empty_${app.screen() !== 'phone' ? 'desktop' : 'phone'}`)}\n

    \n )}\n\n {/* Empty file list */}\n {!this.inModal && state.empty() &&

    {app.translator.trans('fof-upload.forum.file_list.empty')}

    }\n\n {/* File list */}\n
      \n {state.files.map((file) => {\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n const fileClassNames = classList([\n 'fof-file',\n // File is image\n fileIcon === 'image' && 'fof-file-type-image',\n // File is selected\n this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0 && 'fof-file-selected',\n ]);\n\n /**\n * File's baseName (file name + extension)\n * @type {string}\n */\n const fileName = file.baseName();\n\n const isFileHiding = this.filesBeingHidden.includes(file.uuid());\n\n return (\n
    • \n {app.session.user && (this.user === app.session.user || app.session.user.deleteOthersMediaLibrary()) && (\n \n )}\n\n this.onFileClick(file)}\n disabled={!fileSelectable || isFileHiding}\n aria-label={extractText(app.translator.trans('fof-upload.forum.file_list.select_file_a11y_label', { fileName }))}\n >\n
      \n {fileIcon === 'image' ? (\n \n ) : (\n \n \n \n )}\n\n
      {fileName}
      \n\n {isFileHiding && (\n \n \n \n )}\n
      \n \n
    • \n );\n })}\n
    \n\n {/* Load more files */}\n {state.hasMoreResults() && (\n
    \n state.loadMore()}\n >\n {app.translator.trans('fof-upload.forum.file_list.load_more_files_btn')}\n \n
    \n )}\n
    \n );\n }\n\n /**\n * Execute function on file click\n *\n * @param {import('../../common/models/File').default} file\n */\n onFileClick(file) {\n // Custom functionality\n if (this.attrs.onFileSelect) {\n this.attrs.onFileSelect(file);\n return;\n }\n\n // Download on click\n if (this.attrs.downloadOnClick) {\n window.open(file.url());\n return;\n }\n }\n\n /**\n * Check if a file is selectable\n *\n * @param {import('../../common/models/File').default} file\n */\n isSelectable(file) {\n const fileType = file.type();\n\n // Custom defined file types\n if (Array.isArray(this.restrictFileType)) {\n return this.restrictFileType.indexOf(fileType) >= 0;\n }\n\n // Image\n else if (this.restrictFileType === 'image') {\n return fileType.includes('image/');\n }\n\n // Audio\n else if (this.restrictFileType === 'audio') {\n return fileType.includes('audio/');\n }\n\n // Video\n else if (this.restrictFileType === 'video') {\n return fileType.includes('video/');\n }\n\n return false;\n }\n\n /**\n * Begins the hiding process for a file.\n *\n * - Shows a native confirmation dialog\n * - If confirmed, sends AJAX request to the hide file API\n *\n * @param {import('../../common/models/File').default} file File to hide\n */\n hideFile(file) {\n /**\n * @type {string} File UUID\n */\n const uuid = file.uuid();\n\n if (this.filesBeingHidden.includes(uuid)) return;\n\n this.filesBeingHidden.push(uuid);\n\n const confirmHide = confirm(\n extractText(app.translator.trans('fof-upload.forum.file_list.hide_file.hide_confirmation', { fileName: file.baseName() }))\n );\n\n if (confirmHide) {\n app.request({\n method: 'PATCH',\n url: `${app.forum.attribute('apiUrl')}/fof/upload/hide`,\n body: { uuid },\n })\n .then(() => {\n app.alerts.show(Alert, { type: 'success' }, app.translator.trans('fof-upload.forum.file_list.hide_file.hide_success'));\n })\n .catch(() => {\n app.alerts.show(\n Alert,\n { type: 'error' },\n app.translator.trans('fof-upload.forum.file_list.hide_file.hide_fail', { fileName: file.fileName() })\n );\n })\n .then(() => {\n // Remove hidden file from state\n /**\n * @type {{ files: import('../../common/models/File').default[] }}\n */\n const state = app.fileListState;\n\n const index = state.files.findIndex((file) => uuid === file.uuid());\n state.files.splice(index, 1);\n\n // Remove file from hiding list\n const i = this.filesBeingHidden.indexOf(uuid);\n this.filesBeingHidden.splice(i, 1);\n });\n } else {\n // Remove file from hiding list\n const i = this.filesBeingHidden.indexOf(uuid);\n this.filesBeingHidden.splice(i, 1);\n }\n }\n}\n","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport UploadButton from './UploadButton';\nimport UserFileList from './UserFileList';\nimport DragAndDrop from './DragAndDrop';\n\nexport default class FileManagerModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Initialize upload managers\n this.uploader = vnode.attrs.uploader;\n\n // Current selected files\n this.selectedFiles = [];\n\n // Allow multiselect\n this.multiSelect = vnode.attrs.multiSelect || true;\n\n // Restrict file selection to specific types\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n\n // Drag & drop\n this.dragDrop = null;\n\n // Initialize uploads\n this.onUpload();\n }\n\n className() {\n return 'Modal--large fof-file-manager-modal';\n }\n\n /**\n * Initialize drag & drop\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.dragDrop = new DragAndDrop((files) => this.uploader.upload(files, false), this.$().find('.Modal-content')[0]);\n }\n\n /**\n * Remove events from modal content\n */\n onremove() {\n if (this.dragDrop) {\n this.dragDrop.unload();\n }\n }\n\n view() {\n const fileCount = this.selectedFiles.length;\n\n return (\n
    \n
    \n
    \n \n
    \n\n
    \n
    \n \n\n {app.translator.trans('fof-upload.forum.file_list.release_to_upload')}\n
    \n
    \n\n
    \n

    {app.translator.trans('fof-upload.forum.media_manager')}

    \n
    \n\n {this.alertAttrs && (\n
    \n \n
    \n )}\n\n
    \n \n
    \n\n
    \n \n\n 1)}\n className=\"Button Button--primary\"\n >\n {app.translator.trans('fof-upload.forum.file_list.confirm_selection_btn', { fileCount })}\n \n
    \n
    \n
    \n );\n }\n\n /**\n * Add or remove file from selected files\n *\n * @param {File} file\n */\n onFileSelect(file) {\n const itemPosition = this.selectedFiles.indexOf(file.id());\n\n if (itemPosition >= 0) {\n this.selectedFiles.splice(itemPosition, 1);\n } else {\n if (this.multiSelect) {\n this.selectedFiles.push(file.id());\n } else {\n this.selectedFiles = [file.id()];\n }\n }\n }\n\n /**\n * Add files to file list after upload\n */\n onUpload() {\n this.uploader.on('success', ({ file }) => {\n if (this.multiSelect) {\n this.selectedFiles.push(file.id());\n } else {\n this.selectedFiles = [file.id()];\n }\n });\n }\n\n /**\n * Add selected files to the composer\n */\n onSelect() {\n this.hide();\n\n // Custom callback\n if (this.attrs.onSelect) {\n this.attrs.onSelect(this.selectedFiles);\n\n return;\n }\n\n // Add selected files to composer\n this.selectedFiles.map((fileId) => {\n const file = app.store.getById('files', fileId);\n\n app.composer.editor.insertAtCursor(file.bbcode() + '\\n', false);\n });\n }\n}\n","import app from 'flarum/common/app';\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport FileManagerModal from './FileManagerModal';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default class FileManagerButton extends Component {\n view() {\n return (\n \n {Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n })}\n \n );\n }\n\n /**\n * Event handler for upload button being clicked\n *\n * @param {PointerEvent} e\n */\n fileManagerButtonClicked(e) {\n e.preventDefault();\n\n // Open dialog\n app.modal.show(FileManagerModal, {\n uploader: this.attrs.uploader,\n });\n }\n}\n","import UserPage from 'flarum/forum/components/UserPage';\nimport UserFileList from './UserFileList';\n\nexport default class UploadsUserPage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.user = null;\n\n this.loadUser(m.route.param('username'));\n }\n\n content() {\n if (app.session.user && (app.session.user.viewOthersMediaLibrary() || this.user === app.session.user)) {\n return (\n this.user &&\n UserFileList.component({\n user: this.user,\n selectable: false,\n downloadOnClick: true,\n })\n );\n } else {\n return null;\n }\n }\n\n show(user) {\n super.show(user);\n this.user = user;\n }\n}\n","import Uploader from '../handler/Uploader';\nimport DragAndDrop from './DragAndDrop';\nimport FileManagerButton from './FileManagerButton';\nimport FileManagerModal from './FileManagerModal';\nimport UserFileList from './UserFileList';\n\nexport const components = {\n DragAndDrop,\n FileManagerButton,\n FileManagerModal,\n UserFileList,\n Uploader,\n};\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/common/app';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\n\nimport File from '../common/models/File';\nimport FileListState from './states/FileListState';\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\nimport UploadsUserPage from './components/UploadsUserPage';\nimport User from 'flarum/common/models/User';\nimport Model from 'flarum/common/Model';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\n User.prototype.viewOthersMediaLibrary = Model.attribute('fof-upload-viewOthersMediaLibrary');\n User.prototype.deleteOthersMediaLibrary = Model.attribute('fof-upload-deleteOthersMediaLibrary');\n\n addUploadButton();\n downloadButtonInteraction();\n\n // File model\n app.store.models.files = File;\n\n // File list state\n app.fileListState = new FileListState();\n\n // Add user uploads to the user profile\n app.routes['user.uploads'] = {\n path: '/u/:username/uploads',\n component: UploadsUserPage,\n };\n\n // Add uploads to user page menu items\n extend(UserPage.prototype, 'navItems', function (items) {\n if (app.session.user && (app.session.user.viewOthersMediaLibrary() || this.user === app.session.user)) {\n items.add(\n 'uploads',\n LinkButton.component(\n {\n href: app.route('user.uploads', {\n username: this.user.username(),\n }),\n name: 'uploads',\n icon: 'fas fa-file-upload',\n },\n this.user === app.session.user\n ? app.translator.trans('fof-upload.forum.buttons.media')\n : app.translator.trans('fof-upload.forum.buttons.user_uploads')\n ),\n 80\n );\n }\n });\n});\n","import app from 'flarum/common/app';\nimport { extend } from 'flarum/common/extend';\nimport TextEditor from 'flarum/common/components/TextEditor';\nimport UploadButton from './components/UploadButton';\nimport DragAndDrop from './components/DragAndDrop';\nimport PasteClipboard from './components/PasteClipboard';\nimport Uploader from './handler/Uploader';\nimport FileManagerButton from './components/FileManagerButton';\n\nexport default function () {\n extend(TextEditor.prototype, 'oninit', function () {\n this.uploader = new Uploader();\n });\n extend(TextEditor.prototype, 'controlItems', function (items) {\n if (!app.forum.attribute('fof-upload.canUpload')) return;\n\n const composerButtonVisiblity = app.forum.attribute('fof-upload.composerButtonVisiblity');\n\n // Add media button\n if (composerButtonVisiblity === 'both' || composerButtonVisiblity === 'media-btn') {\n items.add(\n 'fof-upload-media',\n FileManagerButton.component({\n uploader: this.uploader,\n })\n );\n }\n\n // Add upload button\n if (composerButtonVisiblity === 'both' || composerButtonVisiblity === 'upload-btn') {\n items.add(\n 'fof-upload',\n UploadButton.component({\n uploader: this.uploader,\n })\n );\n }\n });\n\n extend(TextEditor.prototype, 'oncreate', function (f_, vnode) {\n if (!app.forum.attribute('fof-upload.canUpload')) return;\n\n this.uploader.on('success', ({ file, addBBcode }) => {\n if (!addBBcode) return;\n\n this.attrs.composer.editor.insertAtCursor(file.bbcode() + '\\n', false);\n\n // We wrap this in a typeof check to prevent it running when a user\n // is creating a new discussion. There's nothing to preview in a new\n // discussion, so the `preview` function isn't defined.\n if (typeof this.attrs.preview === 'function') {\n // Scroll the preview into view\n // preview() causes the composer to close on mobile, but we don't want that. We want only the scroll\n // We work around that by temporarily patching the isFullScreen method\n const originalIsFullScreen = app.composer.isFullScreen;\n\n app.composer.isFullScreen = () => false;\n\n this.attrs.preview();\n\n app.composer.isFullScreen = originalIsFullScreen;\n }\n });\n\n this.dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('.TextEditor-editor')[0]);\n });\n\n extend(TextEditor.prototype, 'onremove', function (f_, vnode) {\n if (!app.forum.attribute('fof-upload.canUpload')) return;\n\n this.dragAndDrop.unload();\n });\n}\n","import app from 'flarum/common/app';\nimport { extend } from 'flarum/common/extend';\nimport Post from 'flarum/forum/components/Post';\n\n/* global $ */\n\nexport default function () {\n extend(Post.prototype, 'oncreate', function () {\n this.$('[data-fof-upload-download-uuid]')\n .unbind('click')\n .on('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (!app.forum.attribute('fof-upload.canDownload')) {\n alert(app.translator.trans('fof-upload.forum.states.unauthorized'));\n return;\n }\n\n let url = app.forum.attribute('apiUrl') + '/fof/download';\n\n url += '/' + e.currentTarget.dataset.fofUploadDownloadUuid;\n url += '/' + this.attrs.post.id();\n url += '/' + app.session.csrfToken;\n\n window.open(url);\n });\n });\n}\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/external \"flarum.core.compat['common/app']\"","webpack://@fof/upload/external \"flarum.core.compat['common/Model']\"","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/external \"flarum.core.compat['common/components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['common/extend']\"","webpack://@fof/upload/external \"flarum.core.compat['common/Component']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['forum/components/UserPage']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Tooltip']\"","webpack://@fof/upload/external \"flarum.core.compat['forum/app']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/extractText']\"","webpack://@fof/upload/external \"flarum.core.compat['common/models/User']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/LinkButton']\"","webpack://@fof/upload/external \"flarum.core.compat['common/utils/mixin']\"","webpack://@fof/upload/external \"flarum.core.compat['forum/components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/UploadsUserPage.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","File","apiEndpoint","this","exists","data","id","mixin","Model","baseName","attribute","path","url","type","size","humanSize","createdAt","uuid","tag","hidden","bbcode","FileListState","user","files","moreResults","loading","setUser","loadResults","offset","app","store","find","filter","page","then","parseResults","loadMore","length","results","push","payload","links","next","redraw","addToList","Array","isArray","unshift","hasFiles","isLoading","hasMoreResults","empty","UploadButton","oninit","vnode","attrs","uploader","on","$","reset","isMediaUploadButton","view","buttonText","uploading","translator","trans","text","className","classList","icon","onclick","uploadButtonClicked","disabled","display","multiple","onchange","process","e","prop","upload","click","Component","DragAndDrop","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","unload","removeEventListener","isNotFile","event","dataTransfer","items","kind","preventDefault","over","add","remove","PasteClipboard","element","paste","clipboardData","indexOf","getAsFile","Uploader","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","addBBcode","body","FormData","append","request","method","forum","serialize","raw","result","error","file","fileObj","pushObject","fileListState","image","archive","code","word","UserFileList","session","inModal","selectable","restrictFileType","downloadOnClick","filesBeingHidden","state","aria-live","screen","map","fileType","fileIcon","includes","fileSelectable","isSelectable","fileClassNames","selectedFiles","fileName","isFileHiding","aria-busy","deleteOthersMediaLibrary","aria-label","hideFile","onFileClick","extractText","src","draggable","alt","role","class","onFileSelect","open","confirm","alerts","show","Alert","index","findIndex","splice","FileManagerModal","multiSelect","dragDrop","onUpload","oncreate","onremove","fileCount","alertAttrs","hide","onSelect","itemPosition","fileId","getById","composer","editor","insertAtCursor","Modal","FileManagerButton","Button","component","fileManagerButtonClicked","modal","UploadsUserPage","loadUser","route","param","content","viewOthersMediaLibrary","UserPage","components","initializers","User","extend","TextEditor","composerButtonVisiblity","f_","preview","originalIsFullScreen","isFullScreen","dragAndDrop","parents","Post","unbind","stopPropagation","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","alert","models","routes","LinkButton","href","username"],"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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AQpB,KAAKuD,EAAE,sBAAsB,QAG5FwJ,iBAAOC,IAAWhO,UAAW,YAAY,SAAUkO,EAAI/J,GAC9CzB,IAAIgG,MAAMnH,UAAU,yBAEzBP,KAAKsN,YAAY5H,YCjErBqH,iBAAOS,IAAKxO,UAAW,YAAY,WAAY,WAC3CgB,KAAKuD,EAAE,mCACFkK,OAAO,SACPnK,GAAG,SAAS,SAACoB,GAIV,GAHAA,EAAEuB,iBACFvB,EAAEgJ,kBAEGhM,IAAIgG,MAAMnH,UAAU,0BAAzB,CAKA,IAAIE,EAAMiB,IAAIgG,MAAMnH,UAAU,UAAY,gBAE1CE,GAAO,IAAMiE,EAAEiJ,cAAcC,QAAQC,sBACrCpN,GAAO,IAAM,EAAK2C,MAAM0K,KAAK3N,KAC7BM,GAAO,IAAMiB,IAAI8G,QAAQuF,UAEzBtI,OAAO8E,KAAK9J,QAVRuN,MAAMtM,IAAImC,WAAWC,MAAM,+CFQ3CpC,IAAIC,MAAMsM,OAAO7M,MAAQtB,EAGzB4B,IAAIwG,cAAgB,IAAIhH,EAGxBQ,IAAIwM,OAAO,gBAAkB,CACzB1N,KAAM,uBACN0L,UAAWG,GAIfU,iBAAOJ,IAAS3N,UAAW,YAAY,SAAU+G,GACzCrE,IAAI8G,QAAQrH,OAASO,IAAI8G,QAAQrH,KAAKuL,0BAA4B1M,KAAKmB,OAASO,IAAI8G,QAAQrH,OAC5F4E,EAAMI,IACF,UACAgI,IAAWjC,UACP,CACIkC,KAAM1M,IAAI6K,MAAM,eAAgB,CAC5B8B,SAAUrO,KAAKmB,KAAKkN,aAExB1Q,KAAM,UACNuG,KAAM,sBAEVlE,KAAKmB,OAASO,IAAI8G,QAAQrH,KACpBO,IAAImC,WAAWC,MAAM,kCACrBpC,IAAImC,WAAWC,MAAM,0CAE/B","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 = 27);\n","module.exports = flarum.core.compat['common/app'];","module.exports = flarum.core.compat['common/Model'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","module.exports = flarum.core.compat['common/components/Button'];","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['common/Component'];","module.exports = flarum.core.compat['common/components/Alert'];","module.exports = flarum.core.compat['common/components/LoadingIndicator'];","module.exports = flarum.core.compat['common/components/TextEditor'];","module.exports = flarum.core.compat['forum/components/UserPage'];","module.exports = flarum.core.compat['common/utils/classList'];","module.exports = flarum.core.compat['common/components/Tooltip'];","module.exports = flarum.core.compat['forum/app'];","module.exports = flarum.core.compat['common/utils/extractText'];","module.exports = flarum.core.compat['common/models/User'];","module.exports = flarum.core.compat['common/components/LinkButton'];","module.exports = flarum.core.compat['common/utils/mixin'];","module.exports = flarum.core.compat['forum/components/Post'];","module.exports = flarum.core.compat['common/components/Modal'];","import Model from 'flarum/common/Model';\nimport mixin from 'flarum/common/utils/mixin';\n\nexport default class File extends mixin(Model, {\n baseName: Model.attribute('baseName'),\n path: Model.attribute('path'),\n url: Model.attribute('url'),\n type: Model.attribute('type'),\n size: Model.attribute('size'),\n humanSize: Model.attribute('humanSize'),\n createdAt: Model.attribute('createdAt'),\n uuid: Model.attribute('uuid'),\n tag: Model.attribute('tag'),\n hidden: Model.attribute('hidden'),\n bbcode: Model.attribute('bbcode'),\n}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","import app from 'flarum/common/app';\n\nexport default class FileListState {\n constructor() {\n this.user = null;\n\n this.files = [];\n\n this.moreResults = false;\n\n this.loading = false;\n }\n\n /**\n * Set user and load list\n *\n * @param user A user to populate the media manager\n */\n setUser(user) {\n // Keep previous state\n if (user === this.user) return;\n\n // Set user\n this.user = user;\n\n // Reset file list\n this.files = [];\n\n // Load user files\n this.loadResults();\n }\n\n /**\n * Load more user files\n *\n * @param offset The index to start the page at.\n */\n loadResults(offset = 0) {\n if (!this.user) return;\n\n this.loading = true;\n\n return app.store\n .find('fof/uploads', {\n filter: {\n user: this.user.id(),\n },\n page: {\n offset,\n },\n })\n .then(this.parseResults.bind(this));\n }\n\n /**\n * Load the next page of discussion results.\n */\n loadMore() {\n this.loading = true;\n\n this.loadResults(this.files.length).then(this.parseResults.bind(this));\n }\n\n /**\n * Parse results and append them to the file list.\n */\n parseResults(results) {\n this.files.push(...results);\n\n this.loading = false;\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n\n m.redraw();\n\n return results;\n }\n\n /**\n * Add files to the beginning of the list\n */\n addToList(files) {\n if (Array.isArray(files)) {\n this.files.unshift(...files);\n } else {\n this.files.unshift(files);\n }\n }\n\n /**\n * Are there any files in the list?\n */\n hasFiles() {\n return this.files.length > 0;\n }\n\n /**\n * Is the file list loading?\n */\n isLoading() {\n return this.loading;\n }\n\n /**\n * Does this user has more files?\n */\n hasMoreResults() {\n return this.moreResults;\n }\n\n /**\n * Does this user have any files?\n */\n empty() {\n return !this.hasFiles() && !this.isLoading();\n }\n}\n","import app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport classList from 'flarum/common/utils/classList';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default class UploadButton extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.attrs.uploader.on('uploaded', () => {\n // reset the button for a new upload\n this.$('form')[0].reset();\n\n // redraw to reflect uploader.loading in the DOM\n m.redraw();\n });\n\n this.isMediaUploadButton = vnode.attrs.isMediaUploadButton || false;\n }\n\n view() {\n const buttonText = this.attrs.uploader.uploading\n ? app.translator.trans('fof-upload.forum.states.loading')\n : app.translator.trans('fof-upload.forum.buttons.upload');\n\n return (\n \n \n {this.attrs.uploader.uploading && }\n {(this.isMediaUploadButton || this.attrs.uploader.uploading) && {buttonText}}\n
    \n \n
    \n \n
    \n );\n }\n\n /**\n * Process the upload event.\n *\n * @param e\n */\n process(e) {\n // get the file from the input field\n const files = this.$('input').prop('files');\n\n if (files.length === 0) {\n // We've got no files to upload, so trying\n // to begin an upload will show an error\n // to the user.\n return;\n }\n\n this.attrs.uploader.upload(files, !this.isMediaUploadButton);\n }\n\n /**\n * Event handler for upload button being clicked\n *\n * @param {PointerEvent} e\n */\n uploadButtonClicked(e) {\n // Trigger click on hidden input element\n // (Opens file dialog)\n this.$('input').click();\n }\n}\n","export default class DragAndDrop {\n constructor(upload, composerElement) {\n this.upload = upload;\n this.composerElement = composerElement;\n\n // Keep references to the bound methods so we can remove the event listeners later\n this.handlers = {};\n\n if (!this.supportsFileDragging()) {\n return;\n }\n\n this.composerElement.addEventListener('dragover', (this.handlers.in = this.in.bind(this)));\n\n this.composerElement.addEventListener('dragleave', (this.handlers.out = this.out.bind(this)));\n this.composerElement.addEventListener('dragend', this.handlers.out);\n\n this.composerElement.addEventListener('drop', (this.handlers.dropping = this.dropping.bind(this)));\n }\n\n supportsFileDragging() {\n // Based on https://css-tricks.com/drag-and-drop-file-uploading/\n const div = document.createElement('div');\n\n return ('draggable' in div || ('ondragstart' in div && 'ondrop' in div)) && 'FormData' in window && 'FileReader' in window;\n }\n\n unload() {\n // If the handlers were not set (drag and drop not supported), we skip removing them\n if (!this.handlers.in) {\n return;\n }\n\n this.composerElement.removeEventListener('dragover', this.handlers.in);\n\n this.composerElement.removeEventListener('dragleave', this.handlers.out);\n this.composerElement.removeEventListener('dragend', this.handlers.out);\n\n this.composerElement.removeEventListener('drop', this.handlers.dropping);\n }\n\n isNotFile(event) {\n // Checking event.dataTransfer.files.length does not work on dragover event, it's always zero\n // So we use the dataTransfer.items property to check whether any file is being dragged\n if (event.dataTransfer.items) {\n for (let i = 0; i < event.dataTransfer.items.length; i++) {\n if (event.dataTransfer.items[i].kind !== 'file') {\n return true;\n }\n }\n }\n\n return false;\n }\n\n in(event) {\n if (this.isNotFile(event)) {\n return;\n }\n\n event.preventDefault();\n\n if (!this.over) {\n this.composerElement.classList.add('fof-upload-dragging');\n this.over = true;\n }\n }\n\n out(event) {\n if (this.isNotFile(event)) {\n return;\n }\n\n event.preventDefault();\n\n if (this.over) {\n this.composerElement.classList.remove('fof-upload-dragging');\n this.over = false;\n }\n }\n\n dropping(event) {\n if (this.isNotFile(event)) {\n return;\n }\n\n event.preventDefault();\n\n this.upload(event.dataTransfer.files);\n\n this.composerElement.classList.remove('fof-upload-dragging');\n }\n}\n","export default class PasteClipboard {\n constructor(upload, element) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they'll get removed when the DOM does.\n element.addEventListener('paste', this.paste.bind(this));\n }\n\n paste(e) {\n if (e.clipboardData && e.clipboardData.items) {\n const items = e.clipboardData.items;\n\n const files = [];\n\n for (let i = 0; i < items.length; i++) {\n if (items[i].type.indexOf('image') !== -1) {\n files.push(items[i].getAsFile());\n }\n }\n\n if (files.length > 0) {\n e.preventDefault();\n\n this.upload(files);\n }\n }\n }\n}\n","import app from 'flarum/common/app';\n\nexport default class Uploader {\n constructor() {\n this.callbacks = {\n success: [],\n failure: [],\n uploading: [],\n uploaded: [],\n };\n this.uploading = false;\n }\n\n on(type, callback) {\n this.callbacks[type].push(callback);\n }\n\n dispatch(type, response) {\n this.callbacks[type].forEach((callback) => callback(response));\n }\n\n upload(files, addBBcode = true) {\n this.uploading = true;\n this.dispatch('uploading', files);\n\n m.redraw(); // Forcing a redraw so that the button also updates if uploadFiles() is called from DragAndDrop or PasteClipboard\n\n const body = new FormData();\n\n for (let i = 0; i < files.length; i++) {\n body.append('files[]', files[i]);\n }\n\n // send a POST request to the api\n return app\n .request({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/fof/upload',\n // prevent JSON.stringify'ing the form data in the XHR call\n serialize: (raw) => raw,\n body,\n })\n .then((result) => this.uploaded(result, addBBcode))\n .catch((error) => {\n this.uploading = false;\n m.redraw();\n\n throw error;\n });\n }\n\n uploaded(result, addBBcode = false) {\n this.uploading = false;\n\n result.data.forEach((file) => {\n const fileObj = app.store.pushObject(file);\n\n // Add file to media manager\n app.fileListState.addToList(fileObj);\n\n // Dispatch\n this.dispatch('success', {\n file: fileObj,\n addBBcode,\n });\n });\n\n this.dispatch('uploaded');\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml', 'image/gif'];\nconst archive = ['application/zip', 'application/x-7z-compressed', 'application/gzip', 'application/vnd.rar', 'application/x-rar-compressed'];\nconst code = ['text/html', 'text/css', 'text/javascript', 'application/json', 'application/ld+json', 'text/javascript', 'application/x-httpd-php'];\nconst word = [\n 'application/x-abiword',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'application/pdf',\n];\n\n/**\n * Returns a FontAwesome icon class for a specified MIME type.\n *\n * If it's a known image type, it returns `image` instead.\n *\n * @param {string} fileType MIME type\n * @returns {string} Icon for MIME type\n */\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.includes(fileType)) {\n return 'image';\n }\n // Display image icon for other types\n else if (fileType.includes('image/')) {\n return 'far fa-file-image';\n }\n // Video icon\n else if (fileType.includes('video/')) {\n return 'far fa-file-video';\n }\n // Archive icon\n else if (archive.indexOf(fileType) >= 0) {\n return 'far fa-file-archive';\n }\n // PDF icon\n else if (fileType === 'application/pdf') {\n return 'far fa-file-pdf';\n }\n // Word\n else if (word.indexOf(fileType) >= 0) {\n return 'far fa-file-word';\n }\n // Audio icon\n else if (fileType.includes('audio/')) {\n return 'far fa-file-audio';\n }\n // Code files\n else if (code.indexOf(fileType) >= 0) {\n return 'far fa-file-code';\n }\n\n return 'far fa-file';\n}\n","import Component from 'flarum/common/Component';\n\nimport Button from 'flarum/common/components/Button';\nimport Alert from 'flarum/common/components/Alert';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nimport classList from 'flarum/common/utils/classList';\nimport extractText from 'flarum/common/utils/extractText';\n\nimport mimeToIcon from '../../common/mimeToIcon';\n\nexport default class UserFileList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Load file list\n app.fileListState.setUser(vnode.attrs.user || app.session.user);\n\n this.inModal = vnode.attrs.selectable;\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n this.downloadOnClick = this.attrs.downloadOnClick || false;\n /**\n * @type {string[]} List of file UUIDs currently being hidden.\n */\n this.filesBeingHidden = [];\n\n /**\n * The user who's media we are dealing with\n */\n this.user = app.fileListState.user;\n }\n\n view() {\n /**\n * @type {{empty(): boolean, files: import('../../common/models/File').default[]}}\n */\n const state = app.fileListState;\n\n return (\n
    \n {/* Loading */}\n {state.isLoading() && state.files.length === 0 && (\n
    \n {app.translator.trans('fof-upload.forum.file_list.loading')}\n\n \n
    \n )}\n\n {/* Empty personal file list */}\n {this.inModal && state.empty() && (\n

    \n \n\n {app.translator.trans(`fof-upload.forum.file_list.modal_empty_${app.screen() !== 'phone' ? 'desktop' : 'phone'}`)}\n

    \n )}\n\n {/* Empty file list */}\n {!this.inModal && state.empty() &&

    {app.translator.trans('fof-upload.forum.file_list.empty')}

    }\n\n {/* File list */}\n
      \n {state.files.map((file) => {\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n const fileClassNames = classList([\n 'fof-file',\n // File is image\n fileIcon === 'image' && 'fof-file-type-image',\n // File is selected\n this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0 && 'fof-file-selected',\n ]);\n\n /**\n * File's baseName (file name + extension)\n * @type {string}\n */\n const fileName = file.baseName();\n\n const isFileHiding = this.filesBeingHidden.includes(file.uuid());\n\n return (\n
    • \n {app.session.user && (this.user === app.session.user || app.session.user.deleteOthersMediaLibrary()) && (\n \n )}\n\n this.onFileClick(file)}\n disabled={!fileSelectable || isFileHiding}\n aria-label={extractText(app.translator.trans('fof-upload.forum.file_list.select_file_a11y_label', { fileName }))}\n >\n
      \n {fileIcon === 'image' ? (\n \n ) : (\n \n \n \n )}\n\n
      {fileName}
      \n\n {isFileHiding && (\n \n \n \n )}\n
      \n \n
    • \n );\n })}\n
    \n\n {/* Load more files */}\n {state.hasMoreResults() && (\n
    \n state.loadMore()}\n >\n {app.translator.trans('fof-upload.forum.file_list.load_more_files_btn')}\n \n
    \n )}\n
    \n );\n }\n\n /**\n * Execute function on file click\n *\n * @param {import('../../common/models/File').default} file\n */\n onFileClick(file) {\n // Custom functionality\n if (this.attrs.onFileSelect) {\n this.attrs.onFileSelect(file);\n return;\n }\n\n // Download on click\n if (this.attrs.downloadOnClick) {\n window.open(file.url());\n return;\n }\n }\n\n /**\n * Check if a file is selectable\n *\n * @param {import('../../common/models/File').default} file\n */\n isSelectable(file) {\n const fileType = file.type();\n\n // Custom defined file types\n if (Array.isArray(this.restrictFileType)) {\n return this.restrictFileType.indexOf(fileType) >= 0;\n }\n\n // Image\n else if (this.restrictFileType === 'image') {\n return fileType.includes('image/');\n }\n\n // Audio\n else if (this.restrictFileType === 'audio') {\n return fileType.includes('audio/');\n }\n\n // Video\n else if (this.restrictFileType === 'video') {\n return fileType.includes('video/');\n }\n\n return false;\n }\n\n /**\n * Begins the hiding process for a file.\n *\n * - Shows a native confirmation dialog\n * - If confirmed, sends AJAX request to the hide file API\n *\n * @param {import('../../common/models/File').default} file File to hide\n */\n hideFile(file) {\n /**\n * @type {string} File UUID\n */\n const uuid = file.uuid();\n\n if (this.filesBeingHidden.includes(uuid)) return;\n\n this.filesBeingHidden.push(uuid);\n\n const confirmHide = confirm(\n extractText(app.translator.trans('fof-upload.forum.file_list.hide_file.hide_confirmation', { fileName: file.baseName() }))\n );\n\n if (confirmHide) {\n app.request({\n method: 'PATCH',\n url: `${app.forum.attribute('apiUrl')}/fof/upload/hide`,\n body: { uuid },\n })\n .then(() => {\n app.alerts.show(Alert, { type: 'success' }, app.translator.trans('fof-upload.forum.file_list.hide_file.hide_success'));\n })\n .catch(() => {\n app.alerts.show(\n Alert,\n { type: 'error' },\n app.translator.trans('fof-upload.forum.file_list.hide_file.hide_fail', { fileName: file.fileName() })\n );\n })\n .then(() => {\n // Remove hidden file from state\n /**\n * @type {{ files: import('../../common/models/File').default[] }}\n */\n const state = app.fileListState;\n\n const index = state.files.findIndex((file) => uuid === file.uuid());\n state.files.splice(index, 1);\n\n // Remove file from hiding list\n const i = this.filesBeingHidden.indexOf(uuid);\n this.filesBeingHidden.splice(i, 1);\n });\n } else {\n // Remove file from hiding list\n const i = this.filesBeingHidden.indexOf(uuid);\n this.filesBeingHidden.splice(i, 1);\n }\n }\n}\n","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport UploadButton from './UploadButton';\nimport UserFileList from './UserFileList';\nimport DragAndDrop from './DragAndDrop';\n\nexport default class FileManagerModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Initialize upload managers\n this.uploader = vnode.attrs.uploader;\n\n // Current selected files\n this.selectedFiles = [];\n\n // Allow multiselect\n this.multiSelect = vnode.attrs.multiSelect || true;\n\n // Restrict file selection to specific types\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n\n // Drag & drop\n this.dragDrop = null;\n\n // Initialize uploads\n this.onUpload();\n }\n\n className() {\n return 'Modal--large fof-file-manager-modal';\n }\n\n /**\n * Initialize drag & drop\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.dragDrop = new DragAndDrop((files) => this.uploader.upload(files, false), this.$().find('.Modal-content')[0]);\n }\n\n /**\n * Remove events from modal content\n */\n onremove() {\n if (this.dragDrop) {\n this.dragDrop.unload();\n }\n }\n\n view() {\n const fileCount = this.selectedFiles.length;\n\n return (\n
    \n
    \n
    \n \n
    \n\n
    \n
    \n \n\n {app.translator.trans('fof-upload.forum.file_list.release_to_upload')}\n
    \n
    \n\n
    \n

    {app.translator.trans('fof-upload.forum.media_manager')}

    \n
    \n\n {this.alertAttrs && (\n
    \n \n
    \n )}\n\n
    \n \n
    \n\n
    \n \n\n 1)}\n className=\"Button Button--primary\"\n >\n {app.translator.trans('fof-upload.forum.file_list.confirm_selection_btn', { fileCount })}\n \n
    \n
    \n
    \n );\n }\n\n /**\n * Add or remove file from selected files\n *\n * @param {File} file\n */\n onFileSelect(file) {\n const itemPosition = this.selectedFiles.indexOf(file.id());\n\n if (itemPosition >= 0) {\n this.selectedFiles.splice(itemPosition, 1);\n } else {\n if (this.multiSelect) {\n this.selectedFiles.push(file.id());\n } else {\n this.selectedFiles = [file.id()];\n }\n }\n }\n\n /**\n * Add files to file list after upload\n */\n onUpload() {\n this.uploader.on('success', ({ file }) => {\n if (this.multiSelect) {\n this.selectedFiles.push(file.id());\n } else {\n this.selectedFiles = [file.id()];\n }\n });\n }\n\n /**\n * Add selected files to the composer\n */\n onSelect() {\n this.hide();\n\n // Custom callback\n if (this.attrs.onSelect) {\n this.attrs.onSelect(this.selectedFiles);\n\n return;\n }\n\n // Add selected files to composer\n this.selectedFiles.map((fileId) => {\n const file = app.store.getById('files', fileId);\n\n app.composer.editor.insertAtCursor(file.bbcode() + '\\n', false);\n });\n }\n}\n","import app from 'flarum/common/app';\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport FileManagerModal from './FileManagerModal';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default class FileManagerButton extends Component {\n view() {\n return (\n \n {Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n })}\n \n );\n }\n\n /**\n * Event handler for upload button being clicked\n *\n * @param {PointerEvent} e\n */\n fileManagerButtonClicked(e) {\n e.preventDefault();\n\n // Open dialog\n app.modal.show(FileManagerModal, {\n uploader: this.attrs.uploader,\n });\n }\n}\n","import UserPage from 'flarum/forum/components/UserPage';\nimport UserFileList from './UserFileList';\n\nexport default class UploadsUserPage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.user = null;\n\n this.loadUser(m.route.param('username'));\n }\n\n content() {\n if (app.session.user && (app.session.user.viewOthersMediaLibrary() || this.user === app.session.user)) {\n return (\n this.user &&\n UserFileList.component({\n user: this.user,\n selectable: false,\n downloadOnClick: true,\n })\n );\n } else {\n return null;\n }\n }\n\n show(user) {\n super.show(user);\n this.user = user;\n }\n}\n","import Uploader from '../handler/Uploader';\nimport DragAndDrop from './DragAndDrop';\nimport FileManagerButton from './FileManagerButton';\nimport FileManagerModal from './FileManagerModal';\nimport UserFileList from './UserFileList';\n\nexport const components = {\n DragAndDrop,\n FileManagerButton,\n FileManagerModal,\n UserFileList,\n Uploader,\n};\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/common/app';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\n\nimport File from '../common/models/File';\nimport FileListState from './states/FileListState';\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\nimport UploadsUserPage from './components/UploadsUserPage';\nimport User from 'flarum/common/models/User';\nimport Model from 'flarum/common/Model';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\n User.prototype.viewOthersMediaLibrary = Model.attribute('fof-upload-viewOthersMediaLibrary');\n User.prototype.deleteOthersMediaLibrary = Model.attribute('fof-upload-deleteOthersMediaLibrary');\n\n addUploadButton();\n downloadButtonInteraction();\n\n // File model\n app.store.models.files = File;\n\n // File list state\n app.fileListState = new FileListState();\n\n // Add user uploads to the user profile\n app.routes['user.uploads'] = {\n path: '/u/:username/uploads',\n component: UploadsUserPage,\n };\n\n // Add uploads to user page menu items\n extend(UserPage.prototype, 'navItems', function (items) {\n if (app.session.user && (app.session.user.viewOthersMediaLibrary() || this.user === app.session.user)) {\n items.add(\n 'uploads',\n LinkButton.component(\n {\n href: app.route('user.uploads', {\n username: this.user.username(),\n }),\n name: 'uploads',\n icon: 'fas fa-file-upload',\n },\n this.user === app.session.user\n ? app.translator.trans('fof-upload.forum.buttons.media')\n : app.translator.trans('fof-upload.forum.buttons.user_uploads')\n ),\n 80\n );\n }\n });\n});\n","import app from 'flarum/common/app';\nimport { extend } from 'flarum/common/extend';\nimport TextEditor from 'flarum/common/components/TextEditor';\nimport UploadButton from './components/UploadButton';\nimport DragAndDrop from './components/DragAndDrop';\nimport PasteClipboard from './components/PasteClipboard';\nimport Uploader from './handler/Uploader';\nimport FileManagerButton from './components/FileManagerButton';\n\nexport default function () {\n extend(TextEditor.prototype, 'oninit', function () {\n this.uploader = new Uploader();\n });\n extend(TextEditor.prototype, 'controlItems', function (items) {\n if (!app.forum.attribute('fof-upload.canUpload')) return;\n\n const composerButtonVisiblity = app.forum.attribute('fof-upload.composerButtonVisiblity');\n\n // Add media button\n if (composerButtonVisiblity === 'both' || composerButtonVisiblity === 'media-btn') {\n items.add(\n 'fof-upload-media',\n FileManagerButton.component({\n uploader: this.uploader,\n })\n );\n }\n\n // Add upload button\n if (composerButtonVisiblity === 'both' || composerButtonVisiblity === 'upload-btn') {\n items.add(\n 'fof-upload',\n UploadButton.component({\n uploader: this.uploader,\n })\n );\n }\n });\n\n extend(TextEditor.prototype, 'oncreate', function (f_, vnode) {\n if (!app.forum.attribute('fof-upload.canUpload')) return;\n\n this.uploader.on('success', ({ file, addBBcode }) => {\n if (!addBBcode) return;\n\n this.attrs.composer.editor.insertAtCursor(file.bbcode() + '\\n', false);\n\n // We wrap this in a typeof check to prevent it running when a user\n // is creating a new discussion. There's nothing to preview in a new\n // discussion, so the `preview` function isn't defined.\n if (typeof this.attrs.preview === 'function') {\n // Scroll the preview into view\n // preview() causes the composer to close on mobile, but we don't want that. We want only the scroll\n // We work around that by temporarily patching the isFullScreen method\n const originalIsFullScreen = app.composer.isFullScreen;\n\n app.composer.isFullScreen = () => false;\n\n this.attrs.preview();\n\n app.composer.isFullScreen = originalIsFullScreen;\n }\n });\n\n this.dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('.TextEditor-editor')[0]);\n });\n\n extend(TextEditor.prototype, 'onremove', function (f_, vnode) {\n if (!app.forum.attribute('fof-upload.canUpload')) return;\n\n this.dragAndDrop.unload();\n });\n}\n","import app from 'flarum/common/app';\nimport { extend } from 'flarum/common/extend';\nimport Post from 'flarum/forum/components/Post';\n\n/* global $ */\n\nexport default function () {\n extend(Post.prototype, 'oncreate', function () {\n this.$('[data-fof-upload-download-uuid]')\n .unbind('click')\n .on('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (!app.forum.attribute('fof-upload.canDownload')) {\n alert(app.translator.trans('fof-upload.forum.states.unauthorized'));\n return;\n }\n\n let url = app.forum.attribute('apiUrl') + '/fof/download';\n\n url += '/' + e.currentTarget.dataset.fofUploadDownloadUuid;\n url += '/' + this.attrs.post.id();\n url += '/' + app.session.csrfToken;\n\n window.open(url);\n });\n });\n}\n"],"sourceRoot":""} \ No newline at end of file