From 4abe3039530eba35129f8116b3242e8dbe1f7527 Mon Sep 17 00:00:00 2001 From: Jasper Vriends <4417659+jaspervriends@users.noreply.github.com> Date: Sun, 31 Jan 2021 19:53:21 +0100 Subject: [PATCH 1/8] Implemented media manager - Added responsive media manager - Added /fof/uploads endpoint - Updated /fof/upload endpoint output - Updated FileSerializer - Added File frontend model --- extend.php | 3 + js/dist/admin.js | 707 +++++++- js/dist/admin.js.map | 2 +- js/dist/forum.js | 1477 ++++++++++++++++- js/dist/forum.js.map | 2 +- js/src/common/fileToBBcode.js | 19 + js/src/common/mimeToIcon.js | 41 + js/src/common/models/File.js | 29 + js/src/forum/addUploadButton.js | 16 +- js/src/forum/components/DragAndDrop.js | 12 +- js/src/forum/components/FileManagerButton.js | 42 + js/src/forum/components/FileManagerModal.js | 153 ++ js/src/forum/components/UploadButton.js | 57 +- js/src/forum/components/UserFileList.js | 130 ++ js/src/forum/components/index.js | 13 + js/src/forum/handler/Uploader.js | 19 +- js/src/forum/index.js | 10 + js/src/forum/states/FileListState.js | 112 ++ resources/less/forum/fileList.less | 135 ++ resources/less/forum/fileManagerModal.less | 103 ++ resources/less/forum/upload.less | 26 +- resources/locale/en.yml | 15 + src/Api/Controllers/ListUploadsController.php | 95 ++ src/Api/Controllers/UploadController.php | 17 +- src/Api/Serializers/FileSerializer.php | 18 +- src/Commands/UploadHandler.php | 4 +- 26 files changed, 3186 insertions(+), 71 deletions(-) create mode 100644 js/src/common/fileToBBcode.js create mode 100644 js/src/common/mimeToIcon.js create mode 100644 js/src/common/models/File.js create mode 100644 js/src/forum/components/FileManagerButton.js create mode 100644 js/src/forum/components/FileManagerModal.js create mode 100644 js/src/forum/components/UserFileList.js create mode 100644 js/src/forum/components/index.js create mode 100644 js/src/forum/states/FileListState.js create mode 100644 resources/less/forum/fileList.less create mode 100644 resources/less/forum/fileManagerModal.less create mode 100644 src/Api/Controllers/ListUploadsController.php diff --git a/extend.php b/extend.php index cd965ffd..518185d2 100644 --- a/extend.php +++ b/extend.php @@ -19,6 +19,7 @@ return [ (new Extend\Routes('api')) + ->get('/fof/uploads', 'fof-upload.list', Api\Controllers\ListUploadsController::class) ->post('/fof/upload', 'fof-upload.upload', Api\Controllers\UploadController::class) ->post('/fof/watermark', 'fof-upload.watermark', Api\Controllers\WatermarkUploadController::class) ->get('/fof/download/{uuid}/{post}/{csrf}', 'fof-upload.download', Api\Controllers\DownloadController::class), @@ -30,6 +31,8 @@ (new Extend\Frontend('forum')) ->css(__DIR__.'/resources/less/forum/download.less') ->css(__DIR__.'/resources/less/forum/upload.less') + ->css(__DIR__.'/resources/less/forum/fileManagerModal.less') + ->css(__DIR__.'/resources/less/forum/fileList.less') ->js(__DIR__.'/js/dist/forum.js'), new Extend\Locales(__DIR__.'/resources/locale'), diff --git a/js/dist/admin.js b/js/dist/admin.js index 26eede3c..ac0d05c0 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,707 @@ -module.exports=function(t){var e={};function a(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,a),s.l=!0,s.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 s in t)a.d(n,s,function(e){return t[e]}.bind(null,s));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=19)}([function(t,e){t.exports=flarum.core.compat.app},function(t,e){t.exports=flarum.core.compat["utils/withAttr"]},function(t,e){t.exports=flarum.core.compat["utils/Stream"]},,function(t,e){t.exports=flarum.core.compat["components/Select"]},function(t,e){t.exports=flarum.core.compat["components/Switch"]},function(t,e,a){"use strict";function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}a.d(e,"a",(function(){return n}))},,function(t,e){t.exports=flarum.core.compat["components/Button"]},,,,,function(t,e){t.exports=flarum.core.compat["utils/saveSettings"]},function(t,e){t.exports=flarum.core.compat["components/Alert"]},function(t,e){t.exports=flarum.core.compat["components/UploadImageButton"]},function(t,e){t.exports=flarum.core.compat["components/ExtensionPage"]},function(t,e){t.exports=flarum.core.compat["utils/ItemList"]},,function(t,e,a){"use strict";a.r(e),a.d(e,"components",(function(){return O}));var n=a(0),s=a.n(n),i=a(6),o=a(8),l=a.n(o),r=a(13),u=a.n(r),p=a(14),d=a.n(p),f=a(4),c=a.n(f),h=a(5),v=a.n(h),b=a(15),g=a.n(b),y=a(1),w=a.n(y),x=a(2),T=a.n(x),M=a(16),S=a.n(M),k=a(17),P=a.n(k),_=function(t){function e(){return t.apply(this,arguments)||this}Object(i.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","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"};var n=s.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",s.a.translator.trans("fof-upload.admin.labels.preferences.title")),m("label",s.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",s.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",s.a.translator.trans("fof-upload.admin.help_texts.mime_types")),m(".helpText",s.a.translator.trans("fof-upload.admin.help_texts.download_templates")),this.templateOptionsDescriptions()]),m("fieldset",[m("legend",s.a.translator.trans("fof-upload.admin.labels.resize.title")),m(".helpText",s.a.translator.trans("fof-upload.admin.help_texts.resize")),v.a.component({state:this.values.mustResize()||!1,onchange:this.values.mustResize},s.a.translator.trans("fof-upload.admin.labels.resize.toggle")),m("label",s.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",s.a.translator.trans("fof-upload.admin.labels.client_extension.title")),m(".helpText",s.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",s.a.translator.trans("fof-upload.admin.labels.watermark.title")),m(".helpText",s.a.translator.trans("fof-upload.admin.help_texts.watermark")),v.a.component({state:this.values.addsWatermarks()||!1,onchange:this.values.addsWatermarks},s.a.translator.trans("fof-upload.admin.labels.watermark.toggle")),m("label",s.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",{},s.a.translator.trans("fof-upload.admin.labels.watermark.file")),g.a.component({name:"fof/watermark"})]),m("fieldset",[m("legend",s.a.translator.trans("fof-upload.admin.labels.disable-hotlink-protection.title")),m(".helpText",s.a.translator.trans("fof-upload.admin.help_texts.disable-hotlink-protection")),v.a.component({state:this.values.disableHotlinkProtection()||!1,onchange:this.values.disableHotlinkProtection},s.a.translator.trans("fof-upload.admin.labels.disable-hotlink-protection.toggle")),m("legend",s.a.translator.trans("fof-upload.admin.labels.disable-download-logging.title")),m(".helpText",s.a.translator.trans("fof-upload.admin.help_texts.disable-download-logging")),v.a.component({state:this.values.disableDownloadLogging()||!1,onchange:this.values.disableDownloadLogging},s.a.translator.trans("fof-upload.admin.labels.disable-download-logging.toggle"))]),m("fieldset",[m("legend",s.a.translator.trans("fof-upload.admin.labels.local.title")),m("label",s.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()},s.a.translator.trans("fof-upload.admin.buttons.save"))])])])]},a.adaptorItems=function(){var t=new P.a;return void 0!==this.uploadMethodOptions.imgur&&t.add("imgur",m(".imgur",[m("fieldset",[m("legend",s.a.translator.trans("fof-upload.admin.labels.imgur.title")),m("label",s.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",s.a.translator.trans("fof-upload.admin.labels.qiniu.title")),m("label",s.a.translator.trans("fof-upload.admin.labels.qiniu.key")),m("input.FormControl",{value:this.values.qiniuKey()||"",oninput:w()("value",this.values.qiniuKey)}),m("label",{},s.a.translator.trans("fof-upload.admin.labels.qiniu.secret")),m("input.FormControl",{value:this.values.qiniuSecret()||"",oninput:w()("value",this.values.qiniuSecret)}),m("label",{},s.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",s.a.translator.trans("fof-upload.admin.labels.aws-s3.title")),m("label",s.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",s.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",s.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",s.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",s.a.translator.trans("fof-upload.admin.labels.aws-s3.advanced_title")),m(".helpText",s.a.translator.trans("fof-upload.admin.help_texts.s3_compatible_storage")),m("label",s.a.translator.trans("fof-upload.admin.labels.aws-s3.endpoint")),m("input.FormControl",{value:this.values.awsS3Endpoint()||"",oninput:w()("value",this.values.awsS3Endpoint)}),v.a.component({state:this.values.awsS3UsePathStyleEndpoint()||!1,onchange:this.values.awsS3UsePathStyleEndpoint},s.a.translator.trans("fof-upload.admin.labels.aws-s3.use_path_style_endpoint")),m("label",s.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",s.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",this.templateOptions[e].name+": "+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]()!==s.a.data.settings[t.addPrefix(e)]})),a=this.checkboxes.some((function(e){return t.values[e]()!==("1"===s.a.data.settings[t.addPrefix(e)])})),n=this.objects.some((function(e){return JSON.stringify(t.values[e]())!==s.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,s.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=s.a.alerts.show(d.a,{type:"success"},s.a.translator.trans("core.admin.basics.saved_message"))})).catch((function(){})).then((function(){e.loading=!1,m.redraw()}))}},a.addPrefix=function(t){return this.settingsPrefix+"."+t},e}(S.a),O={UploadPage:_};s.a.initializers.add("fof-upload",(function(t){t.extensionData.for("fof-upload").registerPage(_).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)}))}]); +module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./admin.js"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./admin.js": +/*!******************!*\ + !*** ./admin.js ***! + \******************/ +/*! exports provided: components */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _src_admin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/admin */ "./src/admin/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "components", function() { return _src_admin__WEBPACK_IMPORTED_MODULE_0__["components"]; }); + + + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js": +/*!******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js ***! + \******************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _inheritsLoose; }); +function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; +} + +/***/ }), + +/***/ "./src/admin/components/UploadPage.js": +/*!********************************************!*\ + !*** ./src/admin/components/UploadPage.js ***! + \********************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return UploadPage; }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/app */ "flarum/app"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_app__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_components_Button__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/components/Button */ "flarum/components/Button"); +/* harmony import */ var flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_components_Button__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_utils_saveSettings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/utils/saveSettings */ "flarum/utils/saveSettings"); +/* harmony import */ var flarum_utils_saveSettings__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_utils_saveSettings__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var flarum_components_Alert__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/components/Alert */ "flarum/components/Alert"); +/* harmony import */ var flarum_components_Alert__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_components_Alert__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var flarum_components_Select__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! flarum/components/Select */ "flarum/components/Select"); +/* harmony import */ var flarum_components_Select__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(flarum_components_Select__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var flarum_components_Switch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! flarum/components/Switch */ "flarum/components/Switch"); +/* harmony import */ var flarum_components_Switch__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(flarum_components_Switch__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var flarum_components_UploadImageButton__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! flarum/components/UploadImageButton */ "flarum/components/UploadImageButton"); +/* harmony import */ var flarum_components_UploadImageButton__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(flarum_components_UploadImageButton__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! flarum/utils/withAttr */ "flarum/utils/withAttr"); +/* harmony import */ var flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! flarum/utils/Stream */ "flarum/utils/Stream"); +/* harmony import */ var flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9__); +/* harmony import */ var flarum_components_ExtensionPage__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! flarum/components/ExtensionPage */ "flarum/components/ExtensionPage"); +/* harmony import */ var flarum_components_ExtensionPage__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(flarum_components_ExtensionPage__WEBPACK_IMPORTED_MODULE_10__); +/* harmony import */ var flarum_utils_ItemList__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! flarum/utils/ItemList */ "flarum/utils/ItemList"); +/* harmony import */ var flarum_utils_ItemList__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(flarum_utils_ItemList__WEBPACK_IMPORTED_MODULE_11__); + + + + + + + + + + + + +/* global m */ + +var UploadPage = /*#__PURE__*/function (_ExtensionPage) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(UploadPage, _ExtensionPage); + + function UploadPage() { + return _ExtensionPage.apply(this, arguments) || this; + } + + var _proto = UploadPage.prototype; + + _proto.oninit = function oninit(vnode) { + var _this = this; + + _ExtensionPage.prototype.oninit.call(this, vnode); // whether we are saving the settings or not right now + + + this.loading = false; // the fields we need to watch and to save + + this.fields = [// image + 'resizeMaxWidth', 'cdnUrl', 'maxFileSize', 'whitelistedClientExtensions', // watermark + 'watermark', 'watermarkPosition', // Imgur + 'imgurClientId', // AWS + 'awsS3Key', 'awsS3Secret', 'awsS3Bucket', 'awsS3Region', 'awsS3Endpoint', 'awsS3ACL', // QIniu + 'qiniuKey', 'qiniuSecret', 'qiniuBucket']; // the checkboxes we need to watch and to save. + + this.checkboxes = ['mustResize', 'addsWatermarks', 'disableHotlinkProtection', 'disableDownloadLogging', 'awsS3UsePathStyleEndpoint']; // fields that are objects + + this.objects = ['mimeTypes']; // watermark positions + + 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' + }; // get the saved settings from the database + + var settings = flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.data.settings; // our package prefix (to be added to every field and checkbox in the setting table) + + this.settingsPrefix = 'fof-upload'; // Options for the Upload methods dropdown menu. + + this.uploadMethodOptions = settings[this.addPrefix('availableUploadMethods')] || {}; // Options for the Template dropdown menu. + + this.templateOptions = settings[this.addPrefix('availableTemplates')] || {}; // Contains current values. + + this.values = {}; // bind the values of the fields and checkboxes to the getter/setter functions + + this.fields.forEach(function (key) { + return _this.values[key] = flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(settings[_this.addPrefix(key)]); + }); + this.checkboxes.forEach(function (key) { + return _this.values[key] = flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(settings[_this.addPrefix(key)] === '1'); + }); + this.objects.forEach(function (key) { + return _this.values[key] = settings[_this.addPrefix(key)] ? flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(JSON.parse(settings[_this.addPrefix(key)])) : flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(); + }); // Set a sane default in case no mimeTypes have been configured yet. + // Since 'local' (or others) can now be disabled, pick the last entry in the object for default + + this.defaultAdap = Object.keys(this.uploadMethodOptions)[Object.keys(this.uploadMethodOptions).length - 1]; + this.values.mimeTypes() || (this.values.mimeTypes = flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()({ + '^image\\/.*': { + adapter: this.defaultAdap, + template: 'image-preview' + } + })); + this.newMimeType = { + regex: flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(''), + adapter: flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(this.defaultAdap), + template: flarum_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()('file') + }; + } + /** + * Show the actual ImageUploadPage. + * + * @returns {*} + */ + ; + + _proto.content = function content() { + var _this2 = this; + + return [m('.UploadPage', [m('.container', [m('form', { + onsubmit: this.onsubmit.bind(this) + }, [m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.preferences.title')), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.preferences.max_file_size')), m('input.FormControl', { + value: this.values.maxFileSize() || 2048, + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.maxFileSize), + type: 'number', + min: '0' + }), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.preferences.mime_types')), m('.MimeTypes--Container', Object.keys(this.values.mimeTypes()).map(function (mime) { + var config = _this2.values.mimeTypes()[mime]; // Compatibility for older versions. + + + if (typeof config !== 'object') { + config = { + adapter: config, + template: 'file' + }; + } + + return m('div', [m('input.FormControl.MimeTypes', { + value: mime, + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', _this2.updateMimeTypeKey.bind(_this2, mime)) + }), flarum_components_Select__WEBPACK_IMPORTED_MODULE_5___default.a.component({ + options: _this2.uploadMethodOptions, + onchange: _this2.updateMimeTypeAdapter.bind(_this2, mime, config), + value: config.adapter || 'local' + }), flarum_components_Select__WEBPACK_IMPORTED_MODULE_5___default.a.component({ + options: _this2.getTemplateOptionsForInput(), + onchange: _this2.updateMimeTypeTemplate.bind(_this2, mime, config), + value: config.template || 'local' + }), flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a.component({ + type: 'button', + className: 'Button Button--warning', + onclick: _this2.deleteMimeType.bind(_this2, mime) + }, 'x')]); + }), m('br'), m('div', [m('input.FormControl.MimeTypes.add-MimeType-key', { + value: this.newMimeType.regex(), + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.newMimeType.regex) + }), flarum_components_Select__WEBPACK_IMPORTED_MODULE_5___default.a.component({ + options: this.uploadMethodOptions, + className: 'add-MimeType-value', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.newMimeType.adapter), + value: this.newMimeType.adapter() + }), flarum_components_Select__WEBPACK_IMPORTED_MODULE_5___default.a.component({ + options: this.getTemplateOptionsForInput(), + className: 'add-MimeType-value', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.newMimeType.template), + value: this.newMimeType.template() + }), flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a.component({ + type: 'button', + className: 'Button Button--warning', + onclick: this.addMimeType.bind(this) + }, '+')])), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.mime_types')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.download_templates')), this.templateOptionsDescriptions()]), m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.resize.title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.resize')), flarum_components_Switch__WEBPACK_IMPORTED_MODULE_6___default.a.component({ + state: this.values.mustResize() || false, + onchange: this.values.mustResize + }, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.resize.toggle')), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.resize.max_width')), m('input', { + className: 'FormControl', + value: this.values.resizeMaxWidth() || 100, + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.resizeMaxWidth), + disabled: !this.values.mustResize(), + type: 'number', + min: '0' + })]), m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.client_extension.title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.client_extension')), m('input', { + className: 'FormControl', + value: this.values.whitelistedClientExtensions() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.whitelistedClientExtensions) + })]), m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.watermark.title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.watermark')), flarum_components_Switch__WEBPACK_IMPORTED_MODULE_6___default.a.component({ + state: this.values.addsWatermarks() || false, + onchange: this.values.addsWatermarks + }, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.watermark.toggle')), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.watermark.position')), m('div', [flarum_components_Select__WEBPACK_IMPORTED_MODULE_5___default.a.component({ + options: this.watermarkPositions, + onchange: this.values.watermarkPosition, + value: this.values.watermarkPosition() || 'bottom-right' + })]), m('label', {}, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.watermark.file')), flarum_components_UploadImageButton__WEBPACK_IMPORTED_MODULE_7___default.a.component({ + name: 'fof/watermark' + })]), m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.disable-hotlink-protection.title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.disable-hotlink-protection')), flarum_components_Switch__WEBPACK_IMPORTED_MODULE_6___default.a.component({ + state: this.values.disableHotlinkProtection() || false, + onchange: this.values.disableHotlinkProtection + }, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.disable-hotlink-protection.toggle')), m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.disable-download-logging.title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.disable-download-logging')), flarum_components_Switch__WEBPACK_IMPORTED_MODULE_6___default.a.component({ + state: this.values.disableDownloadLogging() || false, + onchange: this.values.disableDownloadLogging + }, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.disable-download-logging.toggle'))]), m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.local.title')), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.local.cdn_url')), m('input.FormControl', { + value: this.values.cdnUrl() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.cdnUrl) + })]), this.adaptorItems().toArray(), flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a.component({ + type: 'submit', + className: 'Button Button--primary', + loading: this.loading, + disabled: !this.changed() + }, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.buttons.save'))])])])]; + }; + + _proto.adaptorItems = function adaptorItems() { + var items = new flarum_utils_ItemList__WEBPACK_IMPORTED_MODULE_11___default.a(); + + if (this.uploadMethodOptions['imgur'] !== undefined) { + items.add('imgur', m('.imgur', [m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.imgur.title')), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.imgur.client_id')), m('input.FormControl', { + value: this.values.imgurClientId() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.imgurClientId) + })])])); + } + + if (this.uploadMethodOptions['qiniu'] !== undefined) { + items.add('qiniu', m('.qiniu', [m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.qiniu.title')), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.qiniu.key')), m('input.FormControl', { + value: this.values.qiniuKey() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.qiniuKey) + }), m('label', {}, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.qiniu.secret')), m('input.FormControl', { + value: this.values.qiniuSecret() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.qiniuSecret) + }), m('label', {}, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.qiniu.bucket')), m('input.FormControl', { + value: this.values.qiniuBucket() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.qiniuBucket) + })])])); + } + + if (this.uploadMethodOptions['aws-s3'] !== undefined) { + items.add('aws-s3', m('.aws', [m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.aws-s3.title')), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.aws-s3.key')), m('input.FormControl', { + value: this.values.awsS3Key() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.awsS3Key) + }), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.aws-s3.secret')), m('input.FormControl', { + value: this.values.awsS3Secret() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.awsS3Secret) + }), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.aws-s3.bucket')), m('input.FormControl', { + value: this.values.awsS3Bucket() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.awsS3Bucket) + }), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.aws-s3.region')), m('input.FormControl', { + value: this.values.awsS3Region() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.awsS3Region) + })]), m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.aws-s3.advanced_title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.s3_compatible_storage')), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.aws-s3.endpoint')), m('input.FormControl', { + value: this.values.awsS3Endpoint() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.awsS3Endpoint) + }), flarum_components_Switch__WEBPACK_IMPORTED_MODULE_6___default.a.component({ + state: this.values.awsS3UsePathStyleEndpoint() || false, + onchange: this.values.awsS3UsePathStyleEndpoint + }, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.aws-s3.use_path_style_endpoint')), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.aws-s3.acl')), m('input.FormControl', { + value: this.values.awsS3ACL() || '', + oninput: flarum_utils_withAttr__WEBPACK_IMPORTED_MODULE_8___default()('value', this.values.awsS3ACL) + }), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.s3_acl'))])])); + } + + return items; + }; + + _proto.getTemplateOptionsForInput = function getTemplateOptionsForInput() { + var options = {}; + + for (var option in this.templateOptions) { + if (!this.templateOptions.hasOwnProperty(option)) { + continue; + } + + options[option] = this.templateOptions[option].name; + } + + return options; + }; + + _proto.updateMimeTypeKey = function updateMimeTypeKey(mime, value) { + this.values.mimeTypes()[value] = this.values.mimeTypes()[mime]; + this.deleteMimeType(mime); + }; + + _proto.updateMimeTypeAdapter = function updateMimeTypeAdapter(mime, config, value) { + config.adapter = value; + this.values.mimeTypes()[mime] = config; + }; + + _proto.updateMimeTypeTemplate = function updateMimeTypeTemplate(mime, config, value) { + config.template = value; + this.values.mimeTypes()[mime] = config; + }; + + _proto.deleteMimeType = function deleteMimeType(mime) { + delete this.values.mimeTypes()[mime]; + }; + + _proto.templateOptionsDescriptions = function templateOptionsDescriptions() { + var children = []; + + for (var template in this.templateOptions) { + if (!this.templateOptions.hasOwnProperty(template)) { + continue; + } + + children.push(m('li', this.templateOptions[template].name + ': ' + this.templateOptions[template].description)); + } + + return m('ul', children); + }; + + _proto.addMimeType = function addMimeType() { + 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'); + } + /** + * Checks if the values of the fields and checkboxes are different from + * the ones stored in the database + * + * @returns boolean + */ + ; + + _proto.changed = function changed() { + var _this3 = this; + + var fieldsCheck = this.fields.some(function (key) { + return _this3.values[key]() !== flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.data.settings[_this3.addPrefix(key)]; + }); + var checkboxesCheck = this.checkboxes.some(function (key) { + return _this3.values[key]() !== (flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.data.settings[_this3.addPrefix(key)] === '1'); + }); + var objectsCheck = this.objects.some(function (key) { + return JSON.stringify(_this3.values[key]()) !== flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.data.settings[_this3.addPrefix(key)]; + }); + return fieldsCheck || checkboxesCheck || objectsCheck; + } + /** + * Saves the settings to the database and redraw the page + * + * @param e + */ + ; + + _proto.onsubmit = function onsubmit(e) { + var _this4 = this; + + // prevent the usual form submit behaviour + e.preventDefault(); // if the page is already saving, do nothing + + if (this.loading) return; // prevents multiple savings + + this.loading = true; // remove previous success popup + + flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.alerts.dismiss(this.successAlert); + var settings = {}; // gets all the values from the form + + this.fields.forEach(function (key) { + return settings[_this4.addPrefix(key)] = _this4.values[key](); + }); + this.checkboxes.forEach(function (key) { + return settings[_this4.addPrefix(key)] = _this4.values[key](); + }); + this.objects.forEach(function (key) { + return settings[_this4.addPrefix(key)] = JSON.stringify(_this4.values[key]()); + }); // actually saves everything in the database + + flarum_utils_saveSettings__WEBPACK_IMPORTED_MODULE_3___default()(settings).then(function () { + // on success, show popup + _this4.successAlert = flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.alerts.show(flarum_components_Alert__WEBPACK_IMPORTED_MODULE_4___default.a, { + type: 'success' + }, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('core.admin.basics.saved_message')); + })["catch"](function () {}).then(function () { + // return to the initial state and redraw the page + _this4.loading = false; + m.redraw(); + }); + } + /** + * Adds the prefix `this.settingsPrefix` at the beginning of `key` + * + * @returns string + */ + ; + + _proto.addPrefix = function addPrefix(key) { + return this.settingsPrefix + '.' + key; + }; + + return UploadPage; +}(flarum_components_ExtensionPage__WEBPACK_IMPORTED_MODULE_10___default.a); + + + +/***/ }), + +/***/ "./src/admin/components/index.js": +/*!***************************************!*\ + !*** ./src/admin/components/index.js ***! + \***************************************/ +/*! exports provided: components */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "components", function() { return components; }); +/* harmony import */ var _UploadPage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./UploadPage */ "./src/admin/components/UploadPage.js"); + +var components = { + UploadPage: _UploadPage__WEBPACK_IMPORTED_MODULE_0__["default"] +}; + +/***/ }), + +/***/ "./src/admin/index.js": +/*!****************************!*\ + !*** ./src/admin/index.js ***! + \****************************/ +/*! exports provided: components */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/app */ "flarum/app"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_app__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _components_UploadPage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/UploadPage */ "./src/admin/components/UploadPage.js"); +/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components */ "./src/admin/components/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "components", function() { return _components__WEBPACK_IMPORTED_MODULE_2__["components"]; }); + + + + +flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.initializers.add('fof-upload', function (app) { + app.extensionData["for"]('fof-upload').registerPage(_components_UploadPage__WEBPACK_IMPORTED_MODULE_1__["default"]).registerPermission({ + icon: 'far fa-file', + label: app.translator.trans('fof-upload.admin.permissions.upload_label'), + permission: 'fof-upload.upload' + }, 'start', 50).registerPermission({ + icon: 'fas fa-download', + label: app.translator.trans('fof-upload.admin.permissions.download_label'), + permission: 'fof-upload.download', + allowGuest: true + }, 'view', 50); +}); + +/***/ }), + +/***/ "flarum/app": +/*!********************************************!*\ + !*** external "flarum.core.compat['app']" ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['app']; + +/***/ }), + +/***/ "flarum/components/Alert": +/*!*********************************************************!*\ + !*** external "flarum.core.compat['components/Alert']" ***! + \*********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/Alert']; + +/***/ }), + +/***/ "flarum/components/Button": +/*!**********************************************************!*\ + !*** external "flarum.core.compat['components/Button']" ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/Button']; + +/***/ }), + +/***/ "flarum/components/ExtensionPage": +/*!*****************************************************************!*\ + !*** external "flarum.core.compat['components/ExtensionPage']" ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/ExtensionPage']; + +/***/ }), + +/***/ "flarum/components/Select": +/*!**********************************************************!*\ + !*** external "flarum.core.compat['components/Select']" ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/Select']; + +/***/ }), + +/***/ "flarum/components/Switch": +/*!**********************************************************!*\ + !*** external "flarum.core.compat['components/Switch']" ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/Switch']; + +/***/ }), + +/***/ "flarum/components/UploadImageButton": +/*!*********************************************************************!*\ + !*** external "flarum.core.compat['components/UploadImageButton']" ***! + \*********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/UploadImageButton']; + +/***/ }), + +/***/ "flarum/utils/ItemList": +/*!*******************************************************!*\ + !*** external "flarum.core.compat['utils/ItemList']" ***! + \*******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['utils/ItemList']; + +/***/ }), + +/***/ "flarum/utils/Stream": +/*!*****************************************************!*\ + !*** external "flarum.core.compat['utils/Stream']" ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['utils/Stream']; + +/***/ }), + +/***/ "flarum/utils/saveSettings": +/*!***********************************************************!*\ + !*** external "flarum.core.compat['utils/saveSettings']" ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['utils/saveSettings']; + +/***/ }), + +/***/ "flarum/utils/withAttr": +/*!*******************************************************!*\ + !*** external "flarum.core.compat['utils/withAttr']" ***! + \*******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['utils/withAttr']; + +/***/ }) + +/******/ }); //# 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 1aeb194e..e4b5db2c 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['app']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/withAttr']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Select']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['components/UploadImageButton']\"","webpack://@fof/upload/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@fof/upload/external \"flarum.core.compat['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","_inheritsLoose","subClass","superClass","constructor","__proto__","UploadPage","oninit","vnode","this","loading","fields","checkboxes","objects","watermarkPositions","center","left","top","right","bottom","settings","app","data","settingsPrefix","uploadMethodOptions","addPrefix","templateOptions","values","forEach","Stream","JSON","parse","defaultAdap","keys","length","mimeTypes","adapter","template","newMimeType","regex","content","onsubmit","translator","trans","maxFileSize","oninput","withAttr","type","min","map","mime","config","updateMimeTypeKey","Select","component","options","onchange","updateMimeTypeAdapter","getTemplateOptionsForInput","updateMimeTypeTemplate","Button","className","onclick","deleteMimeType","addMimeType","templateOptionsDescriptions","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","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,CACz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AAKK,UAAUpC,IAAQyC,KAAK0E,UAAU,EAAK7E,OAAOtC,SAG1FyH,IAAa1F,GACR2F,MAAK,WAEF,EAAKF,aAAexF,IAAIsF,OAAOK,KAAKC,IAAO,CAAElE,KAAM,WAAa1B,IAAIqB,WAAWC,MAAM,uCAH7F,OAKW,eACNoE,MAAK,WAEF,EAAKrG,SAAU,EACfxC,EAAEgJ,c,EASdzF,UAAA,SAAUpC,GACN,OAAOoB,KAAKc,eAAiB,IAAMlC,G,GAnfH8H,KCZ3BC,EAAa,CACtB9G,cCEJe,IAAIgG,aAAajC,IAAI,cAAc,SAAC/D,GAChCA,EAAIiG,cAAJ,IACS,cACJC,aAAajH,GACbkH,mBACG,CACIC,KAAM,cACNC,MAAOrG,EAAIqB,WAAWC,MAAM,6CAC5BgF,WAAY,qBAEhB,QACA,IAEHH,mBACG,CACIC,KAAM,kBACNC,MAAOrG,EAAIqB,WAAWC,MAAM,+CAC5BgF,WAAY,sBACZC,YAAY,GAEhB,OACA","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 = 19);\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['utils/withAttr'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/Switch'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/UploadImageButton'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['utils/ItemList'];","import app from 'flarum/app';\nimport Button from 'flarum/components/Button';\nimport saveSettings from 'flarum/utils/saveSettings';\nimport Alert from 'flarum/components/Alert';\nimport Select from 'flarum/components/Select';\nimport Switch from 'flarum/components/Switch';\nimport UploadImageButton from 'flarum/components/UploadImageButton';\nimport withAttr from 'flarum/utils/withAttr';\nimport Stream from 'flarum/utils/Stream';\nimport ExtensionPage from 'flarum/components/ExtensionPage';\nimport ItemList from 'flarum/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 // 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 // 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', [\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('fof-upload.admin.buttons.save')\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(m('li', this.templateOptions[template].name + ': ' + 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.basics.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/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});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/./admin.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/admin/components/UploadPage.js","webpack://@fof/upload/./src/admin/components/index.js","webpack://@fof/upload/./src/admin/index.js","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Select']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/upload/external \"flarum.core.compat['components/UploadImageButton']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/withAttr']\""],"names":["UploadPage","oninit","vnode","loading","fields","checkboxes","objects","watermarkPositions","center","left","top","right","bottom","settings","app","data","settingsPrefix","uploadMethodOptions","addPrefix","templateOptions","values","forEach","key","Stream","JSON","parse","defaultAdap","Object","keys","length","mimeTypes","adapter","template","newMimeType","regex","content","m","onsubmit","bind","translator","trans","value","maxFileSize","oninput","withAttr","type","min","map","mime","config","updateMimeTypeKey","Select","component","options","onchange","updateMimeTypeAdapter","getTemplateOptionsForInput","updateMimeTypeTemplate","Button","className","onclick","deleteMimeType","addMimeType","templateOptionsDescriptions","Switch","state","mustResize","resizeMaxWidth","disabled","whitelistedClientExtensions","addsWatermarks","watermarkPosition","UploadImageButton","name","disableHotlinkProtection","disableDownloadLogging","cdnUrl","adaptorItems","toArray","changed","items","ItemList","undefined","add","imgurClientId","qiniuKey","qiniuSecret","qiniuBucket","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3UsePathStyleEndpoint","awsS3ACL","option","hasOwnProperty","children","push","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":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAe;AACf;AACA;AACA;AACA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;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tBpH,YAAU,EAAVA,mDAAUA;AADY,CAAnB,C;;;;;;;;;;;;ACFP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AAEAc,iDAAG,CAACuG,YAAJ,CAAiBlC,GAAjB,CAAqB,YAArB,EAAmC,UAACrE,GAAD,EAAS;AACxCA,KAAG,CAACwG,aAAJ,QACS,YADT,EAEKC,YAFL,CAEkBvH,8DAFlB,EAGKwH,kBAHL,CAIQ;AACIC,QAAI,EAAE,aADV;AAEIC,SAAK,EAAE5G,GAAG,CAACyB,UAAJ,CAAeC,KAAf,CAAqB,2CAArB,CAFX;AAGImF,cAAU,EAAE;AAHhB,GAJR,EASQ,OATR,EAUQ,EAVR,EAYKH,kBAZL,CAaQ;AACIC,QAAI,EAAE,iBADV;AAEIC,SAAK,EAAE5G,GAAG,CAACyB,UAAJ,CAAeC,KAAf,CAAqB,6CAArB,CAFX;AAGImF,cAAU,EAAE,qBAHhB;AAIIC,cAAU,EAAE;AAJhB,GAbR,EAmBQ,MAnBR,EAoBQ,EApBR;AAsBH,CAvBD,E;;;;;;;;;;;ACLA,2C;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,gE;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,oE;;;;;;;;;;;ACAA,sD;;;;;;;;;;;ACAA,oD;;;;;;;;;;;ACAA,0D;;;;;;;;;;;ACAA,sD","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 = \"./admin.js\");\n","export * from './src/admin';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import app from 'flarum/app';\r\nimport Button from 'flarum/components/Button';\r\nimport saveSettings from 'flarum/utils/saveSettings';\r\nimport Alert from 'flarum/components/Alert';\r\nimport Select from 'flarum/components/Select';\r\nimport Switch from 'flarum/components/Switch';\r\nimport UploadImageButton from 'flarum/components/UploadImageButton';\r\nimport withAttr from 'flarum/utils/withAttr';\r\nimport Stream from 'flarum/utils/Stream';\r\nimport ExtensionPage from 'flarum/components/ExtensionPage';\r\nimport ItemList from 'flarum/utils/ItemList';\r\n\r\n/* global m */\r\n\r\nexport default class UploadPage extends ExtensionPage {\r\n oninit(vnode) {\r\n super.oninit(vnode);\r\n // whether we are saving the settings or not right now\r\n this.loading = false;\r\n\r\n // the fields we need to watch and to save\r\n this.fields = [\r\n // image\r\n 'resizeMaxWidth',\r\n 'cdnUrl',\r\n 'maxFileSize',\r\n 'whitelistedClientExtensions',\r\n // watermark\r\n 'watermark',\r\n 'watermarkPosition',\r\n // Imgur\r\n 'imgurClientId',\r\n // AWS\r\n 'awsS3Key',\r\n 'awsS3Secret',\r\n 'awsS3Bucket',\r\n 'awsS3Region',\r\n 'awsS3Endpoint',\r\n 'awsS3ACL',\r\n // QIniu\r\n 'qiniuKey',\r\n 'qiniuSecret',\r\n 'qiniuBucket',\r\n ];\r\n\r\n // the checkboxes we need to watch and to save.\r\n this.checkboxes = ['mustResize', 'addsWatermarks', 'disableHotlinkProtection', 'disableDownloadLogging', 'awsS3UsePathStyleEndpoint'];\r\n\r\n // fields that are objects\r\n this.objects = ['mimeTypes'];\r\n\r\n // watermark positions\r\n this.watermarkPositions = {\r\n 'top-left': 'top-left',\r\n 'top-right': 'top-right',\r\n 'bottom-left': 'bottom-left',\r\n 'bottom-right': 'bottom-right',\r\n center: 'center',\r\n left: 'left',\r\n top: 'top',\r\n right: 'right',\r\n bottom: 'bottom',\r\n };\r\n\r\n // get the saved settings from the database\r\n const settings = app.data.settings;\r\n\r\n // our package prefix (to be added to every field and checkbox in the setting table)\r\n this.settingsPrefix = 'fof-upload';\r\n\r\n // Options for the Upload methods dropdown menu.\r\n this.uploadMethodOptions = settings[this.addPrefix('availableUploadMethods')] || {};\r\n // Options for the Template dropdown menu.\r\n this.templateOptions = settings[this.addPrefix('availableTemplates')] || {};\r\n // Contains current values.\r\n this.values = {};\r\n // bind the values of the fields and checkboxes to the getter/setter functions\r\n this.fields.forEach((key) => (this.values[key] = Stream(settings[this.addPrefix(key)])));\r\n this.checkboxes.forEach((key) => (this.values[key] = Stream(settings[this.addPrefix(key)] === '1')));\r\n this.objects.forEach(\r\n (key) => (this.values[key] = settings[this.addPrefix(key)] ? Stream(JSON.parse(settings[this.addPrefix(key)])) : Stream())\r\n );\r\n\r\n // Set a sane default in case no mimeTypes have been configured yet.\r\n // Since 'local' (or others) can now be disabled, pick the last entry in the object for default\r\n this.defaultAdap = Object.keys(this.uploadMethodOptions)[Object.keys(this.uploadMethodOptions).length - 1];\r\n this.values.mimeTypes() ||\r\n (this.values.mimeTypes = Stream({\r\n '^image\\\\/.*': {\r\n adapter: this.defaultAdap,\r\n template: 'image-preview',\r\n },\r\n }));\r\n\r\n this.newMimeType = {\r\n regex: Stream(''),\r\n adapter: Stream(this.defaultAdap),\r\n template: Stream('file'),\r\n };\r\n }\r\n\r\n /**\r\n * Show the actual ImageUploadPage.\r\n *\r\n * @returns {*}\r\n */\r\n content() {\r\n return [\r\n m('.UploadPage', [\r\n m('.container', [\r\n m(\r\n 'form',\r\n {\r\n onsubmit: this.onsubmit.bind(this),\r\n },\r\n [\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.preferences.title')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.preferences.max_file_size')),\r\n m('input.FormControl', {\r\n value: this.values.maxFileSize() || 2048,\r\n oninput: withAttr('value', this.values.maxFileSize),\r\n type: 'number',\r\n min: '0',\r\n }),\r\n m('label', app.translator.trans('fof-upload.admin.labels.preferences.mime_types')),\r\n m(\r\n '.MimeTypes--Container',\r\n Object.keys(this.values.mimeTypes()).map((mime) => {\r\n let config = this.values.mimeTypes()[mime];\r\n // Compatibility for older versions.\r\n if (typeof config !== 'object') {\r\n config = {\r\n adapter: config,\r\n template: 'file',\r\n };\r\n }\r\n\r\n return m('div', [\r\n m('input.FormControl.MimeTypes', {\r\n value: mime,\r\n oninput: withAttr('value', this.updateMimeTypeKey.bind(this, mime)),\r\n }),\r\n Select.component({\r\n options: this.uploadMethodOptions,\r\n onchange: this.updateMimeTypeAdapter.bind(this, mime, config),\r\n value: config.adapter || 'local',\r\n }),\r\n Select.component({\r\n options: this.getTemplateOptionsForInput(),\r\n onchange: this.updateMimeTypeTemplate.bind(this, mime, config),\r\n value: config.template || 'local',\r\n }),\r\n Button.component(\r\n {\r\n type: 'button',\r\n className: 'Button Button--warning',\r\n onclick: this.deleteMimeType.bind(this, mime),\r\n },\r\n 'x'\r\n ),\r\n ]);\r\n }),\r\n m('br'),\r\n m('div', [\r\n m('input.FormControl.MimeTypes.add-MimeType-key', {\r\n value: this.newMimeType.regex(),\r\n oninput: withAttr('value', this.newMimeType.regex),\r\n }),\r\n Select.component({\r\n options: this.uploadMethodOptions,\r\n className: 'add-MimeType-value',\r\n oninput: withAttr('value', this.newMimeType.adapter),\r\n value: this.newMimeType.adapter(),\r\n }),\r\n Select.component({\r\n options: this.getTemplateOptionsForInput(),\r\n className: 'add-MimeType-value',\r\n oninput: withAttr('value', this.newMimeType.template),\r\n value: this.newMimeType.template(),\r\n }),\r\n Button.component(\r\n {\r\n type: 'button',\r\n className: 'Button Button--warning',\r\n onclick: this.addMimeType.bind(this),\r\n },\r\n '+'\r\n ),\r\n ])\r\n ),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.mime_types')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.download_templates')),\r\n this.templateOptionsDescriptions(),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.resize.title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.resize')),\r\n Switch.component(\r\n {\r\n state: this.values.mustResize() || false,\r\n onchange: this.values.mustResize,\r\n },\r\n app.translator.trans('fof-upload.admin.labels.resize.toggle')\r\n ),\r\n m('label', app.translator.trans('fof-upload.admin.labels.resize.max_width')),\r\n m('input', {\r\n className: 'FormControl',\r\n value: this.values.resizeMaxWidth() || 100,\r\n oninput: withAttr('value', this.values.resizeMaxWidth),\r\n disabled: !this.values.mustResize(),\r\n type: 'number',\r\n min: '0',\r\n }),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.client_extension.title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.client_extension')),\r\n m('input', {\r\n className: 'FormControl',\r\n value: this.values.whitelistedClientExtensions() || '',\r\n oninput: withAttr('value', this.values.whitelistedClientExtensions),\r\n }),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.watermark.title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.watermark')),\r\n Switch.component(\r\n {\r\n state: this.values.addsWatermarks() || false,\r\n onchange: this.values.addsWatermarks,\r\n },\r\n app.translator.trans('fof-upload.admin.labels.watermark.toggle')\r\n ),\r\n m('label', app.translator.trans('fof-upload.admin.labels.watermark.position')),\r\n m('div', [\r\n Select.component({\r\n options: this.watermarkPositions,\r\n onchange: this.values.watermarkPosition,\r\n value: this.values.watermarkPosition() || 'bottom-right',\r\n }),\r\n ]),\r\n m('label', {}, app.translator.trans('fof-upload.admin.labels.watermark.file')),\r\n UploadImageButton.component({\r\n name: 'fof/watermark',\r\n }),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.disable-hotlink-protection.title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.disable-hotlink-protection')),\r\n Switch.component(\r\n {\r\n state: this.values.disableHotlinkProtection() || false,\r\n onchange: this.values.disableHotlinkProtection,\r\n },\r\n app.translator.trans('fof-upload.admin.labels.disable-hotlink-protection.toggle')\r\n ),\r\n m('legend', app.translator.trans('fof-upload.admin.labels.disable-download-logging.title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.disable-download-logging')),\r\n Switch.component(\r\n {\r\n state: this.values.disableDownloadLogging() || false,\r\n onchange: this.values.disableDownloadLogging,\r\n },\r\n app.translator.trans('fof-upload.admin.labels.disable-download-logging.toggle')\r\n ),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.local.title')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.local.cdn_url')),\r\n m('input.FormControl', {\r\n value: this.values.cdnUrl() || '',\r\n oninput: withAttr('value', this.values.cdnUrl),\r\n }),\r\n ]),\r\n\r\n this.adaptorItems().toArray(),\r\n\r\n Button.component(\r\n {\r\n type: 'submit',\r\n className: 'Button Button--primary',\r\n loading: this.loading,\r\n disabled: !this.changed(),\r\n },\r\n app.translator.trans('fof-upload.admin.buttons.save')\r\n ),\r\n ]\r\n ),\r\n ]),\r\n ]),\r\n ];\r\n }\r\n\r\n adaptorItems() {\r\n const items = new ItemList();\r\n\r\n if (this.uploadMethodOptions['imgur'] !== undefined) {\r\n items.add(\r\n 'imgur',\r\n m('.imgur', [\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.imgur.title')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.imgur.client_id')),\r\n m('input.FormControl', {\r\n value: this.values.imgurClientId() || '',\r\n oninput: withAttr('value', this.values.imgurClientId),\r\n }),\r\n ]),\r\n ])\r\n );\r\n }\r\n\r\n if (this.uploadMethodOptions['qiniu'] !== undefined) {\r\n items.add(\r\n 'qiniu',\r\n m('.qiniu', [\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.qiniu.title')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.qiniu.key')),\r\n m('input.FormControl', {\r\n value: this.values.qiniuKey() || '',\r\n oninput: withAttr('value', this.values.qiniuKey),\r\n }),\r\n m('label', {}, app.translator.trans('fof-upload.admin.labels.qiniu.secret')),\r\n m('input.FormControl', {\r\n value: this.values.qiniuSecret() || '',\r\n oninput: withAttr('value', this.values.qiniuSecret),\r\n }),\r\n m('label', {}, app.translator.trans('fof-upload.admin.labels.qiniu.bucket')),\r\n m('input.FormControl', {\r\n value: this.values.qiniuBucket() || '',\r\n oninput: withAttr('value', this.values.qiniuBucket),\r\n }),\r\n ]),\r\n ])\r\n );\r\n }\r\n\r\n if (this.uploadMethodOptions['aws-s3'] !== undefined) {\r\n items.add(\r\n 'aws-s3',\r\n m('.aws', [\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.aws-s3.title')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.key')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3Key() || '',\r\n oninput: withAttr('value', this.values.awsS3Key),\r\n }),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.secret')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3Secret() || '',\r\n oninput: withAttr('value', this.values.awsS3Secret),\r\n }),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.bucket')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3Bucket() || '',\r\n oninput: withAttr('value', this.values.awsS3Bucket),\r\n }),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.region')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3Region() || '',\r\n oninput: withAttr('value', this.values.awsS3Region),\r\n }),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.aws-s3.advanced_title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.s3_compatible_storage')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.endpoint')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3Endpoint() || '',\r\n oninput: withAttr('value', this.values.awsS3Endpoint),\r\n }),\r\n Switch.component(\r\n {\r\n state: this.values.awsS3UsePathStyleEndpoint() || false,\r\n onchange: this.values.awsS3UsePathStyleEndpoint,\r\n },\r\n app.translator.trans('fof-upload.admin.labels.aws-s3.use_path_style_endpoint')\r\n ),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.acl')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3ACL() || '',\r\n oninput: withAttr('value', this.values.awsS3ACL),\r\n }),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.s3_acl')),\r\n ]),\r\n ])\r\n );\r\n }\r\n\r\n return items;\r\n }\r\n\r\n getTemplateOptionsForInput() {\r\n const options = {};\r\n\r\n for (let option in this.templateOptions) {\r\n if (!this.templateOptions.hasOwnProperty(option)) {\r\n continue;\r\n }\r\n\r\n options[option] = this.templateOptions[option].name;\r\n }\r\n\r\n return options;\r\n }\r\n\r\n updateMimeTypeKey(mime, value) {\r\n this.values.mimeTypes()[value] = this.values.mimeTypes()[mime];\r\n\r\n this.deleteMimeType(mime);\r\n }\r\n\r\n updateMimeTypeAdapter(mime, config, value) {\r\n config.adapter = value;\r\n this.values.mimeTypes()[mime] = config;\r\n }\r\n\r\n updateMimeTypeTemplate(mime, config, value) {\r\n config.template = value;\r\n this.values.mimeTypes()[mime] = config;\r\n }\r\n\r\n deleteMimeType(mime) {\r\n delete this.values.mimeTypes()[mime];\r\n }\r\n\r\n templateOptionsDescriptions() {\r\n const children = [];\r\n\r\n for (let template in this.templateOptions) {\r\n if (!this.templateOptions.hasOwnProperty(template)) {\r\n continue;\r\n }\r\n\r\n children.push(m('li', this.templateOptions[template].name + ': ' + this.templateOptions[template].description));\r\n }\r\n\r\n return m('ul', children);\r\n }\r\n\r\n addMimeType() {\r\n this.values.mimeTypes()[this.newMimeType.regex()] = {\r\n adapter: this.newMimeType.adapter(),\r\n template: this.newMimeType.template(),\r\n };\r\n\r\n this.newMimeType.regex('');\r\n this.newMimeType.adapter('local');\r\n this.newMimeType.template('file');\r\n }\r\n\r\n /**\r\n * Checks if the values of the fields and checkboxes are different from\r\n * the ones stored in the database\r\n *\r\n * @returns boolean\r\n */\r\n changed() {\r\n const fieldsCheck = this.fields.some((key) => this.values[key]() !== app.data.settings[this.addPrefix(key)]);\r\n const checkboxesCheck = this.checkboxes.some((key) => this.values[key]() !== (app.data.settings[this.addPrefix(key)] === '1'));\r\n const objectsCheck = this.objects.some((key) => JSON.stringify(this.values[key]()) !== app.data.settings[this.addPrefix(key)]);\r\n\r\n return fieldsCheck || checkboxesCheck || objectsCheck;\r\n }\r\n\r\n /**\r\n * Saves the settings to the database and redraw the page\r\n *\r\n * @param e\r\n */\r\n onsubmit(e) {\r\n // prevent the usual form submit behaviour\r\n e.preventDefault();\r\n\r\n // if the page is already saving, do nothing\r\n if (this.loading) return;\r\n\r\n // prevents multiple savings\r\n this.loading = true;\r\n\r\n // remove previous success popup\r\n app.alerts.dismiss(this.successAlert);\r\n\r\n const settings = {};\r\n\r\n // gets all the values from the form\r\n this.fields.forEach((key) => (settings[this.addPrefix(key)] = this.values[key]()));\r\n this.checkboxes.forEach((key) => (settings[this.addPrefix(key)] = this.values[key]()));\r\n this.objects.forEach((key) => (settings[this.addPrefix(key)] = JSON.stringify(this.values[key]())));\r\n\r\n // actually saves everything in the database\r\n saveSettings(settings)\r\n .then(() => {\r\n // on success, show popup\r\n this.successAlert = app.alerts.show(Alert, { type: 'success' }, app.translator.trans('core.admin.basics.saved_message'));\r\n })\r\n .catch(() => {})\r\n .then(() => {\r\n // return to the initial state and redraw the page\r\n this.loading = false;\r\n m.redraw();\r\n });\r\n }\r\n\r\n /**\r\n * Adds the prefix `this.settingsPrefix` at the beginning of `key`\r\n *\r\n * @returns string\r\n */\r\n addPrefix(key) {\r\n return this.settingsPrefix + '.' + key;\r\n }\r\n}\r\n","import UploadPage from './UploadPage';\r\n\r\nexport const components = {\r\n UploadPage,\r\n};\r\n","import app from 'flarum/app';\r\nimport UploadPage from './components/UploadPage';\r\n\r\nexport * from './components';\r\n\r\napp.initializers.add('fof-upload', (app) => {\r\n app.extensionData\r\n .for('fof-upload')\r\n .registerPage(UploadPage)\r\n .registerPermission(\r\n {\r\n icon: 'far fa-file',\r\n label: app.translator.trans('fof-upload.admin.permissions.upload_label'),\r\n permission: 'fof-upload.upload',\r\n },\r\n 'start',\r\n 50\r\n )\r\n .registerPermission(\r\n {\r\n icon: 'fas fa-download',\r\n label: app.translator.trans('fof-upload.admin.permissions.download_label'),\r\n permission: 'fof-upload.download',\r\n allowGuest: true,\r\n },\r\n 'view',\r\n 50\r\n );\r\n});\r\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['components/UploadImageButton'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['utils/withAttr'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 2e9b7afe..ae2a7edc 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,1477 @@ -module.exports=function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=18)}([function(t,e){t.exports=flarum.core.compat.app},,,function(t,e){t.exports=flarum.core.compat.extend},,,function(t,e,o){"use strict";function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}o.d(e,"a",(function(){return n}))},function(t,e){t.exports=flarum.core.compat["components/TextEditor"]},,function(t,e){t.exports=flarum.core.compat["components/Post"]},function(t,e){t.exports=flarum.core.compat.Component},function(t,e){t.exports=flarum.core.compat["helpers/icon"]},function(t,e){t.exports=flarum.core.compat["components/LoadingIndicator"]},,,,,,function(t,e,o){"use strict";o.r(e);var n=o(0),r=o.n(n),i=o(3),a=o(9),s=o.n(a),u=o(7),p=o.n(u),l=o(6),d=o(10),c=o.n(d),f=o(11),h=o.n(f),g=o(12),v=o.n(g),b=function(t){function e(){return t.apply(this,arguments)||this}Object(l.a)(e,t);var o=e.prototype;return o.oninit=function(e){var o=this;t.prototype.oninit.call(this,e),this.attrs.uploader.on("uploaded",(function(){o.$("form")[0].reset(),m.redraw()}))},o.view=function(){var t=this.attrs.uploader.uploading?r.a.translator.trans("fof-upload.forum.states.loading"):r.a.translator.trans("fof-upload.forum.buttons.attach");return m("button.Button.hasIcon.fof-upload-button.Button--icon",{className:this.attrs.uploader.uploading?"uploading":"",onclick:this.uploadButtonClicked.bind(this)},[this.attrs.uploader.uploading?v.a.component({size:"tiny",className:"LoadingIndicator--inline Button-icon"}):h()("fas fa-file-upload",{className:"Button-icon"}),m("span.Button-label",t),m("form",[m("input",{type:"file",multiple:!0,onchange:this.process.bind(this)})])])},o.process=function(t){var e=this.$("input").prop("files");0!==e.length&&this.attrs.uploader.upload(e)},o.uploadButtonClicked=function(t){this.$("input").click()},e}(c.a),y=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)),this.isDropping=this.over=!1)}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(o))}},t}(),w=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){var e=this;this.uploading=!0,this.dispatch("uploading",t),m.redraw();for(var o=new FormData,n=0;n= 0) { + return 'image'; + } // Display image icon for other types + else if (fileType.includes("image/")) { + return 'far fa-file-image'; + } // Video icon + else if (fileType.includes("video/")) { + return 'far fa-file-video'; + } // Archive icon + else if (archive.indexOf(fileType) >= 0) { + return 'far fa-file-archive'; + } // PDF icon + else if (fileType === "application/pdf") { + return 'far fa-file-pdf'; + } // Word + else if (word.indexOf(fileType) >= 0) { + return 'far fa-file-word'; + } // Audio icon + else if (fileType.includes("audio/")) { + return 'far fa-file-audio'; + } // Code files + else if (code.indexOf(fileType) >= 0) { + return 'far fa-file-code'; + } + + return 'far fa-file'; +} + +/***/ }), + +/***/ "./src/common/models/File.js": +/*!***********************************!*\ + !*** ./src/common/models/File.js ***! + \***********************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return File; }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_Model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/Model */ "flarum/Model"); +/* harmony import */ var flarum_Model__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_Model__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_utils_mixin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/utils/mixin */ "flarum/utils/mixin"); +/* harmony import */ var flarum_utils_mixin__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_utils_mixin__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _fileToBBcode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../fileToBBcode */ "./src/common/fileToBBcode.js"); + + + + + +var File = /*#__PURE__*/function (_mixin) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(File, _mixin); + + function File() { + return _mixin.apply(this, arguments) || this; + } + + var _proto = File.prototype; + + /** + * Use FoF Uploads endpoint + */ + _proto.apiEndpoint = function apiEndpoint() { + return '/fof/uploads' + (this.exists ? '/' + this.data.id : ''); + } + /** + * Generate bbcode for this file + */ + ; + + _proto.bbcode = function bbcode() { + return Object(_fileToBBcode__WEBPACK_IMPORTED_MODULE_3__["default"])(this); + }; + + return File; +}(flarum_utils_mixin__WEBPACK_IMPORTED_MODULE_2___default()(flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a, { + baseName: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("baseName"), + path: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("path"), + url: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("url"), + type: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("type"), + size: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("size"), + humanSize: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("humanSize"), + createdAt: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("createdAt"), + uuid: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("uuid"), + tag: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("tag") +})); + + + +/***/ }), + +/***/ "./src/forum/addUploadButton.js": +/*!**************************************!*\ + !*** ./src/forum/addUploadButton.js ***! + \**************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/app */ "flarum/app"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_app__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var flarum_extend__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/extend */ "flarum/extend"); +/* harmony import */ var flarum_extend__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_extend__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_components_TextEditor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/components/TextEditor */ "flarum/components/TextEditor"); +/* harmony import */ var flarum_components_TextEditor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_components_TextEditor__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _components_UploadButton__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/UploadButton */ "./src/forum/components/UploadButton.js"); +/* harmony import */ var _components_DragAndDrop__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/DragAndDrop */ "./src/forum/components/DragAndDrop.js"); +/* harmony import */ var _components_PasteClipboard__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/PasteClipboard */ "./src/forum/components/PasteClipboard.js"); +/* harmony import */ var _handler_Uploader__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./handler/Uploader */ "./src/forum/handler/Uploader.js"); +/* harmony import */ var _components_FileManagerButton__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/FileManagerButton */ "./src/forum/components/FileManagerButton.js"); + + + + + + + + +/* harmony default export */ __webpack_exports__["default"] = (function () { + Object(flarum_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_components_TextEditor__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'oninit', function () { + this.uploader = new _handler_Uploader__WEBPACK_IMPORTED_MODULE_6__["default"](); + }); + Object(flarum_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_components_TextEditor__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'controlItems', function (items) { + if (!flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute('fof-upload.canUpload')) return; // Add media button + + items.add('fof-upload-media', _components_FileManagerButton__WEBPACK_IMPORTED_MODULE_7__["default"].component({ + uploader: this.uploader + })); // Add upload button + + items.add('fof-upload', _components_UploadButton__WEBPACK_IMPORTED_MODULE_3__["default"].component({ + uploader: this.uploader + })); + }); + Object(flarum_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_components_TextEditor__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'oncreate', function (f_, vnode) { + var _this = this; + + if (!flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute('fof-upload.canUpload')) return; + this.uploader.on('success', function (_ref) { + var file = _ref.file, + addBBcode = _ref.addBBcode; + if (!addBBcode) return; + + _this.attrs.composer.editor.insertAtCursor(file.bbcode() + '\n'); // We wrap this in a typeof check to prevent it running when a user + // is creating a new discussion. There's nothing to preview in a new + // discussion, so the `preview` function isn't defined. + + + if (typeof _this.attrs.preview === 'function') { + // Scroll the preview into view + // preview() causes the composer to close on mobile, but we don't want that. We want only the scroll + // We work around that by temporarily patching the isFullScreen method + var originalIsFullScreen = flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.composer.isFullScreen; + + flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.composer.isFullScreen = function () { + return false; + }; + + _this.attrs.preview(); + + flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.composer.isFullScreen = originalIsFullScreen; + } + }); + var dragAndDrop = new _components_DragAndDrop__WEBPACK_IMPORTED_MODULE_4__["default"](function (files) { + return _this.uploader.upload(files); + }, this.$().parents('.Composer')[0]); + + var unloadHandler = function unloadHandler() { + dragAndDrop.unload(); + }; + + this.$('textarea').bind('onunload', unloadHandler); + new _components_PasteClipboard__WEBPACK_IMPORTED_MODULE_5__["default"](function (files) { + return _this.uploader.upload(files); + }, this.$('textarea')[0]); + }); +}); + +/***/ }), + +/***/ "./src/forum/components/DragAndDrop.js": +/*!*********************************************!*\ + !*** ./src/forum/components/DragAndDrop.js ***! + \*********************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return DragAndDrop; }); +var DragAndDrop = /*#__PURE__*/function () { + function DragAndDrop(upload, composerElement) { + this.upload = upload; + this.composerElement = composerElement; // Keep references to the bound methods so we can remove the event listeners later + + this.handlers = {}; + + if (!this.supportsFileDragging()) { + return; + } + + 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 _proto = DragAndDrop.prototype; + + _proto.supportsFileDragging = function supportsFileDragging() { + // Based on https://css-tricks.com/drag-and-drop-file-uploading/ + var div = document.createElement('div'); + return ('draggable' in div || 'ondragstart' in div && 'ondrop' in div) && 'FormData' in window && 'FileReader' in window; + }; + + _proto.unload = function unload() { + // If the handlers were not set (drag and drop not supported), we skip removing them + if (!this.handlers["in"]) { + return; + } + + 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); + }; + + _proto.isNotFile = function isNotFile(event) { + // Checking event.dataTransfer.files.length does not work on dragover event, it's always zero + // So we use the dataTransfer.items property to check whether any file is being dragged + if (event.dataTransfer.items) { + for (var i = 0; i < event.dataTransfer.items.length; i++) { + if (event.dataTransfer.items[i].kind !== 'file') { + return true; + } + } + } + + return false; + }; + + _proto["in"] = function _in(event) { + if (this.isNotFile(event)) { + return; + } + + event.preventDefault(); + + if (!this.over) { + this.composerElement.classList.add('fof-upload-dragging'); + this.over = true; + } + }; + + _proto.out = function out(event) { + if (this.isNotFile(event)) { + return; + } + + event.preventDefault(); + + if (this.over) { + this.composerElement.classList.remove('fof-upload-dragging'); + this.over = false; + } + }; + + _proto.dropping = function dropping(event) { + if (this.isNotFile(event)) { + return; + } + + event.preventDefault(); + this.upload(event.dataTransfer.files); + this.composerElement.classList.remove('fof-upload-dragging'); + }; + + return DragAndDrop; +}(); + + + +/***/ }), + +/***/ "./src/forum/components/FileManagerButton.js": +/*!***************************************************!*\ + !*** ./src/forum/components/FileManagerButton.js ***! + \***************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return FileManagerButton; }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/app */ "flarum/app"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_app__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_Component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/Component */ "flarum/Component"); +/* harmony import */ var flarum_Component__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_Component__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_components_Button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/components/Button */ "flarum/components/Button"); +/* harmony import */ var flarum_components_Button__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_components_Button__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _FileManagerModal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./FileManagerModal */ "./src/forum/components/FileManagerModal.js"); + + + + + + +var FileManagerButton = /*#__PURE__*/function (_Component) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(FileManagerButton, _Component); + + function FileManagerButton() { + return _Component.apply(this, arguments) || this; + } + + var _proto = FileManagerButton.prototype; + + _proto.view = function view() { + return flarum_components_Button__WEBPACK_IMPORTED_MODULE_3___default.a.component({ + className: "Button fof-upload-button Button--icon", + onclick: this.fileManagerButtonClicked.bind(this), + icon: 'fas fa-photo-video', + title: flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.forum.buttons.media') + }); + } + /** + * Show tooltip on hover + * + * @param {*} vnode + */ + ; + + _proto.oncreate = function oncreate(vnode) { + _Component.prototype.oncreate.call(this, vnode); // Add tooltip + + + this.$().tooltip(); + } + /** + * Event handler for upload button being clicked + * + * @param {PointerEvent} e + */ + ; + + _proto.fileManagerButtonClicked = function fileManagerButtonClicked(e) { + e.preventDefault(); // Open dialog + + flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.modal.show(_FileManagerModal__WEBPACK_IMPORTED_MODULE_4__["default"], { + selectFile: true, + uploader: this.attrs.uploader + }); + }; + + return FileManagerButton; +}(flarum_Component__WEBPACK_IMPORTED_MODULE_2___default.a); + + + +/***/ }), + +/***/ "./src/forum/components/FileManagerModal.js": +/*!**************************************************!*\ + !*** ./src/forum/components/FileManagerModal.js ***! + \**************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return FileManagerModal; }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_components_Modal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/components/Modal */ "flarum/components/Modal"); +/* harmony import */ var flarum_components_Modal__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_components_Modal__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_components_Button__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/components/Button */ "flarum/components/Button"); +/* harmony import */ var flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_components_Button__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _UploadButton__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./UploadButton */ "./src/forum/components/UploadButton.js"); +/* harmony import */ var _UserFileList__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./UserFileList */ "./src/forum/components/UserFileList.js"); +/* harmony import */ var _DragAndDrop__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DragAndDrop */ "./src/forum/components/DragAndDrop.js"); + + + + + + + +var FileManagerModal = /*#__PURE__*/function (_Modal) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(FileManagerModal, _Modal); + + function FileManagerModal() { + return _Modal.apply(this, arguments) || this; + } + + var _proto = FileManagerModal.prototype; + + _proto.oninit = function oninit(vnode) { + _Modal.prototype.oninit.call(this, vnode); // Initialize upload managers + + + this.uploader = vnode.attrs.uploader; // Current selected files + + this.selectedFiles = []; // Allow multiselect + + this.multiSelect = vnode.attrs.multiSelect || false; // Drag & drop + + this.dragDrop = null; // Initialize uploads + + this.onUpload(); + }; + + _proto.className = function className() { + return "Modal--large fof-file-manager-modal"; + } + /** + * Initialize drag & drop + */ + ; + + _proto.oncreate = function oncreate(vnode) { + var _this = this; + + _Modal.prototype.oncreate.call(this, vnode); + + this.dragDrop = new _DragAndDrop__WEBPACK_IMPORTED_MODULE_5__["default"](function (files) { + return _this.uploader.upload(files, false); + }, this.$().find(".Modal-content")[0]); + } + /** + * Remove events from modal content + */ + ; + + _proto.onremove = function onremove() { + if (this.dragDrop) { + this.dragDrop.unload(); + } + }; + + _proto.view = function view() { + return m("div", { + className: 'Modal modal-dialog ' + this.className() + }, m("div", { + className: "Modal-content" + }, m("div", { + className: "fof-modal-buttons App-backControl" + }, _UploadButton__WEBPACK_IMPORTED_MODULE_3__["default"].component({ + uploader: this.uploader, + disabled: app.fileListState.isLoading(), + isMediaUploadButton: true + })), 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" + }, Alert.component(this.alertAttrs)) : '', m("div", { + className: "Modal-body" + }, _UserFileList__WEBPACK_IMPORTED_MODULE_4__["default"].component({ + user: this.attrs.user, + selectable: true, + onFileSelect: this.onFileSelect.bind(this), + selectedFiles: this.selectedFiles + })), m("div", { + className: "Modal-footer" + }, flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a.component({ + onclick: this.hide.bind(this), + className: 'Button' + }, app.translator.trans("fof-upload.forum.buttons.cancel")), flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a.component({ + onclick: this.onSelect.bind(this), + disabled: this.selectedFiles.length === 0 || !this.multiSelect && this.selectedFiles.length > 1, + className: 'Button Button--primary' + }, app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length))))); + } + /** + * Add or remove file from selected files + * + * @param {File} file + */ + ; + + _proto.onFileSelect = function onFileSelect(file) { + var itemPosition = this.selectedFiles.indexOf(file.id()); + + if (itemPosition >= 0) { + this.selectedFiles.splice(itemPosition, 1); + } else { + if (this.multiSelect) { + this.selectedFiles.push(file.id()); + } else { + this.selectedFiles = [file.id()]; + } + } + } + /** + * Add files to file list after upload + */ + ; + + _proto.onUpload = function onUpload() { + var _this2 = this; + + this.uploader.on('success', function (_ref) { + var file = _ref.file; + + if (_this2.multiSelect) { + _this2.selectedFiles.push(file.id()); + } else { + _this2.selectedFiles = [file.id()]; + } + }); + } + /** + * Add selected files to the composer + */ + ; + + _proto.onSelect = function onSelect() { + this.hide(); // Custom callback + + if (this.attrs.onSelect) { + this.attrs.onSelect(this.selectedFiles); + return; + } // Add selected files to composer + + + this.selectedFiles.map(function (fileId) { + var file = app.store.getById("files", fileId); + app.composer.editor.insertAtCursor(file.bbcode() + '\n'); + }); + }; + + return FileManagerModal; +}(flarum_components_Modal__WEBPACK_IMPORTED_MODULE_1___default.a); + + + +/***/ }), + +/***/ "./src/forum/components/PasteClipboard.js": +/*!************************************************!*\ + !*** ./src/forum/components/PasteClipboard.js ***! + \************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return PasteClipboard; }); +var PasteClipboard = /*#__PURE__*/function () { + function PasteClipboard(upload, textAreaElement) { + this.upload = upload; // We don't need to remove the events listeners, because they are bound to the textarea when it's created, + // and need to stay as long as the textarea exists in the DOM + + textAreaElement.addEventListener('paste', this.paste.bind(this)); + } + + var _proto = PasteClipboard.prototype; + + _proto.paste = function paste(e) { + if (e.clipboardData && e.clipboardData.items) { + var items = e.clipboardData.items; + var files = []; + + for (var i = 0; i < items.length; i++) { + if (items[i].type.indexOf('image') !== -1) { + files.push(items[i].getAsFile()); + } + } + + if (files.length > 0) { + e.preventDefault(); + this.upload(files); + } + } + }; + + return PasteClipboard; +}(); + + + +/***/ }), + +/***/ "./src/forum/components/UploadButton.js": +/*!**********************************************!*\ + !*** ./src/forum/components/UploadButton.js ***! + \**********************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return UploadButton; }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/app */ "flarum/app"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_app__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_Component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/Component */ "flarum/Component"); +/* harmony import */ var flarum_Component__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_Component__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_utils_classList__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/utils/classList */ "flarum/utils/classList"); +/* harmony import */ var flarum_utils_classList__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_utils_classList__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var flarum_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/components/LoadingIndicator */ "flarum/components/LoadingIndicator"); +/* harmony import */ var flarum_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var flarum_components_Button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! flarum/components/Button */ "flarum/components/Button"); +/* harmony import */ var flarum_components_Button__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(flarum_components_Button__WEBPACK_IMPORTED_MODULE_5__); + + + + + + + +var UploadButton = /*#__PURE__*/function (_Component) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(UploadButton, _Component); + + function UploadButton() { + return _Component.apply(this, arguments) || this; + } + + var _proto = UploadButton.prototype; + + _proto.oninit = function oninit(vnode) { + var _this = this; + + _Component.prototype.oninit.call(this, vnode); + + this.attrs.uploader.on('uploaded', function () { + // reset the button for a new upload + _this.$('form')[0].reset(); // redraw to reflect uploader.loading in the DOM + + + m.redraw(); + }); + this.isMediaUploadButton = vnode.attrs.isMediaUploadButton || false; + }; + + _proto.oncreate = function oncreate(vnode) { + _Component.prototype.oncreate.call(this, vnode); // Add tooltip + + + if (!this.isMediaUploadButton) { + this.$().tooltip(); + } + }; + + _proto.view = function view() { + var buttonText = this.attrs.uploader.uploading ? flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.forum.states.loading') : flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.forum.buttons.upload'); + return flarum_components_Button__WEBPACK_IMPORTED_MODULE_5___default.a.component({ + className: flarum_utils_classList__WEBPACK_IMPORTED_MODULE_3___default()(["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), + title: !this.isMediaUploadButton ? buttonText : null, + disabled: this.attrs.disabled + }, [this.attrs.uploader.uploading && flarum_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_4___default.a.component({ + size: 'tiny', + className: 'LoadingIndicator--inline Button-icon' + }), this.isMediaUploadButton || this.attrs.uploader.uploading ? m("span", { + className: "Button-label" + }, buttonText) : null, m("form", null, m("input", { + type: "file", + multiple: true, + onchange: this.process.bind(this) + }))]); + } + /** + * Process the upload event. + * + * @param e + */ + ; + + _proto.process = function process(e) { + // get the file from the input field + var files = this.$('input').prop('files'); + + if (files.length === 0) { + // We've got no files to upload, so trying + // to begin an upload will show an error + // to the user. + return; + } + + this.attrs.uploader.upload(files, !this.isMediaUploadButton); + } + /** + * Event handler for upload button being clicked + * + * @param {PointerEvent} e + */ + ; + + _proto.uploadButtonClicked = function uploadButtonClicked(e) { + // Trigger click on hidden input element + // (Opens file dialog) + this.$('input').click(); + }; + + return UploadButton; +}(flarum_Component__WEBPACK_IMPORTED_MODULE_2___default.a); + + + +/***/ }), + +/***/ "./src/forum/components/UserFileList.js": +/*!**********************************************!*\ + !*** ./src/forum/components/UserFileList.js ***! + \**********************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return UserFileList; }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_Component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/Component */ "flarum/Component"); +/* harmony import */ var flarum_Component__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_Component__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_components_Button__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/components/Button */ "flarum/components/Button"); +/* harmony import */ var flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_components_Button__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/components/LoadingIndicator */ "flarum/components/LoadingIndicator"); +/* harmony import */ var flarum_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _common_mimeToIcon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../common/mimeToIcon */ "./src/common/mimeToIcon.js"); + + + + + + +var UserFileList = /*#__PURE__*/function (_Component) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(UserFileList, _Component); + + function UserFileList() { + return _Component.apply(this, arguments) || this; + } + + var _proto = UserFileList.prototype; + + _proto.oninit = function oninit(vnode) { + _Component.prototype.oninit.call(this, vnode); // Load file list + + + app.fileListState.setUser(vnode.attrs.user || app.session.user); + this.inModal = vnode.attrs.selectable; + this.restrictFileType = vnode.attrs.restrictFileType || null; + }; + + _proto.view = function view() { + var _this = this; + + var state = app.fileListState; + return m("div", { + className: "fof-upload-file-list" + }, state.isLoading() && state.files.length === 0 && m("div", { + className: "fof-upload-loading" + }, app.translator.trans("fof-upload.forum.file_list.loading"), m(flarum_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_3___default.a, null)), this.inModal && state.empty() && m("p", { + className: "fof-upload-empty" + }, m("i", { + className: "fas fa-cloud-upload-alt fof-upload-empty-icon" + }), app.translator.trans("fof-upload.forum.file_list.modal_empty_" + (app.screen() !== "phone" ? "desktop" : "phone"))), !this.inModal && state.empty()(m("p", { + className: "fof-upload-empty" + }, app.translator.trans("fof-upload.forum.file_list.empty"))), m("ul", null, state.files.map(function (file) { + var fileClassNames = "fof-file"; + var fileIcon = Object(_common_mimeToIcon__WEBPACK_IMPORTED_MODULE_4__["default"])(file.type()); + var fileSelectable = _this.restrictFileType ? _this.isSelectable(file) : true; // File is image + + if (fileIcon === "image") { + fileClassNames += " fof-file-type-image"; + } // File is selected + + + if (_this.attrs.selectedFiles && _this.attrs.selectedFiles.indexOf(file.id()) >= 0) { + fileClassNames += " fof-file-selected"; + } + + return m("li", null, m("button", { + className: fileClassNames, + onclick: _this.attrs.onFileSelect ? function () { + return _this.attrs.onFileSelect(file); + } : null, + title: file.baseName(), + disabled: !fileSelectable + }, m("span", { + className: "fof-file-icon" + }, m("i", { + className: fileIcon !== 'image' ? fileIcon : 'far fa-file-image' + })), fileIcon === 'image' && m("img", { + src: file.url(), + className: "fof-file-image-preview" + }), m("span", { + className: "fof-file-name" + }, file.baseName()))); + })), state.hasMoreResults() && m("div", { + className: "fof-load-more-files" + }, m(flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a, { + className: "Button Button--primary", + disabled: state.isLoading(), + loading: state.isLoading(), + onclick: function onclick() { + return state.loadMore(); + } + }, app.translator.trans("fof-upload.forum.buttons.load_more_files")))); + } + /** + * Check if a file is selectable + * + * @param {File} file + */ + ; + + _proto.isSelectable = function isSelectable(file) { + var fileType = file.type(); // Custom defined file types + + if (Array.isArray(this.restrictFileType)) { + return this.restrictFileType.indexOf(fileType) >= 0; + } // Image + else if (this.restrictFileType === 'image') { + return fileType.includes("image/"); + } // Audio + else if (this.restrictFileType === 'audio') { + return fileType.includes("audio/"); + } // Video + else if (this.restrictFileType === 'video') { + return fileType.includes("video/"); + } + + return false; + }; + + return UserFileList; +}(flarum_Component__WEBPACK_IMPORTED_MODULE_1___default.a); + + + +/***/ }), + +/***/ "./src/forum/components/index.js": +/*!***************************************!*\ + !*** ./src/forum/components/index.js ***! + \***************************************/ +/*! exports provided: components */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "components", function() { return components; }); +/* harmony import */ var _handler_Uploader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../handler/Uploader */ "./src/forum/handler/Uploader.js"); +/* harmony import */ var _DragAndDrop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DragAndDrop */ "./src/forum/components/DragAndDrop.js"); +/* harmony import */ var _FileManagerButton__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FileManagerButton */ "./src/forum/components/FileManagerButton.js"); +/* harmony import */ var _FileManagerModal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./FileManagerModal */ "./src/forum/components/FileManagerModal.js"); +/* harmony import */ var _UserFileList__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./UserFileList */ "./src/forum/components/UserFileList.js"); + + + + + +var components = { + DragAndDrop: _DragAndDrop__WEBPACK_IMPORTED_MODULE_1__["default"], + FileManagerButton: _FileManagerButton__WEBPACK_IMPORTED_MODULE_2__["default"], + FileManagerModal: _FileManagerModal__WEBPACK_IMPORTED_MODULE_3__["default"], + UserFileList: _UserFileList__WEBPACK_IMPORTED_MODULE_4__["default"], + Uploader: _handler_Uploader__WEBPACK_IMPORTED_MODULE_0__["default"] +}; + +/***/ }), + +/***/ "./src/forum/downloadButtonInteraction.js": +/*!************************************************!*\ + !*** ./src/forum/downloadButtonInteraction.js ***! + \************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/app */ "flarum/app"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_app__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var flarum_extend__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/extend */ "flarum/extend"); +/* harmony import */ var flarum_extend__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_extend__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_components_Post__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/components/Post */ "flarum/components/Post"); +/* harmony import */ var flarum_components_Post__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_components_Post__WEBPACK_IMPORTED_MODULE_2__); + + + +/* global $ */ + +/* harmony default export */ __webpack_exports__["default"] = (function () { + Object(flarum_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_components_Post__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'oncreate', function () { + var _this = this; + + this.$('[data-fof-upload-download-uuid]').unbind('click').on('click', function (e) { + e.preventDefault(); + e.stopPropagation(); + + if (!flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute('fof-upload.canDownload')) { + alert(flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.translator.trans('fof-upload.forum.states.unauthorized')); + return; + } + + var url = flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute('apiUrl') + '/fof/download'; + url += '/' + e.currentTarget.dataset.fofUploadDownloadUuid; + url += '/' + _this.attrs.post.id(); + url += '/' + flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.session.csrfToken; + window.open(url); + }); + }); +}); + +/***/ }), + +/***/ "./src/forum/handler/Uploader.js": +/*!***************************************!*\ + !*** ./src/forum/handler/Uploader.js ***! + \***************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Uploader; }); +var Uploader = /*#__PURE__*/function () { + function Uploader() { + this.callbacks = { + success: [], + failure: [], + uploading: [], + uploaded: [] + }; + this.uploading = false; + } + + var _proto = Uploader.prototype; + + _proto.on = function on(type, callback) { + this.callbacks[type].push(callback); + }; + + _proto.dispatch = function dispatch(type, response) { + this.callbacks[type].forEach(function (callback) { + return callback(response); + }); + }; + + _proto.upload = function upload(files, addBBcode) { + var _this = this; + + if (addBBcode === void 0) { + addBBcode = true; + } + + this.uploading = true; + this.dispatch('uploading', files); + m.redraw(); // Forcing a redraw so that the button also updates if uploadFiles() is called from DragAndDrop or PasteClipboard + + var body = new FormData(); + + for (var i = 0; i < files.length; i++) { + body.append('files[]', files[i]); + } // send a POST request to the api + + + return app.request({ + method: 'POST', + url: app.forum.attribute('apiUrl') + '/fof/upload', + // prevent JSON.stringify'ing the form data in the XHR call + serialize: function serialize(raw) { + return raw; + }, + body: body + }).then(function (result) { + return _this.uploaded(result, addBBcode); + })["catch"](function (error) { + _this.uploading = false; + m.redraw(); + throw error; + }); + }; + + _proto.uploaded = function uploaded(result, addBBcode) { + var _this2 = this; + + if (addBBcode === void 0) { + addBBcode = false; + } + + this.uploading = false; + result.data.forEach(function (file) { + var fileObj = app.store.pushObject(file); // Add file to media manager + + app.fileListState.addToList(fileObj); // Dispatch + + _this2.dispatch('success', { + file: fileObj, + addBBcode: addBBcode + }); + }); + this.dispatch('uploaded'); + }; + + return Uploader; +}(); + + + +/***/ }), + +/***/ "./src/forum/index.js": +/*!****************************!*\ + !*** ./src/forum/index.js ***! + \****************************/ +/*! exports provided: components */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/app */ "flarum/app"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_app__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _common_models_File__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/models/File */ "./src/common/models/File.js"); +/* harmony import */ var _states_FileListState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./states/FileListState */ "./src/forum/states/FileListState.js"); +/* harmony import */ var _downloadButtonInteraction__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./downloadButtonInteraction */ "./src/forum/downloadButtonInteraction.js"); +/* harmony import */ var _addUploadButton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./addUploadButton */ "./src/forum/addUploadButton.js"); +/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components */ "./src/forum/components/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "components", function() { return _components__WEBPACK_IMPORTED_MODULE_5__["components"]; }); + + + + + + + +flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.initializers.add('fof-upload', function () { + Object(_addUploadButton__WEBPACK_IMPORTED_MODULE_4__["default"])(); + Object(_downloadButtonInteraction__WEBPACK_IMPORTED_MODULE_3__["default"])(); // File model + + flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.store.models.files = _common_models_File__WEBPACK_IMPORTED_MODULE_1__["default"]; // File list state + + flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.fileListState = new _states_FileListState__WEBPACK_IMPORTED_MODULE_2__["default"](); +}); + +/***/ }), + +/***/ "./src/forum/states/FileListState.js": +/*!*******************************************!*\ + !*** ./src/forum/states/FileListState.js ***! + \*******************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return FileListState; }); +var FileListState = /*#__PURE__*/function () { + function FileListState() { + this.user = null; + this.files = []; + this.moreResults = false; + this.loading = false; + } + /** + * Set user and load list + * + * @param user A user to populate the media manager + */ + + + var _proto = FileListState.prototype; + + _proto.setUser = function setUser(user) { + // Keep previous state + if (user === this.user) return; // Set user + + this.user = user; // Reset file list + + this.files = []; // Load user files + + this.loadResults(); + } + /** + * Load more user files + * + * @param offset The index to start the page at. + */ + ; + + _proto.loadResults = function loadResults(offset) { + if (offset === void 0) { + offset = 0; + } + + if (!this.user) return; + this.loading = true; + return app.store.find('fof/uploads', { + filter: { + user: this.user.id() + }, + page: { + offset: offset + } + }).then(this.parseResults.bind(this)); + } + /** + * Load the next page of discussion results. + */ + ; + + _proto.loadMore = function loadMore() { + this.loading = true; + this.loadResults(this.files.length).then(this.parseResults.bind(this)); + } + /** + * Parse results and append them to the file list. + */ + ; + + _proto.parseResults = function parseResults(results) { + var _this$files; + + (_this$files = this.files).push.apply(_this$files, results); + + this.loading = false; + this.moreResults = !!results.payload.links && !!results.payload.links.next; + m.redraw(); + return results; + } + /** + * Add files to the beginning of the list + */ + ; + + _proto.addToList = function addToList(files) { + if (Array.isArray(files)) { + var _this$files2; + + (_this$files2 = this.files).unshift.apply(_this$files2, files); + } else { + this.files.unshift(files); + } + } + /** + * Are there any files in the list? + */ + ; + + _proto.hasFiles = function hasFiles() { + return this.files.length > 0; + } + /** + * Is the file list loading? + */ + ; + + _proto.isLoading = function isLoading() { + return this.loading; + } + /** + * Does this user has more files? + */ + ; + + _proto.hasMoreResults = function hasMoreResults() { + return this.moreResults; + } + /** + * Does this user have any files? + */ + ; + + _proto.empty = function empty() { + return !this.hasFiles() && !this.isLoading(); + }; + + return FileListState; +}(); + + + +/***/ }), + +/***/ "flarum/Component": +/*!**************************************************!*\ + !*** external "flarum.core.compat['Component']" ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['Component']; + +/***/ }), + +/***/ "flarum/Model": +/*!**********************************************!*\ + !*** external "flarum.core.compat['Model']" ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['Model']; + +/***/ }), + +/***/ "flarum/app": +/*!********************************************!*\ + !*** external "flarum.core.compat['app']" ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['app']; + +/***/ }), + +/***/ "flarum/components/Button": +/*!**********************************************************!*\ + !*** external "flarum.core.compat['components/Button']" ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/Button']; + +/***/ }), + +/***/ "flarum/components/LoadingIndicator": +/*!********************************************************************!*\ + !*** external "flarum.core.compat['components/LoadingIndicator']" ***! + \********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/LoadingIndicator']; + +/***/ }), + +/***/ "flarum/components/Modal": +/*!*********************************************************!*\ + !*** external "flarum.core.compat['components/Modal']" ***! + \*********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/Modal']; + +/***/ }), + +/***/ "flarum/components/Post": +/*!********************************************************!*\ + !*** external "flarum.core.compat['components/Post']" ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/Post']; + +/***/ }), + +/***/ "flarum/components/TextEditor": +/*!**************************************************************!*\ + !*** external "flarum.core.compat['components/TextEditor']" ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/TextEditor']; + +/***/ }), + +/***/ "flarum/extend": +/*!***********************************************!*\ + !*** external "flarum.core.compat['extend']" ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['extend']; + +/***/ }), + +/***/ "flarum/utils/classList": +/*!********************************************************!*\ + !*** external "flarum.core.compat['utils/classList']" ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['utils/classList']; + +/***/ }), + +/***/ "flarum/utils/mixin": +/*!****************************************************!*\ + !*** external "flarum.core.compat['utils/mixin']" ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['utils/mixin']; + +/***/ }) + +/******/ }); //# 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 a802f91d..fa2b3d3c 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['app']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['helpers/icon']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","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/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","_inheritsLoose","subClass","superClass","constructor","__proto__","UploadButton","oninit","vnode","this","attrs","uploader","on","$","reset","redraw","view","buttonText","uploading","app","translator","trans","className","onclick","uploadButtonClicked","LoadingIndicator","component","size","icon","type","multiple","onchange","process","e","files","prop","length","upload","click","Component","DragAndDrop","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","isDropping","over","div","document","createElement","window","unload","removeEventListener","isNotFile","event","dataTransfer","items","kind","preventDefault","classList","add","remove","PasteClipboard","textAreaElement","paste","clipboardData","indexOf","push","getAsFile","Uploader","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","url","forum","attribute","serialize","raw","then","error","file","initializers","extend","TextEditor","f_","image","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","parents","Post","unbind","stopPropagation","currentTarget","dataset","fofUploadDownloadUuid","post","id","session","csrfToken","open","alert"],"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,EAAI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BkH,EAAYnD,YAKhB,IAAIW,GAAe,SAAC9B,GAAD,OAAW,EAAKvB,SAAS0B,OAAOH,KAAQzB,KAAKI,EAAE,YAAY,QC/ClFiF,iBAAOY,IAAKhH,UAAW,YAAY,WAAY,WAC3Ce,KAAKI,EAAE,mCACF8F,OAAO,SACP/F,GAAG,SAAS,SAACqB,GAIV,GAHAA,EAAE2B,iBACF3B,EAAE2E,kBAEGzF,IAAImE,MAAMC,UAAU,0BAAzB,CAKA,IAAIF,EAAMlE,IAAImE,MAAMC,UAAU,UAAY,gBAE1CF,GAAO,IAAMpD,EAAE4E,cAAcC,QAAQC,sBACrC1B,GAAO,IAAM,EAAK3E,MAAMsG,KAAKC,KAC7B5B,GAAO,IAAMlE,IAAI+F,QAAQC,UAEzB/D,OAAOgE,KAAK/B,QAVRgC,MAAMlG,IAAIC,WAAWC,MAAM","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 = 18);\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['extend'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['helpers/icon'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport icon from 'flarum/helpers/icon';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\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\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.attach');\n\n return m(\n 'button.Button.hasIcon.fof-upload-button.Button--icon',\n {\n className: this.attrs.uploader.uploading ? 'uploading' : '',\n onclick: this.uploadButtonClicked.bind(this),\n },\n [\n this.attrs.uploader.uploading\n ? LoadingIndicator.component({\n size: 'tiny',\n className: 'LoadingIndicator--inline Button-icon',\n })\n : icon('fas fa-file-upload', { className: 'Button-icon' }),\n m('span.Button-label', buttonText),\n m('form', [\n m('input', {\n type: 'file',\n multiple: true,\n onchange: this.process.bind(this),\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);\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 this.isDropping = this.over = false;\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 if (!this.isDropping) {\n this.isDropping = true;\n this.composerElement.classList.add('fof-upload-dropping');\n\n this.upload(event.dataTransfer.files, () => {\n this.composerElement.classList.remove('fof-upload-dropping');\n this.isDropping = false;\n });\n }\n }\n}\n","export default class PasteClipboard {\n constructor(upload, textAreaElement) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\n // and need to stay as long as the textarea exists in the DOM\n textAreaElement.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","export 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) {\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(this.uploaded.bind(this))\n .catch((error) => {\n this.uploading = false;\n m.redraw();\n\n throw error;\n });\n }\n\n uploaded(files) {\n this.uploading = false;\n\n files.forEach((file) => this.dispatch('success', file));\n\n this.dispatch('uploaded');\n }\n}\n","import app from 'flarum/app';\n\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\n\napp.initializers.add('fof-upload', () => {\n addUploadButton();\n downloadButtonInteraction();\n});\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport TextEditor from 'flarum/components/TextEditor';\nimport UploadButton from './components/UploadButton';\nimport DragAndDrop from './components/DragAndDrop';\nimport PasteClipboard from './components/PasteClipboard';\nimport Uploader from './handler/Uploader';\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 items.add(\n 'fof-upload',\n UploadButton.component({\n uploader: this.uploader,\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', (image) => {\n this.attrs.composer.editor.insertAtCursor(image + '\\n');\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 const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n const unloadHandler = () => {\n dragAndDrop.unload();\n };\n\n this.$('textarea').bind('onunload', unloadHandler);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\n });\n}\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport Post from 'flarum/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/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","selectFile","Component","oninit","selectedFiles","multiSelect","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","setUser","session","inModal","restrictFileType","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","hasMoreResults","loadMore","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","open","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","unshift","hasFiles"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA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D,IAAoB,CAAC,KAAKjG,SAAL,EAA5B;AACH,G;;;;;;;;;;;;;;;;AC9GL,iD;;;;;;;;;;;ACAA,6C;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,mE;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,8C;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,mD","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\r\n switch(file.tag()) {\r\n // File\r\n case \"file\":\r\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\r\n\r\n // Image template\r\n case \"image\":\r\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\r\n\r\n // Image preview\r\n case \"image-preview\":\r\n return `[upl-image-preview url=${file.url()}]`;\r\n\r\n // 'just-url' or unknown\r\n default:\r\n return file.url();\r\n }\r\n}","const image = [\"image/png\", \"image/jpg\", \"image/jpeg\", \"image/svg+xml\"];\r\nconst archive = [\"application/zip\", \"application/x-7z-compressed\", \"application/gzip\", \"application/vnd.rar\", \"application/x-rar-compressed\"];\r\nconst code = [\"text/html\", \"text/css\", \"text/javascript\", \"application/json\", \"application/ld+json\", \"text/javascript\", \"application/x-httpd-php\"];\r\nconst word = [\"application/x-abiword\", \"application/msword\", \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"];\r\n\r\nexport default function mimeToIcon(fileType) {\r\n // Display image (do not display for)\r\n if(image.indexOf(fileType) >= 0) {\r\n return 'image';\r\n }\r\n // Display image icon for other types\r\n else if(fileType.includes(\"image/\")) {\r\n return 'far fa-file-image';\r\n }\r\n // Video icon\r\n else if(fileType.includes(\"video/\")) {\r\n return 'far fa-file-video';\r\n }\r\n // Archive icon\r\n else if(archive.indexOf(fileType) >= 0) {\r\n return 'far fa-file-archive';\r\n }\r\n // PDF icon\r\n else if(fileType === \"application/pdf\") {\r\n return 'far fa-file-pdf';\r\n }\r\n // Word\r\n else if(word.indexOf(fileType) >= 0) {\r\n return 'far fa-file-word';\r\n }\r\n // Audio icon\r\n else if(fileType.includes(\"audio/\")) {\r\n return 'far fa-file-audio';\r\n }\r\n // Code files\r\n else if(code.indexOf(fileType) >= 0) {\r\n return 'far fa-file-code';\r\n }\r\n \r\n return 'far fa-file';\r\n}","import Model from \"flarum/Model\";\r\nimport mixin from \"flarum/utils/mixin\";\r\nimport fileToBBcode from \"../fileToBBcode\";\r\n\r\nexport default class File extends mixin(Model, {\r\n baseName: Model.attribute(\"baseName\"),\r\n path: Model.attribute(\"path\"),\r\n url: Model.attribute(\"url\"),\r\n type: Model.attribute(\"type\"),\r\n size: Model.attribute(\"size\"),\r\n humanSize: Model.attribute(\"humanSize\"),\r\n createdAt: Model.attribute(\"createdAt\"),\r\n uuid: Model.attribute(\"uuid\"),\r\n tag: Model.attribute(\"tag\"),\r\n}) {\r\n /**\r\n * Use FoF Uploads endpoint\r\n */\r\n apiEndpoint() {\r\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\r\n }\r\n\r\n /**\r\n * Generate bbcode for this file\r\n */\r\n bbcode() {\r\n return fileToBBcode(this);\r\n }\r\n}\r\n","import app from 'flarum/app';\r\nimport { extend } from 'flarum/extend';\r\nimport TextEditor from 'flarum/components/TextEditor';\r\nimport UploadButton from './components/UploadButton';\r\nimport DragAndDrop from './components/DragAndDrop';\r\nimport PasteClipboard from './components/PasteClipboard';\r\nimport Uploader from './handler/Uploader';\r\nimport FileManagerButton from './components/FileManagerButton';\r\n\r\nexport default function () {\r\n extend(TextEditor.prototype, 'oninit', function () {\r\n this.uploader = new Uploader();\r\n });\r\n extend(TextEditor.prototype, 'controlItems', function (items) {\r\n if (!app.forum.attribute('fof-upload.canUpload')) return;\r\n\r\n // Add media button\r\n items.add(\r\n 'fof-upload-media',\r\n FileManagerButton.component({\r\n uploader: this.uploader,\r\n })\r\n );\r\n\r\n // Add upload button\r\n items.add(\r\n 'fof-upload',\r\n UploadButton.component({\r\n uploader: this.uploader,\r\n })\r\n );\r\n });\r\n\r\n extend(TextEditor.prototype, 'oncreate', function (f_, vnode) {\r\n if (!app.forum.attribute('fof-upload.canUpload')) return;\r\n\r\n this.uploader.on('success', ({ file, addBBcode }) => {\r\n if(!addBBcode) return;\r\n\r\n this.attrs.composer.editor.insertAtCursor(file.bbcode() + '\\n');\r\n\r\n // We wrap this in a typeof check to prevent it running when a user\r\n // is creating a new discussion. There's nothing to preview in a new\r\n // discussion, so the `preview` function isn't defined.\r\n if (typeof this.attrs.preview === 'function') {\r\n // Scroll the preview into view\r\n // preview() causes the composer to close on mobile, but we don't want that. We want only the scroll\r\n // We work around that by temporarily patching the isFullScreen method\r\n const originalIsFullScreen = app.composer.isFullScreen;\r\n\r\n app.composer.isFullScreen = () => false;\r\n\r\n this.attrs.preview();\r\n\r\n app.composer.isFullScreen = originalIsFullScreen;\r\n }\r\n });\r\n\r\n const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\r\n\r\n const unloadHandler = () => {\r\n dragAndDrop.unload();\r\n };\r\n\r\n this.$('textarea').bind('onunload', unloadHandler);\r\n\r\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\r\n });\r\n}\r\n","export default class DragAndDrop {\r\n constructor(upload, composerElement) {\r\n this.upload = upload;\r\n this.composerElement = composerElement;\r\n\r\n // Keep references to the bound methods so we can remove the event listeners later\r\n this.handlers = {};\r\n\r\n if (!this.supportsFileDragging()) {\r\n return;\r\n }\r\n\r\n this.composerElement.addEventListener('dragover', (this.handlers.in = this.in.bind(this)));\r\n\r\n this.composerElement.addEventListener('dragleave', (this.handlers.out = this.out.bind(this)));\r\n this.composerElement.addEventListener('dragend', this.handlers.out);\r\n\r\n this.composerElement.addEventListener('drop', (this.handlers.dropping = this.dropping.bind(this)));\r\n }\r\n\r\n supportsFileDragging() {\r\n // Based on https://css-tricks.com/drag-and-drop-file-uploading/\r\n const div = document.createElement('div');\r\n\r\n return ('draggable' in div || ('ondragstart' in div && 'ondrop' in div)) && 'FormData' in window && 'FileReader' in window;\r\n }\r\n\r\n unload() {\r\n // If the handlers were not set (drag and drop not supported), we skip removing them\r\n if (!this.handlers.in) {\r\n return;\r\n }\r\n\r\n this.composerElement.removeEventListener('dragover', this.handlers.in);\r\n\r\n this.composerElement.removeEventListener('dragleave', this.handlers.out);\r\n this.composerElement.removeEventListener('dragend', this.handlers.out);\r\n\r\n this.composerElement.removeEventListener('drop', this.handlers.dropping);\r\n }\r\n\r\n isNotFile(event) {\r\n // Checking event.dataTransfer.files.length does not work on dragover event, it's always zero\r\n // So we use the dataTransfer.items property to check whether any file is being dragged\r\n if (event.dataTransfer.items) {\r\n for (let i = 0; i < event.dataTransfer.items.length; i++) {\r\n if (event.dataTransfer.items[i].kind !== 'file') {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n in(event) {\r\n if (this.isNotFile(event)) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n if (!this.over) {\r\n this.composerElement.classList.add('fof-upload-dragging');\r\n this.over = true;\r\n }\r\n }\r\n\r\n out(event) {\r\n if (this.isNotFile(event)) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n if (this.over) {\r\n this.composerElement.classList.remove('fof-upload-dragging');\r\n this.over = false;\r\n }\r\n }\r\n\r\n dropping(event) {\r\n if (this.isNotFile(event)) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n this.upload(event.dataTransfer.files);\r\n\r\n this.composerElement.classList.remove('fof-upload-dragging');\r\n }\r\n}\r\n","import app from 'flarum/app';\r\nimport Component from 'flarum/Component';\r\nimport Button from 'flarum/components/Button';\r\nimport FileManagerModal from './FileManagerModal';\r\n\r\nexport default class FileManagerButton extends Component {\r\n view() {\r\n return Button.component({\r\n className: \"Button fof-upload-button Button--icon\",\r\n onclick: this.fileManagerButtonClicked.bind(this),\r\n icon: 'fas fa-photo-video',\r\n title: app.translator.trans('fof-upload.forum.buttons.media')\r\n });\r\n }\r\n\r\n /**\r\n * Show tooltip on hover\r\n * \r\n * @param {*} vnode \r\n */\r\n oncreate(vnode) {\r\n super.oncreate(vnode);\r\n \r\n // Add tooltip\r\n this.$().tooltip();\r\n }\r\n\r\n /**\r\n * Event handler for upload button being clicked\r\n *\r\n * @param {PointerEvent} e\r\n */\r\n fileManagerButtonClicked(e) {\r\n e.preventDefault();\r\n\r\n // Open dialog\r\n app.modal.show(FileManagerModal, {\r\n selectFile: true,\r\n uploader: this.attrs.uploader\r\n });\r\n }\r\n}\r\n","import Modal from \"flarum/components/Modal\";\r\nimport Button from \"flarum/components/Button\";\r\nimport UploadButton from \"./UploadButton\";\r\nimport UserFileList from \"./UserFileList\";\r\nimport DragAndDrop from \"./DragAndDrop\";\r\n\r\nexport default class FileManagerModal extends Modal {\r\n oninit(vnode) {\r\n super.oninit(vnode);\r\n\r\n // Initialize upload managers\r\n this.uploader = vnode.attrs.uploader;\r\n\r\n // Current selected files\r\n this.selectedFiles = [];\r\n\r\n // Allow multiselect\r\n this.multiSelect = vnode.attrs.multiSelect || false;\r\n\r\n // Drag & drop\r\n this.dragDrop = null;\r\n\r\n // Initialize uploads\r\n this.onUpload();\r\n }\r\n\r\n className() {\r\n return \"Modal--large fof-file-manager-modal\";\r\n }\r\n\r\n /**\r\n * Initialize drag & drop\r\n */\r\n oncreate(vnode) {\r\n super.oncreate(vnode);\r\n\r\n this.dragDrop = new DragAndDrop((files) => this.uploader.upload(files, false), this.$().find(\".Modal-content\")[0]);\r\n }\r\n\r\n /**\r\n * Remove events from modal content\r\n */\r\n onremove() {\r\n if(this.dragDrop) {\r\n this.dragDrop.unload();\r\n }\r\n }\r\n\r\n view() {\r\n return (\r\n
\r\n
\r\n
\r\n {UploadButton.component({\r\n uploader: this.uploader,\r\n disabled: app.fileListState.isLoading(),\r\n isMediaUploadButton: true\r\n })}\r\n
\r\n\r\n
\r\n
\r\n \r\n\r\n {app.translator.trans(\"fof-upload.forum.file_list.release_to_upload\")}\r\n
\r\n
\r\n \r\n
\r\n

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

\r\n
\r\n\r\n {this.alertAttrs ?
{Alert.component(this.alertAttrs)}
: ''}\r\n\r\n
\r\n {UserFileList.component({\r\n user: this.attrs.user,\r\n selectable: true,\r\n onFileSelect: this.onFileSelect.bind(this),\r\n selectedFiles: this.selectedFiles\r\n })}\r\n
\r\n\r\n
\r\n {Button.component({\r\n onclick: this.hide.bind(this),\r\n className: 'Button',\r\n }, app.translator.trans(\"fof-upload.forum.buttons.cancel\"))}\r\n\r\n {Button.component({\r\n onclick: this.onSelect.bind(this),\r\n disabled: this.selectedFiles.length === 0 || !this.multiSelect && this.selectedFiles.length > 1,\r\n className: 'Button Button--primary',\r\n }, app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length))}\r\n
\r\n
\r\n
\r\n );\r\n }\r\n\r\n /**\r\n * Add or remove file from selected files\r\n * \r\n * @param {File} file \r\n */\r\n onFileSelect(file) {\r\n const itemPosition = this.selectedFiles.indexOf(file.id());\r\n\r\n if(itemPosition >= 0) {\r\n this.selectedFiles.splice(itemPosition, 1);\r\n }else{\r\n if(this.multiSelect) {\r\n this.selectedFiles.push(file.id());\r\n }else{\r\n this.selectedFiles = [file.id()];\r\n }\r\n }\r\n }\r\n \r\n /**\r\n * Add files to file list after upload\r\n */\r\n onUpload() {\r\n this.uploader.on('success', ({ file }) => {\r\n if(this.multiSelect) {\r\n this.selectedFiles.push(file.id());\r\n }else{\r\n this.selectedFiles = [file.id()];\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Add selected files to the composer\r\n */\r\n onSelect() {\r\n this.hide();\r\n\r\n // Custom callback\r\n if(this.attrs.onSelect) {\r\n this.attrs.onSelect(this.selectedFiles);\r\n\r\n return;\r\n }\r\n \r\n // Add selected files to composer\r\n this.selectedFiles.map((fileId) => {\r\n const file = app.store.getById(\"files\", fileId);\r\n\r\n app.composer.editor.insertAtCursor(file.bbcode() + '\\n')\r\n });\r\n }\r\n}","export default class PasteClipboard {\r\n constructor(upload, textAreaElement) {\r\n this.upload = upload;\r\n\r\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\r\n // and need to stay as long as the textarea exists in the DOM\r\n textAreaElement.addEventListener('paste', this.paste.bind(this));\r\n }\r\n\r\n paste(e) {\r\n if (e.clipboardData && e.clipboardData.items) {\r\n const items = e.clipboardData.items;\r\n\r\n const files = [];\r\n\r\n for (let i = 0; i < items.length; i++) {\r\n if (items[i].type.indexOf('image') !== -1) {\r\n files.push(items[i].getAsFile());\r\n }\r\n }\r\n\r\n if (files.length > 0) {\r\n e.preventDefault();\r\n\r\n this.upload(files);\r\n }\r\n }\r\n }\r\n}\r\n","import app from 'flarum/app';\r\nimport Component from 'flarum/Component';\r\nimport classList from 'flarum/utils/classList';\r\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\r\nimport Button from 'flarum/components/Button';\r\n\r\nexport default class UploadButton extends Component {\r\n oninit(vnode) {\r\n super.oninit(vnode);\r\n\r\n this.attrs.uploader.on('uploaded', () => {\r\n // reset the button for a new upload\r\n this.$('form')[0].reset();\r\n\r\n // redraw to reflect uploader.loading in the DOM\r\n m.redraw();\r\n });\r\n\r\n this.isMediaUploadButton = vnode.attrs.isMediaUploadButton || false;\r\n }\r\n\r\n oncreate(vnode) {\r\n super.oncreate(vnode);\r\n \r\n // Add tooltip\r\n if(!this.isMediaUploadButton) {\r\n this.$().tooltip();\r\n }\r\n }\r\n\r\n view() {\r\n const buttonText = this.attrs.uploader.uploading\r\n ? app.translator.trans('fof-upload.forum.states.loading')\r\n : app.translator.trans('fof-upload.forum.buttons.upload');\r\n\r\n return Button.component({\r\n className: classList([\"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\"]),\r\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\r\n onclick: this.uploadButtonClicked.bind(this),\r\n title: !this.isMediaUploadButton ? buttonText : null,\r\n disabled: this.attrs.disabled\r\n }, [\r\n this.attrs.uploader.uploading && LoadingIndicator.component({\r\n size: 'tiny',\r\n className: 'LoadingIndicator--inline Button-icon',\r\n }),\r\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\r\n
\r\n \r\n
\r\n ]);\r\n }\r\n\r\n /**\r\n * Process the upload event.\r\n *\r\n * @param e\r\n */\r\n process(e) {\r\n // get the file from the input field\r\n const files = this.$('input').prop('files');\r\n\r\n if (files.length === 0) {\r\n // We've got no files to upload, so trying\r\n // to begin an upload will show an error\r\n // to the user.\r\n return;\r\n }\r\n\r\n this.attrs.uploader.upload(files, !this.isMediaUploadButton);\r\n }\r\n\r\n /**\r\n * Event handler for upload button being clicked\r\n *\r\n * @param {PointerEvent} e\r\n */\r\n uploadButtonClicked(e) {\r\n // Trigger click on hidden input element\r\n // (Opens file dialog)\r\n this.$('input').click();\r\n }\r\n}\r\n","import Component from \"flarum/Component\";\r\nimport Button from \"flarum/components/Button\";\r\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\r\nimport mimeToIcon from \"../../common/mimeToIcon\";\r\n\r\nexport default class UserFileList extends Component{\r\n oninit(vnode) {\r\n super.oninit(vnode);\r\n\r\n // Load file list\r\n app.fileListState.setUser(vnode.attrs.user || app.session.user);\r\n\r\n this.inModal = vnode.attrs.selectable;\r\n\r\n this.restrictFileType = vnode.attrs.restrictFileType || null;\r\n }\r\n\r\n view() {\r\n const state = app.fileListState;\r\n \r\n return (\r\n
\r\n {/* Loading */}\r\n {state.isLoading() && state.files.length === 0 && (\r\n
\r\n {app.translator.trans(\"fof-upload.forum.file_list.loading\")}\r\n \r\n \r\n
\r\n )}\r\n \r\n {/* Empty personal file list */}\r\n {this.inModal && state.empty() && (\r\n

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

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

\r\n {app.translator.trans(\"fof-upload.forum.file_list.empty\")}\r\n

\r\n )}\r\n\r\n {/* File list */}\r\n
    \r\n {state.files.map(file => {\r\n let fileClassNames = \"fof-file\";\r\n const fileIcon = mimeToIcon(file.type());\r\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\r\n\r\n // File is image\r\n if(fileIcon === \"image\") {\r\n fileClassNames += \" fof-file-type-image\";\r\n }\r\n\r\n // File is selected\r\n if(this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\r\n fileClassNames += \" fof-file-selected\";\r\n }\r\n\r\n return (\r\n
  • \r\n \r\n
  • \r\n )\r\n })}\r\n
\r\n\r\n {/* Load more files */}\r\n {state.hasMoreResults() && (\r\n
\r\n \r\n
\r\n )}\r\n
\r\n );\r\n }\r\n\r\n /**\r\n * Check if a file is selectable \r\n * \r\n * @param {File} file \r\n */\r\n isSelectable(file) {\r\n const fileType = file.type();\r\n\r\n // Custom defined file types\r\n if(Array.isArray(this.restrictFileType)) {\r\n return this.restrictFileType.indexOf(fileType) >= 0;\r\n }\r\n\r\n // Image\r\n else if(this.restrictFileType === 'image') {\r\n return fileType.includes(\"image/\");\r\n }\r\n\r\n // Audio\r\n else if(this.restrictFileType === 'audio') {\r\n return fileType.includes(\"audio/\");\r\n }\r\n\r\n // Video\r\n else if(this.restrictFileType === 'video') {\r\n return fileType.includes(\"video/\");\r\n }\r\n\r\n return false;\r\n }\r\n}","import Uploader from \"../handler/Uploader\";\r\nimport DragAndDrop from \"./DragAndDrop\";\r\nimport FileManagerButton from \"./FileManagerButton\";\r\nimport FileManagerModal from \"./FileManagerModal\";\r\nimport UserFileList from \"./UserFileList\";\r\n\r\nexport const components = {\r\n DragAndDrop,\r\n FileManagerButton,\r\n FileManagerModal,\r\n UserFileList,\r\n Uploader\r\n};\r\n","import app from 'flarum/app';\r\nimport { extend } from 'flarum/extend';\r\nimport Post from 'flarum/components/Post';\r\n\r\n/* global $ */\r\n\r\nexport default function () {\r\n extend(Post.prototype, 'oncreate', function () {\r\n this.$('[data-fof-upload-download-uuid]')\r\n .unbind('click')\r\n .on('click', (e) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n if (!app.forum.attribute('fof-upload.canDownload')) {\r\n alert(app.translator.trans('fof-upload.forum.states.unauthorized'));\r\n return;\r\n }\r\n\r\n let url = app.forum.attribute('apiUrl') + '/fof/download';\r\n\r\n url += '/' + e.currentTarget.dataset.fofUploadDownloadUuid;\r\n url += '/' + this.attrs.post.id();\r\n url += '/' + app.session.csrfToken;\r\n\r\n window.open(url);\r\n });\r\n });\r\n}\r\n","export default class Uploader {\r\n constructor() {\r\n this.callbacks = {\r\n success: [],\r\n failure: [],\r\n uploading: [],\r\n uploaded: [],\r\n };\r\n this.uploading = false;\r\n }\r\n\r\n on(type, callback) {\r\n this.callbacks[type].push(callback);\r\n }\r\n\r\n dispatch(type, response) {\r\n this.callbacks[type].forEach((callback) => callback(response));\r\n }\r\n\r\n upload(files, addBBcode = true) {\r\n this.uploading = true;\r\n this.dispatch('uploading', files);\r\n\r\n m.redraw(); // Forcing a redraw so that the button also updates if uploadFiles() is called from DragAndDrop or PasteClipboard\r\n\r\n const body = new FormData();\r\n\r\n for (let i = 0; i < files.length; i++) {\r\n body.append('files[]', files[i]);\r\n }\r\n\r\n // send a POST request to the api\r\n return app\r\n .request({\r\n method: 'POST',\r\n url: app.forum.attribute('apiUrl') + '/fof/upload',\r\n // prevent JSON.stringify'ing the form data in the XHR call\r\n serialize: (raw) => raw,\r\n body,\r\n })\r\n .then((result) => this.uploaded(result, addBBcode))\r\n .catch((error) => {\r\n this.uploading = false;\r\n m.redraw();\r\n\r\n throw error;\r\n });\r\n }\r\n\r\n uploaded(result, addBBcode = false) {\r\n this.uploading = false;\r\n\r\n result.data.forEach((file) => {\r\n const fileObj = app.store.pushObject(file);\r\n\r\n // Add file to media manager\r\n app.fileListState.addToList(fileObj);\r\n\r\n // Dispatch\r\n this.dispatch('success', {\r\n file: fileObj,\r\n addBBcode\r\n });\r\n });\r\n\r\n this.dispatch('uploaded');\r\n }\r\n}\r\n","import app from 'flarum/app';\r\n\r\nimport File from '../common/models/File';\r\nimport FileListState from './states/FileListState';\r\nimport downloadButtonInteraction from './downloadButtonInteraction';\r\nimport addUploadButton from './addUploadButton';\r\n\r\nexport * from './components';\r\n\r\napp.initializers.add('fof-upload', () => {\r\n addUploadButton();\r\n downloadButtonInteraction();\r\n\r\n // File model\r\n app.store.models.files = File;\r\n\r\n // File list state\r\n app.fileListState = new FileListState();\r\n});\r\n","export default class FileListState {\r\n constructor() {\r\n this.user = null;\r\n\r\n this.files = [];\r\n \r\n this.moreResults = false;\r\n \r\n this.loading = false;\r\n }\r\n\r\n /**\r\n * Set user and load list\r\n *\r\n * @param user A user to populate the media manager\r\n */\r\n setUser(user) {\r\n // Keep previous state\r\n if(user === this.user) return;\r\n\r\n // Set user\r\n this.user = user;\r\n\r\n // Reset file list\r\n this.files = [];\r\n\r\n // Load user files\r\n this.loadResults();\r\n }\r\n\r\n /**\r\n * Load more user files\r\n *\r\n * @param offset The index to start the page at.\r\n */\r\n loadResults(offset = 0) {\r\n if(!this.user) return;\r\n\r\n this.loading = true;\r\n\r\n return app.store.find('fof/uploads', {\r\n filter: {\r\n user: this.user.id()\r\n },\r\n page: {\r\n offset\r\n }\r\n }).then(this.parseResults.bind(this));\r\n }\r\n\r\n /**\r\n * Load the next page of discussion results.\r\n */\r\n loadMore() {\r\n this.loading = true;\r\n \r\n this.loadResults(this.files.length).then(this.parseResults.bind(this));\r\n }\r\n\r\n /**\r\n * Parse results and append them to the file list.\r\n */\r\n parseResults(results) {\r\n this.files.push(...results);\r\n\r\n this.loading = false;\r\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\r\n\r\n m.redraw();\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * Add files to the beginning of the list\r\n */\r\n addToList(files) {\r\n if(Array.isArray(files)) {\r\n this.files.unshift(...files);\r\n }else{\r\n this.files.unshift(files);\r\n }\r\n }\r\n \r\n /**\r\n * Are there any files in the list?\r\n */\r\n hasFiles() {\r\n return this.files.length > 0;\r\n }\r\n\r\n /**\r\n * Is the file list loading?\r\n */\r\n isLoading() {\r\n return this.loading;\r\n }\r\n\r\n /**\r\n * Does this user has more files?\r\n */\r\n hasMoreResults() {\r\n return this.moreResults;\r\n }\r\n\r\n /**\r\n * Does this user have any files?\r\n */\r\n empty() {\r\n return !this.hasFiles() && !this.isLoading();\r\n }\r\n} ","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/common/fileToBBcode.js b/js/src/common/fileToBBcode.js new file mode 100644 index 00000000..742064e8 --- /dev/null +++ b/js/src/common/fileToBBcode.js @@ -0,0 +1,19 @@ +export default function fileToBBcode(file) { + switch(file.tag()) { + // File + case "file": + return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`; + + // Image template + case "image": + return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`; + + // Image preview + case "image-preview": + return `[upl-image-preview url=${file.url()}]`; + + // 'just-url' or unknown + default: + return file.url(); + } +} \ No newline at end of file diff --git a/js/src/common/mimeToIcon.js b/js/src/common/mimeToIcon.js new file mode 100644 index 00000000..85d8058a --- /dev/null +++ b/js/src/common/mimeToIcon.js @@ -0,0 +1,41 @@ +const image = ["image/png", "image/jpg", "image/jpeg", "image/svg+xml"]; +const archive = ["application/zip", "application/x-7z-compressed", "application/gzip", "application/vnd.rar", "application/x-rar-compressed"]; +const code = ["text/html", "text/css", "text/javascript", "application/json", "application/ld+json", "text/javascript", "application/x-httpd-php"]; +const word = ["application/x-abiword", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]; + +export default function mimeToIcon(fileType) { + // Display image (do not display for) + if(image.indexOf(fileType) >= 0) { + return 'image'; + } + // Display image icon for other types + else if(fileType.includes("image/")) { + return 'far fa-file-image'; + } + // Video icon + else if(fileType.includes("video/")) { + return 'far fa-file-video'; + } + // Archive icon + else if(archive.indexOf(fileType) >= 0) { + return 'far fa-file-archive'; + } + // PDF icon + else if(fileType === "application/pdf") { + return 'far fa-file-pdf'; + } + // Word + else if(word.indexOf(fileType) >= 0) { + return 'far fa-file-word'; + } + // Audio icon + else if(fileType.includes("audio/")) { + return 'far fa-file-audio'; + } + // Code files + else if(code.indexOf(fileType) >= 0) { + return 'far fa-file-code'; + } + + return 'far fa-file'; +} \ No newline at end of file diff --git a/js/src/common/models/File.js b/js/src/common/models/File.js new file mode 100644 index 00000000..07edf8d8 --- /dev/null +++ b/js/src/common/models/File.js @@ -0,0 +1,29 @@ +import Model from "flarum/Model"; +import mixin from "flarum/utils/mixin"; +import fileToBBcode from "../fileToBBcode"; + +export default class File extends mixin(Model, { + baseName: Model.attribute("baseName"), + path: Model.attribute("path"), + url: Model.attribute("url"), + type: Model.attribute("type"), + size: Model.attribute("size"), + humanSize: Model.attribute("humanSize"), + createdAt: Model.attribute("createdAt"), + uuid: Model.attribute("uuid"), + tag: Model.attribute("tag"), +}) { + /** + * Use FoF Uploads endpoint + */ + apiEndpoint() { + return '/fof/uploads' + (this.exists ? '/' + this.data.id : ''); + } + + /** + * Generate bbcode for this file + */ + bbcode() { + return fileToBBcode(this); + } +} diff --git a/js/src/forum/addUploadButton.js b/js/src/forum/addUploadButton.js index 7f489767..807c1991 100644 --- a/js/src/forum/addUploadButton.js +++ b/js/src/forum/addUploadButton.js @@ -5,6 +5,7 @@ import UploadButton from './components/UploadButton'; import DragAndDrop from './components/DragAndDrop'; import PasteClipboard from './components/PasteClipboard'; import Uploader from './handler/Uploader'; +import FileManagerButton from './components/FileManagerButton'; export default function () { extend(TextEditor.prototype, 'oninit', function () { @@ -13,6 +14,15 @@ export default function () { extend(TextEditor.prototype, 'controlItems', function (items) { if (!app.forum.attribute('fof-upload.canUpload')) return; + // Add media button + items.add( + 'fof-upload-media', + FileManagerButton.component({ + uploader: this.uploader, + }) + ); + + // Add upload button items.add( 'fof-upload', UploadButton.component({ @@ -24,8 +34,10 @@ export default function () { extend(TextEditor.prototype, 'oncreate', function (f_, vnode) { if (!app.forum.attribute('fof-upload.canUpload')) return; - this.uploader.on('success', (image) => { - this.attrs.composer.editor.insertAtCursor(image + '\n'); + this.uploader.on('success', ({ file, addBBcode }) => { + if(!addBBcode) return; + + this.attrs.composer.editor.insertAtCursor(file.bbcode() + '\n'); // We wrap this in a typeof check to prevent it running when a user // is creating a new discussion. There's nothing to preview in a new diff --git a/js/src/forum/components/DragAndDrop.js b/js/src/forum/components/DragAndDrop.js index 62bc0ad2..0544c7b3 100644 --- a/js/src/forum/components/DragAndDrop.js +++ b/js/src/forum/components/DragAndDrop.js @@ -16,8 +16,6 @@ export default class DragAndDrop { this.composerElement.addEventListener('dragend', this.handlers.out); this.composerElement.addEventListener('drop', (this.handlers.dropping = this.dropping.bind(this))); - - this.isDropping = this.over = false; } supportsFileDragging() { @@ -88,14 +86,8 @@ export default class DragAndDrop { event.preventDefault(); - if (!this.isDropping) { - this.isDropping = true; - this.composerElement.classList.add('fof-upload-dropping'); + this.upload(event.dataTransfer.files); - this.upload(event.dataTransfer.files, () => { - this.composerElement.classList.remove('fof-upload-dropping'); - this.isDropping = false; - }); - } + this.composerElement.classList.remove('fof-upload-dragging'); } } diff --git a/js/src/forum/components/FileManagerButton.js b/js/src/forum/components/FileManagerButton.js new file mode 100644 index 00000000..6327b8c8 --- /dev/null +++ b/js/src/forum/components/FileManagerButton.js @@ -0,0 +1,42 @@ +import app from 'flarum/app'; +import Component from 'flarum/Component'; +import Button from 'flarum/components/Button'; +import FileManagerModal from './FileManagerModal'; + +export default class FileManagerButton extends Component { + view() { + return Button.component({ + className: "Button fof-upload-button Button--icon", + onclick: this.fileManagerButtonClicked.bind(this), + icon: 'fas fa-photo-video', + title: app.translator.trans('fof-upload.forum.buttons.media') + }); + } + + /** + * Show tooltip on hover + * + * @param {*} vnode + */ + oncreate(vnode) { + super.oncreate(vnode); + + // Add tooltip + this.$().tooltip(); + } + + /** + * Event handler for upload button being clicked + * + * @param {PointerEvent} e + */ + fileManagerButtonClicked(e) { + e.preventDefault(); + + // Open dialog + app.modal.show(FileManagerModal, { + selectFile: true, + uploader: this.attrs.uploader + }); + } +} diff --git a/js/src/forum/components/FileManagerModal.js b/js/src/forum/components/FileManagerModal.js new file mode 100644 index 00000000..e5e2f688 --- /dev/null +++ b/js/src/forum/components/FileManagerModal.js @@ -0,0 +1,153 @@ +import Modal from "flarum/components/Modal"; +import Button from "flarum/components/Button"; +import UploadButton from "./UploadButton"; +import UserFileList from "./UserFileList"; +import DragAndDrop from "./DragAndDrop"; + +export default class FileManagerModal extends Modal { + oninit(vnode) { + super.oninit(vnode); + + // Initialize upload managers + this.uploader = vnode.attrs.uploader; + + // Current selected files + this.selectedFiles = []; + + // Allow multiselect + this.multiSelect = vnode.attrs.multiSelect || false; + + // Drag & drop + this.dragDrop = null; + + // Initialize uploads + this.onUpload(); + } + + className() { + return "Modal--large fof-file-manager-modal"; + } + + /** + * Initialize drag & drop + */ + oncreate(vnode) { + super.oncreate(vnode); + + this.dragDrop = new DragAndDrop((files) => this.uploader.upload(files, false), this.$().find(".Modal-content")[0]); + } + + /** + * Remove events from modal content + */ + onremove() { + if(this.dragDrop) { + this.dragDrop.unload(); + } + } + + view() { + return ( +
+
+
+ {UploadButton.component({ + uploader: this.uploader, + disabled: app.fileListState.isLoading(), + isMediaUploadButton: true + })} +
+ +
+
+ + + {app.translator.trans("fof-upload.forum.file_list.release_to_upload")} +
+
+ +
+

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

+
+ + {this.alertAttrs ?
{Alert.component(this.alertAttrs)}
: ''} + +
+ {UserFileList.component({ + user: this.attrs.user, + selectable: true, + onFileSelect: this.onFileSelect.bind(this), + selectedFiles: this.selectedFiles + })} +
+ +
+ {Button.component({ + onclick: this.hide.bind(this), + className: 'Button', + }, app.translator.trans("fof-upload.forum.buttons.cancel"))} + + {Button.component({ + onclick: this.onSelect.bind(this), + disabled: this.selectedFiles.length === 0 || !this.multiSelect && this.selectedFiles.length > 1, + className: 'Button Button--primary', + }, app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length))} +
+
+
+ ); + } + + /** + * Add or remove file from selected files + * + * @param {File} file + */ + onFileSelect(file) { + const itemPosition = this.selectedFiles.indexOf(file.id()); + + if(itemPosition >= 0) { + this.selectedFiles.splice(itemPosition, 1); + }else{ + if(this.multiSelect) { + this.selectedFiles.push(file.id()); + }else{ + this.selectedFiles = [file.id()]; + } + } + } + + /** + * Add files to file list after upload + */ + onUpload() { + this.uploader.on('success', ({ file }) => { + if(this.multiSelect) { + this.selectedFiles.push(file.id()); + }else{ + this.selectedFiles = [file.id()]; + } + }); + } + + /** + * Add selected files to the composer + */ + onSelect() { + this.hide(); + + // Custom callback + if(this.attrs.onSelect) { + this.attrs.onSelect(this.selectedFiles); + + return; + } + + // Add selected files to composer + this.selectedFiles.map((fileId) => { + const file = app.store.getById("files", fileId); + + app.composer.editor.insertAtCursor(file.bbcode() + '\n') + }); + } +} \ No newline at end of file diff --git a/js/src/forum/components/UploadButton.js b/js/src/forum/components/UploadButton.js index 851cef0d..4b653843 100644 --- a/js/src/forum/components/UploadButton.js +++ b/js/src/forum/components/UploadButton.js @@ -1,7 +1,8 @@ import app from 'flarum/app'; import Component from 'flarum/Component'; -import icon from 'flarum/helpers/icon'; +import classList from 'flarum/utils/classList'; import LoadingIndicator from 'flarum/components/LoadingIndicator'; +import Button from 'flarum/components/Button'; export default class UploadButton extends Component { oninit(vnode) { @@ -14,36 +15,40 @@ export default class UploadButton extends Component { // redraw to reflect uploader.loading in the DOM m.redraw(); }); + + this.isMediaUploadButton = vnode.attrs.isMediaUploadButton || false; + } + + oncreate(vnode) { + super.oncreate(vnode); + + // Add tooltip + if(!this.isMediaUploadButton) { + this.$().tooltip(); + } } view() { const buttonText = this.attrs.uploader.uploading ? app.translator.trans('fof-upload.forum.states.loading') - : app.translator.trans('fof-upload.forum.buttons.attach'); + : app.translator.trans('fof-upload.forum.buttons.upload'); - return m( - 'button.Button.hasIcon.fof-upload-button.Button--icon', - { - className: this.attrs.uploader.uploading ? 'uploading' : '', - onclick: this.uploadButtonClicked.bind(this), - }, - [ - this.attrs.uploader.uploading - ? LoadingIndicator.component({ - size: 'tiny', - className: 'LoadingIndicator--inline Button-icon', - }) - : icon('fas fa-file-upload', { className: 'Button-icon' }), - m('span.Button-label', buttonText), - m('form', [ - m('input', { - type: 'file', - multiple: true, - onchange: this.process.bind(this), - }), - ]), - ] - ); + return Button.component({ + className: classList(["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), + title: !this.isMediaUploadButton ? buttonText : null, + disabled: this.attrs.disabled + }, [ + this.attrs.uploader.uploading && LoadingIndicator.component({ + size: 'tiny', + className: 'LoadingIndicator--inline Button-icon', + }), + this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null, +
+ +
+ ]); } /** @@ -62,7 +67,7 @@ export default class UploadButton extends Component { return; } - this.attrs.uploader.upload(files); + this.attrs.uploader.upload(files, !this.isMediaUploadButton); } /** diff --git a/js/src/forum/components/UserFileList.js b/js/src/forum/components/UserFileList.js new file mode 100644 index 00000000..ed6a6ab8 --- /dev/null +++ b/js/src/forum/components/UserFileList.js @@ -0,0 +1,130 @@ +import Component from "flarum/Component"; +import Button from "flarum/components/Button"; +import LoadingIndicator from 'flarum/components/LoadingIndicator'; +import mimeToIcon from "../../common/mimeToIcon"; + +export default class UserFileList extends Component{ + oninit(vnode) { + super.oninit(vnode); + + // Load file list + app.fileListState.setUser(vnode.attrs.user || app.session.user); + + this.inModal = vnode.attrs.selectable; + + this.restrictFileType = vnode.attrs.restrictFileType || null; + } + + view() { + const state = app.fileListState; + + return ( +
+ {/* Loading */} + {state.isLoading() && state.files.length === 0 && ( +
+ {app.translator.trans("fof-upload.forum.file_list.loading")} + + +
+ )} + + {/* Empty personal file list */} + {this.inModal && state.empty() && ( +

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

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

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

+ )} + + {/* File list */} +
    + {state.files.map(file => { + let fileClassNames = "fof-file"; + const fileIcon = mimeToIcon(file.type()); + const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true; + + // File is image + if(fileIcon === "image") { + fileClassNames += " fof-file-type-image"; + } + + // File is selected + if(this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) { + fileClassNames += " fof-file-selected"; + } + + return ( +
  • + +
  • + ) + })} +
+ + {/* Load more files */} + {state.hasMoreResults() && ( +
+ +
+ )} +
+ ); + } + + /** + * Check if a file is selectable + * + * @param {File} file + */ + isSelectable(file) { + const fileType = file.type(); + + // Custom defined file types + if(Array.isArray(this.restrictFileType)) { + return this.restrictFileType.indexOf(fileType) >= 0; + } + + // Image + else if(this.restrictFileType === 'image') { + return fileType.includes("image/"); + } + + // Audio + else if(this.restrictFileType === 'audio') { + return fileType.includes("audio/"); + } + + // Video + else if(this.restrictFileType === 'video') { + return fileType.includes("video/"); + } + + return false; + } +} \ No newline at end of file diff --git a/js/src/forum/components/index.js b/js/src/forum/components/index.js new file mode 100644 index 00000000..7439d8f8 --- /dev/null +++ b/js/src/forum/components/index.js @@ -0,0 +1,13 @@ +import Uploader from "../handler/Uploader"; +import DragAndDrop from "./DragAndDrop"; +import FileManagerButton from "./FileManagerButton"; +import FileManagerModal from "./FileManagerModal"; +import UserFileList from "./UserFileList"; + +export const components = { + DragAndDrop, + FileManagerButton, + FileManagerModal, + UserFileList, + Uploader +}; diff --git a/js/src/forum/handler/Uploader.js b/js/src/forum/handler/Uploader.js index c3ea75d4..daee7e42 100644 --- a/js/src/forum/handler/Uploader.js +++ b/js/src/forum/handler/Uploader.js @@ -17,7 +17,7 @@ export default class Uploader { this.callbacks[type].forEach((callback) => callback(response)); } - upload(files) { + upload(files, addBBcode = true) { this.uploading = true; this.dispatch('uploading', files); @@ -38,7 +38,7 @@ export default class Uploader { serialize: (raw) => raw, body, }) - .then(this.uploaded.bind(this)) + .then((result) => this.uploaded(result, addBBcode)) .catch((error) => { this.uploading = false; m.redraw(); @@ -47,10 +47,21 @@ export default class Uploader { }); } - uploaded(files) { + uploaded(result, addBBcode = false) { this.uploading = false; - files.forEach((file) => this.dispatch('success', file)); + result.data.forEach((file) => { + const fileObj = app.store.pushObject(file); + + // Add file to media manager + app.fileListState.addToList(fileObj); + + // Dispatch + this.dispatch('success', { + file: fileObj, + addBBcode + }); + }); this.dispatch('uploaded'); } diff --git a/js/src/forum/index.js b/js/src/forum/index.js index 54ce2a3d..07bec9f3 100644 --- a/js/src/forum/index.js +++ b/js/src/forum/index.js @@ -1,9 +1,19 @@ import app from 'flarum/app'; +import File from '../common/models/File'; +import FileListState from './states/FileListState'; import downloadButtonInteraction from './downloadButtonInteraction'; import addUploadButton from './addUploadButton'; +export * from './components'; + app.initializers.add('fof-upload', () => { addUploadButton(); downloadButtonInteraction(); + + // File model + app.store.models.files = File; + + // File list state + app.fileListState = new FileListState(); }); diff --git a/js/src/forum/states/FileListState.js b/js/src/forum/states/FileListState.js new file mode 100644 index 00000000..2b73ab08 --- /dev/null +++ b/js/src/forum/states/FileListState.js @@ -0,0 +1,112 @@ +export default class FileListState { + constructor() { + this.user = null; + + this.files = []; + + this.moreResults = false; + + this.loading = false; + } + + /** + * Set user and load list + * + * @param user A user to populate the media manager + */ + setUser(user) { + // Keep previous state + if(user === this.user) return; + + // Set user + this.user = user; + + // Reset file list + this.files = []; + + // Load user files + this.loadResults(); + } + + /** + * Load more user files + * + * @param offset The index to start the page at. + */ + loadResults(offset = 0) { + if(!this.user) return; + + this.loading = true; + + return app.store.find('fof/uploads', { + filter: { + user: this.user.id() + }, + page: { + offset + } + }).then(this.parseResults.bind(this)); + } + + /** + * Load the next page of discussion results. + */ + loadMore() { + this.loading = true; + + this.loadResults(this.files.length).then(this.parseResults.bind(this)); + } + + /** + * Parse results and append them to the file list. + */ + parseResults(results) { + this.files.push(...results); + + this.loading = false; + this.moreResults = !!results.payload.links && !!results.payload.links.next; + + m.redraw(); + + return results; + } + + /** + * Add files to the beginning of the list + */ + addToList(files) { + if(Array.isArray(files)) { + this.files.unshift(...files); + }else{ + this.files.unshift(files); + } + } + + /** + * Are there any files in the list? + */ + hasFiles() { + return this.files.length > 0; + } + + /** + * Is the file list loading? + */ + isLoading() { + return this.loading; + } + + /** + * Does this user has more files? + */ + hasMoreResults() { + return this.moreResults; + } + + /** + * Does this user have any files? + */ + empty() { + return !this.hasFiles() && !this.isLoading(); + } +} \ No newline at end of file diff --git a/resources/less/forum/fileList.less b/resources/less/forum/fileList.less new file mode 100644 index 00000000..b63ef579 --- /dev/null +++ b/resources/less/forum/fileList.less @@ -0,0 +1,135 @@ +.fof-upload-file-list { + .fof-upload-loading { + font-size: 20px; + text-align: center; + } + + .fof-upload-empty { + font-size: 20px; + text-align: center; + + @media screen and (min-width: 769px) { + padding: 40px 0; + } + + .fof-upload-empty-icon { + display: block; + margin-bottom: 20px; + font-size: 35px; + } + } + + ul { + padding: 0px; + margin: 0 -7px; + + display: flex; + flex-flow: row wrap; + position: relative; + + li { + margin: 7px; + flex: ~"0 1 calc(20% - 14px)"; + list-style-type: none; + + @media screen and (min-width: 710px) and (max-width: 769px) { + flex: ~"0 1 calc(25% - 14px)"; + } + + @media screen and (min-width: 500px) and (max-width: 710px) { + flex: ~"0 1 calc(33% - 14px)"; + } + + @media screen and (min-width: 360px) and (max-width: 500px) { + flex: ~"0 1 calc(50% - 14px)"; + } + + @media screen and (max-width: 360px) { + flex: ~"0 1 calc(100% - 14px)"; + } + } + } + + + .fof-file { + position: relative; + display: block; + border-radius: 4px; + margin-bottom: 5px; + background: @body-bg; + background-position: center center; + background-size: cover; + width: 100%; + overflow: hidden; + border: 1px solid @control-bg; + outline: none; + box-shadow: 0 0 0 0px rgba(255, 255, 255, 0); + transition: box-shadow 150ms ease-in-out, border-color 150ms ease-in-out; + + &:before { + content: ""; + display: block; + padding-top: 100%; + } + + &:disabled { + opacity: 0.5; + } + + &:hover:not(:disabled):not(.fof-file-selected) { + border-color: darken(@body-bg, 20%); + } + + .fof-file-icon { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -68%); + font-size: 45px; + } + + .fof-file-image-preview { + position: absolute; + top: 50%; + left: 50%; + max-height: 100%; + transform: translate(-50%, -50%); + -webkit-user-drag: none; + opacity: if(@config-dark-mode, 0.6, 1); + } + + .fof-file-name { + position: absolute; + left: 0; + bottom: 0; + right: 0; + padding: 10px; + font-size: 13px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + -webkit-border-bottom-right-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -moz-border-radius-bottomright: 3px; + -moz-border-radius-bottomleft: 3px; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; + } + + &.fof-file-type-image { + .fof-file-name { + background: fade(@body-bg, 80%); + color: @text-color; + } + } + + &.fof-file-selected { + box-shadow: 0 0 0 3px fade(@primary-color, 60%); + } + } + + .fof-load-more-files { + text-align: center; + padding: 40px 20px 20px; + } +} \ No newline at end of file diff --git a/resources/less/forum/fileManagerModal.less b/resources/less/forum/fileManagerModal.less new file mode 100644 index 00000000..62926eb2 --- /dev/null +++ b/resources/less/forum/fileManagerModal.less @@ -0,0 +1,103 @@ +.fof-file-manager-modal { + .fof-modal-buttons { + @media screen and (min-width: 768px) { + position: absolute; + right: 10px; + top: 22px; + z-index: 1; + } + + @media screen and (max-width: 768px) { + left: unset; + right: 0; + } + + // Show full content on desktop + @media screen and (min-width: 767px) { + .Button.fof-upload-button { + width: auto; + padding: 8px 13px; + + @media screen and (min-width: 767px) { + margin-right: 10px; + } + + .Button-icon { + margin-right: 7px; + } + + .Button-label { + display: inline-block; + } + } + } + + // Hide attach button label + @media screen and (max-width: 767px) { + .fof-upload-button:not(.uploading) { + .Button-icon { + margin: 0; + } + + .Button-label { + display: none; + } + } + } + } + + .fof-drag-and-drop { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: fade(@control-bg, 90%); + z-index: 5; + transition: opacity 150ms ease-in-out; + pointer-events: none; + opacity: 0; + + .fof-drag-and-drop-release { + position: absolute; + top: 50%; + text-align: center; + left: 0; + right: 0; + transform: translateY(-50%); + font-size: 30px; + + > i { + display: block; + margin-bottom: 20px; + font-size: 75px; + } + } + } + + .Modal-content.fof-upload-dragging, + .Modal-content.fof-upload-dropping { + .fof-drag-and-drop { + opacity: 1; + } + } + + .Modal-body { + max-height: 500px; + overflow: auto; + + // Full height on mobile devices + @media screen and (max-width: 767px) { + height: ~"calc(100vh - 122px)"; + max-height: unset; + } + } + + .Modal-footer { + text-align: right; + + .Button { + margin-left: 10px; + } + } +} \ No newline at end of file diff --git a/resources/less/forum/upload.less b/resources/less/forum/upload.less index 64f98bc8..7c5300c2 100644 --- a/resources/less/forum/upload.less +++ b/resources/less/forum/upload.less @@ -10,9 +10,6 @@ display: none; } - &:hover, - &:focus, - &:active, &.uploading { // Cancel the effects of .Button--icon width: auto; @@ -20,7 +17,8 @@ // Cancel the effects of .Button--icon .Button-icon { - margin-right: 7px; + margin-left: -5px; + margin-right: 5px; } .Button-label { @@ -29,7 +27,19 @@ } } -.Composer.fof-upload-dragging { - background-color: #ddd; - .box-shadow(~"0 0 0 2px @{primary-color}, 0 2px 6px @{shadow-color}"); -} +.Composer { + &.fof-upload-dragging { + background-color: #ddd; + .box-shadow(~"0 0 0 2px @{primary-color}, 0 2px 6px @{shadow-color}"); + } + + .Composer-footer { + .item-fof-upload-media { + margin-right: 5px; + } + + .item-fof-upload { + margin-right: 0; + } + } +} \ No newline at end of file diff --git a/resources/locale/en.yml b/resources/locale/en.yml index e2285eea..c95f8e8a 100644 --- a/resources/locale/en.yml +++ b/resources/locale/en.yml @@ -92,8 +92,23 @@ fof-upload: ovh-svfs: OVH SVFS qiniu: QiNiu forum: + media_manager: Media manager + buttons: attach: Attach + upload: Upload + cancel: Cancel + media: Media + load_more_files: Load more files + select_file: Select file|Select files + + file_list: + loading: Loading files... + empty: There are no files to show. + release_to_upload: Release to upload + modal_empty_desktop: Your file list is empty, click or drag a file to upload. + modal_empty_phone: Your file list is empty, select a file to upload. + states: error: Error loading: Uploading diff --git a/src/Api/Controllers/ListUploadsController.php b/src/Api/Controllers/ListUploadsController.php new file mode 100644 index 00000000..43d503cc --- /dev/null +++ b/src/Api/Controllers/ListUploadsController.php @@ -0,0 +1,95 @@ +url = $url; + } + + /** + * @param \Psr\Http\Message\ServerRequestInterface $request + * @param \Tobscure\JsonApi\Document $request + * + */ + protected function data(ServerRequestInterface $request, Document $document) + { + $actor = $request->getAttribute('actor'); + $params = $request->getQueryParams(); + + // User is signed in + $actor->assertRegistered(); + + $filterUploads = Arr::get($params, "filter.user", $actor->id); + + // Can this user load other their files? + if($filterUploads !== $actor->id) { + $actor->assertCan("fof-upload.view-files"); + } + + // Params + $limit = $this->extractLimit($request); + $offset = $this->extractOffset($request); + + // Build query + $query = File::where([ + 'actor_id' => $filterUploads + ]); + + $results = $query + ->skip($offset) + ->take($limit + 1) + ->orderBy('id', 'desc') + ->get(); + + // Check for more results + $hasMoreResults = $limit > 0 && $results->count() > $limit; + + // Pop + if($hasMoreResults) { + $results->pop(); + } + + // Add pagination to the request + $document->addPaginationLinks( + $this->url->to('api')->route('fof-upload.list'), + $params, + $offset, + $limit, + $hasMoreResults ? null : 0 + ); + + return $results; + } +} diff --git a/src/Api/Controllers/UploadController.php b/src/Api/Controllers/UploadController.php index 5ae078d5..72baec70 100644 --- a/src/Api/Controllers/UploadController.php +++ b/src/Api/Controllers/UploadController.php @@ -14,16 +14,18 @@ use FoF\Upload\Commands\Upload; use FoF\Upload\Exceptions\InvalidUploadException; +use FoF\Upload\Api\Serializers\FileSerializer; +use Flarum\Api\Controller\AbstractListController; use Illuminate\Contracts\Bus\Dispatcher; use Illuminate\Support\Arr; use Illuminate\Support\Collection; -use Laminas\Diactoros\Response\JsonResponse; -use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Psr\Http\Server\RequestHandlerInterface; +use Tobscure\JsonApi\Document; -class UploadController implements RequestHandlerInterface +class UploadController extends AbstractListController { + public $serializer = FileSerializer::class; + /** * @var Dispatcher */ @@ -36,12 +38,11 @@ public function __construct(Dispatcher $bus) /** * @param \Psr\Http\Message\ServerRequestInterface $request + * @param \Tobscure\JsonApi\Document $request * * @throws InvalidUploadException - * - * @return \Psr\Http\Message\ResponseInterface */ - public function handle(ServerRequestInterface $request): ResponseInterface + protected function data(ServerRequestInterface $request, Document $document) { $actor = $request->getAttribute('actor'); $files = collect(Arr::get($request->getUploadedFiles(), 'files', [])); @@ -55,6 +56,6 @@ public function handle(ServerRequestInterface $request): ResponseInterface throw new InvalidUploadException('No files were uploaded'); } - return new JsonResponse($collection->toArray(), 201); + return $collection; } } diff --git a/src/Api/Serializers/FileSerializer.php b/src/Api/Serializers/FileSerializer.php index 0a676f84..eb143ead 100644 --- a/src/Api/Serializers/FileSerializer.php +++ b/src/Api/Serializers/FileSerializer.php @@ -14,7 +14,6 @@ use Flarum\Api\Serializer\AbstractSerializer; use FoF\Upload\File; -use Illuminate\Support\Arr; class FileSerializer extends AbstractSerializer { @@ -29,11 +28,16 @@ class FileSerializer extends AbstractSerializer */ protected function getDefaultAttributes($model) { - $attributes = Arr::only( - $model->attributesToArray(), - ['uuid', 'base_name', 'tag'] - ); - - return $attributes; + return [ + 'baseName' => $model->base_name, + 'path' => $model->path, + 'url' => $model->url, + 'type' => $model->type, + 'size' => $model->size, + 'humanSize' => $model->humanSize, + 'createdAt' => $model->created_at, + 'uuid' => $model->uuid, + 'tag' => $model->tag + ]; } } diff --git a/src/Commands/UploadHandler.php b/src/Commands/UploadHandler.php index dd80cd5d..168746ab 100644 --- a/src/Commands/UploadHandler.php +++ b/src/Commands/UploadHandler.php @@ -98,7 +98,7 @@ public function handle(Upload $command) $uploadFileData = $this->mimeDetector->getFileType(); - if ($uploadFileData['mime'] === null) { + if (!isset($uploadFileData['mime']) || $uploadFileData['mime'] === null) { try { $uploadFileData['mime'] = mime_content_type($upload->getPathname()); } catch (Exception $e) { @@ -165,7 +165,7 @@ public function handle(Upload $command) throw $e; } - return $template->preview($file); + return $file; }); return $savedFiles->filter(); From cb3fa38501fe3e3883d10a8af56b48f2ba740e0e Mon Sep 17 00:00:00 2001 From: Jasper Vriends <4417659+jaspervriends@users.noreply.github.com> Date: Sun, 31 Jan 2021 20:07:49 +0100 Subject: [PATCH 2/8] Linter --- js/dist/admin.js.map | 2 +- js/dist/forum.js | 124 +++++++++---------- js/dist/forum.js.map | 2 +- js/src/common/fileToBBcode.js | 10 +- js/src/common/mimeToIcon.js | 28 ++--- js/src/common/models/File.js | 24 ++-- js/src/forum/addUploadButton.js | 2 +- js/src/forum/components/FileManagerButton.js | 12 +- js/src/forum/components/FileManagerModal.js | 92 +++++++------- js/src/forum/components/UploadButton.js | 47 ++++--- js/src/forum/components/UserFileList.js | 93 +++++++------- js/src/forum/components/index.js | 12 +- js/src/forum/handler/Uploader.js | 2 +- js/src/forum/states/FileListState.js | 42 ++++--- 14 files changed, 255 insertions(+), 237 deletions(-) diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index e4b5db2c..9e793861 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/./admin.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/admin/components/UploadPage.js","webpack://@fof/upload/./src/admin/components/index.js","webpack://@fof/upload/./src/admin/index.js","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Select']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/upload/external \"flarum.core.compat['components/UploadImageButton']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/withAttr']\""],"names":["UploadPage","oninit","vnode","loading","fields","checkboxes","objects","watermarkPositions","center","left","top","right","bottom","settings","app","data","settingsPrefix","uploadMethodOptions","addPrefix","templateOptions","values","forEach","key","Stream","JSON","parse","defaultAdap","Object","keys","length","mimeTypes","adapter","template","newMimeType","regex","content","m","onsubmit","bind","translator","trans","value","maxFileSize","oninput","withAttr","type","min","map","mime","config","updateMimeTypeKey","Select","component","options","onchange","updateMimeTypeAdapter","getTemplateOptionsForInput","updateMimeTypeTemplate","Button","className","onclick","deleteMimeType","addMimeType","templateOptionsDescriptions","Switch","state","mustResize","resizeMaxWidth","disabled","whitelistedClientExtensions","addsWatermarks","watermarkPosition","UploadImageButton","name","disableHotlinkProtection","disableDownloadLogging","cdnUrl","adaptorItems","toArray","changed","items","ItemList","undefined","add","imgurClientId","qiniuKey","qiniuSecret","qiniuBucket","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3UsePathStyleEndpoint","awsS3ACL","option","hasOwnProperty","children","push","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":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;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e,KAAf;AACAiC,OAAC,CAAC8E,MAAF;AACH,KAVL;AAWH;AAED;;;;;;;SAKAhG,S,GAAA,mBAAUI,GAAV,EAAe;AACX,WAAO,KAAKN,cAAL,GAAsB,GAAtB,GAA4BM,GAAnC;AACH,G;;;EApfmC6F,uE;;;;;;;;;;;;;;ACdxC;AAAA;AAAA;AAAA;AAEO,IAAMC,UAAU,GAAG;AACtBpH,YAAU,EAAVA,mDAAUA;AADY,CAAnB,C;;;;;;;;;;;;ACFP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AAEAc,iDAAG,CAACuG,YAAJ,CAAiBlC,GAAjB,CAAqB,YAArB,EAAmC,UAACrE,GAAD,EAAS;AACxCA,KAAG,CAACwG,aAAJ,QACS,YADT,EAEKC,YAFL,CAEkBvH,8DAFlB,EAGKwH,kBAHL,CAIQ;AACIC,QAAI,EAAE,aADV;AAEIC,SAAK,EAAE5G,GAAG,CAACyB,UAAJ,CAAeC,KAAf,CAAqB,2CAArB,CAFX;AAGImF,cAAU,EAAE;AAHhB,GAJR,EASQ,OATR,EAUQ,EAVR,EAYKH,kBAZL,CAaQ;AACIC,QAAI,EAAE,iBADV;AAEIC,SAAK,EAAE5G,GAAG,CAACyB,UAAJ,CAAeC,KAAf,CAAqB,6CAArB,CAFX;AAGImF,cAAU,EAAE,qBAHhB;AAIIC,cAAU,EAAE;AAJhB,GAbR,EAmBQ,MAnBR,EAoBQ,EApBR;AAsBH,CAvBD,E;;;;;;;;;;;ACLA,2C;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,gE;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,oE;;;;;;;;;;;ACAA,sD;;;;;;;;;;;ACAA,oD;;;;;;;;;;;ACAA,0D;;;;;;;;;;;ACAA,sD","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 = \"./admin.js\");\n","export * from './src/admin';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import app from 'flarum/app';\r\nimport Button from 'flarum/components/Button';\r\nimport saveSettings from 'flarum/utils/saveSettings';\r\nimport Alert from 'flarum/components/Alert';\r\nimport Select from 'flarum/components/Select';\r\nimport Switch from 'flarum/components/Switch';\r\nimport UploadImageButton from 'flarum/components/UploadImageButton';\r\nimport withAttr from 'flarum/utils/withAttr';\r\nimport Stream from 'flarum/utils/Stream';\r\nimport ExtensionPage from 'flarum/components/ExtensionPage';\r\nimport ItemList from 'flarum/utils/ItemList';\r\n\r\n/* global m */\r\n\r\nexport default class UploadPage extends ExtensionPage {\r\n oninit(vnode) {\r\n super.oninit(vnode);\r\n // whether we are saving the settings or not right now\r\n this.loading = false;\r\n\r\n // the fields we need to watch and to save\r\n this.fields = [\r\n // image\r\n 'resizeMaxWidth',\r\n 'cdnUrl',\r\n 'maxFileSize',\r\n 'whitelistedClientExtensions',\r\n // watermark\r\n 'watermark',\r\n 'watermarkPosition',\r\n // Imgur\r\n 'imgurClientId',\r\n // AWS\r\n 'awsS3Key',\r\n 'awsS3Secret',\r\n 'awsS3Bucket',\r\n 'awsS3Region',\r\n 'awsS3Endpoint',\r\n 'awsS3ACL',\r\n // QIniu\r\n 'qiniuKey',\r\n 'qiniuSecret',\r\n 'qiniuBucket',\r\n ];\r\n\r\n // the checkboxes we need to watch and to save.\r\n this.checkboxes = ['mustResize', 'addsWatermarks', 'disableHotlinkProtection', 'disableDownloadLogging', 'awsS3UsePathStyleEndpoint'];\r\n\r\n // fields that are objects\r\n this.objects = ['mimeTypes'];\r\n\r\n // watermark positions\r\n this.watermarkPositions = {\r\n 'top-left': 'top-left',\r\n 'top-right': 'top-right',\r\n 'bottom-left': 'bottom-left',\r\n 'bottom-right': 'bottom-right',\r\n center: 'center',\r\n left: 'left',\r\n top: 'top',\r\n right: 'right',\r\n bottom: 'bottom',\r\n };\r\n\r\n // get the saved settings from the database\r\n const settings = app.data.settings;\r\n\r\n // our package prefix (to be added to every field and checkbox in the setting table)\r\n this.settingsPrefix = 'fof-upload';\r\n\r\n // Options for the Upload methods dropdown menu.\r\n this.uploadMethodOptions = settings[this.addPrefix('availableUploadMethods')] || {};\r\n // Options for the Template dropdown menu.\r\n this.templateOptions = settings[this.addPrefix('availableTemplates')] || {};\r\n // Contains current values.\r\n this.values = {};\r\n // bind the values of the fields and checkboxes to the getter/setter functions\r\n this.fields.forEach((key) => (this.values[key] = Stream(settings[this.addPrefix(key)])));\r\n this.checkboxes.forEach((key) => (this.values[key] = Stream(settings[this.addPrefix(key)] === '1')));\r\n this.objects.forEach(\r\n (key) => (this.values[key] = settings[this.addPrefix(key)] ? Stream(JSON.parse(settings[this.addPrefix(key)])) : Stream())\r\n );\r\n\r\n // Set a sane default in case no mimeTypes have been configured yet.\r\n // Since 'local' (or others) can now be disabled, pick the last entry in the object for default\r\n this.defaultAdap = Object.keys(this.uploadMethodOptions)[Object.keys(this.uploadMethodOptions).length - 1];\r\n this.values.mimeTypes() ||\r\n (this.values.mimeTypes = Stream({\r\n '^image\\\\/.*': {\r\n adapter: this.defaultAdap,\r\n template: 'image-preview',\r\n },\r\n }));\r\n\r\n this.newMimeType = {\r\n regex: Stream(''),\r\n adapter: Stream(this.defaultAdap),\r\n template: Stream('file'),\r\n };\r\n }\r\n\r\n /**\r\n * Show the actual ImageUploadPage.\r\n *\r\n * @returns {*}\r\n */\r\n content() {\r\n return [\r\n m('.UploadPage', [\r\n m('.container', [\r\n m(\r\n 'form',\r\n {\r\n onsubmit: this.onsubmit.bind(this),\r\n },\r\n [\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.preferences.title')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.preferences.max_file_size')),\r\n m('input.FormControl', {\r\n value: this.values.maxFileSize() || 2048,\r\n oninput: withAttr('value', this.values.maxFileSize),\r\n type: 'number',\r\n min: '0',\r\n }),\r\n m('label', app.translator.trans('fof-upload.admin.labels.preferences.mime_types')),\r\n m(\r\n '.MimeTypes--Container',\r\n Object.keys(this.values.mimeTypes()).map((mime) => {\r\n let config = this.values.mimeTypes()[mime];\r\n // Compatibility for older versions.\r\n if (typeof config !== 'object') {\r\n config = {\r\n adapter: config,\r\n template: 'file',\r\n };\r\n }\r\n\r\n return m('div', [\r\n m('input.FormControl.MimeTypes', {\r\n value: mime,\r\n oninput: withAttr('value', this.updateMimeTypeKey.bind(this, mime)),\r\n }),\r\n Select.component({\r\n options: this.uploadMethodOptions,\r\n onchange: this.updateMimeTypeAdapter.bind(this, mime, config),\r\n value: config.adapter || 'local',\r\n }),\r\n Select.component({\r\n options: this.getTemplateOptionsForInput(),\r\n onchange: this.updateMimeTypeTemplate.bind(this, mime, config),\r\n value: config.template || 'local',\r\n }),\r\n Button.component(\r\n {\r\n type: 'button',\r\n className: 'Button Button--warning',\r\n onclick: this.deleteMimeType.bind(this, mime),\r\n },\r\n 'x'\r\n ),\r\n ]);\r\n }),\r\n m('br'),\r\n m('div', [\r\n m('input.FormControl.MimeTypes.add-MimeType-key', {\r\n value: this.newMimeType.regex(),\r\n oninput: withAttr('value', this.newMimeType.regex),\r\n }),\r\n Select.component({\r\n options: this.uploadMethodOptions,\r\n className: 'add-MimeType-value',\r\n oninput: withAttr('value', this.newMimeType.adapter),\r\n value: this.newMimeType.adapter(),\r\n }),\r\n Select.component({\r\n options: this.getTemplateOptionsForInput(),\r\n className: 'add-MimeType-value',\r\n oninput: withAttr('value', this.newMimeType.template),\r\n value: this.newMimeType.template(),\r\n }),\r\n Button.component(\r\n {\r\n type: 'button',\r\n className: 'Button Button--warning',\r\n onclick: this.addMimeType.bind(this),\r\n },\r\n '+'\r\n ),\r\n ])\r\n ),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.mime_types')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.download_templates')),\r\n this.templateOptionsDescriptions(),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.resize.title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.resize')),\r\n Switch.component(\r\n {\r\n state: this.values.mustResize() || false,\r\n onchange: this.values.mustResize,\r\n },\r\n app.translator.trans('fof-upload.admin.labels.resize.toggle')\r\n ),\r\n m('label', app.translator.trans('fof-upload.admin.labels.resize.max_width')),\r\n m('input', {\r\n className: 'FormControl',\r\n value: this.values.resizeMaxWidth() || 100,\r\n oninput: withAttr('value', this.values.resizeMaxWidth),\r\n disabled: !this.values.mustResize(),\r\n type: 'number',\r\n min: '0',\r\n }),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.client_extension.title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.client_extension')),\r\n m('input', {\r\n className: 'FormControl',\r\n value: this.values.whitelistedClientExtensions() || '',\r\n oninput: withAttr('value', this.values.whitelistedClientExtensions),\r\n }),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.watermark.title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.watermark')),\r\n Switch.component(\r\n {\r\n state: this.values.addsWatermarks() || false,\r\n onchange: this.values.addsWatermarks,\r\n },\r\n app.translator.trans('fof-upload.admin.labels.watermark.toggle')\r\n ),\r\n m('label', app.translator.trans('fof-upload.admin.labels.watermark.position')),\r\n m('div', [\r\n Select.component({\r\n options: this.watermarkPositions,\r\n onchange: this.values.watermarkPosition,\r\n value: this.values.watermarkPosition() || 'bottom-right',\r\n }),\r\n ]),\r\n m('label', {}, app.translator.trans('fof-upload.admin.labels.watermark.file')),\r\n UploadImageButton.component({\r\n name: 'fof/watermark',\r\n }),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.disable-hotlink-protection.title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.disable-hotlink-protection')),\r\n Switch.component(\r\n {\r\n state: this.values.disableHotlinkProtection() || false,\r\n onchange: this.values.disableHotlinkProtection,\r\n },\r\n app.translator.trans('fof-upload.admin.labels.disable-hotlink-protection.toggle')\r\n ),\r\n m('legend', app.translator.trans('fof-upload.admin.labels.disable-download-logging.title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.disable-download-logging')),\r\n Switch.component(\r\n {\r\n state: this.values.disableDownloadLogging() || false,\r\n onchange: this.values.disableDownloadLogging,\r\n },\r\n app.translator.trans('fof-upload.admin.labels.disable-download-logging.toggle')\r\n ),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.local.title')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.local.cdn_url')),\r\n m('input.FormControl', {\r\n value: this.values.cdnUrl() || '',\r\n oninput: withAttr('value', this.values.cdnUrl),\r\n }),\r\n ]),\r\n\r\n this.adaptorItems().toArray(),\r\n\r\n Button.component(\r\n {\r\n type: 'submit',\r\n className: 'Button Button--primary',\r\n loading: this.loading,\r\n disabled: !this.changed(),\r\n },\r\n app.translator.trans('fof-upload.admin.buttons.save')\r\n ),\r\n ]\r\n ),\r\n ]),\r\n ]),\r\n ];\r\n }\r\n\r\n adaptorItems() {\r\n const items = new ItemList();\r\n\r\n if (this.uploadMethodOptions['imgur'] !== undefined) {\r\n items.add(\r\n 'imgur',\r\n m('.imgur', [\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.imgur.title')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.imgur.client_id')),\r\n m('input.FormControl', {\r\n value: this.values.imgurClientId() || '',\r\n oninput: withAttr('value', this.values.imgurClientId),\r\n }),\r\n ]),\r\n ])\r\n );\r\n }\r\n\r\n if (this.uploadMethodOptions['qiniu'] !== undefined) {\r\n items.add(\r\n 'qiniu',\r\n m('.qiniu', [\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.qiniu.title')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.qiniu.key')),\r\n m('input.FormControl', {\r\n value: this.values.qiniuKey() || '',\r\n oninput: withAttr('value', this.values.qiniuKey),\r\n }),\r\n m('label', {}, app.translator.trans('fof-upload.admin.labels.qiniu.secret')),\r\n m('input.FormControl', {\r\n value: this.values.qiniuSecret() || '',\r\n oninput: withAttr('value', this.values.qiniuSecret),\r\n }),\r\n m('label', {}, app.translator.trans('fof-upload.admin.labels.qiniu.bucket')),\r\n m('input.FormControl', {\r\n value: this.values.qiniuBucket() || '',\r\n oninput: withAttr('value', this.values.qiniuBucket),\r\n }),\r\n ]),\r\n ])\r\n );\r\n }\r\n\r\n if (this.uploadMethodOptions['aws-s3'] !== undefined) {\r\n items.add(\r\n 'aws-s3',\r\n m('.aws', [\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.aws-s3.title')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.key')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3Key() || '',\r\n oninput: withAttr('value', this.values.awsS3Key),\r\n }),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.secret')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3Secret() || '',\r\n oninput: withAttr('value', this.values.awsS3Secret),\r\n }),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.bucket')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3Bucket() || '',\r\n oninput: withAttr('value', this.values.awsS3Bucket),\r\n }),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.region')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3Region() || '',\r\n oninput: withAttr('value', this.values.awsS3Region),\r\n }),\r\n ]),\r\n m('fieldset', [\r\n m('legend', app.translator.trans('fof-upload.admin.labels.aws-s3.advanced_title')),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.s3_compatible_storage')),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.endpoint')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3Endpoint() || '',\r\n oninput: withAttr('value', this.values.awsS3Endpoint),\r\n }),\r\n Switch.component(\r\n {\r\n state: this.values.awsS3UsePathStyleEndpoint() || false,\r\n onchange: this.values.awsS3UsePathStyleEndpoint,\r\n },\r\n app.translator.trans('fof-upload.admin.labels.aws-s3.use_path_style_endpoint')\r\n ),\r\n m('label', app.translator.trans('fof-upload.admin.labels.aws-s3.acl')),\r\n m('input.FormControl', {\r\n value: this.values.awsS3ACL() || '',\r\n oninput: withAttr('value', this.values.awsS3ACL),\r\n }),\r\n m('.helpText', app.translator.trans('fof-upload.admin.help_texts.s3_acl')),\r\n ]),\r\n ])\r\n );\r\n }\r\n\r\n return items;\r\n }\r\n\r\n getTemplateOptionsForInput() {\r\n const options = {};\r\n\r\n for (let option in this.templateOptions) {\r\n if (!this.templateOptions.hasOwnProperty(option)) {\r\n continue;\r\n }\r\n\r\n options[option] = this.templateOptions[option].name;\r\n }\r\n\r\n return options;\r\n }\r\n\r\n updateMimeTypeKey(mime, value) {\r\n this.values.mimeTypes()[value] = this.values.mimeTypes()[mime];\r\n\r\n this.deleteMimeType(mime);\r\n }\r\n\r\n updateMimeTypeAdapter(mime, config, value) {\r\n config.adapter = value;\r\n this.values.mimeTypes()[mime] = config;\r\n }\r\n\r\n updateMimeTypeTemplate(mime, config, value) {\r\n config.template = value;\r\n this.values.mimeTypes()[mime] = config;\r\n }\r\n\r\n deleteMimeType(mime) {\r\n delete this.values.mimeTypes()[mime];\r\n }\r\n\r\n templateOptionsDescriptions() {\r\n const children = [];\r\n\r\n for (let template in this.templateOptions) {\r\n if (!this.templateOptions.hasOwnProperty(template)) {\r\n continue;\r\n }\r\n\r\n children.push(m('li', this.templateOptions[template].name + ': ' + this.templateOptions[template].description));\r\n }\r\n\r\n return m('ul', children);\r\n }\r\n\r\n addMimeType() {\r\n this.values.mimeTypes()[this.newMimeType.regex()] = {\r\n adapter: this.newMimeType.adapter(),\r\n template: this.newMimeType.template(),\r\n };\r\n\r\n this.newMimeType.regex('');\r\n this.newMimeType.adapter('local');\r\n this.newMimeType.template('file');\r\n }\r\n\r\n /**\r\n * Checks if the values of the fields and checkboxes are different from\r\n * the ones stored in the database\r\n *\r\n * @returns boolean\r\n */\r\n changed() {\r\n const fieldsCheck = this.fields.some((key) => this.values[key]() !== app.data.settings[this.addPrefix(key)]);\r\n const checkboxesCheck = this.checkboxes.some((key) => this.values[key]() !== (app.data.settings[this.addPrefix(key)] === '1'));\r\n const objectsCheck = this.objects.some((key) => JSON.stringify(this.values[key]()) !== app.data.settings[this.addPrefix(key)]);\r\n\r\n return fieldsCheck || checkboxesCheck || objectsCheck;\r\n }\r\n\r\n /**\r\n * Saves the settings to the database and redraw the page\r\n *\r\n * @param e\r\n */\r\n onsubmit(e) {\r\n // prevent the usual form submit behaviour\r\n e.preventDefault();\r\n\r\n // if the page is already saving, do nothing\r\n if (this.loading) return;\r\n\r\n // prevents multiple savings\r\n this.loading = true;\r\n\r\n // remove previous success popup\r\n app.alerts.dismiss(this.successAlert);\r\n\r\n const settings = {};\r\n\r\n // gets all the values from the form\r\n this.fields.forEach((key) => (settings[this.addPrefix(key)] = this.values[key]()));\r\n this.checkboxes.forEach((key) => (settings[this.addPrefix(key)] = this.values[key]()));\r\n this.objects.forEach((key) => (settings[this.addPrefix(key)] = JSON.stringify(this.values[key]())));\r\n\r\n // actually saves everything in the database\r\n saveSettings(settings)\r\n .then(() => {\r\n // on success, show popup\r\n this.successAlert = app.alerts.show(Alert, { type: 'success' }, app.translator.trans('core.admin.basics.saved_message'));\r\n })\r\n .catch(() => {})\r\n .then(() => {\r\n // return to the initial state and redraw the page\r\n this.loading = false;\r\n m.redraw();\r\n });\r\n }\r\n\r\n /**\r\n * Adds the prefix `this.settingsPrefix` at the beginning of `key`\r\n *\r\n * @returns string\r\n */\r\n addPrefix(key) {\r\n return this.settingsPrefix + '.' + key;\r\n }\r\n}\r\n","import UploadPage from './UploadPage';\r\n\r\nexport const components = {\r\n UploadPage,\r\n};\r\n","import app from 'flarum/app';\r\nimport UploadPage from './components/UploadPage';\r\n\r\nexport * from './components';\r\n\r\napp.initializers.add('fof-upload', (app) => {\r\n app.extensionData\r\n .for('fof-upload')\r\n .registerPage(UploadPage)\r\n .registerPermission(\r\n {\r\n icon: 'far fa-file',\r\n label: app.translator.trans('fof-upload.admin.permissions.upload_label'),\r\n permission: 'fof-upload.upload',\r\n },\r\n 'start',\r\n 50\r\n )\r\n .registerPermission(\r\n {\r\n icon: 'fas fa-download',\r\n label: app.translator.trans('fof-upload.admin.permissions.download_label'),\r\n permission: 'fof-upload.download',\r\n allowGuest: true,\r\n },\r\n 'view',\r\n 50\r\n );\r\n});\r\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['components/UploadImageButton'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['utils/withAttr'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/./admin.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/admin/components/UploadPage.js","webpack://@fof/upload/./src/admin/components/index.js","webpack://@fof/upload/./src/admin/index.js","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Select']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/upload/external \"flarum.core.compat['components/UploadImageButton']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/withAttr']\""],"names":["UploadPage","oninit","vnode","loading","fields","checkboxes","objects","watermarkPositions","center","left","top","right","bottom","settings","app","data","settingsPrefix","uploadMethodOptions","addPrefix","templateOptions","values","forEach","key","Stream","JSON","parse","defaultAdap","Object","keys","length","mimeTypes","adapter","template","newMimeType","regex","content","m","onsubmit","bind","translator","trans","value","maxFileSize","oninput","withAttr","type","min","map","mime","config","updateMimeTypeKey","Select","component","options","onchange","updateMimeTypeAdapter","getTemplateOptionsForInput","updateMimeTypeTemplate","Button","className","onclick","deleteMimeType","addMimeType","templateOptionsDescriptions","Switch","state","mustResize","resizeMaxWidth","disabled","whitelistedClientExtensions","addsWatermarks","watermarkPosition","UploadImageButton","name","disableHotlinkProtection","disableDownloadLogging","cdnUrl","adaptorItems","toArray","changed","items","ItemList","undefined","add","imgurClientId","qiniuKey","qiniuSecret","qiniuBucket","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3UsePathStyleEndpoint","awsS3ACL","option","hasOwnProperty","children","push","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","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cAAU,EAAE,qBAHhB;AAIIC,cAAU,EAAE;AAJhB,GAbR,EAmBQ,MAnBR,EAoBQ,EApBR;AAsBH,CAvBD,E;;;;;;;;;;;ACLA,2C;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,gE;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,oE;;;;;;;;;;;ACAA,sD;;;;;;;;;;;ACAA,oD;;;;;;;;;;;ACAA,0D;;;;;;;;;;;ACAA,sD","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 = \"./admin.js\");\n","export * from './src/admin';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import app from 'flarum/app';\nimport Button from 'flarum/components/Button';\nimport saveSettings from 'flarum/utils/saveSettings';\nimport Alert from 'flarum/components/Alert';\nimport Select from 'flarum/components/Select';\nimport Switch from 'flarum/components/Switch';\nimport UploadImageButton from 'flarum/components/UploadImageButton';\nimport withAttr from 'flarum/utils/withAttr';\nimport Stream from 'flarum/utils/Stream';\nimport ExtensionPage from 'flarum/components/ExtensionPage';\nimport ItemList from 'flarum/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 // 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 // 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', [\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('fof-upload.admin.buttons.save')\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(m('li', this.templateOptions[template].name + ': ' + 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.basics.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/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});\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['components/UploadImageButton'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['utils/withAttr'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index ae2a7edc..ef3c902a 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -134,15 +134,15 @@ __webpack_require__.r(__webpack_exports__); function fileToBBcode(file) { switch (file.tag()) { // File - case "file": + case 'file': return "[upl-file uuid=" + file.uuid() + " size=" + file.humanSize() + "]" + file.baseName() + "[/upl-file]"; // Image template - case "image": + case 'image': return "[upl-image uuid=" + file.uuid() + " size=" + file.humanSize() + " url=" + file.url() + "]" + file.baseName() + "[/upl-image]"; // Image preview - case "image-preview": + case 'image-preview': return "[upl-image-preview url=" + file.url() + "]"; // 'just-url' or unknown @@ -163,31 +163,31 @@ function fileToBBcode(file) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return mimeToIcon; }); -var image = ["image/png", "image/jpg", "image/jpeg", "image/svg+xml"]; -var archive = ["application/zip", "application/x-7z-compressed", "application/gzip", "application/vnd.rar", "application/x-rar-compressed"]; -var code = ["text/html", "text/css", "text/javascript", "application/json", "application/ld+json", "text/javascript", "application/x-httpd-php"]; -var word = ["application/x-abiword", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]; +var image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml']; +var archive = ['application/zip', 'application/x-7z-compressed', 'application/gzip', 'application/vnd.rar', 'application/x-rar-compressed']; +var code = ['text/html', 'text/css', 'text/javascript', 'application/json', 'application/ld+json', 'text/javascript', 'application/x-httpd-php']; +var word = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document']; function mimeToIcon(fileType) { // Display image (do not display for) if (image.indexOf(fileType) >= 0) { return 'image'; } // Display image icon for other types - else if (fileType.includes("image/")) { + else if (fileType.includes('image/')) { return 'far fa-file-image'; } // Video icon - else if (fileType.includes("video/")) { + else if (fileType.includes('video/')) { return 'far fa-file-video'; } // Archive icon else if (archive.indexOf(fileType) >= 0) { return 'far fa-file-archive'; } // PDF icon - else if (fileType === "application/pdf") { + else if (fileType === 'application/pdf') { return 'far fa-file-pdf'; } // Word else if (word.indexOf(fileType) >= 0) { return 'far fa-file-word'; } // Audio icon - else if (fileType.includes("audio/")) { + else if (fileType.includes('audio/')) { return 'far fa-file-audio'; } // Code files else if (code.indexOf(fileType) >= 0) { @@ -246,15 +246,15 @@ var File = /*#__PURE__*/function (_mixin) { return File; }(flarum_utils_mixin__WEBPACK_IMPORTED_MODULE_2___default()(flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a, { - baseName: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("baseName"), - path: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("path"), - url: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("url"), - type: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("type"), - size: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("size"), - humanSize: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("humanSize"), - createdAt: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("createdAt"), - uuid: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("uuid"), - tag: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute("tag") + baseName: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute('baseName'), + path: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute('path'), + url: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute('url'), + type: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute('type'), + size: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute('size'), + humanSize: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute('humanSize'), + createdAt: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute('createdAt'), + uuid: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute('uuid'), + tag: flarum_Model__WEBPACK_IMPORTED_MODULE_1___default.a.attribute('tag') })); @@ -489,7 +489,7 @@ var FileManagerButton = /*#__PURE__*/function (_Component) { _proto.view = function view() { return flarum_components_Button__WEBPACK_IMPORTED_MODULE_3___default.a.component({ - className: "Button fof-upload-button Button--icon", + className: 'Button fof-upload-button Button--icon', onclick: this.fileManagerButtonClicked.bind(this), icon: 'fas fa-photo-video', title: flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.forum.buttons.media') @@ -497,8 +497,8 @@ var FileManagerButton = /*#__PURE__*/function (_Component) { } /** * Show tooltip on hover - * - * @param {*} vnode + * + * @param {*} vnode */ ; @@ -573,7 +573,7 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { this.selectedFiles = []; // Allow multiselect - this.multiSelect = vnode.attrs.multiSelect || false; // Drag & drop + this.multiSelect = vnode.attrs.multiSelect || true; // Drag & drop this.dragDrop = null; // Initialize uploads @@ -581,7 +581,7 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { }; _proto.className = function className() { - return "Modal--large fof-file-manager-modal"; + return 'Modal--large fof-file-manager-modal'; } /** * Initialize drag & drop @@ -595,7 +595,7 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { this.dragDrop = new _DragAndDrop__WEBPACK_IMPORTED_MODULE_5__["default"](function (files) { return _this.uploader.upload(files, false); - }, this.$().find(".Modal-content")[0]); + }, this.$().find('.Modal-content')[0]); } /** * Remove events from modal content @@ -620,30 +620,30 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { disabled: app.fileListState.isLoading(), isMediaUploadButton: true })), m("div", { - className: "fof-drag-and-drop" + className: 'fof-drag-and-drop' }, m("div", { - className: "fof-drag-and-drop-release" + 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: '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", { + }, app.translator.trans('fof-upload.forum.media_manager'))), this.alertAttrs ? m("div", { className: "Modal-alert" }, Alert.component(this.alertAttrs)) : '', m("div", { - className: "Modal-body" + className: 'Modal-body' }, _UserFileList__WEBPACK_IMPORTED_MODULE_4__["default"].component({ user: this.attrs.user, selectable: true, onFileSelect: this.onFileSelect.bind(this), selectedFiles: this.selectedFiles })), m("div", { - className: "Modal-footer" + className: 'Modal-footer' }, flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a.component({ onclick: this.hide.bind(this), className: 'Button' - }, app.translator.trans("fof-upload.forum.buttons.cancel")), flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a.component({ + }, app.translator.trans('fof-upload.forum.buttons.cancel')), flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a.component({ onclick: this.onSelect.bind(this), disabled: this.selectedFiles.length === 0 || !this.multiSelect && this.selectedFiles.length > 1, className: 'Button Button--primary' @@ -651,8 +651,8 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { } /** * Add or remove file from selected files - * - * @param {File} file + * + * @param {File} file */ ; @@ -702,7 +702,7 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { this.selectedFiles.map(function (fileId) { - var file = app.store.getById("files", fileId); + var file = app.store.getById('files', fileId); app.composer.editor.insertAtCursor(file.bbcode() + '\n'); }); }; @@ -823,7 +823,7 @@ var UploadButton = /*#__PURE__*/function (_Component) { _proto.view = function view() { var buttonText = this.attrs.uploader.uploading ? flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.forum.states.loading') : flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.forum.buttons.upload'); return flarum_components_Button__WEBPACK_IMPORTED_MODULE_5___default.a.component({ - className: flarum_utils_classList__WEBPACK_IMPORTED_MODULE_3___default()(["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"]), + className: flarum_utils_classList__WEBPACK_IMPORTED_MODULE_3___default()(['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), title: !this.isMediaUploadButton ? buttonText : null, @@ -926,27 +926,27 @@ var UserFileList = /*#__PURE__*/function (_Component) { var state = app.fileListState; return m("div", { - className: "fof-upload-file-list" + className: 'fof-upload-file-list' }, state.isLoading() && state.files.length === 0 && m("div", { - className: "fof-upload-loading" - }, app.translator.trans("fof-upload.forum.file_list.loading"), m(flarum_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_3___default.a, null)), this.inModal && state.empty() && m("p", { - className: "fof-upload-empty" + className: 'fof-upload-loading' + }, app.translator.trans('fof-upload.forum.file_list.loading'), m(flarum_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_3___default.a, null)), this.inModal && state.empty() && m("p", { + className: 'fof-upload-empty' }, m("i", { - className: "fas fa-cloud-upload-alt fof-upload-empty-icon" - }), app.translator.trans("fof-upload.forum.file_list.modal_empty_" + (app.screen() !== "phone" ? "desktop" : "phone"))), !this.inModal && state.empty()(m("p", { - className: "fof-upload-empty" - }, app.translator.trans("fof-upload.forum.file_list.empty"))), m("ul", null, state.files.map(function (file) { - var fileClassNames = "fof-file"; + className: 'fas fa-cloud-upload-alt fof-upload-empty-icon' + }), app.translator.trans("fof-upload.forum.file_list.modal_empty_" + (app.screen() !== 'phone' ? 'desktop' : 'phone'))), !this.inModal && state.empty()(m("p", { + className: 'fof-upload-empty' + }, app.translator.trans('fof-upload.forum.file_list.empty'))), m("ul", null, state.files.map(function (file) { + var fileClassNames = 'fof-file'; var fileIcon = Object(_common_mimeToIcon__WEBPACK_IMPORTED_MODULE_4__["default"])(file.type()); var fileSelectable = _this.restrictFileType ? _this.isSelectable(file) : true; // File is image - if (fileIcon === "image") { - fileClassNames += " fof-file-type-image"; + if (fileIcon === 'image') { + fileClassNames += ' fof-file-type-image'; } // File is selected if (_this.attrs.selectedFiles && _this.attrs.selectedFiles.indexOf(file.id()) >= 0) { - fileClassNames += " fof-file-selected"; + fileClassNames += ' fof-file-selected'; } return m("li", null, m("button", { @@ -957,30 +957,30 @@ var UserFileList = /*#__PURE__*/function (_Component) { title: file.baseName(), disabled: !fileSelectable }, m("span", { - className: "fof-file-icon" + className: 'fof-file-icon' }, m("i", { className: fileIcon !== 'image' ? fileIcon : 'far fa-file-image' })), fileIcon === 'image' && m("img", { src: file.url(), - className: "fof-file-image-preview" + className: 'fof-file-image-preview' }), m("span", { - className: "fof-file-name" + className: 'fof-file-name' }, file.baseName()))); })), state.hasMoreResults() && m("div", { - className: "fof-load-more-files" + className: 'fof-load-more-files' }, m(flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a, { - className: "Button Button--primary", + className: 'Button Button--primary', disabled: state.isLoading(), loading: state.isLoading(), onclick: function onclick() { return state.loadMore(); } - }, app.translator.trans("fof-upload.forum.buttons.load_more_files")))); + }, app.translator.trans('fof-upload.forum.buttons.load_more_files')))); } /** - * Check if a file is selectable - * - * @param {File} file + * Check if a file is selectable + * + * @param {File} file */ ; @@ -991,13 +991,13 @@ var UserFileList = /*#__PURE__*/function (_Component) { return this.restrictFileType.indexOf(fileType) >= 0; } // Image else if (this.restrictFileType === 'image') { - return fileType.includes("image/"); + return fileType.includes('image/'); } // Audio else if (this.restrictFileType === 'audio') { - return fileType.includes("audio/"); + return fileType.includes('audio/'); } // Video else if (this.restrictFileType === 'video') { - return fileType.includes("video/"); + return fileType.includes('video/'); } return false; diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index fa2b3d3c..4604a66b 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/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","selectFile","Component","oninit","selectedFiles","multiSelect","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","setUser","session","inModal","restrictFileType","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","hasMoreResults","loadMore","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","open","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","unshift","hasFiles"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA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KAAL,EAAWuJ,OAAX,qBAAsBvJ,KAAtB;AACH,KAFD,MAEK;AACD,WAAKA,KAAL,CAAWuJ,OAAX,CAAmBvJ,KAAnB;AACH;AACJ;AAED;;;;;SAGAwJ,Q,GAAA,oBAAW;AACP,WAAO,KAAKxJ,KAAL,CAAWuB,MAAX,GAAoB,CAA3B;AACH;AAED;;;;;SAGAgC,S,GAAA,qBAAY;AACR,WAAO,KAAKsF,OAAZ;AACH;AAED;;;;;SAGA1C,c,GAAA,0BAAiB;AACb,WAAO,KAAKyC,WAAZ;AACH;AAED;;;;;SAGA/C,K,GAAA,iBAAQ;AACJ,WAAO,CAAC,KAAK2D,QAAL,EAAD,IAAoB,CAAC,KAAKjG,SAAL,EAA5B;AACH,G;;;;;;;;;;;;;;;;AC9GL,iD;;;;;;;;;;;ACAA,6C;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,mE;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,8C;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,mD","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\r\n switch(file.tag()) {\r\n // File\r\n case \"file\":\r\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\r\n\r\n // Image template\r\n case \"image\":\r\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\r\n\r\n // Image preview\r\n case \"image-preview\":\r\n return `[upl-image-preview url=${file.url()}]`;\r\n\r\n // 'just-url' or unknown\r\n default:\r\n return file.url();\r\n }\r\n}","const image = [\"image/png\", \"image/jpg\", \"image/jpeg\", \"image/svg+xml\"];\r\nconst archive = [\"application/zip\", \"application/x-7z-compressed\", \"application/gzip\", \"application/vnd.rar\", \"application/x-rar-compressed\"];\r\nconst code = [\"text/html\", \"text/css\", \"text/javascript\", \"application/json\", \"application/ld+json\", \"text/javascript\", \"application/x-httpd-php\"];\r\nconst word = [\"application/x-abiword\", \"application/msword\", \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"];\r\n\r\nexport default function mimeToIcon(fileType) {\r\n // Display image (do not display for)\r\n if(image.indexOf(fileType) >= 0) {\r\n return 'image';\r\n }\r\n // Display image icon for other types\r\n else if(fileType.includes(\"image/\")) {\r\n return 'far fa-file-image';\r\n }\r\n // Video icon\r\n else if(fileType.includes(\"video/\")) {\r\n return 'far fa-file-video';\r\n }\r\n // Archive icon\r\n else if(archive.indexOf(fileType) >= 0) {\r\n return 'far fa-file-archive';\r\n }\r\n // PDF icon\r\n else if(fileType === \"application/pdf\") {\r\n return 'far fa-file-pdf';\r\n }\r\n // Word\r\n else if(word.indexOf(fileType) >= 0) {\r\n return 'far fa-file-word';\r\n }\r\n // Audio icon\r\n else if(fileType.includes(\"audio/\")) {\r\n return 'far fa-file-audio';\r\n }\r\n // Code files\r\n else if(code.indexOf(fileType) >= 0) {\r\n return 'far fa-file-code';\r\n }\r\n \r\n return 'far fa-file';\r\n}","import Model from \"flarum/Model\";\r\nimport mixin from \"flarum/utils/mixin\";\r\nimport fileToBBcode from \"../fileToBBcode\";\r\n\r\nexport default class File extends mixin(Model, {\r\n baseName: Model.attribute(\"baseName\"),\r\n path: Model.attribute(\"path\"),\r\n url: Model.attribute(\"url\"),\r\n type: Model.attribute(\"type\"),\r\n size: Model.attribute(\"size\"),\r\n humanSize: Model.attribute(\"humanSize\"),\r\n createdAt: Model.attribute(\"createdAt\"),\r\n uuid: Model.attribute(\"uuid\"),\r\n tag: Model.attribute(\"tag\"),\r\n}) {\r\n /**\r\n * Use FoF Uploads endpoint\r\n */\r\n apiEndpoint() {\r\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\r\n }\r\n\r\n /**\r\n * Generate bbcode for this file\r\n */\r\n bbcode() {\r\n return fileToBBcode(this);\r\n }\r\n}\r\n","import app from 'flarum/app';\r\nimport { extend } from 'flarum/extend';\r\nimport TextEditor from 'flarum/components/TextEditor';\r\nimport UploadButton from './components/UploadButton';\r\nimport DragAndDrop from './components/DragAndDrop';\r\nimport PasteClipboard from './components/PasteClipboard';\r\nimport Uploader from './handler/Uploader';\r\nimport FileManagerButton from './components/FileManagerButton';\r\n\r\nexport default function () {\r\n extend(TextEditor.prototype, 'oninit', function () {\r\n this.uploader = new Uploader();\r\n });\r\n extend(TextEditor.prototype, 'controlItems', function (items) {\r\n if (!app.forum.attribute('fof-upload.canUpload')) return;\r\n\r\n // Add media button\r\n items.add(\r\n 'fof-upload-media',\r\n FileManagerButton.component({\r\n uploader: this.uploader,\r\n })\r\n );\r\n\r\n // Add upload button\r\n items.add(\r\n 'fof-upload',\r\n UploadButton.component({\r\n uploader: this.uploader,\r\n })\r\n );\r\n });\r\n\r\n extend(TextEditor.prototype, 'oncreate', function (f_, vnode) {\r\n if (!app.forum.attribute('fof-upload.canUpload')) return;\r\n\r\n this.uploader.on('success', ({ file, addBBcode }) => {\r\n if(!addBBcode) return;\r\n\r\n this.attrs.composer.editor.insertAtCursor(file.bbcode() + '\\n');\r\n\r\n // We wrap this in a typeof check to prevent it running when a user\r\n // is creating a new discussion. There's nothing to preview in a new\r\n // discussion, so the `preview` function isn't defined.\r\n if (typeof this.attrs.preview === 'function') {\r\n // Scroll the preview into view\r\n // preview() causes the composer to close on mobile, but we don't want that. We want only the scroll\r\n // We work around that by temporarily patching the isFullScreen method\r\n const originalIsFullScreen = app.composer.isFullScreen;\r\n\r\n app.composer.isFullScreen = () => false;\r\n\r\n this.attrs.preview();\r\n\r\n app.composer.isFullScreen = originalIsFullScreen;\r\n }\r\n });\r\n\r\n const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\r\n\r\n const unloadHandler = () => {\r\n dragAndDrop.unload();\r\n };\r\n\r\n this.$('textarea').bind('onunload', unloadHandler);\r\n\r\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\r\n });\r\n}\r\n","export default class DragAndDrop {\r\n constructor(upload, composerElement) {\r\n this.upload = upload;\r\n this.composerElement = composerElement;\r\n\r\n // Keep references to the bound methods so we can remove the event listeners later\r\n this.handlers = {};\r\n\r\n if (!this.supportsFileDragging()) {\r\n return;\r\n }\r\n\r\n this.composerElement.addEventListener('dragover', (this.handlers.in = this.in.bind(this)));\r\n\r\n this.composerElement.addEventListener('dragleave', (this.handlers.out = this.out.bind(this)));\r\n this.composerElement.addEventListener('dragend', this.handlers.out);\r\n\r\n this.composerElement.addEventListener('drop', (this.handlers.dropping = this.dropping.bind(this)));\r\n }\r\n\r\n supportsFileDragging() {\r\n // Based on https://css-tricks.com/drag-and-drop-file-uploading/\r\n const div = document.createElement('div');\r\n\r\n return ('draggable' in div || ('ondragstart' in div && 'ondrop' in div)) && 'FormData' in window && 'FileReader' in window;\r\n }\r\n\r\n unload() {\r\n // If the handlers were not set (drag and drop not supported), we skip removing them\r\n if (!this.handlers.in) {\r\n return;\r\n }\r\n\r\n this.composerElement.removeEventListener('dragover', this.handlers.in);\r\n\r\n this.composerElement.removeEventListener('dragleave', this.handlers.out);\r\n this.composerElement.removeEventListener('dragend', this.handlers.out);\r\n\r\n this.composerElement.removeEventListener('drop', this.handlers.dropping);\r\n }\r\n\r\n isNotFile(event) {\r\n // Checking event.dataTransfer.files.length does not work on dragover event, it's always zero\r\n // So we use the dataTransfer.items property to check whether any file is being dragged\r\n if (event.dataTransfer.items) {\r\n for (let i = 0; i < event.dataTransfer.items.length; i++) {\r\n if (event.dataTransfer.items[i].kind !== 'file') {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n in(event) {\r\n if (this.isNotFile(event)) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n if (!this.over) {\r\n this.composerElement.classList.add('fof-upload-dragging');\r\n this.over = true;\r\n }\r\n }\r\n\r\n out(event) {\r\n if (this.isNotFile(event)) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n if (this.over) {\r\n this.composerElement.classList.remove('fof-upload-dragging');\r\n this.over = false;\r\n }\r\n }\r\n\r\n dropping(event) {\r\n if (this.isNotFile(event)) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n\r\n this.upload(event.dataTransfer.files);\r\n\r\n this.composerElement.classList.remove('fof-upload-dragging');\r\n }\r\n}\r\n","import app from 'flarum/app';\r\nimport Component from 'flarum/Component';\r\nimport Button from 'flarum/components/Button';\r\nimport FileManagerModal from './FileManagerModal';\r\n\r\nexport default class FileManagerButton extends Component {\r\n view() {\r\n return Button.component({\r\n className: \"Button fof-upload-button Button--icon\",\r\n onclick: this.fileManagerButtonClicked.bind(this),\r\n icon: 'fas fa-photo-video',\r\n title: app.translator.trans('fof-upload.forum.buttons.media')\r\n });\r\n }\r\n\r\n /**\r\n * Show tooltip on hover\r\n * \r\n * @param {*} vnode \r\n */\r\n oncreate(vnode) {\r\n super.oncreate(vnode);\r\n \r\n // Add tooltip\r\n this.$().tooltip();\r\n }\r\n\r\n /**\r\n * Event handler for upload button being clicked\r\n *\r\n * @param {PointerEvent} e\r\n */\r\n fileManagerButtonClicked(e) {\r\n e.preventDefault();\r\n\r\n // Open dialog\r\n app.modal.show(FileManagerModal, {\r\n selectFile: true,\r\n uploader: this.attrs.uploader\r\n });\r\n }\r\n}\r\n","import Modal from \"flarum/components/Modal\";\r\nimport Button from \"flarum/components/Button\";\r\nimport UploadButton from \"./UploadButton\";\r\nimport UserFileList from \"./UserFileList\";\r\nimport DragAndDrop from \"./DragAndDrop\";\r\n\r\nexport default class FileManagerModal extends Modal {\r\n oninit(vnode) {\r\n super.oninit(vnode);\r\n\r\n // Initialize upload managers\r\n this.uploader = vnode.attrs.uploader;\r\n\r\n // Current selected files\r\n this.selectedFiles = [];\r\n\r\n // Allow multiselect\r\n this.multiSelect = vnode.attrs.multiSelect || false;\r\n\r\n // Drag & drop\r\n this.dragDrop = null;\r\n\r\n // Initialize uploads\r\n this.onUpload();\r\n }\r\n\r\n className() {\r\n return \"Modal--large fof-file-manager-modal\";\r\n }\r\n\r\n /**\r\n * Initialize drag & drop\r\n */\r\n oncreate(vnode) {\r\n super.oncreate(vnode);\r\n\r\n this.dragDrop = new DragAndDrop((files) => this.uploader.upload(files, false), this.$().find(\".Modal-content\")[0]);\r\n }\r\n\r\n /**\r\n * Remove events from modal content\r\n */\r\n onremove() {\r\n if(this.dragDrop) {\r\n this.dragDrop.unload();\r\n }\r\n }\r\n\r\n view() {\r\n return (\r\n
\r\n
\r\n
\r\n {UploadButton.component({\r\n uploader: this.uploader,\r\n disabled: app.fileListState.isLoading(),\r\n isMediaUploadButton: true\r\n })}\r\n
\r\n\r\n
\r\n
\r\n \r\n\r\n {app.translator.trans(\"fof-upload.forum.file_list.release_to_upload\")}\r\n
\r\n
\r\n \r\n
\r\n

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

\r\n
\r\n\r\n {this.alertAttrs ?
{Alert.component(this.alertAttrs)}
: ''}\r\n\r\n
\r\n {UserFileList.component({\r\n user: this.attrs.user,\r\n selectable: true,\r\n onFileSelect: this.onFileSelect.bind(this),\r\n selectedFiles: this.selectedFiles\r\n })}\r\n
\r\n\r\n
\r\n {Button.component({\r\n onclick: this.hide.bind(this),\r\n className: 'Button',\r\n }, app.translator.trans(\"fof-upload.forum.buttons.cancel\"))}\r\n\r\n {Button.component({\r\n onclick: this.onSelect.bind(this),\r\n disabled: this.selectedFiles.length === 0 || !this.multiSelect && this.selectedFiles.length > 1,\r\n className: 'Button Button--primary',\r\n }, app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length))}\r\n
\r\n
\r\n
\r\n );\r\n }\r\n\r\n /**\r\n * Add or remove file from selected files\r\n * \r\n * @param {File} file \r\n */\r\n onFileSelect(file) {\r\n const itemPosition = this.selectedFiles.indexOf(file.id());\r\n\r\n if(itemPosition >= 0) {\r\n this.selectedFiles.splice(itemPosition, 1);\r\n }else{\r\n if(this.multiSelect) {\r\n this.selectedFiles.push(file.id());\r\n }else{\r\n this.selectedFiles = [file.id()];\r\n }\r\n }\r\n }\r\n \r\n /**\r\n * Add files to file list after upload\r\n */\r\n onUpload() {\r\n this.uploader.on('success', ({ file }) => {\r\n if(this.multiSelect) {\r\n this.selectedFiles.push(file.id());\r\n }else{\r\n this.selectedFiles = [file.id()];\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Add selected files to the composer\r\n */\r\n onSelect() {\r\n this.hide();\r\n\r\n // Custom callback\r\n if(this.attrs.onSelect) {\r\n this.attrs.onSelect(this.selectedFiles);\r\n\r\n return;\r\n }\r\n \r\n // Add selected files to composer\r\n this.selectedFiles.map((fileId) => {\r\n const file = app.store.getById(\"files\", fileId);\r\n\r\n app.composer.editor.insertAtCursor(file.bbcode() + '\\n')\r\n });\r\n }\r\n}","export default class PasteClipboard {\r\n constructor(upload, textAreaElement) {\r\n this.upload = upload;\r\n\r\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\r\n // and need to stay as long as the textarea exists in the DOM\r\n textAreaElement.addEventListener('paste', this.paste.bind(this));\r\n }\r\n\r\n paste(e) {\r\n if (e.clipboardData && e.clipboardData.items) {\r\n const items = e.clipboardData.items;\r\n\r\n const files = [];\r\n\r\n for (let i = 0; i < items.length; i++) {\r\n if (items[i].type.indexOf('image') !== -1) {\r\n files.push(items[i].getAsFile());\r\n }\r\n }\r\n\r\n if (files.length > 0) {\r\n e.preventDefault();\r\n\r\n this.upload(files);\r\n }\r\n }\r\n }\r\n}\r\n","import app from 'flarum/app';\r\nimport Component from 'flarum/Component';\r\nimport classList from 'flarum/utils/classList';\r\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\r\nimport Button from 'flarum/components/Button';\r\n\r\nexport default class UploadButton extends Component {\r\n oninit(vnode) {\r\n super.oninit(vnode);\r\n\r\n this.attrs.uploader.on('uploaded', () => {\r\n // reset the button for a new upload\r\n this.$('form')[0].reset();\r\n\r\n // redraw to reflect uploader.loading in the DOM\r\n m.redraw();\r\n });\r\n\r\n this.isMediaUploadButton = vnode.attrs.isMediaUploadButton || false;\r\n }\r\n\r\n oncreate(vnode) {\r\n super.oncreate(vnode);\r\n \r\n // Add tooltip\r\n if(!this.isMediaUploadButton) {\r\n this.$().tooltip();\r\n }\r\n }\r\n\r\n view() {\r\n const buttonText = this.attrs.uploader.uploading\r\n ? app.translator.trans('fof-upload.forum.states.loading')\r\n : app.translator.trans('fof-upload.forum.buttons.upload');\r\n\r\n return Button.component({\r\n className: classList([\"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\"]),\r\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\r\n onclick: this.uploadButtonClicked.bind(this),\r\n title: !this.isMediaUploadButton ? buttonText : null,\r\n disabled: this.attrs.disabled\r\n }, [\r\n this.attrs.uploader.uploading && LoadingIndicator.component({\r\n size: 'tiny',\r\n className: 'LoadingIndicator--inline Button-icon',\r\n }),\r\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\r\n
\r\n \r\n
\r\n ]);\r\n }\r\n\r\n /**\r\n * Process the upload event.\r\n *\r\n * @param e\r\n */\r\n process(e) {\r\n // get the file from the input field\r\n const files = this.$('input').prop('files');\r\n\r\n if (files.length === 0) {\r\n // We've got no files to upload, so trying\r\n // to begin an upload will show an error\r\n // to the user.\r\n return;\r\n }\r\n\r\n this.attrs.uploader.upload(files, !this.isMediaUploadButton);\r\n }\r\n\r\n /**\r\n * Event handler for upload button being clicked\r\n *\r\n * @param {PointerEvent} e\r\n */\r\n uploadButtonClicked(e) {\r\n // Trigger click on hidden input element\r\n // (Opens file dialog)\r\n this.$('input').click();\r\n }\r\n}\r\n","import Component from \"flarum/Component\";\r\nimport Button from \"flarum/components/Button\";\r\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\r\nimport mimeToIcon from \"../../common/mimeToIcon\";\r\n\r\nexport default class UserFileList extends Component{\r\n oninit(vnode) {\r\n super.oninit(vnode);\r\n\r\n // Load file list\r\n app.fileListState.setUser(vnode.attrs.user || app.session.user);\r\n\r\n this.inModal = vnode.attrs.selectable;\r\n\r\n this.restrictFileType = vnode.attrs.restrictFileType || null;\r\n }\r\n\r\n view() {\r\n const state = app.fileListState;\r\n \r\n return (\r\n
\r\n {/* Loading */}\r\n {state.isLoading() && state.files.length === 0 && (\r\n
\r\n {app.translator.trans(\"fof-upload.forum.file_list.loading\")}\r\n \r\n \r\n
\r\n )}\r\n \r\n {/* Empty personal file list */}\r\n {this.inModal && state.empty() && (\r\n

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

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

\r\n {app.translator.trans(\"fof-upload.forum.file_list.empty\")}\r\n

\r\n )}\r\n\r\n {/* File list */}\r\n
    \r\n {state.files.map(file => {\r\n let fileClassNames = \"fof-file\";\r\n const fileIcon = mimeToIcon(file.type());\r\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\r\n\r\n // File is image\r\n if(fileIcon === \"image\") {\r\n fileClassNames += \" fof-file-type-image\";\r\n }\r\n\r\n // File is selected\r\n if(this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\r\n fileClassNames += \" fof-file-selected\";\r\n }\r\n\r\n return (\r\n
  • \r\n \r\n
  • \r\n )\r\n })}\r\n
\r\n\r\n {/* Load more files */}\r\n {state.hasMoreResults() && (\r\n
\r\n \r\n
\r\n )}\r\n
\r\n );\r\n }\r\n\r\n /**\r\n * Check if a file is selectable \r\n * \r\n * @param {File} file \r\n */\r\n isSelectable(file) {\r\n const fileType = file.type();\r\n\r\n // Custom defined file types\r\n if(Array.isArray(this.restrictFileType)) {\r\n return this.restrictFileType.indexOf(fileType) >= 0;\r\n }\r\n\r\n // Image\r\n else if(this.restrictFileType === 'image') {\r\n return fileType.includes(\"image/\");\r\n }\r\n\r\n // Audio\r\n else if(this.restrictFileType === 'audio') {\r\n return fileType.includes(\"audio/\");\r\n }\r\n\r\n // Video\r\n else if(this.restrictFileType === 'video') {\r\n return fileType.includes(\"video/\");\r\n }\r\n\r\n return false;\r\n }\r\n}","import Uploader from \"../handler/Uploader\";\r\nimport DragAndDrop from \"./DragAndDrop\";\r\nimport FileManagerButton from \"./FileManagerButton\";\r\nimport FileManagerModal from \"./FileManagerModal\";\r\nimport UserFileList from \"./UserFileList\";\r\n\r\nexport const components = {\r\n DragAndDrop,\r\n FileManagerButton,\r\n FileManagerModal,\r\n UserFileList,\r\n Uploader\r\n};\r\n","import app from 'flarum/app';\r\nimport { extend } from 'flarum/extend';\r\nimport Post from 'flarum/components/Post';\r\n\r\n/* global $ */\r\n\r\nexport default function () {\r\n extend(Post.prototype, 'oncreate', function () {\r\n this.$('[data-fof-upload-download-uuid]')\r\n .unbind('click')\r\n .on('click', (e) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n if (!app.forum.attribute('fof-upload.canDownload')) {\r\n alert(app.translator.trans('fof-upload.forum.states.unauthorized'));\r\n return;\r\n }\r\n\r\n let url = app.forum.attribute('apiUrl') + '/fof/download';\r\n\r\n url += '/' + e.currentTarget.dataset.fofUploadDownloadUuid;\r\n url += '/' + this.attrs.post.id();\r\n url += '/' + app.session.csrfToken;\r\n\r\n window.open(url);\r\n });\r\n });\r\n}\r\n","export default class Uploader {\r\n constructor() {\r\n this.callbacks = {\r\n success: [],\r\n failure: [],\r\n uploading: [],\r\n uploaded: [],\r\n };\r\n this.uploading = false;\r\n }\r\n\r\n on(type, callback) {\r\n this.callbacks[type].push(callback);\r\n }\r\n\r\n dispatch(type, response) {\r\n this.callbacks[type].forEach((callback) => callback(response));\r\n }\r\n\r\n upload(files, addBBcode = true) {\r\n this.uploading = true;\r\n this.dispatch('uploading', files);\r\n\r\n m.redraw(); // Forcing a redraw so that the button also updates if uploadFiles() is called from DragAndDrop or PasteClipboard\r\n\r\n const body = new FormData();\r\n\r\n for (let i = 0; i < files.length; i++) {\r\n body.append('files[]', files[i]);\r\n }\r\n\r\n // send a POST request to the api\r\n return app\r\n .request({\r\n method: 'POST',\r\n url: app.forum.attribute('apiUrl') + '/fof/upload',\r\n // prevent JSON.stringify'ing the form data in the XHR call\r\n serialize: (raw) => raw,\r\n body,\r\n })\r\n .then((result) => this.uploaded(result, addBBcode))\r\n .catch((error) => {\r\n this.uploading = false;\r\n m.redraw();\r\n\r\n throw error;\r\n });\r\n }\r\n\r\n uploaded(result, addBBcode = false) {\r\n this.uploading = false;\r\n\r\n result.data.forEach((file) => {\r\n const fileObj = app.store.pushObject(file);\r\n\r\n // Add file to media manager\r\n app.fileListState.addToList(fileObj);\r\n\r\n // Dispatch\r\n this.dispatch('success', {\r\n file: fileObj,\r\n addBBcode\r\n });\r\n });\r\n\r\n this.dispatch('uploaded');\r\n }\r\n}\r\n","import app from 'flarum/app';\r\n\r\nimport File from '../common/models/File';\r\nimport FileListState from './states/FileListState';\r\nimport downloadButtonInteraction from './downloadButtonInteraction';\r\nimport addUploadButton from './addUploadButton';\r\n\r\nexport * from './components';\r\n\r\napp.initializers.add('fof-upload', () => {\r\n addUploadButton();\r\n downloadButtonInteraction();\r\n\r\n // File model\r\n app.store.models.files = File;\r\n\r\n // File list state\r\n app.fileListState = new FileListState();\r\n});\r\n","export default class FileListState {\r\n constructor() {\r\n this.user = null;\r\n\r\n this.files = [];\r\n \r\n this.moreResults = false;\r\n \r\n this.loading = false;\r\n }\r\n\r\n /**\r\n * Set user and load list\r\n *\r\n * @param user A user to populate the media manager\r\n */\r\n setUser(user) {\r\n // Keep previous state\r\n if(user === this.user) return;\r\n\r\n // Set user\r\n this.user = user;\r\n\r\n // Reset file list\r\n this.files = [];\r\n\r\n // Load user files\r\n this.loadResults();\r\n }\r\n\r\n /**\r\n * Load more user files\r\n *\r\n * @param offset The index to start the page at.\r\n */\r\n loadResults(offset = 0) {\r\n if(!this.user) return;\r\n\r\n this.loading = true;\r\n\r\n return app.store.find('fof/uploads', {\r\n filter: {\r\n user: this.user.id()\r\n },\r\n page: {\r\n offset\r\n }\r\n }).then(this.parseResults.bind(this));\r\n }\r\n\r\n /**\r\n * Load the next page of discussion results.\r\n */\r\n loadMore() {\r\n this.loading = true;\r\n \r\n this.loadResults(this.files.length).then(this.parseResults.bind(this));\r\n }\r\n\r\n /**\r\n * Parse results and append them to the file list.\r\n */\r\n parseResults(results) {\r\n this.files.push(...results);\r\n\r\n this.loading = false;\r\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\r\n\r\n m.redraw();\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * Add files to the beginning of the list\r\n */\r\n addToList(files) {\r\n if(Array.isArray(files)) {\r\n this.files.unshift(...files);\r\n }else{\r\n this.files.unshift(files);\r\n }\r\n }\r\n \r\n /**\r\n * Are there any files in the list?\r\n */\r\n hasFiles() {\r\n return this.files.length > 0;\r\n }\r\n\r\n /**\r\n * Is the file list loading?\r\n */\r\n isLoading() {\r\n return this.loading;\r\n }\r\n\r\n /**\r\n * Does this user has more files?\r\n */\r\n hasMoreResults() {\r\n return this.moreResults;\r\n }\r\n\r\n /**\r\n * Does this user have any files?\r\n */\r\n empty() {\r\n return !this.hasFiles() && !this.isLoading();\r\n }\r\n} ","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","selectFile","Component","oninit","selectedFiles","multiSelect","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","setUser","session","inModal","restrictFileType","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","hasMoreResults","loadMore","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","open","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","un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;AAEA,WAAOmE,OAAP;AACH;AAED;;;;;SAGAb,S,GAAA,mBAAUtI,KAAV,EAAiB;AACb,QAAIqG,KAAK,CAACC,OAAN,CAActG,KAAd,CAAJ,EAA0B;AAAA;;AACtB,2BAAKA,KAAL,EAAWuJ,OAAX,qBAAsBvJ,KAAtB;AACH,KAFD,MAEO;AACH,WAAKA,KAAL,CAAWuJ,OAAX,CAAmBvJ,KAAnB;AACH;AACJ;AAED;;;;;SAGAwJ,Q,GAAA,oBAAW;AACP,WAAO,KAAKxJ,KAAL,CAAWuB,MAAX,GAAoB,CAA3B;AACH;AAED;;;;;SAGAgC,S,GAAA,qBAAY;AACR,WAAO,KAAKsF,OAAZ;AACH;AAED;;;;;SAGA1C,c,GAAA,0BAAiB;AACb,WAAO,KAAKyC,WAAZ;AACH;AAED;;;;;SAGA/C,K,GAAA,iBAAQ;AACJ,WAAO,CAAC,KAAK2D,QAAL,EAAD,IAAoB,CAAC,KAAKjG,SAAL,EAA5B;AACH,G;;;;;;;;;;;;;;;;AChHL,iD;;;;;;;;;;;ACAA,6C;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,mE;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,8C;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,mD","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\n switch (file.tag()) {\n // File\n case 'file':\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\n\n // Image template\n case 'image':\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\n\n // Image preview\n case 'image-preview':\n return `[upl-image-preview url=${file.url()}]`;\n\n // 'just-url' or unknown\n default:\n return file.url();\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml'];\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 = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];\n\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.indexOf(fileType) >= 0) {\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 Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport fileToBBcode from '../fileToBBcode';\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}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n\n /**\n * Generate bbcode for this file\n */\n bbcode() {\n return fileToBBcode(this);\n }\n}\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport TextEditor from 'flarum/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 // Add media button\n items.add(\n 'fof-upload-media',\n FileManagerButton.component({\n uploader: this.uploader,\n })\n );\n\n // Add upload button\n items.add(\n 'fof-upload',\n UploadButton.component({\n uploader: this.uploader,\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');\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 const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n const unloadHandler = () => {\n dragAndDrop.unload();\n };\n\n this.$('textarea').bind('onunload', unloadHandler);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\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","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport FileManagerModal from './FileManagerModal';\n\nexport default class FileManagerButton extends Component {\n view() {\n return Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n title: app.translator.trans('fof-upload.forum.buttons.media'),\n });\n }\n\n /**\n * Show tooltip on hover\n *\n * @param {*} vnode\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n this.$().tooltip();\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 selectFile: true,\n uploader: this.attrs.uploader,\n });\n }\n}\n","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/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 // 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 return (\n
\n
\n
\n {UploadButton.component({\n uploader: this.uploader,\n disabled: app.fileListState.isLoading(),\n isMediaUploadButton: true,\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 ?
{Alert.component(this.alertAttrs)}
: ''}\n\n
\n {UserFileList.component({\n user: this.attrs.user,\n selectable: true,\n onFileSelect: this.onFileSelect.bind(this),\n selectedFiles: this.selectedFiles,\n })}\n
\n\n
\n {Button.component(\n {\n onclick: this.hide.bind(this),\n className: 'Button',\n },\n app.translator.trans('fof-upload.forum.buttons.cancel')\n )}\n\n {Button.component(\n {\n onclick: this.onSelect.bind(this),\n disabled: this.selectedFiles.length === 0 || (!this.multiSelect && this.selectedFiles.length > 1),\n className: 'Button Button--primary',\n },\n app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length)\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');\n });\n }\n}\n","export default class PasteClipboard {\n constructor(upload, textAreaElement) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\n // and need to stay as long as the textarea exists in the DOM\n textAreaElement.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/app';\nimport Component from 'flarum/Component';\nimport classList from 'flarum/utils/classList';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Button from 'flarum/components/Button';\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 oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n if (!this.isMediaUploadButton) {\n this.$().tooltip();\n }\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 Button.component(\n {\n className: classList([\n 'Button',\n 'hasIcon',\n 'fof-upload-button',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--icon',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--link',\n this.attrs.uploader.uploading && 'uploading',\n ]),\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\n onclick: this.uploadButtonClicked.bind(this),\n title: !this.isMediaUploadButton ? buttonText : null,\n disabled: this.attrs.disabled,\n },\n [\n this.attrs.uploader.uploading &&\n LoadingIndicator.component({\n size: 'tiny',\n className: 'LoadingIndicator--inline Button-icon',\n }),\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\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","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\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\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n }\n\n view() {\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 let fileClassNames = 'fof-file';\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n // File is image\n if (fileIcon === 'image') {\n fileClassNames += ' fof-file-type-image';\n }\n\n // File is selected\n if (this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\n fileClassNames += ' fof-file-selected';\n }\n\n return (\n
  • \n this.attrs.onFileSelect(file) : null}\n title={file.baseName()}\n disabled={!fileSelectable}\n >\n \n \n \n\n {fileIcon === 'image' && }\n\n {file.baseName()}\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.buttons.load_more_files')}\n \n
\n )}\n
\n );\n }\n\n /**\n * Check if a file is selectable\n *\n * @param {File} 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","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 app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport Post from 'flarum/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","export 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","import app from 'flarum/app';\n\nimport File from '../common/models/File';\nimport FileListState from './states/FileListState';\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\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","export 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","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/common/fileToBBcode.js b/js/src/common/fileToBBcode.js index 742064e8..aae031d2 100644 --- a/js/src/common/fileToBBcode.js +++ b/js/src/common/fileToBBcode.js @@ -1,19 +1,19 @@ export default function fileToBBcode(file) { - switch(file.tag()) { + switch (file.tag()) { // File - case "file": + case 'file': return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`; // Image template - case "image": + case 'image': return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`; // Image preview - case "image-preview": + case 'image-preview': return `[upl-image-preview url=${file.url()}]`; // 'just-url' or unknown default: return file.url(); } -} \ No newline at end of file +} diff --git a/js/src/common/mimeToIcon.js b/js/src/common/mimeToIcon.js index 85d8058a..f3cbbb14 100644 --- a/js/src/common/mimeToIcon.js +++ b/js/src/common/mimeToIcon.js @@ -1,41 +1,41 @@ -const image = ["image/png", "image/jpg", "image/jpeg", "image/svg+xml"]; -const archive = ["application/zip", "application/x-7z-compressed", "application/gzip", "application/vnd.rar", "application/x-rar-compressed"]; -const code = ["text/html", "text/css", "text/javascript", "application/json", "application/ld+json", "text/javascript", "application/x-httpd-php"]; -const word = ["application/x-abiword", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]; +const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml']; +const archive = ['application/zip', 'application/x-7z-compressed', 'application/gzip', 'application/vnd.rar', 'application/x-rar-compressed']; +const code = ['text/html', 'text/css', 'text/javascript', 'application/json', 'application/ld+json', 'text/javascript', 'application/x-httpd-php']; +const word = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document']; export default function mimeToIcon(fileType) { // Display image (do not display for) - if(image.indexOf(fileType) >= 0) { + if (image.indexOf(fileType) >= 0) { return 'image'; } // Display image icon for other types - else if(fileType.includes("image/")) { + else if (fileType.includes('image/')) { return 'far fa-file-image'; } // Video icon - else if(fileType.includes("video/")) { + else if (fileType.includes('video/')) { return 'far fa-file-video'; } // Archive icon - else if(archive.indexOf(fileType) >= 0) { + else if (archive.indexOf(fileType) >= 0) { return 'far fa-file-archive'; } // PDF icon - else if(fileType === "application/pdf") { + else if (fileType === 'application/pdf') { return 'far fa-file-pdf'; } // Word - else if(word.indexOf(fileType) >= 0) { + else if (word.indexOf(fileType) >= 0) { return 'far fa-file-word'; } // Audio icon - else if(fileType.includes("audio/")) { + else if (fileType.includes('audio/')) { return 'far fa-file-audio'; } // Code files - else if(code.indexOf(fileType) >= 0) { + else if (code.indexOf(fileType) >= 0) { return 'far fa-file-code'; } - + return 'far fa-file'; -} \ No newline at end of file +} diff --git a/js/src/common/models/File.js b/js/src/common/models/File.js index 07edf8d8..0088b90b 100644 --- a/js/src/common/models/File.js +++ b/js/src/common/models/File.js @@ -1,17 +1,17 @@ -import Model from "flarum/Model"; -import mixin from "flarum/utils/mixin"; -import fileToBBcode from "../fileToBBcode"; +import Model from 'flarum/Model'; +import mixin from 'flarum/utils/mixin'; +import fileToBBcode from '../fileToBBcode'; export default class File extends mixin(Model, { - baseName: Model.attribute("baseName"), - path: Model.attribute("path"), - url: Model.attribute("url"), - type: Model.attribute("type"), - size: Model.attribute("size"), - humanSize: Model.attribute("humanSize"), - createdAt: Model.attribute("createdAt"), - uuid: Model.attribute("uuid"), - tag: Model.attribute("tag"), + baseName: Model.attribute('baseName'), + path: Model.attribute('path'), + url: Model.attribute('url'), + type: Model.attribute('type'), + size: Model.attribute('size'), + humanSize: Model.attribute('humanSize'), + createdAt: Model.attribute('createdAt'), + uuid: Model.attribute('uuid'), + tag: Model.attribute('tag'), }) { /** * Use FoF Uploads endpoint diff --git a/js/src/forum/addUploadButton.js b/js/src/forum/addUploadButton.js index 807c1991..76e773bd 100644 --- a/js/src/forum/addUploadButton.js +++ b/js/src/forum/addUploadButton.js @@ -35,7 +35,7 @@ export default function () { if (!app.forum.attribute('fof-upload.canUpload')) return; this.uploader.on('success', ({ file, addBBcode }) => { - if(!addBBcode) return; + if (!addBBcode) return; this.attrs.composer.editor.insertAtCursor(file.bbcode() + '\n'); diff --git a/js/src/forum/components/FileManagerButton.js b/js/src/forum/components/FileManagerButton.js index 6327b8c8..cbcae0ea 100644 --- a/js/src/forum/components/FileManagerButton.js +++ b/js/src/forum/components/FileManagerButton.js @@ -6,21 +6,21 @@ import FileManagerModal from './FileManagerModal'; export default class FileManagerButton extends Component { view() { return Button.component({ - className: "Button fof-upload-button Button--icon", + className: 'Button fof-upload-button Button--icon', onclick: this.fileManagerButtonClicked.bind(this), icon: 'fas fa-photo-video', - title: app.translator.trans('fof-upload.forum.buttons.media') + title: app.translator.trans('fof-upload.forum.buttons.media'), }); } /** * Show tooltip on hover - * - * @param {*} vnode + * + * @param {*} vnode */ oncreate(vnode) { super.oncreate(vnode); - + // Add tooltip this.$().tooltip(); } @@ -36,7 +36,7 @@ export default class FileManagerButton extends Component { // Open dialog app.modal.show(FileManagerModal, { selectFile: true, - uploader: this.attrs.uploader + uploader: this.attrs.uploader, }); } } diff --git a/js/src/forum/components/FileManagerModal.js b/js/src/forum/components/FileManagerModal.js index e5e2f688..632b1569 100644 --- a/js/src/forum/components/FileManagerModal.js +++ b/js/src/forum/components/FileManagerModal.js @@ -1,8 +1,8 @@ -import Modal from "flarum/components/Modal"; -import Button from "flarum/components/Button"; -import UploadButton from "./UploadButton"; -import UserFileList from "./UserFileList"; -import DragAndDrop from "./DragAndDrop"; +import Modal from 'flarum/components/Modal'; +import Button from 'flarum/components/Button'; +import UploadButton from './UploadButton'; +import UserFileList from './UserFileList'; +import DragAndDrop from './DragAndDrop'; export default class FileManagerModal extends Modal { oninit(vnode) { @@ -15,7 +15,7 @@ export default class FileManagerModal extends Modal { this.selectedFiles = []; // Allow multiselect - this.multiSelect = vnode.attrs.multiSelect || false; + this.multiSelect = vnode.attrs.multiSelect || true; // Drag & drop this.dragDrop = null; @@ -25,7 +25,7 @@ export default class FileManagerModal extends Modal { } className() { - return "Modal--large fof-file-manager-modal"; + return 'Modal--large fof-file-manager-modal'; } /** @@ -34,14 +34,14 @@ export default class FileManagerModal extends Modal { oncreate(vnode) { super.oncreate(vnode); - this.dragDrop = new DragAndDrop((files) => this.uploader.upload(files, false), this.$().find(".Modal-content")[0]); + this.dragDrop = new DragAndDrop((files) => this.uploader.upload(files, false), this.$().find('.Modal-content')[0]); } /** * Remove events from modal content */ onremove() { - if(this.dragDrop) { + if (this.dragDrop) { this.dragDrop.unload(); } } @@ -54,44 +54,50 @@ export default class FileManagerModal extends Modal { {UploadButton.component({ uploader: this.uploader, disabled: app.fileListState.isLoading(), - isMediaUploadButton: true + isMediaUploadButton: true, })} -
-
- +
+
+ - {app.translator.trans("fof-upload.forum.file_list.release_to_upload")} + {app.translator.trans('fof-upload.forum.file_list.release_to_upload')}
- +
-

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

+

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

{this.alertAttrs ?
{Alert.component(this.alertAttrs)}
: ''} -
+
{UserFileList.component({ user: this.attrs.user, selectable: true, onFileSelect: this.onFileSelect.bind(this), - selectedFiles: this.selectedFiles + selectedFiles: this.selectedFiles, })}
-
- {Button.component({ - onclick: this.hide.bind(this), - className: 'Button', - }, app.translator.trans("fof-upload.forum.buttons.cancel"))} - - {Button.component({ - onclick: this.onSelect.bind(this), - disabled: this.selectedFiles.length === 0 || !this.multiSelect && this.selectedFiles.length > 1, - className: 'Button Button--primary', - }, app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length))} +
+ {Button.component( + { + onclick: this.hide.bind(this), + className: 'Button', + }, + app.translator.trans('fof-upload.forum.buttons.cancel') + )} + + {Button.component( + { + onclick: this.onSelect.bind(this), + disabled: this.selectedFiles.length === 0 || (!this.multiSelect && this.selectedFiles.length > 1), + className: 'Button Button--primary', + }, + app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length) + )}
@@ -100,31 +106,31 @@ export default class FileManagerModal extends Modal { /** * Add or remove file from selected files - * - * @param {File} file + * + * @param {File} file */ onFileSelect(file) { const itemPosition = this.selectedFiles.indexOf(file.id()); - if(itemPosition >= 0) { + if (itemPosition >= 0) { this.selectedFiles.splice(itemPosition, 1); - }else{ - if(this.multiSelect) { + } else { + if (this.multiSelect) { this.selectedFiles.push(file.id()); - }else{ + } else { this.selectedFiles = [file.id()]; } } } - + /** * Add files to file list after upload */ onUpload() { this.uploader.on('success', ({ file }) => { - if(this.multiSelect) { + if (this.multiSelect) { this.selectedFiles.push(file.id()); - }else{ + } else { this.selectedFiles = [file.id()]; } }); @@ -137,17 +143,17 @@ export default class FileManagerModal extends Modal { this.hide(); // Custom callback - if(this.attrs.onSelect) { + if (this.attrs.onSelect) { this.attrs.onSelect(this.selectedFiles); return; } - + // Add selected files to composer this.selectedFiles.map((fileId) => { - const file = app.store.getById("files", fileId); + const file = app.store.getById('files', fileId); - app.composer.editor.insertAtCursor(file.bbcode() + '\n') + app.composer.editor.insertAtCursor(file.bbcode() + '\n'); }); } -} \ No newline at end of file +} diff --git a/js/src/forum/components/UploadButton.js b/js/src/forum/components/UploadButton.js index 4b653843..8fde92f2 100644 --- a/js/src/forum/components/UploadButton.js +++ b/js/src/forum/components/UploadButton.js @@ -21,9 +21,9 @@ export default class UploadButton extends Component { oncreate(vnode) { super.oncreate(vnode); - + // Add tooltip - if(!this.isMediaUploadButton) { + if (!this.isMediaUploadButton) { this.$().tooltip(); } } @@ -33,22 +33,33 @@ export default class UploadButton extends Component { ? app.translator.trans('fof-upload.forum.states.loading') : app.translator.trans('fof-upload.forum.buttons.upload'); - return Button.component({ - className: classList(["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), - title: !this.isMediaUploadButton ? buttonText : null, - disabled: this.attrs.disabled - }, [ - this.attrs.uploader.uploading && LoadingIndicator.component({ - size: 'tiny', - className: 'LoadingIndicator--inline Button-icon', - }), - this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null, -
- -
- ]); + return Button.component( + { + className: classList([ + '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), + title: !this.isMediaUploadButton ? buttonText : null, + disabled: this.attrs.disabled, + }, + [ + this.attrs.uploader.uploading && + LoadingIndicator.component({ + size: 'tiny', + className: 'LoadingIndicator--inline Button-icon', + }), + this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null, +
+ +
, + ] + ); } /** diff --git a/js/src/forum/components/UserFileList.js b/js/src/forum/components/UserFileList.js index ed6a6ab8..126f0bee 100644 --- a/js/src/forum/components/UserFileList.js +++ b/js/src/forum/components/UserFileList.js @@ -1,9 +1,9 @@ -import Component from "flarum/Component"; -import Button from "flarum/components/Button"; +import Component from 'flarum/Component'; +import Button from 'flarum/components/Button'; import LoadingIndicator from 'flarum/components/LoadingIndicator'; -import mimeToIcon from "../../common/mimeToIcon"; +import mimeToIcon from '../../common/mimeToIcon'; -export default class UserFileList extends Component{ +export default class UserFileList extends Component { oninit(vnode) { super.oninit(vnode); @@ -17,80 +17,79 @@ export default class UserFileList extends Component{ view() { const state = app.fileListState; - + return ( -
+
{/* Loading */} {state.isLoading() && state.files.length === 0 && ( -
- {app.translator.trans("fof-upload.forum.file_list.loading")} - +
+ {app.translator.trans('fof-upload.forum.file_list.loading')} +
)} - + {/* Empty personal file list */} {this.inModal && state.empty() && ( -

- +

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

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

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

- )} + {!this.inModal && state.empty()(

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

)} {/* File list */}
    - {state.files.map(file => { - let fileClassNames = "fof-file"; + {state.files.map((file) => { + let fileClassNames = 'fof-file'; const fileIcon = mimeToIcon(file.type()); const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true; // File is image - if(fileIcon === "image") { - fileClassNames += " fof-file-type-image"; + if (fileIcon === 'image') { + fileClassNames += ' fof-file-type-image'; } // File is selected - if(this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) { - fileClassNames += " fof-file-selected"; + if (this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) { + fileClassNames += ' fof-file-selected'; } return (
  • -
  • - ) + ); })}
{/* Load more files */} {state.hasMoreResults() && ( -
- +
+
)}
@@ -98,33 +97,33 @@ export default class UserFileList extends Component{ } /** - * Check if a file is selectable - * - * @param {File} file + * Check if a file is selectable + * + * @param {File} file */ isSelectable(file) { const fileType = file.type(); // Custom defined file types - if(Array.isArray(this.restrictFileType)) { + if (Array.isArray(this.restrictFileType)) { return this.restrictFileType.indexOf(fileType) >= 0; } // Image - else if(this.restrictFileType === 'image') { - return fileType.includes("image/"); + else if (this.restrictFileType === 'image') { + return fileType.includes('image/'); } // Audio - else if(this.restrictFileType === 'audio') { - return fileType.includes("audio/"); + else if (this.restrictFileType === 'audio') { + return fileType.includes('audio/'); } // Video - else if(this.restrictFileType === 'video') { - return fileType.includes("video/"); + else if (this.restrictFileType === 'video') { + return fileType.includes('video/'); } return false; } -} \ No newline at end of file +} diff --git a/js/src/forum/components/index.js b/js/src/forum/components/index.js index 7439d8f8..73cd4135 100644 --- a/js/src/forum/components/index.js +++ b/js/src/forum/components/index.js @@ -1,13 +1,13 @@ -import Uploader from "../handler/Uploader"; -import DragAndDrop from "./DragAndDrop"; -import FileManagerButton from "./FileManagerButton"; -import FileManagerModal from "./FileManagerModal"; -import UserFileList from "./UserFileList"; +import Uploader from '../handler/Uploader'; +import DragAndDrop from './DragAndDrop'; +import FileManagerButton from './FileManagerButton'; +import FileManagerModal from './FileManagerModal'; +import UserFileList from './UserFileList'; export const components = { DragAndDrop, FileManagerButton, FileManagerModal, UserFileList, - Uploader + Uploader, }; diff --git a/js/src/forum/handler/Uploader.js b/js/src/forum/handler/Uploader.js index daee7e42..2854183e 100644 --- a/js/src/forum/handler/Uploader.js +++ b/js/src/forum/handler/Uploader.js @@ -59,7 +59,7 @@ export default class Uploader { // Dispatch this.dispatch('success', { file: fileObj, - addBBcode + addBBcode, }); }); diff --git a/js/src/forum/states/FileListState.js b/js/src/forum/states/FileListState.js index 2b73ab08..e9be8846 100644 --- a/js/src/forum/states/FileListState.js +++ b/js/src/forum/states/FileListState.js @@ -3,9 +3,9 @@ export default class FileListState { this.user = null; this.files = []; - + this.moreResults = false; - + this.loading = false; } @@ -16,7 +16,7 @@ export default class FileListState { */ setUser(user) { // Keep previous state - if(user === this.user) return; + if (user === this.user) return; // Set user this.user = user; @@ -34,27 +34,29 @@ export default class FileListState { * @param offset The index to start the page at. */ loadResults(offset = 0) { - if(!this.user) return; + if (!this.user) return; this.loading = true; - return app.store.find('fof/uploads', { - filter: { - user: this.user.id() - }, - page: { - offset - } - }).then(this.parseResults.bind(this)); + return app.store + .find('fof/uploads', { + filter: { + user: this.user.id(), + }, + page: { + offset, + }, + }) + .then(this.parseResults.bind(this)); } /** * Load the next page of discussion results. */ loadMore() { - this.loading = true; - - this.loadResults(this.files.length).then(this.parseResults.bind(this)); + this.loading = true; + + this.loadResults(this.files.length).then(this.parseResults.bind(this)); } /** @@ -74,14 +76,14 @@ export default class FileListState { /** * Add files to the beginning of the list */ - addToList(files) { - if(Array.isArray(files)) { + addToList(files) { + if (Array.isArray(files)) { this.files.unshift(...files); - }else{ + } else { this.files.unshift(files); } } - + /** * Are there any files in the list? */ @@ -109,4 +111,4 @@ export default class FileListState { empty() { return !this.hasFiles() && !this.isLoading(); } -} \ No newline at end of file +} From 60906e54a30fc7c95ab84c079b274305ceeb1c06 Mon Sep 17 00:00:00 2001 From: Jasper Vriends <4417659+jaspervriends@users.noreply.github.com> Date: Sun, 31 Jan 2021 20:26:49 +0100 Subject: [PATCH 3/8] Updated restricted file types --- js/dist/forum.js | 8 +++++--- js/dist/forum.js.map | 2 +- js/src/forum/components/FileManagerButton.js | 3 +-- js/src/forum/components/FileManagerModal.js | 4 ++++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/js/dist/forum.js b/js/dist/forum.js index ef3c902a..cbd7db9f 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -519,7 +519,6 @@ var FileManagerButton = /*#__PURE__*/function (_Component) { e.preventDefault(); // Open dialog flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.modal.show(_FileManagerModal__WEBPACK_IMPORTED_MODULE_4__["default"], { - selectFile: true, uploader: this.attrs.uploader }); }; @@ -573,7 +572,9 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { this.selectedFiles = []; // Allow multiselect - this.multiSelect = vnode.attrs.multiSelect || true; // Drag & drop + this.multiSelect = vnode.attrs.multiSelect || true; // Restrict file selection to specific types + + this.restrictFileType = vnode.attrs.restrictFileType || null; // Drag & drop this.dragDrop = null; // Initialize uploads @@ -637,7 +638,8 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { user: this.attrs.user, selectable: true, onFileSelect: this.onFileSelect.bind(this), - selectedFiles: this.selectedFiles + selectedFiles: this.selectedFiles, + restrictFileType: this.restrictFileType })), m("div", { className: 'Modal-footer' }, flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a.component({ diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 4604a66b..8fb08813 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/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","selectFile","Component","oninit","selectedFiles","multiSelect","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","setUser","session","inModal","restrictFileType","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","hasMoreResults","loadMore","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","open","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","unshift","hasFiles"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAe;AACf;AACA;AACA;AACA,C;;;;;;;;;;;;ACJA;AAAA;AAAe,SAASA,YAAT,CAAsBC,IAAtB,EAA4B;AACvC,UAAQA,IAAI,CAACC,GAAL,EAAR;AACI;AACA,SAAK,MAAL;AACI,iCAAyBD,IAAI,CAACE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;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,8C;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,mD","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\n switch (file.tag()) {\n // File\n case 'file':\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\n\n // Image template\n case 'image':\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\n\n // Image preview\n case 'image-preview':\n return `[upl-image-preview url=${file.url()}]`;\n\n // 'just-url' or unknown\n default:\n return file.url();\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml'];\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 = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];\n\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.indexOf(fileType) >= 0) {\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 Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport fileToBBcode from '../fileToBBcode';\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}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n\n /**\n * Generate bbcode for this file\n */\n bbcode() {\n return fileToBBcode(this);\n }\n}\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport TextEditor from 'flarum/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 // Add media button\n items.add(\n 'fof-upload-media',\n FileManagerButton.component({\n uploader: this.uploader,\n })\n );\n\n // Add upload button\n items.add(\n 'fof-upload',\n UploadButton.component({\n uploader: this.uploader,\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');\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 const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n const unloadHandler = () => {\n dragAndDrop.unload();\n };\n\n this.$('textarea').bind('onunload', unloadHandler);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\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","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport FileManagerModal from './FileManagerModal';\n\nexport default class FileManagerButton extends Component {\n view() {\n return Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n title: app.translator.trans('fof-upload.forum.buttons.media'),\n });\n }\n\n /**\n * Show tooltip on hover\n *\n * @param {*} vnode\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n this.$().tooltip();\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 selectFile: true,\n uploader: this.attrs.uploader,\n });\n }\n}\n","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/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 // 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 return (\n
\n
\n
\n {UploadButton.component({\n uploader: this.uploader,\n disabled: app.fileListState.isLoading(),\n isMediaUploadButton: true,\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 ?
{Alert.component(this.alertAttrs)}
: ''}\n\n
\n {UserFileList.component({\n user: this.attrs.user,\n selectable: true,\n onFileSelect: this.onFileSelect.bind(this),\n selectedFiles: this.selectedFiles,\n })}\n
\n\n
\n {Button.component(\n {\n onclick: this.hide.bind(this),\n className: 'Button',\n },\n app.translator.trans('fof-upload.forum.buttons.cancel')\n )}\n\n {Button.component(\n {\n onclick: this.onSelect.bind(this),\n disabled: this.selectedFiles.length === 0 || (!this.multiSelect && this.selectedFiles.length > 1),\n className: 'Button Button--primary',\n },\n app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length)\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');\n });\n }\n}\n","export default class PasteClipboard {\n constructor(upload, textAreaElement) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\n // and need to stay as long as the textarea exists in the DOM\n textAreaElement.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/app';\nimport Component from 'flarum/Component';\nimport classList from 'flarum/utils/classList';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Button from 'flarum/components/Button';\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 oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n if (!this.isMediaUploadButton) {\n this.$().tooltip();\n }\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 Button.component(\n {\n className: classList([\n 'Button',\n 'hasIcon',\n 'fof-upload-button',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--icon',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--link',\n this.attrs.uploader.uploading && 'uploading',\n ]),\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\n onclick: this.uploadButtonClicked.bind(this),\n title: !this.isMediaUploadButton ? buttonText : null,\n disabled: this.attrs.disabled,\n },\n [\n this.attrs.uploader.uploading &&\n LoadingIndicator.component({\n size: 'tiny',\n className: 'LoadingIndicator--inline Button-icon',\n }),\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\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","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\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\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n }\n\n view() {\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 let fileClassNames = 'fof-file';\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n // File is image\n if (fileIcon === 'image') {\n fileClassNames += ' fof-file-type-image';\n }\n\n // File is selected\n if (this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\n fileClassNames += ' fof-file-selected';\n }\n\n return (\n
  • \n this.attrs.onFileSelect(file) : null}\n title={file.baseName()}\n disabled={!fileSelectable}\n >\n \n \n \n\n {fileIcon === 'image' && }\n\n {file.baseName()}\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.buttons.load_more_files')}\n \n
\n )}\n
\n );\n }\n\n /**\n * Check if a file is selectable\n *\n * @param {File} 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","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 app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport Post from 'flarum/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","export 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","import app from 'flarum/app';\n\nimport File from '../common/models/File';\nimport FileListState from './states/FileListState';\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\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","export 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","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","Component","oninit","selectedFiles","multiSelect","restrictFileType","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","setUser","session","inModal","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","hasMoreResults","loadMore","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","open","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","unshift","hasFiles"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;Q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H,KAFD,MAEO;AACH,WAAKA,KAAL,CAAWsJ,OAAX,CAAmBtJ,KAAnB;AACH;AACJ;AAED;;;;;SAGAuJ,Q,GAAA,oBAAW;AACP,WAAO,KAAKvJ,KAAL,CAAWuB,MAAX,GAAoB,CAA3B;AACH;AAED;;;;;SAGAgC,S,GAAA,qBAAY;AACR,WAAO,KAAKqF,OAAZ;AACH;AAED;;;;;SAGA1C,c,GAAA,0BAAiB;AACb,WAAO,KAAKyC,WAAZ;AACH;AAED;;;;;SAGA/C,K,GAAA,iBAAQ;AACJ,WAAO,CAAC,KAAK2D,QAAL,EAAD,IAAoB,CAAC,KAAKhG,SAAL,EAA5B;AACH,G;;;;;;;;;;;;;;;;AChHL,iD;;;;;;;;;;;ACAA,6C;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,mE;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,8C;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,mD","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\n switch (file.tag()) {\n // File\n case 'file':\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\n\n // Image template\n case 'image':\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\n\n // Image preview\n case 'image-preview':\n return `[upl-image-preview url=${file.url()}]`;\n\n // 'just-url' or unknown\n default:\n return file.url();\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml'];\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 = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];\n\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.indexOf(fileType) >= 0) {\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 Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport fileToBBcode from '../fileToBBcode';\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}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n\n /**\n * Generate bbcode for this file\n */\n bbcode() {\n return fileToBBcode(this);\n }\n}\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport TextEditor from 'flarum/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 // Add media button\n items.add(\n 'fof-upload-media',\n FileManagerButton.component({\n uploader: this.uploader,\n })\n );\n\n // Add upload button\n items.add(\n 'fof-upload',\n UploadButton.component({\n uploader: this.uploader,\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');\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 const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n const unloadHandler = () => {\n dragAndDrop.unload();\n };\n\n this.$('textarea').bind('onunload', unloadHandler);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\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","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport FileManagerModal from './FileManagerModal';\n\nexport default class FileManagerButton extends Component {\n view() {\n return Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n title: app.translator.trans('fof-upload.forum.buttons.media'),\n });\n }\n\n /**\n * Show tooltip on hover\n *\n * @param {*} vnode\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n this.$().tooltip();\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 Modal from 'flarum/components/Modal';\nimport Button from 'flarum/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 return (\n
\n
\n
\n {UploadButton.component({\n uploader: this.uploader,\n disabled: app.fileListState.isLoading(),\n isMediaUploadButton: true,\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 ?
{Alert.component(this.alertAttrs)}
: ''}\n\n
\n {UserFileList.component({\n user: this.attrs.user,\n selectable: true,\n onFileSelect: this.onFileSelect.bind(this),\n selectedFiles: this.selectedFiles,\n restrictFileType: this.restrictFileType\n })}\n
\n\n
\n {Button.component(\n {\n onclick: this.hide.bind(this),\n className: 'Button',\n },\n app.translator.trans('fof-upload.forum.buttons.cancel')\n )}\n\n {Button.component(\n {\n onclick: this.onSelect.bind(this),\n disabled: this.selectedFiles.length === 0 || (!this.multiSelect && this.selectedFiles.length > 1),\n className: 'Button Button--primary',\n },\n app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length)\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');\n });\n }\n}\n","export default class PasteClipboard {\n constructor(upload, textAreaElement) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\n // and need to stay as long as the textarea exists in the DOM\n textAreaElement.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/app';\nimport Component from 'flarum/Component';\nimport classList from 'flarum/utils/classList';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Button from 'flarum/components/Button';\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 oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n if (!this.isMediaUploadButton) {\n this.$().tooltip();\n }\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 Button.component(\n {\n className: classList([\n 'Button',\n 'hasIcon',\n 'fof-upload-button',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--icon',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--link',\n this.attrs.uploader.uploading && 'uploading',\n ]),\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\n onclick: this.uploadButtonClicked.bind(this),\n title: !this.isMediaUploadButton ? buttonText : null,\n disabled: this.attrs.disabled,\n },\n [\n this.attrs.uploader.uploading &&\n LoadingIndicator.component({\n size: 'tiny',\n className: 'LoadingIndicator--inline Button-icon',\n }),\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\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","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\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\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n }\n\n view() {\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 let fileClassNames = 'fof-file';\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n // File is image\n if (fileIcon === 'image') {\n fileClassNames += ' fof-file-type-image';\n }\n\n // File is selected\n if (this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\n fileClassNames += ' fof-file-selected';\n }\n\n return (\n
  • \n this.attrs.onFileSelect(file) : null}\n title={file.baseName()}\n disabled={!fileSelectable}\n >\n \n \n \n\n {fileIcon === 'image' && }\n\n {file.baseName()}\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.buttons.load_more_files')}\n \n
\n )}\n
\n );\n }\n\n /**\n * Check if a file is selectable\n *\n * @param {File} 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","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 app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport Post from 'flarum/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","export 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","import app from 'flarum/app';\n\nimport File from '../common/models/File';\nimport FileListState from './states/FileListState';\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\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","export 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","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/forum/components/FileManagerButton.js b/js/src/forum/components/FileManagerButton.js index cbcae0ea..eae45d69 100644 --- a/js/src/forum/components/FileManagerButton.js +++ b/js/src/forum/components/FileManagerButton.js @@ -35,8 +35,7 @@ export default class FileManagerButton extends Component { // Open dialog app.modal.show(FileManagerModal, { - selectFile: true, - uploader: this.attrs.uploader, + uploader: this.attrs.uploader }); } } diff --git a/js/src/forum/components/FileManagerModal.js b/js/src/forum/components/FileManagerModal.js index 632b1569..3eb6702a 100644 --- a/js/src/forum/components/FileManagerModal.js +++ b/js/src/forum/components/FileManagerModal.js @@ -17,6 +17,9 @@ export default class FileManagerModal extends Modal { // Allow multiselect this.multiSelect = vnode.attrs.multiSelect || true; + // Restrict file selection to specific types + this.restrictFileType = vnode.attrs.restrictFileType || null; + // Drag & drop this.dragDrop = null; @@ -78,6 +81,7 @@ export default class FileManagerModal extends Modal { selectable: true, onFileSelect: this.onFileSelect.bind(this), selectedFiles: this.selectedFiles, + restrictFileType: this.restrictFileType })}
From e66e83882b75456311f7472ea4c5fdd977b8ddea Mon Sep 17 00:00:00 2001 From: Jasper Vriends <4417659+jaspervriends@users.noreply.github.com> Date: Mon, 1 Feb 2021 16:27:06 +0100 Subject: [PATCH 4/8] Update resources/locale/en.yml Comma splicing Co-authored-by: David Wheatley --- resources/locale/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/locale/en.yml b/resources/locale/en.yml index c95f8e8a..3e579c1a 100644 --- a/resources/locale/en.yml +++ b/resources/locale/en.yml @@ -106,7 +106,7 @@ fof-upload: loading: Loading files... empty: There are no files to show. release_to_upload: Release to upload - modal_empty_desktop: Your file list is empty, click or drag a file to upload. + modal_empty_desktop: Your file list is empty. Click or drag a file here to upload. modal_empty_phone: Your file list is empty, select a file to upload. states: From a3ef57515fd3a7e9f99bb6f6b507cfdef5cfd307 Mon Sep 17 00:00:00 2001 From: Jasper Vriends <4417659+jaspervriends@users.noreply.github.com> Date: Mon, 1 Feb 2021 16:27:21 +0100 Subject: [PATCH 5/8] Update resources/locale/en.yml Comma splicing Co-authored-by: David Wheatley --- resources/locale/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/locale/en.yml b/resources/locale/en.yml index 3e579c1a..689d08c3 100644 --- a/resources/locale/en.yml +++ b/resources/locale/en.yml @@ -107,7 +107,7 @@ fof-upload: empty: There are no files to show. release_to_upload: Release to upload modal_empty_desktop: Your file list is empty. Click or drag a file here to upload. - modal_empty_phone: Your file list is empty, select a file to upload. + modal_empty_phone: Your file list is empty. Select a file to upload. states: error: Error From 8c2d11406ad7f11df93aa963093ef791b48c9380 Mon Sep 17 00:00:00 2001 From: Jasper Vriends <4417659+jaspervriends@users.noreply.github.com> Date: Wed, 10 Feb 2021 16:26:03 +0100 Subject: [PATCH 6/8] Updated feedback --- js/dist/forum.js | 3 ++- js/dist/forum.js.map | 2 +- js/src/forum/components/UserFileList.js | 2 +- resources/less/forum/fileList.less | 7 +------ src/Api/Controllers/ListUploadsController.php | 2 +- src/Api/Controllers/UploadController.php | 2 +- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/js/dist/forum.js b/js/dist/forum.js index cbd7db9f..9bec6fc0 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -964,7 +964,8 @@ var UserFileList = /*#__PURE__*/function (_Component) { className: fileIcon !== 'image' ? fileIcon : 'far fa-file-image' })), fileIcon === 'image' && m("img", { src: file.url(), - className: 'fof-file-image-preview' + className: 'fof-file-image-preview', + draggable: false }), m("span", { className: 'fof-file-name' }, file.baseName()))); diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 8fb08813..9d291a0c 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/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","Component","oninit","selectedFiles","multiSelect","restrictFileType","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","setUser","session","inModal","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","hasMoreResults","loadMore","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","open","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","unshift","hasFiles"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAe;AACf;AACA;AACA;AACA,C;;;;;;;;;;;;ACJA;AAAA;AAAe,SAASA,YAAT,CAAsBC,IAAtB,EAA4B;AACvC,UAAQA,IAAI,CAACC,GAAL,EAAR;AACI;AACA,SAAK,MAAL;AACI,iCAAyBD,IAAI,CAACE,IAAL,EAAzB,cAA6CF,IAAI,CAACG,SAAL,EAA7C,SAAiEH,IAAI,CAACI,QAAL,EAAjE;AAEJ;;AACA,SAAK,OAAL;AACI,kCAA0BJ,IAAI,CAACE,IAAL,EAA1B,cAA8CF,IAAI,CAACG,SAAL,EAA9C,aAAsEH,IAAI,CAACK,GAAL,EAAtE,SAAoFL,IAAI,CAACI,QAAL,EAApF;AA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ction __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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\n switch (file.tag()) {\n // File\n case 'file':\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\n\n // Image template\n case 'image':\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\n\n // Image preview\n case 'image-preview':\n return `[upl-image-preview url=${file.url()}]`;\n\n // 'just-url' or unknown\n default:\n return file.url();\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml'];\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 = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];\n\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.indexOf(fileType) >= 0) {\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 Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport fileToBBcode from '../fileToBBcode';\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}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n\n /**\n * Generate bbcode for this file\n */\n bbcode() {\n return fileToBBcode(this);\n }\n}\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport TextEditor from 'flarum/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 // Add media button\n items.add(\n 'fof-upload-media',\n FileManagerButton.component({\n uploader: this.uploader,\n })\n );\n\n // Add upload button\n items.add(\n 'fof-upload',\n UploadButton.component({\n uploader: this.uploader,\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');\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 const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n const unloadHandler = () => {\n dragAndDrop.unload();\n };\n\n this.$('textarea').bind('onunload', unloadHandler);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\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","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport FileManagerModal from './FileManagerModal';\n\nexport default class FileManagerButton extends Component {\n view() {\n return Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n title: app.translator.trans('fof-upload.forum.buttons.media'),\n });\n }\n\n /**\n * Show tooltip on hover\n *\n * @param {*} vnode\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n this.$().tooltip();\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 Modal from 'flarum/components/Modal';\nimport Button from 'flarum/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 return (\n
\n
\n
\n {UploadButton.component({\n uploader: this.uploader,\n disabled: app.fileListState.isLoading(),\n isMediaUploadButton: true,\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 ?
{Alert.component(this.alertAttrs)}
: ''}\n\n
\n {UserFileList.component({\n user: this.attrs.user,\n selectable: true,\n onFileSelect: this.onFileSelect.bind(this),\n selectedFiles: this.selectedFiles,\n restrictFileType: this.restrictFileType\n })}\n
\n\n
\n {Button.component(\n {\n onclick: this.hide.bind(this),\n className: 'Button',\n },\n app.translator.trans('fof-upload.forum.buttons.cancel')\n )}\n\n {Button.component(\n {\n onclick: this.onSelect.bind(this),\n disabled: this.selectedFiles.length === 0 || (!this.multiSelect && this.selectedFiles.length > 1),\n className: 'Button Button--primary',\n },\n app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length)\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');\n });\n }\n}\n","export default class PasteClipboard {\n constructor(upload, textAreaElement) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\n // and need to stay as long as the textarea exists in the DOM\n textAreaElement.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/app';\nimport Component from 'flarum/Component';\nimport classList from 'flarum/utils/classList';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Button from 'flarum/components/Button';\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 oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n if (!this.isMediaUploadButton) {\n this.$().tooltip();\n }\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 Button.component(\n {\n className: classList([\n 'Button',\n 'hasIcon',\n 'fof-upload-button',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--icon',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--link',\n this.attrs.uploader.uploading && 'uploading',\n ]),\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\n onclick: this.uploadButtonClicked.bind(this),\n title: !this.isMediaUploadButton ? buttonText : null,\n disabled: this.attrs.disabled,\n },\n [\n this.attrs.uploader.uploading &&\n LoadingIndicator.component({\n size: 'tiny',\n className: 'LoadingIndicator--inline Button-icon',\n }),\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\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","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\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\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n }\n\n view() {\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 let fileClassNames = 'fof-file';\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n // File is image\n if (fileIcon === 'image') {\n fileClassNames += ' fof-file-type-image';\n }\n\n // File is selected\n if (this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\n fileClassNames += ' fof-file-selected';\n }\n\n return (\n
  • \n this.attrs.onFileSelect(file) : null}\n title={file.baseName()}\n disabled={!fileSelectable}\n >\n \n \n \n\n {fileIcon === 'image' && }\n\n {file.baseName()}\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.buttons.load_more_files')}\n \n
\n )}\n
\n );\n }\n\n /**\n * Check if a file is selectable\n *\n * @param {File} 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","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 app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport Post from 'flarum/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","export 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","import app from 'flarum/app';\n\nimport File from '../common/models/File';\nimport FileListState from './states/FileListState';\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\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","export 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","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","Component","oninit","selectedFiles","multiSelect","restrictFileType","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","setUser","session","inModal","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","hasMoreResults","loadMore","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","open","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","unshift","hasFiles"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EA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,KAAnB;AACH;AACJ;AAED;;;;;SAGAuJ,Q,GAAA,oBAAW;AACP,WAAO,KAAKvJ,KAAL,CAAWuB,MAAX,GAAoB,CAA3B;AACH;AAED;;;;;SAGAgC,S,GAAA,qBAAY;AACR,WAAO,KAAKqF,OAAZ;AACH;AAED;;;;;SAGA1C,c,GAAA,0BAAiB;AACb,WAAO,KAAKyC,WAAZ;AACH;AAED;;;;;SAGA/C,K,GAAA,iBAAQ;AACJ,WAAO,CAAC,KAAK2D,QAAL,EAAD,IAAoB,CAAC,KAAKhG,SAAL,EAA5B;AACH,G;;;;;;;;;;;;;;;;AChHL,iD;;;;;;;;;;;ACAA,6C;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,mE;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,8C;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,mD","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\n switch (file.tag()) {\n // File\n case 'file':\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\n\n // Image template\n case 'image':\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\n\n // Image preview\n case 'image-preview':\n return `[upl-image-preview url=${file.url()}]`;\n\n // 'just-url' or unknown\n default:\n return file.url();\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml'];\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 = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];\n\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.indexOf(fileType) >= 0) {\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 Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport fileToBBcode from '../fileToBBcode';\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}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n\n /**\n * Generate bbcode for this file\n */\n bbcode() {\n return fileToBBcode(this);\n }\n}\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport TextEditor from 'flarum/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 // Add media button\n items.add(\n 'fof-upload-media',\n FileManagerButton.component({\n uploader: this.uploader,\n })\n );\n\n // Add upload button\n items.add(\n 'fof-upload',\n UploadButton.component({\n uploader: this.uploader,\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');\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 const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n const unloadHandler = () => {\n dragAndDrop.unload();\n };\n\n this.$('textarea').bind('onunload', unloadHandler);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\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","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport FileManagerModal from './FileManagerModal';\n\nexport default class FileManagerButton extends Component {\n view() {\n return Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n title: app.translator.trans('fof-upload.forum.buttons.media'),\n });\n }\n\n /**\n * Show tooltip on hover\n *\n * @param {*} vnode\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n this.$().tooltip();\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 Modal from 'flarum/components/Modal';\nimport Button from 'flarum/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 return (\n
\n
\n
\n {UploadButton.component({\n uploader: this.uploader,\n disabled: app.fileListState.isLoading(),\n isMediaUploadButton: true,\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 ?
{Alert.component(this.alertAttrs)}
: ''}\n\n
\n {UserFileList.component({\n user: this.attrs.user,\n selectable: true,\n onFileSelect: this.onFileSelect.bind(this),\n selectedFiles: this.selectedFiles,\n restrictFileType: this.restrictFileType\n })}\n
\n\n
\n {Button.component(\n {\n onclick: this.hide.bind(this),\n className: 'Button',\n },\n app.translator.trans('fof-upload.forum.buttons.cancel')\n )}\n\n {Button.component(\n {\n onclick: this.onSelect.bind(this),\n disabled: this.selectedFiles.length === 0 || (!this.multiSelect && this.selectedFiles.length > 1),\n className: 'Button Button--primary',\n },\n app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length)\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');\n });\n }\n}\n","export default class PasteClipboard {\n constructor(upload, textAreaElement) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\n // and need to stay as long as the textarea exists in the DOM\n textAreaElement.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/app';\nimport Component from 'flarum/Component';\nimport classList from 'flarum/utils/classList';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Button from 'flarum/components/Button';\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 oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n if (!this.isMediaUploadButton) {\n this.$().tooltip();\n }\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 Button.component(\n {\n className: classList([\n 'Button',\n 'hasIcon',\n 'fof-upload-button',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--icon',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--link',\n this.attrs.uploader.uploading && 'uploading',\n ]),\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\n onclick: this.uploadButtonClicked.bind(this),\n title: !this.isMediaUploadButton ? buttonText : null,\n disabled: this.attrs.disabled,\n },\n [\n this.attrs.uploader.uploading &&\n LoadingIndicator.component({\n size: 'tiny',\n className: 'LoadingIndicator--inline Button-icon',\n }),\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\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","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\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\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n }\n\n view() {\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 let fileClassNames = 'fof-file';\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n // File is image\n if (fileIcon === 'image') {\n fileClassNames += ' fof-file-type-image';\n }\n\n // File is selected\n if (this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\n fileClassNames += ' fof-file-selected';\n }\n\n return (\n
  • \n this.attrs.onFileSelect(file) : null}\n title={file.baseName()}\n disabled={!fileSelectable}\n >\n \n \n \n\n {fileIcon === 'image' && }\n\n {file.baseName()}\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.buttons.load_more_files')}\n \n
\n )}\n
\n );\n }\n\n /**\n * Check if a file is selectable\n *\n * @param {File} 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","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 app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport Post from 'flarum/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","export 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","import app from 'flarum/app';\n\nimport File from '../common/models/File';\nimport FileListState from './states/FileListState';\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\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","export 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","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/forum/components/UserFileList.js b/js/src/forum/components/UserFileList.js index 126f0bee..8d533da6 100644 --- a/js/src/forum/components/UserFileList.js +++ b/js/src/forum/components/UserFileList.js @@ -70,7 +70,7 @@ export default class UserFileList extends Component { - {fileIcon === 'image' && } + {fileIcon === 'image' && } {file.baseName()} diff --git a/resources/less/forum/fileList.less b/resources/less/forum/fileList.less index b63ef579..8e8f4931 100644 --- a/resources/less/forum/fileList.less +++ b/resources/less/forum/fileList.less @@ -63,7 +63,7 @@ overflow: hidden; border: 1px solid @control-bg; outline: none; - box-shadow: 0 0 0 0px rgba(255, 255, 255, 0); + box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); transition: box-shadow 150ms ease-in-out, border-color 150ms ease-in-out; &:before { @@ -94,7 +94,6 @@ left: 50%; max-height: 100%; transform: translate(-50%, -50%); - -webkit-user-drag: none; opacity: if(@config-dark-mode, 0.6, 1); } @@ -108,10 +107,6 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - -webkit-border-bottom-right-radius: 3px; - -webkit-border-bottom-left-radius: 3px; - -moz-border-radius-bottomright: 3px; - -moz-border-radius-bottomleft: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } diff --git a/src/Api/Controllers/ListUploadsController.php b/src/Api/Controllers/ListUploadsController.php index 43d503cc..a92c4b88 100644 --- a/src/Api/Controllers/ListUploadsController.php +++ b/src/Api/Controllers/ListUploadsController.php @@ -40,7 +40,7 @@ public function __construct(UrlGenerator $url) /** * @param \Psr\Http\Message\ServerRequestInterface $request - * @param \Tobscure\JsonApi\Document $request + * @param \Tobscure\JsonApi\Document $document * */ protected function data(ServerRequestInterface $request, Document $document) diff --git a/src/Api/Controllers/UploadController.php b/src/Api/Controllers/UploadController.php index 72baec70..65d631b9 100644 --- a/src/Api/Controllers/UploadController.php +++ b/src/Api/Controllers/UploadController.php @@ -38,7 +38,7 @@ public function __construct(Dispatcher $bus) /** * @param \Psr\Http\Message\ServerRequestInterface $request - * @param \Tobscure\JsonApi\Document $request + * @param \Tobscure\JsonApi\Document $document * * @throws InvalidUploadException */ From 679f5160350a66f864ce2be1b4f45c861dd2ce07 Mon Sep 17 00:00:00 2001 From: Jasper Vriends <4417659+jaspervriends@users.noreply.github.com> Date: Wed, 10 Feb 2021 17:18:57 +0100 Subject: [PATCH 7/8] Added composer button visibility --- js/dist/admin.js | 14 +++++++++++-- js/dist/admin.js.map | 2 +- js/dist/forum.js | 20 +++++++++++------- js/dist/forum.js.map | 2 +- js/src/admin/components/UploadPage.js | 19 +++++++++++++++++ js/src/forum/addUploadButton.js | 30 ++++++++++++++++----------- resources/locale/en.yml | 9 ++++++++ src/Extenders/AddForumAttributes.php | 15 ++++++++++++++ 8 files changed, 88 insertions(+), 23 deletions(-) diff --git a/js/dist/admin.js b/js/dist/admin.js index ac0d05c0..3e0a5fcc 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -186,7 +186,7 @@ var UploadPage = /*#__PURE__*/function (_ExtensionPage) { this.loading = false; // the fields we need to watch and to save this.fields = [// image - 'resizeMaxWidth', 'cdnUrl', 'maxFileSize', 'whitelistedClientExtensions', // watermark + 'resizeMaxWidth', 'cdnUrl', 'maxFileSize', 'whitelistedClientExtensions', 'composerButtonVisiblity', // watermark 'watermark', 'watermarkPosition', // Imgur 'imgurClientId', // AWS 'awsS3Key', 'awsS3Secret', 'awsS3Bucket', 'awsS3Region', 'awsS3Endpoint', 'awsS3ACL', // QIniu @@ -206,6 +206,12 @@ var UploadPage = /*#__PURE__*/function (_ExtensionPage) { top: 'top', right: 'right', bottom: 'bottom' + }; // Composer button options + + this.composerButtonVisiblityOptions = { + 'both': flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.composer_buttons.options.both'), + 'upload-btn': flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.composer_buttons.options.upload-btn'), + 'media-btn': flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.composer_buttons.options.media-btn') }; // get the saved settings from the database var settings = flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.data.settings; // our package prefix (to be added to every field and checkbox in the setting table) @@ -303,7 +309,11 @@ var UploadPage = /*#__PURE__*/function (_ExtensionPage) { type: 'button', className: 'Button Button--warning', onclick: this.addMimeType.bind(this) - }, '+')])), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.mime_types')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.download_templates')), this.templateOptionsDescriptions()]), m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.resize.title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.resize')), flarum_components_Switch__WEBPACK_IMPORTED_MODULE_6___default.a.component({ + }, '+')])), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.mime_types')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.download_templates')), this.templateOptionsDescriptions()]), m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.composer_buttons.title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.composer_buttons')), m('div', [flarum_components_Select__WEBPACK_IMPORTED_MODULE_5___default.a.component({ + options: this.composerButtonVisiblityOptions, + onchange: this.values.composerButtonVisiblity, + value: this.values.composerButtonVisiblity() || 'both' + })])]), m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.resize.title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.resize')), flarum_components_Switch__WEBPACK_IMPORTED_MODULE_6___default.a.component({ state: this.values.mustResize() || false, onchange: this.values.mustResize }, flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.resize.toggle')), m('label', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.resize.max_width')), m('input', { diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index 9e793861..b150e7df 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/./admin.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/admin/components/UploadPage.js","webpack://@fof/upload/./src/admin/components/index.js","webpack://@fof/upload/./src/admin/index.js","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Select']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/upload/external \"flarum.core.compat['components/UploadImageButton']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/withAttr']\""],"names":["UploadPage","oninit","vnode","loading","fields","checkboxes","objects","watermarkPositions","center","left","top","right","bottom","settings","app","data","settingsPrefix","uploadMethodOptions","addPrefix","templateOptions","values","forEach","key","Stream","JSON","parse","defaultAdap","Object","keys","length","mimeTypes","adapter","template","newMimeType","regex","content","m","onsubmit","bind","translator","trans","value","maxFileSize","oninput","withAttr","type","min","map","mime","config","updateMimeTypeKey","Select","component","options","onchange","updateMimeTypeAdapter","getTemplateOptionsForInput","updateMimeTypeTemplate","Button","className","onclick","deleteMimeType","addMimeType","templateOptionsDescriptions","Switch","state","mustResize","resizeMaxWidth","disabled","whitelistedClientExtensions","addsWatermarks","watermarkPosition","UploadImageButton","name","disableHotlinkProtection","disableDownloadLogging","cdnUrl","adaptorItems","toArray","changed","items","ItemList","undefined","add","imgurClientId","qiniuKey","qiniuSecret","qiniuBucket","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3UsePathStyleEndpoint","awsS3ACL","option","hasOwnProperty","children","push","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":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAe;AACf;AACA;AACA;AACA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;IAEqBA,U;;;;;;;;;SACjBC,M,GAAA,gBAAOC,KAAP,EAAc;AAAA;;AACV,6BAAMD,MAAN,YAAaC,KAAb,EADU,CAEV;;;AACA,SAAKC,OAAL,GAAe,KAAf,CAHU,CAKV;;AACA,SAAKC,MAAL,GAAc,CACV;AACA,oBAFU,EAGV,QAHU,EAIV,aAJU,EAKV,6BALU,EAMV;AACA,eAPU,EAQV,mBARU,EASV;AACA,mBAVU,EAWV;AACA,cAZU,EAaV,aAbU,EAcV,aAdU,EAeV,aAfU,EAgBV,eAhBU,EAiBV,UAjBU,EAkBV;AACA,cAnBU,EAoBV,aApBU,EAqBV,aArBU,CAAd,CANU,CA8BV;;AACA,SAAKC,UAAL,GAAkB,CAAC,YAAD,EAAe,gBAAf,EAAiC,0BAAjC,EAA6D,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AGImF,cAAU,EAAE,qBAHhB;AAIIC,cAAU,EAAE;AAJhB,GAbR,EAmBQ,MAnBR,EAoBQ,EApBR;AAsBH,CAvBD,E;;;;;;;;;;;ACLA,2C;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,gE;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,oE;;;;;;;;;;;ACAA,sD;;;;;;;;;;;ACAA,oD;;;;;;;;;;;ACAA,0D;;;;;;;;;;;ACAA,sD","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 = \"./admin.js\");\n","export * from './src/admin';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import app from 'flarum/app';\nimport Button from 'flarum/components/Button';\nimport saveSettings from 'flarum/utils/saveSettings';\nimport Alert from 'flarum/components/Alert';\nimport Select from 'flarum/components/Select';\nimport Switch from 'flarum/components/Switch';\nimport UploadImageButton from 'flarum/components/UploadImageButton';\nimport withAttr from 'flarum/utils/withAttr';\nimport Stream from 'flarum/utils/Stream';\nimport ExtensionPage from 'flarum/components/ExtensionPage';\nimport ItemList from 'flarum/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 // 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 // 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', [\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('fof-upload.admin.buttons.save')\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(m('li', this.templateOptions[template].name + ': ' + 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.basics.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/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});\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['components/UploadImageButton'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['utils/withAttr'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/./admin.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/admin/components/UploadPage.js","webpack://@fof/upload/./src/admin/components/index.js","webpack://@fof/upload/./src/admin/index.js","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Select']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/upload/external \"flarum.core.compat['components/UploadImageButton']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/withAttr']\""],"names":["UploadPage","oninit","vnode","loading","fields","checkboxes","objects","watermarkPositions","center","left","top","right","bottom","composerButtonVisiblityOptions","app","translator","trans","settings","data","settingsPrefix","uploadMethodOptions","addPrefix","templateOptions","values","forEach","key","Stream","JSON","parse","defaultAdap","Object","keys","length","mimeTypes","adapter","template","newMimeType","regex","content","m","onsubmit","bind","value","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","name","disableHotlinkProtection","disableDownloadLogging","cdnUrl","adaptorItems","toArray","changed","items","ItemList","undefined","add","imgurClientId","qiniuKey","qiniuSecret","qiniuBucket","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3UsePathStyleEndpoint","awsS3ACL","option","hasOwnProperty","children","push","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":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAe;AACf;AACA;AACA;AACA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;IAEqBA,U;;;;;;;;;SACjBC,M,GAAA,gBAAOC,KAAP,EAAc;AAAA;;AACV,6BAAMD,MAAN,YAAaC,KAAb,EADU,CAEV;;;AACA,SAAKC,OAAL,GAAe,KAAf,CAHU,CA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ACAA,gE;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,oE;;;;;;;;;;;ACAA,sD;;;;;;;;;;;ACAA,oD;;;;;;;;;;;ACAA,0D;;;;;;;;;;;ACAA,sD","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 = \"./admin.js\");\n","export * from './src/admin';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import app from 'flarum/app';\nimport Button from 'flarum/components/Button';\nimport saveSettings from 'flarum/utils/saveSettings';\nimport Alert from 'flarum/components/Alert';\nimport Select from 'flarum/components/Select';\nimport Switch from 'flarum/components/Switch';\nimport UploadImageButton from 'flarum/components/UploadImageButton';\nimport withAttr from 'flarum/utils/withAttr';\nimport Stream from 'flarum/utils/Stream';\nimport ExtensionPage from 'flarum/components/ExtensionPage';\nimport ItemList from 'flarum/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', [\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('fof-upload.admin.buttons.save')\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(m('li', this.templateOptions[template].name + ': ' + 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.basics.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/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});\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['components/UploadImageButton'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['utils/withAttr'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 9bec6fc0..a5744b66 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -294,15 +294,21 @@ __webpack_require__.r(__webpack_exports__); this.uploader = new _handler_Uploader__WEBPACK_IMPORTED_MODULE_6__["default"](); }); Object(flarum_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_components_TextEditor__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'controlItems', function (items) { - if (!flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute('fof-upload.canUpload')) return; // Add media button + if (!flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute('fof-upload.canUpload')) return; + var composerButtonVisiblity = flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute("fof-upload.composerButtonVisiblity"); // Add media button + + if (composerButtonVisiblity === "both" || composerButtonVisiblity === "media-btn") { + items.add('fof-upload-media', _components_FileManagerButton__WEBPACK_IMPORTED_MODULE_7__["default"].component({ + uploader: this.uploader + })); + } // Add upload button - items.add('fof-upload-media', _components_FileManagerButton__WEBPACK_IMPORTED_MODULE_7__["default"].component({ - uploader: this.uploader - })); // Add upload button - items.add('fof-upload', _components_UploadButton__WEBPACK_IMPORTED_MODULE_3__["default"].component({ - uploader: this.uploader - })); + if (composerButtonVisiblity === "both" || composerButtonVisiblity === "upload-btn") { + items.add('fof-upload', _components_UploadButton__WEBPACK_IMPORTED_MODULE_3__["default"].component({ + uploader: this.uploader + })); + } }); Object(flarum_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_components_TextEditor__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'oncreate', function (f_, vnode) { var _this = this; diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 9d291a0c..956151d6 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/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","Component","oninit","selectedFiles","multiSelect","restrictFileType","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","setUser","session","inModal","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","hasMoreResults","loadMore","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","open","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","unshift","hasFiles"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;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tE;AAEAtE,KAAC,CAACC,MAAF;AAEA,WAAOkE,OAAP;AACH;AAED;;;;;SAGAb,S,GAAA,mBAAUrI,KAAV,EAAiB;AACb,QAAIoG,KAAK,CAACC,OAAN,CAAcrG,KAAd,CAAJ,EAA0B;AAAA;;AACtB,2BAAKA,KAAL,EAAWsJ,OAAX,qBAAsBtJ,KAAtB;AACH,KAFD,MAEO;AACH,WAAKA,KAAL,CAAWsJ,OAAX,CAAmBtJ,KAAnB;AACH;AACJ;AAED;;;;;SAGAuJ,Q,GAAA,oBAAW;AACP,WAAO,KAAKvJ,KAAL,CAAWuB,MAAX,GAAoB,CAA3B;AACH;AAED;;;;;SAGAgC,S,GAAA,qBAAY;AACR,WAAO,KAAKqF,OAAZ;AACH;AAED;;;;;SAGA1C,c,GAAA,0BAAiB;AACb,WAAO,KAAKyC,WAAZ;AACH;AAED;;;;;SAGA/C,K,GAAA,iBAAQ;AACJ,WAAO,CAAC,KAAK2D,QAAL,EAAD,IAAoB,CAAC,KAAKhG,SAAL,EAA5B;AACH,G;;;;;;;;;;;;;;;;AChHL,iD;;;;;;;;;;;ACAA,6C;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,mE;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,8C;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,mD","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\n switch (file.tag()) {\n // File\n case 'file':\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\n\n // Image template\n case 'image':\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\n\n // Image preview\n case 'image-preview':\n return `[upl-image-preview url=${file.url()}]`;\n\n // 'just-url' or unknown\n default:\n return file.url();\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml'];\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 = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];\n\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.indexOf(fileType) >= 0) {\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 Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport fileToBBcode from '../fileToBBcode';\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}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n\n /**\n * Generate bbcode for this file\n */\n bbcode() {\n return fileToBBcode(this);\n }\n}\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport TextEditor from 'flarum/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 // Add media button\n items.add(\n 'fof-upload-media',\n FileManagerButton.component({\n uploader: this.uploader,\n })\n );\n\n // Add upload button\n items.add(\n 'fof-upload',\n UploadButton.component({\n uploader: this.uploader,\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');\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 const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n const unloadHandler = () => {\n dragAndDrop.unload();\n };\n\n this.$('textarea').bind('onunload', unloadHandler);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\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","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport FileManagerModal from './FileManagerModal';\n\nexport default class FileManagerButton extends Component {\n view() {\n return Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n title: app.translator.trans('fof-upload.forum.buttons.media'),\n });\n }\n\n /**\n * Show tooltip on hover\n *\n * @param {*} vnode\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n this.$().tooltip();\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 Modal from 'flarum/components/Modal';\nimport Button from 'flarum/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 return (\n
\n
\n
\n {UploadButton.component({\n uploader: this.uploader,\n disabled: app.fileListState.isLoading(),\n isMediaUploadButton: true,\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 ?
{Alert.component(this.alertAttrs)}
: ''}\n\n
\n {UserFileList.component({\n user: this.attrs.user,\n selectable: true,\n onFileSelect: this.onFileSelect.bind(this),\n selectedFiles: this.selectedFiles,\n restrictFileType: this.restrictFileType\n })}\n
\n\n
\n {Button.component(\n {\n onclick: this.hide.bind(this),\n className: 'Button',\n },\n app.translator.trans('fof-upload.forum.buttons.cancel')\n )}\n\n {Button.component(\n {\n onclick: this.onSelect.bind(this),\n disabled: this.selectedFiles.length === 0 || (!this.multiSelect && this.selectedFiles.length > 1),\n className: 'Button Button--primary',\n },\n app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length)\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');\n });\n }\n}\n","export default class PasteClipboard {\n constructor(upload, textAreaElement) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\n // and need to stay as long as the textarea exists in the DOM\n textAreaElement.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/app';\nimport Component from 'flarum/Component';\nimport classList from 'flarum/utils/classList';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Button from 'flarum/components/Button';\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 oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n if (!this.isMediaUploadButton) {\n this.$().tooltip();\n }\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 Button.component(\n {\n className: classList([\n 'Button',\n 'hasIcon',\n 'fof-upload-button',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--icon',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--link',\n this.attrs.uploader.uploading && 'uploading',\n ]),\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\n onclick: this.uploadButtonClicked.bind(this),\n title: !this.isMediaUploadButton ? buttonText : null,\n disabled: this.attrs.disabled,\n },\n [\n this.attrs.uploader.uploading &&\n LoadingIndicator.component({\n size: 'tiny',\n className: 'LoadingIndicator--inline Button-icon',\n }),\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\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","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\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\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n }\n\n view() {\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 let fileClassNames = 'fof-file';\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n // File is image\n if (fileIcon === 'image') {\n fileClassNames += ' fof-file-type-image';\n }\n\n // File is selected\n if (this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\n fileClassNames += ' fof-file-selected';\n }\n\n return (\n
  • \n this.attrs.onFileSelect(file) : null}\n title={file.baseName()}\n disabled={!fileSelectable}\n >\n \n \n \n\n {fileIcon === 'image' && }\n\n {file.baseName()}\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.buttons.load_more_files')}\n \n
\n )}\n
\n );\n }\n\n /**\n * Check if a file is selectable\n *\n * @param {File} 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","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 app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport Post from 'flarum/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","export 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","import app from 'flarum/app';\n\nimport File from '../common/models/File';\nimport FileListState from './states/FileListState';\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\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","export 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","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","composerButtonVisiblity","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","Component","oninit","selectedFiles","multiSelect","restrictFileType","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","setUser","session","inModal","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","hasMoreResults","loadMore","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","open","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","unshift","hasFiles"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAe;AACf;AACA;AACA;AACA,C;;;;;;;;;;;;ACJA;A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ACJ;AAED;;;;;SAGAuJ,Q,GAAA,oBAAW;AACP,WAAO,KAAKvJ,KAAL,CAAWuB,MAAX,GAAoB,CAA3B;AACH;AAED;;;;;SAGAgC,S,GAAA,qBAAY;AACR,WAAO,KAAKqF,OAAZ;AACH;AAED;;;;;SAGA1C,c,GAAA,0BAAiB;AACb,WAAO,KAAKyC,WAAZ;AACH;AAED;;;;;SAGA/C,K,GAAA,iBAAQ;AACJ,WAAO,CAAC,KAAK2D,QAAL,EAAD,IAAoB,CAAC,KAAKhG,SAAL,EAA5B;AACH,G;;;;;;;;;;;;;;;;AChHL,iD;;;;;;;;;;;ACAA,6C;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,mE;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,8C;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,mD","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\n switch (file.tag()) {\n // File\n case 'file':\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\n\n // Image template\n case 'image':\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\n\n // Image preview\n case 'image-preview':\n return `[upl-image-preview url=${file.url()}]`;\n\n // 'just-url' or unknown\n default:\n return file.url();\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml'];\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 = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];\n\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.indexOf(fileType) >= 0) {\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 Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport fileToBBcode from '../fileToBBcode';\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}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n\n /**\n * Generate bbcode for this file\n */\n bbcode() {\n return fileToBBcode(this);\n }\n}\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport TextEditor from 'flarum/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');\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 const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n const unloadHandler = () => {\n dragAndDrop.unload();\n };\n\n this.$('textarea').bind('onunload', unloadHandler);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\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","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport FileManagerModal from './FileManagerModal';\n\nexport default class FileManagerButton extends Component {\n view() {\n return Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n title: app.translator.trans('fof-upload.forum.buttons.media'),\n });\n }\n\n /**\n * Show tooltip on hover\n *\n * @param {*} vnode\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n this.$().tooltip();\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 Modal from 'flarum/components/Modal';\nimport Button from 'flarum/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 return (\n
\n
\n
\n {UploadButton.component({\n uploader: this.uploader,\n disabled: app.fileListState.isLoading(),\n isMediaUploadButton: true,\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 ?
{Alert.component(this.alertAttrs)}
: ''}\n\n
\n {UserFileList.component({\n user: this.attrs.user,\n selectable: true,\n onFileSelect: this.onFileSelect.bind(this),\n selectedFiles: this.selectedFiles,\n restrictFileType: this.restrictFileType\n })}\n
\n\n
\n {Button.component(\n {\n onclick: this.hide.bind(this),\n className: 'Button',\n },\n app.translator.trans('fof-upload.forum.buttons.cancel')\n )}\n\n {Button.component(\n {\n onclick: this.onSelect.bind(this),\n disabled: this.selectedFiles.length === 0 || (!this.multiSelect && this.selectedFiles.length > 1),\n className: 'Button Button--primary',\n },\n app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length)\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');\n });\n }\n}\n","export default class PasteClipboard {\n constructor(upload, textAreaElement) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\n // and need to stay as long as the textarea exists in the DOM\n textAreaElement.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/app';\nimport Component from 'flarum/Component';\nimport classList from 'flarum/utils/classList';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Button from 'flarum/components/Button';\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 oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n if (!this.isMediaUploadButton) {\n this.$().tooltip();\n }\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 Button.component(\n {\n className: classList([\n 'Button',\n 'hasIcon',\n 'fof-upload-button',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--icon',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--link',\n this.attrs.uploader.uploading && 'uploading',\n ]),\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\n onclick: this.uploadButtonClicked.bind(this),\n title: !this.isMediaUploadButton ? buttonText : null,\n disabled: this.attrs.disabled,\n },\n [\n this.attrs.uploader.uploading &&\n LoadingIndicator.component({\n size: 'tiny',\n className: 'LoadingIndicator--inline Button-icon',\n }),\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\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","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\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\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n }\n\n view() {\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 let fileClassNames = 'fof-file';\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n // File is image\n if (fileIcon === 'image') {\n fileClassNames += ' fof-file-type-image';\n }\n\n // File is selected\n if (this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\n fileClassNames += ' fof-file-selected';\n }\n\n return (\n
  • \n this.attrs.onFileSelect(file) : null}\n title={file.baseName()}\n disabled={!fileSelectable}\n >\n \n \n \n\n {fileIcon === 'image' && }\n\n {file.baseName()}\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.buttons.load_more_files')}\n \n
\n )}\n
\n );\n }\n\n /**\n * Check if a file is selectable\n *\n * @param {File} 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","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 app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport Post from 'flarum/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","export 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","import app from 'flarum/app';\n\nimport File from '../common/models/File';\nimport FileListState from './states/FileListState';\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\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","export 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","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/admin/components/UploadPage.js b/js/src/admin/components/UploadPage.js index 22972c1a..00a7a73c 100644 --- a/js/src/admin/components/UploadPage.js +++ b/js/src/admin/components/UploadPage.js @@ -25,6 +25,7 @@ export default class UploadPage extends ExtensionPage { 'cdnUrl', 'maxFileSize', 'whitelistedClientExtensions', + 'composerButtonVisiblity', // watermark 'watermark', 'watermarkPosition', @@ -62,6 +63,13 @@ export default class UploadPage extends ExtensionPage { bottom: 'bottom', }; + // Composer button options + this.composerButtonVisiblityOptions = { + 'both' : app.translator.trans('fof-upload.admin.labels.composer_buttons.options.both'), + 'upload-btn' : app.translator.trans('fof-upload.admin.labels.composer_buttons.options.upload-btn'), + 'media-btn' : app.translator.trans('fof-upload.admin.labels.composer_buttons.options.media-btn') + } + // get the saved settings from the database const settings = app.data.settings; @@ -193,6 +201,17 @@ export default class UploadPage extends ExtensionPage { m('.helpText', app.translator.trans('fof-upload.admin.help_texts.download_templates')), this.templateOptionsDescriptions(), ]), + m('fieldset', [ + m('legend', app.translator.trans('fof-upload.admin.labels.composer_buttons.title')), + m('.helpText', app.translator.trans('fof-upload.admin.help_texts.composer_buttons')), + m('div', [ + Select.component({ + options: this.composerButtonVisiblityOptions, + onchange: this.values.composerButtonVisiblity, + value: this.values.composerButtonVisiblity() || 'both', + }), + ]) + ]), m('fieldset', [ m('legend', app.translator.trans('fof-upload.admin.labels.resize.title')), m('.helpText', app.translator.trans('fof-upload.admin.help_texts.resize')), diff --git a/js/src/forum/addUploadButton.js b/js/src/forum/addUploadButton.js index 76e773bd..269f99fc 100644 --- a/js/src/forum/addUploadButton.js +++ b/js/src/forum/addUploadButton.js @@ -14,21 +14,27 @@ export default function () { extend(TextEditor.prototype, 'controlItems', function (items) { if (!app.forum.attribute('fof-upload.canUpload')) return; + const composerButtonVisiblity = app.forum.attribute("fof-upload.composerButtonVisiblity"); + // Add media button - items.add( - 'fof-upload-media', - FileManagerButton.component({ - uploader: this.uploader, - }) - ); + if(composerButtonVisiblity === "both" || composerButtonVisiblity === "media-btn") { + items.add( + 'fof-upload-media', + FileManagerButton.component({ + uploader: this.uploader, + }) + ); + } // Add upload button - items.add( - 'fof-upload', - UploadButton.component({ - uploader: this.uploader, - }) - ); + if(composerButtonVisiblity === "both" || composerButtonVisiblity === "upload-btn") { + items.add( + 'fof-upload', + UploadButton.component({ + uploader: this.uploader, + }) + ); + } }); extend(TextEditor.prototype, 'oncreate', function (f_, vnode) { diff --git a/resources/locale/en.yml b/resources/locale/en.yml index 689d08c3..f25a0331 100644 --- a/resources/locale/en.yml +++ b/resources/locale/en.yml @@ -26,6 +26,8 @@ fof-upload: The following settings are only required when using S3 compatible storage. If you use AWS, you can leave them blank. s3_acl: | The ACL that should be applied to the uploaded object (default: private). For possible values, see https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl + composer_buttons: | + By default both the media manager button and upload button are visible. You can also choose to display only one button. labels: aws-s3: bucket: Bucket @@ -69,6 +71,13 @@ fof-upload: position: Watermark position title: Watermark images toggle: Watermark images + composer_buttons: + title: Composer buttons + options: + both: Both + upload-btn: Upload button only + media-btn: Media manager button only + permissions: download_label: Download files upload_label: Upload files diff --git a/src/Extenders/AddForumAttributes.php b/src/Extenders/AddForumAttributes.php index 35165129..2db94720 100644 --- a/src/Extenders/AddForumAttributes.php +++ b/src/Extenders/AddForumAttributes.php @@ -13,13 +13,28 @@ namespace FoF\Upload\Extenders; use Flarum\Api\Serializer\ForumSerializer; +use Flarum\Settings\SettingsRepositoryInterface; class AddForumAttributes { + private $settings; + + /** + * @param SettingsRepositoryInterface $settings + */ + public function __construct(SettingsRepositoryInterface $settings) + { + $this->settings = $settings; + } + + /** + * @param ForumSerializer $serializer + */ public function __invoke(ForumSerializer $serializer) { $attributes['fof-upload.canUpload'] = $serializer->getActor()->can('fof-upload.upload'); $attributes['fof-upload.canDownload'] = $serializer->getActor()->can('fof-upload.download'); + $attributes['fof-upload.composerButtonVisiblity'] = $this->settings->get('fof-upload.composerButtonVisiblity', 'both'); return $attributes; } From e3f46ab38a2b5fb4f0895b686dc824929f6bd770 Mon Sep 17 00:00:00 2001 From: Jasper Vriends <4417659+jaspervriends@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:47:04 +0100 Subject: [PATCH 8/8] Added user uploads to profile page --- js/dist/admin.js | 10 +- js/dist/admin.js.map | 2 +- js/dist/forum.js | 178 +++++++++++++++--- js/dist/forum.js.map | 2 +- js/src/admin/components/UploadPage.js | 12 +- js/src/admin/index.js | 9 + js/src/forum/addUploadButton.js | 6 +- js/src/forum/components/FileManagerButton.js | 2 +- js/src/forum/components/FileManagerModal.js | 12 +- js/src/forum/components/UploadsUserPage.js | 30 +++ js/src/forum/components/UserFileList.js | 25 ++- js/src/forum/index.js | 32 ++++ ...dd_uploads_view_and_delete_permissions.php | 19 ++ resources/locale/en.yml | 5 +- src/Api/Controllers/ListUploadsController.php | 4 +- src/Extenders/AddForumAttributes.php | 1 + 16 files changed, 297 insertions(+), 52 deletions(-) create mode 100644 js/src/forum/components/UploadsUserPage.js create mode 100644 migrations/2021_02_11_01_add_uploads_view_and_delete_permissions.php diff --git a/js/dist/admin.js b/js/dist/admin.js index 3e0a5fcc..614274ff 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -209,7 +209,7 @@ var UploadPage = /*#__PURE__*/function (_ExtensionPage) { }; // Composer button options this.composerButtonVisiblityOptions = { - 'both': flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.composer_buttons.options.both'), + both: flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.composer_buttons.options.both'), 'upload-btn': flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.composer_buttons.options.upload-btn'), 'media-btn': flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.composer_buttons.options.media-btn') }; // get the saved settings from the database @@ -309,7 +309,7 @@ var UploadPage = /*#__PURE__*/function (_ExtensionPage) { type: 'button', className: 'Button Button--warning', onclick: this.addMimeType.bind(this) - }, '+')])), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.mime_types')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.download_templates')), this.templateOptionsDescriptions()]), m('fieldset', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.composer_buttons.title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.composer_buttons')), m('div', [flarum_components_Select__WEBPACK_IMPORTED_MODULE_5___default.a.component({ + }, '+')])), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.mime_types')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.download_templates')), this.templateOptionsDescriptions()]), m('fieldset.composerButtons', [m('legend', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.labels.composer_buttons.title')), m('.helpText', flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.admin.help_texts.composer_buttons')), m('div', [flarum_components_Select__WEBPACK_IMPORTED_MODULE_5___default.a.component({ options: this.composerButtonVisiblityOptions, onchange: this.values.composerButtonVisiblity, value: this.values.composerButtonVisiblity() || 'both' @@ -587,7 +587,11 @@ flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.initializers.add('fof-upload', label: app.translator.trans('fof-upload.admin.permissions.download_label'), permission: 'fof-upload.download', allowGuest: true - }, 'view', 50); + }, 'view', 50).registerPermission({ + icon: 'fas fa-eye', + label: app.translator.trans('fof-upload.admin.permissions.view_user_uploads_label'), + permission: 'fof-upload.viewUserUploads' + }, 'moderate', 50); }); /***/ }), diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index b150e7df..3b0c9c24 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/./admin.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/admin/components/UploadPage.js","webpack://@fof/upload/./src/admin/components/index.js","webpack://@fof/upload/./src/admin/index.js","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Select']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/upload/external \"flarum.core.compat['components/UploadImageButton']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/withAttr']\""],"names":["UploadPage","oninit","vnode","loading","fields","checkboxes","objects","watermarkPositions","center","left","top","right","bottom","composerButtonVisiblityOptions","app","translator","trans","settings","data","settingsPrefix","uploadMethodOptions","addPrefix","templateOptions","values","forEach","key","Stream","JSON","parse","defaultAdap","Object","keys","length","mimeTypes","adapter","template","newMimeType","regex","content","m","onsubmit","bind","value","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","name","disableHotlinkProtection","disableDownloadLogging","cdnUrl","adaptorItems","toArray","changed","items","ItemList","undefined","add","imgurClientId","qiniuKey","qiniuSecret","qiniuBucket","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3UsePathStyleEndpoint","awsS3ACL","option","hasOwnProperty","children","push","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":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;Q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A;AAAA;AAAA;AAEO,IAAMC,UAAU,GAAG;AACtBtH,YAAU,EAAVA,mDAAUA;AADY,CAAnB,C;;;;;;;;;;;;ACFP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AAEAc,iDAAG,CAACyG,YAAJ,CAAiBlC,GAAjB,CAAqB,YAArB,EAAmC,UAACvE,GAAD,EAAS;AACxCA,KAAG,CAAC0G,aAAJ,QACS,YADT,EAEKC,YAFL,CAEkBzH,8DAFlB,EAGK0H,kBAHL,CAIQ;AACIC,QAAI,EAAE,aADV;AAEIC,SAAK,EAAE9G,GAAG,CAACC,UAAJ,CAAeC,KAAf,CAAqB,2CAArB,CAFX;AAGI6G,cAAU,EAAE;AAHhB,GAJR,EASQ,OATR,EAUQ,EAVR,EAYKH,kBAZL,CAaQ;AACIC,QAAI,EAAE,iBADV;AAEIC,SAAK,EAAE9G,GAAG,CAACC,UAAJ,CAAeC,KAAf,CAAqB,6CAArB,CAFX;AAGI6G,cAAU,EAAE,qBAHhB;AAIIC,cAAU,EAAE;AAJhB,GAbR,EAmBQ,MAnBR,EAoBQ,EApBR;AAsBH,CAvBD,E;;;;;;;;;;;ACLA,2C;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,gE;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,oE;;;;;;;;;;;ACAA,sD;;;;;;;;;;;ACAA,oD;;;;;;;;;;;ACAA,0D;;;;;;;;;;;ACAA,sD","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 = \"./admin.js\");\n","export * from './src/admin';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import app from 'flarum/app';\nimport Button from 'flarum/components/Button';\nimport saveSettings from 'flarum/utils/saveSettings';\nimport Alert from 'flarum/components/Alert';\nimport Select from 'flarum/components/Select';\nimport Switch from 'flarum/components/Switch';\nimport UploadImageButton from 'flarum/components/UploadImageButton';\nimport withAttr from 'flarum/utils/withAttr';\nimport Stream from 'flarum/utils/Stream';\nimport ExtensionPage from 'flarum/components/ExtensionPage';\nimport ItemList from 'flarum/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', [\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('fof-upload.admin.buttons.save')\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(m('li', this.templateOptions[template].name + ': ' + 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.basics.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/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});\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['components/UploadImageButton'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['utils/withAttr'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/./admin.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/admin/components/UploadPage.js","webpack://@fof/upload/./src/admin/components/index.js","webpack://@fof/upload/./src/admin/index.js","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Select']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/upload/external \"flarum.core.compat['components/UploadImageButton']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/withAttr']\""],"names":["UploadPage","oninit","vnode","loading","fields","checkboxes","objects","watermarkPositions","center","left","top","right","bottom","composerButtonVisiblityOptions","both","app","translator","trans","settings","data","settingsPrefix","uploadMethodOptions","addPrefix","templateOptions","values","forEach","key","Stream","JSON","parse","defaultAdap","Object","keys","length","mimeTypes","adapter","template","newMimeType","regex","content","m","onsubmit","bind","value","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","name","disableHotlinkProtection","disableDownloadLogging","cdnUrl","adaptorItems","toArray","changed","items","ItemList","undefined","add","imgurClientId","qiniuKey","qiniuSecret","qiniuBucket","awsS3Key","awsS3Secret","awsS3Bucket","awsS3Region","awsS3Endpoint","awsS3UsePathStyleEndpoint","awsS3ACL","option","hasOwnProperty","children","push","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":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAe;AACf;AACA;AACA;AACA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;IAEqBA,U;;;;;;;;;SACjBC,M,GAAA,gBAAOC,KAAP,EAAc;AAAA;;AACV,6BAAMD,MAAN,YAAaC,KAAb,EADU,CAEV;;;AACA,SAAKC,OAAL,GAAe,KAAf,CAHU,CAKV;;AACA,SAAKC,MAAL,GAAc,CACV;AACA,oBAFU,EAGV,QAHU,EAIV,aAJU,EAKV,6BALU,EAMV,yBANU,EAOV;AACA,eARU,EASV,mBATU,EAUV;AACA,mBAXU,EAYV;AACA,cAbU,EAcV,aAdU,EAeV,aAfU,EAgBV,aAh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ACAA,yD;;;;;;;;;;;ACAA,gE;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,oE;;;;;;;;;;;ACAA,sD;;;;;;;;;;;ACAA,oD;;;;;;;;;;;ACAA,0D;;;;;;;;;;;ACAA,sD","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 = \"./admin.js\");\n","export * from './src/admin';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import app from 'flarum/app';\nimport Button from 'flarum/components/Button';\nimport saveSettings from 'flarum/utils/saveSettings';\nimport Alert from 'flarum/components/Alert';\nimport Select from 'flarum/components/Select';\nimport Switch from 'flarum/components/Switch';\nimport UploadImageButton from 'flarum/components/UploadImageButton';\nimport withAttr from 'flarum/utils/withAttr';\nimport Stream from 'flarum/utils/Stream';\nimport ExtensionPage from 'flarum/components/ExtensionPage';\nimport ItemList from 'flarum/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('fof-upload.admin.buttons.save')\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(m('li', this.templateOptions[template].name + ': ' + 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.basics.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/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});\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/ExtensionPage'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['components/UploadImageButton'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['utils/withAttr'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index a5744b66..7e81b209 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -295,16 +295,16 @@ __webpack_require__.r(__webpack_exports__); }); Object(flarum_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_components_TextEditor__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'controlItems', function (items) { if (!flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute('fof-upload.canUpload')) return; - var composerButtonVisiblity = flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute("fof-upload.composerButtonVisiblity"); // Add media button + var composerButtonVisiblity = flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute('fof-upload.composerButtonVisiblity'); // Add media button - if (composerButtonVisiblity === "both" || composerButtonVisiblity === "media-btn") { + if (composerButtonVisiblity === 'both' || composerButtonVisiblity === 'media-btn') { items.add('fof-upload-media', _components_FileManagerButton__WEBPACK_IMPORTED_MODULE_7__["default"].component({ uploader: this.uploader })); } // Add upload button - if (composerButtonVisiblity === "both" || composerButtonVisiblity === "upload-btn") { + if (composerButtonVisiblity === 'both' || composerButtonVisiblity === 'upload-btn') { items.add('fof-upload', _components_UploadButton__WEBPACK_IMPORTED_MODULE_3__["default"].component({ uploader: this.uploader })); @@ -627,11 +627,11 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { disabled: app.fileListState.isLoading(), isMediaUploadButton: true })), m("div", { - className: 'fof-drag-and-drop' + className: "fof-drag-and-drop" }, m("div", { - className: 'fof-drag-and-drop-release' + className: "fof-drag-and-drop-release" }, m("i", { - className: 'fas fa-cloud-upload-alt' + className: "fas fa-cloud-upload-alt" }), app.translator.trans('fof-upload.forum.file_list.release_to_upload'))), m("div", { className: "Modal-header" }, m("h3", { @@ -639,7 +639,7 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { }, app.translator.trans('fof-upload.forum.media_manager'))), this.alertAttrs ? m("div", { className: "Modal-alert" }, Alert.component(this.alertAttrs)) : '', m("div", { - className: 'Modal-body' + className: "Modal-body" }, _UserFileList__WEBPACK_IMPORTED_MODULE_4__["default"].component({ user: this.attrs.user, selectable: true, @@ -647,7 +647,7 @@ var FileManagerModal = /*#__PURE__*/function (_Modal) { selectedFiles: this.selectedFiles, restrictFileType: this.restrictFileType })), m("div", { - className: 'Modal-footer' + className: "Modal-footer" }, flarum_components_Button__WEBPACK_IMPORTED_MODULE_2___default.a.component({ onclick: this.hide.bind(this), className: 'Button' @@ -885,6 +885,62 @@ var UploadButton = /*#__PURE__*/function (_Component) { +/***/ }), + +/***/ "./src/forum/components/UploadsUserPage.js": +/*!*************************************************!*\ + !*** ./src/forum/components/UploadsUserPage.js ***! + \*************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return UploadsUserPage; }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_components_UserPage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/components/UserPage */ "flarum/components/UserPage"); +/* harmony import */ var flarum_components_UserPage__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_components_UserPage__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _UserFileList__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./UserFileList */ "./src/forum/components/UserFileList.js"); + + + + +var UploadsUserPage = /*#__PURE__*/function (_UserPage) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(UploadsUserPage, _UserPage); + + function UploadsUserPage() { + return _UserPage.apply(this, arguments) || this; + } + + var _proto = UploadsUserPage.prototype; + + _proto.oninit = function oninit(vnode) { + _UserPage.prototype.oninit.call(this, vnode); + + this.user = null; + this.loadUser(m.route.param('username')); + }; + + _proto.content = function content() { + if (this.user !== app.session.user && !app.forum.attribute('fof-upload.canViewUserUploads')) return null; + return this.user && _UserFileList__WEBPACK_IMPORTED_MODULE_2__["default"].component({ + user: this.user, + selectable: false, + downloadOnClick: true + }); + }; + + _proto.show = function show(user) { + _UserPage.prototype.show.call(this, user); + + this.user = user; + }; + + return UploadsUserPage; +}(flarum_components_UserPage__WEBPACK_IMPORTED_MODULE_1___default.a); + + + /***/ }), /***/ "./src/forum/components/UserFileList.js": @@ -927,6 +983,7 @@ var UserFileList = /*#__PURE__*/function (_Component) { app.fileListState.setUser(vnode.attrs.user || app.session.user); this.inModal = vnode.attrs.selectable; this.restrictFileType = vnode.attrs.restrictFileType || null; + this.downloadOnClick = this.attrs.downloadOnClick || false; }; _proto.view = function view() { @@ -941,9 +998,9 @@ var UserFileList = /*#__PURE__*/function (_Component) { className: 'fof-upload-empty' }, m("i", { className: 'fas fa-cloud-upload-alt fof-upload-empty-icon' - }), app.translator.trans("fof-upload.forum.file_list.modal_empty_" + (app.screen() !== 'phone' ? 'desktop' : 'phone'))), !this.inModal && state.empty()(m("p", { + }), app.translator.trans("fof-upload.forum.file_list.modal_empty_" + (app.screen() !== 'phone' ? 'desktop' : 'phone'))), !this.inModal && state.empty() && m("p", { className: 'fof-upload-empty' - }, app.translator.trans('fof-upload.forum.file_list.empty'))), m("ul", null, state.files.map(function (file) { + }, app.translator.trans('fof-upload.forum.file_list.empty')), m("ul", null, state.files.map(function (file) { var fileClassNames = 'fof-file'; var fileIcon = Object(_common_mimeToIcon__WEBPACK_IMPORTED_MODULE_4__["default"])(file.type()); var fileSelectable = _this.restrictFileType ? _this.isSelectable(file) : true; // File is image @@ -959,9 +1016,9 @@ var UserFileList = /*#__PURE__*/function (_Component) { return m("li", null, m("button", { className: fileClassNames, - onclick: _this.attrs.onFileSelect ? function () { - return _this.attrs.onFileSelect(file); - } : null, + onclick: function onclick() { + return _this.onFileClick(file); + }, title: file.baseName(), disabled: !fileSelectable }, m("span", { @@ -986,6 +1043,26 @@ var UserFileList = /*#__PURE__*/function (_Component) { } }, app.translator.trans('fof-upload.forum.buttons.load_more_files')))); } + /** + * Execute function on file click + * + * @param {*} file + */ + ; + + _proto.onFileClick = function onFileClick(file) { + // Custom functionality + if (this.attrs.onFileSelect) { + this.attrs.onFileSelect(file); + return; + } // Download on click + + + if (this.attrs.downloadOnClick) { + window.open(file.url()); + return; + } + } /** * Check if a file is selectable * @@ -1198,28 +1275,55 @@ var Uploader = /*#__PURE__*/function () { "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/app */ "flarum/app"); -/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_app__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _common_models_File__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/models/File */ "./src/common/models/File.js"); -/* harmony import */ var _states_FileListState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./states/FileListState */ "./src/forum/states/FileListState.js"); -/* harmony import */ var _downloadButtonInteraction__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./downloadButtonInteraction */ "./src/forum/downloadButtonInteraction.js"); -/* harmony import */ var _addUploadButton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./addUploadButton */ "./src/forum/addUploadButton.js"); -/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components */ "./src/forum/components/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "components", function() { return _components__WEBPACK_IMPORTED_MODULE_5__["components"]; }); +/* harmony import */ var flarum_extend__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/extend */ "flarum/extend"); +/* harmony import */ var flarum_extend__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_extend__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/app */ "flarum/app"); +/* harmony import */ var flarum_app__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_app__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_components_UserPage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/components/UserPage */ "flarum/components/UserPage"); +/* harmony import */ var flarum_components_UserPage__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_components_UserPage__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_components_LinkButton__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/components/LinkButton */ "flarum/components/LinkButton"); +/* harmony import */ var flarum_components_LinkButton__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_components_LinkButton__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _common_models_File__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/models/File */ "./src/common/models/File.js"); +/* harmony import */ var _states_FileListState__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./states/FileListState */ "./src/forum/states/FileListState.js"); +/* harmony import */ var _downloadButtonInteraction__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./downloadButtonInteraction */ "./src/forum/downloadButtonInteraction.js"); +/* harmony import */ var _addUploadButton__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./addUploadButton */ "./src/forum/addUploadButton.js"); +/* harmony import */ var _components_UploadsUserPage__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/UploadsUserPage */ "./src/forum/components/UploadsUserPage.js"); +/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components */ "./src/forum/components/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "components", function() { return _components__WEBPACK_IMPORTED_MODULE_9__["components"]; }); + + + + + +flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.initializers.add('fof-upload', function () { + Object(_addUploadButton__WEBPACK_IMPORTED_MODULE_7__["default"])(); + Object(_downloadButtonInteraction__WEBPACK_IMPORTED_MODULE_6__["default"])(); // File model -flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.initializers.add('fof-upload', function () { - Object(_addUploadButton__WEBPACK_IMPORTED_MODULE_4__["default"])(); - Object(_downloadButtonInteraction__WEBPACK_IMPORTED_MODULE_3__["default"])(); // File model + flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.store.models.files = _common_models_File__WEBPACK_IMPORTED_MODULE_4__["default"]; // File list state - flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.store.models.files = _common_models_File__WEBPACK_IMPORTED_MODULE_1__["default"]; // File list state + flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.fileListState = new _states_FileListState__WEBPACK_IMPORTED_MODULE_5__["default"](); // Add user uploads to the user profile - flarum_app__WEBPACK_IMPORTED_MODULE_0___default.a.fileListState = new _states_FileListState__WEBPACK_IMPORTED_MODULE_2__["default"](); + flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.routes['user.uploads'] = { + path: '/u/:username/uploads', + component: _components_UploadsUserPage__WEBPACK_IMPORTED_MODULE_8__["default"] + }; // Add uploads to user page menu items + + Object(flarum_extend__WEBPACK_IMPORTED_MODULE_0__["extend"])(flarum_components_UserPage__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'navItems', function (items) { + if (this.user !== flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.session.user && !flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.forum.attribute('fof-upload.canViewUserUploads')) return; + items.add('uploads', flarum_components_LinkButton__WEBPACK_IMPORTED_MODULE_3___default.a.component({ + href: flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.route('user.uploads', { + username: this.user.username() + }), + name: 'uploads', + icon: 'fas fa-file-upload' + }, this.user === flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.session.user ? flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.forum.buttons.media') : flarum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('fof-upload.forum.buttons.user_uploads')), 80); + }); }); /***/ }), @@ -1405,6 +1509,17 @@ module.exports = flarum.core.compat['components/Button']; /***/ }), +/***/ "flarum/components/LinkButton": +/*!**************************************************************!*\ + !*** external "flarum.core.compat['components/LinkButton']" ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/LinkButton']; + +/***/ }), + /***/ "flarum/components/LoadingIndicator": /*!********************************************************************!*\ !*** external "flarum.core.compat['components/LoadingIndicator']" ***! @@ -1449,6 +1564,17 @@ module.exports = flarum.core.compat['components/TextEditor']; /***/ }), +/***/ "flarum/components/UserPage": +/*!************************************************************!*\ + !*** external "flarum.core.compat['components/UserPage']" ***! + \************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = flarum.core.compat['components/UserPage']; + +/***/ }), + /***/ "flarum/extend": /*!***********************************************!*\ !*** external "flarum.core.compat['extend']" ***! diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 956151d6..0b3ba0e7 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/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","composerButtonVisiblity","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","Component","oninit","selectedFiles","multiSelect","restrictFileType","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","setUser","session","inModal","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","hasMoreResults","loadMore","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","open","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","unshift","hasFiles"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;Q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AAA,sBAAaC,OAAb,EAAsB;AAAA;;AAClB,wBAAKlJ,KAAL,EAAWoE,IAAX,oBAAmB8E,OAAnB;;AAEA,SAAKN,OAAL,GAAe,KAAf;AACA,SAAKD,WAAL,GAAmB,CAAC,CAACO,OAAO,CAACC,OAAR,CAAgBC,KAAlB,IAA2B,CAAC,CAACF,OAAO,CAACC,OAAR,CAAgBC,KAAhB,CAAsBC,IAAtE;AAEAtE,KAAC,CAACC,MAAF;AAEA,WAAOkE,OAAP;AACH;AAED;;;;;SAGAb,S,GAAA,mBAAUrI,KAAV,EAAiB;AACb,QAAIoG,KAAK,CAACC,OAAN,CAAcrG,KAAd,CAAJ,EAA0B;AAAA;;AACtB,2BAAKA,KAAL,EAAWsJ,OAAX,qBAAsBtJ,KAAtB;AACH,KAFD,MAEO;AACH,WAAKA,KAAL,CAAWsJ,OAAX,CAAmBtJ,KAAnB;AACH;AACJ;AAED;;;;;SAGAuJ,Q,GAAA,oBAAW;AACP,WAAO,KAAKvJ,KAAL,CAAWuB,MAAX,GAAoB,CAA3B;AACH;AAED;;;;;SAGAgC,S,GAAA,qBAAY;AACR,WAAO,KAAKqF,OAAZ;AACH;AAED;;;;;SAGA1C,c,GAAA,0BAAiB;AACb,WAAO,KAAKyC,WAAZ;AACH;AAED;;;;;SAGA/C,K,GAAA,iBAAQ;AACJ,WAAO,CAAC,KAAK2D,QAAL,EAAD,IAAoB,CAAC,KAAKhG,SAAL,EAA5B;AACH,G;;;;;;;;;;;;;;;;AChHL,iD;;;;;;;;;;;ACAA,6C;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,mE;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,8C;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,mD","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\n switch (file.tag()) {\n // File\n case 'file':\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\n\n // Image template\n case 'image':\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\n\n // Image preview\n case 'image-preview':\n return `[upl-image-preview url=${file.url()}]`;\n\n // 'just-url' or unknown\n default:\n return file.url();\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml'];\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 = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];\n\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.indexOf(fileType) >= 0) {\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 Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport fileToBBcode from '../fileToBBcode';\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}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n\n /**\n * Generate bbcode for this file\n */\n bbcode() {\n return fileToBBcode(this);\n }\n}\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport TextEditor from 'flarum/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');\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 const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n const unloadHandler = () => {\n dragAndDrop.unload();\n };\n\n this.$('textarea').bind('onunload', unloadHandler);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\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","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport FileManagerModal from './FileManagerModal';\n\nexport default class FileManagerButton extends Component {\n view() {\n return Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n title: app.translator.trans('fof-upload.forum.buttons.media'),\n });\n }\n\n /**\n * Show tooltip on hover\n *\n * @param {*} vnode\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n this.$().tooltip();\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 Modal from 'flarum/components/Modal';\nimport Button from 'flarum/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 return (\n
\n
\n
\n {UploadButton.component({\n uploader: this.uploader,\n disabled: app.fileListState.isLoading(),\n isMediaUploadButton: true,\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 ?
{Alert.component(this.alertAttrs)}
: ''}\n\n
\n {UserFileList.component({\n user: this.attrs.user,\n selectable: true,\n onFileSelect: this.onFileSelect.bind(this),\n selectedFiles: this.selectedFiles,\n restrictFileType: this.restrictFileType\n })}\n
\n\n
\n {Button.component(\n {\n onclick: this.hide.bind(this),\n className: 'Button',\n },\n app.translator.trans('fof-upload.forum.buttons.cancel')\n )}\n\n {Button.component(\n {\n onclick: this.onSelect.bind(this),\n disabled: this.selectedFiles.length === 0 || (!this.multiSelect && this.selectedFiles.length > 1),\n className: 'Button Button--primary',\n },\n app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length)\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');\n });\n }\n}\n","export default class PasteClipboard {\n constructor(upload, textAreaElement) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\n // and need to stay as long as the textarea exists in the DOM\n textAreaElement.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/app';\nimport Component from 'flarum/Component';\nimport classList from 'flarum/utils/classList';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Button from 'flarum/components/Button';\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 oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n if (!this.isMediaUploadButton) {\n this.$().tooltip();\n }\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 Button.component(\n {\n className: classList([\n 'Button',\n 'hasIcon',\n 'fof-upload-button',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--icon',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--link',\n this.attrs.uploader.uploading && 'uploading',\n ]),\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\n onclick: this.uploadButtonClicked.bind(this),\n title: !this.isMediaUploadButton ? buttonText : null,\n disabled: this.attrs.disabled,\n },\n [\n this.attrs.uploader.uploading &&\n LoadingIndicator.component({\n size: 'tiny',\n className: 'LoadingIndicator--inline Button-icon',\n }),\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\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","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\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\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n }\n\n view() {\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 let fileClassNames = 'fof-file';\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n // File is image\n if (fileIcon === 'image') {\n fileClassNames += ' fof-file-type-image';\n }\n\n // File is selected\n if (this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\n fileClassNames += ' fof-file-selected';\n }\n\n return (\n
  • \n this.attrs.onFileSelect(file) : null}\n title={file.baseName()}\n disabled={!fileSelectable}\n >\n \n \n \n\n {fileIcon === 'image' && }\n\n {file.baseName()}\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.buttons.load_more_files')}\n \n
\n )}\n
\n );\n }\n\n /**\n * Check if a file is selectable\n *\n * @param {File} 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","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 app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport Post from 'flarum/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","export 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","import app from 'flarum/app';\n\nimport File from '../common/models/File';\nimport FileListState from './states/FileListState';\nimport downloadButtonInteraction from './downloadButtonInteraction';\nimport addUploadButton from './addUploadButton';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\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","export 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","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/upload/webpack/bootstrap","webpack://@fof/upload/./forum.js","webpack://@fof/upload/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/upload/./src/common/fileToBBcode.js","webpack://@fof/upload/./src/common/mimeToIcon.js","webpack://@fof/upload/./src/common/models/File.js","webpack://@fof/upload/./src/forum/addUploadButton.js","webpack://@fof/upload/./src/forum/components/DragAndDrop.js","webpack://@fof/upload/./src/forum/components/FileManagerButton.js","webpack://@fof/upload/./src/forum/components/FileManagerModal.js","webpack://@fof/upload/./src/forum/components/PasteClipboard.js","webpack://@fof/upload/./src/forum/components/UploadButton.js","webpack://@fof/upload/./src/forum/components/UploadsUserPage.js","webpack://@fof/upload/./src/forum/components/UserFileList.js","webpack://@fof/upload/./src/forum/components/index.js","webpack://@fof/upload/./src/forum/downloadButtonInteraction.js","webpack://@fof/upload/./src/forum/handler/Uploader.js","webpack://@fof/upload/./src/forum/index.js","webpack://@fof/upload/./src/forum/states/FileListState.js","webpack://@fof/upload/external \"flarum.core.compat['Component']\"","webpack://@fof/upload/external \"flarum.core.compat['Model']\"","webpack://@fof/upload/external \"flarum.core.compat['app']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Button']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LinkButton']\"","webpack://@fof/upload/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/upload/external \"flarum.core.compat['components/Post']\"","webpack://@fof/upload/external \"flarum.core.compat['components/TextEditor']\"","webpack://@fof/upload/external \"flarum.core.compat['components/UserPage']\"","webpack://@fof/upload/external \"flarum.core.compat['extend']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/classList']\"","webpack://@fof/upload/external \"flarum.core.compat['utils/mixin']\""],"names":["fileToBBcode","file","tag","uuid","humanSize","baseName","url","image","archive","code","word","mimeToIcon","fileType","indexOf","includes","File","apiEndpoint","exists","data","id","bbcode","mixin","Model","attribute","path","type","size","createdAt","extend","TextEditor","prototype","uploader","Uploader","items","app","forum","composerButtonVisiblity","add","FileManagerButton","component","UploadButton","f_","vnode","on","addBBcode","attrs","composer","editor","insertAtCursor","preview","originalIsFullScreen","isFullScreen","dragAndDrop","DragAndDrop","files","upload","$","parents","unloadHandler","unload","bind","PasteClipboard","composerElement","handlers","supportsFileDragging","addEventListener","out","dropping","div","document","createElement","window","removeEventListener","isNotFile","event","dataTransfer","i","length","kind","preventDefault","over","classList","remove","view","Button","className","onclick","fileManagerButtonClicked","icon","title","translator","trans","oncreate","tooltip","e","modal","show","FileManagerModal","Component","oninit","selectedFiles","multiSelect","restrictFileType","dragDrop","onUpload","find","onremove","disabled","fileListState","isLoading","isMediaUploadButton","alertAttrs","Alert","UserFileList","user","selectable","onFileSelect","hide","onSelect","transChoice","itemPosition","splice","push","map","fileId","store","getById","Modal","textAreaElement","paste","clipboardData","getAsFile","reset","m","redraw","buttonText","uploading","uploadButtonClicked","LoadingIndicator","process","prop","click","UploadsUserPage","loadUser","route","param","content","session","downloadOnClick","UserPage","setUser","inModal","state","empty","screen","fileClassNames","fileIcon","fileSelectable","isSelectable","onFileClick","hasMoreResults","loadMore","open","Array","isArray","components","Post","unbind","stopPropagation","alert","currentTarget","dataset","fofUploadDownloadUuid","post","csrfToken","callbacks","success","failure","uploaded","callback","dispatch","response","forEach","body","FormData","append","request","method","serialize","raw","then","result","error","fileObj","pushObject","addToList","initializers","addUploadButton","downloadButtonInteraction","models","FileListState","routes","LinkButton","href","username","name","moreResults","loading","loadResults","offset","filter","page","parseResults","results","payload","links","next","unshift","hasFiles"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAE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BAAKA,KAAL,EAAWmK,OAAX,qBAAsBnK,KAAtB;AACH,KAFD,MAEO;AACH,WAAKA,KAAL,CAAWmK,OAAX,CAAmBnK,KAAnB;AACH;AACJ;AAED;;;;;SAGAoK,Q,GAAA,oBAAW;AACP,WAAO,KAAKpK,KAAL,CAAWuB,MAAX,GAAoB,CAA3B;AACH;AAED;;;;;SAGAgC,S,GAAA,qBAAY;AACR,WAAO,KAAKkG,OAAZ;AACH;AAED;;;;;SAGA/C,c,GAAA,0BAAiB;AACb,WAAO,KAAK8C,WAAZ;AACH;AAED;;;;;SAGArD,K,GAAA,iBAAQ;AACJ,WAAO,CAAC,KAAKiE,QAAL,EAAD,IAAoB,CAAC,KAAK7G,SAAL,EAA5B;AACH,G;;;;;;;;;;;;;;;;AChHL,iD;;;;;;;;;;;ACAA,6C;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,yD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,mE;;;;;;;;;;;ACAA,wD;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,2D;;;;;;;;;;;ACAA,8C;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,mD","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function fileToBBcode(file) {\n switch (file.tag()) {\n // File\n case 'file':\n return `[upl-file uuid=${file.uuid()} size=${file.humanSize()}]${file.baseName()}[/upl-file]`;\n\n // Image template\n case 'image':\n return `[upl-image uuid=${file.uuid()} size=${file.humanSize()} url=${file.url()}]${file.baseName()}[/upl-image]`;\n\n // Image preview\n case 'image-preview':\n return `[upl-image-preview url=${file.url()}]`;\n\n // 'just-url' or unknown\n default:\n return file.url();\n }\n}\n","const image = ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml'];\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 = ['application/x-abiword', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];\n\nexport default function mimeToIcon(fileType) {\n // Display image (do not display for)\n if (image.indexOf(fileType) >= 0) {\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 Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport fileToBBcode from '../fileToBBcode';\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}) {\n /**\n * Use FoF Uploads endpoint\n */\n apiEndpoint() {\n return '/fof/uploads' + (this.exists ? '/' + this.data.id : '');\n }\n\n /**\n * Generate bbcode for this file\n */\n bbcode() {\n return fileToBBcode(this);\n }\n}\n","import app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport TextEditor from 'flarum/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');\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 const dragAndDrop = new DragAndDrop((files) => this.uploader.upload(files), this.$().parents('.Composer')[0]);\n\n const unloadHandler = () => {\n dragAndDrop.unload();\n };\n\n this.$('textarea').bind('onunload', unloadHandler);\n\n new PasteClipboard((files) => this.uploader.upload(files), this.$('textarea')[0]);\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","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport FileManagerModal from './FileManagerModal';\n\nexport default class FileManagerButton extends Component {\n view() {\n return Button.component({\n className: 'Button fof-upload-button Button--icon',\n onclick: this.fileManagerButtonClicked.bind(this),\n icon: 'fas fa-photo-video',\n title: app.translator.trans('fof-upload.forum.buttons.media'),\n });\n }\n\n /**\n * Show tooltip on hover\n *\n * @param {*} vnode\n */\n oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n this.$().tooltip();\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 Modal from 'flarum/components/Modal';\nimport Button from 'flarum/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 return (\n
\n
\n
\n {UploadButton.component({\n uploader: this.uploader,\n disabled: app.fileListState.isLoading(),\n isMediaUploadButton: true,\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 ?
{Alert.component(this.alertAttrs)}
: ''}\n\n
\n {UserFileList.component({\n user: this.attrs.user,\n selectable: true,\n onFileSelect: this.onFileSelect.bind(this),\n selectedFiles: this.selectedFiles,\n restrictFileType: this.restrictFileType,\n })}\n
\n\n
\n {Button.component(\n {\n onclick: this.hide.bind(this),\n className: 'Button',\n },\n app.translator.trans('fof-upload.forum.buttons.cancel')\n )}\n\n {Button.component(\n {\n onclick: this.onSelect.bind(this),\n disabled: this.selectedFiles.length === 0 || (!this.multiSelect && this.selectedFiles.length > 1),\n className: 'Button Button--primary',\n },\n app.translator.transChoice('fof-upload.forum.buttons.select_file', this.selectedFiles.length)\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');\n });\n }\n}\n","export default class PasteClipboard {\n constructor(upload, textAreaElement) {\n this.upload = upload;\n\n // We don't need to remove the events listeners, because they are bound to the textarea when it's created,\n // and need to stay as long as the textarea exists in the DOM\n textAreaElement.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/app';\nimport Component from 'flarum/Component';\nimport classList from 'flarum/utils/classList';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Button from 'flarum/components/Button';\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 oncreate(vnode) {\n super.oncreate(vnode);\n\n // Add tooltip\n if (!this.isMediaUploadButton) {\n this.$().tooltip();\n }\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 Button.component(\n {\n className: classList([\n 'Button',\n 'hasIcon',\n 'fof-upload-button',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--icon',\n !this.isMediaUploadButton && !this.attrs.uploader.uploading && 'Button--link',\n this.attrs.uploader.uploading && 'uploading',\n ]),\n icon: !this.attrs.uploader.uploading && 'fas fa-file-upload',\n onclick: this.uploadButtonClicked.bind(this),\n title: !this.isMediaUploadButton ? buttonText : null,\n disabled: this.attrs.disabled,\n },\n [\n this.attrs.uploader.uploading &&\n LoadingIndicator.component({\n size: 'tiny',\n className: 'LoadingIndicator--inline Button-icon',\n }),\n this.isMediaUploadButton || this.attrs.uploader.uploading ? {buttonText} : null,\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","import UserPage from 'flarum/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 (this.user !== app.session.user && !app.forum.attribute('fof-upload.canViewUserUploads')) return null;\n\n return (\n this.user &&\n UserFileList.component({\n user: this.user,\n selectable: false,\n downloadOnClick: true,\n })\n );\n }\n\n show(user) {\n super.show(user);\n this.user = user;\n }\n}\n","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\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\n this.restrictFileType = vnode.attrs.restrictFileType || null;\n\n this.downloadOnClick = this.attrs.downloadOnClick || false;\n }\n\n view() {\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 let fileClassNames = 'fof-file';\n const fileIcon = mimeToIcon(file.type());\n const fileSelectable = this.restrictFileType ? this.isSelectable(file) : true;\n\n // File is image\n if (fileIcon === 'image') {\n fileClassNames += ' fof-file-type-image';\n }\n\n // File is selected\n if (this.attrs.selectedFiles && this.attrs.selectedFiles.indexOf(file.id()) >= 0) {\n fileClassNames += ' fof-file-selected';\n }\n\n return (\n
  • \n this.onFileClick(file)}\n title={file.baseName()}\n disabled={!fileSelectable}\n >\n \n \n \n\n {fileIcon === 'image' && }\n\n {file.baseName()}\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.buttons.load_more_files')}\n \n
\n )}\n
\n );\n }\n\n /**\n * Execute function on file click\n *\n * @param {*} 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 {File} 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","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 app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport Post from 'flarum/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","export 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","import { extend } from 'flarum/extend';\nimport app from 'flarum/app';\nimport UserPage from 'flarum/components/UserPage';\nimport LinkButton from 'flarum/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';\n\nexport * from './components';\n\napp.initializers.add('fof-upload', () => {\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 (this.user !== app.session.user && !app.forum.attribute('fof-upload.canViewUserUploads')) return;\n\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","export 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","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/LinkButton'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/Post'];","module.exports = flarum.core.compat['components/TextEditor'];","module.exports = flarum.core.compat['components/UserPage'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/classList'];","module.exports = flarum.core.compat['utils/mixin'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/admin/components/UploadPage.js b/js/src/admin/components/UploadPage.js index 00a7a73c..304256e9 100644 --- a/js/src/admin/components/UploadPage.js +++ b/js/src/admin/components/UploadPage.js @@ -65,10 +65,10 @@ export default class UploadPage extends ExtensionPage { // Composer button options this.composerButtonVisiblityOptions = { - 'both' : app.translator.trans('fof-upload.admin.labels.composer_buttons.options.both'), - 'upload-btn' : app.translator.trans('fof-upload.admin.labels.composer_buttons.options.upload-btn'), - 'media-btn' : app.translator.trans('fof-upload.admin.labels.composer_buttons.options.media-btn') - } + both: app.translator.trans('fof-upload.admin.labels.composer_buttons.options.both'), + 'upload-btn': app.translator.trans('fof-upload.admin.labels.composer_buttons.options.upload-btn'), + 'media-btn': app.translator.trans('fof-upload.admin.labels.composer_buttons.options.media-btn'), + }; // get the saved settings from the database const settings = app.data.settings; @@ -201,7 +201,7 @@ export default class UploadPage extends ExtensionPage { m('.helpText', app.translator.trans('fof-upload.admin.help_texts.download_templates')), this.templateOptionsDescriptions(), ]), - m('fieldset', [ + m('fieldset.composerButtons', [ m('legend', app.translator.trans('fof-upload.admin.labels.composer_buttons.title')), m('.helpText', app.translator.trans('fof-upload.admin.help_texts.composer_buttons')), m('div', [ @@ -210,7 +210,7 @@ export default class UploadPage extends ExtensionPage { onchange: this.values.composerButtonVisiblity, value: this.values.composerButtonVisiblity() || 'both', }), - ]) + ]), ]), m('fieldset', [ m('legend', app.translator.trans('fof-upload.admin.labels.resize.title')), diff --git a/js/src/admin/index.js b/js/src/admin/index.js index a3480fff..39cb886c 100644 --- a/js/src/admin/index.js +++ b/js/src/admin/index.js @@ -25,5 +25,14 @@ app.initializers.add('fof-upload', (app) => { }, 'view', 50 + ) + .registerPermission( + { + icon: 'fas fa-eye', + label: app.translator.trans('fof-upload.admin.permissions.view_user_uploads_label'), + permission: 'fof-upload.viewUserUploads', + }, + 'moderate', + 50 ); }); diff --git a/js/src/forum/addUploadButton.js b/js/src/forum/addUploadButton.js index 269f99fc..8b8e30be 100644 --- a/js/src/forum/addUploadButton.js +++ b/js/src/forum/addUploadButton.js @@ -14,10 +14,10 @@ export default function () { extend(TextEditor.prototype, 'controlItems', function (items) { if (!app.forum.attribute('fof-upload.canUpload')) return; - const composerButtonVisiblity = app.forum.attribute("fof-upload.composerButtonVisiblity"); + const composerButtonVisiblity = app.forum.attribute('fof-upload.composerButtonVisiblity'); // Add media button - if(composerButtonVisiblity === "both" || composerButtonVisiblity === "media-btn") { + if (composerButtonVisiblity === 'both' || composerButtonVisiblity === 'media-btn') { items.add( 'fof-upload-media', FileManagerButton.component({ @@ -27,7 +27,7 @@ export default function () { } // Add upload button - if(composerButtonVisiblity === "both" || composerButtonVisiblity === "upload-btn") { + if (composerButtonVisiblity === 'both' || composerButtonVisiblity === 'upload-btn') { items.add( 'fof-upload', UploadButton.component({ diff --git a/js/src/forum/components/FileManagerButton.js b/js/src/forum/components/FileManagerButton.js index eae45d69..744baa75 100644 --- a/js/src/forum/components/FileManagerButton.js +++ b/js/src/forum/components/FileManagerButton.js @@ -35,7 +35,7 @@ export default class FileManagerButton extends Component { // Open dialog app.modal.show(FileManagerModal, { - uploader: this.attrs.uploader + uploader: this.attrs.uploader, }); } } diff --git a/js/src/forum/components/FileManagerModal.js b/js/src/forum/components/FileManagerModal.js index 3eb6702a..814d5db4 100644 --- a/js/src/forum/components/FileManagerModal.js +++ b/js/src/forum/components/FileManagerModal.js @@ -61,9 +61,9 @@ export default class FileManagerModal extends Modal { })}
-
-
- +
+
+ {app.translator.trans('fof-upload.forum.file_list.release_to_upload')}
@@ -75,17 +75,17 @@ export default class FileManagerModal extends Modal { {this.alertAttrs ?
{Alert.component(this.alertAttrs)}
: ''} -
+
{UserFileList.component({ user: this.attrs.user, selectable: true, onFileSelect: this.onFileSelect.bind(this), selectedFiles: this.selectedFiles, - restrictFileType: this.restrictFileType + restrictFileType: this.restrictFileType, })}
-
+
{Button.component( { onclick: this.hide.bind(this), diff --git a/js/src/forum/components/UploadsUserPage.js b/js/src/forum/components/UploadsUserPage.js new file mode 100644 index 00000000..a9a1abf0 --- /dev/null +++ b/js/src/forum/components/UploadsUserPage.js @@ -0,0 +1,30 @@ +import UserPage from 'flarum/components/UserPage'; +import UserFileList from './UserFileList'; + +export default class UploadsUserPage extends UserPage { + oninit(vnode) { + super.oninit(vnode); + + this.user = null; + + this.loadUser(m.route.param('username')); + } + + content() { + if (this.user !== app.session.user && !app.forum.attribute('fof-upload.canViewUserUploads')) return null; + + return ( + this.user && + UserFileList.component({ + user: this.user, + selectable: false, + downloadOnClick: true, + }) + ); + } + + show(user) { + super.show(user); + this.user = user; + } +} diff --git a/js/src/forum/components/UserFileList.js b/js/src/forum/components/UserFileList.js index 8d533da6..bae18953 100644 --- a/js/src/forum/components/UserFileList.js +++ b/js/src/forum/components/UserFileList.js @@ -13,6 +13,8 @@ export default class UserFileList extends Component { this.inModal = vnode.attrs.selectable; this.restrictFileType = vnode.attrs.restrictFileType || null; + + this.downloadOnClick = this.attrs.downloadOnClick || false; } view() { @@ -39,7 +41,7 @@ export default class UserFileList extends Component { )} {/* Empty file list */} - {!this.inModal && state.empty()(

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

)} + {!this.inModal && state.empty() &&

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

} {/* File list */}
    @@ -62,7 +64,7 @@ export default class UserFileList extends Component {