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D,EAASkD,EAAQ3D,EAClC,CAEA,IADGyD,GAA4BA,EAA2BlL,GACrDwI,EAAIL,EAAS5F,OAAQiG,IACzBwC,EAAU7C,EAASK,GAChBf,EAAoB6B,EAAEyB,EAAiBC,IAAYD,EAAgBC,IACrED,EAAgBC,GAAS,KAE1BD,EAAgBC,GAAW,EAE5B,OAAOvD,EAAoBQ,EAAEC,EAAO,EAGjCoD,EAAqBV,KAA4B,sBAAIA,KAA4B,uBAAK,GAC1FU,EAAmBC,QAAQN,EAAqBO,KAAK,KAAM,IAC3DF,EAAmBhE,KAAO2D,EAAqBO,KAAK,KAAMF,EAAmBhE,KAAKkE,KAAKF,QClDvF7D,EAAoBgE,QAAKrH,ECGzB,IAAIsH,EAAsBjE,EAAoBQ,OAAE7D,EAAW,CAAC,OAAO,IAAOqD,EAAoB,SAC9FiE,EAAsBjE,EAAoBQ,EAAEyD","sources":["webpack:///nextcloud/webpack/runtime/chunk loaded","webpack://nextcloud/./apps/files_trashbin/src/trashbin.scss?8b2e","webpack:///nextcloud/apps/files_trashbin/src/services/client.ts","webpack:///nextcloud/apps/files_trashbin/src/services/trashbin.ts","webpack:///nextcloud/apps/files/src/logger.js","webpack:///nextcloud/apps/files_trashbin/src/actions/restoreAction.ts","webpack:///nextcloud/apps/files_trashbin/src/files-init.ts","webpack:///nextcloud/apps/files_trashbin/src/trashbin.scss","webpack:///nextcloud/webpack/bootstrap","webpack:///nextcloud/webpack/runtime/compat get default export","webpack:///nextcloud/webpack/runtime/define property getters","webpack:///nextcloud/webpack/runtime/ensure chunk","webpack:///nextcloud/webpack/runtime/global","webpack:///nextcloud/webpack/runtime/hasOwnProperty shorthand","webpack:///nextcloud/webpack/runtime/make namespace object","webpack:///nextcloud/webpack/runtime/node module decorator","webpack:///nextcloud/webpack/runtime/runtimeId","webpack:///nextcloud/webpack/runtime/jsonp chunk loading","webpack:///nextcloud/webpack/runtime/nonce","webpack:///nextcloud/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","\n import API from \"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js!./trashbin.scss\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js!./trashbin.scss\";\n export default content && content.locals ? content.locals : undefined;\n","/**\n * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { createClient } from 'webdav';\nimport { generateRemoteUrl } from '@nextcloud/router';\nimport { getCurrentUser, getRequestToken, onRequestTokenUpdate } from '@nextcloud/auth';\n// init webdav client\nexport const rootPath = `/trashbin/${getCurrentUser()?.uid}/trash`;\nexport const rootUrl = generateRemoteUrl('dav' + rootPath);\nconst client = createClient(rootUrl);\n// set CSRF token header\nconst setHeaders = (token) => {\n client.setHeaders({\n // Add this so the server knows it is an request from the browser\n 'X-Requested-With': 'XMLHttpRequest',\n // Inject user auth\n requesttoken: token ?? '',\n });\n};\n// refresh headers when request token changes\nonRequestTokenUpdate(setHeaders);\nsetHeaders(getRequestToken());\nexport default client;\n","import { File, Folder, davParsePermissions, getDavNameSpaces, getDavProperties } from '@nextcloud/files';\nimport { generateRemoteUrl, generateUrl } from '@nextcloud/router';\nimport { getCurrentUser } from '@nextcloud/auth';\nimport client, { rootPath } from './client';\nconst data = `<?xml version=\"1.0\"?>\n<d:propfind ${getDavNameSpaces()}>\n\t<d:prop>\n\t\t<nc:trashbin-filename />\n\t\t<nc:trashbin-deletion-time />\n\t\t<nc:trashbin-original-location />\n\t\t<nc:trashbin-title />\n\t\t${getDavProperties()}\n\t</d:prop>\n</d:propfind>`;\nconst resultToNode = function (node) {\n const permissions = davParsePermissions(node.props?.permissions);\n const owner = getCurrentUser()?.uid;\n const previewUrl = generateUrl('/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32', node.props);\n const nodeData = {\n id: node.props?.fileid || 0,\n source: generateRemoteUrl('dav' + rootPath + node.filename),\n // do not show the mtime column\n // mtime: new Date(node.lastmod),\n mime: node.mime,\n size: node.props?.size || 0,\n permissions,\n owner,\n root: rootPath,\n attributes: {\n ...node,\n ...node.props,\n // Override displayed name on the list\n displayName: node.props?.['trashbin-filename'],\n previewUrl,\n },\n };\n delete nodeData.attributes.props;\n return node.type === 'file'\n ? new File(nodeData)\n : new Folder(nodeData);\n};\nexport const getContents = async (path = '/') => {\n // TODO: use only one request when webdav-client supports it\n // @see https://github.com/perry-mitchell/webdav-client/pull/334\n const rootResponse = await client.stat(path, {\n details: true,\n data,\n });\n const contentsResponse = await client.getDirectoryContents(path, {\n details: true,\n data,\n });\n return {\n folder: resultToNode(rootResponse.data),\n contents: contentsResponse.data.map(resultToNode),\n };\n};\n","/**\n * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { getLoggerBuilder } from '@nextcloud/logger'\n\nexport default getLoggerBuilder()\n\t.setApp('files')\n\t.detectUser()\n\t.build()\n","/**\n * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport { emit } from '@nextcloud/event-bus';\nimport { generateRemoteUrl } from '@nextcloud/router';\nimport { getCurrentUser } from '@nextcloud/auth';\nimport { Permission, Node, View, registerFileAction, FileAction } from '@nextcloud/files';\nimport { translate as t } from '@nextcloud/l10n';\nimport axios from '@nextcloud/axios';\nimport History from '@mdi/svg/svg/history.svg?raw';\nimport logger from '../../../files/src/logger.js';\nimport { encodePath } from '@nextcloud/paths';\nregisterFileAction(new FileAction({\n id: 'restore',\n displayName() {\n return t('files_trashbin', 'Restore');\n },\n iconSvgInline: () => History,\n enabled(nodes, view) {\n // Only available in the trashbin view\n if (view.id !== 'trashbin') {\n return false;\n }\n // Only available if all nodes have read permission\n return nodes.length > 0 && nodes\n .map(node => node.permissions)\n .every(permission => (permission & Permission.READ) !== 0);\n },\n async exec(node) {\n try {\n const destination = generateRemoteUrl(encodePath(`dav/trashbin/${getCurrentUser()?.uid}/restore/${node.basename}`));\n await axios({\n method: 'MOVE',\n url: node.encodedSource,\n headers: {\n destination,\n },\n });\n // Let's pretend the file is deleted since\n // we don't know the restored location\n emit('files:node:deleted', node);\n return true;\n }\n catch (error) {\n logger.error(error);\n return false;\n }\n },\n async execBatch(nodes, view, dir) {\n return Promise.all(nodes.map(node => this.exec(node, view, dir)));\n },\n order: 1,\n inline: () => true,\n}));\n","/**\n * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport './trashbin.scss';\nimport { translate as t } from '@nextcloud/l10n';\nimport DeleteSvg from '@mdi/svg/svg/delete.svg?raw';\nimport moment from '@nextcloud/moment';\nimport { getContents } from './services/trashbin';\n// Register restore action\nimport './actions/restoreAction';\nimport { Column, Node, View, getNavigation } from '@nextcloud/files';\nimport { dirname, joinPaths } from '@nextcloud/paths';\nconst parseOriginalLocation = (node) => {\n const path = node.attributes?.['trashbin-original-location'] !== undefined ? String(node.attributes?.['trashbin-original-location']) : null;\n if (!path) {\n return t('files_trashbin', 'Unknown');\n }\n const dir = dirname(path);\n if (dir === path) { // Node is in root folder\n return t('files_trashbin', 'All files');\n }\n return joinPaths(t('files_trashbin', 'All files'), dir);\n};\nconst Navigation = getNavigation();\nNavigation.register(new View({\n id: 'trashbin',\n name: t('files_trashbin', 'Deleted files'),\n caption: t('files_trashbin', 'List of files that have been deleted.'),\n emptyTitle: t('files_trashbin', 'No deleted files'),\n emptyCaption: t('files_trashbin', 'Files and folders you have deleted will show up here'),\n icon: DeleteSvg,\n order: 50,\n sticky: true,\n defaultSortKey: 'deleted',\n columns: [\n new Column({\n id: 'original-location',\n title: t('files_trashbin', 'Original location'),\n render(node) {\n const originalLocation = parseOriginalLocation(node);\n const span = document.createElement('span');\n span.title = originalLocation;\n span.textContent = originalLocation;\n return span;\n },\n sort(nodeA, nodeB) {\n const locationA = parseOriginalLocation(nodeA);\n const locationB = parseOriginalLocation(nodeB);\n return locationA.localeCompare(locationB);\n },\n }),\n new Column({\n id: 'deleted',\n title: t('files_trashbin', 'Deleted'),\n render(node) {\n const deletionTime = node.attributes?.['trashbin-deletion-time'];\n const span = document.createElement('span');\n if (deletionTime) {\n span.title = moment.unix(deletionTime).format('LLL');\n span.textContent = moment.unix(deletionTime).fromNow();\n return span;\n }\n // Unknown deletion time\n span.textContent = t('files_trashbin', 'A long time ago');\n return span;\n },\n sort(nodeA, nodeB) {\n const deletionTimeA = nodeA.attributes?.['trashbin-deletion-time'] || nodeA?.mtime || 0;\n const deletionTimeB = nodeB.attributes?.['trashbin-deletion-time'] || nodeB?.mtime || 0;\n return deletionTimeB - deletionTimeA;\n },\n }),\n ],\n getContents,\n}));\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.files-list__row-trashbin-original-location{width:150px !important}`, \"\",{\"version\":3,\"sources\":[\"webpack://./apps/files_trashbin/src/trashbin.scss\"],\"names\":[],\"mappings\":\"AAAA,4CACE,sBAAA\",\"sourcesContent\":[\".files-list__row-trashbin-original-location {\\n width: 150px !important;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","// The chunk loading function for additional chunks\n// Since all referenced chunks are already included\n// in this file, this function is empty here.\n__webpack_require__.e = () => (Promise.resolve());","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","__webpack_require__.j = 2573;","__webpack_require__.b = document.baseURI || self.location.href;\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t2573: 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunknextcloud\"] = self[\"webpackChunknextcloud\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","__webpack_require__.nc = undefined;","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [4208], () => (__webpack_require__(29276)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","options","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","locals","rootPath","concat","_getCurrentUser","getCurrentUser","uid","rootUrl","generateRemoteUrl","client","createClient","setHeaders","token","requesttoken","onRequestTokenUpdate","getRequestToken","data","getDavNameSpaces","getDavProperties","resultToNode","node","_node$props","_node$props2","_node$props3","_node$props4","permissions","davParsePermissions","props","owner","previewUrl","generateUrl","nodeData","id","fileid","source","filename","mime","size","root","attributes","displayName","type","File","Folder","getLoggerBuilder","setApp","detectUser","build","registerFileAction","FileAction","t","iconSvgInline","enabled","nodes","view","length","map","every","permission","Permission","READ","exec","destination","encodePath","basename","axios","method","url","encodedSource","headers","emit","error","logger","execBatch","dir","Promise","all","this","order","inline","parseOriginalLocation","_node$attributes","_node$attributes2","path","undefined","String","dirname","joinPaths","getNavigation","register","View","name","caption","emptyTitle","emptyCaption","icon","sticky","defaultSortKey","columns","Column","title","render","originalLocation","span","document","createElement","textContent","sort","nodeA","nodeB","locationA","locationB","localeCompare","_node$attributes3","deletionTime","moment","unix","format","fromNow","_nodeA$attributes","_nodeB$attributes","deletionTimeA","mtime","getContents","async","arguments","rootResponse","stat","details","contentsResponse","getDirectoryContents","folder","contents","___CSS_LOADER_EXPORT___","push","module","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","loaded","__webpack_modules__","call","m","O","result","chunkIds","fn","priority","notFulfilled","Infinity","i","fulfilled","j","Object","keys","key","splice","r","n","getter","__esModule","d","a","definition","o","defineProperty","enumerable","get","e","resolve","g","globalThis","Function","window","obj","prop","prototype","hasOwnProperty","Symbol","toStringTag","value","nmd","paths","children","b","baseURI","self","location","href","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","chunkLoadingGlobal","forEach","bind","nc","__webpack_exports__"],"sourceRoot":""}
|