From 7ab74aa7b1e103729bca2f8b930279362c8917b5 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Thu, 7 Jul 2022 19:41:44 +0200 Subject: [PATCH] hop --- mastodon_multi_accounts.db | Bin 20480 -> 20480 bytes routes/index.js | 28 ++++++++++++++++++++++++++++ views/layout.jade | 1 + views/publish.jade | 8 ++++++++ 4 files changed, 37 insertions(+) create mode 100644 views/publish.jade diff --git a/mastodon_multi_accounts.db b/mastodon_multi_accounts.db index ed32c165f97cc94f242223a460d7b1e0e07442d3..a724412299402249e528dadd759f1ea48734533e 100644 GIT binary patch delta 59 zcmV-B0L1@*paFoO0gxL35|JE30TQubpFbA|4FCWD2M*l;59ANS50wvR4>=DD4&Ad6 R5XTMzEC-VfPc4%SPxRU05EuXe delta 57 zcmV-90LK4-paFoO0gxL35s@520THoapFb4_4FCWD1`i7W59ANS50wvR4>=DDvk?&Y P4gxF&liyA)lR8hvq^J*8 diff --git a/routes/index.js b/routes/index.js index c0c2a69..1118c6f 100644 --- a/routes/index.js +++ b/routes/index.js @@ -116,6 +116,34 @@ router.get('/add-example', function (req, res, next) { // publier le message en db dans la file router.get('/publish-last-entry', function (req, res, next) { res.render('index', {title: 'Express'}); + getAllPosts(db).then( + (results) => { + console.log( "publier le premier message de la file d'attente" ,results[0]) + res.render('publish', {posts_list: results[0]}); + }, + (err) => console.error(err), + ); + }); +// répartir les publications dans le temps +// TODO +const limit_posts_per_day=10 + +router.get('/dispatch-publication-in-time', function (req, res, next) { + res.render('index', {title: 'Express'}); + getAllPosts(db).then( + (results) => { + 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', {posts_list: results[0]}); + }, + (err) => console.error(err), + ); + +}); + + module.exports = router; diff --git a/views/layout.jade b/views/layout.jade index 5995b3e..375980d 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -11,5 +11,6 @@ html a(href="/init-db") init DB a(href="/list") list DB a(href="/add-example") ajout à la file example + a(href="/publish-last-entry") publier premier block content diff --git a/views/publish.jade b/views/publish.jade new file mode 100644 index 0000000..a02dde4 --- /dev/null +++ b/views/publish.jade @@ -0,0 +1,8 @@ +extends layout + +block content + h1 Publié + div.post-message + strong.author= p.post_username + div.content= p.content + img(src=p.medias) \ No newline at end of file