node
Este commit está contenido en:
23
development/node/docker-compose.yml
Archivo normal
23
development/node/docker-compose.yml
Archivo normal
@@ -0,0 +1,23 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
node:
|
||||
build: ./node
|
||||
restart: always
|
||||
hostname: node
|
||||
container_name: node
|
||||
entrypoint:
|
||||
- /bin/sleep
|
||||
- infinity
|
||||
volumes:
|
||||
- ./follow:/follow
|
||||
networks:
|
||||
mynet:
|
||||
ipv4_address: 172.131.0.101
|
||||
|
||||
networks:
|
||||
mynet:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.131.0.0/24
|
||||
54
development/node/follow/follow-federationbot.js
Archivo normal
54
development/node/follow/follow-federationbot.js
Archivo normal
@@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
const requestsync = require('sync-request')
|
||||
|
||||
/*let body = requestsync('GET', 'https://social.hatthieves.es/api/v1/instance/peers'),
|
||||
urls = JSON.parse(body.getBody())*/
|
||||
|
||||
//for (let url of urls) {
|
||||
let url = 'social.hatthieves.es',
|
||||
count = 100
|
||||
// try {
|
||||
let actors,
|
||||
followed = [],
|
||||
body
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : ''
|
||||
body = requestsync('GET', 'https://ale:pleroma.@' + url + '/api/v1/accounts/9kSZXaByPLAFWK949A/following?max_id=' + id + '&limit=' + count)
|
||||
try {
|
||||
actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.length > 0) {
|
||||
for (let a of actors) {
|
||||
if (a && a.id && !followed.some(f => f === a.id)) {
|
||||
followed.push(a.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log('Loading users: ' + followed.length)
|
||||
} while (actors && actors.length >= count && body.statusCode === 200)
|
||||
// actors = []
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : ''
|
||||
// body = requestsync('GET', 'https://' + url + '/api/statuses/networkpublic_timeline?max_id=' + id + '&only_media=false&count=20&with_muted=true')
|
||||
try {
|
||||
// actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.length > 0) {
|
||||
for (let a of actors) {
|
||||
if (a && a.user && a.user.id) {
|
||||
requestsync('POST', 'https://ale:pleroma.@social.hatthieves.es/api/v1/accounts/' + a.user.id + '/follow')
|
||||
console.log('following: ' + a.user.screen_name)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log(url + ' following: ' + followed.length)
|
||||
} while (actors && actors.length >= 20 && body.statusCode === 200)
|
||||
/* } catch (e) {
|
||||
console.log(e)
|
||||
}*/
|
||||
//}
|
||||
|
||||
1
development/node/follow/follow-pleroma
Submódulo
1
development/node/follow/follow-pleroma
Submódulo
Submodule development/node/follow/follow-pleroma added at 351fbf015c
57
development/node/follow/follow-pleroma.js
Archivo normal
57
development/node/follow/follow-pleroma.js
Archivo normal
@@ -0,0 +1,57 @@
|
||||
'use strict'
|
||||
const requestsync = require('sync-request'),
|
||||
user = process.argv[2] || 'user',
|
||||
pass = process.argv[3] || 'pass',
|
||||
site = process.argv[4] || 'https://social.hatthieves.es',
|
||||
url = site.split('://')[0] + '://' + user + ':' + pass + '@' + site.split('://')[1]
|
||||
|
||||
try {
|
||||
let actors,
|
||||
followed = [],
|
||||
count = 100,
|
||||
account = JSON.parse(requestsync('GET', url + '/api/v1/accounts/' + user).getBody()).id
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : '',
|
||||
body = requestsync('GET', url + '/api/v1/accounts/' + account + '/following?max_id=' + id + '&limit=' + count)
|
||||
try {
|
||||
actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.length > 0) {
|
||||
for (let a of actors) {
|
||||
if (a && a.id && !followed.some(f => f === a.id)) {
|
||||
followed.push(a.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log('Loading users: ' + followed.length)
|
||||
} while (actors && actors.length >= count)
|
||||
actors = []
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : '',
|
||||
body = requestsync('GET', url + '/api/statuses/networkpublic_timeline?max_id=' + id + '&only_media=false&count=20&with_muted=true')
|
||||
try {
|
||||
actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.length > 0) {
|
||||
for (let a of actors) {
|
||||
if (a && a.user && a.user.id && !followed.some(f => f === a.user.id)) {
|
||||
requestsync('POST', url + '/api/v1/accounts/' + a.user.id + '/follow')
|
||||
if (a.in_reply_to_user_id && !followed.some(f => f === a.in_reply_to_user_id)) {
|
||||
requestsync('POST', url + '/api/v1/accounts/' + a.in_reply_to_user_id + '/follow')
|
||||
followed.push(a.in_reply_to_user_id)
|
||||
console.log('Following: ' + a.in_reply_to_user_id)
|
||||
}
|
||||
followed.push(a.user.id)
|
||||
console.log('Following: ' + a.user.screen_name)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log('Following: ' + followed.length + ' accounts')
|
||||
} while (actors && actors.length >= 20)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
55
development/node/follow/follow-users.js
Archivo normal
55
development/node/follow/follow-users.js
Archivo normal
@@ -0,0 +1,55 @@
|
||||
'use strict'
|
||||
const requestsync = require('sync-request'),
|
||||
fs = require('fs')
|
||||
|
||||
/*let body = requestsync('GET', 'https://social.hatthieves.es/api/v1/instance/peers'),
|
||||
urls = JSON.parse(body.getBody())*/
|
||||
|
||||
//for (let url of urls) {
|
||||
let url = 'social.hatthieves.es',
|
||||
count = 100
|
||||
// try {
|
||||
let actors,
|
||||
followed = [],
|
||||
body
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : ''
|
||||
body = requestsync('GET', 'https://ale:pleroma.@' + url + '/api/v1/accounts/9lM7CeFGQNLWp38fgW/following?max_id=' + id + '&limit=' + count)
|
||||
try {
|
||||
actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.length > 0) {
|
||||
for (let a of actors) {
|
||||
if (a && a.id && !followed.some(f => f === a.id)) {
|
||||
followed.push(a.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log('Loading users: ' + followed.length)
|
||||
} while (actors && actors.length >= count && body.statusCode === 200)
|
||||
actors = []
|
||||
fs.readFileSync(__dirname + '/users.txt').toString('utf8').split('\n').map(u => {
|
||||
body = requestsync('GET', 'https://ale:pleroma.@' + url + '/api/v2/search?q=' + u + '&resolve=true')
|
||||
try {
|
||||
actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.accounts && actors.accounts.length > 0) {
|
||||
for (let a of actors.accounts) {
|
||||
if (a && a.id && !followed.some(f => f === a.id)) {
|
||||
requestsync('POST', 'https://ale:pleroma.@social.hatthieves.es/api/v1/accounts/' + a.id + '/follow')
|
||||
followed.push(a.id)
|
||||
console.log('following: ' + a.acct)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log(url + ' following: ' + followed.length)
|
||||
})
|
||||
/* } catch (e) {
|
||||
console.log(e)
|
||||
}*/
|
||||
//}
|
||||
|
||||
60
development/node/follow/follow.js
Archivo normal
60
development/node/follow/follow.js
Archivo normal
@@ -0,0 +1,60 @@
|
||||
'use strict'
|
||||
const requestsync = require('sync-request')
|
||||
|
||||
/*let body = requestsync('GET', 'https://social.hatthieves.es/api/v1/instance/peers'),
|
||||
urls = JSON.parse(body.getBody())*/
|
||||
|
||||
//for (let url of urls) {
|
||||
let url = 'social.hatthieves.es',
|
||||
count = 100
|
||||
// try {
|
||||
let actors,
|
||||
followed = [],
|
||||
body
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : ''
|
||||
body = requestsync('GET', 'https://ale:pleroma.@' + url + '/api/v1/accounts/9lM7CeFGQNLWp38fgW/following?max_id=' + id + '&limit=' + count)
|
||||
try {
|
||||
actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.length > 0) {
|
||||
for (let a of actors) {
|
||||
if (a && a.id && !followed.some(f => f === a.id)) {
|
||||
followed.push(a.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log('Loading users: ' + followed.length)
|
||||
} while (actors && actors.length >= count && body.statusCode === 200)
|
||||
actors = []
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : ''
|
||||
body = requestsync('GET', 'https://' + url + '/api/v1/timelines/public?max_id=' + id + '&only_media=false&count=20&with_muted=true')
|
||||
try {
|
||||
actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.length > 0) {
|
||||
for (let a of actors) {
|
||||
if (a && a.user && a.user.id && !followed.some(f => f === a.user.id)) {
|
||||
requestsync('POST', 'https://ale:pleroma.@social.hatthieves.es/api/v1/accounts/' + a.user.id + '/follow')
|
||||
if (a.in_reply_to_user_id && !followed.some(f => f === a.in_reply_to_user_id)) {
|
||||
requestsync('POST', 'https://ale:pleroma.@social.hatthieves.es/api/v1/accounts/' + a.in_reply_to_user_id + '/follow')
|
||||
followed.push(a.in_reply_to_user_id)
|
||||
console.log('following: ' + a.in_reply_to_user_id)
|
||||
}
|
||||
followed.push(a.user.id)
|
||||
console.log('following: ' + a.user.screen_name)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log(url + ' following: ' + followed.length)
|
||||
} while (actors && actors.length >= 20 && body.statusCode === 200)
|
||||
/* } catch (e) {
|
||||
console.log(e)
|
||||
}*/
|
||||
//}
|
||||
|
||||
7
development/node/follow/package.json
Archivo normal
7
development/node/follow/package.json
Archivo normal
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "follow",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"private": true
|
||||
}
|
||||
54
development/node/follow/refollow.js
Archivo normal
54
development/node/follow/refollow.js
Archivo normal
@@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
const requestsync = require('sync-request')
|
||||
|
||||
let body = requestsync('GET', 'https://social.hatthieves.es/api/v1/instance/peers'),
|
||||
urls = JSON.parse(body.getBody())
|
||||
|
||||
//for (let url of urls) {
|
||||
let url = 'social.hatthieves.es',
|
||||
count = 100
|
||||
try {
|
||||
let actors,
|
||||
followed = []
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : '',
|
||||
// body = requestsync('GET', 'https://ale:pleroma.@' + url + '/api/v1/accounts/9lM7CeFGQNLWp38fgW/following?max_id=' + id + '&limit=' + count)
|
||||
body = requestsync('GET', 'https://ale:pleroma.@' + url + '/api/v1/accounts/9lM7CeFGQNLWp38fgW/followers?max_id=' + id + '&limit=' + count)
|
||||
try {
|
||||
actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.length > 0) {
|
||||
for (let a of actors) {
|
||||
if (a && a.id) {
|
||||
followed.push(a)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log('Loading users: ' + followed.length)
|
||||
} while (actors && actors.length >= count)
|
||||
/* actors = []
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : '',
|
||||
body = requestsync('GET', 'https://' + url + '/api/statuses/networkpublic_timeline?max_id=' + id + '&only_media=false&count=20&with_muted=true')
|
||||
try {
|
||||
actors = JSON.parse(body.getBody())*/
|
||||
if (followed && followed.length > 0) {
|
||||
for (let a of followed) {
|
||||
if (a && a.id) {
|
||||
requestsync('POST', 'https://ale:pleroma.@social.hatthieves.es/api/v1/accounts/' + a.id + '/follow')
|
||||
console.log('Re-following: ' + a.display_name)
|
||||
}
|
||||
}
|
||||
}/*
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log(url + ' following: ' + followed.length)
|
||||
} while (actors && actors.length >= 20)*/
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
//}
|
||||
|
||||
40831
development/node/follow/users.txt
Archivo normal
40831
development/node/follow/users.txt
Archivo normal
La diferencia del archivo ha sido suprimido porque es demasiado grande
Cargar Diff
2
development/node/node/Dockerfile
Archivo normal
2
development/node/node/Dockerfile
Archivo normal
@@ -0,0 +1,2 @@
|
||||
FROM node:10-slim
|
||||
RUN apt update && apt -y upgrade && apt -y install git && apt clean
|
||||
Referencia en una nueva incidencia
Block a user