|
|
@ -10,7 +10,7 @@ const fetch = require('node-fetch') |
|
|
|
, timeDiffString = require(__dirname+'/../helpers/timediffstring.js'); |
|
|
|
, timeDiffString = require(__dirname+'/../helpers/timediffstring.js'); |
|
|
|
|
|
|
|
|
|
|
|
module.exports = async () => { |
|
|
|
module.exports = async () => { |
|
|
|
const label = `/webring.json`; |
|
|
|
const label = `updating webring`; |
|
|
|
const start = process.hrtime(); |
|
|
|
const start = process.hrtime(); |
|
|
|
|
|
|
|
|
|
|
|
//fetch stuff from others
|
|
|
|
//fetch stuff from others
|
|
|
@ -56,32 +56,35 @@ module.exports = async () => { |
|
|
|
await Webring.db.insertMany(webringBoards); |
|
|
|
await Webring.db.insertMany(webringBoards); |
|
|
|
|
|
|
|
|
|
|
|
//output our own webring json
|
|
|
|
//output our own webring json
|
|
|
|
const boards = await Boards.boardSort(0, 0); |
|
|
|
const needsUpdate = await cache.del('webring_update'); //returns 1 if somethign was deleted, 0 if not exist
|
|
|
|
const json = { |
|
|
|
if (needsUpdate) { |
|
|
|
name: meta.siteName, |
|
|
|
const boards = await Boards.boardSort(0, 0); |
|
|
|
url: meta.url, |
|
|
|
const json = { |
|
|
|
endpoint: `${meta.url}/webring.json`, |
|
|
|
name: meta.siteName, |
|
|
|
logos, |
|
|
|
url: meta.url, |
|
|
|
following, |
|
|
|
endpoint: `${meta.url}/webring.json`, |
|
|
|
blacklist, |
|
|
|
logos, |
|
|
|
known, |
|
|
|
following, |
|
|
|
boards: boards.map(b => { |
|
|
|
blacklist, |
|
|
|
//map local boards to webring format
|
|
|
|
known, |
|
|
|
return { |
|
|
|
boards: boards.map(b => { |
|
|
|
uri: b._id, |
|
|
|
//map local boards to webring format
|
|
|
|
title: b.settings.name, |
|
|
|
return { |
|
|
|
subtitle: b.settings.description, |
|
|
|
uri: b._id, |
|
|
|
path: `${meta.url}/${b._id}/`, |
|
|
|
title: b.settings.name, |
|
|
|
postsPerHour: b.pph, |
|
|
|
subtitle: b.settings.description, |
|
|
|
totalPosts: b.sequence_value-1, |
|
|
|
path: `${meta.url}/${b._id}/`, |
|
|
|
uniqueUsers: b.ips, |
|
|
|
postsPerHour: b.pph, |
|
|
|
nsfw: !b.settings.sfw, |
|
|
|
totalPosts: b.sequence_value-1, |
|
|
|
tags: b.settings.tags, |
|
|
|
uniqueUsers: b.ips, |
|
|
|
lastPostTimestamp: b.lastPostTimestamp, |
|
|
|
nsfw: !b.settings.sfw, |
|
|
|
}; |
|
|
|
tags: b.settings.tags, |
|
|
|
}), |
|
|
|
lastPostTimestamp: b.lastPostTimestamp, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
await outputFile(`${uploadDirectory}/json/webring.json`, JSON.stringify(json)); |
|
|
|
} |
|
|
|
} |
|
|
|
await outputFile(`${uploadDirectory}/json/webring.json`, JSON.stringify(json)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const end = process.hrtime(start); |
|
|
|
const end = process.hrtime(start); |
|
|
|
console.log(timeDiffString(label, end)); |
|
|
|
console.log(timeDiffString(label, end)); |
|
|
|