Stremlined dependencies | built ad'Hoc http server

This commit is contained in:
2022-02-05 13:35:27 +01:00
parent fede4df965
commit 044004fd05
7 changed files with 123 additions and 277 deletions

View File

@@ -17,12 +17,7 @@
"author": "marcobaobao",
"license": "ISC",
"dependencies": {
"@koa/cors": "^3.1.0",
"better-sqlite3": "^7.4.5",
"chart.js": "^3.6.0",
"koa": "^2.13.4",
"koa-static": "^5.0.0",
"ordered-binary": "^1.2.1",
"react": "^17.0.2",
"react-bootstrap": "2.0.2",
"react-bootstrap-icons": "^1.7.2",
@@ -39,9 +34,6 @@
"parcel": "^2.0.1",
"typescript": "^4.5.2",
"@types/better-sqlite3": "^7.4.2",
"@types/koa": "^2.13.4",
"@types/koa-static": "^4.0.2",
"@types/koa__cors": "^3.1.1",
"@types/node": "^17.0.13",
"@types/uuid": "^8.3.4"
}

255
pnpm-lock.yaml generated
View File

@@ -1,7 +1,6 @@
lockfileVersion: 5.3
specifiers:
'@koa/cors': ^3.1.0
'@parcel/transformer-yaml': ^2.2.1
'@types/better-sqlite3': ^7.4.2
'@types/koa': ^2.13.4
@@ -10,10 +9,6 @@ specifiers:
'@types/node': ^17.0.13
'@types/uuid': ^8.3.4
better-sqlite3: ^7.4.5
chart.js: ^3.6.0
koa: ^2.13.4
koa-static: ^5.0.0
ordered-binary: ^1.2.1
parcel: ^2.0.1
react: ^17.0.2
react-bootstrap: 2.0.2
@@ -28,16 +23,11 @@ specifiers:
uuid: ^8.3.2
dependencies:
'@koa/cors': 3.1.0
better-sqlite3: 7.5.0
chart.js: 3.7.0
koa: 2.13.4
koa-static: 5.0.0
ordered-binary: 1.2.3
react: 17.0.2
react-bootstrap: 2.0.2_react-dom@17.0.2+react@17.0.2
react-bootstrap-icons: 1.7.2_react@17.0.2
react-chartjs-2: 4.0.1_chart.js@3.7.0+react@17.0.2
react-chartjs-2: 4.0.1_react@17.0.2
react-dom: 17.0.2_react@17.0.2
rxjs: 7.5.2
socket.io: 4.4.1
@@ -290,13 +280,6 @@ packages:
resolution: {integrity: sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==}
dev: true
/@koa/cors/3.1.0:
resolution: {integrity: sha512-7ulRC1da/rBa6kj6P4g2aJfnET3z8Uf3SWu60cjbtxTA5g8lxRdX/Bd2P92EagGwwAhANeNw8T8if99rJliR6Q==}
engines: {node: '>= 8.0.0'}
dependencies:
vary: 1.1.2
dev: false
/@nodelib/fs.scandir/2.1.5:
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@@ -1637,14 +1620,6 @@ packages:
engines: {node: '>= 0.8'}
dev: true
/cache-content-type/1.0.1:
resolution: {integrity: sha512-IKufZ1o4Ut42YUrZSo8+qnMTrFuKkvyoLXUywKz9GJ5BrhOFGhLdkx9sG4KAnVvbY6kEcSFjLQul+DVmBm2bgA==}
engines: {node: '>= 6.0.0'}
dependencies:
mime-types: 2.1.34
ylru: 1.2.1
dev: false
/call-bind/1.0.2:
resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==}
dependencies:
@@ -1687,10 +1662,6 @@ packages:
supports-color: 7.2.0
dev: true
/chart.js/3.7.0:
resolution: {integrity: sha512-31gVuqqKp3lDIFmzpKIrBeum4OpZsQjSIAqlOpgjosHDJZlULtvwLEZKtEhIAZc7JMPaHlYMys40Qy9Mf+1AAg==}
dev: false
/chownr/1.1.4:
resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==}
dev: false
@@ -1733,11 +1704,6 @@ packages:
engines: {node: '>=0.8'}
dev: true
/co/4.6.0:
resolution: {integrity: sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=}
engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
dev: false
/code-point-at/1.1.0:
resolution: {integrity: sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=}
engines: {node: '>=0.10.0'}
@@ -1816,18 +1782,6 @@ packages:
engines: {node: '>= 0.6'}
dev: true
/content-disposition/0.5.4:
resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==}
engines: {node: '>= 0.6'}
dependencies:
safe-buffer: 5.2.1
dev: false
/content-type/1.0.4:
resolution: {integrity: sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==}
engines: {node: '>= 0.6'}
dev: false
/convert-source-map/1.8.0:
resolution: {integrity: sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==}
dependencies:
@@ -1839,14 +1793,6 @@ packages:
engines: {node: '>= 0.6'}
dev: false
/cookies/0.8.0:
resolution: {integrity: sha512-8aPsApQfebXnuI+537McwYsDtjVxGm8gTIzQI3FDW6t5t/DAhERxtnbEPN/8RX+uZthoz4eCOgloXaE5cYyNow==}
engines: {node: '>= 0.8'}
dependencies:
depd: 2.0.0
keygrip: 1.1.0
dev: false
/core-js/3.20.3:
resolution: {integrity: sha512-vVl8j8ph6tRS3B8qir40H7yw7voy17xL0piAjlbBUsH7WIfzoedL/ZOr1OV9FyZQLWXsayOJyV4tnRyXR85/ag==}
requiresBuild: true
@@ -2044,12 +1990,6 @@ packages:
ms: 2.0.0
dev: true
/debug/3.2.7:
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
dependencies:
ms: 2.1.3
dev: false
/debug/4.3.3:
resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==}
engines: {node: '>=6.0'}
@@ -2068,10 +2008,6 @@ packages:
mimic-response: 3.1.0
dev: false
/deep-equal/1.0.1:
resolution: {integrity: sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=}
dev: false
/deep-extend/0.6.0:
resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==}
engines: {node: '>=4.0.0'}
@@ -2094,16 +2030,6 @@ packages:
resolution: {integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=}
dev: false
/depd/1.1.2:
resolution: {integrity: sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=}
engines: {node: '>= 0.6'}
dev: false
/depd/2.0.0:
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
engines: {node: '>= 0.8'}
dev: false
/dequal/2.0.2:
resolution: {integrity: sha512-q9K8BlJVxK7hQYqa6XISGmBZbtQQWVXSrRrWreHC94rMt1QL/Impruc+7p2CYSYuVIUr+YCt6hjrs1kkdJRTug==}
engines: {node: '>=6'}
@@ -2116,10 +2042,6 @@ packages:
minimalistic-assert: 1.0.1
dev: true
/destroy/1.0.4:
resolution: {integrity: sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=}
dev: false
/detect-libc/1.0.3:
resolution: {integrity: sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=}
engines: {node: '>=0.10'}
@@ -2183,6 +2105,7 @@ packages:
/ee-first/1.1.1:
resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=}
dev: true
/ejs/3.1.6:
resolution: {integrity: sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==}
@@ -2223,6 +2146,7 @@ packages:
/encodeurl/1.0.2:
resolution: {integrity: sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=}
engines: {node: '>= 0.8'}
dev: true
/end-of-stream/1.4.4:
resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==}
@@ -2336,6 +2260,7 @@ packages:
/escape-html/1.0.3:
resolution: {integrity: sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=}
dev: true
/escape-string-regexp/1.0.5:
resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=}
@@ -2456,11 +2381,6 @@ packages:
engines: {node: '>=0.4.x'}
dev: true
/fresh/0.5.2:
resolution: {integrity: sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=}
engines: {node: '>= 0.6'}
dev: false
/fs-constants/1.0.0:
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
dev: false
@@ -2577,12 +2497,14 @@ packages:
/has-symbols/1.0.2:
resolution: {integrity: sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==}
engines: {node: '>= 0.4'}
dev: true
/has-tostringtag/1.0.0:
resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==}
engines: {node: '>= 0.4'}
dependencies:
has-symbols: 1.0.2
dev: true
/has-unicode/2.0.1:
resolution: {integrity: sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=}
@@ -2667,35 +2589,6 @@ packages:
entities: 3.0.1
dev: true
/http-assert/1.5.0:
resolution: {integrity: sha512-uPpH7OKX4H25hBmU6G1jWNaqJGpTXxey+YOUizJUAgu0AjLUeC8D73hTrhvDS5D+GJN1DN1+hhc/eF/wpxtp0w==}
engines: {node: '>= 0.8'}
dependencies:
deep-equal: 1.0.1
http-errors: 1.8.1
dev: false
/http-errors/1.6.3:
resolution: {integrity: sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=}
engines: {node: '>= 0.6'}
dependencies:
depd: 1.1.2
inherits: 2.0.3
setprototypeof: 1.1.0
statuses: 1.5.0
dev: false
/http-errors/1.8.1:
resolution: {integrity: sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==}
engines: {node: '>= 0.6'}
dependencies:
depd: 1.1.2
inherits: 2.0.4
setprototypeof: 1.2.0
statuses: 1.5.0
toidentifier: 1.0.1
dev: false
/http-proxy-middleware/2.0.2:
resolution: {integrity: sha512-XtmDN5w+vdFTBZaYhdJAbMqn0DP/EhkUaAeo963mojwpKMMbw6nivtFKw07D7DDOH745L5k0VL0P8KRYNEVF/g==}
engines: {node: '>=12.0.0'}
@@ -2774,10 +2667,6 @@ packages:
wrappy: 1.0.2
dev: true
/inherits/2.0.3:
resolution: {integrity: sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=}
dev: false
/inherits/2.0.4:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
@@ -2866,6 +2755,7 @@ packages:
engines: {node: '>= 0.4'}
dependencies:
has-tostringtag: 1.0.0
dev: true
/is-glob/4.0.3:
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
@@ -3022,77 +2912,6 @@ packages:
minimist: 1.2.5
dev: true
/keygrip/1.1.0:
resolution: {integrity: sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==}
engines: {node: '>= 0.6'}
dependencies:
tsscmp: 1.0.6
dev: false
/koa-compose/4.1.0:
resolution: {integrity: sha512-8ODW8TrDuMYvXRwra/Kh7/rJo9BtOfPc6qO8eAfC80CnCvSjSl0bkRM24X6/XBBEyj0v1nRUQ1LyOy3dbqOWXw==}
dev: false
/koa-convert/2.0.0:
resolution: {integrity: sha512-asOvN6bFlSnxewce2e/DK3p4tltyfC4VM7ZwuTuepI7dEQVcvpyFuBcEARu1+Hxg8DIwytce2n7jrZtRlPrARA==}
engines: {node: '>= 10'}
dependencies:
co: 4.6.0
koa-compose: 4.1.0
dev: false
/koa-send/5.0.1:
resolution: {integrity: sha512-tmcyQ/wXXuxpDxyNXv5yNNkdAMdFRqwtegBXUaowiQzUKqJehttS0x2j0eOZDQAyloAth5w6wwBImnFzkUz3pQ==}
engines: {node: '>= 8'}
dependencies:
debug: 4.3.3
http-errors: 1.8.1
resolve-path: 1.4.0
transitivePeerDependencies:
- supports-color
dev: false
/koa-static/5.0.0:
resolution: {integrity: sha512-UqyYyH5YEXaJrf9S8E23GoJFQZXkBVJ9zYYMPGz919MSX1KuvAcycIuS0ci150HCoPf4XQVhQ84Qf8xRPWxFaQ==}
engines: {node: '>= 7.6.0'}
dependencies:
debug: 3.2.7
koa-send: 5.0.1
transitivePeerDependencies:
- supports-color
dev: false
/koa/2.13.4:
resolution: {integrity: sha512-43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g==}
engines: {node: ^4.8.4 || ^6.10.1 || ^7.10.1 || >= 8.1.4}
dependencies:
accepts: 1.3.7
cache-content-type: 1.0.1
content-disposition: 0.5.4
content-type: 1.0.4
cookies: 0.8.0
debug: 4.3.3
delegates: 1.0.0
depd: 2.0.0
destroy: 1.0.4
encodeurl: 1.0.2
escape-html: 1.0.3
fresh: 0.5.2
http-assert: 1.5.0
http-errors: 1.8.1
is-generator-function: 1.0.10
koa-compose: 4.1.0
koa-convert: 2.0.0
on-finished: 2.3.0
only: 0.0.2
parseurl: 1.3.3
statuses: 1.5.0
type-is: 1.6.18
vary: 1.1.2
transitivePeerDependencies:
- supports-color
dev: false
/lilconfig/2.0.4:
resolution: {integrity: sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==}
engines: {node: '>=10'}
@@ -3174,11 +2993,6 @@ packages:
resolution: {integrity: sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==}
dev: true
/media-typer/0.3.0:
resolution: {integrity: sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=}
engines: {node: '>= 0.6'}
dev: false
/merge2/1.4.1:
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
engines: {node: '>= 8'}
@@ -3269,10 +3083,6 @@ packages:
/ms/2.1.2:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
/ms/2.1.3:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
dev: false
/msgpackr-extract/1.0.16:
resolution: {integrity: sha512-fxdRfQUxPrL/TizyfYfMn09dK58e+d65bRD/fcaVH4052vj30QOzzqxcQIS7B0NsqlypEQ/6Du3QmP2DhWFfCA==}
requiresBuild: true
@@ -3407,6 +3217,7 @@ packages:
engines: {node: '>= 0.8'}
dependencies:
ee-first: 1.1.1
dev: true
/once/1.4.0:
resolution: {integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=}
@@ -3420,10 +3231,6 @@ packages:
mimic-fn: 2.1.0
dev: true
/only/0.0.2:
resolution: {integrity: sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q=}
dev: false
/open/7.4.2:
resolution: {integrity: sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==}
engines: {node: '>=8'}
@@ -3449,6 +3256,7 @@ packages:
/ordered-binary/1.2.3:
resolution: {integrity: sha512-fEwMk8TNUtzQDjXKYS2ANW3fNZ/gMReCPOAsLHaqw+UDnq/8ddXAcX4lGRpTK7kAghAjkmJs1EXXbcrDbg+ruw==}
dev: true
/os-browserify/0.3.0:
resolution: {integrity: sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=}
@@ -3531,6 +3339,7 @@ packages:
/parseurl/1.3.3:
resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
engines: {node: '>= 0.8'}
dev: true
/path-browserify/1.0.1:
resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
@@ -3539,6 +3348,7 @@ packages:
/path-is-absolute/1.0.1:
resolution: {integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=}
engines: {node: '>=0.10.0'}
dev: true
/path-is-inside/1.0.2:
resolution: {integrity: sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=}
@@ -4161,13 +3971,12 @@ packages:
warning: 4.0.3
dev: false
/react-chartjs-2/4.0.1_chart.js@3.7.0+react@17.0.2:
/react-chartjs-2/4.0.1_react@17.0.2:
resolution: {integrity: sha512-q8bgWzKoFvBvD7YcjT/hXG8jt55TaMAuJ1dmI3tKFJ7CijUWYz4pIfOhkTI6PBTwqu/pmeWsClBRd/7HiWzN1g==}
peerDependencies:
chart.js: ^3.5.0
react: ^16.8.0 || ^17.0.0
dependencies:
chart.js: 3.7.0
react: 17.0.2
dev: false
@@ -4248,14 +4057,6 @@ packages:
engines: {node: '>=4'}
dev: true
/resolve-path/1.4.0:
resolution: {integrity: sha1-xL2p9e+y/OZSR4c6s2u02DT+Fvc=}
engines: {node: '>= 0.8'}
dependencies:
http-errors: 1.6.3
path-is-absolute: 1.0.1
dev: false
/restore-cursor/3.1.0:
resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==}
engines: {node: '>=8'}
@@ -4351,14 +4152,6 @@ packages:
resolution: {integrity: sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=}
dev: true
/setprototypeof/1.1.0:
resolution: {integrity: sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==}
dev: false
/setprototypeof/1.2.0:
resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
dev: false
/sha.js/2.4.11:
resolution: {integrity: sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==}
hasBin: true
@@ -4516,6 +4309,7 @@ packages:
/statuses/1.5.0:
resolution: {integrity: sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=}
engines: {node: '>= 0.6'}
dev: true
/stream-browserify/3.0.0:
resolution: {integrity: sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==}
@@ -4716,20 +4510,10 @@ packages:
is-number: 7.0.0
dev: true
/toidentifier/1.0.1:
resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
engines: {node: '>=0.6'}
dev: false
/tslib/2.3.1:
resolution: {integrity: sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==}
dev: false
/tsscmp/1.0.6:
resolution: {integrity: sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==}
engines: {node: '>=0.6.x'}
dev: false
/tty-browserify/0.0.1:
resolution: {integrity: sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==}
dev: true
@@ -4750,14 +4534,6 @@ packages:
engines: {node: '>=10'}
dev: true
/type-is/1.6.18:
resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}
engines: {node: '>= 0.6'}
dependencies:
media-typer: 0.3.0
mime-types: 2.1.34
dev: false
/typescript/4.5.5:
resolution: {integrity: sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==}
engines: {node: '>=4.2.0'}
@@ -4953,8 +4729,3 @@ packages:
/yeast/0.1.2:
resolution: {integrity: sha1-AI4G2AlDIMNy28L47XagymyKxBk=}
dev: false
/ylru/1.2.1:
resolution: {integrity: sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ==}
engines: {node: '>= 4.0.0'}
dev: false

View File

@@ -0,0 +1,86 @@
import http from 'http';
import url from 'url';
import fs, { open, close } from 'fs';
import { parse, join } from 'path';
namespace server {
export const mimes = {
'.html': 'text/html',
'.ico': 'image/x-icon',
'.js': 'text/javascript',
'.json': 'application/json',
'.css': 'text/css',
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.webp': 'image/webp',
};
}
class Jean {
private workingDir: string;
/**
* Jean static file server its only purpose is serving SPA and images
* with the lowest impact possible.
* @param workingDir sets the root directory automatically trying index.html
* If specified the file in addition to the directory it will serve the
* file directly.
* *e.g* new Jean(path.join(__dirname, 'dist')) will try
* index.html from the dist directory;
* @author me :D
*/
constructor(workingDir: string) {
this.workingDir = workingDir;
}
/**
* Create a static file server
* @returns an instance of a standard NodeJS http.Server
*/
public createServer(): http.Server {
return http.createServer((req, res) => {
// parse the current given url
const parsedUrl = url.parse(req.url, false)
// extract the pathname and guard it with the working dir
let pathname = join(this.workingDir, `.${parsedUrl.pathname}`);
// extract the file extension
const ext = parse(pathname).ext;
// open the file or directory and fetch its descriptor
open(pathname, 'r', (err, fd) => {
// whoops, not found, send a 404
if (err) {
res.statusCode = 404;
res.end(`File ${pathname} not found!`);
return;
}
// something's gone wrong it's not a file or a directory
fs.fstat(fd, (err, stat) => {
if (err) {
res.statusCode = 500;
res.end(err);
}
// try file index.html
if (stat.isDirectory()) {
pathname = join(pathname, 'index.html')
}
// read the file
fs.readFile(pathname, (err, data) => {
if (err) {
res.statusCode = 500;
res.end(`Error reading the file: ${err}`);
} else {
// infer it's extension otherwise it's the index.html
res.setHeader('Content-type', server.mimes[ext] || 'text/html');
res.end(data);
close(fd);
}
});
})
});
})
}
}
export default Jean;

