diff --git a/.env.example b/.env.example index a138ef0..10a06ed 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,4 @@ -APP_ID=ABCD -SECRET=ABCD -TOKEN=ABCD APP_NAME="autopost bot" INSTANCE_MASTODON="https://mastodon.cipherbliss.com" - TOKEN_account_A=ABCD - TOKEN_account_B=ABCD diff --git a/.gitignore b/.gitignore index 375c8cd..183dcda 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ mastodon_multi_accounts.db assets/pictures/meme/not_published/* assets/pictures/meme/published/* #!/assets/documents/qzine_posts_all.json -assets/blog_posts_medias/* \ No newline at end of file +assets/blog_posts_medias/* +/bin/mentions.html diff --git a/app.js b/app.mjs similarity index 93% rename from app.js rename to app.mjs index e00d7f9..41d7fb8 100644 --- a/app.js +++ b/app.mjs @@ -44,6 +44,6 @@ module.exports = app; app.listen(listenPort, () => console.log(`Server is live at http://localhost:${listenPort}`)); console.log('================================================================='); -console.log('made by Tykayn from CipherBliss - https://mastodon.cipherbliss.com/@tykayn'); +console.log('= made by Tykayn from CipherBliss - https://mastodon.cipherbliss.com/@tykayn'); console.log('================================================================='); diff --git a/assets/bash_scripts/get_mentions_multi.sh b/assets/bash_scripts/get_mentions_multi.sh new file mode 100644 index 0000000..3aabce3 --- /dev/null +++ b/assets/bash_scripts/get_mentions_multi.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +node helpers/get_mentions.mjs > bin/mentions.ht diff --git a/cron_scripts/crontab b/cron_scripts/crontab index bb93766..c2d6298 100644 --- a/cron_scripts/crontab +++ b/cron_scripts/crontab @@ -10,5 +10,7 @@ 0 9 * * * bash /home/tykayn/www/multi-account-post-schedule-mastodon/assets/bash_scripts/osm_wiki.sh | tee -a /home/tykayn/log_autopost.txt 2>&1 # tous les Vendredis à midi, revue de lecture AFIS +0 5 * * 4 bash /home/tykayn/www/multi-account-post-schedule-mastodon/assets/bash_scripts/agendadulibre_coming_osm.sh | tee -a /home/tykayn/log_autopost.txt 2>&1 0 12 * * 5 bash /home/tykayn/www/multi-account-post-schedule-mastodon/assets/bash_scripts/afis_science.sh | tee -a /home/tykayn/log_autopost.txt 2>&1 +0 6 * * 6 bash /home/tykayn/www/multi-account-post-schedule-mastodon/assets/bash_scripts/idf_agendadulibre.sh | tee -a /home/tykayn/log_autopost.txt 2>&1 # ----------- END mastodon autopost ------------- \ No newline at end of file diff --git a/helpers/configs.js b/helpers/configs.js new file mode 100644 index 0000000..5f77943 --- /dev/null +++ b/helpers/configs.js @@ -0,0 +1,42 @@ +export const accounts_to_select = [ + { + 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: "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: "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: "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" + }, +] \ No newline at end of file diff --git a/helpers/get_mentions.mjs b/helpers/get_mentions.mjs new file mode 100644 index 0000000..5e10440 --- /dev/null +++ b/helpers/get_mentions.mjs @@ -0,0 +1,67 @@ +import {createMastoFetcherWithAuthorLogin} from "./utils.mjs"; +import moment from 'moment' + +moment.locale('fr') + +console.log('' + + '
' + + '' + + + '' + + '' + + '.avatar{ margin-right: 1em; margin-bottom: 1em; width: 4rem; height: 4rem;}'+ + '') +console.log('get mentions on all accounts managed') + + +export async function getMentionsOfAccount(accountToFetch) { + + const masto = createMastoFetcherWithAuthorLogin(accountToFetch) + let results = {} + + results = await masto.get('notifications??exclude_types[]=follow&exclude_types[]=follow_request&exclude_types[]=favourite&exclude_types[]=reblog&exclude_types[]=poll&exclude_types[]=status&exclude_types[]=update&exclude_types[]=admin.sign_up&exclude_types[]=admin.report') + +// console.log('results',results) + console.log('