Merge remote-tracking branch 'origin/master' into gitClient
This commit is contained in:
commit
91ab93b533
|
@ -9,12 +9,16 @@
|
|||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@types/multer": "^1.4.7",
|
||||
"body-parser": "^1.20.2",
|
||||
"case-anything": "^2.1.10",
|
||||
"dotenv": "^16.0.3",
|
||||
"express": "^4.18.1",
|
||||
"image-size": "^1.0.2",
|
||||
"moment": "^2.29.4",
|
||||
"morgan": "^1.10.0",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-fetch": "^2.6.9",
|
||||
"pg": "^8.8.0",
|
||||
"pm2": "^5.2.2",
|
||||
"rimraf": "^3.0.2",
|
||||
|
@ -23,7 +27,9 @@
|
|||
"uuidv4": "^6.2.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/jest": "^29.5.0",
|
||||
"@types/multer": "^1.4.7",
|
||||
"@types/node": "^18.7.16",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"better-sqlite3": "^8.0.1",
|
||||
|
@ -1392,12 +1398,54 @@
|
|||
"@babel/types": "^7.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/body-parser": {
|
||||
"version": "1.19.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
|
||||
"integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/connect": "*",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/connect": {
|
||||
"version": "3.4.35",
|
||||
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
|
||||
"integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/cookiejar": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.2.tgz",
|
||||
"integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/express": {
|
||||
"version": "4.17.17",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
|
||||
"integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/body-parser": "*",
|
||||
"@types/express-serve-static-core": "^4.17.33",
|
||||
"@types/qs": "*",
|
||||
"@types/serve-static": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/express-serve-static-core": {
|
||||
"version": "4.17.33",
|
||||
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.33.tgz",
|
||||
"integrity": "sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/qs": "*",
|
||||
"@types/range-parser": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/graceful-fs": {
|
||||
"version": "4.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz",
|
||||
|
@ -1441,6 +1489,21 @@
|
|||
"pretty-format": "^29.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/mime": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz",
|
||||
"integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/multer": {
|
||||
"version": "1.4.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.7.tgz",
|
||||
"integrity": "sha512-/SNsDidUFCvqqcWDwxv2feww/yqhNeTRL5CVoL3jU4Goc4kKEL10T7Eye65ZqPNi4HRx8sAEX59pV1aEH7drNA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/express": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.14.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.6.tgz",
|
||||
|
@ -1453,6 +1516,28 @@
|
|||
"integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/qs": {
|
||||
"version": "6.9.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
|
||||
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/range-parser": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
|
||||
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/serve-static": {
|
||||
"version": "1.15.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz",
|
||||
"integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/mime": "*",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/stack-utils": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz",
|
||||
|
@ -2117,6 +2202,17 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"node_modules/case-anything": {
|
||||
"version": "2.1.10",
|
||||
"resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz",
|
||||
"integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ==",
|
||||
"engines": {
|
||||
"node": ">=12.13"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/mesqueeb"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
|
@ -3172,19 +3268,6 @@
|
|||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ftp": {
|
||||
"version": "0.3.10",
|
||||
"resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz",
|
||||
|
@ -3538,6 +3621,20 @@
|
|||
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/image-size": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/image-size/-/image-size-1.0.2.tgz",
|
||||
"integrity": "sha512-xfOoWjceHntRb3qFCrh5ZFORYH8XCdYpASltMhZ/Q0KZiOwjdE/Yl2QCiWdwD+lygV5bMCvauzgu5PxBX/Yerg==",
|
||||
"dependencies": {
|
||||
"queue": "6.0.2"
|
||||
},
|
||||
"bin": {
|
||||
"image-size": "bin/image-size.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/import-local": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz",
|
||||
|
@ -4705,6 +4802,14 @@
|
|||
"resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz",
|
||||
"integrity": "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A=="
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.29.4",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
||||
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/morgan": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
|
||||
|
@ -5899,6 +6004,14 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/queue": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz",
|
||||
"integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==",
|
||||
"dependencies": {
|
||||
"inherits": "~2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
|
@ -8593,12 +8706,54 @@
|
|||
"@babel/types": "^7.3.0"
|
||||
}
|
||||
},
|
||||
"@types/body-parser": {
|
||||
"version": "1.19.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
|
||||
"integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/connect": "*",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/connect": {
|
||||
"version": "3.4.35",
|
||||
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
|
||||
"integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/cookiejar": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.2.tgz",
|
||||
"integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/express": {
|
||||
"version": "4.17.17",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
|
||||
"integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/body-parser": "*",
|
||||
"@types/express-serve-static-core": "^4.17.33",
|
||||
"@types/qs": "*",
|
||||
"@types/serve-static": "*"
|
||||
}
|
||||
},
|
||||
"@types/express-serve-static-core": {
|
||||
"version": "4.17.33",
|
||||
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.33.tgz",
|
||||
"integrity": "sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*",
|
||||
"@types/qs": "*",
|
||||
"@types/range-parser": "*"
|
||||
}
|
||||
},
|
||||
"@types/graceful-fs": {
|
||||
"version": "4.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz",
|
||||
|
@ -8642,6 +8797,21 @@
|
|||
"pretty-format": "^29.0.0"
|
||||
}
|
||||
},
|
||||
"@types/mime": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz",
|
||||
"integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/multer": {
|
||||
"version": "1.4.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.7.tgz",
|
||||
"integrity": "sha512-/SNsDidUFCvqqcWDwxv2feww/yqhNeTRL5CVoL3jU4Goc4kKEL10T7Eye65ZqPNi4HRx8sAEX59pV1aEH7drNA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/express": "*"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "18.14.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.6.tgz",
|
||||
|
@ -8654,6 +8824,28 @@
|
|||
"integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/qs": {
|
||||
"version": "6.9.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
|
||||
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/range-parser": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
|
||||
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/serve-static": {
|
||||
"version": "1.15.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz",
|
||||
"integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/mime": "*",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/stack-utils": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz",
|
||||
|
@ -9159,6 +9351,11 @@
|
|||
"integrity": "sha512-PDd20WuOBPiasZ7KbFnmQRyuLE7cFXW2PVd7dmALzbkUXEP46upAuCDm9eY9vho8fgNMGmbAX92QBZHzcnWIqw==",
|
||||
"dev": true
|
||||
},
|
||||
"case-anything": {
|
||||
"version": "2.1.10",
|
||||
"resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.10.tgz",
|
||||
"integrity": "sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ=="
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
|
@ -9967,12 +10164,6 @@
|
|||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
|
||||
},
|
||||
"fsevents": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||
"optional": true
|
||||
},
|
||||
"ftp": {
|
||||
"version": "0.3.10",
|
||||
"resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz",
|
||||
|
@ -10222,6 +10413,14 @@
|
|||
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
|
||||
"dev": true
|
||||
},
|
||||
"image-size": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/image-size/-/image-size-1.0.2.tgz",
|
||||
"integrity": "sha512-xfOoWjceHntRb3qFCrh5ZFORYH8XCdYpASltMhZ/Q0KZiOwjdE/Yl2QCiWdwD+lygV5bMCvauzgu5PxBX/Yerg==",
|
||||
"requires": {
|
||||
"queue": "6.0.2"
|
||||
}
|
||||
},
|
||||
"import-local": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz",
|
||||
|
@ -11112,6 +11311,11 @@
|
|||
"resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz",
|
||||
"integrity": "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A=="
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.29.4",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
||||
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
|
||||
},
|
||||
"morgan": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
|
||||
|
@ -12020,6 +12224,14 @@
|
|||
"side-channel": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"queue": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz",
|
||||
"integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==",
|
||||
"requires": {
|
||||
"inherits": "~2.0.3"
|
||||
}
|
||||
},
|
||||
"range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
|
|
|
@ -16,12 +16,16 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@types/multer": "^1.4.7",
|
||||
"body-parser": "^1.20.2",
|
||||
"case-anything": "^2.1.10",
|
||||
"dotenv": "^16.0.3",
|
||||
"express": "^4.18.1",
|
||||
"moment": "^2.29.4",
|
||||
"image-size": "^1.0.2",
|
||||
"morgan": "^1.10.0",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-fetch": "^2.6.9",
|
||||
"pg": "^8.8.0",
|
||||
"pm2": "^5.2.2",
|
||||
"rimraf": "^3.0.2",
|
||||
|
@ -31,6 +35,8 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.0",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/multer": "^1.4.7",
|
||||
"@types/node": "^18.7.16",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"better-sqlite3": "^8.0.1",
|
||||
|
|
|
@ -26,6 +26,9 @@ window.addEventListener("load", () => {
|
|||
|
||||
form.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
if (!confirm("You are about to submit the form. Continue?")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Form validation
|
||||
const name = document.getElementById("name").value;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<label for="poster">Event Poster</label>
|
||||
<input type="file" id="poster" name="poster" accept="image/*" /> <br />
|
||||
|
||||
<input type="checkbox" id="online" name="online" value="online" />
|
||||
<input type="checkbox" id="online" name="online" />
|
||||
<label for="online">This event is online</label><br /><br />
|
||||
|
||||
<input type="submit" value="Submit" />
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
interface EventDetails {
|
||||
name: string;
|
||||
shortDescription: string;
|
||||
longDescription: string;
|
||||
startDate: Date;
|
||||
endDate?: Date;
|
||||
registerLink?: string;
|
||||
location?: string;
|
||||
online?: boolean;
|
||||
}
|
||||
|
||||
export { EventDetails };
|
|
@ -0,0 +1,61 @@
|
|||
import * as fs from "fs";
|
||||
import { trainCase } from "case-anything";
|
||||
import { EventDetails } from "./EventDetails";
|
||||
import moment from "moment";
|
||||
|
||||
const DATE_FORMAT = "MMMM DD yyyy HH:mm";
|
||||
|
||||
function createMarkdownFile(
|
||||
eventDetails: EventDetails,
|
||||
parentDirectory: string,
|
||||
posterLink?: string
|
||||
): boolean | string {
|
||||
const {
|
||||
name,
|
||||
longDescription,
|
||||
shortDescription,
|
||||
startDate,
|
||||
endDate,
|
||||
location,
|
||||
online,
|
||||
registerLink,
|
||||
} = eventDetails;
|
||||
|
||||
const formatDate = (date: Date) => moment(date).format(DATE_FORMAT);
|
||||
|
||||
const fileName = trainCase(eventDetails.name);
|
||||
const path = `${parentDirectory}/${fileName}.md`;
|
||||
const endDateCleaned = `${
|
||||
endDate ? `endDate: '${formatDate(endDate)}'\n` : ""
|
||||
}`;
|
||||
const locationCleaned = `${
|
||||
location && location.length ? `location: '${location}'\n` : ""
|
||||
}`;
|
||||
const posterLinkCleaned = `${posterLink ? `poster: '${posterLink}'\n` : ""}`;
|
||||
const registerLinkCleaned = `${
|
||||
registerLink ? `registerLink: '${registerLink}'\n` : ""
|
||||
}`;
|
||||
|
||||
const md =
|
||||
`---\nname: '${name}'\n` +
|
||||
`short: '${shortDescription}'\n` +
|
||||
`startDate: '${formatDate(startDate)}'\n` +
|
||||
`${endDateCleaned}` +
|
||||
`online: ${(online ?? false).toString()}\n` +
|
||||
`${locationCleaned}` +
|
||||
`${posterLinkCleaned}` +
|
||||
`${registerLinkCleaned}---\n\n` +
|
||||
`${longDescription}\n`;
|
||||
|
||||
// create file and write md to it
|
||||
fs.writeFile(path, md, function (err: unknown) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export { createMarkdownFile };
|
|
@ -1,8 +1,69 @@
|
|||
// Sample function only, actual functions needed may be different
|
||||
function makePullRequest() {
|
||||
console.log("TODO: Make pull request");
|
||||
// TODO: Remove this, for demo purposes only!
|
||||
console.log(`API KEY: ${process.env.GITEA_API_KEY}`);
|
||||
}
|
||||
import fetch from "node-fetch";
|
||||
import "dotenv/config";
|
||||
|
||||
export { makePullRequest };
|
||||
export const MAIN_BRANCH = "master";
|
||||
export const GITEA_API_URL = "https://git.csclub.uwaterloo.ca/api/v1/repos";
|
||||
|
||||
export const makePullRequest = async (
|
||||
owner: string,
|
||||
repoName: string,
|
||||
title: string,
|
||||
body: string,
|
||||
branchName: string,
|
||||
reviewers: Array<string>,
|
||||
assignee: string = ""
|
||||
) => {
|
||||
const PULL_URL = `${GITEA_API_URL}/${owner}/${repoName}/pulls`;
|
||||
|
||||
const response = await fetch(PULL_URL, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${process.env.GITEA_API_KEY}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
assignee: assignee,
|
||||
base: MAIN_BRANCH,
|
||||
title: title,
|
||||
body: body,
|
||||
head: branchName,
|
||||
}),
|
||||
});
|
||||
const content = await response.json();
|
||||
if (response.status != 201) {
|
||||
console.log(content);
|
||||
throw Error("Error from Gitea when making PR: " + content.errors);
|
||||
}
|
||||
|
||||
await addReviewers(reviewers, owner, repoName, content.number);
|
||||
|
||||
return content.url;
|
||||
};
|
||||
|
||||
async function addReviewers(
|
||||
reviewers: Array<string>,
|
||||
owner: string,
|
||||
repoName: string,
|
||||
prNumber: number
|
||||
) {
|
||||
const PULL_URL = `${GITEA_API_URL}/${owner}/${repoName}/pulls/${prNumber}/requested_reviewers`;
|
||||
const response = await fetch(PULL_URL, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${process.env.GITEA_API_KEY}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
reviewers: reviewers,
|
||||
}),
|
||||
});
|
||||
|
||||
const content = await response.json();
|
||||
if (response.status != 201) {
|
||||
console.log(content);
|
||||
throw Error("Error from Gitea when adding reviewers " + content.errors);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,28 +1,59 @@
|
|||
function validateForm(name : string, short : string, long : string, start : string, end : string,
|
||||
register : string, location : string, online : any) : boolean | string {
|
||||
// Assume good intention for now (internal use only)
|
||||
if (!name) {
|
||||
return "Event name is required.";
|
||||
}
|
||||
import { createEmitAndSemanticDiagnosticsBuilderProgram } from "typescript";
|
||||
import { EventDetails } from "./EventDetails";
|
||||
|
||||
if (!short) {
|
||||
return "Short description is required.";
|
||||
}
|
||||
function validateForm(
|
||||
name: string,
|
||||
shortDescription: string,
|
||||
longDescription: string,
|
||||
start: string,
|
||||
end: string,
|
||||
registerLink: string,
|
||||
location: string,
|
||||
online?: string,
|
||||
file?: Express.Multer.File
|
||||
): EventDetails | string {
|
||||
if (!name) {
|
||||
return "Event name is required.";
|
||||
}
|
||||
|
||||
if (!long) {
|
||||
return "Long description is required.";
|
||||
}
|
||||
if (!shortDescription) {
|
||||
return "Short description is required.";
|
||||
}
|
||||
|
||||
if (start && end) {
|
||||
const startTime = new Date(start);
|
||||
const endTime = new Date(end);
|
||||
|
||||
if (startTime > endTime) {
|
||||
return "End time must be greater than or equal to start time."
|
||||
}
|
||||
}
|
||||
if (!longDescription) {
|
||||
return "Long description is required.";
|
||||
}
|
||||
|
||||
return true;
|
||||
if (!file) {
|
||||
return "Poster is required.";
|
||||
}
|
||||
|
||||
if (start && end) {
|
||||
const startTime = new Date(start);
|
||||
const endTime = new Date(end);
|
||||
|
||||
const checkDateIsValid = (date: Date) =>
|
||||
date instanceof Date && !isNaN(date.valueOf());
|
||||
|
||||
if (
|
||||
!checkDateIsValid(startTime) ||
|
||||
!checkDateIsValid(endTime) ||
|
||||
startTime > endTime
|
||||
) {
|
||||
return "End time must be greater than or equal to start time.";
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
name: name,
|
||||
shortDescription: shortDescription,
|
||||
longDescription: longDescription,
|
||||
startDate: new Date(start),
|
||||
endDate: end ? new Date(end) : undefined,
|
||||
registerLink: registerLink,
|
||||
location: location,
|
||||
online: online === "on" ? true : false, // The form sends "on" if the checkbox is checked
|
||||
};
|
||||
}
|
||||
|
||||
export { validateForm };
|
||||
export { validateForm };
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import express from "express";
|
||||
import multer, { FileFilterCallback } from "multer";
|
||||
import sizeOf from "image-size";
|
||||
import * as fsp from "fs/promises";
|
||||
import * as path from "path";
|
||||
const app = express();
|
||||
const publicDirname = path.join(__dirname, "../public");
|
||||
const uploadDirname = path.join(__dirname, "../uploads");
|
||||
const MAX_FILE_SIZE_IN_BYTES = 15 * 1_000_000; // 15 mb
|
||||
const DEVELOPMENT_PORT = 8000;
|
||||
const IMAGE_SQUARE_VALIDATION_TOLERENCE = 0.2;
|
||||
|
||||
import allowedUsers from "./allowedUsers.json";
|
||||
|
||||
|
@ -13,6 +16,8 @@ import * as fs from "fs";
|
|||
import * as dotenv from "dotenv";
|
||||
import { makePullRequest } from "./giteaClient";
|
||||
import { validateForm } from "./handleForm";
|
||||
import { createMarkdownFile } from "./eventCreator";
|
||||
import { trainCase } from "case-anything";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
|
@ -41,7 +46,7 @@ const storage = multer.diskStorage({
|
|||
},
|
||||
});
|
||||
|
||||
const fileFilter = (
|
||||
const fileFilter = async (
|
||||
_,
|
||||
file: express.Multer.File,
|
||||
callback: FileFilterCallback
|
||||
|
@ -60,6 +65,16 @@ const fileFilter = (
|
|||
}
|
||||
};
|
||||
|
||||
const validateImageIsSquare = async (file: Express.Multer.File) => {
|
||||
const dimensions = sizeOf(file.path);
|
||||
const ratio = dimensions.height / dimensions.width;
|
||||
|
||||
return (
|
||||
ratio < 1 + IMAGE_SQUARE_VALIDATION_TOLERENCE &&
|
||||
ratio > 1 - IMAGE_SQUARE_VALIDATION_TOLERENCE
|
||||
);
|
||||
};
|
||||
|
||||
let upload = multer({
|
||||
storage: storage,
|
||||
fileFilter: fileFilter,
|
||||
|
@ -69,16 +84,14 @@ let upload = multer({
|
|||
// Routes
|
||||
app.get("/", async (req, res) => {
|
||||
res.sendFile(path.join(publicDirname, "index.html"));
|
||||
|
||||
// TODO: Remove this, only for demo purposes
|
||||
makePullRequest();
|
||||
// makePullRequest();
|
||||
});
|
||||
|
||||
app.post("/event", upload.single("poster"), (req, res) => {
|
||||
app.post("/event", upload.single("poster"), async (req, res) => {
|
||||
const { name, short, long, start, end, register, location, online } =
|
||||
req.body;
|
||||
|
||||
const validationStatus = validateForm(
|
||||
let processedEventOrError = validateForm(
|
||||
name,
|
||||
short,
|
||||
long,
|
||||
|
@ -86,17 +99,28 @@ app.post("/event", upload.single("poster"), (req, res) => {
|
|||
end,
|
||||
register,
|
||||
location,
|
||||
online
|
||||
online,
|
||||
req.file
|
||||
);
|
||||
|
||||
if (validationStatus === true) {
|
||||
res.send(
|
||||
"The event has been validated (change it to added after finished) successfully."
|
||||
);
|
||||
// Perform API request
|
||||
} else {
|
||||
res.status(400).send(validationStatus);
|
||||
if (!(await validateImageIsSquare(req.file))) {
|
||||
// Delete the file
|
||||
await fsp.unlink(req.file.path);
|
||||
return res
|
||||
.status(400)
|
||||
.send("The poster photo must be approximately square.");
|
||||
}
|
||||
|
||||
// Check error
|
||||
if (typeof processedEventOrError === "string") {
|
||||
res.status(400);
|
||||
res.send(processedEventOrError);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Move this to event creator (and change the image path to where the image will actually be in the repo)
|
||||
createMarkdownFile(processedEventOrError, uploadDirname, req.file?.path);
|
||||
res.send("The event has been added successfully.");
|
||||
});
|
||||
|
||||
function initUploadDir() {
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
import { cloneRepo, commitRepo, createAndPublishNewBranch, pushRepo, removeRepo } from "../gitClient";
|
||||
import {
|
||||
cloneRepo,
|
||||
commitRepo,
|
||||
createAndPublishNewBranch,
|
||||
pushRepo,
|
||||
removeRepo,
|
||||
} from "../gitClient";
|
||||
import { existsSync, readdirSync } from "fs";
|
||||
import { execSync } from "child_process";
|
||||
|
||||
|
@ -14,34 +20,36 @@ test("successfully clones repo", async () => {
|
|||
test("successfully commits to repo", async () => {
|
||||
const folderPath = await cloneRepo("https://github.com/octocat/Spoon-Knife");
|
||||
let thrownError = undefined;
|
||||
try{
|
||||
try {
|
||||
execSync(`cd ${folderPath} && touch newFile.ts`);
|
||||
await commitRepo(folderPath);
|
||||
const directoryContents = readdirSync(folderPath);
|
||||
expect(directoryContents).toContain("newFile.ts")
|
||||
} catch(error){
|
||||
expect(directoryContents).toContain("newFile.ts");
|
||||
} catch (error) {
|
||||
thrownError = error;
|
||||
}
|
||||
expect(thrownError).toBeUndefined();
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
test("successfully pushes to repo", async () => {
|
||||
const folderPath = await cloneRepo("https://github.com/tejas-srikanth/Watopoly"); // NOTE: user needs permission to push to repo in order for this to work
|
||||
test("successfully tries to pushes to repo", async () => {
|
||||
const folderPath = await cloneRepo("https://github.com/octocat/Spoon-Knife"); // NOTE: user needs permission to push to repo in order for this to work
|
||||
let thrownError = undefined;
|
||||
try{
|
||||
try {
|
||||
execSync(`cd ${folderPath} && touch newerFile.ts`);
|
||||
await createAndPublishNewBranch(folderPath);
|
||||
await commitRepo(folderPath);
|
||||
await pushRepo(folderPath);
|
||||
const directoryContents = readdirSync(folderPath);
|
||||
expect(directoryContents).toContain("newerFile.ts")
|
||||
} catch(error){
|
||||
expect(directoryContents).toContain("newerFile.ts");
|
||||
} catch (error) {
|
||||
thrownError = error;
|
||||
}
|
||||
expect(thrownError).toBeUndefined();
|
||||
|
||||
})
|
||||
// Should try to push to a repo (will get permission denied though)
|
||||
expect(thrownError).toContain(
|
||||
" Permission to octocat/Spoon-Knife.git denied to"
|
||||
);
|
||||
});
|
||||
|
||||
test("throws error if can't clone repo", async () => {
|
||||
let thrownError = undefined;
|
||||
|
|
Loading…
Reference in New Issue