View File

@@ -2,6 +2,7 @@ import { spawn } from 'child_process';
import { join } from 'path';
import { Readable } from 'stream';
import { deleteDownloadByPID, insertDownload } from '../db/db';
import { ISettings } from '../interfaces/ISettings';
import Logger from '../utils/BetterLogger';
const log = new Logger();
@@ -9,15 +10,15 @@ const log = new Logger();
/**
* Represents a download process that spawns yt-dlp.
* @constructor
* @param {string} url - The downlaod url.
* @param {Array<String>} params - The cli arguments passed by the frontend.
* @param {*} settings - The download settings passed by the frontend.
* @param url - The downlaod url.
* @param params - The cli arguments passed by the frontend.
* @param settings - The download settings passed by the frontend.
*/
class Process {
private url: string;
private params: Array<string>;
private settings: any;
private settings: ISettings;
private stdout: Readable;
private pid: number;
private info: any;
@@ -35,11 +36,11 @@ class Process {
/**
* function that launch the download process, sets the stdout property and the pid
* @param {Function} callback not yet implemented
* @returns {Promise<this>} the process instance
* @param callback not yet implemented
* @returns the process instance
*/
async start(callback?: Function): Promise<this> {
await this.#__internalGetInfo();
await this.internalGetInfo();
const ytldp = spawn(this.exePath,
['-o', `${this.settings?.download_path || 'downloads/'}%(title)s.%(ext)s`]
@@ -69,8 +70,8 @@ class Process {
* function used internally by the download process to fetch information, usually thumbnail and title
* @returns Promise to the lock
*/
async #__internalGetInfo() {
let lock = true;
private async internalGetInfo() {
this.lock = true;
let stdoutChunks = [];
const ytdlpInfo = spawn(this.exePath, ['-s', '-j', this.url]);
@@ -93,7 +94,7 @@ class Process {
}
});
if (!lock) {
if (!this.lock) {
return true;
}
}

View File

@@ -3,14 +3,15 @@ import { from, interval } from 'rxjs';
import { throttle } from 'rxjs/operators';
import { pruneDownloads } from '../db/db';
import { killProcess } from '../utils/procUtils';
import { Socket } from 'socket.io';
import { IPayload } from '../interfaces/IPayload';
import { ISettings } from '../interfaces/ISettings';
import Logger from '../utils/BetterLogger';
import Process from './Process';
import ProcessPool from './ProcessPool';
import { Socket } from 'socket.io';
import { IPayload } from '../interfaces/IPayload';
// settings read from settings.json
let settings;
let settings: ISettings;
let coldRestart = true;
const log = new Logger();
@@ -20,7 +21,7 @@ try {
settings = require('../settings.json');
}
catch (e) {
console.warn("settings.json not found");
log.warn('dl', 'settings.json not found');
}
/**
@@ -95,7 +96,6 @@ export async function retriveDownload(socket: Socket) {
if (coldRestart) {
coldRestart = false;
let downloads = await pruneDownloads();
console.log(downloads)
// sanitize
downloads = [... new Set(downloads.filter(el => el !== undefined))];
log.info('dl', `Cold restart, retrieving ${downloads.length} jobs`)

View File

@@ -0,0 +1,3 @@
export interface ISettings {
download_path: string
}

View File

@@ -1,19 +1,15 @@
import Koa from 'koa';
import serve from 'koa-static';
import cors from '@koa/cors';
import { logger, splash } from './utils/logger';
import { join } from 'path';
import { Server } from 'socket.io';
import { createServer } from 'http';
import { ytdlpUpdater } from './utils/updater';
import { download, abortDownload, retriveDownload, abortAllDownloads } from './core/downloader';
import Logger from './utils/BetterLogger';
import { retrieveAll, init } from './db/db';
import { getFreeDiskSpace } from './utils/procUtils';
import Logger from './utils/BetterLogger';
import Jean from './core/HTTPServer';
const app = new Koa()
const log = new Logger()
const server = createServer(app.callback())
const server = new Jean(join(__dirname, 'frontend')).createServer();
const log = new Logger();
const io = new Server(server, {
cors: {
origin: "*",
@@ -55,12 +51,9 @@ io.on('disconnect', (socket) => {
logger('ws', `${socket.handshake.address} disconnected`)
})
app
.use(cors())
.use(serve(join(__dirname, 'frontend')))
splash()
log.info('koa', `Server started on port ${process.env.PORT || 3022}`)
log.info('http', `Server started on port ${process.env.PORT || 3022}`)
init()
.then(() => server.listen(process.env.PORT || 3022))