2023-03-04 22:53:12 +01:00
|
|
|
import {createMastoFetcherWithAuthorLogin} from "./libs/utils.mjs";
|
2023-03-04 10:30:20 +01:00
|
|
|
import moment from 'moment'
|
|
|
|
|
|
|
|
moment.locale('fr')
|
|
|
|
|
|
|
|
console.log('<html>' +
|
|
|
|
'<head>' +
|
|
|
|
'<meta charset="utf-8"/>' +
|
|
|
|
|
|
|
|
'</head><body>' +
|
|
|
|
'<style>' +
|
|
|
|
'body{ width:80vw, padding: 2rem; margin: 0 auto; font-family: Arial, sans-serif; font-size: 1.5rem;}' +
|
|
|
|
'.block_account{ padding: 1.5rem;}' +
|
|
|
|
'.message{ padding: 1rem 2rem;}</style>' +
|
|
|
|
'.avatar{ margin-right: 1em; margin-bottom: 1em; width: 4rem; height: 4rem;}'+
|
|
|
|
'')
|
|
|
|
console.log('get mentions on all accounts managed')
|
|
|
|
|
|
|
|
|
|
|
|
export async function getMentionsOfAccount(accountToFetch) {
|
|
|
|
|
2023-03-04 22:53:12 +01:00
|
|
|
console.log('\n fetching account: ', accountToFetch)
|
2023-03-04 10:30:20 +01:00
|
|
|
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('<div class="block_account"> # mentions du compte ' + accountToFetch)
|
|
|
|
results.data.forEach(item => {
|
|
|
|
if(item.type !=='follow'){
|
|
|
|
|
|
|
|
// if(item.type =='mention'){
|
|
|
|
// console.log('item', item)
|
|
|
|
console.log('\n <div class="message">from <strong>', item.account.username, '</strong>')
|
|
|
|
// console.log('in reply to ', item.status.in_reply_to_id )
|
|
|
|
// console.log('language', item.status.language )
|
|
|
|
if (item.status) {
|
|
|
|
console.log(`
|
|
|
|
<a href="${item.status.uri}">lien</a>`)
|
|
|
|
console.log('\n : ',item.type,' :', moment(item.status.created_at).format('dddd YYYY-MM-DD HH:ii:ss'))
|
|
|
|
console.log('\n <blockquote>', item.status.content, '</blockquote>')
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
console.log('<pre>',item,'</pre>')
|
|
|
|
console.log('<img class="avatar" src="',item.account.avatar_static,'">')
|
|
|
|
}
|
|
|
|
console.log('</div>')
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
})
|
|
|
|
console.log('</div>\n <hr>')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const accounts = [
|
|
|
|
'qzine',
|
2023-03-04 22:53:12 +01:00
|
|
|
'tykayn',
|
|
|
|
'curator',
|
|
|
|
'kurator',
|
2023-03-04 10:30:20 +01:00
|
|
|
// 'modominem',
|
|
|
|
'voixdunucleaire',
|
|
|
|
// 'voicesofnuclear',
|
|
|
|
'afis91'
|
|
|
|
]
|
|
|
|
|
|
|
|
accounts.forEach(item => getMentionsOfAccount(item))
|
|
|
|
console.log('</body>')
|
|
|
|
console.log('</html>')
|