{"version":3,"sources":["dashboard.js"],"names":["const","lsKeys","token","viewType","uploads","uploadsAll","selected","albums","albumsAll","users","originalNames","page","section","dom","localStorage","username","permissions","menusContainer","menus","currentView","views","type","album","pageNum","filters","all","checkboxes","lastSelected","selectAlbumContainer","cache","clipboardJS","lazyLoad","imageExts","videoExts","isSomethingLoading","fadingIn","albumTitleMaxLength","albumDescMaxLength","unhide","document","querySelector","classList","add","remove","onError","error","console","content","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","checkClientVersion","apiVersion","match","src","text","buttons","confirm","closeModal","then","reload","reloadOnError","axios","post","success","removeItem","defaults","headers","common","version","prepareDashboard","catch","addEventListener","domClick","event","target","contains","preventDefault","itemMenus","selector","onclick","getUploads","deleteUploadsByNames","getAlbums","changeToken","changePassword","logout","params","group","getStatistics","getUsers","loop","i","item","warnSomethingLoading","call","Object","assign","trigger","currentTarget","push","length","moderator","getAlbumsSidebar","prepareShareX","updateTrigger","timer","newState","parentNode","tagName","className","includes","let","getItemID","element","parent","parseInt","dataset","id","action","hasAttribute","stopPropagation","setUploadsView","toggleOriginalNames","addToAlbum","deleteUpload","addSelectedUploadsToAlbum","bulkDeleteUploads","displayPreview","uploadFiltersHelp","filterUploads","submitAlbum","editAlbum","disableAlbum","viewAlbumUploads","createUser","editUser","disableUser","deleteUser","viewUserUploads","getNewToken","clearSelection","select","selectAll","focusJumpToPage","switchPage","fadeAndScroll","disableFading","clearTimeout","setTimeout","scrollIntoView","behavior","block","inline","getByView","view","get","func","goto","jumpToPage","jumpid","checkValidity","parsed","value","isNaN","focus","url","undefined","test","minoffset","Date","getTimezoneOffset","pages","Math","ceil","count","files","autoPage","basedomain","max","pagination","paginate","extraControls","escape","controls","bottomExtraControls","replace","bottomPagination","unselected","showOriginalNames","hasExpiryDateColumn","some","file","expirydate","thumb","exec","extname","toLowerCase","name","original","prettyBytes","getPrettyBytes","size","prettyDate","getPrettyDate","timestamp","prettyExpiryDate","appendix","userid","albumid","table","upload","div","appendChild","querySelectorAll","allAlbums","tr","ip","checked","update","isimage","isvideo","onload","body","onerror","video","autoplay","insertAdjacentElement","splice","indexOf","JSON","stringify","selectInBetween","lastElement","thisIndex","index","lastIndex","abs","shiftKey","suffix","substring","proceed","Boolean","style","trim","filtersid","user","postBulkDeleteUploads","field","values","cb","failed","filter","textArea","seen","names","split","map","trimmed","prototype","hasOwnProperty","join","objective","dangerMode","cancel","fields","Array","isArray","addUploadsToAlbum","ids","callback","choose","added","list","getElementsByTagName","removeAttribute","homeDomain","createNewAlbum","albumUrl","enabled","download","public","requestLink","identifier","purge","sidebar","albumsContainer","oldAlbums","li","a","sendNewPassword","pass","password","admin","displayGroup","groups","keys","registration","prettyTokenUpdate","usage","groupOptions","g","resetPassword","autoClose","displayName","totalItems","itemsPerPage","currentPage","numPages","template","start","end","elementsToShow","step","stats","rows","types","_types","valKeys","j","number","toLocaleString","byte","byteUsage","used","total","floor","uptime","getPrettyUptime","s","toUpperCase","hrtime","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,OAAQ,iBACRC,UAAW,oBACXC,MAAO,iBAETC,cAAe,CACbN,QAAS,gBACTC,WAAY,qBAIVM,KAAO,CAEXC,QAAS,KAETC,IAAK,KAGLX,MAAOY,aAAab,OAAOC,OAG3Ba,SAAU,KACVC,YAAa,KAGbC,eAAgB,KAChBC,MAAO,GAEPC,YAAa,KACbC,MAAO,CAELhB,QAAS,CACPiB,KAAMP,aAAab,OAAOE,SAASC,SACnCM,cAA8D,MAA/CI,aAAab,OAAOS,cAAcN,SACjDkB,MAAO,KACPC,QAAS,MAGXlB,WAAY,CACVgB,KAA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,oBAAkB,WAGX,mBAAlBwB,OAAOC,QAEhBD,OAAO4O,eAAe5O,OAAQ,SAAU,CACtCmE,MAAO,SAAiBxF,EAAQkQ,GAC9B,aAlyBA,IAAIC,EAAcC,UAmyBlB,GAAIpQ,MAAAA,EACF,MAAM,IAAIqQ,UAAU,8CAEtB,IADAtW,IAAMuW,EAAKjP,OAAOrB,GACTiB,EAAI,EAAGA,EAAImP,UAAU1O,OAAQT,IAAK,CACzClH,IAAMwW,EAAaH,EAAUnP,GAC7B,GAAIsP,MAAAA,EACF,IAAKxW,IAAMyW,KAAWD,EAEhBlP,OAAOmK,UAAUC,eAAerK,KAAKmP,EAAYC,KACnDF,EAAGE,GAAWD,EAAWC,IAEjC,OAAOF,GAETG,UAAU,EACVC,cAAc,IAIZ,iBAAkBpU,SAASqU,iBAC/BrU,SAASqU,gBAAgBnU,UAAUC,IAAI,YAGzC,IADA1C,IAAM6W,EAAe,CAAC,UAAW,aAAc,SAAU,YAAa,SAC7D3P,EAAI,EAAGA,EAAI2P,EAAalP,OAAQT,IAAK,CAC5ClH,IAAM8W,EAAKhW,aAAab,OAAOK,SAASuW,EAAa3P,KACjD4P,IAAInW,KAAKL,SAASuW,EAAa3P,IAAM0I,KAAKmH,MAAMD,IAGtDnW,KAAK0D,cAEL1D,KAAKmB,YAAc,IAAIkV,YAAY,iBAEnCrW,KAAKmB,YAAYmV,GAAG,WAAS,WAC3B,OAAO9T,KAAK,GAAI,yCAA0C,UAAW,CACnE2B,SAAS,EACTkD,MAAO,UAIXrH,KAAKmB,YAAYmV,GAAG,QAAStW,KAAKiC,SAElCjC,KAAKoB,SAAW,IAAImV","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 albums: 'selectedAlbums',\n albumsAll: 'selectedAlbumsAll',\n users: 'selectedUsers'\n },\n originalNames: {\n uploads: 'originalNames',\n uploadsAll: 'originalNamesAll'\n }\n}\n\nconst page = {\n // #dashboard\n section: null,\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 // params of uploads view\n uploads: {\n type: localStorage[lsKeys.viewType.uploads],\n originalNames: localStorage[lsKeys.originalNames.uploads] === '1',\n album: null, // album's id\n pageNum: null\n },\n // params of uploads view (all)\n uploadsAll: {\n type: localStorage[lsKeys.viewType.uploadsAll],\n originalNames: localStorage[lsKeys.originalNames.uploadsAll] === '1',\n filters: null,\n pageNum: null,\n all: true\n },\n // params of albums view\n albums: {\n filters: null,\n pageNum: null\n },\n // params of albums view (all)\n albumsAll: {\n filters: null,\n pageNum: null,\n all: true\n },\n // params of users view\n users: {\n filters: null,\n pageNum: null\n }\n },\n\n // ids of selected items (shared across pages and will be synced with localStorage)\n selected: {\n uploads: [],\n uploadsAll: [],\n albums: [],\n albumsAll: [],\n users: []\n },\n checkboxes: [],\n lastSelected: [],\n\n // select album dom for dialogs/modals\n selectAlbumContainer: null,\n\n // cache for dialogs/modals\n cache: {},\n\n clipboardJS: null,\n lazyLoad: null,\n\n imageExts: ['.webp', '.jpg', '.jpeg', '.gif', '.png', '.tiff', '.tif', '.svg'],\n // TODO: Disable \"Load original\" button with non-streamable extensions\n videoExts: ['.webm', '.mp4', '.wmv', '.avi', '.mov', '.mkv', '.m4v', '.m2ts'],\n\n isSomethingLoading: false,\n fadingIn: null,\n\n albumTitleMaxLength: 70,\n albumDescMaxLength: 4000\n}\n\npage.unhide = () => {\n document.querySelector('#loader').classList.add('is-hidden')\n page.section.classList.remove('is-hidden')\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.checkClientVersion = apiVersion => {\n const self = document.querySelector('#mainScript')\n const match = self.src.match(/\\?_=(\\d+)$/)\n if (match && match[1] && match[1] !== apiVersion)\n return swal({\n title: 'Update detected!',\n text: 'Client assets have been updated. Reload to display the latest version?',\n icon: 'info',\n buttons: {\n confirm: {\n text: 'Reload',\n closeModal: false\n }\n }\n }).then(() => {\n window.location.reload()\n })\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 if (response.data.version)\n page.checkClientVersion(response.data.version)\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.section = document.querySelector('#dashboard')\n page.dom = page.section.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: '#itemManageYourAlbums', 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: '#itemManageAlbums', onclick: page.getAlbums, 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 if (page.isSomethingLoading)\n return page.warnSomethingLoading()\n\n // eslint-disable-next-line compat/compat\n itemMenus[i].onclick.call(null, Object.assign(itemMenus[i].params || {}, {\n trigger: event.currentTarget\n }))\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 page.unhide()\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.warnSomethingLoading = () => {\n swal('Please wait!', 'Something else is still loading\\u2026', 'warning', {\n buttons: false,\n timer: 3000\n })\n}\n\npage.updateTrigger = (trigger, newState) => {\n if (!trigger) return\n\n // Disable menus container and pagination when loading\n if (newState === 'loading') {\n page.isSomethingLoading = true\n page.section.classList.add('is-loading')\n } else {\n page.section.classList.remove('is-loading')\n page.isSomethingLoading = false\n }\n\n if (newState === 'loading') {\n trigger.classList.add('is-loading')\n } else if (newState === 'active') {\n if (trigger.parentNode.tagName === 'LI' && !trigger.className.includes('pagination-link')) {\n for (let i = 0; i < page.menus.length; i++)\n page.menus[i].classList.remove('is-active')\n trigger.classList.add('is-active')\n }\n trigger.classList.remove('is-loading')\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 // Uploads\n case 'view-list':\n return page.setUploadsView('list', element)\n case 'view-thumbs':\n return page.setUploadsView('thumbs', element)\n case 'toggle-original-names':\n return page.toggleOriginalNames(element)\n case 'add-to-album':\n return page.addToAlbum(id)\n case 'delete-upload':\n return page.deleteUpload(id)\n case 'add-selected-uploads-to-album':\n return page.addSelectedUploadsToAlbum()\n case 'bulk-delete-uploads':\n return page.bulkDeleteUploads()\n case 'display-preview':\n return page.displayPreview(id)\n // Manage uploads\n case 'upload-filters-help':\n return page.uploadFiltersHelp(element)\n case 'filter-uploads':\n return page.filterUploads(element)\n // Manage your albums\n case 'submit-album':\n return page.submitAlbum(element)\n case 'edit-album':\n return page.editAlbum(id)\n case 'disable-album':\n return page.disableAlbum(id)\n case 'view-album-uploads':\n return page.viewAlbumUploads(id, element)\n // Manage users\n case 'create-user':\n return page.createUser()\n case 'edit-user':\n return page.editUser(id)\n case 'disable-user':\n return page.disableUser(id)\n case 'delete-user':\n return page.deleteUser(id)\n case 'view-user-uploads':\n return page.viewUserUploads(id, element)\n // Others\n case 'get-new-token':\n return page.getNewToken(element)\n // Uploads & Users\n case 'clear-selection':\n return page.clearSelection()\n case 'select':\n return page.select(element, event)\n case 'select-all':\n return page.selectAll(element)\n case 'page-ellipsis':\n return page.focusJumpToPage(element)\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 = disableFading => {\n if (page.fadingIn) {\n clearTimeout(page.fadingIn)\n page.dom.classList.remove('fade-in')\n }\n\n if (!disableFading) {\n page.dom.classList.add('fade-in')\n page.fadingIn = setTimeout(() => {\n page.dom.classList.remove('fade-in')\n }, 500)\n }\n\n page.dom.scrollIntoView({\n behavior: disableFading ? 'auto' : 'smooth',\n block: 'start',\n inline: 'nearest'\n })\n}\n\npage.getByView = (view, get) => {\n switch (view) {\n case 'uploads':\n case 'uploadsAll':\n return {\n type: 'uploads',\n func: page.getUploads\n }[get]\n case 'albums':\n case 'albumsAll':\n return {\n type: 'albums',\n func: page.getAlbums\n }[get]\n case 'users':\n return {\n type: 'users',\n func: page.getUsers\n }[get]\n default:\n return null\n }\n}\n\npage.switchPage = (action, element) => {\n if (page.isSomethingLoading)\n return page.warnSomethingLoading()\n\n // eslint-disable-next-line compat/compat\n const params = Object.assign(page.views[page.currentView], {\n trigger: element\n })\n\n const func = page.getByView(page.currentView, 'func')\n\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(`#${element.dataset.jumpid || '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 = element => {\n const jumpToPage = document.querySelector(`#${element.dataset.jumpid || 'jumpToPage'}`)\n if (!jumpToPage) return\n jumpToPage.focus()\n jumpToPage.select()\n}\n\npage.getUploads = (params = {}) => {\n if (params && params.all && !page.permissions.moderator)\n return swal('An error occurred!', 'You cannot do this!', 'error')\n\n if (page.isSomethingLoading)\n return page.warnSomethingLoading()\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\n if (params.all)\n headers.all = '1'\n\n if (params.filters) {\n headers.filters = params.filters\n\n // Send client timezone offset if properly using date: and/or :expiry filters\n // Server will pretend client is on UTC if unset\n if (/(^|\\s)(date|expiry):[\\d\"]/.test(params.filters))\n headers.minoffset = new Date().getTimezoneOffset()\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 pages = Math.ceil(response.data.count / 25)\n const files = response.data.files\n if (params.pageNum && (files.length === 0)) {\n page.updateTrigger(params.trigger)\n if (params.autoPage) {\n params.pageNum = pages - 1\n return page.getUploads(params)\n } else {\n return swal('An error occurred!', `There are no more uploads to populate page ${params.pageNum + 1}.`, 'error')\n }\n }\n\n page.currentView = params.all ? 'uploadsAll' : 'uploads'\n page.cache = {}\n\n const albums = response.data.albums\n const users = response.data.users\n const basedomain = response.data.basedomain\n\n if (params.pageNum < 0) params.pageNum = Math.max(0, pages + params.pageNum)\n const pagination = page.paginate(response.data.count, 25, params.pageNum)\n\n const 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 Toggle original names\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 // Do some string replacements for bottom controls\n const bottomFiltersId = 'bFilters'\n const bottomJumpId = 'bJumpToPage'\n const bottomExtraControls = extraControls\n .replace(/id=\"filters\"/, `id=\"${bottomFiltersId}\"`)\n .replace(/(data-action=\"filter-uploads\")/, `$1 data-filtersid=\"${bottomFiltersId}\"`)\n .replace(/id=\"jumpToPage\"/, `id=\"${bottomJumpId}\"`)\n .replace(/(data-action=\"jump-to-page\")/g, `$1 data-jumpid=\"${bottomJumpId}\"`)\n const bottomPagination = pagination\n .replace(/(data-action=\"page-ellipsis\")/g, `$1 data-jumpid=\"${bottomJumpId}\"`)\n\n // Whether there are any unselected items\n let unselected = false\n\n const showOriginalNames = page.views[page.currentView].originalNames\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[files[i].id] = {\n name: files[i].name,\n original: files[i].original,\n thumb: files[i].thumb,\n file: 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 ${controls}\n ${bottomExtraControls}\n ${bottomPagination}\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 ${showOriginalNames ? `

${upload.original}

` : ''}\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 = table.querySelectorAll('.checkbox[data-action=\"select\"]')\n }\n } else {\n const allAlbums = params.all && params.filters && params.filters.includes('albumid:')\n page.dom.innerHTML = `\n ${pagination}\n ${extraControls}\n ${controls}\n
\n \n \n \n \n \n ${showOriginalNames ? '' : ''}\n ${params.album === undefined ? `` : ''}\n ${allAlbums ? '' : ''}\n \n ${params.all ? '' : ''}\n \n ${hasExpiryDateColumn ? '' : ''}\n \n \n \n \n \n
File nameOriginal nameUser' : 'albumid\">Album'}AlbumSizeIPUpload dateExpiry date
\n
\n ${controls}\n ${bottomExtraControls}\n ${bottomPagination}\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 ${showOriginalNames ? `${upload.original}` : ''}\n ${params.album === undefined ? `${upload.appendix}` : ''}\n ${allAlbums ? `${upload.albumid ? (albums[upload.albumid] || '') : ''}` : ''}\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 = table.querySelectorAll('.checkbox[data-action=\"select\"]')\n }\n }\n\n const selectAll = document.querySelector('#selectAll')\n if (selectAll && !unselected && files.length) {\n selectAll.checked = true\n selectAll.title = 'Unselect all'\n }\n\n if (page.views[page.currentView].type === 'thumbs') {\n page.fadeAndScroll(true)\n page.lazyLoad.update()\n } else {\n page.fadeAndScroll()\n }\n\n page.updateTrigger(params.trigger, 'active')\n\n if (page.currentView === 'uploads')\n page.views.uploads.album = params.album\n page.views[page.currentView].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 if (page.isSomethingLoading)\n return page.warnSomethingLoading()\n\n if (view === 'list') {\n delete localStorage[lsKeys.viewType[page.currentView]]\n page.views[page.currentView].type = undefined\n } else {\n localStorage[lsKeys.viewType[page.currentView]] = view\n page.views[page.currentView].type = view\n }\n\n // eslint-disable-next-line compat/compat\n page.getUploads(Object.assign(page.views[page.currentView], {\n trigger: element\n }))\n}\n\npage.toggleOriginalNames = element => {\n if (page.isSomethingLoading)\n return page.warnSomethingLoading()\n\n if (page.views[page.currentView].originalNames) {\n delete localStorage[lsKeys.originalNames[page.currentView]]\n page.views[page.currentView].originalNames = false\n } else {\n localStorage[lsKeys.originalNames[page.currentView]] = '1'\n page.views[page.currentView].originalNames = true\n }\n\n // eslint-disable-next-line compat/compat\n page.getUploads(Object.assign(page.views[page.currentView], {\n trigger: element\n }))\n}\n\npage.displayPreview = id => {\n const file = page.cache[id]\n if (!file.thumb) return\n\n const div = document.createElement('div')\n div.innerHTML = `\n
\n

