remove spaces
This commit is contained in:
parent
f3eb83d6b6
commit
89476fe75c
|
@ -76,7 +76,7 @@ async function apGet(url,ttl) {
|
|||
.catch(reject)
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
// like Promise.all except returns null on error instead of failing all the promises
|
||||
|
@ -84,7 +84,6 @@ async function promiseSome(proms){
|
|||
|
||||
function noRejectWrap(prom){
|
||||
return new Promise(function(resolve,reject){
|
||||
|
||||
prom // it's already been called
|
||||
.then(resolve)
|
||||
.catch(e=>{
|
||||
|
@ -96,7 +95,6 @@ async function promiseSome(proms){
|
|||
}
|
||||
|
||||
return await Promise.all(proms.map(noRejectWrap))
|
||||
|
||||
}
|
||||
|
||||
module.exports = async function (opts) {
|
||||
|
@ -118,20 +116,20 @@ module.exports = async function (opts) {
|
|||
[user, feed] = await Promise.all([ apGet(userUrl), apGet(feedUrl) ]);
|
||||
}else{
|
||||
// get user, then outbox, then feed
|
||||
|
||||
|
||||
user = await apGet(userUrl,24 * hour);
|
||||
isIndex = true;
|
||||
var outbox = await apGet(user.outbox, 1 * hour);
|
||||
|
||||
|
||||
// outbox.first can be a string for a URL, or an object with stuffs in it
|
||||
if (typeof outbox.first == 'object'){
|
||||
feed = outbox.first;
|
||||
} else {
|
||||
} else {
|
||||
feed = await apGet(outbox.first, hour/6);// 10 mins. Because the base feed URL can get new toots quickly.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
var templateData = {
|
||||
opts: opts,// from the request
|
||||
meta: metaForUser(user),
|
||||
|
@ -141,7 +139,6 @@ module.exports = async function (opts) {
|
|||
};
|
||||
|
||||
return template(templateData);
|
||||
|
||||
}
|
||||
|
||||
function metaForUser(user) {
|
||||
|
@ -155,9 +152,8 @@ function metaForUser(user) {
|
|||
}
|
||||
|
||||
async function itemsForFeed(opts,user,feed) {
|
||||
|
||||
var items = feed.orderedItems;
|
||||
|
||||
|
||||
if (opts.boosts){
|
||||
// yes, I have to fetch all the fucking boosts for this whole feed apparently >:/
|
||||
var boostData = [];
|
||||
|
@ -184,7 +180,7 @@ async function itemsForFeed(opts,user,feed) {
|
|||
if (!boostToot){// failed request
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// inject in-place into items
|
||||
|
||||
var index = -1;
|
||||
|
@ -250,7 +246,7 @@ function getNextPage(opts,user,feed){
|
|||
var base = opts.mastofeedUrl.slice(0,opts.mastofeedUrl.indexOf('?'));
|
||||
|
||||
var ret = '/apiv2/feed?userurl=' + encodeURIComponent(opts.userUrl) + '&feedurl=' +encodeURIComponent(feed.next);
|
||||
|
||||
|
||||
// add other params to the end
|
||||
(['theme','header','size','boosts','replies']).forEach((k)=>{
|
||||
if (typeof opts[k] != 'undefined'){
|
||||
|
|
Loading…
Reference in New Issue