forked from mirror/misskey
Resolve #2894
This commit is contained in:
parent
946c706913
commit
2b0a919fb5
@ -62,6 +62,8 @@ export type Source = {
|
|||||||
*/
|
*/
|
||||||
ghost?: string;
|
ghost?: string;
|
||||||
|
|
||||||
|
proxy?: string;
|
||||||
|
|
||||||
summalyProxy?: string;
|
summalyProxy?: string;
|
||||||
|
|
||||||
accesslog?: string;
|
accesslog?: string;
|
||||||
|
@ -51,6 +51,7 @@ export default class Resolver {
|
|||||||
|
|
||||||
const object = await request({
|
const object = await request({
|
||||||
url: value,
|
url: value,
|
||||||
|
proxy: config.proxy,
|
||||||
timeout: this.timeout,
|
timeout: this.timeout,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': config.user_agent,
|
'User-Agent': config.user_agent,
|
||||||
|
@ -30,22 +30,20 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
|||||||
.replace('{{limit}}', limit)
|
.replace('{{limit}}', limit)
|
||||||
.replace('{{offset}}', offset);
|
.replace('{{offset}}', offset);
|
||||||
|
|
||||||
request(
|
request({
|
||||||
{
|
url: url,
|
||||||
url: url,
|
proxy: config.proxy,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
json: true,
|
json: true,
|
||||||
followRedirect: true,
|
followRedirect: true,
|
||||||
followAllRedirects: true
|
followAllRedirects: true
|
||||||
},
|
}, (error: any, response: any, body: any) => {
|
||||||
(error: any, response: any, body: any) => {
|
if (!error && response.statusCode == 200) {
|
||||||
if (!error && response.statusCode == 200) {
|
res(body);
|
||||||
res(body);
|
} else {
|
||||||
} else {
|
res([]);
|
||||||
res([]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
} else {
|
} else {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
@ -63,6 +63,7 @@ handler.on('status', event => {
|
|||||||
// Fetch parent status
|
// Fetch parent status
|
||||||
request({
|
request({
|
||||||
url: `${parent.url}/statuses`,
|
url: `${parent.url}/statuses`,
|
||||||
|
proxy: config.proxy,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'misskey'
|
'User-Agent': 'misskey'
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ module.exports = async (ctx: Koa.Context) => {
|
|||||||
try {
|
try {
|
||||||
const summary = config.summalyProxy ? await request.get({
|
const summary = config.summalyProxy ? await request.get({
|
||||||
url: config.summalyProxy,
|
url: config.summalyProxy,
|
||||||
|
proxy: config.proxy,
|
||||||
qs: {
|
qs: {
|
||||||
url: ctx.query.url
|
url: ctx.query.url
|
||||||
},
|
},
|
||||||
|
@ -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;
|
const requestUrl = URL.parse(url).pathname.match(/[^\u0021-\u00ff]/) ? encodeURI(url) : url;
|
||||||
request({
|
request({
|
||||||
url: requestUrl,
|
url: requestUrl,
|
||||||
|
proxy: config.proxy,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': config.user_agent
|
'User-Agent': config.user_agent
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user