Added support for redd.it PNG.
This commit is contained in:
parent
304566e5bd
commit
2d050be1a5
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"image/jpeg": ".jpg",
|
||||
"image/png": ".png",
|
||||
"image/gif": ".gif",
|
||||
"video/mp4": ".mp4",
|
||||
"video/webm": ".webm"
|
||||
}
|
|
@ -5,12 +5,7 @@ const path = require('path');
|
|||
const url = require('url');
|
||||
const dateFns = require('date-fns');
|
||||
|
||||
const extensions = {
|
||||
'image/jpeg': '.jpg',
|
||||
'image/gif': '.gif',
|
||||
'video/mp4': '.mp4',
|
||||
'video/webm': '.webm'
|
||||
};
|
||||
const extensions = require('./extensions.json');
|
||||
|
||||
function interpolate(pattern, user, post, item) {
|
||||
const dateFormat = config.library.dateFormat || 'YYYYMMDD';
|
||||
|
|
|
@ -2,8 +2,15 @@
|
|||
|
||||
const util = require('util');
|
||||
const config = require('config');
|
||||
const path = require('path');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const extensions = require('../extensions.json');
|
||||
|
||||
function reverseLookup(extension) {
|
||||
return Object.keys(extensions).find(mime => extensions[mime] === extension);
|
||||
};
|
||||
|
||||
function redditImage(post) {
|
||||
return Promise.resolve({
|
||||
album: null,
|
||||
|
@ -12,7 +19,7 @@ function redditImage(post) {
|
|||
url: post.url,
|
||||
title: post.title,
|
||||
datetime: post.datetime,
|
||||
type: 'image/jpeg',
|
||||
type: reverseLookup(path.extname(post.url)),
|
||||
original: post
|
||||
}]
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue