{"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","prevPageNums","checkboxes","lastSelected","selectAlbumContainer","cache","clipboardJS","lazyLoad","albumsSidebarCollapse","albumsSidebarCollapsible","imageExts","videoExts","audioExts","isSomethingLoading","fadingIn","albumTitleMaxLength","albumDescMaxLength","document","querySelector","classList","add","remove","error","console","content","createElement","innerHTML","toString","swal","title","icon","statusText","response","status","description","data","verifyToken","window","location","apiVersion","match","src","text","buttons","confirm","closeModal","then","reload","axios","post","defaults","headers","common","version","checkClientVersion","prepareDashboard","catch","code","removeItem","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","forceScroll","push","length","moderator","unhide","getAlbumsSidebar","prepareShareX","updateTrigger","timer","newState","parentNode","tagName","className","includes","let","element","parent","parseInt","dataset","id","action","hasAttribute","stopPropagation","getItemID","setUploadsView","toggleOriginalNames","addToAlbum","deleteUpload","addSelectedUploadsToAlbum","bulkDeleteUploads","displayPreview","uploadFiltersHelp","filterUploads","submitAlbum","editAlbum","disableAlbum","deleteAlbum","viewAlbumUploads","createUser","editUser","disableUser","deleteUser","viewUserUploads","getNewToken","clearSelection","select","selectAll","focusJumpToPage","switchPage","disableFading","clearTimeout","setTimeout","disableSmooth","scrollIntoView","behavior","block","inline","view","get","func","getByView","goto","jumpToPage","jumpid","checkValidity","parsed","value","isNaN","focus","url","test","minoffset","Date","getTimezoneOffset","success","uploadsPerPage","pages","Math","ceil","count","files","autoPage","basedomain","max","pagination","paginate","extraControls","escape","controls","bottomExtraControls","replace","bottomPagination","unselected","showOriginalNames","hasExpiryDateColumn","some","file","expirydate","origin","thumb","extname","toLowerCase","previewable","name","original","prettyBytes","getPrettyBytes","size","prettyDate","getPrettyDate","timestamp","prettyExpiryDate","appendix","userid","albumid","table","upload","div","appendChild","querySelectorAll","allAlbums","tr","ip","checked","fadeInDom","scrollToDom","update","onAxiosError","undefined","onload","body","onerror","setAttribute","splice","indexOf","JSON","stringify","lastElement","thisIndex","index","lastIndex","abs","shiftKey","selectInBetween","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","Array","isArray","addUploadsToAlbum","ids","callback","choose","added","simple","list","getElementsByTagName","removeAttribute","albumsPerPage","homeDomain","createNewAlbum","albumUrlText","identifier","albumUrl","hasZip","zipSize","prettyZipDate","zipGeneratedAt","isZipExpired","editedAt","enabled","download","public","descriptionHtml","urlPath","requestLink","purge","albumsSidebar","oldAlbums","diffCount","innerText","collapsed","textExpand","textCollapse","collapse","li","a","sendNewPassword","pass","password","admin","usersPerPage","displayGroup","groups","keys","registration","prettyTokenUpdate","usage","groupOptions","g","isHigher","isDisabledHelper","resetPassword","autoClose","displayName","totalItems","itemsPerPage","currentPage","numPages","template","start","end","elementsToShow","step","stats","rows","valKeys","j","totalForPercentage","available","used","total","toFixed","getPrettyUptime","toLocaleString","onError","hrtime","defineProperty","varArgs","arguments$1","arguments","TypeError","to","nextSource","nextKey","writable","configurable","documentElement","selectedKeys","ls","parse","preparePage","ClipboardJS","on","LazyLoad","bulmaCollapsible"],"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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,KAAKuB,yBAAyBwV,GAAG,mBAAiB,SAAEpS,GAClD3E,KAAKsB,sBAAsB0R,UAAYhT,KAAKsB,sBAAsBiG,QAAQ2L,UA7zB5E,GACF","file":"dashboard.js","sourcesContent":["/* global swal, axios, ClipboardJS, LazyLoad, bulmaCollapsible */\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 prevPageNums: {\n uploads: null,\n uploadsAll: null,\n albums: null,\n albumsAll: null,\n users: null\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 albumsSidebarCollapse: null,\n albumsSidebarCollapsible: null,\n\n imageExts: ['.gif', '.jpeg', '.jpg', '.png', '.svg', '.tif', '.tiff', '.webp'],\n videoExts: ['.3g2', '.3gp', '.asf', '.avchd', '.avi', '.divx', '.evo', '.flv', '.h264', '.h265', '.hevc', '.m2p', '.m2ts', '.m4v', '.mk3d', '.mkv', '.mov', '.mp4', '.mpeg', '.mpg', '.mxf', '.ogg', '.ogv', '.ps', '.qt', '.rmvb', '.ts', '.vob', '.webm', '.wmv'],\n audioExts: ['.flac', '.mp3', '.wav', '.wma'],\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 = `\n

${error.toString()}

\n

Please check your console for more information.

\n `\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.\\nPlease check the console for more information.'\n\n return swal(`${error.response.status} ${statusText}`, description, 'error')\n}\n\npage.preparePage = () => {\n if (page.token) page.verifyToken(page.token)\n else 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}\n\npage.verifyToken = token => {\n axios.post('api/tokens/verify', { token }).then(response => {\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\n page.token = token\n page.username = response.data.username\n page.permissions = response.data.permissions\n page.prepareDashboard()\n }).catch(error => {\n return swal({\n title: 'An error occurred!',\n text: error.response.data ? error.response.data.description : error.toString(),\n icon: 'error'\n }).then(() => {\n if (error.response.data && error.response.data.code === 10001) {\n localStorage.removeItem(lsKeys.token)\n window.location = 'auth'\n }\n })\n })\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 }\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]) continue\n\n // Add onclick event listener\n const item = document.querySelector(itemMenus[i].selector)\n item.addEventListener('click', event => {\n if (page.isSomethingLoading) 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 forceScroll: true\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') 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 }\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 }\n if (['SPAN'].includes(element.tagName) && ['A', 'BUTTON'].includes(element.parentNode.tagName)) {\n element = element.parentNode\n }\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 'delete-album':\n return page.deleteAlbum(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.fadeInDom = 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\npage.scrollToDom = disableSmooth => {\n page.dom.scrollIntoView({\n behavior: disableSmooth ? '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) 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 }\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\n if (page.isSomethingLoading) 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\n const url = typeof params.album !== 'undefined'\n ? `api/album/${params.album}/${params.pageNum}`\n : `api/uploads/${params.pageNum}`\n\n const headers = {}\n if (params.all) headers.all = '1'\n if (params.filters) {\n headers.filters = params.filters\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\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\n const uploadsPerPage = response.data.uploadsPerPage || 25\n const pages = Math.ceil(response.data.count / uploadsPerPage)\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) {\n params.pageNum = Math.max(0, pages + params.pageNum)\n }\n const pagination = page.paginate(response.data.count, uploadsPerPage, 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 \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 = true\n\n const showOriginalNames = page.views[page.currentView].originalNames\n const hasExpiryDateColumn = files.some(file => typeof file.expirydate !== 'undefined')\n\n for (let i = 0; i < files.length; i++) {\n // Build full URLs\n files[i].file = `${basedomain || window.location.origin}/${files[i].name}`\n if (files[i].thumb) {\n files[i].thumb = `${basedomain ? `${basedomain}/` : ''}${files[i].thumb}`\n }\n\n // Determine types\n const extname = files[i].extname.toLowerCase()\n if (page.imageExts.includes(extname)) {\n files[i].type = 'picture'\n } else if (page.videoExts.includes(extname)) {\n files[i].type = 'video'\n } else if (page.audioExts.includes(extname)) {\n files[i].type = 'audio'\n } else {\n files[i].type = 'other'\n }\n\n files[i].previewable = files[i].thumb || files[i].type === 'audio'\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 extname: files[i].extname,\n thumb: files[i].thumb,\n file: files[i].file,\n type: files[i].type,\n previewable: files[i].previewable\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\n // Update selected status\n files[i].selected = page.selected[page.currentView].includes(files[i].id)\n if (files[i].selected) {\n unselected = false\n }\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 (typeof params.album === 'undefined') {\n files[i].appendix = files[i].albumid\n ? albums[files[i].albumid] || ''\n : ''\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 (typeof upload.thumb !== 'undefined') {\n div.innerHTML = `\"${upload.name}\"`\n } else {\n div.innerHTML = `

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

`\n }\n\n div.innerHTML += `\n \n
\n ${upload.previewable\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

${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\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 ${typeof 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(${response.data.count} total)
\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 ${typeof 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 \n \n \n \n \n ${params.all\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\n const selectAll = document.querySelector('#selectAll')\n if (selectAll && !unselected) {\n selectAll.checked = true\n selectAll.title = 'Unselect all'\n }\n\n page.fadeInDom()\n\n const pageNum = files.length ? params.pageNum : 0\n if (params.forceScroll ||\n page.prevPageNums[page.currentView] === null ||\n page.prevPageNums[page.currentView] !== pageNum) {\n const disableSmooth = !params.forceScroll && page.views[page.currentView].type === 'thumbs'\n page.scrollToDom(disableSmooth)\n }\n\n if (page.views[page.currentView].type === 'thumbs') {\n page.lazyLoad.update()\n }\n\n page.updateTrigger(params.trigger, 'active')\n\n if (page.currentView === 'uploads') {\n page.views.uploads.album = params.album\n }\n page.views[page.currentView].filters = params.filters\n page.views[page.currentView].pageNum = page.prevPageNums[page.currentView] = pageNum\n }).catch(error => {\n page.updateTrigger(params.trigger)\n page.onAxiosError(error)\n })\n}\n\npage.setUploadsView = (view, element) => {\n if (page.isSomethingLoading) 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) 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.previewable) return\n\n const div = document.createElement('div')\n div.innerHTML = `\n
\n

\n

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

\n ${file.thumb\n ? `

\n \n

`\n : ''}\n
\n `\n\n if (file.file && ['picture', 'video', 'audio'].includes(file.type)) {\n div.innerHTML += `\n
\n
\n \n \n \n \n ${file.type === 'picture' ? 'Load original' : 'Play in embedded player'}\n \n
\n
\n `\n\n if (file.type === 'picture') {\n div.querySelector('#swalOriginal').addEventListener('click', event => {\n const trigger = event.currentTarget\n if (trigger.classList.contains('is-danger')) return\n\n trigger.classList.add('is-loading')\n const thumb = div.querySelector('#swalThumb')\n\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 })\n } else {\n const match = file.file.match(/.*\\/(.*)$/)\n if (match || match[1]) {\n div.querySelector('#swalOriginal').setAttribute('href', `v/${match[1]}`)\n div.querySelector('#swalOriginal').setAttribute('target', '_blank')\n }\n }\n }\n\n return swal({\n content: div,\n buttons: false\n }).then(() => {\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\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\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) 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 }\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\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}\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) 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 }\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 : `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, is:video, and is:audio to list images, videos, audios respectively.\n This will only use image, video and audio extensions that are whitelisted internally in the safe.\n For images and videos specifically, they will be the ones 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\n ? `- Query uploads passing ALL exclusion filter keys OR matching ANY filter keys, if any.\n - Refine matches`\n : '- 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\n ? `- 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 `\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\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\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) 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 => failed.includes(id))\n } else {\n page.selected[page.currentView] = []\n }\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\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\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.fadeInDom()\n page.scrollToDom()\n page.updateTrigger(params.trigger, 'active')\n\n document.querySelector('#submitBulkDelete').addEventListener('click', () => {\n if (page.isSomethingLoading) 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\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.field,\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\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\n if (typeof params.cb === 'function') params.cb(failed)\n }).catch(page.onAxiosError)\n })\n}\n\npage.addSelectedUploadsToAlbum = () => {\n if (page.currentView !== 'uploads') return\n\n const count = page.selected[page.currentView].length\n if (!count) 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]\n .filter(id => failed.includes(id))\n } else {\n page.selected[page.currentView] = []\n }\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)) 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\n const suffix = `upload${ids.length === 1 ? '' : 's'}`\n if (!added) 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', { headers: { simple: '1' } }).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\n if (page.isSomethingLoading) return page.warnSomethingLoading()\n\n page.updateTrigger(params.trigger, 'loading')\n\n if (typeof params.pageNum !== 'number') params.pageNum = 0\n\n const headers = {}\n if (params.all) 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\n const albumsPerPage = response.data.albumsPerPage || 25\n const pages = Math.ceil(response.data.count / albumsPerPage)\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 || window.location.origin\n\n if (params.pageNum < 0) {\n params.pageNum = Math.max(0, pages + params.pageNum)\n }\n const pagination = page.paginate(response.data.count, albumsPerPage, 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 = true\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 \n \n \n
IDNameUserUploadsSizeCreated atZIP sizeZIP generated atPublic link(${response.data.count} total)
\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 urlPath = '/a/'\n const albumUrlText = urlPath + album.identifier\n const albumUrl = homeDomain + albumUrlText\n\n const selected = page.selected[page.currentView].includes(album.id)\n if (selected) {\n unselected = false\n }\n\n // Prettify\n album.hasZip = album.zipSize !== null\n album.prettyDate = page.getPrettyDate(new Date(album.timestamp * 1000))\n album.prettyZipDate = album.hasZip ? page.getPrettyDate(new Date(album.zipGeneratedAt * 1000)) : null\n album.isZipExpired = album.hasZip && !(album.zipGeneratedAt > album.editedAt)\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 descriptionHtml: album.descriptionHtml,\n enabled,\n homeDomain,\n urlPath,\n identifier: album.identifier\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 ${page.getPrettyBytes(album.size)}\n ${album.prettyDate}\n ${album.hasZip ? page.getPrettyBytes(album.zipSize) : '-'}\n ${album.hasZip ? album.prettyZipDate : '-'}\n ${albumUrlText}\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 ${params.all\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.fadeInDom()\n\n const pageNum = albums.length ? params.pageNum : 0\n if (params.forceScroll ||\n page.prevPageNums[page.currentView] === null ||\n page.prevPageNums[page.currentView] !== pageNum) {\n page.scrollToDom()\n }\n\n page.updateTrigger(params.trigger, 'active')\n\n if (page.currentView === 'albumsAll') {\n page.views[page.currentView].filters = params.filters\n }\n page.views[page.currentView].pageNum = page.prevPageNums[page.currentView] = pageNum\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 albumUrlText = album.urlPath + album.identifier\n const albumUrl = album.homeDomain + albumUrlText\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

Markdown supported. Max length is ${page.albumDescMaxLength} characters.

\n
\n ${album.descriptionHtml\n ? `
\n
\n ${album.descriptionHtml}\n
\n

Save changes then re-open this Edit prompt to refresh this preview.

\n
`\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

Current public link: ${albumUrlText}

\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\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\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\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, 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\n swal('Disabled!', 'The 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.deleteAlbum = id => {\n swal({\n title: 'Are you sure?',\n text: 'You won\\'t be able to recover this album!\\n' +\n 'This also 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, delete it!',\n closeModal: false\n },\n purge: {\n text: 'Umm, delete the uploads, 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 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\n swal('Disabled!', 'The album has been deleted.', '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\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: { simple: '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\n const albums = response.data.albums\n const count = response.data.count\n const albumsSidebar = document.querySelector('#albumsSidebar')\n\n // Clear albums sidebar if necessary\n const oldAlbums = albumsSidebar.querySelectorAll('li > a')\n const diffCount = oldAlbums.length !== count\n if (oldAlbums.length) {\n for (let i = 0; i < oldAlbums.length; i++) {\n page.menus.splice(page.menus.indexOf(oldAlbums[i]), 1)\n }\n albumsSidebar.innerHTML = ''\n }\n\n page.albumsSidebarCollapse.innerText = page.albumsSidebarCollapsible.collapsed()\n ? page.albumsSidebarCollapse.dataset.textExpand\n : page.albumsSidebarCollapse.dataset.textCollapse\n\n if (!albums || !albums.length) {\n page.albumsSidebarCollapsible.collapse()\n page.albumsSidebarCollapse.setAttribute('disabled', 'disabled')\n return\n }\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 albumsSidebar.appendChild(li)\n }\n\n page.albumsSidebarCollapse.removeAttribute('disabled')\n if (!page.albumsSidebarCollapsible.collapsed() && diffCount) {\n // Since it's not possible to refresh collapsible's height with bulmaCollapsible APIs,\n // forcefully collapse albums sidebar if albums count is different with the previous iteration.\n page.albumsSidebarCollapsible.collapse()\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 page.fadeInDom()\n page.scrollToDom()\n page.updateTrigger(params.trigger, 'active')\n\n document.querySelector('#getNewToken').addEventListener('click', event => {\n if (page.isSomethingLoading) 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\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.fadeInDom()\n page.scrollToDom()\n page.updateTrigger(params.trigger, 'active')\n\n document.querySelector('#sendChangePassword').addEventListener('click', event => {\n if (page.isSomethingLoading) return page.warnSomethingLoading()\n\n if (!page.dom.querySelector('form').checkValidity()) 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}\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\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.permissions.admin) return swal('An error occurred!', 'You cannot do this!', 'error')\n\n if (page.isSomethingLoading) return page.warnSomethingLoading()\n\n page.updateTrigger(params.trigger, 'loading')\n\n if (typeof params.pageNum !== 'number') 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\n const usersPerPage = response.data.usersPerPage || 25\n const pages = Math.ceil(response.data.count / usersPerPage)\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) {\n params.pageNum = Math.max(0, pages + params.pageNum)\n }\n const pagination = page.paginate(response.data.count, usersPerPage, 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 // 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 = true\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(${response.data.count} total)
\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) {\n unselected = false\n }\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.fadeInDom()\n\n const pageNum = users.length ? params.pageNum : 0\n if (params.forceScroll ||\n page.prevPageNums[page.currentView] === null ||\n page.prevPageNums[page.currentView] !== pageNum) {\n page.scrollToDom()\n }\n\n page.updateTrigger(params.trigger, 'active')\n\n page.views[page.currentView].pageNum = page.prevPageNums[page.currentView] = pageNum\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\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 let isHigher = false\n const groupOptions = Object.keys(page.permissions).map((g, i, a) => {\n const selected = g === user.displayGroup\n if (selected) {\n isHigher = typeof a[i + 1] !== 'undefined' && page.permissions[a[i + 1]]\n }\n const disabled = !(a[i + 1] && page.permissions[a[i + 1]])\n return ``\n }).join('\\n')\n\n const isDisabledHelper = isHigher ? '' : ' disabled'\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 ${isHigher\n ? ''\n : `
\n You cannot modify user in the same or higher group as you.\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\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\n if (!div.innerHTML) {\n div.innerHTML = `

${displayName} was edited!

`\n }\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 }\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 uploads will still 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, ONLY the user!',\n closeModal: false\n },\n purge: {\n text: 'Yes, AND their 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\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/03cac0fb8af3a759bc1220bd3c011b67dbc5e909/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 },\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) return swal('An error occurred!', 'You cannot do this!', 'error')\n\n if (page.isSomethingLoading) 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\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 valKeys = Object.keys(response.data.stats[keys[i]])\n for (let j = 0; j < valKeys.length; j++) {\n const data = response.data.stats[keys[i]][valKeys[j]]\n const type = typeof data === 'object' ? data.type : 'auto'\n const value = typeof data === 'object' ? data.value : data\n\n let parsed\n switch (type) {\n case 'byte':\n parsed = page.getPrettyBytes(value)\n break\n case 'byteUsage': {\n // Reasoning: https://github.com/sebhildebrandt/systeminformation/issues/464#issuecomment-756406053\n const totalForPercentage = typeof value.available !== 'undefined'\n ? (value.used + value.available)\n : value.total\n parsed = `${page.getPrettyBytes(value.used)} / ${page.getPrettyBytes(value.total)} (${(value.used / totalForPercentage * 100).toFixed(2)}%)`\n break\n }\n case 'uptime':\n parsed = page.getPrettyUptime(value)\n break\n case 'auto':\n switch (typeof value) {\n case 'number':\n parsed = value.toLocaleString()\n break\n default:\n parsed = value\n }\n break\n default:\n parsed = value\n }\n\n rows += `\n \n ${valKeys[j]}\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\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\n page.dom.innerHTML = content\n page.fadeInDom()\n page.scrollToDom()\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 || typeof target === 'undefined') {\n throw new TypeError('Cannot convert undefined or null to object')\n }\n const to = Object(target)\n for (let i = 1; i < arguments.length; i++) {\n const nextSource = arguments[i]\n if (nextSource !== null && typeof 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 }\n }\n }\n return to\n },\n writable: true,\n configurable: true\n })\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\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 page.albumsSidebarCollapse = document.querySelector('#albumsSidebarCollapse')\n\n /* eslint-disable-next-line new-cap */\n page.albumsSidebarCollapsible = new bulmaCollapsible(document.querySelector('#albumsSidebar'))\n page.albumsSidebarCollapsible.on('before:expand', event => {\n page.albumsSidebarCollapse.innerText = page.albumsSidebarCollapse.dataset.textCollapse\n })\n page.albumsSidebarCollapsible.on('before:collapse', event => {\n page.albumsSidebarCollapse.innerText = page.albumsSidebarCollapse.dataset.textExpand\n })\n})\n"]}