plan recommend bot
This commit is contained in:
parent
1a3e7a5b0e
commit
36dd87ca0d
3
assets/bash_scripts/screenshot_org_roam_ui.sh
Normal file
3
assets/bash_scripts/screenshot_org_roam_ui.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
# org roam ui
|
||||
squint screenshot --selector '.force-graph-container' http://localhost:35901/ --out-file "./documents/screenshots/org_roam_ui.jpg" --single-page
|
@ -7,12 +7,6 @@ const __dirname = path.resolve();
|
||||
|
||||
// choisir un type de publication au hasard dans les dossiers "picture"
|
||||
|
||||
console.log(typeOfFolder)
|
||||
|
||||
const folderMemeUnpublished = 'assets/pictures/meme/not_published/'
|
||||
const folderMemePublished = 'assets/pictures/meme/published/'
|
||||
const list_unpublished_images = listFilesOfFolder(folderMemeUnpublished)
|
||||
|
||||
const reallySendPost = false;
|
||||
// const reallySendPost = true;
|
||||
|
||||
@ -20,8 +14,16 @@ let allFollows = {
|
||||
|
||||
}
|
||||
|
||||
function convertFollowersToArray(){
|
||||
|
||||
}
|
||||
function selectXRandomElementsFromFollowers(count){
|
||||
|
||||
let elementsSelected = []
|
||||
let followersList = convertFollowersToArray(allFollows)
|
||||
for (let ii=0; ii < count; ii++){
|
||||
elementsSelected.push(getRandomElementOfArray(followersList))
|
||||
}
|
||||
return []
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
|
||||
|
||||
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',
|
||||
@ -236,13 +236,6 @@ router.get('/publish-last-entry', function (req, res, next) {
|
||||
|
||||
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',
|
||||
// {grant_type: 'authorization_code', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob'},
|
||||
// function (err, accessToken, refreshToken, res) {
|
||||
//
|
||||
// console.log(err, accessToken, refreshToken , res);
|
||||
|
||||
const masto = new Masto({
|
||||
access_token: accessToken,
|
||||
api_url: env.parsed.INSTANCE_MASTODON + '/api/v1/',
|
||||
@ -305,6 +298,8 @@ router.get('/dispatch-publication-in-time', function (req, res, next) {
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
router.post('/direct-post', function (req, res, next) {
|
||||
|
||||
let env = require('dotenv').config({ path: __dirname + '/../.env' })
|
||||
@ -316,7 +311,10 @@ router.post('/direct-post', function (req, res, next) {
|
||||
let author = req.body.author.toUpperCase()
|
||||
console.log('vérif token pour', author)
|
||||
let access_token = env.parsed['TOKEN_' + author]
|
||||
|
||||
const masto = new Masto({
|
||||
access_token: access_token,
|
||||
api_url: env.parsed.INSTANCE_MASTODON + '/api/v1/',
|
||||
})
|
||||
console.log('token', access_token)
|
||||
if (access_token) {
|
||||
|
||||
@ -325,10 +323,7 @@ router.post('/direct-post', function (req, res, next) {
|
||||
let sensitive = false
|
||||
|
||||
console.log('accessToken', access_token)
|
||||
const masto = new Masto({
|
||||
access_token: access_token,
|
||||
api_url: env.parsed.INSTANCE_MASTODON + '/api/v1/',
|
||||
})
|
||||
|
||||
|
||||
let params = {
|
||||
status: req.body.message,
|
||||
@ -349,29 +344,30 @@ router.post('/direct-post', function (req, res, next) {
|
||||
|
||||
if (!req.body.fichier) {
|
||||
|
||||
masto.post('statuses', params).then(rep => {
|
||||
console.log('rep', rep)
|
||||
console.log('\n message bien envoyé')
|
||||
}, err => {
|
||||
console.error(err)
|
||||
})
|
||||
console.log(' pas de fichier dans le post')
|
||||
sendPostMastodon(params, masto)
|
||||
res.render('index', { bodyReq: req.body })
|
||||
}
|
||||
|
||||
// TODO prise en charge des fichiers joints
|
||||
// if (req.body.fichier) {
|
||||
//
|
||||
// masto.post('statuses', params).then(rep => {
|
||||
// console.log('rep', rep)
|
||||
// }, err => {
|
||||
// console.error(err)
|
||||
// })
|
||||
// res.render('index', {bodyReq: req.body})
|
||||
// }
|
||||
if (req.body.fichier) {
|
||||
console.log(' envoi avec fichier')
|
||||
sendPostMastodon(params, masto)
|
||||
res.render('index', {bodyReq: req.body})
|
||||
}
|
||||
|
||||
} else {
|
||||
console.error('pas de token pour ' + req.body.author)
|
||||
}
|
||||
})
|
||||
|
||||
function sendPostMastodon(config, masto){
|
||||
masto.post('statuses', config).then(rep => {
|
||||
console.log('rep', rep)
|
||||
console.log('\n message bien envoyé')
|
||||
}, err => {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = router
|
||||
|
Loading…
Reference in New Issue
Block a user