\n

${file.name}
\n
${file.original}
\n

\n

\n \n

\n
\n `\n\n if (file.file) {\n const exec = /.[\\w]+(\\?|$)/.exec(file.file)\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.file\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.file\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.length; i++) {\n const id = page.getItemID(page.checkboxes[i])\n if (isNaN(id)) continue\n if (page.checkboxes[i].checked !== element.checked) {\n page.checkboxes[i].checked = element.checked\n if (page.checkboxes[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.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[i].checked = lastElement.checked\n const id = page.getItemID(page.checkboxes[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 if (event.shiftKey && page.lastSelected) {\n page.selectInBetween(element, page.lastSelected)\n // Check or uncheck depending on the state of the initial checkbox\n element.checked = page.lastSelected.checked\n } else {\n page.lastSelected = 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.getByView(page.currentView, 'type')\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\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.uploadFiltersHelp = element => {\n const all = Boolean(element.dataset.all)\n const content = document.createElement('div')\n content.style = 'text-align: left'\n content.innerHTML = `${all ? `\n There are 2 filter keys, namely user (username) and ip.\n These keys can be specified more than once.\n For usernames with whitespaces, wrap them with double quotes (\").\n Special cases such as uploads by non-registered users or have no IPs respectively, use user:- or ip:-.\n\n To exclude certain users/ips while still listing every other uploads, add negation sign (-) before the keys.\n Negation sign can also be used to exclude the special cases mentioned above (i.e. -user:- or -ip:-).\n\n If you know the ID of a user's album, you can list its uploads with albumid key.\n Negation sign works for this key as well.\n ` : `\n There is only 1 filter key, namely albumid.\n This key can be specified more than once.\n Special case such as uploads with no albums, use albumid:-.\n\n To exclude certain albums while still listing every other uploads, add negation sign (-) before the keys.\n Negation sign can also be used to exclude the special case mentioned above (i.e. -albumid:-).\n `}\n There are 2 range keys: date (upload date) and expiry (expiry date).\n Their format is: \"YYYY/MM/DD HH:MM:SS-YYYY/MM/DD HH:MM:SS\" (\"from\" date and \"to\" date respectively).\n You may specify only one of the dates.\n If \"to\" date is missing, 'now' will be used. If \"from\" date is missing, 'beginning of time' will be used.\n If any of the subsequent date or time units are not specified, their first value will be used (e.g. January for month, 1 for day, and so on).\n If only time is specified, today's date will be used.\n If you do not need to specify both date and time, you may omit the double quotes.\n In conclusion, the following examples are all valid: date:\"2020/01/01 01:23-2018/01/01 06\", expiry:-2020/05, date:12:34:56.\n These keys can only be specified once each.\n\n Timezone? Feel free to query the dates with your own timezone.\n API requests to the filter endpoint will attach your browser's timezone offset, so the server will automatically calculate timezone differences.\n\n Matches can also be sorted with sort keys.\n Their formats are: sort:columnName[:d[escending]], where :d[escending] is an optional tag to set the direction to descending.\n This key must be used with internal column names used in the database (id, ${all ? 'userid' : 'albumid'}, and so on),\n but there are 2 shortcuts available: date for timestamp column and expiry for expirydate column.\n This key can also be specified more than once, where their order will decide the sorting steps.\n\n Finally, there are type-is keys to refine by types.\n You can use is:image and is:video to list images and videos respectively.\n This will only use image/video extensions whose thumbnails can be generated by the safe.\n Negation sign works for this key as well.\n Mixing inclusion and exclusion is not allowed (i.e. is:image -is:video, since the second key is redundant).\n\n Any leftover keywords which do not use keys (non-keyed keywords) will be matched against the matches' file names.\n Excluding certain keywords is also supported by adding negation sign before the keywords.\n\n Internal steps:\n ${all ? `- Query uploads passing ALL exclusion filter keys OR matching ANY filter keys, if any.\n - Refine matches` : '- Filter uploads'} using date key, if any.\n - Refine matches using expiry key, if any.\n - Refine matches using type-is keys, if any.\n - Refine matches using ANY non-keyed keywords, if any.\n - Filter matches using ALL exclusion non-keyed keywords, if any.\n - Sort matches using sorting keys, if any.\n\n Examples:\n ${all ? `- Uploads from users named \"demo\" AND/OR \"John Doe\" AND/OR non-registered users:\n user:demo user:\"John Doe\" user:-\n - ALL uploads, but NOT the ones from user named \"demo\" AND \"John Doe\":\n -user:demo -user:\"John Doe\"\n - Uploads from IP \"127.0.0.1\" AND which file names match \"*.rar\" OR \"*.zip\":\n ip:127.0.0.1 *.rar *.zip\n ` : ''}- Uploads without albums:\n albumid:-\n - ALL uploads, but NOT the ones from album with ID 69:\n -albumid:69\n - Uploads uploaded since \"1 June 2019 00:00:00\":\n date:2019/06\n - Uploads uploaded between \"7 April 2020 12:00:00\" and \"7 April 2020 23:59:59\":\n date:\"2020/04/07 12-2020/04/07 23:59:59\"\n - Uploads uploaded before \"5 February 2020 00:00:00\":\n date:-2020/02/05\n - Uploads which file names match \"*.gz\" but NOT \"*.tar.gz\":\n *.gz -*.tar.gz\n - Sort matches by \"size\" column in ascending and descending order respectively:\n ${all ? 'user:\"John Doe\"' : '*.txt'} sort:size\n *.mp4 ${all ? 'user:- ' : ''}sort:size:d\n ${!page.permissions.moderator ? `\n Notice: Regular users may face some limitations in the amount of keys that can be used at a time.\n ` : ''}\n Friendly reminder: This window can be scrolled up!\n `.trim().replace(/^\\s*/g, '').replace(/\\n/g, '
')\n\n swal({ content }).then(() => {\n // Restore modal size\n document.body.querySelector('.swal-overlay .swal-modal').classList.remove('is-expanded')\n })\n\n // Expand modal size\n document.body.querySelector('.swal-overlay .swal-modal:not(.is-expanded)').classList.add('is-expanded')\n}\n\npage.filterUploads = element => {\n const filters = document.querySelector(`#${element.dataset.filtersid || 'filters'}`).value\n .trim()\n .replace(/\\t/g, ' ')\n .replace(/(^|\\s)((albumid|ip|user|date|expiry|is|sort|orderby):)\\s+/g, '$2')\n // eslint-disable-next-line compat/compat\n page.getUploads(Object.assign(page.views[page.currentView], {\n filters,\n pageNum: 0,\n trigger: element\n }))\n}\n\npage.viewUserUploads = (id, element) => {\n const user = page.cache[id]\n if (!user) return\n element.classList.add('is-loading')\n // Wrap username in quotes if it contains whitespaces\n const username = user.username.includes(' ')\n ? `\"${user.username}\"`\n : user.username\n page.getUploads({\n all: true,\n filters: `user:${username}`,\n trigger: document.querySelector('#itemManageUploads')\n })\n}\n\npage.viewAlbumUploads = (id, element) => {\n if (!page.cache[id]) return\n element.classList.add('is-loading')\n // eslint-disable-next-line compat/compat\n const all = page.currentView === 'albumsAll' && page.permissions.moderator\n page.getUploads({\n all,\n filters: `albumid:${id}`,\n trigger: all\n ? document.querySelector('#itemManageUploads')\n : document.querySelector('#itemUploads')\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(page.views[page.currentView], {\n autoPage: true\n }))\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(page.views[page.currentView], {\n autoPage: true\n }))\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 if (page.isSomethingLoading)\n return page.warnSomethingLoading()\n\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 buttons: false,\n timer: 1500\n })\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 buttons: false,\n timer: 1500\n })\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 if (params && params.all && !page.permissions.moderator)\n return swal('An error occurred!', 'You cannot do this!', 'error')\n\n if (page.isSomethingLoading)\n return page.warnSomethingLoading()\n\n page.updateTrigger(params.trigger, 'loading')\n\n if (typeof params.pageNum !== 'number')\n params.pageNum = 0\n\n const headers = {}\n\n if (params.all)\n headers.all = '1'\n\n const url = `api/albums/${params.pageNum}`\n axios.get(url, { headers }).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 const pages = Math.ceil(response.data.count / 25)\n const albums = response.data.albums\n if (params.pageNum && (albums.length === 0)) {\n page.updateTrigger(params.trigger)\n if (params.autoPage) {\n params.pageNum = pages - 1\n return page.getAlbums(params)\n } else {\n return swal('An error occurred!', `There are no more albums to populate page ${params.pageNum + 1}.`, 'error')\n }\n }\n\n page.currentView = params.all ? 'albumsAll' : 'albums'\n page.cache = {}\n\n const users = response.data.users\n const homeDomain = response.data.homeDomain\n\n if (params.pageNum < 0) params.pageNum = Math.max(0, pages + params.pageNum)\n const pagination = page.paginate(response.data.count, 25, params.pageNum)\n\n const 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 ${!params.all ? 'Bulk disable' : ''}\n \n ${params.all\n ? `\n \n \n \n Bulk delete\n `\n : ''}\n
\n
\n `\n\n // Do some string replacements for bottom controls\n const bottomFiltersId = 'bFilters'\n const bottomJumpId = 'bJumpToPage'\n const bottomExtraControls = extraControls\n .replace(/id=\"filters\"/, `id=\"${bottomFiltersId}\"`)\n .replace(/(data-action=\"filter-uploads\")/, `$1 data-filtersid=\"${bottomFiltersId}\"`)\n .replace(/id=\"jumpToPage\"/, `id=\"${bottomJumpId}\"`)\n .replace(/(data-action=\"jump-to-page\")/g, `$1 data-jumpid=\"${bottomJumpId}\"`)\n const bottomPagination = pagination\n .replace(/(data-action=\"page-ellipsis\")/g, `$1 data-jumpid=\"${bottomJumpId}\"`)\n\n // Whether there are any unselected items\n let unselected = false\n\n const createNewAlbum = `\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 `\n\n page.dom.innerHTML = `\n ${!params.all ? createNewAlbum : ''}\n ${pagination}\n ${extraControls}\n ${controls}\n
\n \n \n \n \n \n \n ${params.all ? '' : ''}\n \n \n \n \n \n \n \n \n
IDNameUserUploadsCreated atPublic link
\n
\n ${controls}\n ${bottomExtraControls}\n ${bottomPagination}\n `\n\n const table = document.querySelector('#table')\n\n for (let i = 0; i < albums.length; i++) {\n const album = albums[i]\n const albumUrl = `${homeDomain}/a/${album.identifier}`\n\n const selected = page.selected[page.currentView].includes(album.id)\n if (!selected) unselected = true\n\n // Prettify\n album.prettyDate = page.getPrettyDate(new Date(album.timestamp * 1000))\n\n // Server-side explicitly expect this value to consider an album as disabled\n const enabled = album.enabled !== 0\n page.cache[album.id] = {\n name: album.name,\n download: album.download,\n public: album.public,\n description: album.description,\n enabled\n }\n\n const tr = document.createElement('tr')\n tr.dataset.id = album.id\n tr.innerHTML = `\n \n ${album.id}\n ${album.name}\n ${params.all ? `${album.userid ? (users[album.userid] || '') : ''}` : ''}\n ${album.uploads}\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 \n \n \n `\n\n table.appendChild(tr)\n page.checkboxes = 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 if (page.currentView === 'albumsAll')\n page.views[page.currentView].filters = params.filters\n page.views[page.currentView].pageNum = albums.length ? params.pageNum : 0\n }).catch(error => {\n page.updateTrigger(params.trigger)\n page.onAxiosError(error)\n })\n}\n\npage.editAlbum = id => {\n const album = page.cache[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 ${page.currentView === 'albumsAll' && page.permissions.moderator\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 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 const post = {\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 }\n\n if (page.currentView === 'albumsAll' && page.permissions.moderator)\n post.enabled = document.querySelector('#swalEnabled').checked\n\n axios.post('api/albums/edit', post).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!', `The album's new identifier is: ${response.data.identifier}.`, 'success')\n else if (response.data.name !== album.name)\n swal('Success!', `The album was renamed to: ${response.data.name}.`, 'success')\n else\n swal('Success!', 'The album was edited.', 'success', {\n buttons: false,\n timer: 1500\n })\n\n page.getAlbumsSidebar()\n // Reload albums list\n // eslint-disable-next-line compat/compat\n page.getAlbums(Object.assign(page.views[page.currentView], {\n autoPage: true\n }))\n }).catch(page.onAxiosError)\n })\n}\n\npage.disableAlbum = id => {\n swal({\n title: 'Are you sure?',\n text: 'This won\\'t delete the uploads associated with the album!',\n icon: 'warning',\n dangerMode: true,\n buttons: {\n cancel: true,\n confirm: {\n text: 'Yes, disable 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/disable', {\n id,\n purge: proceed === 'purge'\n }).then(response => {\n if (response.data.success === false) {\n const failed = Array.isArray(response.data.failed)\n ? response.data.failed\n : []\n\n if (response.data.description === 'No token provided')\n return page.verifyToken(page.token)\n else if (failed.length)\n return swal('An error occurred!', `Unable to delete ${failed.length} of the album's upload${failed.length === 1 ? '' : 's'}.`, 'error')\n else\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n swal('Deleted!', 'Your album has been disabled.', 'success', {\n buttons: false,\n timer: 1500\n })\n\n page.getAlbumsSidebar()\n // Reload albums list\n // eslint-disable-next-line compat/compat\n page.getAlbums(Object.assign(page.views[page.currentView], {\n autoPage: true\n }))\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 buttons: false,\n timer: 1500\n })\n page.getAlbumsSidebar()\n page.getAlbums({\n pageNum: -1\n })\n }).catch(error => {\n page.updateTrigger(element)\n page.onAxiosError(error)\n })\n}\n\npage.getAlbumsSidebar = () => {\n axios.get('api/albums', { headers: { sidebar: '1' } }).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 albums = response.data.albums\n const count = response.data.count\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 (albums === undefined)\n return\n\n for (let i = 0; i < albums.length; i++) {\n const album = albums[i]\n const li = document.createElement('li')\n const a = document.createElement('a')\n a.id = album.id\n a.className = 'is-relative'\n a.innerHTML = album.name\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\n if (count > albums.length) {\n const li = document.createElement('li')\n const a = document.createElement('a')\n a.className = 'is-relative'\n a.innerHTML = '...'\n a.title = `You have ${count} albums, but the sidebar can only list your first ${albums.length} albums.`\n\n a.addEventListener('click', event => {\n page.getAlbums({\n trigger: document.querySelector('#itemManageYourAlbums')\n })\n })\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 page.fadeAndScroll()\n page.updateTrigger(params.trigger, 'active')\n\n document.querySelector('#getNewToken').addEventListener('click', event => {\n if (page.isSomethingLoading)\n return page.warnSomethingLoading()\n\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 buttons: false,\n timer: 1500\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.isSomethingLoading)\n return page.warnSomethingLoading()\n\n if (!page.dom.querySelector('form').checkValidity())\n return\n\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 buttons: false,\n timer: 1500\n }).then(() => {\n page.changePassword()\n })\n }).catch(error => {\n page.updateTrigger(element)\n page.onAxiosError(error)\n })\n}\n\npage.getUsers = (params = {}) => {\n if (page.isSomethingLoading)\n return page.warnSomethingLoading()\n\n if (!page.permissions.admin)\n return swal('An error occurred!', 'You cannot do this!', 'error')\n\n page.updateTrigger(params.trigger, 'loading')\n\n if (typeof params.pageNum !== 'number')\n params.pageNum = 0\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 const pages = Math.ceil(response.data.count / 25)\n const users = response.data.users\n if (params.pageNum && (users.length === 0)) {\n page.updateTrigger(params.trigger)\n if (params.autoPage) {\n params.pageNum = pages - 1\n return page.getUsers(params)\n } else {\n return swal('An error occurred!', `There are no more users to populate page ${params.pageNum + 1}.`, 'error')\n }\n }\n\n page.currentView = 'users'\n page.cache = {}\n\n if (params.pageNum < 0) params.pageNum = Math.max(0, pages + params.pageNum)\n const pagination = page.paginate(response.data.count, 25, params.pageNum)\n\n const 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 // Do some string replacements for bottom controls\n const bottomFiltersId = 'bFilters'\n const bottomJumpId = 'bJumpToPage'\n const bottomExtraControls = extraControls\n .replace(/id=\"filters\"/, `id=\"${bottomFiltersId}\"`)\n .replace(/(data-action=\"filter-uploads\")/, `$1 data-filtersid=\"${bottomFiltersId}\"`)\n .replace(/id=\"jumpToPage\"/, `id=\"${bottomJumpId}\"`)\n .replace(/(data-action=\"jump-to-page\")/g, `$1 data-jumpid=\"${bottomJumpId}\"`)\n const bottomPagination = pagination\n .replace(/(data-action=\"page-ellipsis\")/g, `$1 data-jumpid=\"${bottomJumpId}\"`)\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 \n
UsernameUploadsUsageGroupRegistration dateLast token update
\n
\n ${controls}\n ${bottomExtraControls}\n ${bottomPagination}\n `\n\n const table = document.querySelector('#table')\n\n for (let i = 0; i < users.length; i++) {\n const user = users[i]\n const selected = page.selected[page.currentView].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[user.id] = {\n username: user.username,\n groups: user.groups,\n enabled,\n displayGroup\n }\n\n const prettyDate = user.registration\n ? page.getPrettyDate(new Date(user.registration * 1000))\n : '-'\n const prettyTokenUpdate = user.timestamp\n ? page.getPrettyDate(new Date(user.timestamp * 1000))\n : '-'\n\n const tr = document.createElement('tr')\n tr.dataset.id = user.id\n tr.innerHTML = `\n \n ${user.username}\n ${user.uploads}\n ${page.getPrettyBytes(user.usage)}\n ${displayGroup}\n ${prettyDate}\n ${prettyTokenUpdate}\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 = 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[page.currentView].pageNum = users.length ? params.pageNum : 0\n }).catch(error => {\n page.updateTrigger(params.trigger)\n page.onAxiosError(error)\n })\n}\n\npage.createUser = () => {\n const groupOptions = Object.keys(page.permissions).map((g, i, a) => {\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 swal({\n title: 'Create new 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/create', {\n username: document.querySelector('#swalUsername').value,\n password: document.querySelector('#swalPassword').value,\n group: document.querySelector('#swalGroup').value\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 div = document.createElement('div')\n div.innerHTML = `\n

Username: ${response.data.username}

\n

Password: ${response.data.password}

\n

User group: ${response.data.group}

\n `\n swal({\n title: 'Created a new user!',\n icon: 'success',\n content: div\n })\n\n // Load last page of users list\n // eslint-disable-next-line compat/compat\n page.getUsers(Object.assign(page.views.users, {\n pageNum: -1\n }))\n }).catch(page.onAxiosError)\n })\n}\n\npage.editUser = id => {\n const user = page.cache[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

User ID: ${id}

\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\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 let autoClose = true\n const div = document.createElement('div')\n\n let displayName = user.username\n if (response.data.update.username !== user.username) {\n div.innerHTML += `

${user.username} was renamed into: ${response.data.update.username}.

`\n autoClose = false\n displayName = response.data.update.username\n }\n\n if (response.data.update.password) {\n div.innerHTML += `\n

${displayName}'s new password is:

\n

${response.data.update.password}

\n `\n autoClose = false\n }\n\n if (response.data.update.enabled !== user.enabled)\n div.innerHTML += `

${displayName} has been ${response.data.update.enabled ? 'enabled' : 'disabled'}!

`\n\n if (!div.innerHTML)\n div.innerHTML = `

${displayName} was edited!

`\n\n swal({\n title: 'Success!',\n icon: 'success',\n content: div,\n buttons: !autoClose,\n timer: autoClose ? 1500 : null\n })\n page.getUsers(page.views.users)\n }).catch(page.onAxiosError)\n })\n}\n\npage.disableUser = id => {\n const user = page.cache[id]\n if (!user || !user.enabled) return\n\n const content = document.createElement('div')\n content.innerHTML = `\n

You will be disabling a user named ${page.cache[id].username}.

\n

Their files will remain.

\n `\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!', `${page.cache[id].username} has been disabled.`, 'success', {\n buttons: false,\n timer: 1500\n })\n page.getUsers(page.views.users)\n }).catch(page.onAxiosError)\n })\n}\n\npage.deleteUser = id => {\n const user = page.cache[id]\n if (!user) return\n\n const content = document.createElement('div')\n content.innerHTML = `\n

You will be deleting a user named ${page.cache[id].username}.

\n

Their files will remain, unless you choose otherwise.

\n `\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, delete it!',\n closeModal: false\n },\n purge: {\n text: 'Yes, and the uploads too!',\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/users/delete', {\n id,\n purge: proceed === 'purge'\n }).then(response => {\n if (!response) return\n\n if (response.data.success === false) {\n const failed = Array.isArray(response.data.failed)\n ? response.data.failed\n : []\n\n if (response.data.description === 'No token provided')\n return page.verifyToken(page.token)\n else if (failed.length)\n return swal('An error occurred!', `Unable to delete ${failed.length} of the user's upload${failed.length === 1 ? '' : 's'}.`, 'error')\n else\n return swal('An error occurred!', response.data.description, 'error')\n }\n\n swal('Success!', `${page.cache[id].username} has been deleted.`, 'success', {\n buttons: false,\n timer: 1500\n })\n\n // Reload users list\n // eslint-disable-next-line compat/compat\n page.getUsers(Object.assign(page.views.users, {\n autoPage: true\n }))\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 cannot do this!', 'error')\n\n if (page.isSomethingLoading)\n return page.warnSomethingLoading()\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.floor(value.used / value.total * 100)}%)`\n if ((types.uptime || []).includes(valKeys[j]))\n parsed = page.getPrettyUptime(value)\n\n const string = valKeys[j]\n .replace(/([A-Z])/g, ' $1')\n .replace(/(^|\\s)(cpu|db|zip)/gi, s => s.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]}
    \n
    \n `\n }\n\n if (Array.isArray(response.data.hrtime))\n content += `\n
    \n
    \n Time taken: ${response.data.hrtime[0]}s ${Math.ceil(response.data.hrtime[1] / 1000000)}ms.\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.addEventListener('DOMContentLoaded', () => {\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', 'albums', 'albumsAll', '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('', 'The link has been copied to clipboard.', 'success', {\n buttons: false,\n timer: 1500\n })\n })\n\n page.clipboardJS.on('error', page.onError)\n\n page.lazyLoad = new LazyLoad()\n})\n"]}