This commit is contained in:
syuilo 2018-10-13 13:13:15 +09:00
parent 7ee2bfc1eb
commit f93cb02293
6 changed files with 19 additions and 15 deletions

View File

@ -62,6 +62,8 @@ export type Source = {
*/
ghost?: string;
proxy?: string;
summalyProxy?: string;
accesslog?: string;

View File

@ -51,6 +51,7 @@ export default class Resolver {
const object = await request({
url: value,
proxy: config.proxy,
timeout: this.timeout,
headers: {
'User-Agent': config.user_agent,

View File

@ -30,22 +30,20 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
.replace('{{limit}}', limit)
.replace('{{offset}}', offset);
request(
{
url: url,
timeout: timeout,
json: true,
followRedirect: true,
followAllRedirects: true
},
(error: any, response: any, body: any) => {
if (!error && response.statusCode == 200) {
res(body);
} else {
res([]);
}
request({
url: url,
proxy: config.proxy,
timeout: timeout,
json: true,
followRedirect: true,
followAllRedirects: true
}, (error: any, response: any, body: any) => {
if (!error && response.statusCode == 200) {
res(body);
} else {
res([]);
}
);
});
} else {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);

View File

@ -63,6 +63,7 @@ handler.on('status', event => {
// Fetch parent status
request({
url: `${parent.url}/statuses`,
proxy: config.proxy,
headers: {
'User-Agent': 'misskey'
}

View File

@ -7,6 +7,7 @@ module.exports = async (ctx: Koa.Context) => {
try {
const summary = config.summalyProxy ? await request.get({
url: config.summalyProxy,
proxy: config.proxy,
qs: {
url: ctx.query.url
},

View File

@ -37,6 +37,7 @@ export default async (url: string, user: IUser, folderId: mongodb.ObjectID = nul
const requestUrl = URL.parse(url).pathname.match(/[^\u0021-\u00ff]/) ? encodeURI(url) : url;
request({
url: requestUrl,
proxy: config.proxy,
headers: {
'User-Agent': config.user_agent
}