mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 12:13:48 +01:00
Add sunnaly proxy option
This commit is contained in:
parent
de37c3b62d
commit
7212d4569f
@ -138,3 +138,6 @@ drive:
|
||||
|
||||
# Clustering
|
||||
# clusterLimit: 1
|
||||
|
||||
# Summaly proxy
|
||||
# summalyProxy: "http://example.com"
|
||||
|
@ -62,6 +62,8 @@ export type Source = {
|
||||
*/
|
||||
ghost?: string;
|
||||
|
||||
summalyProxy?: string;
|
||||
|
||||
accesslog?: string;
|
||||
twitter?: {
|
||||
consumer_key: string;
|
||||
|
@ -1,11 +1,20 @@
|
||||
import * as Koa from 'koa';
|
||||
import * as request from 'request-promise-native';
|
||||
import summaly from 'summaly';
|
||||
import config from '../../config';
|
||||
|
||||
module.exports = async (ctx: Koa.Context) => {
|
||||
try {
|
||||
const summary = await summaly(ctx.query.url, {
|
||||
const summary = config.summalyProxy ? await request.get({
|
||||
url: config.summalyProxy,
|
||||
qs: {
|
||||
url: ctx.query.url
|
||||
},
|
||||
json: true
|
||||
}) : await summaly(ctx.query.url, {
|
||||
followRedirects: false
|
||||
});
|
||||
|
||||
summary.icon = wrap(summary.icon);
|
||||
summary.thumbnail = wrap(summary.thumbnail);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user