mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-13 16:49:31 +08:00
feat: lacking config tips, close #2695
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const got = require('@/utils/got');
|
||||
const config = require('@/config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const user = ctx.params.user;
|
||||
@@ -10,6 +11,9 @@ module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
params: {
|
||||
access_token: config.github && config.github.access_token,
|
||||
},
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
|
||||
@@ -9,16 +9,12 @@ module.exports = async (ctx) => {
|
||||
|
||||
const fileUrl = `https://github.com/${user}/${repo}/commits/${branch}/${filepath}`;
|
||||
|
||||
const reqParams = {
|
||||
sha: branch,
|
||||
path: filepath,
|
||||
};
|
||||
if (config.github.access_token) {
|
||||
reqParams.access_token = config.github.access_token;
|
||||
}
|
||||
|
||||
const res = await got.get(`https://api.github.com/repos/${user}/${repo}/commits`, {
|
||||
params: reqParams,
|
||||
params: {
|
||||
sha: branch,
|
||||
path: filepath,
|
||||
access_token: config.github && config.github.access_token,
|
||||
},
|
||||
});
|
||||
const list = res.data;
|
||||
const count = [];
|
||||
|
||||
@@ -2,6 +2,9 @@ const got = require('@/utils/got');
|
||||
const config = require('@/config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
if (!config.github || !config.github.access_token) {
|
||||
throw 'GitHub follower RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#%E9%83%A8%E5%88%86-rss-%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE">relevant config</a>';
|
||||
}
|
||||
const user = ctx.params.user;
|
||||
|
||||
const host = `https://github.com/${user}`;
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = async (ctx) => {
|
||||
url,
|
||||
params: {
|
||||
sort: 'created',
|
||||
access_token: config.github.access_token,
|
||||
access_token: config.github && config.github.access_token,
|
||||
},
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = async (ctx) => {
|
||||
url,
|
||||
params: {
|
||||
sort: 'created',
|
||||
access_token: config.github.access_token,
|
||||
access_token: config.github && config.github.access_token,
|
||||
},
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
@@ -9,7 +9,7 @@ module.exports = async (ctx) => {
|
||||
url: `https://api.github.com/users/${user}/repos`,
|
||||
params: {
|
||||
sort: 'created',
|
||||
access_token: config.github.access_token,
|
||||
access_token: config.github && config.github.access_token,
|
||||
},
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
@@ -2,6 +2,9 @@ const got = require('@/utils/got');
|
||||
const config = require('@/config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
if (!config.github || !config.github.access_token) {
|
||||
throw 'GitHub star RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#%E9%83%A8%E5%88%86-rss-%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE">relevant config</a>';
|
||||
}
|
||||
const user = ctx.params.user;
|
||||
const repo = ctx.params.repo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user