{"version":3,"sources":["dashboard.js"],"names":["const","lsKeys","token","viewType","uploads","uploadsAll","selected","users","page","dom","localStorage","username","permissions","menusContainer","menus","currentView","views","type","album","pageNum","filters","all","checkboxes","lastSelected","upload","user","selectAlbumContainer","cache","albums","clipboardJS","lazyLoad","imageExts","videoExts","isTriggerLoading","fadingIn","albumTitleMaxLength","albumDescMaxLength","onError","error","console","content","document","createElement","innerHTML","toString","swal","title","icon","onAxiosError","statusText","520","521","522","523","524","525","526","527","530","response","status","description","data","preparePage","verifyToken","window","location","reloadOnError","axios","post","then","success","text","removeItem","defaults","headers","common","prepareDashboard","catch","querySelector","addEventListener","domClick","event","target","classList","contains","preventDefault","itemMenus","selector","onclick","getUploads","deleteUploadsByNames","getAlbums","changeToken","changePassword","logout","params","group","getStatistics","getUsers","loop","i","item","call","Object","assign","trigger","currentTarget","remove","push","length","moderator","getAlbumsSidebar","prepareShareX","updateTrigger","newState","add","parentNode","tagName","let","getItemID","element","parent","parseInt","dataset","id","includes","action","hasAttribute","stopPropagation","setUploadsView","clearSelection","addSelectedUploadsToAlbum","select","selectAll","addToAlbum","deleteUpload","bulkDeleteUploads","displayPreview","submitAlbum","editAlbum","deleteAlbum","getNewToken","editUser","disableUser","filtersHelp","filterUploads","viewUserUploads","focusJumpToPage","switchPage","fadeAndScroll","clearTimeout","setTimeout","scrollIntoView","behavior","block","inline","func","goto","jumpToPage","checkValidity","parsed","value","isNaN","focus","undefined","url","get","files","autoPage","Math","ceil","count","basedomain","pagination","paginate","filter","extraControls","controls","unselected","hasExpiryDateColumn","some","file","expirydate","thumb","exec","extname","toLowerCase","name","original","prettyBytes","getPrettyBytes","size","prettyDate","getPrettyDate","Date","timestamp","prettyExpiryDate","appendix","userid","albumid","table","div","className","appendChild","querySelectorAll","update","tr","ip","checked","view","isimage","isvideo","src","onload","body","onerror","video","autoplay","insertAdjacentElement","buttons","splice","indexOf","JSON","stringify","selectInBetween","lastElement","thisIndex","index","lastIndex","abs","shiftKey","suffix","substring","proceed","style","trim","replace","postBulkDeleteUploads","field","values","cb","failed","textArea","seen","names","split","map","trimmed","test","prototype","hasOwnProperty","join","objective","dangerMode","cancel","confirm","closeModal","fields","Array","isArray","addUploadsToAlbum","ids","callback","choose","added","list","getElementsByTagName","removeAttribute","homeDomain","albumUrl","download","public","requestLink","identifier","purge","albumsContainer","oldAlbums","li","a","sendNewPassword","pass","password","admin","displayGroup","groups","keys","enabled","usage","groupOptions","g","resetPassword","totalItems","itemsPerPage","currentPage","numPages","template","start","end","elementsToShow","step","stats","rows","types","_types","valKeys","j","number","toLocaleString","byte","byteUsage","used","total","round","toUpperCase","defineProperty","varArgs","arguments$1","arguments","TypeError","to","nextSource","nextKey","writable","configurable","documentElement","selectedKeys","ls","parse","ClipboardJS","on","LazyLoad"],"mappings":"AAEAA,IAAMC,OAAS,CACbC,MAAO,QACPC,SAAU,CACRC,QAAS,kBACTC,WAAY,sBAEdC,SAAU,CACRF,QAAS,kBACTC,WAAY,qBACZE,MAAO,kBAILC,KAAO,CAEXC,IAAK,KAGLP,MAAOQ,aAAaT,OAAOC,OAG3BS,SAAU,KACVC,YAAa,KAGbC,eAAgB,KAChBC,MAAO,GAEPC,YAAa,KACbC,MAAO,CAELZ,QAAS,CACPa,KAAMP,aAAaT,OAAOE,SAASC,SACnCc,MAAO,KACPC,QAAS,MAGXd,WAAY,CACVY,KAAMP,aAAaT,OAAOE,SAASE,YACnCe,QAAS,KACTD,QAAS,KACTE,KAAK,GAGPd,MAAO,CACLY,QAAS,OAKbb,SAAU,CACRF,QAAS,GACTC,WAAY,GACZE,MAAO,IAETe,WAAY,CACVlB,QAAS,GACTC,WAAY,GACZE,MAAO,IAETgB,aAAc,CACZC,OAAQ,KACRnB,WAAY,KACZoB,KAAM,MAIRC,qBAAsB,KAGtBC,MAAO,CACLvB,QAAS,GACTwB,OAAQ,GACRrB,MAAO,IAGTsB,YAAa,KACbC,SAAU,KAEVC,UAAW,CAAC,QAAS,OAAQ,QAAS,OAAQ,OAAQ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tC0D,MAAO,SAAiB/E,EAAQyO,GAC9B,aA9iBA,IAAIC,EAAcC,UA+iBlB,GAAI3O,MAAAA,EACF,MAAM,IAAI4O,UAAU,8CAEtB,IADA/T,IAAMgU,EAAKxN,OAAOrB,GACTkB,EAAI,EAAGA,EAAIyN,UAAUhN,OAAQT,IAAK,CACzCrG,IAAMiU,EAAaH,EAAUzN,GAC7B,GAAI4N,MAAAA,EACF,IAAKjU,IAAMkU,KAAWD,EAEhBzN,OAAOkJ,UAAUC,eAAepJ,KAAK0N,EAAYC,KACnDF,EAAGE,GAAWD,EAAWC,IAEjC,OAAOF,GAETG,UAAU,EACVC,cAAc,IAIZ,iBAAkB3R,SAAS4R,iBAC/B5R,SAAS4R,gBAAgBjP,UAAUgC,IAAI,YAGzC,IADApH,IAAMsU,EAAe,CAAC,UAAW,aAAc,SACtCjO,EAAI,EAAGA,EAAIiO,EAAaxN,OAAQT,IAAK,CAC5CrG,IAAMuU,EAAK7T,aAAaT,OAAOK,SAASgU,EAAajO,KACjDkO,IAAI/T,KAAKF,SAASgU,EAAajO,IAAM0H,KAAKyG,MAAMD,IAGtD/T,KAAKuD,cAELvD,KAAKqB,YAAc,IAAI4S,YAAY,iBAEnCjU,KAAKqB,YAAY6S,GAAG,WAAS,WAC3B,OAAO7R,KAAK,UAAW,yCAA0C,cAGnErC,KAAKqB,YAAY6S,GAAG,QAASlU,KAAK6B,SAElC7B,KAAKsB,SAAW,IAAI6S","file":"dashboard.js","sourcesContent":["/* global swal, axios, ClipboardJS, LazyLoad */\n\nconst lsKeys = {\n token: 'token',\n viewType: {\n uploads: 'viewTypeUploads',\n uploadsAll: 'viewTypeUploadsAll'\n },\n selected: {\n uploads: 'selectedUploads',\n uploadsAll: 'selectedUploadsAll',\n users: 'selectedUsers'\n }\n}\n\nconst page = {\n // #page\n dom: null,\n\n // user token\n token: localStorage[lsKeys.token],\n\n // from api/tokens/verify\n username: null,\n permissions: null,\n\n // sidebar menus\n menusContainer: null,\n menus: [],\n\n currentView: null,\n views: {\n // config of uploads view\n uploads: {\n type: localStorage[lsKeys.viewType.uploads],\n album: null, // album's id\n pageNum: null // page num\n },\n // config of uploads view (all)\n uploadsAll: {\n type: localStorage[lsKeys.viewType.uploadsAll],\n filters: null, // uploads' filters\n pageNum: null, // page num\n all: true\n },\n // config of users view\n users: {\n pageNum: null\n }\n },\n\n // id of selected items (shared across pages and will be synced with localStorage)\n selected: {\n uploads: [],\n uploadsAll: [],\n users: []\n },\n checkboxes: {\n uploads: [],\n uploadsAll: [],\n users: []\n },\n lastSelected: {\n upload: null,\n uploadsAll: null,\n user: null\n },\n\n // select album dom for dialogs/modals\n selectAlbumContainer: null,\n\n // cache for dialogs/modals\n cache: {\n uploads: {},\n albums: {},\n users: {}\n },\n\n clipboardJS: null,\n lazyLoad: null,\n\n imageExts: ['.webp', '.jpg', '.jpeg', '.gif', '.png', '.tiff', '.tif', '.svg'],\n // some of these extensions can not be played directly in browsers\n videoExts: ['.webm', '.mp4', '.wmv', '.avi', '.mov', '.mkv'],\n\n isTriggerLoading: null,\n fadingIn: null,\n\n albumTitleMaxLength: 70,\n albumDescMaxLength: 4000\n}\n\n// Handler for regular JS errors\npage.onError = error => {\n console.error(error)\n\n const content = document.createElement('div')\n content.innerHTML = `${error.toString()}`\n return swal({\n title: 'An error occurred!',\n icon: 'error',\n content\n })\n}\n\n// Handler for Axios errors\npage.onAxiosError = error => {\n console.error(error)\n\n // Better Cloudflare errors\n const cloudflareErrors = {\n 520: 'Unknown Error',\n 521: 'Web Server Is Down',\n 522: 'Connection Timed Out',\n 523: 'Origin Is Unreachable',\n 524: 'A Timeout Occurred',\n 525: 'SSL Handshake Failed',\n 526: 'Invalid SSL Certificate',\n 527: 'Railgun Error',\n 530: 'Origin DNS Error'\n }\n\n const statusText = cloudflareErrors[error.response.status] || error.response.statusText\n const description = error.response.data && error.response.data.description\n ? error.response.data.description\n : 'There was an error with the request, please check the console for more information.'\n\n return swal(`${error.response.status} ${statusText}`, description, 'error')\n}\n\npage.preparePage = () => {\n if (page.token)\n page.verifyToken(page.token, true)\n else\n window.location = 'auth'\n}\n\npage.verifyToken = (token, reloadOnError) => {\n axios.post('api/tokens/verify', { token }).then(response => {\n if (response.data.success === false)\n return swal({\n title: 'An error occurred!',\n text: response.data.description,\n icon: 'error'\n }).then(() => {\n if (!reloadOnError) return\n localStorage.removeItem(lsKeys.token)\n window.location = 'auth'\n })\n\n axios.defaults.headers.common.token = token\n localStorage[lsKeys.token] = token\n\n page.token = token\n page.username = response.data.username\n page.permissions = response.data.permissions\n page.prepareDashboard()\n }).catch(page.onAxiosError)\n}\n\npage.prepareDashboard = () => {\n page.dom = document.querySelector('#page')\n\n // Capture all click events\n page.dom.addEventListener('click', page.domClick, true)\n\n // Capture all submit events\n page.dom.addEventListener('submit', event => {\n // Prevent default if necessary\n if (event.target && event.target.classList.contains('prevent-default'))\n return event.preventDefault()\n }, true)\n\n page.menusContainer = document.querySelector('#menu')\n\n // All item menus in the sidebar\n const itemMenus = [\n { selector: '#itemUploads', onclick: page.getUploads },\n { selector: '#itemDeleteUploadsByNames', onclick: page.deleteUploadsByNames },\n { selector: '#itemManageAlbums', onclick: page.getAlbums },\n { selector: '#itemManageToken', onclick: page.changeToken },\n { selector: '#itemChangePassword', onclick: page.changePassword },\n { selector: '#itemLogout', onclick: page.logout },\n { selector: '#itemManageUploads', onclick: page.getUploads, params: { all: true }, group: 'moderator' },\n { selector: '#itemStatistics', onclick: page.getStatistics, group: 'admin' },\n { selector: '#itemManageUsers', onclick: page.getUsers, group: 'admin' }\n ]\n\n for (let i = 0; i < itemMenus.length; i++) {\n // Skip item menu if not enough permission\n if (itemMenus[i].group && !page.permissions[itemMenus[i].group])\n continue\n\n // Add onclick event listener\n const item = document.querySelector(itemMenus[i].selector)\n item.addEventListener('click', event => {\n // This class name isn't actually being applied fast enough\n if (page.menusContainer.classList.contains('is-loading'))\n return\n\n // eslint-disable-next-line compat/compat\n itemMenus[i].onclick.call(null, Object.assign({\n trigger: event.currentTarget\n }, itemMenus[i].params || {}))\n })\n\n item.classList.remove('is-hidden')\n page.menus.push(item)\n }\n\n // If at least a moderator, show administration section\n if (page.permissions.moderator) {\n document.querySelector('#itemLabelAdmin').classList.remove('is-hidden')\n document.querySelector('#itemListAdmin').classList.remove('is-hidden')\n }\n\n // Update text of logout button\n document.querySelector('#itemLogout').innerHTML = `Logout ( ${page.username} )`\n\n // Finally display dashboard\n document.querySelector('#dashboard').classList.remove('is-hidden')\n\n // Load albums sidebar\n page.getAlbumsSidebar()\n\n if (typeof page.prepareShareX === 'function')\n page.prepareShareX()\n}\n\npage.logout = params => {\n page.updateTrigger(params.trigger, 'active')\n localStorage.removeItem(lsKeys.token)\n window.location = 'auth'\n}\n\npage.updateTrigger = (trigger, newState) => {\n if (!trigger) return\n\n // Disable menus container when loading\n if (newState === 'loading')\n page.menusContainer.classList.add('is-loading')\n else\n page.menusContainer.classList.remove('is-loading')\n\n if (newState === 'loading') {\n trigger.classList.add('is-loading')\n } else if (newState === 'active') {\n if (trigger.parentNode.tagName !== 'LI')\n return\n for (let i = 0; i < page.menus.length; i++)\n page.menus[i].classList.remove('is-active')\n trigger.classList.remove('is-loading')\n trigger.classList.add('is-active')\n } else {\n trigger.classList.remove('is-loading')\n trigger.classList.remove('is-active')\n }\n}\n\npage.getItemID = element => {\n // This expects the item's parent to have the item's ID\n let parent = element.parentNode\n // If the element is part of a set of controls, use the container's parent instead\n if (element.parentNode.classList.contains('controls')) parent = parent.parentNode\n return parseInt(parent.dataset.id)\n}\n\npage.domClick = event => {\n // We are processing clicks this way to avoid using \"onclick\" attribute\n // Apparently we will need to use \"unsafe-inline\" for \"script-src\" directive\n // of Content Security Policy (CSP), if we want to use \"onclick\" attribute\n // Though I think that only applies to some browsers (?)\n // Of course it wouldn't have mattered if we didn't use CSP to begin with\n // Anyway, I personally would rather not use \"onclick\" attribute\n let element = event.target\n if (!element) return\n\n // Delegate click events to their A or BUTTON parents\n if (['I'].includes(element.tagName) && ['SPAN'].includes(element.parentNode.tagName))\n element = element.parentNode\n if (['SPAN'].includes(element.tagName) && ['A', 'BUTTON'].includes(element.parentNode.tagName))\n element = element.parentNode\n\n // Skip elements that have no action data\n if (!element.dataset || !element.dataset.action) return\n\n // Skip disabled elements\n if (element.hasAttribute('disabled')) return\n\n event.stopPropagation() // maybe necessary\n const id = page.getItemID(element)\n const action = element.dataset.action\n\n switch (action) {\n case 'view-list':\n return page.setUploadsView('list', element)\n case 'view-thumbs':\n return page.setUploadsView('thumbs', element)\n case 'clear-selection':\n return page.clearSelection()\n case 'add-selected-uploads-to-album':\n return page.addSelectedUploadsToAlbum()\n case 'select':\n return page.select(element, event)\n case 'select-all':\n return page.selectAll(element)\n case 'add-to-album':\n return page.addToAlbum(id)\n case 'delete-upload':\n return page.deleteUpload(id)\n case 'bulk-delete-uploads':\n return page.bulkDeleteUploads()\n case 'display-preview':\n return page.displayPreview(id)\n case 'submit-album':\n return page.submitAlbum(element)\n case 'edit-album':\n return page.editAlbum(id)\n case 'delete-album':\n return page.deleteAlbum(id)\n case 'get-new-token':\n return page.getNewToken(element)\n case 'edit-user':\n return page.editUser(id)\n case 'disable-user':\n return page.disableUser(id)\n case 'filters-help':\n return page.filtersHelp(element)\n case 'filter-uploads':\n return page.filterUploads(element)\n case 'view-user-uploads':\n return page.viewUserUploads(id, element)\n case 'page-ellipsis':\n return page.focusJumpToPage()\n case 'page-prev':\n case 'page-next':\n case 'page-goto':\n case 'jump-to-page':\n return page.switchPage(action, element)\n }\n}\n\npage.fadeAndScroll = content => {\n if (page.fadingIn) {\n clearTimeout(page.fadingIn)\n page.dom.classList.remove('fade-in')\n }\n\n page.dom.classList.add('fade-in')\n page.fadingIn = setTimeout(() => {\n page.dom.classList.remove('fade-in')\n }, 500)\n\n page.dom.scrollIntoView({\n behavior: 'smooth',\n block: 'start',\n inline: 'nearest'\n })\n}\n\npage.switchPage = (action, element) => {\n // eslint-disable-next-line compat/compat\n const params = Object.assign({\n trigger: element\n }, page.views[page.currentView])\n const func = page.currentView === 'users' ? page.getUsers : page.getUploads\n switch (action) {\n case 'page-prev':\n params.pageNum = page.views[page.currentView].pageNum - 1\n if (params.pageNum < 0)\n return swal('An error occurred!', 'This is already the first page.', 'error')\n return func(params)\n case 'page-next':\n params.pageNum = page.views[page.currentView].pageNum + 1\n return func(params)\n case 'page-goto':\n params.pageNum = parseInt(element.dataset.goto)\n return func(params)\n case 'jump-to-page': {\n const jumpToPage = document.querySelector('#jumpToPage')\n if (!jumpToPage.checkValidity()) return\n const parsed = parseInt(jumpToPage.value)\n params.pageNum = isNaN(parsed) ? 0 : (parsed - 1)\n if (params.pageNum < 0) params.pageNum = 0\n return func(params)\n }\n }\n}\n\npage.focusJumpToPage = () => {\n const element = document.querySelector('#jumpToPage')\n if (!element) return\n element.focus()\n element.select()\n}\n\npage.getUploads = (params = {}) => {\n if (params === undefined)\n params = {}\n\n if ((params.all || params.filters) && !page.permissions.moderator)\n return swal('An error occurred!', 'You can not do this!', 'error')\n\n page.updateTrigger(params.trigger, 'loading')\n\n if (typeof params.pageNum !== 'number' || params.pageNum < 0)\n params.pageNum = 0\n\n const url = params.album !== undefined\n ? `api/album/${params.album}/${params.pageNum}`\n : `api/uploads/${params.pageNum}`\n\n const headers = {\n all: params.all ? '1' : '',\n filters: params.filters || ''\n }\n\n axios.get(url, { headers }).then(response => {\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n page.updateTrigger(params.trigger)\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n const files = response.data.files\n if (params.pageNum && (files.length === 0))\n if (params.autoPage) {\n params.pageNum = Math.ceil(response.data.count / 25) - 1\n return page.getUploads(params)\n } else {\n page.updateTrigger(params.trigger)\n return swal('An error occurred!', `There are no more uploads to populate page ${params.pageNum + 1}.`, 'error')\n }\n\n page.currentView = params.all ? 'uploadsAll' : 'uploads'\n page.cache.uploads = {}\n\n const albums = response.data.albums\n const users = response.data.users\n const basedomain = response.data.basedomain\n const pagination = page.paginate(response.data.count, 25, params.pageNum)\n\n let filter = '
'\n if (params.all)\n filter = `\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n `\n const extraControls = `\n
\n ${filter}\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n `\n\n const controls = `\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n \n \n \n ${params.all ? '' : `\n \n \n \n \n `}\n \n \n \n \n Bulk delete\n \n
\n
\n `\n\n // Whether there are any unselected items\n let unselected = false\n\n const hasExpiryDateColumn = files.some(file => {\n return file.expirydate !== undefined\n })\n\n for (let i = 0; i < files.length; i++) {\n // Build full URLs\n files[i].file = `${basedomain}/${files[i].name}`\n if (files[i].thumb)\n files[i].thumb = `${basedomain}/${files[i].thumb}`\n\n // Determine types\n files[i].type = 'other'\n const exec = /.[\\w]+(\\?|$)/.exec(files[i].file)\n const extname = exec && exec[0] ? exec[0].toLowerCase() : null\n if (page.imageExts.includes(extname))\n files[i].type = 'picture'\n else if (page.videoExts.includes(extname))\n files[i].type = 'video'\n\n // Cache bare minimum data for thumbnails viewer\n page.cache.uploads[files[i].id] = {\n name: files[i].name,\n thumb: files[i].thumb,\n original: files[i].file,\n type: files[i].type\n }\n\n // Prettify\n files[i].prettyBytes = page.getPrettyBytes(parseInt(files[i].size))\n files[i].prettyDate = page.getPrettyDate(new Date(files[i].timestamp * 1000))\n\n if (hasExpiryDateColumn)\n files[i].prettyExpiryDate = files[i].expirydate\n ? page.getPrettyDate(new Date(files[i].expirydate * 1000))\n : null\n\n // Update selected status\n files[i].selected = page.selected[page.currentView].includes(files[i].id)\n if (!files[i].selected) unselected = true\n\n // Appendix (display album or user)\n if (params.all)\n files[i].appendix = files[i].userid\n ? users[files[i].userid] || ''\n : ''\n else if (params.album === undefined)\n files[i].appendix = files[i].albumid\n ? albums[files[i].albumid] || ''\n : ''\n }\n\n if (page.views[page.currentView].type === 'thumbs') {\n page.dom.innerHTML = `\n ${pagination}\n ${extraControls}\n ${controls}\n
\n
\n ${pagination}\n `\n\n const table = document.querySelector('#table')\n\n for (let i = 0; i < files.length; i++) {\n const upload = files[i]\n const div = document.createElement('div')\n div.className = 'image-container column'\n div.dataset.id = upload.id\n\n if (upload.thumb !== undefined)\n div.innerHTML = `\"${upload.name}\"`\n else\n div.innerHTML = `

${upload.extname || 'N/A'}

`\n\n div.innerHTML += `\n \n
\n ${upload.thumb ? `\n \n \n \n \n ` : ''}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n

${upload.name}

\n

${upload.appendix ? `${upload.appendix} – ` : ''}${upload.prettyBytes}

\n ${hasExpiryDateColumn && upload.prettyExpiryDate ? `\n

EXP: ${upload.prettyExpiryDate}

` : ''}\n
\n `\n\n table.appendChild(div)\n page.checkboxes[page.currentView] = table.querySelectorAll('.checkbox[data-action=\"select\"]')\n page.lazyLoad.update()\n }\n } else {\n page.dom.innerHTML = `\n ${pagination}\n ${extraControls}\n ${controls}\n
\n \n \n \n \n \n ${params.album === undefined ? `` : ''}\n \n ${params.all ? '' : ''}\n \n ${hasExpiryDateColumn ? '' : ''}\n \n \n \n \n \n
File${params.all ? 'User' : 'Album'}SizeIPDateExpiry date
\n
\n ${pagination}\n `\n\n const table = document.querySelector('#table')\n\n for (let i = 0; i < files.length; i++) {\n const upload = files[i]\n const tr = document.createElement('tr')\n tr.dataset.id = upload.id\n tr.innerHTML = `\n \n ${upload.name}\n ${params.album === undefined ? `${upload.appendix}` : ''}\n ${upload.prettyBytes}\n ${params.all ? `${upload.ip || ''}` : ''}\n ${upload.prettyDate}\n ${hasExpiryDateColumn ? `${upload.prettyExpiryDate || '-'}` : ''}\n \n \n \n \n \n \n \n \n \n \n \n ${params.all ? '' : `\n \n \n \n \n `}\n \n \n \n \n \n \n `\n\n table.appendChild(tr)\n page.checkboxes[page.currentView] = table.querySelectorAll('.checkbox[data-action=\"select\"]')\n }\n }\n\n const selectAll = document.querySelector('#selectAll')\n if (selectAll && !unselected) {\n selectAll.checked = true\n selectAll.title = 'Unselect all'\n }\n\n page.fadeAndScroll()\n page.updateTrigger(params.trigger, 'active')\n\n if (page.currentView === 'uploads')\n page.views.uploads.album = params.album\n if (page.currentView === 'uploadsAll')\n page.views.uploadsAll.filters = params.filters\n page.views[page.currentView].pageNum = files.length ? params.pageNum : 0\n }).catch(error => {\n page.updateTrigger(params.trigger)\n page.onAxiosError(error)\n })\n}\n\npage.setUploadsView = (view, element) => {\n localStorage[lsKeys.viewType[page.currentView]] = view\n page.views[page.currentView].type = view\n // eslint-disable-next-line compat/compat\n page.getUploads(Object.assign({\n trigger: element\n }, page.views[page.currentView]))\n}\n\npage.displayPreview = id => {\n const file = page.cache.uploads[id]\n if (!file.thumb) return\n\n const div = document.createElement('div')\n div.innerHTML = `\n
\n \n
\n \n
\n
\n `\n\n if (file.original) {\n const exec = /.[\\w]+(\\?|$)/.exec(file.original)\n const extname = exec && exec[0] ? exec[0].toLowerCase() : null\n const isimage = page.imageExts.includes(extname)\n const isvideo = !isimage && page.videoExts.includes(extname)\n\n if (isimage || isvideo) {\n div.innerHTML += `\n
\n
\n \n \n \n \n Load original\n \n
\n
\n `\n\n div.querySelector('#swalOriginal').addEventListener('click', event => {\n const trigger = event.currentTarget\n if (trigger.classList.contains('is-danger'))\n return\n\n trigger.classList.add('is-loading')\n const thumb = div.querySelector('#swalThumb')\n\n if (isimage) {\n thumb.src = file.original\n thumb.onload = () => {\n trigger.classList.add('is-hidden')\n document.body.querySelector('.swal-overlay .swal-modal:not(.is-expanded)').classList.add('is-expanded')\n }\n thumb.onerror = event => {\n event.currentTarget.classList.add('is-hidden')\n trigger.className = 'button is-danger is-fullwidth'\n trigger.innerHTML = `\n \n \n \n Unable to load original\n `\n }\n } else if (isvideo) {\n thumb.classList.add('is-hidden')\n const video = document.createElement('video')\n video.id = 'swalVideo'\n video.controls = true\n video.autoplay = true\n video.src = file.original\n thumb.insertAdjacentElement('afterend', video)\n\n trigger.classList.add('is-hidden')\n document.body.querySelector('.swal-overlay .swal-modal:not(.is-expanded)').classList.add('is-expanded')\n }\n })\n }\n }\n\n return swal({\n content: div,\n buttons: false\n }).then(() => {\n // Destroy video, if necessary\n const video = div.querySelector('#swalVideo')\n if (video) video.remove()\n\n // Restore modal size\n document.body.querySelector('.swal-overlay .swal-modal').classList.remove('is-expanded')\n })\n}\n\npage.selectAll = element => {\n for (let i = 0; i < page.checkboxes[page.currentView].length; i++) {\n const id = page.getItemID(page.checkboxes[page.currentView][i])\n if (isNaN(id)) continue\n if (page.checkboxes[page.currentView][i].checked !== element.checked) {\n page.checkboxes[page.currentView][i].checked = element.checked\n if (page.checkboxes[page.currentView][i].checked)\n page.selected[page.currentView].push(id)\n else\n page.selected[page.currentView].splice(page.selected[page.currentView].indexOf(id), 1)\n }\n }\n\n if (page.selected[page.currentView].length)\n localStorage[lsKeys.selected[page.currentView]] = JSON.stringify(page.selected[page.currentView])\n else\n delete localStorage[lsKeys.selected[page.currentView]]\n\n element.title = element.checked ? 'Unselect all' : 'Select all'\n}\n\npage.selectInBetween = (element, lastElement) => {\n const thisIndex = parseInt(element.dataset.index)\n const lastIndex = parseInt(lastElement.dataset.index)\n\n const distance = Math.abs(thisIndex - lastIndex)\n if (distance < 2)\n return\n\n for (let i = 0; i < page.checkboxes[page.currentView].length; i++)\n if ((thisIndex > lastIndex && i > lastIndex && i < thisIndex) ||\n (thisIndex < lastIndex && i > thisIndex && i < lastIndex)) {\n // Check or uncheck depending on the state of the initial checkbox\n const checked = page.checkboxes[page.currentView][i].checked = lastElement.checked\n const id = page.getItemID(page.checkboxes[page.currentView][i])\n if (!page.selected[page.currentView].includes(id) && checked)\n page.selected[page.currentView].push(id)\n else if (page.selected[page.currentView].includes(id) && !checked)\n page.selected[page.currentView].splice(page.selected[page.currentView].indexOf(id), 1)\n }\n}\n\npage.select = (element, event) => {\n const id = page.getItemID(element)\n if (isNaN(id)) return\n\n const lastSelected = page.lastSelected[page.currentView]\n if (event.shiftKey && lastSelected) {\n page.selectInBetween(element, lastSelected)\n // Check or uncheck depending on the state of the initial checkbox\n element.checked = lastSelected.checked\n } else {\n page.lastSelected[page.currentView] = element\n }\n\n if (!page.selected[page.currentView].includes(id) && element.checked)\n page.selected[page.currentView].push(id)\n else if (page.selected[page.currentView].includes(id) && !element.checked)\n page.selected[page.currentView].splice(page.selected[page.currentView].indexOf(id), 1)\n\n // Update local storage\n if (page.selected[page.currentView].length)\n localStorage[lsKeys.selected[page.currentView]] = JSON.stringify(page.selected[page.currentView])\n else\n delete localStorage[lsKeys.selected[page.currentView]]\n}\n\npage.clearSelection = () => {\n const selected = page.selected[page.currentView]\n const type = page.currentView === 'users' ? 'users' : 'uploads'\n const count = selected.length\n if (!count)\n return swal('An error occurred!', `You have not selected any ${type}.`, 'error')\n\n const suffix = count === 1 ? type.substring(0, type.length - 1) : type\n return swal({\n title: 'Are you sure?',\n text: `You are going to unselect ${count} ${suffix}.`,\n buttons: true\n }).then(proceed => {\n if (!proceed) return\n\n const checkboxes = page.checkboxes[page.currentView]\n for (let i = 0; i < checkboxes.length; i++)\n if (checkboxes[i].checked)\n checkboxes[i].checked = false\n\n page.selected[page.currentView] = []\n delete localStorage[lsKeys.selected[page.currentView]]\n\n const selectAll = document.querySelector('#selectAll')\n if (selectAll) selectAll.checked = false\n\n return swal('Cleared selection!', `Unselected ${count} ${suffix}.`, 'success')\n })\n}\n\npage.filtersHelp = element => {\n const content = document.createElement('div')\n content.style = 'text-align: left'\n content.innerHTML = `\n This supports 3 filter keys, namely user (username), ip and name (upload name).\n Each key can be specified more than once.\n Backlashes should be used if the usernames have spaces.\n There are also 2 additional flags, namely -user and -ip, which will match uploads by non-registered users and have no IPs respectively.\n\n How does it work?\n First, it will filter uploads matching ANY of the supplied user or ip keys.\n Then, it will refine the matches using the supplied name keys.\n\n Examples:\n\n Uploads from user with username \"demo\":\n user:demo\n\n Uploads from users with username either \"John Doe\" OR \"demo\":\n user:John\\\\ Doe user:demo\n\n Uploads from IP \"127.0.0.1\" AND which upload names match \"*.rar\" OR \"*.zip\":\n ip:127.0.0.1 name:*.rar name:*.zip\n\n Uploads from user with username \"test\" OR from non-registered users:\n user:test -user\n `.trim().replace(/^ {6}/gm, '').replace(/\\n/g, '
')\n swal({ content })\n}\n\npage.filterUploads = element => {\n const filters = document.querySelector('#filters').value\n page.getUploads({ all: true, filters }, element)\n}\n\npage.viewUserUploads = (id, element) => {\n const user = page.cache.users[id]\n if (!user) return\n element.classList.add('is-loading')\n page.getUploads({\n all: true,\n filters: `user:${user.username.replace(/ /g, '\\\\ ')}`,\n trigger: document.querySelector('#itemManageUploads')\n })\n}\n\npage.deleteUpload = id => {\n page.postBulkDeleteUploads({\n all: page.currentView === 'uploadsAll',\n field: 'id',\n values: [id],\n cb (failed) {\n // Remove from remembered checkboxes if necessary\n if (!failed.length && page.selected[page.currentView].includes(id))\n page.selected[page.currentView].splice(page.selected[page.currentView].indexOf(id), 1)\n\n // Update local storage\n if (page.selected[page.currentView].length)\n localStorage[lsKeys.selected[page.currentView]] = JSON.stringify(page.selected[page.currentView])\n else\n delete localStorage[lsKeys.selected[page.currentView]]\n\n // Reload upload list\n // eslint-disable-next-line compat/compat\n page.getUploads(Object.assign({\n autoPage: true\n }, page.views[page.currentView]))\n }\n })\n}\n\npage.bulkDeleteUploads = () => {\n const count = page.selected[page.currentView].length\n if (!count)\n return swal('An error occurred!', 'You have not selected any uploads.', 'error')\n\n page.postBulkDeleteUploads({\n all: page.currentView === 'uploadsAll',\n field: 'id',\n values: page.selected[page.currentView],\n cb (failed) {\n // Update state of checkboxes\n if (failed.length)\n page.selected[page.currentView] = page.selected[page.currentView]\n .filter(id => {\n return failed.includes(id)\n })\n else\n page.selected[page.currentView] = []\n\n // Update local storage\n if (page.selected[page.currentView].length)\n localStorage[lsKeys.selected[page.currentView]] = JSON.stringify(page.selected[page.currentView])\n else\n delete localStorage[lsKeys.selected[page.currentView]]\n\n // Reload uploads list\n // eslint-disable-next-line compat/compat\n page.getUploads(Object.assign({\n autoPage: true\n }, page.views[page.currentView]))\n }\n })\n}\n\npage.deleteUploadsByNames = (params = {}) => {\n let appendix = ''\n if (page.permissions.moderator)\n appendix = '
Hint: You can use this feature to delete uploads by other users.'\n\n page.dom.innerHTML = `\n
\n
\n \n
\n \n
\n

Separate each entry with a new line.${appendix}

\n
\n
\n
\n \n
\n
\n
\n `\n page.fadeAndScroll()\n page.updateTrigger(params.trigger, 'active')\n\n document.querySelector('#submitBulkDelete').addEventListener('click', () => {\n const textArea = document.querySelector('#bulkDeleteNames')\n\n // Clean up\n const seen = {}\n const names = textArea.value\n .split(/\\r?\\n/)\n .map(name => {\n const trimmed = name.trim()\n return /^[^\\s]+$/.test(trimmed)\n ? trimmed\n : ''\n })\n .filter(name => {\n // Filter out invalid and duplicate names\n return (!name || Object.prototype.hasOwnProperty.call(seen, name))\n ? false\n : (seen[name] = true)\n })\n\n // Update textarea with cleaned names\n textArea.value = names.join('\\n')\n\n if (!names.length)\n return swal('An error occurred!', 'You have not entered any upload names.', 'error')\n\n page.postBulkDeleteUploads({\n all: true,\n field: 'name',\n values: names,\n cb (failed) {\n textArea.value = failed.join('\\n')\n }\n })\n })\n}\n\npage.postBulkDeleteUploads = (params = {}) => {\n const count = params.values.length\n\n const objective = `${params.values.length} upload${count === 1 ? '' : 's'}`\n const boldObjective = objective.replace(/^(\\d*)(.*)/, '$1$2')\n let text = `

You won't be able to recover ${boldObjective}!

`\n\n if (params.all) {\n const obj1 = count === 1 ? 'an upload' : 'some uploads'\n const obj2 = count === 1 ? 'another user' : 'other users'\n text += `\\n

Warning: You may be nuking ${obj1} by ${obj2}!

`\n }\n\n const content = document.createElement('div')\n content.innerHTML = text\n\n swal({\n title: 'Are you sure?',\n content,\n icon: 'warning',\n dangerMode: true,\n buttons: {\n cancel: true,\n confirm: {\n text: `Yes, nuke ${params.values.length === 1 ? 'it' : 'them'}!`,\n closeModal: false\n }\n }\n }).then(proceed => {\n if (!proceed) return\n\n axios.post('api/upload/bulkdelete', {\n field: params.fields,\n values: params.values\n }).then(response => {\n if (!response) return\n\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n const failed = Array.isArray(response.data.failed) ? response.data.failed : []\n if (failed.length === params.values.length)\n swal('An error occurred!', `Unable to delete any of the ${objective}.`, 'error')\n else if (failed.length && failed.length < params.values.length)\n swal('Warning!', `From ${objective}, unable to delete ${failed.length} of them.`, 'warning')\n else\n swal('Deleted!', `${objective} ${count === 1 ? 'has' : 'have'} been deleted.`, 'success')\n\n if (typeof params.cb === 'function')\n params.cb(failed)\n }).catch(page.onAxiosError)\n })\n}\n\npage.addSelectedUploadsToAlbum = () => {\n if (page.currentView !== 'uploads')\n return\n\n const count = page.selected[page.currentView].length\n if (!count)\n return swal('An error occurred!', 'You have not selected any uploads.', 'error')\n\n page.addUploadsToAlbum(page.selected[page.currentView], failed => {\n if (!failed) return\n if (failed.length)\n page.selected[page.currentView] = page.selected[page.currentView].filter(id => {\n return failed.includes(id)\n })\n else\n page.selected[page.currentView] = []\n\n localStorage[lsKeys.selected[page.currentView]] = JSON.stringify(page.selected[page.currentView])\n page.getUploads(page.views[page.currentView])\n })\n}\n\npage.addToAlbum = id => {\n page.addUploadsToAlbum([id], failed => {\n if (!failed) return\n page.getUploads(page.views[page.currentView])\n })\n}\n\npage.addUploadsToAlbum = (ids, callback) => {\n const count = ids.length\n\n const content = document.createElement('div')\n content.innerHTML = `\n
\n

You are about to add ${count} upload${count === 1 ? '' : 's'} to an album.

\n

If an upload is already in an album, it will be moved.

\n
\n
\n
\n
\n \n
\n
\n
\n `\n\n swal({\n icon: 'warning',\n content,\n buttons: {\n cancel: true,\n confirm: {\n text: 'OK',\n closeModal: false\n }\n }\n }).then(choose => {\n if (!choose) return\n\n const albumid = parseInt(document.querySelector('#swalAlbum').value)\n if (isNaN(albumid))\n return swal('An error occurred!', 'You did not choose an album.', 'error')\n\n axios.post('api/albums/addfiles', {\n ids,\n albumid\n }).then(add => {\n if (!add) return\n\n if (add.data.success === false) {\n if (add.data.description === 'No token provided')\n page.verifyToken(page.token)\n else\n swal('An error occurred!', add.data.description, 'error')\n\n return\n }\n\n let added = ids.length\n if (add.data.failed && add.data.failed.length)\n added -= add.data.failed.length\n\n const suffix = `upload${ids.length === 1 ? '' : 's'}`\n if (!added)\n return swal('An error occurred!', `Could not add the ${suffix} to the album.`, 'error')\n\n swal('Woohoo!', `Successfully ${albumid < 0 ? 'removed' : 'added'} ${added} ${suffix} ${albumid < 0 ? 'from' : 'to'} the album.`, 'success')\n callback(add.data.failed)\n }).catch(page.onAxiosError)\n })\n\n // Get albums list then update content of swal\n axios.get('api/albums').then(list => {\n if (list.data.success === false) {\n if (list.data.description === 'No token provided')\n page.verifyToken(page.token)\n else\n swal('An error occurred!', list.data.description, 'error')\n\n return\n }\n\n // If the prompt was replaced, the container would be missing\n const select = document.querySelector('#swalAlbum')\n if (!select) return\n\n select.innerHTML += list.data.albums\n .map(album => {\n return ``\n })\n .join('\\n')\n\n select.getElementsByTagName('option')[1].innerHTML = 'Choose an album'\n select.removeAttribute('disabled')\n }).catch(page.onAxiosError)\n}\n\npage.getAlbums = (params = {}) => {\n page.updateTrigger(params.trigger, 'loading')\n\n axios.get('api/albums').then(response => {\n if (!response) return\n\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n page.updateTrigger(params.trigger)\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n page.cache.albums = {}\n\n page.dom.innerHTML = `\n

Create new album

\n
\n
\n
\n \n
\n

Max length is ${page.albumTitleMaxLength} characters.

\n
\n
\n
\n \n
\n

Max length is ${page.albumDescMaxLength} characters.

\n
\n
\n
\n \n
\n
\n
\n
\n

List of albums

\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
IDNameFilesCreated atPublic link
\n
\n `\n\n const homeDomain = response.data.homeDomain\n const table = document.querySelector('#table')\n\n for (let i = 0; i < response.data.albums.length; i++) {\n const album = response.data.albums[i]\n const albumUrl = `${homeDomain}/a/${album.identifier}`\n\n // Prettify\n album.prettyDate = page.getPrettyDate(new Date(album.timestamp * 1000))\n\n page.cache.albums[album.id] = {\n name: album.name,\n download: album.download,\n public: album.public,\n description: album.description\n }\n\n const tr = document.createElement('tr')\n tr.innerHTML = `\n ${album.id}\n ${album.name}\n ${album.files}\n ${album.prettyDate}\n ${albumUrl}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n `\n\n table.appendChild(tr)\n }\n page.fadeAndScroll()\n page.updateTrigger(params.trigger, 'active')\n }).catch(error => {\n page.updateTrigger(params.trigger)\n page.onAxiosError(error)\n })\n}\n\npage.editAlbum = id => {\n const album = page.cache.albums[id]\n if (!album) return\n\n const div = document.createElement('div')\n div.innerHTML = `\n
\n
\n \n
\n

Max length is ${page.albumTitleMaxLength} characters.

\n
\n
\n
\n \n
\n

Max length is ${page.albumDescMaxLength} characters.

\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n `\n\n swal({\n title: 'Edit album',\n icon: 'info',\n content: div,\n buttons: {\n cancel: true,\n confirm: {\n closeModal: false\n }\n }\n }).then(value => {\n if (!value) return\n\n axios.post('api/albums/edit', {\n id,\n name: document.querySelector('#swalName').value.trim(),\n description: document.querySelector('#swalDescription').value.trim(),\n download: document.querySelector('#swalDownload').checked,\n public: document.querySelector('#swalPublic').checked,\n requestLink: document.querySelector('#swalRequestLink').checked\n }).then(response => {\n if (!response) return\n\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n if (response.data.identifier)\n swal('Success!', `Your album's new identifier is: ${response.data.identifier}.`, 'success')\n else if (response.data.name !== album.name)\n swal('Success!', `Your album was renamed to: ${response.data.name}.`, 'success')\n else\n swal('Success!', 'Your album was edited!', 'success')\n\n page.getAlbumsSidebar()\n page.getAlbums()\n }).catch(page.onAxiosError)\n })\n}\n\npage.deleteAlbum = id => {\n swal({\n title: 'Are you sure?',\n text: 'This won\\'t delete your uploads, only the album!',\n icon: 'warning',\n dangerMode: true,\n buttons: {\n cancel: true,\n confirm: {\n text: 'Yes, delete it!',\n closeModal: false\n },\n purge: {\n text: 'Umm, delete the uploads too please?',\n value: 'purge',\n className: 'swal-button--danger',\n closeModal: false\n }\n }\n }).then(proceed => {\n if (!proceed) return\n\n axios.post('api/albums/delete', {\n id,\n purge: proceed === 'purge'\n }).then(response => {\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else if (Array.isArray(response.data.failed) && response.data.failed.length) {\n return swal('An error occurred!', 'Unable to delete ', 'error')\n } else {\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n swal('Deleted!', 'Your album has been deleted.', 'success')\n page.getAlbumsSidebar()\n page.getAlbums()\n }).catch(page.onAxiosError)\n })\n}\n\npage.submitAlbum = element => {\n page.updateTrigger(element, 'loading')\n\n axios.post('api/albums', {\n name: document.querySelector('#albumName').value.trim(),\n description: document.querySelector('#albumDescription').value.trim()\n }).then(response => {\n if (!response) return\n\n page.updateTrigger(element)\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n swal('Woohoo!', 'Album was created successfully.', 'success')\n page.getAlbumsSidebar()\n page.getAlbums()\n }).catch(error => {\n page.updateTrigger(element)\n page.onAxiosError(error)\n })\n}\n\npage.getAlbumsSidebar = () => {\n axios.get('api/albums/sidebar').then(response => {\n if (!response) return\n\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n const albumsContainer = document.querySelector('#albumsContainer')\n\n // Clear albums sidebar if necessary\n const oldAlbums = albumsContainer.querySelectorAll('li > a')\n if (oldAlbums.length) {\n for (let i = 0; i < oldAlbums.length; i++)\n page.menus.splice(page.menus.indexOf(oldAlbums[i]), 1)\n albumsContainer.innerHTML = ''\n }\n\n if (response.data.albums === undefined)\n return\n\n for (let i = 0; i < response.data.albums.length; i++) {\n const album = response.data.albums[i]\n const li = document.createElement('li')\n const a = document.createElement('a')\n a.id = album.id\n a.innerHTML = album.name\n a.className = 'is-relative'\n\n a.addEventListener('click', event => {\n page.getUploads({\n album: parseInt(event.currentTarget.id),\n trigger: event.currentTarget\n })\n })\n page.menus.push(a)\n\n li.appendChild(a)\n albumsContainer.appendChild(li)\n }\n }).catch(page.onAxiosError)\n}\n\npage.changeToken = (params = {}) => {\n page.dom.innerHTML = `\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n \n \n \n Request new token\n \n
\n
\n `\n page.fadeAndScroll()\n page.updateTrigger(params.trigger, 'active')\n\n document.querySelector('#getNewToken').addEventListener('click', event => {\n const trigger = event.currentTarget\n page.updateTrigger(trigger, 'loading')\n axios.post('api/tokens/change').then(response => {\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n page.updateTrigger(trigger)\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n page.updateTrigger(trigger)\n swal({\n title: 'Woohoo!',\n text: 'Your token was successfully changed.',\n icon: 'success'\n }).then(() => {\n axios.defaults.headers.common.token = response.data.token\n localStorage[lsKeys.token] = response.data.token\n page.token = response.data.token\n page.changeToken()\n })\n }).catch(error => {\n page.updateTrigger(trigger)\n page.onAxiosError(error)\n })\n })\n}\n\npage.changePassword = (params = {}) => {\n page.dom.innerHTML = `\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n
\n \n
\n
\n
\n `\n page.fadeAndScroll()\n page.updateTrigger(params.trigger, 'active')\n\n document.querySelector('#sendChangePassword').addEventListener('click', event => {\n if (!page.dom.querySelector('form').checkValidity()) return\n if (document.querySelector('#password').value === document.querySelector('#passwordConfirm').value)\n page.sendNewPassword(document.querySelector('#password').value, event.currentTarget)\n else\n swal({\n title: 'Password mismatch!',\n text: 'Your passwords do not match, please try again.',\n icon: 'error'\n })\n })\n}\n\npage.sendNewPassword = (pass, element) => {\n page.updateTrigger(element, 'loading')\n\n axios.post('api/password/change', { password: pass }).then(response => {\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n page.updateTrigger(element)\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n page.updateTrigger(element)\n swal({\n title: 'Woohoo!',\n text: 'Your password was successfully changed.',\n icon: 'success'\n }).then(() => {\n page.changePassword()\n })\n }).catch(error => {\n page.updateTrigger(element)\n page.onAxiosError(error)\n })\n}\n\npage.getUsers = (params = {}) => {\n page.updateTrigger(params.trigger, 'loading')\n\n if (params.pageNum === undefined)\n params.pageNum = 0\n\n if (!page.permissions.admin)\n return swal('An error occurred!', 'You can not do this!', 'error')\n\n const url = `api/users/${params.pageNum}`\n axios.get(url).then(response => {\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n page.updateTrigger(params.trigger)\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n if (params.pageNum && (response.data.users.length === 0)) {\n // Only remove loading class here, since beyond this the entire page will be replaced anyways\n page.updateTrigger(params.trigger)\n return swal('An error occurred!', `There are no more users to populate page ${params.pageNum + 1}.`, 'error')\n }\n\n page.currentView = 'users'\n page.cache.users = {}\n\n const pagination = page.paginate(response.data.count, 25, params.pageNum)\n\n const extraControls = `\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n `\n\n const controls = `\n
\n
\n
\n \n \n \n \n \n \n \n \n \n Bulk disable\n \n \n \n \n \n Bulk delete\n \n
\n
\n `\n\n // Whether there are any unselected items\n let unselected = false\n\n page.dom.innerHTML = `\n ${pagination}\n ${extraControls}\n ${controls}\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
IDUsernameUploadsUsageGroup
\n
\n
\n ${pagination}\n `\n\n const table = document.querySelector('#table')\n\n for (let i = 0; i < response.data.users.length; i++) {\n const user = response.data.users[i]\n const selected = page.selected.users.includes(user.id)\n if (!selected) unselected = true\n\n let displayGroup = null\n const groups = Object.keys(user.groups)\n for (let i = 0; i < groups.length; i++) {\n if (!user.groups[groups[i]]) break\n displayGroup = groups[i]\n }\n\n // Server-side explicitly expects either of these two values to consider a user as disabled\n const enabled = user.enabled !== false && user.enabled !== 0\n page.cache.users[user.id] = {\n username: user.username,\n groups: user.groups,\n enabled,\n displayGroup\n }\n\n const tr = document.createElement('tr')\n tr.dataset.id = user.id\n tr.innerHTML = `\n \n ${user.id}\n ${user.username}\n ${user.uploads}\n ${page.getPrettyBytes(user.usage)}\n ${displayGroup}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n `\n\n table.appendChild(tr)\n page.checkboxes.users = table.querySelectorAll('.checkbox[data-action=\"select\"]')\n }\n\n const selectAll = document.querySelector('#selectAll')\n if (selectAll && !unselected) {\n selectAll.checked = true\n selectAll.title = 'Unselect all'\n }\n\n page.fadeAndScroll()\n page.updateTrigger(params.trigger, 'active')\n\n page.views.users.pageNum = response.data.users.length ? params.pageNum : 0\n }).catch(error => {\n page.updateTrigger(params.trigger)\n page.onAxiosError(error)\n })\n}\n\npage.editUser = id => {\n const user = page.cache.users[id]\n if (!user) return\n\n const groupOptions = Object.keys(page.permissions).map((g, i, a) => {\n const selected = g === user.displayGroup\n const disabled = !(a[i + 1] && page.permissions[a[i + 1]])\n return ``\n }).join('\\n')\n\n const div = document.createElement('div')\n div.innerHTML = `\n
\n \n
\n \n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n `\n\n swal({\n title: 'Edit user',\n icon: 'info',\n content: div,\n buttons: {\n cancel: true,\n confirm: {\n closeModal: false\n }\n }\n }).then(proceed => {\n if (!proceed) return\n\n axios.post('api/users/edit', {\n id,\n username: document.querySelector('#swalUsername').value,\n group: document.querySelector('#swalGroup').value,\n enabled: document.querySelector('#swalEnabled').checked,\n resetPassword: document.querySelector('#swalResetPassword').checked\n }).then(response => {\n if (!response) return\n\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n if (response.data.password) {\n const div = document.createElement('div')\n div.innerHTML = `\n

${user.username}'s new password is:

\n

${response.data.password}

\n `\n swal({\n title: 'Success!',\n icon: 'success',\n content: div\n })\n } else if (response.data.update && response.data.update.username !== user.username) {\n swal('Success!', `${user.username} was renamed into: ${response.data.update.name}.`, 'success')\n } else {\n swal('Success!', 'The user was edited!', 'success')\n }\n\n page.getUsers(page.views.users)\n }).catch(page.onAxiosError)\n })\n}\n\npage.disableUser = id => {\n const user = page.cache.users[id]\n if (!user || !user.enabled) return\n\n const content = document.createElement('div')\n content.innerHTML = `You will be disabling a user with the username ${page.cache.users[id].username}.`\n\n swal({\n title: 'Are you sure?',\n icon: 'warning',\n content,\n dangerMode: true,\n buttons: {\n cancel: true,\n confirm: {\n text: 'Yes, disable them!',\n closeModal: false\n }\n }\n }).then(proceed => {\n if (!proceed) return\n\n axios.post('api/users/disable', { id }).then(response => {\n if (!response) return\n\n if (response.data.success === false)\n if (response.data.description === 'No token provided')\n return page.verifyToken(page.token)\n else\n return swal('An error occurred!', response.data.description, 'error')\n\n swal('Success!', 'The user has been disabled.', 'success')\n page.getUsers(page.views.users)\n }).catch(page.onAxiosError)\n })\n}\n\n// Roughly based on https://github.com/mayuska/pagination/blob/master/index.js\npage.paginate = (totalItems, itemsPerPage, currentPage) => {\n currentPage = currentPage + 1\n const step = 3\n const numPages = Math.ceil(totalItems / itemsPerPage)\n\n let template = ''\n const elementsToShow = step * 2\n const add = {\n pageNum (start, end) {\n for (let i = start; i <= end; ++i)\n template += `
  • ${i}
  • `\n },\n startDots () {\n template += `\n
  • 1
  • \n
  • \n `\n },\n endDots () {\n template += `\n
  • \n
  • ${numPages}
  • \n `\n }\n }\n\n if (elementsToShow + 1 >= numPages) {\n add.pageNum(1, numPages)\n } else if (currentPage < elementsToShow) {\n add.pageNum(1, elementsToShow)\n add.endDots()\n } else if (currentPage > numPages - elementsToShow + 1) {\n add.startDots()\n add.pageNum(numPages - elementsToShow + 1, numPages)\n } else {\n add.startDots()\n add.pageNum(currentPage - step + 1, currentPage + step - 1)\n add.endDots()\n }\n\n return `\n \n `\n}\n\npage.getStatistics = (params = {}) => {\n if (!page.permissions.admin)\n return swal('An error occurred!', 'You can not do this!', 'error')\n\n page.updateTrigger(params.trigger, 'loading')\n\n const url = 'api/stats'\n axios.get(url).then(response => {\n if (response.data.success === false)\n if (response.data.description === 'No token provided') {\n return page.verifyToken(page.token)\n } else {\n page.updateTrigger(params.trigger)\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n let content = ''\n const keys = Object.keys(response.data.stats)\n for (let i = 0; i < keys.length; i++) {\n let rows = ''\n if (!response.data.stats[keys[i]])\n rows += `\n \n Generating, please try again later\\u2026\n \n \n `\n else\n try {\n const types = response.data.stats[keys[i]]._types || {}\n const valKeys = Object.keys(response.data.stats[keys[i]])\n for (let j = 0; j < valKeys.length; j++) {\n // Skip keys that starts with an underscore\n if (/^_/.test(valKeys[j]))\n continue\n\n const value = response.data.stats[keys[i]][valKeys[j]]\n let parsed = value\n\n // Parse values with some preset formatting\n if ((types.number || []).includes(valKeys[j]))\n parsed = value.toLocaleString()\n if ((types.byte || []).includes(valKeys[j]))\n parsed = page.getPrettyBytes(value)\n if ((types.byteUsage || []).includes(valKeys[j]))\n parsed = `${page.getPrettyBytes(value.used)} / ${page.getPrettyBytes(value.total)} (${Math.round(value.used / value.total * 100)}%)`\n\n const string = valKeys[j]\n .replace(/([A-Z])/g, ' $1')\n .toUpperCase()\n rows += `\n \n ${string}\n ${parsed}\n \n `\n }\n } catch (error) {\n rows = `\n \n Error parsing response. Try again?\n \n \n `\n page.onError(error)\n }\n\n content += `\n
    \n \n \n \n \n \n \n \n \n ${rows}\n \n
    ${keys[i].toUpperCase()}
    \n
    \n `\n }\n\n page.dom.innerHTML = content\n page.fadeAndScroll()\n page.updateTrigger(params.trigger, 'active')\n }).catch(error => {\n page.updateTrigger(params.trigger)\n page.onAxiosError(error)\n })\n}\n\nwindow.onload = () => {\n // Polyfill Object.assign()\n // eslint-disable-next-line compat/compat\n if (typeof Object.assign !== 'function')\n // Must be writable: true, enumerable: false, configurable: true\n Object.defineProperty(Object, 'assign', {\n value: function assign (target, varArgs) { // .length of function is 2\n 'use strict'\n if (target === null || target === undefined)\n throw new TypeError('Cannot convert undefined or null to object')\n const to = Object(target)\n for (let i = 1; i < arguments.length; i++) {\n const nextSource = arguments[i]\n if (nextSource !== null && nextSource !== undefined)\n for (const nextKey in nextSource)\n // Avoid bugs when hasOwnProperty is shadowed\n if (Object.prototype.hasOwnProperty.call(nextSource, nextKey))\n to[nextKey] = nextSource[nextKey]\n }\n return to\n },\n writable: true,\n configurable: true\n })\n\n // Add 'no-touch' class to non-touch devices\n if (!('ontouchstart' in document.documentElement))\n document.documentElement.classList.add('no-touch')\n\n const selectedKeys = ['uploads', 'uploadsAll', 'users']\n for (let i = 0; i < selectedKeys.length; i++) {\n const ls = localStorage[lsKeys.selected[selectedKeys[i]]]\n if (ls) page.selected[selectedKeys[i]] = JSON.parse(ls)\n }\n\n page.preparePage()\n\n page.clipboardJS = new ClipboardJS('.clipboard-js')\n\n page.clipboardJS.on('success', () => {\n return swal('Copied!', 'The link has been copied to clipboard.', 'success')\n })\n\n page.clipboardJS.on('error', page.onError)\n\n page.lazyLoad = new LazyLoad()\n}\n"]}