mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 09:37:17 +00:00
Improve hos tweetable skins are fetched
This commit is contained in:
parent
0c7c82aca9
commit
374d3a967d
1 changed files with 10 additions and 2 deletions
|
|
@ -174,13 +174,21 @@ async function reject(md5) {
|
|||
}
|
||||
|
||||
async function getSkinToReview() {
|
||||
const skin = await skins.findOne(REVIEWABLE_QUERY);
|
||||
const reviewable = await skins.aggregate([
|
||||
{ $match: REVIEWABLE_QUERY },
|
||||
{ $sample: { size: 1 } }
|
||||
]);
|
||||
const skin = reviewable[0];
|
||||
const { canonicalFilename, md5 } = getSkinRecord(skin);
|
||||
return { filename: canonicalFilename, md5 };
|
||||
}
|
||||
|
||||
async function getSkinToTweet() {
|
||||
const skin = await skins.findOne(TWEETABLE_QUERY);
|
||||
const tweetables = await skins.aggregate([
|
||||
{ $match: TWEETABLE_QUERY },
|
||||
{ $sample: { size: 1 } }
|
||||
]);
|
||||
const skin = tweetables[0];
|
||||
if (skin == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue