Added untis
This commit is contained in:
@@ -15,4 +15,8 @@ services:
|
||||
- 'CALDAV_USER=USERNAME' # Username for the caldav server
|
||||
- 'CALDAV_PASSWORD=PASSWORD' # Password for the caldav server
|
||||
- 'CALDAV_CALENDAR=CALENDARNAME' # Calendar name from the caldav server
|
||||
- 'UNTIS_SCHOOLS=School1,School2' # Comma seperated list of schools (find in URL when logging in to untis, replace + with space)
|
||||
- 'UNTIS_USERNAMES=USERNAME1,USERNAME2' # Usernames for untis schools
|
||||
- 'UNTIS_PASSWORDS=PASSWORD1,PASSWORD2' # Passwords for untis schools
|
||||
- 'UNTIS_SERVERS=cissa.webuntis.com,neilo.webuntis.com' # Servers for untis chools
|
||||
```
|
||||
315
package-lock.json
generated
315
package-lock.json
generated
@@ -7,7 +7,66 @@
|
||||
"dependencies": {
|
||||
"ejs": "^3.1.9",
|
||||
"express": "^4.18.2",
|
||||
"moment": "^2.29.4"
|
||||
"moment": "^2.29.4",
|
||||
"webuntis": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.5.tgz",
|
||||
"integrity": "sha512-ecjvYlnAaZ/KVneE/OdKYBYfgXV3Ptu6zQWmgEF7vwKhQnvVS6bjMD2XYgj+SNvQ1GfK/pjgokfPkC/2CO8CuA==",
|
||||
"dependencies": {
|
||||
"regenerator-runtime": "^0.13.11"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@otplib/core": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@otplib/core/-/core-12.0.1.tgz",
|
||||
"integrity": "sha512-4sGntwbA/AC+SbPhbsziRiD+jNDdIzsZ3JUyfZwjtKyc/wufl1pnSIaG4Uqx8ymPagujub0o92kgBnB89cuAMA==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/@otplib/plugin-crypto": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@otplib/plugin-crypto/-/plugin-crypto-12.0.1.tgz",
|
||||
"integrity": "sha512-qPuhN3QrT7ZZLcLCyKOSNhuijUi9G5guMRVrxq63r9YNOxxQjPm59gVxLM+7xGnHnM6cimY57tuKsjK7y9LM1g==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@otplib/core": "^12.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@otplib/plugin-thirty-two": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@otplib/plugin-thirty-two/-/plugin-thirty-two-12.0.1.tgz",
|
||||
"integrity": "sha512-MtT+uqRso909UkbrrYpJ6XFjj9D+x2Py7KjTO9JDPhL0bJUYVu5kFP4TFZW4NFAywrAtFRxOVY261u0qwb93gA==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@otplib/core": "^12.0.1",
|
||||
"thirty-two": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@otplib/preset-default": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@otplib/preset-default/-/preset-default-12.0.1.tgz",
|
||||
"integrity": "sha512-xf1v9oOJRyXfluBhMdpOkr+bsE+Irt+0D5uHtvg6x1eosfmHCsCC6ej/m7FXiWqdo0+ZUI6xSKDhJwc8yfiOPQ==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@otplib/core": "^12.0.1",
|
||||
"@otplib/plugin-crypto": "^12.0.1",
|
||||
"@otplib/plugin-thirty-two": "^12.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@otplib/preset-v11": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@otplib/preset-v11/-/preset-v11-12.0.1.tgz",
|
||||
"integrity": "sha512-9hSetMI7ECqbFiKICrNa4w70deTUfArtwXykPUvSHWOdzOlfa9ajglu7mNCntlvxycTiOAXkQGwjQCzzDEMRMg==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@otplib/core": "^12.0.1",
|
||||
"@otplib/plugin-crypto": "^12.0.1",
|
||||
"@otplib/plugin-thirty-two": "^12.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
@@ -46,6 +105,20 @@
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "0.27.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
|
||||
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.14.9",
|
||||
"form-data": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
@@ -134,6 +207,17 @@
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"dependencies": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
@@ -171,6 +255,21 @@
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
|
||||
},
|
||||
"node_modules/date-fns": {
|
||||
"version": "2.30.0",
|
||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
|
||||
"integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.21.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.11"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/date-fns"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
@@ -179,6 +278,14 @@
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||
@@ -321,6 +428,38 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.2",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
@@ -555,6 +694,17 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/otplib": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/otplib/-/otplib-12.0.1.tgz",
|
||||
"integrity": "sha512-xDGvUOQjop7RDgxTQ+o4pOol0/3xSZzawTiPKRrHnQWAy0WjhNs/5HdIDJCrqC4MBynmjXgULc6YfioaxZeFgg==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@otplib/core": "^12.0.1",
|
||||
"@otplib/preset-default": "^12.0.1",
|
||||
"@otplib/preset-v11": "^12.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
@@ -616,6 +766,11 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/regenerator-runtime": {
|
||||
"version": "0.13.11",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
|
||||
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
@@ -719,6 +874,15 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/thirty-two": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/thirty-two/-/thirty-two-1.0.2.tgz",
|
||||
"integrity": "sha512-OEI0IWCe+Dw46019YLl6V10Us5bi574EvlJEOcAkB29IzQ/mYD1A6RyNHLjZPiHCmuodxvgF6U+vZO1L15lxVA==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=0.2.6"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
@@ -762,9 +926,76 @@
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/webuntis": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/webuntis/-/webuntis-2.0.3.tgz",
|
||||
"integrity": "sha512-ZBicV9RMySsn00n+CN+lDboUz/DVujKnFzaGjpZg99sA3NfsRHNIuShGxU5qq9oIl3rGd+K6gu0VA6Tkc745AQ==",
|
||||
"dependencies": {
|
||||
"axios": "^0.27.2",
|
||||
"date-fns": "^2.28.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"otplib": "^12"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": {
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.5.tgz",
|
||||
"integrity": "sha512-ecjvYlnAaZ/KVneE/OdKYBYfgXV3Ptu6zQWmgEF7vwKhQnvVS6bjMD2XYgj+SNvQ1GfK/pjgokfPkC/2CO8CuA==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.11"
|
||||
}
|
||||
},
|
||||
"@otplib/core": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@otplib/core/-/core-12.0.1.tgz",
|
||||
"integrity": "sha512-4sGntwbA/AC+SbPhbsziRiD+jNDdIzsZ3JUyfZwjtKyc/wufl1pnSIaG4Uqx8ymPagujub0o92kgBnB89cuAMA==",
|
||||
"optional": true
|
||||
},
|
||||
"@otplib/plugin-crypto": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@otplib/plugin-crypto/-/plugin-crypto-12.0.1.tgz",
|
||||
"integrity": "sha512-qPuhN3QrT7ZZLcLCyKOSNhuijUi9G5guMRVrxq63r9YNOxxQjPm59gVxLM+7xGnHnM6cimY57tuKsjK7y9LM1g==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"@otplib/core": "^12.0.1"
|
||||
}
|
||||
},
|
||||
"@otplib/plugin-thirty-two": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@otplib/plugin-thirty-two/-/plugin-thirty-two-12.0.1.tgz",
|
||||
"integrity": "sha512-MtT+uqRso909UkbrrYpJ6XFjj9D+x2Py7KjTO9JDPhL0bJUYVu5kFP4TFZW4NFAywrAtFRxOVY261u0qwb93gA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"@otplib/core": "^12.0.1",
|
||||
"thirty-two": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"@otplib/preset-default": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@otplib/preset-default/-/preset-default-12.0.1.tgz",
|
||||
"integrity": "sha512-xf1v9oOJRyXfluBhMdpOkr+bsE+Irt+0D5uHtvg6x1eosfmHCsCC6ej/m7FXiWqdo0+ZUI6xSKDhJwc8yfiOPQ==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"@otplib/core": "^12.0.1",
|
||||
"@otplib/plugin-crypto": "^12.0.1",
|
||||
"@otplib/plugin-thirty-two": "^12.0.1"
|
||||
}
|
||||
},
|
||||
"@otplib/preset-v11": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@otplib/preset-v11/-/preset-v11-12.0.1.tgz",
|
||||
"integrity": "sha512-9hSetMI7ECqbFiKICrNa4w70deTUfArtwXykPUvSHWOdzOlfa9ajglu7mNCntlvxycTiOAXkQGwjQCzzDEMRMg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"@otplib/core": "^12.0.1",
|
||||
"@otplib/plugin-crypto": "^12.0.1",
|
||||
"@otplib/plugin-thirty-two": "^12.0.1"
|
||||
}
|
||||
},
|
||||
"accepts": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||
@@ -792,6 +1023,20 @@
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.27.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
|
||||
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.14.9",
|
||||
"form-data": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
@@ -861,6 +1106,14 @@
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"requires": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
@@ -889,6 +1142,14 @@
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
|
||||
},
|
||||
"date-fns": {
|
||||
"version": "2.30.0",
|
||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
|
||||
"integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.21.0"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
@@ -897,6 +1158,11 @@
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
|
||||
},
|
||||
"depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||
@@ -1013,6 +1279,21 @@
|
||||
"unpipe": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.15.2",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
|
||||
},
|
||||
"form-data": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
@@ -1172,6 +1453,17 @@
|
||||
"ee-first": "1.1.1"
|
||||
}
|
||||
},
|
||||
"otplib": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/otplib/-/otplib-12.0.1.tgz",
|
||||
"integrity": "sha512-xDGvUOQjop7RDgxTQ+o4pOol0/3xSZzawTiPKRrHnQWAy0WjhNs/5HdIDJCrqC4MBynmjXgULc6YfioaxZeFgg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"@otplib/core": "^12.0.1",
|
||||
"@otplib/preset-default": "^12.0.1",
|
||||
"@otplib/preset-v11": "^12.0.1"
|
||||
}
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
@@ -1215,6 +1507,11 @@
|
||||
"unpipe": "1.0.0"
|
||||
}
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
"version": "0.13.11",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
|
||||
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
@@ -1291,6 +1588,12 @@
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"thirty-two": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/thirty-two/-/thirty-two-1.0.2.tgz",
|
||||
"integrity": "sha512-OEI0IWCe+Dw46019YLl6V10Us5bi574EvlJEOcAkB29IzQ/mYD1A6RyNHLjZPiHCmuodxvgF6U+vZO1L15lxVA==",
|
||||
"optional": true
|
||||
},
|
||||
"toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
@@ -1319,6 +1622,16 @@
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="
|
||||
},
|
||||
"webuntis": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/webuntis/-/webuntis-2.0.3.tgz",
|
||||
"integrity": "sha512-ZBicV9RMySsn00n+CN+lDboUz/DVujKnFzaGjpZg99sA3NfsRHNIuShGxU5qq9oIl3rGd+K6gu0VA6Tkc745AQ==",
|
||||
"requires": {
|
||||
"axios": "^0.27.2",
|
||||
"date-fns": "^2.28.0",
|
||||
"otplib": "^12"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"dependencies": {
|
||||
"ejs": "^3.1.9",
|
||||
"express": "^4.18.2",
|
||||
"moment": "^2.29.4"
|
||||
"moment": "^2.29.4",
|
||||
"webuntis": "^2.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ const path = require('path');
|
||||
const app = express();
|
||||
const { spawnSync } = require('child_process');
|
||||
const moment = require('moment');
|
||||
const { WebUntis } = require('webuntis');
|
||||
|
||||
// Befehl für die Skriptausführung
|
||||
const command = process.platform === 'win32' ? 'python' : 'python3';
|
||||
@@ -14,14 +15,6 @@ const static = path.join(__dirname, 'static');
|
||||
// Verwende EJS als Vorlagen-Engine
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
// Funktion zum Formatieren des Datums
|
||||
function formatDate(date) {
|
||||
const day = date.getDate().toString().padStart(2, '0');
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
const year = date.getFullYear();
|
||||
return `${day}.${month}.${year}`;
|
||||
}
|
||||
|
||||
// Funktion zum Erstellen der Liste der letzten 50 Wochen
|
||||
function getLast50Weeks() {
|
||||
let currentWeek = moment().startOf('isoWeek');
|
||||
@@ -37,14 +30,7 @@ function getLast50Weeks() {
|
||||
return last50Weeks;
|
||||
}
|
||||
|
||||
function convertToJsEscape(str) {
|
||||
return str.replace(/[\u00A0-\u9999]/g, function (match) {
|
||||
return '\\u' + ('0000' + match.charCodeAt(0).toString(16)).slice(-4);
|
||||
});
|
||||
}
|
||||
|
||||
function getCalendarEntries(week) {
|
||||
const weekDate = getLast50Weeks()[week];
|
||||
function getCalendarEntries(weekDate) {
|
||||
const [startDateStr, endDateStr] = weekDate.split(" - ");
|
||||
|
||||
// Argumente für das Kalender-Skript
|
||||
@@ -67,6 +53,66 @@ function getCalendarEntries(week) {
|
||||
return result;
|
||||
}
|
||||
|
||||
async function getUntis(weekDate) {
|
||||
const untisSchools = process.env.UNTIS_SCHOOLS.split(",");
|
||||
const untisUsernames = process.env.UNTIS_USERNAMES.split(",");
|
||||
const untisPasswords = process.env.UNTIS_PASSWORDS.split(",");
|
||||
const untisServers = process.env.UNTIS_SERVERS.split(",");
|
||||
|
||||
let teachingContent = "";
|
||||
|
||||
await Promise.all(untisSchools.map(async (school, index) => {
|
||||
if(untisUsernames[index].length > 0 && untisPasswords[index].length > 0 && untisServers[index].length > 0) {
|
||||
const client = new WebUntis(school, untisUsernames[index], untisPasswords[index], untisServers[index]);
|
||||
|
||||
// Anmelden
|
||||
await client.login();
|
||||
|
||||
const cookie = await client._buildCookies();
|
||||
const jwtToken = await client._getJWT();
|
||||
const authorization = `Bearer ${jwtToken}`;
|
||||
|
||||
const [startDateDay, startDateMonth, startDateYear] = weekDate.split(" - ")[0].split(".")
|
||||
let startDate = new Date(`${startDateYear}-${startDateMonth}-${startDateDay}T00:00:00.000Z`);
|
||||
|
||||
for (let i = 0; i < 7; i++) {
|
||||
const timetable = await client.getOwnClassTimetableFor(startDate).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
try {
|
||||
const lessonid = timetable[0].kl[0].id;
|
||||
|
||||
startDateStr = startDate.toISOString().split("T")[0];
|
||||
|
||||
await fetch(`https://${untisServers[index]}/WebUntis/api/rest/view/v1/calendar-entry/detail?elementId=${lessonid}&elementType=1&endDateTime=${startDateStr}T23%3A59%3A59&startDateTime=${startDateStr}T00%3A00%3A00`, {
|
||||
"headers": {
|
||||
"authorization": authorization,
|
||||
"cookie": cookie,
|
||||
},
|
||||
"method": "GET"
|
||||
}).then(res => res.json()).then(json => {
|
||||
for (entry of json.calendarEntries) {
|
||||
if (!teachingContent.includes(entry.teachingContent)) {
|
||||
if (teachingContent != "") teachingContent += '\n';
|
||||
teachingContent += "- "+entry.teachingContent;
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {}
|
||||
|
||||
startDate.setDate(startDate.getDate() + i);
|
||||
}
|
||||
|
||||
// Abmelden
|
||||
await client.logout();
|
||||
}
|
||||
}));
|
||||
|
||||
if(teachingContent == "") teachingContent = "Keine Unterrichtsinhalte gefunden";
|
||||
return teachingContent;
|
||||
}
|
||||
|
||||
app.use("/", express.static(static));
|
||||
|
||||
// Definiere eine Route für die Startseite
|
||||
@@ -75,8 +121,12 @@ app.get('/', (req, res) => {
|
||||
});
|
||||
|
||||
// Definiere eine Route für die Ausgabe der Daten
|
||||
app.get('/getreport', (req, res) => {
|
||||
res.send(getCalendarEntries(req.query.week));
|
||||
app.get('/getreport', async (req, res) => {
|
||||
const weekDate = getLast50Weeks()[req.query.week];
|
||||
res.send({
|
||||
calendar: getCalendarEntries(weekDate),
|
||||
untis: await getUntis(weekDate)
|
||||
});
|
||||
});
|
||||
|
||||
// Starte den Webserver
|
||||
|
||||
@@ -15,9 +15,14 @@
|
||||
<% }); %>
|
||||
</select>
|
||||
<button id="export-button" onclick="exportReport()">Export</button>
|
||||
<button id="copy-button" onclick="copyToClipboard()">Copy</button>
|
||||
</div>
|
||||
<textarea id="export-textarea"></textarea>
|
||||
<h4>Kalendereinträge</h4>
|
||||
<button id="calendar-copy-button" onclick="copyToClipboard(calendarcalendarCopyButton, calendarTextarea)">Copy</button>
|
||||
<textarea id="calendar-textarea"></textarea>
|
||||
|
||||
<h4>Untis Einträge</h4>
|
||||
<button id="untis-copy-button" onclick="copyToClipboard(untisCopyButton, untisTextarea)">Copy</button>
|
||||
<textarea id="untis-textarea"></textarea>
|
||||
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -1,31 +1,37 @@
|
||||
const exportTextarea = document.getElementById('export-textarea');
|
||||
const calendarTextarea = document.getElementById('calendar-textarea');
|
||||
const untisTextarea = document.getElementById('untis-textarea');
|
||||
|
||||
const calendarcalendarCopyButton = document.getElementById('calendar-copy-button');
|
||||
const untisCopyButton = document.getElementById('untis-copy-button');
|
||||
|
||||
const weekList = document.getElementById('week-list');
|
||||
const exportButton = document.getElementById('export-button');
|
||||
const copyButton = document.getElementById('copy-button');
|
||||
|
||||
let loadingInterval;
|
||||
|
||||
function copyToClipboard() {
|
||||
navigator.clipboard.writeText(exportTextarea.value).then(() => {
|
||||
copyButton.innerText = 'Copied!';
|
||||
function copyToClipboard(button, textarea) {
|
||||
navigator.clipboard.writeText(textarea.value).then(() => {
|
||||
button.innerText = 'Copied!';
|
||||
setTimeout(() => {
|
||||
copyButton.innerText = 'Copy';
|
||||
button.innerText = 'Copy';
|
||||
}, 2000);
|
||||
}).catch(() => {
|
||||
copyButton.innerText = 'Error!';
|
||||
button.innerText = 'Error!';
|
||||
setTimeout(() => {
|
||||
copyButton.innerText = 'Copy';
|
||||
button.innerText = 'Copy';
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
function loading() {
|
||||
exportButton.disabled = true;
|
||||
exportTextarea.value = 'Loading';
|
||||
calendarTextarea.value = 'Loading';
|
||||
untisTextarea.value = '';
|
||||
loadingInterval = setInterval(() => {
|
||||
if (exportTextarea.value != 'Loading...') {
|
||||
exportTextarea.value += '.';
|
||||
if (calendarTextarea.value != 'Loading...') {
|
||||
calendarTextarea.value += '.';
|
||||
} else {
|
||||
exportTextarea.value = 'Loading';
|
||||
calendarTextarea.value = 'Loading';
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
@@ -33,7 +39,7 @@ function loading() {
|
||||
function loaded() {
|
||||
exportButton.disabled = false;
|
||||
clearInterval(loadingInterval);
|
||||
exportTextarea.value = '';
|
||||
calendarTextarea.value = '';
|
||||
}
|
||||
|
||||
function exportReport() {
|
||||
@@ -46,17 +52,25 @@ function exportReport() {
|
||||
if (response.ok) {
|
||||
return response.text();
|
||||
} else {
|
||||
exportTextarea.value = 'Error while fetching report';
|
||||
calendarTextarea.value = 'Error while fetching report';
|
||||
throw new Error('Error while fetching report');
|
||||
}
|
||||
}).then(text => {
|
||||
loaded();
|
||||
exportTextarea.value = text;
|
||||
exportTextarea.style.height = "auto";
|
||||
exportTextarea.style.height = exportTextarea.scrollHeight + "px";
|
||||
|
||||
// parse json
|
||||
const json = JSON.parse(text);
|
||||
|
||||
calendarTextarea.value = json.calendar;
|
||||
calendarTextarea.style.height = "auto";
|
||||
calendarTextarea.style.height = calendarTextarea.scrollHeight + "px";
|
||||
|
||||
untisTextarea.value = json.untis;
|
||||
untisTextarea.style.height = "auto";
|
||||
untisTextarea.style.height = untisTextarea.scrollHeight + "px";
|
||||
}).catch(error => {
|
||||
loaded();
|
||||
exportTextarea.value = 'Error while fetching report';
|
||||
calendarTextarea.value = 'Error while fetching report';
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
@@ -12,6 +12,12 @@ h1 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
margin: 0;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.selector {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
@@ -44,7 +50,7 @@ button:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#export-textarea {
|
||||
textarea {
|
||||
font-size: 16px;
|
||||
width: 100%;
|
||||
resize: none;
|
||||
|
||||
Reference in New Issue
Block a user