add schedule working

This commit is contained in:
Tykayn 2023-07-03 23:12:20 +02:00 committed by tykayn
parent 5f7836ed7c
commit b5b8696c91
7 changed files with 3270 additions and 4370 deletions

View File

@ -1,13 +1,13 @@
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
let createError = require('http-errors');
let express = require('express');
let path = require('path');
let cookieParser = require('cookie-parser');
let logger = require('morgan');
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
let indexRouter = require('./routes/index');
let usersRouter = require('./routes/users');
const listenPort = 8000;
var app = express();
let app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));

98
package-lock.json generated
View File

@ -19,7 +19,6 @@
"moment": "^2.29.4",
"morgan": "~1.9.1",
"node-fs": "^0.1.7",
"nodemon": "^2.0.19",
"oauth": "^0.9.15",
"rss-parser": "^3.12.0",
"sqlite3": "^5.0.8",
@ -31,6 +30,7 @@
"fs": "^0.0.1-security",
"https": "^1.0.0",
"node-fetch": "^3.2.10",
"nodemon": "^2.0.22",
"request-promise": "^4.2.6",
"sharp": "^0.31.2"
}
@ -422,6 +422,7 @@
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
"integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
"dev": true,
"license": "ISC",
"dependencies": {
"normalize-path": "^3.0.0",
@ -561,6 +562,7 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@ -645,6 +647,7 @@
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"license": "MIT",
"dependencies": {
"fill-range": "^7.0.1"
@ -835,6 +838,7 @@
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
"dev": true,
"funding": [
{
"type": "individual",
@ -1579,6 +1583,7 @@
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"to-regex-range": "^5.0.1"
@ -1781,6 +1786,7 @@
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"license": "ISC",
"dependencies": {
"is-glob": "^4.0.1"
@ -1828,6 +1834,7 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=4"
@ -2045,6 +2052,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
"dev": true,
"license": "ISC"
},
"node_modules/imurmurhash": {
@ -2122,6 +2130,7 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"license": "MIT",
"dependencies": {
"binary-extensions": "^2.0.0"
@ -2140,6 +2149,7 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
@ -2158,6 +2168,7 @@
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-extglob": "^2.1.1"
@ -2177,6 +2188,7 @@
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.12.0"
@ -2840,16 +2852,15 @@
}
},
"node_modules/nodemon": {
"version": "2.0.19",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz",
"integrity": "sha512-4pv1f2bMDj0Eeg/MhGqxrtveeQ5/G/UVe9iO6uTZzjnRluSA4PVWf8CW99LUPwGB3eNIA7zUFoP77YuI7hOc0A==",
"hasInstallScript": true,
"license": "MIT",
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz",
"integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==",
"dev": true,
"dependencies": {
"chokidar": "^3.5.2",
"debug": "^3.2.7",
"ignore-by-default": "^1.0.1",
"minimatch": "^3.0.4",
"minimatch": "^3.1.2",
"pstree.remy": "^1.1.8",
"semver": "^5.7.1",
"simple-update-notifier": "^1.0.7",
@ -2872,6 +2883,7 @@
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ms": "^2.1.1"
@ -2881,12 +2893,14 @@
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true,
"license": "MIT"
},
"node_modules/nodemon/node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true,
"license": "ISC",
"bin": {
"semver": "bin/semver"
@ -2911,6 +2925,7 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
@ -3175,6 +3190,7 @@
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8.6"
@ -3317,6 +3333,7 @@
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
"integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",
"dev": true,
"license": "MIT"
},
"node_modules/pump": {
@ -3495,6 +3512,7 @@
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dev": true,
"license": "MIT",
"dependencies": {
"picomatch": "^2.2.1"
@ -3839,6 +3857,7 @@
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.0.7.tgz",
"integrity": "sha512-BBKgR84BJQJm6WjWFMHgLVuo61FBDSj1z/xSFUIozqO6wO7ii0JxCqlIud7Enr/+LhlbNI0whErq96P2qHNWew==",
"dev": true,
"license": "MIT",
"dependencies": {
"semver": "~7.0.0"
@ -3851,6 +3870,7 @@
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
"integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
"dev": true,
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
@ -4141,6 +4161,7 @@
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^3.0.0"
@ -4217,6 +4238,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-number": "^7.0.0"
@ -4229,6 +4251,7 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
"integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
"dev": true,
"license": "ISC",
"dependencies": {
"nopt": "~1.0.10"
@ -4241,6 +4264,7 @@
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
"integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
"dev": true,
"license": "MIT",
"dependencies": {
"abbrev": "1"
@ -4399,6 +4423,7 @@
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
"integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
"dev": true,
"license": "MIT"
},
"node_modules/underscore": {
@ -4959,6 +4984,7 @@
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
"integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
"dev": true,
"requires": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
@ -5057,7 +5083,8 @@
"binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA=="
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true
},
"bl": {
"version": "4.1.0",
@ -5130,6 +5157,7 @@
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"requires": {
"fill-range": "^7.0.1"
}
@ -5260,6 +5288,7 @@
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
"dev": true,
"requires": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
@ -5786,6 +5815,7 @@
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"requires": {
"to-regex-range": "^5.0.1"
}
@ -5931,6 +5961,7 @@
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"requires": {
"is-glob": "^4.0.1"
}
@ -5963,7 +5994,8 @@
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true
},
"has-unicode": {
"version": "2.0.1",
@ -6112,7 +6144,8 @@
"ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA=="
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
"dev": true
},
"imurmurhash": {
"version": "0.1.4",
@ -6173,6 +6206,7 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"requires": {
"binary-extensions": "^2.0.0"
}
@ -6185,7 +6219,8 @@
"is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
@ -6196,6 +6231,7 @@
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"requires": {
"is-extglob": "^2.1.1"
}
@ -6209,7 +6245,8 @@
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"is-promise": {
"version": "2.2.2",
@ -6670,14 +6707,15 @@
}
},
"nodemon": {
"version": "2.0.19",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz",
"integrity": "sha512-4pv1f2bMDj0Eeg/MhGqxrtveeQ5/G/UVe9iO6uTZzjnRluSA4PVWf8CW99LUPwGB3eNIA7zUFoP77YuI7hOc0A==",
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz",
"integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==",
"dev": true,
"requires": {
"chokidar": "^3.5.2",
"debug": "^3.2.7",
"ignore-by-default": "^1.0.1",
"minimatch": "^3.0.4",
"minimatch": "^3.1.2",
"pstree.remy": "^1.1.8",
"semver": "^5.7.1",
"simple-update-notifier": "^1.0.7",
@ -6690,6 +6728,7 @@
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
@ -6697,12 +6736,14 @@
"ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
}
}
},
@ -6717,7 +6758,8 @@
"normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true
},
"npmlog": {
"version": "5.0.1",
@ -6899,7 +6941,8 @@
"picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true
},
"pkg-dir": {
"version": "4.2.0",
@ -7007,7 +7050,8 @@
"pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
"integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w=="
"integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",
"dev": true
},
"pump": {
"version": "3.0.0",
@ -7142,6 +7186,7 @@
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dev": true,
"requires": {
"picomatch": "^2.2.1"
}
@ -7374,6 +7419,7 @@
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.0.7.tgz",
"integrity": "sha512-BBKgR84BJQJm6WjWFMHgLVuo61FBDSj1z/xSFUIozqO6wO7ii0JxCqlIud7Enr/+LhlbNI0whErq96P2qHNWew==",
"dev": true,
"requires": {
"semver": "~7.0.0"
},
@ -7381,7 +7427,8 @@
"semver": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
"integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A=="
"integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
"dev": true
}
}
},
@ -7585,6 +7632,7 @@
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
@ -7651,6 +7699,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"requires": {
"is-number": "^7.0.0"
}
@ -7659,6 +7708,7 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
"integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
"dev": true,
"requires": {
"nopt": "~1.0.10"
},
@ -7667,6 +7717,7 @@
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
"integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
"dev": true,
"requires": {
"abbrev": "1"
}
@ -7786,7 +7837,8 @@
"undefsafe": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
"integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA=="
"integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
"dev": true
},
"underscore": {
"version": "1.7.0",

View File

@ -3,9 +3,9 @@
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"publish": "node ./publisher.js",
"scrap": "node scrapper.mjs"
"start": "nodemon ./bin/www",
"publish": "nodemon ./publisher.js",
"scrap": "nodemon scrapper.mjs"
},
"dependencies": {
"@databases/sqlite": "^4.0.0",
@ -19,7 +19,6 @@
"moment": "^2.29.4",
"morgan": "~1.9.1",
"node-fs": "^0.1.7",
"nodemon": "^2.0.19",
"oauth": "^0.9.15",
"rss-parser": "^3.12.0",
"sqlite3": "^5.0.8",
@ -31,6 +30,7 @@
"fs": "^0.0.1-security",
"https": "^1.0.0",
"node-fetch": "^3.2.10",
"nodemon": "^2.0.22",
"request-promise": "^4.2.6",
"sharp": "^0.31.2"
}

View File

@ -69,3 +69,22 @@ input{
box-shadow: 0 0 1em #2F6FAB;
border: solid 3px #2F6FAB;
}
.wip{
margin: 2em;
border: solid 2px #2F6FAB;
}
fieldset.wip{
margin-top: 12em;
}
.time_spans_choice{
padding: 0.5rem;
display: block;
width: 10rem;
float:left;
}
.time_spans_choice:hover{
cursor: pointer;
color: dodgerblue;
}

View File

@ -1,85 +1,95 @@
var express = require('express');
var router = express.Router();
var sqlite3 = require('sqlite3');
var Masto = require('mastodon');
var express = require('express')
var router = express.Router()
var sqlite3 = require('sqlite3')
var Masto = require('mastodon')
// import accounts_to_select from '../src/configs.mjs'
const accounts_to_select = [
{
label: "tykayn",
value: "tykayn",
src : "https://mastodon.cipherbliss.com/system/accounts/avatars/000/000/001/original/6388tykayn.gif"
label: 'tykayn',
value: 'tykayn',
src: 'https://mastodon.cipherbliss.com/system/accounts/avatars/000/000/001/original/6388tykayn.gif'
},
{
label: "modominem",
value: "modominem",
src : "https://mastodon.cipherbliss.com/system/accounts/avatars/000/152/770/original/c62bb94381dc1f75.png"
label: 'modominem',
value: 'modominem',
src: 'https://mastodon.cipherbliss.com/system/accounts/avatars/000/152/770/original/c62bb94381dc1f75.png'
},
{
label: "qzine",
value: "qzine",
src :"https://mastodon.cipherbliss.com/system/accounts/avatars/000/003/032/original/2bb8b90d21d3fdca.jpg"
label: 'qzine',
value: 'qzine',
src: 'https://mastodon.cipherbliss.com/system/accounts/avatars/000/003/032/original/2bb8b90d21d3fdca.jpg'
},
{
label: "curator",
value: "curator",
src : "https://mastodon.cipherbliss.com/system/accounts/avatars/000/002/974/original/8e48623291e49afe.jpg"
label: 'curator',
value: 'curator',
src: 'https://mastodon.cipherbliss.com/system/accounts/avatars/000/002/974/original/8e48623291e49afe.jpg'
},
{
label: "kurator",
value: "kurator",
src : "https://mastodon.cipherbliss.com/system/accounts/avatars/000/162/067/original/bb374d2c6a361b6d.jpg"
label: 'kurator',
value: 'kurator',
src: 'https://mastodon.cipherbliss.com/system/accounts/avatars/000/162/067/original/bb374d2c6a361b6d.jpg'
},
{
label: "voix du nucléaire",
value: "voixdunucleaire",
src : "https://mastodon.cipherbliss.com/system/accounts/avatars/000/107/055/original/7dac1a35f1423b94.jpg"
label: 'voix du nucléaire',
value: 'voixdunucleaire',
src: 'https://mastodon.cipherbliss.com/system/accounts/avatars/000/107/055/original/7dac1a35f1423b94.jpg'
},
{
label: "The greatest Meme",
value: "meme",
src : "https://mastodon.cipherbliss.com/system/accounts/avatars/000/002/978/original/b2f2e817572c93e9.png"
label: 'The greatest Meme',
value: 'meme',
src: 'https://mastodon.cipherbliss.com/system/accounts/avatars/000/002/978/original/b2f2e817572c93e9.png'
},
{
label: "cil de gometz",
value: "cil_gometz",
src : "https://mastodon.cipherbliss.com/system/accounts/avatars/000/107/055/original/7dac1a35f1423b94.jpg"
label: 'cil de gometz',
value: 'cil_gometz',
src: 'https://mastodon.cipherbliss.com/system/accounts/avatars/000/107/055/original/7dac1a35f1423b94.jpg'
},
]
// change this object to fit your multi accounts
const default_times = ['08:02:00', '08:42:00', '09:10:00', '09:15:00', '10:22:00', '12:22:00']
const database_masto = "mastodon_multi_accounts.db"
const time_spans_choices = ['08:02:00', '08:42:00', '09:10:00', '09:15:00', '10:22:00', '12:22:00', '13:02:00', '14:01:00', '14:34:00', '16:10:00', '17:15:00', '17:48:00']
const database_masto = 'mastodon_multi_accounts.db'
/* GET home page. */
let schedule_time = '';
let schedule_time = ''
let schedule_day = new Date()
schedule_day = schedule_day.toISOString()
router.get('/', function (req, res, next) {
if (!req.body.schedule_time) {
schedule_time = default_times[Math.floor(Math.random() * default_times.length)];
schedule_time = time_spans_choices[Math.floor(Math.random() * time_spans_choices.length)]
}
res.render('index', {accounts_to_select, reqBody: req.body, schedule_time});
});
let contentVars =
{
accounts_to_select,
reqBody: req.body,
schedule_time,
schedule_day,
time_spans_choices
}
res.render('index',
contentVars
)
})
// publier un message avec un certain compte
router.get('/publish', function (req, res, next) {
res.render('index', {title: 'Express'});
});
res.render('index', { title: 'Express' })
})
const connect = require('@databases/sqlite')
const { sql } = require('@databases/sqlite')
const { runOnChangeOnly } = require('nodemon/lib/config/defaults')
const fs = require('fs')
const connect = require('@databases/sqlite');
const {sql} = require('@databases/sqlite');
const {runOnChangeOnly} = require("nodemon/lib/config/defaults");
const fs = require("fs");
const db = connect(database_masto);
const db = connect(database_masto)
function createDatabase () {
var newdb = new sqlite3.Database(database_masto, sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE, (err) => {
createTables(newdb);
createTables(newdb)
})
}
@ -103,11 +113,11 @@ function createTables(newdb) {
insert into posts_scheduled
values (NULL, "modominem", "un message d'example", NULL);
`);
`)
console.log('requête de création faite')
}
const prepared = prepare();
const prepared = prepare()
}
// ajouter un message à la file d'attente avec un certain compte
@ -124,20 +134,18 @@ router.post('/add-to-queue', function (req, res, next) {
db.serialize(() => {
db.run('INSERT INTO posts_scheduled VALUES(?,?,?,?,?)', [null, req.body.author, req.body.message, req.body.fichier, null], function (err) {
if (err) {
return console.log(err.message);
res.render('index', {message: 'erreur ' + err.message});
return console.log(err.message)
res.render('index', { message: 'erreur ' + err.message })
}
console.log("nouveau post ajouté", req.body.author, req.body.message);
console.log('nouveau post ajouté', req.body.author, req.body.message)
res.render('index', {message: 'message ajouté OK'});
res.render('index', { message: 'message ajouté OK' })
});
});
});
})
})
})
function getAllPosts (db) {
return db.query(sql`SELECT *
@ -151,8 +159,8 @@ router.get('/init-db', function (req, res, next) {
createDatabase()
}
)
res.render('created_db', {});
});
res.render('created_db', {})
})
router.get('/list', function (req, res, next) {
@ -166,13 +174,12 @@ router.get('/list', function (req, res, next) {
getAllPosts(db).then(
(results) => {
console.log("liste de posts ", results)
res.render('database', {posts_list: results});
console.log('liste de posts ', results)
res.render('database', { posts_list: results })
},
(err) => console.error(err),
);
});
)
})
router.get('/add-example', function (req, res, next) {
// let db = connect(database_masto);
@ -190,41 +197,39 @@ router.get('/add-example', function (req, res, next) {
},
err => {
console.log(err)
});
})
}
const prepared = prepare();
const prepared = prepare()
}
);
require('dotenv').config();
)
// publier le message en db dans la file
router.get('/publish-last-entry', function (req, res, next) {
var OAuth2 = require('oauth').OAuth2;
var OAuth2 = require('oauth').OAuth2
// console.log('process.env' , process.env)
var oauth = new OAuth2(process.env.APP_ID, process.env.SECRET, process.env.INSTANCE_MASTODON, null, '/oauth/token');
// console.log('env' , env)
var oauth = new OAuth2(env.APP_ID, env.SECRET, env.INSTANCE_MASTODON, null, '/oauth/token')
var url = oauth.getAuthorizeUrl({
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
response_type: 'code',
scope: 'read write follow'
});
})
console.log('url ', url)
let status = "#mastoart of @tykayn"
let visibility = "unlisted" // public, unlisted, private, direct.
let media_filename = "colline.JPG"
let file_path = "assets/not_published/" + media_filename
let accessToken = process.env.TOKEN
let sensitive = false;
let scheduled_at = "2022-07-07T21:36:29.100Z";
let account_id = "2974"; // curator bliss
let language = "fr";
let status = '#mastoart of @tykayn'
let visibility = 'unlisted' // public, unlisted, private, direct.
let media_filename = 'colline.JPG'
let file_path = 'assets/not_published/' + media_filename
let accessToken = env.TOKEN
let sensitive = false
let scheduled_at = '2022-07-07T21:36:29.100Z'
let account_id = '2974' // curator bliss
let language = 'fr'
let enable_post = false;
let enable_post = false
// Get the user to open up the url in their browser and get the code
// oauth.getOAuthAccessToken('code from the authorization page that user should paste into your app',
@ -235,14 +240,13 @@ router.get('/publish-last-entry', function (req, res, next) {
const masto = new Masto({
access_token: accessToken,
api_url: process.env.INSTANCE_MASTODON + '/api/v1/',
});
api_url: env.parsed.INSTANCE_MASTODON + '/api/v1/',
})
if (enable_post) {
masto.post('media', { file: fs.createReadStream(file_path) }).then(resp => {
id = resp.data.id;
id = resp.data.id
// doc https://docs.joinmastodon.org/methods/statuses/
console.log('media id ', resp.data.id)
@ -272,43 +276,10 @@ router.get('/publish-last-entry', function (req, res, next) {
})
})
}
//
// if (!file) {
// return masto.post('statuses', {
// status,
// visibility,
// });
// }
// const response = await masto.post('media', {
// file: {
// value: file,
// options: {
// filename: 'assets/test.png',
// contentType: 'image/png',
// },
// },
// });
//
// return masto.post('statuses', {
// status,
// visibility,
// media_ids: [response.data.id],
// });
res.render('index', {})
// })
res.render('index', {});
//
// getAllPosts(db).then(
// (results) => {
// console.log( "publier le premier message de la file d'attente" ,results[0])
// res.render('publish', {p: results[0]});
// },
// (err) => console.error(err),
// );
});
})
// répartir les publications dans le temps
// TODO
@ -318,32 +289,41 @@ router.get('/dispatch-publication-in-time', function (req, res, next) {
getAllPosts(db).then(
(results) => {
console.log("répartir", results[0])
console.log('répartir', results[0])
// on compte les posts et quel intervalle de temps mettre entre chaque pour tenir le rythme de X posts par jour
res.render('index', {p: results[0]});
res.render('index', { p: results[0] })
},
(err) => console.error(err),
);
});
)
})
router.post('/direct-post', function (req, res, next) {
if (process.env['TOKEN_' + req.body.author]) {
let env = require('dotenv').config({ path: __dirname + '/../.env' })
console.log('dotenv', env)
let visibility = 'public';
let language = 'fr';
let sensitive = false;
// console.log('req', req)
console.log('req.body', req.body)
let accessToken = process.env['TOKEN_' + req.body.author]
console.log('accessToken', accessToken)
let author = req.body.author.toUpperCase()
console.log('vérif token pour', author)
let access_token = env.parsed['TOKEN_' + author]
console.log('token', access_token)
if (access_token) {
let visibility = 'public'
let language = 'fr'
let sensitive = false
console.log('accessToken', access_token)
const masto = new Masto({
access_token: accessToken,
api_url: process.env.INSTANCE_MASTODON + '/api/v1/',
});
access_token: access_token,
api_url: env.parsed.INSTANCE_MASTODON + '/api/v1/',
})
let params = {
status: req.body.message,
@ -357,6 +337,8 @@ router.post('/direct-post', function (req, res, next) {
if (req.body.scheduled_at && req.body.scheduled_at_bool) {
let dateschedule = new Date(req.body.scheduled_at)
params['scheduled_at'] = dateschedule.toISOString()
console.log('scheduled_at', params['scheduled_at'])
return
}
console.log(req.body)
@ -364,12 +346,14 @@ router.post('/direct-post', function (req, res, next) {
masto.post('statuses', params).then(rep => {
console.log('rep', rep)
console.log('\n message bien envoyé')
}, err => {
console.error(err)
})
res.render('index', { bodyReq: req.body })
}
// TODO prise en charge des fichiers joints
// if (req.body.fichier) {
//
// masto.post('statuses', params).then(rep => {
@ -385,4 +369,4 @@ router.post('/direct-post', function (req, res, next) {
}
})
module.exports = router;
module.exports = router

View File

@ -32,15 +32,26 @@ block content
span Quavez-vous en tête?
textarea.main-input.autosuggest-textarea__textarea(name="message", width="500", lines="20",autofocus="autofocus")
br
fieldset.wip
label
span Fichier à joindre (optionnel)
textarea.file-input.autosuggest-textarea__textarea(name="fichier", width="500", lines="1",value="default_picture.jpg")
fieldset.wip
label Schedule in time (work in progress, not working by now)
input.file-input.autosuggest-textarea__textarea(name="fichier", type="file")
h2 schedule
label Select day in the future
div.day_spans
each val, index in [1,2,3,4,5]
div.clickable(onclick=`selectDay('${val}')`)
span.time_spans_choice=val
label Select time span
div.time_spans
each val, index in time_spans_choices
div.clickable(onclick=`selectTime('${val}')`)
span.time_spans_choice=val
label Schedule in time (work in progress)
input.input.checkbox(type="checkbox", value=false, name="scheduled_at_bool")
input.input.checkbox(type="date", name="scheduled_at")
input.input.checkbox(type="text", name="scheduled_at_time",value=schedule_time)
//div(id=flatpickr)
input.input.checkbox(type="date", name="scheduled_at", value=schedule_day)
input.input.checkbox(type="text", id="scheduled_at_time", name="scheduled_at_time",value=schedule_time)
br
div.composer--publisher
//input.button.primary(type="submit", value="ajouter à la file d'attente")
@ -57,5 +68,14 @@ block content
},500)
console.log('account changed', somePseudo)
}
function selectTime(someTime){
let selector=document.querySelector('#scheduled_at_time');
selector.value = someTime
selector.classList.add("changed")
setTimeout(()=>{
selector.classList.remove("changed")
},500)
console.log('account changed', somePseudo)
}
console.log('script loaded')

6927
yarn.lock

File diff suppressed because it is too large Load Diff