Spaces:
Running
Running
Commit ·
ef747c9
1
Parent(s): 04d405f
first commit
Browse filesFiles changed (13)
- .env.exampleAdded+13
- .gitignoreAdded+21
- package-lock.jsonAdded+1489
- package.jsonAdded+32
- public/app.jsAdded+587
- public/index.htmlAdded+141
- public/styles.cssAdded+984
- server/controllers/archiveController.jsAdded+487
- server/index.jsAdded+149
- server/middleware/security.jsAdded+343
- server/routes/api.jsAdded+201
- server/services/extractionService.jsAdded+352
- server/utils/fileTree.jsAdded+149
12345678910111213# Server ConfigurationPORT=3000
# File Size Limits (in bytes)MAX_FILE_SIZE=104857600MAX_EXTRACTED_FILE_SIZE=52428800
# Session Configuration (in milliseconds)SESSION_TIMEOUT=3600000
# Rate LimitingRATE_LIMIT_WINDOW=3600000RATE_LIMIT_MAX=10123456789101112131415161718192021# Dependenciesnode_modules/
# Environment files.env
# Upload and extraction directoriesuploads/extracted/
# OS files.DS_StoreThumbs.db
# IDE.vscode/.idea/
# Logs*.lognpm-debug.log*1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489{ "name": "archive-extractor", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "archive-extractor", "version": "1.0.0", "license": "MIT", "dependencies": { "adm-zip": "^0.5.10", "archiver": "^6.0.1", "express": "^4.18.2", "express-rate-limit": "^7.1.5", "fs-extra": "^11.2.0", "helmet": "^7.1.0", "mime-types": "^3.0.2", "multer": "^1.4.5-lts.1", "node-unrar-js": "^2.0.0", "uuid": "^9.0.1" } }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "license": "MIT", "dependencies": { "mime-types": "~2.1.34", "negotiator": "0.6.3" }, "engines": { "node": ">= 0.6" } }, "node_modules/accepts/node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/accepts/node_modules/mime-types": { "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "license": "MIT", "dependencies": { "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" } }, "node_modules/adm-zip": { "version": "0.5.16", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.16.tgz", "integrity": "sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ==", "license": "MIT", "engines": { "node": ">=12.0" } }, "node_modules/append-field": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", "license": "MIT" }, "node_modules/archiver": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/archiver/-/archiver-6.0.2.tgz", "integrity": "sha512-UQ/2nW7NMl1G+1UnrLypQw1VdT9XZg/ECcKPq7l+STzStrSivFIXIp34D8M5zeNGW5NoOupdYCHv6VySCPNNlw==", "license": "MIT", "dependencies": { "archiver-utils": "^4.0.1", "async": "^3.2.4", "buffer-crc32": "^0.2.1", "readable-stream": "^3.6.0", "readdir-glob": "^1.1.2", "tar-stream": "^3.0.0", "zip-stream": "^5.0.1" }, "engines": { "node": ">= 12.0.0" } }, "node_modules/archiver-utils": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-4.0.1.tgz", "integrity": "sha512-Q4Q99idbvzmgCTEAAhi32BkOyq8iVI5EwdO0PmBDSGIzzjYNdcFn7Q7k3OzbLy4kLUPXfJtG6fO2RjftXbobBg==", "license": "MIT", "dependencies": { "glob": "^8.0.0", "graceful-fs": "^4.2.0", "lazystream": "^1.0.0", "lodash": "^4.17.15", "normalize-path": "^3.0.0", "readable-stream": "^3.6.0" }, "engines": { "node": ">= 12.0.0" } }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", "license": "MIT" }, "node_modules/async": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", "license": "MIT" }, "node_modules/b4a": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.7.3.tgz", "integrity": "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q==", "license": "Apache-2.0", "peerDependencies": { "react-native-b4a": "*" }, "peerDependenciesMeta": { "react-native-b4a": { "optional": true } } }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "license": "MIT" }, "node_modules/bare-events": { "version": "2.8.2", "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz", "integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==", "license": "Apache-2.0", "peerDependencies": { "bare-abort-controller": "*" }, "peerDependenciesMeta": { "bare-abort-controller": { "optional": true } } }, "node_modules/body-parser": { "version": "1.20.4", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz", "integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==", "license": "MIT", "dependencies": { "bytes": "~3.1.2", "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "~1.2.0", "http-errors": "~2.0.1", "iconv-lite": "~0.4.24", "on-finished": "~2.4.1", "qs": "~6.14.0", "raw-body": "~2.5.3", "type-is": "~1.6.18", "unpipe": "~1.0.0" }, "engines": { "node": ">= 0.8", "npm": "1.2.8000 || >= 1.4.16" } }, "node_modules/brace-expansion": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } }, "node_modules/buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "license": "MIT", "engines": { "node": "*" } }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "license": "MIT" }, "node_modules/busboy": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", "dependencies": { "streamsearch": "^1.1.0" }, "engines": { "node": ">=10.16.0" } }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" }, "engines": { "node": ">= 0.4" } }, "node_modules/call-bound": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/compress-commons": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-5.0.3.tgz", "integrity": "sha512-/UIcLWvwAQyVibgpQDPtfNM3SvqN7G9elAPAV7GM0L53EbNWwWiCsWtK8Fwed/APEbptPHXs5PuW+y8Bq8lFTA==", "license": "MIT", "dependencies": { "crc-32": "^1.2.0", "crc32-stream": "^5.0.0", "normalize-path": "^3.0.0", "readable-stream": "^3.6.0" }, "engines": { "node": ">= 12.0.0" } }, "node_modules/concat-stream": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "engines": [ "node >= 0.8" ], "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^2.2.2", "typedarray": "^0.0.6" } }, "node_modules/concat-stream/node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "node_modules/concat-stream/node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "license": "MIT" }, "node_modules/concat-stream/node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "license": "MIT", "dependencies": { "safe-buffer": "~5.1.0" } }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "license": "MIT", "dependencies": { "safe-buffer": "5.2.1" }, "engines": { "node": ">= 0.6" } }, "node_modules/content-type": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/cookie": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/cookie-signature": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", "license": "MIT" }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "license": "MIT" }, "node_modules/crc-32": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", "license": "Apache-2.0", "bin": { "crc32": "bin/crc32.njs" }, "engines": { "node": ">=0.8" } }, "node_modules/crc32-stream": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-5.0.1.tgz", "integrity": "sha512-lO1dFui+CEUh/ztYIpgpKItKW9Bb4NWakCRJrnqAbFIYD+OZAwb2VfD5T5eXMw2FNcsDHkQcNl/Wh3iVXYwU6g==", "license": "MIT", "dependencies": { "crc-32": "^1.2.0", "readable-stream": "^3.4.0" }, "engines": { "node": ">= 12.0.0" } }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "license": "MIT", "dependencies": { "ms": "2.0.0" } }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/destroy": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", "license": "MIT", "engines": { "node": ">= 0.8", "npm": "1.2.8000 || >= 1.4.16" } }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "license": "MIT" }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/es-define-property": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "license": "MIT", "engines": { "node": ">= 0.4" } }, "node_modules/es-errors": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", "license": "MIT", "engines": { "node": ">= 0.4" } }, "node_modules/es-object-atoms": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", "license": "MIT" }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/events-universal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz", "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==", "license": "Apache-2.0", "dependencies": { "bare-events": "^2.7.0" } }, "node_modules/express": { "version": "4.22.1", "resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz", "integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==", "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", "body-parser": "~1.20.3", "content-disposition": "~0.5.4", "content-type": "~1.0.4", "cookie": "~0.7.1", "cookie-signature": "~1.0.6", "debug": "2.6.9", "depd": "2.0.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "finalhandler": "~1.3.1", "fresh": "~0.5.2", "http-errors": "~2.0.0", "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "~2.4.1", "parseurl": "~1.3.3", "path-to-regexp": "~0.1.12", "proxy-addr": "~2.0.7", "qs": "~6.14.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", "send": "~0.19.0", "serve-static": "~1.16.2", "setprototypeof": "1.2.0", "statuses": "~2.0.1", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2" }, "engines": { "node": ">= 0.10.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/express" } }, "node_modules/express-rate-limit": { "version": "7.5.1", "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz", "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==", "license": "MIT", "engines": { "node": ">= 16" }, "funding": { "url": "https://github.com/sponsors/express-rate-limit" }, "peerDependencies": { "express": ">= 4.11" } }, "node_modules/fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", "license": "MIT" }, "node_modules/finalhandler": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", "license": "MIT", "dependencies": { "debug": "2.6.9", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "~2.4.1", "parseurl": "~1.3.3", "statuses": "~2.0.2", "unpipe": "~1.0.0" }, "engines": { "node": ">= 0.8" } }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/fs-extra": { "version": "11.3.3", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.3.tgz", "integrity": "sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==", "license": "MIT", "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { "node": ">=14.14" } }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "license": "ISC" }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/get-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", "license": "MIT", "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/glob": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", "deprecated": "Glob versions prior to v9 are no longer supported", "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" }, "engines": { "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", "license": "MIT", "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "license": "ISC" }, "node_modules/has-symbols": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "license": "MIT", "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "license": "MIT", "dependencies": { "function-bind": "^1.1.2" }, "engines": { "node": ">= 0.4" } }, "node_modules/helmet": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/helmet/-/helmet-7.2.0.tgz", "integrity": "sha512-ZRiwvN089JfMXokizgqEPXsl2Guk094yExfoDXR0cBYWxtBbaSww/w+vT4WEJsBW2iTUi1GgZ6swmoug3Oy4Xw==", "license": "MIT", "engines": { "node": ">=16.0.0" } }, "node_modules/http-errors": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", "license": "MIT", "dependencies": { "depd": "~2.0.0", "inherits": "~2.0.4", "setprototypeof": "~1.2.0", "statuses": "~2.0.2", "toidentifier": "~1.0.1" }, "engines": { "node": ">= 0.8" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/express" } }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, "engines": { "node": ">=0.10.0" } }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "license": "ISC", "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "license": "ISC" }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", "license": "MIT", "engines": { "node": ">= 0.10" } }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", "license": "MIT" }, "node_modules/jsonfile": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", "license": "MIT", "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "node_modules/lazystream": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", "license": "MIT", "dependencies": { "readable-stream": "^2.0.5" }, "engines": { "node": ">= 0.6.3" } }, "node_modules/lazystream/node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "node_modules/lazystream/node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "license": "MIT" }, "node_modules/lazystream/node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "license": "MIT", "dependencies": { "safe-buffer": "~5.1.0" } }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "license": "MIT" }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", "license": "MIT", "engines": { "node": ">= 0.4" } }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/merge-descriptors": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "license": "MIT", "bin": { "mime": "cli.js" }, "engines": { "node": ">=4" } }, "node_modules/mime-db": { "version": "1.54.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", "license": "MIT", "dependencies": { "mime-db": "^1.54.0" }, "engines": { "node": ">=18" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/express" } }, "node_modules/minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { "node": ">=10" } }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "license": "MIT", "dependencies": { "minimist": "^1.2.6" }, "bin": { "mkdirp": "bin/cmd.js" } }, "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, "node_modules/multer": { "version": "1.4.5-lts.2", "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.2.tgz", "integrity": "sha512-VzGiVigcG9zUAoCNU+xShztrlr1auZOlurXynNvO9GiWD1/mTBbUljOKY+qMeazBqXgRnjzeEgJI/wyjJUHg9A==", "deprecated": "Multer 1.x is impacted by a number of vulnerabilities, which have been patched in 2.x. You should upgrade to the latest 2.x version.", "license": "MIT", "dependencies": { "append-field": "^1.0.0", "busboy": "^1.0.0", "concat-stream": "^1.5.2", "mkdirp": "^0.5.4", "object-assign": "^4.1.1", "type-is": "^1.6.4", "xtend": "^4.0.0" }, "engines": { "node": ">= 6.0.0" } }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/node-unrar-js": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/node-unrar-js/-/node-unrar-js-2.0.2.tgz", "integrity": "sha512-hLNmoJzqaKJnod8yiTVGe9hnlNRHotUi0CreSv/8HtfRi/3JnRC8DvsmKfeGGguRjTEulhZK6zXX5PXoVuDZ2w==", "license": "MIT", "engines": { "node": ">=10.0.0" } }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/object-inspect": { "version": "1.13.4", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", "license": "MIT", "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "license": "MIT", "dependencies": { "ee-first": "1.1.1" }, "engines": { "node": ">= 0.8" } }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "license": "ISC", "dependencies": { "wrappy": "1" } }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/path-to-regexp": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", "license": "MIT" }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "license": "MIT" }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", "license": "MIT", "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" }, "engines": { "node": ">= 0.10" } }, "node_modules/qs": { "version": "6.14.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", "license": "BSD-3-Clause", "dependencies": { "side-channel": "^1.1.0" }, "engines": { "node": ">=0.6" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/raw-body": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", "license": "MIT", "dependencies": { "bytes": "~3.1.2", "http-errors": "~2.0.1", "iconv-lite": "~0.4.24", "unpipe": "~1.0.0" }, "engines": { "node": ">= 0.8" } }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "license": "MIT", "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" }, "engines": { "node": ">= 6" } }, "node_modules/readdir-glob": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", "license": "Apache-2.0", "dependencies": { "minimatch": "^5.1.0" } }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ], "license": "MIT" }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "license": "MIT" }, "node_modules/send": { "version": "0.19.2", "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", "license": "MIT", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "~0.5.2", "http-errors": "~2.0.1", "mime": "1.6.0", "ms": "2.1.3", "on-finished": "~2.4.1", "range-parser": "~1.2.1", "statuses": "~2.0.2" }, "engines": { "node": ">= 0.8.0" } }, "node_modules/send/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, "node_modules/serve-static": { "version": "1.16.3", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", "license": "MIT", "dependencies": { "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", "send": "~0.19.1" }, "engines": { "node": ">= 0.8.0" } }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "license": "ISC" }, "node_modules/side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/side-channel-list": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/side-channel-map": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", "license": "MIT", "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/side-channel-weakmap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", "license": "MIT", "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/statuses": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/streamsearch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", "engines": { "node": ">=10.0.0" } }, "node_modules/streamx": { "version": "2.23.0", "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.23.0.tgz", "integrity": "sha512-kn+e44esVfn2Fa/O0CPFcex27fjIL6MkVae0Mm6q+E6f0hWv578YCERbv+4m02cjxvDsPKLnmxral/rR6lBMAg==", "license": "MIT", "dependencies": { "events-universal": "^1.0.0", "fast-fifo": "^1.3.2", "text-decoder": "^1.1.0" } }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "license": "MIT", "dependencies": { "safe-buffer": "~5.2.0" } }, "node_modules/tar-stream": { "version": "3.1.7", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", "license": "MIT", "dependencies": { "b4a": "^1.6.4", "fast-fifo": "^1.2.0", "streamx": "^2.15.0" } }, "node_modules/text-decoder": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.3.tgz", "integrity": "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==", "license": "Apache-2.0", "dependencies": { "b4a": "^1.6.4" } }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "license": "MIT", "engines": { "node": ">=0.6" } }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", "license": "MIT", "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" }, "engines": { "node": ">= 0.6" } }, "node_modules/type-is/node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/type-is/node_modules/mime-types": { "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "license": "MIT", "dependencies": { "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" } }, "node_modules/typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", "license": "MIT" }, "node_modules/universalify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "license": "MIT", "engines": { "node": ">= 10.0.0" } }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "license": "MIT" }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", "license": "MIT", "engines": { "node": ">= 0.4.0" } }, "node_modules/uuid": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "license": "ISC" }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "license": "MIT", "engines": { "node": ">=0.4" } }, "node_modules/zip-stream": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-5.0.2.tgz", "integrity": "sha512-LfOdrUvPB8ZoXtvOBz6DlNClfvi//b5d56mSWyJi7XbH/HfhOHfUhOqxhT/rUiR7yiktlunqRo+jY6y/cWC/5g==", "license": "MIT", "dependencies": { "archiver-utils": "^4.0.1", "compress-commons": "^5.0.1", "readable-stream": "^3.6.0" }, "engines": { "node": ">= 12.0.0" } } }}1234567891011121314151617181920212223242526272829303132{ "name": "archive-extractor", "version": "1.0.0", "description": "Production-ready web application for uploading, extracting, and managing compressed file archives", "main": "server/index.js", "type": "module", "scripts": { "start": "node server/index.js", "dev": "node --watch server/index.js" }, "keywords": [ "archive", "zip", "rar", "extractor", "file-manager" ], "author": "", "license": "MIT", "dependencies": { "adm-zip": "^0.5.10", "archiver": "^6.0.1", "express": "^4.18.2", "express-rate-limit": "^7.1.5", "fs-extra": "^11.2.0", "helmet": "^7.1.0", "mime-types": "^3.0.2", "multer": "^1.4.5-lts.1", "node-unrar-js": "^2.0.0", "uuid": "^9.0.1" }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587/** * Archive Extractor Frontend Application * * Handles file upload with drag-and-drop, file tree rendering, * and download functionality with toast notifications. */
// ============================================// State Management// ============================================const state = { currentSessionId: null, uploadInProgress: false,};
// ============================================// DOM Elements// ============================================const elements = { dropzone: document.getElementById('dropzone'), fileInput: document.getElementById('fileInput'), passwordInput: document.getElementById('passwordInput'), passwordToggle: document.getElementById('passwordToggle'), passwordSection: document.getElementById('passwordSection'), progressSection: document.getElementById('progressSection'), progressFilename: document.getElementById('progressFilename'), progressPercent: document.getElementById('progressPercent'), progressFill: document.getElementById('progressFill'), progressStatus: document.getElementById('progressStatus'), uploadSection: document.getElementById('upload-section'), explorerSection: document.getElementById('explorer-section'), archiveName: document.getElementById('archiveName'), archiveStats: document.getElementById('archiveStats'), fileTree: document.getElementById('fileTree'), downloadAllBtn: document.getElementById('downloadAllBtn'), newUploadBtn: document.getElementById('newUploadBtn'), toastContainer: document.getElementById('toastContainer'),};
// ============================================// File Type Icons// ============================================const FILE_ICONS = { // Documents pdf: 'file-pdf', doc: 'file-doc', docx: 'file-doc', xls: 'file-doc', xlsx: 'file-doc', ppt: 'file-doc', pptx: 'file-doc', txt: 'file', rtf: 'file-doc', // Images jpg: 'file-image', jpeg: 'file-image', png: 'file-image', gif: 'file-image', webp: 'file-image', svg: 'file-image', bmp: 'file-image', ico: 'file-image', // Video mp4: 'file-video', mkv: 'file-video', avi: 'file-video', mov: 'file-video', wmv: 'file-video', webm: 'file-video', // Audio mp3: 'file-audio', wav: 'file-audio', flac: 'file-audio', ogg: 'file-audio', aac: 'file-audio', // Code js: 'file-code', ts: 'file-code', jsx: 'file-code', tsx: 'file-code', html: 'file-code', css: 'file-code', scss: 'file-code', json: 'file-code', xml: 'file-code', py: 'file-code', java: 'file-code', cpp: 'file-code', c: 'file-code', h: 'file-code', php: 'file-code', rb: 'file-code', go: 'file-code', rs: 'file-code', sql: 'file-code', sh: 'file-code', md: 'file-code', // Archives zip: 'file-archive', rar: 'file-archive', '7z': 'file-archive', tar: 'file-archive', gz: 'file-archive',};
// ============================================// SVG Icons// ============================================const ICONS = { folder: `<svg viewBox="0 0 24 24" fill="currentColor"><path d="M10 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8l-2-2z"/></svg>`, folderOpen: `<svg viewBox="0 0 24 24" fill="currentColor"><path d="M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8l-2-2H4zm0 6h16v8H4v-8z"/></svg>`, file: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>`, chevron: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>`, download: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>`, success: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>`, error: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>`, warning: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>`, info: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>`, close: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>`,};
// ============================================// Utility Functions// ============================================
/** * Formats bytes to human-readable size. * @param {number} bytes - Size in bytes * @returns {string} Formatted size string */function formatFileSize(bytes) { if (bytes === 0) return '0 B'; const k = 1024; const sizes = ['B', 'KB', 'MB', 'GB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i];}
/** * Gets the file icon class based on extension. * @param {string} extension - File extension with dot * @returns {string} Icon class name */function getFileIconClass(extension) { const ext = extension.replace('.', '').toLowerCase(); return FILE_ICONS[ext] || 'file';}
/** * Validates file before upload. * @param {File} file - File to validate * @returns {{valid: boolean, error?: string}} */function validateFile(file) { const allowedExtensions = ['.zip', '.rar']; const maxSize = 100 * 1024 * 1024; // 100MB
const ext = '.' + file.name.split('.').pop().toLowerCase();
if (!allowedExtensions.includes(ext)) { return { valid: false, error: 'Only .zip and .rar files are allowed' }; }
if (file.size > maxSize) { return { valid: false, error: 'File size exceeds 100MB limit' }; }
return { valid: true };}
// ============================================// Toast Notifications// ============================================
/** * Shows a toast notification. * @param {string} type - Toast type: 'success', 'error', 'warning', 'info' * @param {string} title - Toast title * @param {string} message - Toast message * @param {number} duration - Duration in ms (default: 5000) */function showToast(type, title, message, duration = 5000) { const toast = document.createElement('div'); toast.className = `toast ${type}`; toast.innerHTML = ` <div class="toast-icon">${ICONS[type]}</div> <div class="toast-content"> <div class="toast-title">${title}</div> <div class="toast-message">${message}</div> </div> <button class="toast-close">${ICONS.close}</button> `;
elements.toastContainer.appendChild(toast);
// Close button handler const closeBtn = toast.querySelector('.toast-close'); closeBtn.addEventListener('click', () => removeToast(toast));
// Auto-remove after duration if (duration > 0) { setTimeout(() => removeToast(toast), duration); }}
/** * Removes a toast with animation. * @param {HTMLElement} toast - Toast element to remove */function removeToast(toast) { if (!toast.parentNode) return; toast.classList.add('removing'); setTimeout(() => toast.remove(), 300);}
// ============================================// File Upload// ============================================
/** * Handles file upload with progress tracking. * Supports multiple files. * @param {FileList|File[]} files - Files to upload */async function uploadFiles(files) { if (state.uploadInProgress) { showToast('warning', 'Upload in Progress', 'Please wait for the current upload to complete.'); return; }
const fileArray = Array.from(files); // Validate all files for (const file of fileArray) { const validation = validateFile(file); if (!validation.valid) { showToast('error', 'Invalid File', `${file.name}: ${validation.error}`); return; } }
state.uploadInProgress = true; const fileNames = fileArray.map(f => f.name).join(', '); showProgress(fileArray.length > 1 ? `${fileArray.length} files` : fileArray[0].name);
const formData = new FormData(); for (const file of fileArray) { formData.append('file', file); } // Add password if provided const password = elements.passwordInput.value.trim(); if (password) { formData.append('password', password); }
const xhr = new XMLHttpRequest();
xhr.upload.addEventListener('progress', (e) => { if (e.lengthComputable) { const percent = Math.round((e.loaded / e.total) * 100); updateProgress(percent, 'Uploading...'); } });
xhr.addEventListener('load', async () => { if (xhr.status === 200) { const response = JSON.parse(xhr.responseText); updateProgress(100, 'Extracting archive...'); // Small delay for UX await new Promise(resolve => setTimeout(resolve, 500)); // Handle both single and multiple file responses if (response.archives) { // Multiple files - use first one for now, store all session IDs state.currentSessionId = response.archives[0].sessionId; state.allSessions = response.archives.map(a => a.sessionId); hideProgress(); await loadFileTree(response.archives[0].sessionId, response.archives[0].filename, response.archives[0].stats); const totalFiles = response.archives.reduce((sum, a) => sum + a.stats.totalFiles, 0); showToast('success', 'Upload Complete', `Successfully extracted ${response.count} archives with ${totalFiles} total files.`); } else { // Single file state.currentSessionId = response.sessionId; state.allSessions = [response.sessionId]; hideProgress(); await loadFileTree(response.sessionId, response.filename, response.stats); showToast('success', 'Upload Complete', `Successfully extracted ${response.stats.totalFiles} files.`); } } else { const error = JSON.parse(xhr.responseText); hideProgress(); showToast('error', 'Upload Failed', error.message || 'An error occurred during upload.'); } state.uploadInProgress = false; });
xhr.addEventListener('error', () => { hideProgress(); showToast('error', 'Network Error', 'Failed to connect to the server.'); state.uploadInProgress = false; });
xhr.open('POST', '/api/upload'); xhr.send(formData);}
/** * Shows the progress section. * @param {string} filename - Name of file being uploaded */function showProgress(filename) { elements.progressSection.classList.add('active'); elements.progressFilename.textContent = filename; elements.progressPercent.textContent = '0%'; elements.progressFill.style.width = '0%'; elements.progressStatus.textContent = 'Preparing upload...'; elements.dropzone.style.display = 'none'; elements.passwordSection.style.display = 'none';}
/** * Updates progress display. * @param {number} percent - Progress percentage * @param {string} status - Status message */function updateProgress(percent, status) { elements.progressPercent.textContent = `${percent}%`; elements.progressFill.style.width = `${percent}%`; elements.progressStatus.textContent = status;}
/** * Hides the progress section. */function hideProgress() { elements.progressSection.classList.remove('active'); elements.dropzone.style.display = 'block'; elements.passwordSection.style.display = 'block'; // Clear password after upload attempt elements.passwordInput.value = '';}
// ============================================// File Tree// ============================================
/** * Loads and displays the file tree. * @param {string} sessionId - Session ID * @param {string} filename - Original filename * @param {Object} stats - Extraction statistics */async function loadFileTree(sessionId, filename, stats) { try { const response = await fetch(`/api/files/${sessionId}`); const data = await response.json();
if (!response.ok) { throw new Error(data.message || 'Failed to load file tree'); }
// Update UI elements.archiveName.textContent = filename; elements.archiveStats.textContent = `${stats.totalFiles} files • ${formatFileSize(stats.totalSize)}`; // Render tree elements.fileTree.innerHTML = ''; renderTreeNode(data.tree, elements.fileTree, true);
// Show explorer, hide upload elements.uploadSection.classList.add('hidden'); elements.explorerSection.classList.remove('hidden'); } catch (error) { console.error('Error loading file tree:', error); showToast('error', 'Error', error.message); }}
/** * Renders a tree node recursively. * @param {Object} node - Tree node data * @param {HTMLElement} container - Container element * @param {boolean} isRoot - Whether this is the root node */function renderTreeNode(node, container, isRoot = false) { const item = document.createElement('div'); item.className = 'tree-item';
const isFolder = node.type === 'folder'; const hasChildren = isFolder && node.children && node.children.length > 0; const iconClass = isFolder ? 'folder' : getFileIconClass(node.extension);
const header = document.createElement('div'); header.className = 'tree-header'; header.innerHTML = ` <span class="tree-toggle ${hasChildren ? '' : 'hidden'}">${ICONS.chevron}</span> <span class="tree-icon ${iconClass}">${isFolder ? ICONS.folder : ICONS.file}</span> <span class="tree-name">${node.name}</span> ${!isFolder ? `<span class="tree-size">${formatFileSize(node.size)}</span>` : ''} <div class="tree-actions"> <button class="tree-action-btn" title="Download${isFolder ? ' as ZIP' : ''}" data-action="download" data-path="${node.path}" data-type="${node.type}"> ${ICONS.download} </button> </div> `;
item.appendChild(header);
// Add children container for folders if (hasChildren) { const childrenContainer = document.createElement('div'); childrenContainer.className = 'tree-children'; for (const child of node.children) { renderTreeNode(child, childrenContainer); } item.appendChild(childrenContainer);
// Toggle handler header.addEventListener('click', (e) => { if (e.target.closest('.tree-action-btn')) return; const toggle = header.querySelector('.tree-toggle'); const icon = header.querySelector('.tree-icon'); const isExpanded = childrenContainer.classList.toggle('expanded'); toggle.classList.toggle('expanded', isExpanded); icon.innerHTML = isExpanded ? ICONS.folderOpen : ICONS.folder; });
// Expand root by default if (isRoot) { const toggle = header.querySelector('.tree-toggle'); const icon = header.querySelector('.tree-icon'); childrenContainer.classList.add('expanded'); toggle.classList.add('expanded'); icon.innerHTML = ICONS.folderOpen; } }
// Download action handler const downloadBtn = header.querySelector('.tree-action-btn[data-action="download"]'); downloadBtn.addEventListener('click', (e) => { e.stopPropagation(); const path = downloadBtn.dataset.path; const type = downloadBtn.dataset.type; downloadItem(path, type); });
container.appendChild(item);}
/** * Downloads a file or folder. * @param {string} path - Item path * @param {string} type - 'file' or 'folder' */function downloadItem(path, type) { if (!state.currentSessionId) { showToast('error', 'Error', 'No active session'); return; }
// Remove leading slash from path (backend expects relative paths) const relativePath = path.startsWith('/') ? path.slice(1) : path;
const endpoint = type === 'folder' ? `/api/download/${state.currentSessionId}/folder?path=${encodeURIComponent(relativePath)}` : `/api/download/${state.currentSessionId}/file?path=${encodeURIComponent(relativePath)}`;
// Create temporary link and click it const link = document.createElement('a'); link.href = endpoint; link.download = ''; document.body.appendChild(link); link.click(); document.body.removeChild(link);
showToast('info', 'Download Started', `Downloading ${type === 'folder' ? 'folder as ZIP' : path.split('/').pop()}...`);}
/** * Downloads all files as ZIP. */function downloadAll() { downloadItem('/', 'folder');}
/** * Resets to upload view. */function resetToUpload() { // Clean up current session if (state.currentSessionId) { fetch(`/api/session/${state.currentSessionId}`, { method: 'DELETE' }) .catch(console.error); }
state.currentSessionId = null; elements.fileTree.innerHTML = ''; elements.explorerSection.classList.add('hidden'); elements.uploadSection.classList.remove('hidden');}
// ============================================// Event Listeners// ============================================
// Drag and dropelements.dropzone.addEventListener('dragover', (e) => { e.preventDefault(); elements.dropzone.classList.add('dragover');});
elements.dropzone.addEventListener('dragleave', (e) => { e.preventDefault(); elements.dropzone.classList.remove('dragover');});
elements.dropzone.addEventListener('drop', (e) => { e.preventDefault(); elements.dropzone.classList.remove('dragover'); const files = e.dataTransfer.files; if (files.length > 0) { uploadFiles(files); }});
// Click to uploadelements.dropzone.addEventListener('click', () => { elements.fileInput.click();});
elements.fileInput.addEventListener('change', (e) => { const files = e.target.files; if (files.length > 0) { uploadFiles(files); } // Reset input so same file can be selected again e.target.value = '';});
// Button handlerselements.downloadAllBtn.addEventListener('click', downloadAll);elements.newUploadBtn.addEventListener('click', resetToUpload);
// Keyboard shortcutsdocument.addEventListener('keydown', (e) => { // Escape to go back to upload if (e.key === 'Escape' && !elements.explorerSection.classList.contains('hidden')) { resetToUpload(); }});
// Prevent default drag behavior on documentdocument.addEventListener('dragover', (e) => e.preventDefault());document.addEventListener('drop', (e) => e.preventDefault());
// Password toggle visibilityelements.passwordToggle.addEventListener('click', () => { const input = elements.passwordInput; const eyeIcon = elements.passwordToggle.querySelector('.eye-icon'); const eyeOffIcon = elements.passwordToggle.querySelector('.eye-off-icon'); if (input.type === 'password') { input.type = 'text'; eyeIcon.classList.add('hidden'); eyeOffIcon.classList.remove('hidden'); } else { input.type = 'password'; eyeIcon.classList.remove('hidden'); eyeOffIcon.classList.add('hidden'); }});
// ============================================// Initialize// ============================================console.log('Archive Extractor initialized');123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Upload and extract ZIP and RAR archive files. Browse and download extracted contents."> <title>Archive Extractor - Upload, Extract & Download</title> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="styles.css"></head><body> <div class="app-container"> <!-- Header --> <header class="header"> <div class="header-content"> <div class="logo"> <svg class="logo-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M21 8v13H3V8M1 3h22v5H1zM10 12h4"/> </svg> <h1>Archive Extractor</h1> </div> <p class="tagline">Upload, extract, and browse your ZIP & RAR files</p> </div> </header>
<!-- Main Content --> <main class="main-content"> <!-- Upload Section --> <section id="upload-section" class="upload-section"> <div class="upload-zone" id="dropzone"> <div class="upload-icon"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> <polyline points="17 8 12 3 7 8"/> <line x1="12" y1="3" x2="12" y2="15"/> </svg> </div> <h2 class="upload-title">Drag & Drop your archive here</h2> <p class="upload-subtitle">or tap to select a file</p> <p class="upload-info">Supports ZIP and RAR files up to 100MB</p> <input type="file" id="fileInput" accept=".zip,.rar" multiple hidden> </div>
<!-- Password Section --> <div class="password-section" id="passwordSection"> <div class="password-header"> <svg class="password-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/> <path d="M7 11V7a5 5 0 0 1 10 0v4"/> </svg> <span>Password (optional)</span> </div> <div class="password-input-wrapper"> <input type="password" id="passwordInput" class="password-input" placeholder="Enter password if archive is protected" autocomplete="off" > <button type="button" class="password-toggle" id="passwordToggle" aria-label="Toggle password visibility"> <svg class="eye-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/> <circle cx="12" cy="12" r="3"/> </svg> <svg class="eye-off-icon hidden" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/> <line x1="1" y1="1" x2="23" y2="23"/> </svg> </button> </div> <p class="password-hint">Leave empty if archive is not password protected</p> </div>
<!-- Progress Section --> <div class="progress-section" id="progressSection"> <div class="progress-header"> <span class="progress-filename" id="progressFilename">Uploading...</span> <span class="progress-percent" id="progressPercent">0%</span> </div> <div class="progress-bar"> <div class="progress-fill" id="progressFill"></div> </div> <p class="progress-status" id="progressStatus">Preparing upload...</p> </div> </section>
<!-- File Explorer Section --> <section id="explorer-section" class="explorer-section hidden"> <div class="explorer-header"> <div class="explorer-info"> <h2 class="explorer-title" id="archiveName">Archive Contents</h2> <p class="explorer-stats" id="archiveStats"></p> </div> <div class="explorer-actions"> <button class="btn btn-primary" id="downloadAllBtn"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> <polyline points="7 10 12 15 17 10"/> <line x1="12" y1="15" x2="12" y2="3"/> </svg> Download All </button> <button class="btn btn-secondary" id="newUploadBtn"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <line x1="12" y1="5" x2="12" y2="19"/> <line x1="5" y1="12" x2="19" y2="12"/> </svg> New Upload </button> </div> </div>
<!-- File Tree --> <div class="file-tree-container"> <div class="file-tree" id="fileTree"> <!-- Tree will be rendered here --> </div> </div> </section> </main>
<!-- Toast Container --> <div class="toast-container" id="toastContainer"></div>
<!-- Footer --> <footer class="footer"> <a href="https://www.buymeacoffee.com/bacteriaqh" target="_blank" rel="noopener noreferrer" class="bmc-button"> <svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20"> <path d="M20.216 6.415l-.132-.666c-.119-.598-.388-1.163-1.001-1.379-.197-.069-.42-.098-.57-.241-.152-.143-.196-.366-.231-.572-.065-.378-.125-.756-.192-1.133-.057-.325-.102-.69-.25-.987-.195-.4-.597-.634-.996-.788a5.723 5.723 0 00-.626-.194c-1-.263-2.05-.36-3.077-.416a25.834 25.834 0 00-3.7.062c-.915.083-1.88.184-2.75.5-.318.116-.646.256-.888.501-.297.302-.393.77-.177 1.146.154.267.415.456.692.58.36.162.737.284 1.123.366 1.075.238 2.189.331 3.287.37 1.218.05 2.437.01 3.65-.118.299-.033.598-.073.896-.119.352-.054.578-.513.474-.834-.124-.383-.457-.531-.834-.473-.466.074-.96.108-1.382.146-1.177.08-2.358.082-3.536.006a22.228 22.228 0 01-1.157-.107c-.086-.01-.18-.025-.258-.036-.243-.036-.484-.08-.724-.13-.111-.027-.111-.185 0-.212h.005c.277-.06.557-.108.838-.147h.002c.131-.009.263-.032.394-.048a25.076 25.076 0 013.426-.12c.674.019 1.347.067 2.017.144l.228.031c.267.04.533.088.798.145.392.085.895.113 1.07.542.055.137.08.288.111.431l.319 1.484a.237.237 0 01-.199.284h-.003c-.037.006-.075.01-.112.015a36.704 36.704 0 01-4.743.295 37.059 37.059 0 01-4.699-.304c-.14-.017-.293-.042-.417-.06-.326-.048-.649-.108-.973-.161-.393-.065-.768-.032-1.123.161-.29.16-.527.404-.675.701-.154.316-.199.66-.267 1-.069.34-.176.707-.135 1.056.087.753.613 1.365 1.37 1.502a39.69 39.69 0 0011.343.376.483.483 0 01.535.53l-.071.697-1.018 9.907c-.041.41-.047.832-.125 1.237-.122.637-.553 1.028-1.182 1.171-.577.131-1.165.2-1.756.205-.656.004-1.31-.025-1.966-.022-.699.004-1.556-.06-2.095-.58-.475-.458-.54-1.174-.605-1.793l-.731-7.013-.322-3.094c-.037-.351-.286-.695-.678-.678-.336.015-.718.3-.678.679l.228 2.185.949 9.112c.147 1.344 1.174 2.068 2.446 2.272.742.12 1.503.144 2.257.156.966.016 1.942.053 2.892-.122 1.408-.258 2.465-1.198 2.616-2.657.34-3.332.683-6.663 1.024-9.995l.215-2.087a.484.484 0 01.39-.426c.402-.078.787-.212 1.074-.518.455-.488.546-1.124.385-1.766zm-1.478.772c-.145.137-.363.201-.578.233-2.416.359-4.866.54-7.308.46-1.748-.06-3.477-.254-5.207-.498-.17-.024-.353-.055-.47-.18-.22-.236-.111-.71-.054-.995.052-.26.152-.609.463-.646.484-.057 1.046.148 1.526.22.577.088 1.156.159 1.737.212 2.48.226 5.002.19 7.472-.14.45-.06.899-.13 1.345-.21.399-.072.84-.206 1.08.206.166.281.188.657.162.974a.544.544 0 01-.168.364z"/> </svg> Buy me a coffee </a> </footer> </div>
<script src="app.js"></script></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984/** * CSS Styles for Archive Extractor Application * Modern dark theme with glassmorphism effects and smooth animations */
/* ============================================ CSS Custom Properties (Design Tokens) ============================================ */:root { /* Colors */ --color-bg-primary: #0a0a0f; --color-bg-secondary: #12121a; --color-bg-tertiary: #1a1a24; --color-bg-glass: rgba(26, 26, 36, 0.8); --color-bg-hover: rgba(99, 102, 241, 0.1); --color-text-primary: #f8fafc; --color-text-secondary: #94a3b8; --color-text-muted: #64748b; --color-accent: #6366f1; --color-accent-light: #818cf8; --color-accent-dark: #4f46e5; --color-success: #22c55e; --color-success-bg: rgba(34, 197, 94, 0.1); --color-error: #ef4444; --color-error-bg: rgba(239, 68, 68, 0.1); --color-warning: #f59e0b; --color-warning-bg: rgba(245, 158, 11, 0.1); --color-border: rgba(148, 163, 184, 0.1); --color-border-accent: rgba(99, 102, 241, 0.3); /* Spacing */ --spacing-xs: 0.25rem; --spacing-sm: 0.5rem; --spacing-md: 1rem; --spacing-lg: 1.5rem; --spacing-xl: 2rem; --spacing-2xl: 3rem; /* Border Radius */ --radius-sm: 0.375rem; --radius-md: 0.5rem; --radius-lg: 0.75rem; --radius-xl: 1rem; --radius-full: 9999px; /* Shadows */ --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3); --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4); --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3); /* Transitions */ --transition-fast: 150ms ease; --transition-base: 200ms ease; --transition-slow: 300ms ease; /* Typography */ --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; --font-size-xs: 0.75rem; --font-size-sm: 0.875rem; --font-size-base: 1rem; --font-size-lg: 1.125rem; --font-size-xl: 1.25rem; --font-size-2xl: 1.5rem; --font-size-3xl: 2rem;}
/* ============================================ Reset & Base Styles ============================================ */*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0;}
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;}
body { font-family: var(--font-family); font-size: var(--font-size-base); line-height: 1.6; color: var(--color-text-primary); background: var(--color-bg-primary); min-height: 100vh; overflow-x: hidden;}
/* Background gradient effect */body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%), radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%); pointer-events: none; z-index: -1;}
/* ============================================ App Container ============================================ */.app-container { max-width: 1200px; margin: 0 auto; padding: var(--spacing-md); min-height: 100vh; display: flex; flex-direction: column;}
/* ============================================ Header ============================================ */.header { padding: var(--spacing-xl) 0; text-align: center;}
.header-content { display: flex; flex-direction: column; align-items: center; gap: var(--spacing-sm);}
.logo { display: flex; align-items: center; gap: var(--spacing-md);}
.logo-icon { width: 48px; height: 48px; color: var(--color-accent);}
.logo h1 { font-size: var(--font-size-3xl); font-weight: 700; background: linear-gradient(135deg, var(--color-text-primary), var(--color-accent-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;}
.tagline { color: var(--color-text-secondary); font-size: var(--font-size-lg);}
/* ============================================ Main Content ============================================ */.main-content { flex: 1; display: flex; flex-direction: column; gap: var(--spacing-xl);}
/* ============================================ Upload Section ============================================ */.upload-section { display: flex; flex-direction: column; gap: var(--spacing-lg);}
.upload-zone { position: relative; border: 2px dashed var(--color-border); border-radius: var(--radius-xl); padding: var(--spacing-2xl); text-align: center; cursor: pointer; transition: all var(--transition-base); background: var(--color-bg-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);}
.upload-zone:hover { border-color: var(--color-accent); background: var(--color-bg-hover);}
.upload-zone.dragover { border-color: var(--color-accent); background: rgba(99, 102, 241, 0.15); transform: scale(1.01); box-shadow: var(--shadow-glow);}
.upload-icon { margin-bottom: var(--spacing-lg);}
.upload-icon svg { width: 64px; height: 64px; color: var(--color-accent); transition: transform var(--transition-base);}
.upload-zone:hover .upload-icon svg { transform: translateY(-4px);}
.upload-title { font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--spacing-sm);}
.upload-subtitle { color: var(--color-text-secondary); margin-bottom: var(--spacing-md);}
.upload-info { color: var(--color-text-muted); font-size: var(--font-size-sm);}
/* ============================================ Password Section ============================================ */.password-section { background: var(--color-bg-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: var(--radius-lg); padding: var(--spacing-lg); border: 1px solid var(--color-border);}
.password-header { display: flex; align-items: center; gap: var(--spacing-sm); margin-bottom: var(--spacing-md); color: var(--color-text-secondary); font-size: var(--font-size-sm); font-weight: 500;}
.password-icon { width: 18px; height: 18px; color: var(--color-accent);}
.password-input-wrapper { position: relative; display: flex; align-items: center;}
.password-input { width: 100%; padding: var(--spacing-md) var(--spacing-lg); padding-right: 3.5rem; font-family: inherit; font-size: var(--font-size-base); color: var(--color-text-primary); background: var(--color-bg-tertiary); border: 1px solid var(--color-border); border-radius: var(--radius-md); outline: none; transition: all var(--transition-fast); /* Mobile-friendly: larger touch target */ min-height: 48px;}
.password-input::placeholder { color: var(--color-text-muted);}
.password-input:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);}
.password-toggle { position: absolute; right: var(--spacing-sm); display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: none; background: transparent; color: var(--color-text-muted); cursor: pointer; border-radius: var(--radius-sm); transition: all var(--transition-fast); /* Mobile-friendly: larger touch target */ -webkit-tap-highlight-color: transparent;}
.password-toggle:hover,.password-toggle:active { color: var(--color-accent); background: var(--color-bg-hover);}
.password-toggle svg { width: 20px; height: 20px;}
.password-toggle .eye-off-icon.hidden,.password-toggle .eye-icon.hidden { display: none;}
.password-hint { margin-top: var(--spacing-sm); color: var(--color-text-muted); font-size: var(--font-size-xs);}
/* ============================================ Progress Section ============================================ */.progress-section { display: none; background: var(--color-bg-glass); backdrop-filter: blur(10px); border-radius: var(--radius-lg); padding: var(--spacing-lg); border: 1px solid var(--color-border);}
.progress-section.active { display: block; animation: slideDown 0.3s ease;}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); }}
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--spacing-sm);}
.progress-filename { font-weight: 500; color: var(--color-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80%;}
.progress-percent { font-weight: 600; color: var(--color-accent);}
.progress-bar { height: 6px; background: var(--color-bg-tertiary); border-radius: var(--radius-full); overflow: hidden; margin-bottom: var(--spacing-sm);}
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light)); border-radius: var(--radius-full); transition: width var(--transition-fast);}
.progress-status { color: var(--color-text-secondary); font-size: var(--font-size-sm);}
/* ============================================ Explorer Section ============================================ */.explorer-section { background: var(--color-bg-glass); backdrop-filter: blur(10px); border-radius: var(--radius-xl); border: 1px solid var(--color-border); overflow: hidden; animation: fadeIn 0.3s ease;}
.explorer-section.hidden { display: none;}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; }}
.explorer-header { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-lg); border-bottom: 1px solid var(--color-border); flex-wrap: wrap; gap: var(--spacing-md);}
.explorer-info { flex: 1; min-width: 200px;}
.explorer-title { font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--spacing-xs);}
.explorer-stats { color: var(--color-text-secondary); font-size: var(--font-size-sm);}
.explorer-actions { display: flex; gap: var(--spacing-sm); flex-wrap: wrap;}
/* ============================================ Buttons ============================================ */.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--spacing-sm); padding: var(--spacing-md) var(--spacing-lg); font-family: inherit; font-size: var(--font-size-sm); font-weight: 500; border: none; border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; /* Mobile-friendly: minimum touch target */ min-height: 44px; -webkit-tap-highlight-color: transparent;}
.btn svg { width: 16px; height: 16px;}
.btn-primary { background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark)); color: white;}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow);}
.btn-secondary { background: var(--color-bg-tertiary); color: var(--color-text-primary); border: 1px solid var(--color-border);}
.btn-secondary:hover { background: var(--color-bg-hover); border-color: var(--color-accent);}
.btn-small { padding: var(--spacing-xs) var(--spacing-sm); font-size: var(--font-size-xs);}
/* ============================================ File Tree ============================================ */.file-tree-container { max-height: 60vh; overflow-y: auto; padding: var(--spacing-md);}
.file-tree { font-family: monospace; font-size: var(--font-size-sm);}
.tree-item { user-select: none;}
.tree-header { display: flex; align-items: center; gap: var(--spacing-sm); padding: var(--spacing-sm) var(--spacing-md); border-radius: var(--radius-md); cursor: pointer; transition: background var(--transition-fast);}
.tree-header:hover { background: var(--color-bg-hover);}
.tree-toggle { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); transition: transform var(--transition-fast); flex-shrink: 0;}
.tree-toggle.expanded { transform: rotate(90deg);}
.tree-toggle.hidden { visibility: hidden;}
.tree-icon { width: 18px; height: 18px; flex-shrink: 0;}
.tree-icon.folder { color: #fbbf24;}
.tree-icon.file { color: var(--color-text-secondary);}
/* File type specific icons */.tree-icon.file-pdf { color: #ef4444; }.tree-icon.file-doc { color: #3b82f6; }.tree-icon.file-image { color: #10b981; }.tree-icon.file-video { color: #8b5cf6; }.tree-icon.file-audio { color: #f59e0b; }.tree-icon.file-code { color: #06b6d4; }.tree-icon.file-archive { color: #6366f1; }
.tree-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--color-text-primary);}
.tree-size { color: var(--color-text-muted); font-size: var(--font-size-xs); margin-left: auto; padding-left: var(--spacing-md);}
.tree-actions { display: flex; gap: var(--spacing-xs); opacity: 0; transition: opacity var(--transition-fast);}
.tree-header:hover .tree-actions { opacity: 1;}
/* Mobile: always show actions */@media (hover: none) and (pointer: coarse) { .tree-actions { opacity: 1; }}
.tree-action-btn { display: flex; align-items: center; justify-content: center; /* Mobile-friendly: larger touch target */ width: 36px; height: 36px; border: none; background: var(--color-bg-tertiary); border-radius: var(--radius-md); color: var(--color-text-secondary); cursor: pointer; transition: all var(--transition-fast); -webkit-tap-highlight-color: transparent;}
.tree-action-btn:hover,.tree-action-btn:active { background: var(--color-accent); color: white;}
.tree-action-btn svg { width: 16px; height: 16px;}
.tree-children { margin-left: var(--spacing-lg); border-left: 1px solid var(--color-border); padding-left: var(--spacing-sm); display: none;}
.tree-children.expanded { display: block; animation: expandIn 0.2s ease;}
@keyframes expandIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); }}
/* ============================================ Toast Notifications ============================================ */.toast-container { position: fixed; bottom: var(--spacing-lg); right: var(--spacing-lg); display: flex; flex-direction: column; gap: var(--spacing-sm); z-index: 1000; max-width: 400px;}
.toast { display: flex; align-items: flex-start; gap: var(--spacing-md); padding: var(--spacing-md); background: var(--color-bg-secondary); border-radius: var(--radius-lg); border: 1px solid var(--color-border); box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease;}
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); }}
.toast.removing { animation: slideOut 0.3s ease forwards;}
@keyframes slideOut { to { opacity: 0; transform: translateX(100%); }}
.toast-icon { width: 20px; height: 20px; flex-shrink: 0;}
.toast.success .toast-icon { color: var(--color-success); }.toast.error .toast-icon { color: var(--color-error); }.toast.warning .toast-icon { color: var(--color-warning); }.toast.info .toast-icon { color: var(--color-accent); }
.toast-content { flex: 1;}
.toast-title { font-weight: 600; font-size: var(--font-size-sm); margin-bottom: var(--spacing-xs);}
.toast-message { color: var(--color-text-secondary); font-size: var(--font-size-sm); line-height: 1.4;}
.toast-close { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: none; background: transparent; color: var(--color-text-muted); cursor: pointer; border-radius: var(--radius-sm); transition: all var(--transition-fast);}
.toast-close:hover { background: var(--color-bg-tertiary); color: var(--color-text-primary);}
.toast-close svg { width: 14px; height: 14px;}
/* ============================================ Loading Spinner ============================================ */.spinner { width: 20px; height: 20px; border: 2px solid var(--color-bg-tertiary); border-top-color: var(--color-accent); border-radius: 50%; animation: spin 0.8s linear infinite;}
@keyframes spin { to { transform: rotate(360deg); }}
/* ============================================ Scrollbar Styling ============================================ */::-webkit-scrollbar { width: 8px; height: 8px;}
::-webkit-scrollbar-track { background: var(--color-bg-secondary); border-radius: var(--radius-full);}
::-webkit-scrollbar-thumb { background: var(--color-bg-tertiary); border-radius: var(--radius-full); border: 2px solid var(--color-bg-secondary);}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted);}
/* ============================================ Responsive Design ============================================ */@media (max-width: 768px) { :root { --font-size-3xl: 1.5rem; --font-size-2xl: 1.25rem; --font-size-xl: 1.125rem; }
.app-container { padding: var(--spacing-md); }
.header { padding: var(--spacing-lg) 0; }
.logo-icon { width: 36px; height: 36px; }
.upload-zone { padding: var(--spacing-xl) var(--spacing-lg); }
.upload-icon svg { width: 48px; height: 48px; }
.password-section { padding: var(--spacing-md); }
.password-input { font-size: 16px; /* Prevents iOS zoom on focus */ }
.explorer-header { flex-direction: column; align-items: stretch; padding: var(--spacing-md); }
.explorer-actions { justify-content: stretch; }
.explorer-actions .btn { flex: 1; justify-content: center; padding: var(--spacing-md); }
.file-tree-container { padding: var(--spacing-sm); }
.tree-header { padding: var(--spacing-sm) var(--spacing-sm); gap: var(--spacing-sm); min-height: 48px; /* Mobile touch target */ }
.tree-size { display: none; }
.tree-children { margin-left: var(--spacing-md); }
.toast-container { left: var(--spacing-sm); right: var(--spacing-sm); bottom: var(--spacing-sm); max-width: none; }
.toast { padding: var(--spacing-md); }}
@media (max-width: 480px) { .logo { flex-direction: column; gap: var(--spacing-xs); }
.logo h1 { font-size: var(--font-size-xl); }
.tagline { font-size: var(--font-size-sm); text-align: center; }
.upload-title { font-size: var(--font-size-base); }
.upload-subtitle, .upload-info { font-size: var(--font-size-xs); }
.password-header { font-size: var(--font-size-xs); }
.tree-name { font-size: var(--font-size-sm); }}
/* ============================================ Utility Classes ============================================ */.hidden { display: none !important;}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;}
/* ============================================ Footer ============================================ */.footer { padding: var(--spacing-xl) 0; text-align: center; margin-top: auto;}
.bmc-button { display: inline-flex; align-items: center; gap: var(--spacing-sm); padding: var(--spacing-md) var(--spacing-lg); background: linear-gradient(135deg, #ffdd00 0%, #ffc107 100%); color: #000; font-weight: 600; font-size: var(--font-size-sm); text-decoration: none; border-radius: var(--radius-full); transition: all var(--transition-base); box-shadow: var(--shadow-md);}
.bmc-button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 221, 0, 0.4);}
.bmc-button:active { transform: translateY(0);}
.bmc-button svg { width: 20px; height: 20px;}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487/** * @fileoverview Archive controller handling all API endpoint logic. * Manages file uploads, extraction, file tree generation, and downloads. * @module controllers/archiveController */
import fs from 'fs-extra';import path from 'path';import { v4 as uuidv4 } from 'uuid';import archiver from 'archiver';import { fileURLToPath } from 'url';import mime from 'mime-types';import { extractArchive, getExtractionStats } from '../services/extractionService.js';import { generateFileTree } from '../utils/fileTree.js';import { validatePath, sanitizeFilename } from '../middleware/security.js';
const __filename = fileURLToPath(import.meta.url);const __dirname = path.dirname(__filename);
/** * Base paths for file storage. * @constant {Object} */const PATHS = { uploads: path.resolve(__dirname, '../../uploads'), extracted: path.resolve(__dirname, '../../extracted'),};
// Ensure directories existawait fs.ensureDir(PATHS.uploads);await fs.ensureDir(PATHS.extracted);
/** * Stores active session information for cleanup. * @type {Map<string, {createdAt: number, timeout: NodeJS.Timeout}>} */const activeSessions = new Map();
/** * Session timeout duration. * @constant {number} */const SESSION_TIMEOUT = parseInt(process.env.SESSION_TIMEOUT) || 60000; // 1 minute
/** * Schedules automatic cleanup for a session. * * @param {string} sessionId - Session ID to schedule cleanup for */const scheduleCleanup = (sessionId) => { const timeout = setTimeout(async () => { await cleanupSession(sessionId); }, SESSION_TIMEOUT);
activeSessions.set(sessionId, { createdAt: Date.now(), timeout, });};
/** * Cleans up session files and data. * * @async * @param {string} sessionId - Session ID to cleanup * @returns {Promise<boolean>} True if cleanup succeeded */const cleanupSession = async (sessionId) => { try { const session = activeSessions.get(sessionId); if (session?.timeout) { clearTimeout(session.timeout); } activeSessions.delete(sessionId);
// Remove extracted files const extractedPath = path.join(PATHS.extracted, sessionId); await fs.remove(extractedPath);
// Remove uploaded file const uploadPattern = path.join(PATHS.uploads, `${sessionId}*`); const uploadFiles = await fs.readdir(PATHS.uploads); for (const file of uploadFiles) { if (file.startsWith(sessionId)) { await fs.remove(path.join(PATHS.uploads, file)); } }
console.log(`Session cleaned up: ${sessionId}`); return true; } catch (error) { console.error(`Cleanup error for session ${sessionId}:`, error.message); return false; }};
/** * Handles file upload and extraction. * Supports both single and multiple file uploads. * POST /api/upload * * @async * @param {Object} req - Express request object * @param {Object} res - Express response object */export const uploadArchive = async (req, res) => { const createdSessions = []; const uploadPaths = [];
try { // Support both single file (req.file) and multiple files (req.files) const files = req.files || (req.file ? [req.file] : []); if (files.length === 0) { return res.status(400).json({ error: true, message: 'No file uploaded', code: 'NO_FILE', }); }
// Get password from request body (optional) const password = req.body?.password || null; const results = []; // Process each file for (const file of files) { const sessionId = uuidv4(); const uploadPath = file.path; createdSessions.push(sessionId); uploadPaths.push(uploadPath);
// Create session extraction directory const extractionPath = path.join(PATHS.extracted, sessionId); await fs.ensureDir(extractionPath, { mode: 0o755 });
// Extract the archive (with password if provided) console.log(`Extracting ${file.originalname} to session ${sessionId}${password ? ' (with password)' : ''}`); const result = await extractArchive(uploadPath, extractionPath, { password });
if (!result.success) { // Clean up on extraction failure await fs.remove(extractionPath); await fs.remove(uploadPath);
const statusCode = result.code === 'PASSWORD_PROTECTED' || result.code === 'INCORRECT_PASSWORD' || result.code === 'CORRUPTED_ARCHIVE' ? 422 : 500;
return res.status(statusCode).json({ error: true, message: `${file.originalname}: ${result.error}`, code: result.code, }); }
// Get extraction stats const stats = await getExtractionStats(extractionPath);
// Schedule automatic cleanup scheduleCleanup(sessionId);
// Clean up uploaded archive (no longer needed) await fs.remove(uploadPath);
results.push({ sessionId, filename: sanitizeFilename(file.originalname), stats: { totalFiles: stats.totalFiles, totalSize: stats.totalSize, }, }); }
// Return response based on single or multiple files if (results.length === 1) { res.status(200).json({ success: true, ...results[0], }); } else { res.status(200).json({ success: true, count: results.length, archives: results, }); } } catch (error) { console.error('Upload error:', error);
// Clean up on error for (const sessionId of createdSessions) { await fs.remove(path.join(PATHS.extracted, sessionId)).catch(() => {}); } for (const uploadPath of uploadPaths) { await fs.remove(uploadPath).catch(() => {}); }
res.status(500).json({ error: true, message: 'Failed to process archive', code: 'INTERNAL_ERROR', }); }};
/** * Returns the file tree for a session. * GET /api/files/:sessionId * * @async * @param {Object} req - Express request object * @param {Object} res - Express response object */export const getFileTree = async (req, res) => { try { const { sessionId } = req.params; const sessionPath = path.join(PATHS.extracted, sessionId);
// Check if session exists const exists = await fs.pathExists(sessionPath); if (!exists) { return res.status(404).json({ error: true, message: 'Session not found or expired', code: 'SESSION_NOT_FOUND', }); }
// Generate file tree const tree = await generateFileTree(sessionPath);
res.status(200).json({ success: true, sessionId, tree, }); } catch (error) { console.error('Get file tree error:', error); res.status(500).json({ error: true, message: 'Failed to retrieve file structure', code: 'INTERNAL_ERROR', }); }};
/** * Downloads an individual file. * GET /api/download/:sessionId/file?path=<filepath> * * @async * @param {Object} req - Express request object * @param {Object} res - Express response object */export const downloadFile = async (req, res) => { try { const { sessionId } = req.params; const filePath = req.query.path;
// Path validation is done in middleware, but double-check const pathValidation = validatePath(filePath); if (!pathValidation.valid) { return res.status(400).json({ error: true, message: pathValidation.error, code: 'INVALID_PATH', }); }
const sessionPath = path.join(PATHS.extracted, sessionId); const fullPath = path.join(sessionPath, filePath);
// SECURITY: Ensure path stays within session directory const normalizedPath = path.normalize(fullPath); if (!normalizedPath.startsWith(path.normalize(sessionPath))) { return res.status(400).json({ error: true, message: 'Invalid file path', code: 'INVALID_PATH', }); }
// Check if file exists const exists = await fs.pathExists(fullPath); if (!exists) { return res.status(404).json({ error: true, message: 'File not found', code: 'FILE_NOT_FOUND', }); }
// Check if it's a file (not directory) const stats = await fs.stat(fullPath); if (stats.isDirectory()) { return res.status(400).json({ error: true, message: 'Cannot download a directory. Use folder download endpoint.', code: 'IS_DIRECTORY', }); }
// Set headers and send file const filename = sanitizeFilename(path.basename(fullPath)); const contentType = mime.lookup(fullPath) || 'application/octet-stream'; res.setHeader('Content-Type', contentType); res.setHeader('Content-Disposition', `attachment; filename="${filename}"`); res.setHeader('Content-Length', stats.size);
const readStream = fs.createReadStream(fullPath); readStream.pipe(res); } catch (error) { console.error('Download file error:', error); res.status(500).json({ error: true, message: 'Failed to download file', code: 'INTERNAL_ERROR', }); }};
/** * Downloads a folder as a ZIP archive. * GET /api/download/:sessionId/folder?path=<folderpath> * * @async * @param {Object} req - Express request object * @param {Object} res - Express response object */export const downloadFolder = async (req, res) => { try { const { sessionId } = req.params; const folderPath = req.query.path || '/';
// Path validation if (folderPath !== '/') { const pathValidation = validatePath(folderPath); if (!pathValidation.valid) { return res.status(400).json({ error: true, message: pathValidation.error, code: 'INVALID_PATH', }); } }
const sessionPath = path.join(PATHS.extracted, sessionId); const fullPath = folderPath === '/' ? sessionPath : path.join(sessionPath, folderPath);
// SECURITY: Ensure path stays within session directory const normalizedPath = path.normalize(fullPath); if (!normalizedPath.startsWith(path.normalize(sessionPath))) { return res.status(400).json({ error: true, message: 'Invalid folder path', code: 'INVALID_PATH', }); }
// Check if folder exists const exists = await fs.pathExists(fullPath); if (!exists) { return res.status(404).json({ error: true, message: 'Folder not found', code: 'FILE_NOT_FOUND', }); }
// Check if it's a directory const stats = await fs.stat(fullPath); if (!stats.isDirectory()) { return res.status(400).json({ error: true, message: 'Path is not a folder. Use file download endpoint.', code: 'NOT_DIRECTORY', }); }
// Create ZIP archive const folderName = folderPath === '/' ? 'archive' : sanitizeFilename(path.basename(fullPath)); const zipFilename = `${folderName}.zip`;
res.setHeader('Content-Type', 'application/zip'); res.setHeader('Content-Disposition', `attachment; filename="${zipFilename}"`);
const archive = archiver('zip', { zlib: { level: 6 }, // Balanced compression });
archive.on('error', (err) => { console.error('Archiver error:', err); if (!res.headersSent) { res.status(500).json({ error: true, message: 'Failed to create archive', code: 'ARCHIVE_ERROR', }); } });
archive.pipe(res); archive.directory(fullPath, false); await archive.finalize(); } catch (error) { console.error('Download folder error:', error); if (!res.headersSent) { res.status(500).json({ error: true, message: 'Failed to download folder', code: 'INTERNAL_ERROR', }); } }};
/** * Manually deletes a session. * DELETE /api/session/:sessionId * * @async * @param {Object} req - Express request object * @param {Object} res - Express response object */export const deleteSession = async (req, res) => { try { const { sessionId } = req.params; const sessionPath = path.join(PATHS.extracted, sessionId);
// Check if session exists const exists = await fs.pathExists(sessionPath); if (!exists) { return res.status(404).json({ error: true, message: 'Session not found', code: 'SESSION_NOT_FOUND', }); }
// Clean up the session const success = await cleanupSession(sessionId);
if (success) { res.status(200).json({ success: true, message: 'Session deleted successfully', }); } else { res.status(500).json({ error: true, message: 'Failed to delete session', code: 'CLEANUP_ERROR', }); } } catch (error) { console.error('Delete session error:', error); res.status(500).json({ error: true, message: 'Failed to delete session', code: 'INTERNAL_ERROR', }); }};
/** * Gets session information. * Used internally for monitoring. * * @param {string} sessionId - Session ID * @returns {Object|null} Session info or null */export const getSessionInfo = (sessionId) => { return activeSessions.get(sessionId) || null;};
/** * Gets count of active sessions. * * @returns {number} Number of active sessions */export const getActiveSessionCount = () => { return activeSessions.size;};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149/** * @fileoverview Express application entry point. * Configures middleware, routes, and starts the server. * @module index */
import express from 'express';import helmet from 'helmet';import path from 'path';import { fileURLToPath } from 'url';import fs from 'fs-extra';import apiRoutes from './routes/api.js';
const __filename = fileURLToPath(import.meta.url);const __dirname = path.dirname(__filename);
/** * Express application instance. */const app = express();
/** * Server port. * @constant {number} */const PORT = parseInt(process.env.PORT) || 3000;
// ============================================// Ensure required directories exist// ============================================const uploadsDir = path.resolve(__dirname, '../uploads');const extractedDir = path.resolve(__dirname, '../extracted');await fs.ensureDir(uploadsDir);await fs.ensureDir(extractedDir);
// ============================================// Security Middleware// ============================================
/** * Helmet configuration for HTTP security headers. * SECURITY: Sets various HTTP headers to protect against common attacks. */app.use( helmet({ contentSecurityPolicy: { directives: { defaultSrc: ["'self'"], scriptSrc: ["'self'", "'unsafe-inline'"], styleSrc: ["'self'", "'unsafe-inline'", 'https://fonts.googleapis.com'], fontSrc: ["'self'", 'https://fonts.gstatic.com'], imgSrc: ["'self'", 'data:', 'blob:'], connectSrc: ["'self'"], }, }, crossOriginEmbedderPolicy: false, }));
// ============================================// Body Parsing Middleware// ============================================app.use(express.json({ limit: '1mb' }));app.use(express.urlencoded({ extended: true, limit: '1mb' }));
// ============================================// Static Files// ============================================const publicDir = path.resolve(__dirname, '../public');app.use(express.static(publicDir));
// ============================================// API Routes// ============================================app.use('/api', apiRoutes);
// ============================================// Fallback route for SPA// ============================================app.get('*', (req, res) => { res.sendFile(path.join(publicDir, 'index.html'));});
// ============================================// Global Error Handler// ============================================
/** * Global error handling middleware. * Catches unhandled errors and returns consistent error response. * * @param {Error} err - Error object * @param {Object} req - Express request * @param {Object} res - Express response * @param {Function} next - Next middleware */app.use((err, req, res, next) => { console.error('Unhandled error:', err);
// Don't leak error details in production const message = process.env.NODE_ENV === 'production' ? 'An unexpected error occurred' : err.message;
res.status(500).json({ error: true, message, code: 'INTERNAL_ERROR', });});
// ============================================// Start Server// ============================================const HOST = process.env.HOST || '0.0.0.0';app.listen(PORT, HOST, () => { console.log(`╔═══════════════════════════════════════════════════════════╗║ ║║ 🗜️ Archive Extractor Server ║║ ║║ Server running at: http://${HOST}:${PORT} ║║ Press Ctrl+C to stop ║║ ║╚═══════════════════════════════════════════════════════════╝ `);});
// ============================================// Graceful Shutdown// ============================================
/** * Handles graceful shutdown on process signals. * Cleans up resources before exiting. */const gracefulShutdown = async (signal) => { console.log(`\n${signal} received. Shutting down gracefully...`); // Could add cleanup logic here if needed // For example, finishing pending uploads or saving session states
process.exit(0);};
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));process.on('SIGINT', () => gracefulShutdown('SIGINT'));
export default app;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343/** * @fileoverview Security middleware for file upload validation and path sanitization. * Implements comprehensive security measures to prevent malicious uploads and path traversal attacks. * @module middleware/security */
import rateLimit from 'express-rate-limit';import fs from 'fs-extra';import path from 'path';
/** * Magic bytes signatures for supported archive formats. * These are the first bytes of valid archive files. * @constant {Object} */const MAGIC_BYTES = { // ZIP magic bytes: PK\x03\x04 (also PK\x05\x06 for empty ZIP, PK\x07\x08 for spanned) zip: [ [0x50, 0x4b, 0x03, 0x04], // Standard ZIP [0x50, 0x4b, 0x05, 0x06], // Empty ZIP [0x50, 0x4b, 0x07, 0x08], // Spanned ZIP ], // RAR magic bytes - support both RAR4 and RAR5 // RAR4: Rar!\x1a\x07\x00 // RAR5: Rar!\x1a\x07\x01\x00 // Common prefix: Rar!\x1a\x07 (6 bytes) rar: [ [0x52, 0x61, 0x72, 0x21, 0x1a, 0x07], // Common RAR signature (works for both RAR4 and RAR5) ],};
/** * Allowed file extensions for upload. * @constant {Set<string>} */const ALLOWED_EXTENSIONS = new Set(['.zip', '.rar']);
/** * Maximum filename length to prevent filesystem issues. * @constant {number} */const MAX_FILENAME_LENGTH = 255;
/** * Regex pattern for characters to remove from filenames. * Allows alphanumeric, dots, hyphens, underscores, and spaces. * @constant {RegExp} */const UNSAFE_FILENAME_CHARS = /[^a-zA-Z0-9.\-_\s]/g;
/** * Creates a rate limiter middleware for upload endpoint. * Limits requests based on IP address to prevent abuse. * * @returns {Function} Express rate limit middleware */export const createUploadRateLimiter = () => { const windowMs = parseInt(process.env.RATE_LIMIT_WINDOW) || 3600000; // 1 hour const max = parseInt(process.env.RATE_LIMIT_MAX) || 10;
return rateLimit({ windowMs, max, message: { error: true, message: 'Too many upload requests. Please try again later.', code: 'RATE_LIMIT_EXCEEDED', }, standardHeaders: true, legacyHeaders: false, // Use IP address for rate limiting keyGenerator: (req) => req.ip, });};
/** * Validates file extension against allowed list. * * @param {string} filename - The filename to validate * @returns {boolean} True if extension is allowed */export const isValidExtension = (filename) => { const ext = path.extname(filename).toLowerCase(); return ALLOWED_EXTENSIONS.has(ext);};
/** * Validates file magic bytes to ensure file content matches extension. * SECURITY: This prevents malicious files disguised with wrong extensions. * * @async * @param {string} filePath - Path to the file to validate * @param {string} expectedType - Expected file type ('zip' or 'rar') * @returns {Promise<boolean>} True if magic bytes match expected type */export const validateMagicBytes = async (filePath, expectedType) => { try { const expectedSignatures = MAGIC_BYTES[expectedType]; if (!expectedSignatures || expectedSignatures.length === 0) { return false; }
// Find the maximum signature length we need to read const maxLength = Math.max(...expectedSignatures.map(sig => sig.length));
// Read the first bytes of the file const fileBuffer = await fs.readFile(filePath); const buffer = fileBuffer.slice(0, maxLength);
// Debug logging console.log(`Validating ${expectedType} file, first ${maxLength} bytes:`, Array.from(buffer).map(b => '0x' + b.toString(16).padStart(2, '0')).join(', ') );
// Check against each possible signature for (const expectedBytes of expectedSignatures) { let matches = true; for (let i = 0; i < expectedBytes.length; i++) { if (buffer[i] !== expectedBytes[i]) { matches = false; break; } } if (matches) { console.log(`Magic bytes match for ${expectedType}`); return true; } }
console.log(`No magic bytes match found for ${expectedType}`); return false; } catch (error) { console.error('Magic bytes validation error:', error.message); return false; }};
/** * Sanitizes a filename by removing dangerous characters and limiting length. * SECURITY: Prevents directory traversal and filesystem exploits through filenames. * * @param {string} filename - The filename to sanitize * @returns {string} Sanitized filename */export const sanitizeFilename = (filename) => { if (!filename || typeof filename !== 'string') { return 'unnamed_file'; }
// Remove path components let sanitized = path.basename(filename);
// Remove unsafe characters sanitized = sanitized.replace(UNSAFE_FILENAME_CHARS, '_');
// Remove leading/trailing dots and spaces sanitized = sanitized.replace(/^[\s.]+|[\s.]+$/g, '');
// Limit length if (sanitized.length > MAX_FILENAME_LENGTH) { const ext = path.extname(sanitized); const name = path.basename(sanitized, ext); sanitized = name.substring(0, MAX_FILENAME_LENGTH - ext.length) + ext; }
// Fallback if empty after sanitization if (!sanitized) { return 'unnamed_file'; }
return sanitized;};
/** * Validates a path to prevent directory traversal attacks. * SECURITY: Rejects paths containing ".." or absolute path indicators. * * @param {string} requestedPath - The path to validate * @returns {{valid: boolean, error?: string}} Validation result */export const validatePath = (requestedPath) => { if (!requestedPath || typeof requestedPath !== 'string') { return { valid: false, error: 'Path is required' }; }
// SECURITY: Check for path traversal attempts if (requestedPath.includes('..')) { return { valid: false, error: 'Path traversal detected' }; }
// SECURITY: Reject absolute paths if (path.isAbsolute(requestedPath)) { return { valid: false, error: 'Absolute paths not allowed' }; }
// SECURITY: Check for null bytes (can be used to bypass some checks) if (requestedPath.includes('\0')) { return { valid: false, error: 'Invalid path characters' }; }
return { valid: true };};
/** * Validates a session ID format. * SECURITY: Only allows valid UUID v4 format to prevent injection. * * @param {string} sessionId - The session ID to validate * @returns {boolean} True if session ID is valid UUID v4 */export const isValidSessionId = (sessionId) => { if (!sessionId || typeof sessionId !== 'string') { return false; }
// UUID v4 pattern const uuidV4Pattern = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; return uuidV4Pattern.test(sessionId);};
/** * Middleware to validate session ID parameter. * * @param {Object} req - Express request object * @param {Object} res - Express response object * @param {Function} next - Express next function */export const validateSessionIdMiddleware = (req, res, next) => { const { sessionId } = req.params;
if (!isValidSessionId(sessionId)) { return res.status(400).json({ error: true, message: 'Invalid session ID format', code: 'INVALID_SESSION_ID', }); }
next();};
/** * Middleware to validate file path query parameter. * * @param {Object} req - Express request object * @param {Object} res - Express response object * @param {Function} next - Express next function */export const validatePathMiddleware = (req, res, next) => { const filePath = req.query.path;
if (!filePath) { return res.status(400).json({ error: true, message: 'File path is required', code: 'MISSING_PATH', }); }
const validation = validatePath(filePath); if (!validation.valid) { return res.status(400).json({ error: true, message: validation.error, code: 'INVALID_PATH', }); }
next();};
/** * Middleware to validate uploaded files. * Checks file existence, extension, and magic bytes. * Supports both single and multiple file uploads. * * @param {Object} req - Express request object * @param {Object} res - Express response object * @param {Function} next - Express next function */export const validateUploadedFile = async (req, res, next) => { try { // Support both single file (req.file) and multiple files (req.files) const files = req.files || (req.file ? [req.file] : []); if (files.length === 0) { return res.status(400).json({ error: true, message: 'No file uploaded', code: 'NO_FILE', }); }
// Validate each file for (const file of files) { const { originalname, path: filePath } = file;
// Validate extension if (!isValidExtension(originalname)) { // Clean up all uploaded files for (const f of files) { await fs.remove(f.path).catch(() => {}); } return res.status(400).json({ error: true, message: `Only .zip and .rar files are allowed. Invalid file: ${originalname}`, code: 'INVALID_FILE_TYPE', }); }
// Determine expected type from extension const ext = path.extname(originalname).toLowerCase().slice(1);
// Validate magic bytes const isValidMagic = await validateMagicBytes(filePath, ext); if (!isValidMagic) { // Clean up all uploaded files for (const f of files) { await fs.remove(f.path).catch(() => {}); } return res.status(400).json({ error: true, message: `File content does not match file extension: ${originalname}`, code: 'INVALID_MAGIC_BYTES', }); } }
next(); } catch (error) { console.error('File validation error:', error); // Clean up on error const files = req.files || (req.file ? [req.file] : []); for (const file of files) { await fs.remove(file.path).catch(() => {}); } return res.status(500).json({ error: true, message: 'File validation failed', code: 'VALIDATION_ERROR', }); }};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201/** * @fileoverview API routes for archive operations. * Configures multer for file uploads and applies security middleware. * @module routes/api */
import { Router } from 'express';import multer from 'multer';import path from 'path';import { fileURLToPath } from 'url';import { v4 as uuidv4 } from 'uuid';import { createUploadRateLimiter, validateSessionIdMiddleware, validatePathMiddleware, validateUploadedFile,} from '../middleware/security.js';import { uploadArchive, getFileTree, downloadFile, downloadFolder, deleteSession,} from '../controllers/archiveController.js';
const __filename = fileURLToPath(import.meta.url);const __dirname = path.dirname(__filename);
const router = Router();
/** * Maximum file size for uploads. * @constant {number} */const MAX_FILE_SIZE = parseInt(process.env.MAX_FILE_SIZE) || 104857600; // 100MB
/** * Configure multer storage. * Files are stored with unique names to prevent conflicts. */const storage = multer.diskStorage({ destination: (req, file, cb) => { const uploadsDir = path.resolve(__dirname, '../../uploads'); cb(null, uploadsDir); }, filename: (req, file, cb) => { // Generate unique filename to prevent conflicts const uniqueId = uuidv4(); const ext = path.extname(file.originalname).toLowerCase(); cb(null, `${uniqueId}${ext}`); },});
/** * Multer file filter. * Only allows .zip and .rar files. */const fileFilter = (req, file, cb) => { const allowedExtensions = ['.zip', '.rar']; const ext = path.extname(file.originalname).toLowerCase();
if (allowedExtensions.includes(ext)) { cb(null, true); } else { cb(new Error('Only .zip and .rar files are allowed'), false); }};
/** * Multer upload configuration. */const upload = multer({ storage, fileFilter, limits: { fileSize: MAX_FILE_SIZE, files: 10, // Allow up to 10 files at a time },});
/** * Rate limiter for upload endpoint. */const uploadRateLimiter = createUploadRateLimiter();
/** * Error handler wrapper for async route handlers. * * @param {Function} fn - Async route handler * @returns {Function} Wrapped handler with error catching */const asyncHandler = (fn) => (req, res, next) => { Promise.resolve(fn(req, res, next)).catch(next);};
/** * Multer error handler middleware. * * @param {Error} err - Error object * @param {Object} req - Express request * @param {Object} res - Express response * @param {Function} next - Next middleware */const multerErrorHandler = (err, req, res, next) => { if (err instanceof multer.MulterError) { if (err.code === 'LIMIT_FILE_SIZE') { return res.status(400).json({ error: true, message: `File too large. Maximum size is ${MAX_FILE_SIZE / 1024 / 1024}MB`, code: 'FILE_TOO_LARGE', }); } if (err.code === 'LIMIT_FILE_COUNT') { return res.status(400).json({ error: true, message: 'Only one file can be uploaded at a time', code: 'TOO_MANY_FILES', }); } return res.status(400).json({ error: true, message: err.message, code: 'UPLOAD_ERROR', }); }
if (err.message === 'Only .zip and .rar files are allowed') { return res.status(400).json({ error: true, message: err.message, code: 'INVALID_FILE_TYPE', }); }
next(err);};
// ============================================// Routes// ============================================
/** * POST /api/upload * Upload and extract archive files (supports multiple files). * * Rate limited to 10 uploads per hour per IP. * Validates file extension and magic bytes. */router.post( '/upload', uploadRateLimiter, upload.array('file', 10), multerErrorHandler, asyncHandler(validateUploadedFile), asyncHandler(uploadArchive));
/** * GET /api/files/:sessionId * Get the file tree structure for an extracted archive. */router.get( '/files/:sessionId', validateSessionIdMiddleware, asyncHandler(getFileTree));
/** * GET /api/download/:sessionId/file * Download an individual file from the extracted archive. * Query param: path - relative path to the file */router.get( '/download/:sessionId/file', validateSessionIdMiddleware, validatePathMiddleware, asyncHandler(downloadFile));
/** * GET /api/download/:sessionId/folder * Download a folder as a ZIP archive. * Query param: path - relative path to the folder (optional, defaults to root) */router.get( '/download/:sessionId/folder', validateSessionIdMiddleware, asyncHandler(downloadFolder));
/** * DELETE /api/session/:sessionId * Manually delete a session and its files. */router.delete( '/session/:sessionId', validateSessionIdMiddleware, asyncHandler(deleteSession));
export default router;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352/** * @fileoverview Archive extraction service for ZIP and RAR files. * Handles recursive extraction with security measures including zip bomb protection. * @module services/extractionService */
import AdmZip from 'adm-zip';import { createExtractorFromFile } from 'node-unrar-js';import fs from 'fs-extra';import path from 'path';import { sanitizeFilename, validatePath } from '../middleware/security.js';
/** * Maximum size for individual extracted files (zip bomb protection). * @constant {number} */const MAX_EXTRACTED_FILE_SIZE = parseInt(process.env.MAX_EXTRACTED_FILE_SIZE) || 52428800; // 50MB
/** * Archive extensions that should be recursively extracted. * @constant {Set<string>} */const NESTED_ARCHIVE_EXTENSIONS = new Set(['.zip', '.rar']);
/** * Extracts an archive file to a destination directory. * Automatically detects archive type and handles nested archives. * * @async * @param {string} archivePath - Path to the archive file * @param {string} destPath - Destination directory for extraction * @param {Object} options - Extraction options * @param {string} [options.password] - Password for encrypted archives * @returns {Promise<{success: boolean, error?: string, code?: string}>} Extraction result */export const extractArchive = async (archivePath, destPath, options = {}) => { const ext = path.extname(archivePath).toLowerCase(); const { password } = options;
try { // Ensure destination directory exists with restricted permissions await fs.ensureDir(destPath, { mode: 0o755 });
if (ext === '.zip') { return await extractZip(archivePath, destPath, password); } else if (ext === '.rar') { return await extractRar(archivePath, destPath, password); } else { return { success: false, error: 'Unsupported archive format', code: 'UNSUPPORTED_FORMAT', }; } } catch (error) { console.error('Extraction error:', error); return { success: false, error: error.message || 'Extraction failed', code: 'EXTRACTION_FAILED', }; }};
/** * Extracts a ZIP archive. * Uses adm-zip library with security validations. * * @async * @param {string} zipPath - Path to the ZIP file * @param {string} destPath - Destination directory * @param {string} [password] - Password for encrypted archives * @returns {Promise<{success: boolean, error?: string, code?: string}>} */const extractZip = async (zipPath, destPath, password = null) => { try { const zip = new AdmZip(zipPath); // Check if archive is encrypted and we have a password const entries = zip.getEntries(); const hasEncryptedEntries = entries.some(entry => entry.header.encripted); if (hasEncryptedEntries && !password) { return { success: false, error: 'Archive is password protected. Please provide a password.', code: 'PASSWORD_PROTECTED', }; }
for (const entry of entries) { // Skip directories, they'll be created with files if (entry.isDirectory) { continue; }
// SECURITY: Validate and sanitize entry path const entryPath = entry.entryName; const pathValidation = validatePath(entryPath); if (!pathValidation.valid) { console.warn(`Skipping unsafe entry: ${entryPath}`); continue; }
// SECURITY: Check for zip bomb (decompression ratio attack) if (entry.header.size > MAX_EXTRACTED_FILE_SIZE) { console.warn(`Skipping oversized entry: ${entryPath} (${entry.header.size} bytes)`); continue; }
// Sanitize each path component const pathParts = entryPath.split('/').filter(Boolean); const sanitizedParts = pathParts.map((part, index) => { // Don't sanitize extension for the last part (filename) if (index === pathParts.length - 1) { return sanitizeFilename(part); } return sanitizeFilename(part); });
const sanitizedPath = sanitizedParts.join(path.sep); const fullDestPath = path.join(destPath, sanitizedPath);
// SECURITY: Ensure file stays within destination directory const normalizedDest = path.normalize(fullDestPath); if (!normalizedDest.startsWith(path.normalize(destPath))) { console.warn(`Path escape attempt blocked: ${entryPath}`); continue; }
// Create parent directory await fs.ensureDir(path.dirname(fullDestPath), { mode: 0o755 });
// Extract file (with password if provided) let content; try { content = password ? entry.getData(password) : entry.getData(); } catch (decryptError) { if (decryptError.message?.includes('password') || decryptError.message?.includes('decrypt')) { return { success: false, error: 'Incorrect password for archive', code: 'INCORRECT_PASSWORD', }; } throw decryptError; } // SECURITY: Final size check on actual extracted data if (content.length > MAX_EXTRACTED_FILE_SIZE) { console.warn(`Extracted content too large: ${entryPath}`); continue; }
await fs.writeFile(fullDestPath, content, { mode: 0o644 });
// Check if extracted file is a nested archive const ext = path.extname(fullDestPath).toLowerCase(); if (NESTED_ARCHIVE_EXTENSIONS.has(ext)) { const nestedDestPath = fullDestPath.replace(/\.(zip|rar)$/i, ''); const nestedResult = await extractArchive(fullDestPath, nestedDestPath); if (nestedResult.success) { // Remove the nested archive after extraction await fs.remove(fullDestPath); } } }
return { success: true }; } catch (error) { // Handle specific ZIP errors if (error.message?.includes('password')) { return { success: false, error: 'Archive is password protected', code: 'PASSWORD_PROTECTED', }; } if (error.message?.includes('Invalid') || error.message?.includes('corrupt')) { return { success: false, error: 'Archive appears to be corrupted', code: 'CORRUPTED_ARCHIVE', }; }
throw error; }};
/** * Extracts a RAR archive. * Uses node-unrar-js library with security validations. * * @async * @param {string} rarPath - Path to the RAR file * @param {string} destPath - Destination directory * @param {string} [password] - Password for encrypted archives * @returns {Promise<{success: boolean, error?: string, code?: string}>} */const extractRar = async (rarPath, destPath, password = null) => { try { const extractorOptions = { filepath: rarPath, targetPath: destPath, }; // Add password if provided if (password) { extractorOptions.password = password; } const extractor = await createExtractorFromFile(extractorOptions);
// Get list of files first to validate const list = extractor.getFileList(); const fileHeaders = [...list.fileHeaders];
// Check for password protection for (const header of fileHeaders) { if (header.flags?.encrypted) { if (!password) { return { success: false, error: 'Archive is password protected. Please provide a password.', code: 'PASSWORD_PROTECTED', }; } break; // Password provided, continue with extraction } }
// Extract files const extracted = extractor.extract(); const files = [...extracted.files];
// Process extracted files for (const file of files) { if (file.fileHeader.flags?.directory) { continue; }
const filePath = file.fileHeader.name; // SECURITY: Validate path const pathValidation = validatePath(filePath); if (!pathValidation.valid) { const fullPath = path.join(destPath, filePath); await fs.remove(fullPath).catch(() => {}); console.warn(`Removed unsafe entry: ${filePath}`); continue; }
// SECURITY: Check extracted file size const fullPath = path.join(destPath, filePath); try { const stats = await fs.stat(fullPath); if (stats.size > MAX_EXTRACTED_FILE_SIZE) { await fs.remove(fullPath); console.warn(`Removed oversized entry: ${filePath}`); continue; } } catch (e) { // File might not exist if extraction failed }
// Check for nested archives const ext = path.extname(fullPath).toLowerCase(); if (NESTED_ARCHIVE_EXTENSIONS.has(ext)) { const nestedDestPath = fullPath.replace(/\.(zip|rar)$/i, ''); const nestedResult = await extractArchive(fullPath, nestedDestPath); if (nestedResult.success) { await fs.remove(fullPath); } } }
return { success: true }; } catch (error) { // Handle specific RAR errors if (error.message?.includes('password') || error.message?.includes('encrypted')) { if (password) { return { success: false, error: 'Incorrect password for archive', code: 'INCORRECT_PASSWORD', }; } return { success: false, error: 'Archive is password protected. Please provide a password.', code: 'PASSWORD_PROTECTED', }; } if (error.message?.includes('Invalid') || error.message?.includes('corrupt') || error.message?.includes('Bad')) { return { success: false, error: 'Archive appears to be corrupted', code: 'CORRUPTED_ARCHIVE', }; }
throw error; }};
/** * Checks if a file is an archive that can be extracted. * * @param {string} filePath - Path to check * @returns {boolean} True if file is a supported archive */export const isArchive = (filePath) => { const ext = path.extname(filePath).toLowerCase(); return NESTED_ARCHIVE_EXTENSIONS.has(ext);};
/** * Gets extraction statistics for a session. * * @async * @param {string} sessionPath - Path to the extracted session * @returns {Promise<{totalFiles: number, totalSize: number}>} */export const getExtractionStats = async (sessionPath) => { let totalFiles = 0; let totalSize = 0;
const walk = async (dir) => { const entries = await fs.readdir(dir); for (const entry of entries) { const fullPath = path.join(dir, entry); const stats = await fs.stat(fullPath); if (stats.isDirectory()) { await walk(fullPath); } else { totalFiles++; totalSize += stats.size; } } };
await walk(sessionPath); return { totalFiles, totalSize };};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149/** * @fileoverview File tree generation utility. * Recursively builds a JSON representation of a directory structure. * @module utils/fileTree */
import fs from 'fs-extra';import path from 'path';
/** * Generates a file tree structure from a directory. * * @async * @param {string} dirPath - Absolute path to the directory * @param {string} [relativePath=''] - Relative path from root (used for recursion) * @returns {Promise<Object>} Tree structure object * * @example * // Returns: * // { * // name: "root", * // type: "folder", * // path: "/", * // children: [ * // { name: "file.txt", type: "file", size: 1024, path: "/file.txt", extension: ".txt" } * // ] * // } */export const generateFileTree = async (dirPath, relativePath = '') => { const stats = await fs.stat(dirPath); const name = path.basename(dirPath) || 'root'; const currentPath = relativePath || '/';
if (stats.isFile()) { return { name, type: 'file', size: stats.size, path: currentPath, extension: path.extname(name).toLowerCase(), }; }
// It's a directory const children = []; const entries = await fs.readdir(dirPath);
// Sort entries: folders first, then files, alphabetically const sortedEntries = entries.sort((a, b) => { return a.toLowerCase().localeCompare(b.toLowerCase()); });
for (const entry of sortedEntries) { const entryPath = path.join(dirPath, entry); const entryRelativePath = path.posix.join(currentPath, entry);
try { const entryStats = await fs.stat(entryPath); if (entryStats.isDirectory()) { // Recursively get directory contents const subtree = await generateFileTree(entryPath, entryRelativePath); children.push(subtree); } else if (entryStats.isFile()) { children.push({ name: entry, type: 'file', size: entryStats.size, path: entryRelativePath, extension: path.extname(entry).toLowerCase(), }); } } catch (error) { // Skip entries we can't read (permission issues, etc.) console.warn(`Could not read entry: ${entryPath}`, error.message); } }
// Sort children: folders first, then files children.sort((a, b) => { if (a.type === 'folder' && b.type !== 'folder') return -1; if (a.type !== 'folder' && b.type === 'folder') return 1; return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); });
return { name: relativePath ? name : 'root', type: 'folder', path: currentPath, children, };};
/** * Calculates total size of a directory recursively. * * @async * @param {string} dirPath - Path to the directory * @returns {Promise<number>} Total size in bytes */export const getDirectorySize = async (dirPath) => { let totalSize = 0;
const calculateSize = async (currentPath) => { const stats = await fs.stat(currentPath);
if (stats.isFile()) { totalSize += stats.size; } else if (stats.isDirectory()) { const entries = await fs.readdir(currentPath); for (const entry of entries) { await calculateSize(path.join(currentPath, entry)); } } };
await calculateSize(dirPath); return totalSize;};
/** * Counts files and folders in a directory. * * @async * @param {string} dirPath - Path to the directory * @returns {Promise<{files: number, folders: number}>} Count object */export const countItems = async (dirPath) => { let files = 0; let folders = 0;
const count = async (currentPath) => { const stats = await fs.stat(currentPath);
if (stats.isFile()) { files++; } else if (stats.isDirectory()) { folders++; const entries = await fs.readdir(currentPath); for (const entry of entries) { await count(path.join(currentPath, entry)); } } };
await count(dirPath); // Subtract 1 from folders to not count the root return { files, folders: Math.max(0, folders - 1) };};.env.exampleAdded+13
.gitignoreAdded+21
package-lock.jsonAdded+1489
package.jsonAdded+32
public/app.jsAdded+587
public/index.htmlAdded+141
public/styles.cssAdded+984
server/controllers/archiveController.jsAdded+487
server/index.jsAdded+149
server/middleware/security.jsAdded+343
server/routes/api.jsAdded+201
server/services/extractionService.jsAdded+352
server/utils/fileTree.jsAdded+149