-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup themes & plugins list #1458
Conversation
@stevenjoezhang We could add a check for whether the theme is available after the generation. |
The rate limit of GitHub api is 5000 requests per hour const yaml = require('js-yaml');
const fs = require('fs');
const https = require('https');
function load(type) {
const file = fs.readFileSync(`./source/_data/${type}.yml`);
return yaml.load(file);
}
function request(url) {
if (!url.startsWith('https://github.com/')) {
console.log(url);
return;
}
url = url.replace(/(\/$|\.git$)/g, '');
https.get('https://api.github.com/repos/' + url.replace('https://github.com/', ''), {
headers: {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36',
'Authorization': 'Basic ' + Buffer.from('Client ID' + ':' + 'Client Secret').toString('base64')
}
}, res => {
if (res.statusCode !== 200) console.log(res.statusCode, url);
}).on('error', err => {
console.error('Failded to download release messages.');
console.log(err);
});
}
function validatePlugins() {
const plugins = load('plugins');
let url = plugins.map(item => item.link);
url.forEach(request);
} |
Use hexo's built-in API to get const themesMap = hexo.locals.get('data').themes;
const pluginsMap = hexo.locals.get('data').plugins; Also, we can simply request the given |
That's right, and it's possible to display a warning on the hexo.io website, such as "the repository is currently not accessible", or "the plugin has not been updated for years". |
Check List
Please read and check followings before submitting a PR.
name
is unique.link
URL is correct.preview
URL is correct.preview
URL web site is rendered correctly.source/themes/screenshots
.name
.800 * 500
.png
.name
is unique.link
URL is correct.en
Englishko
Koreanpt-br
Brazilian Portugueseru
Russianth
Thaizh-cn
simplified Chinesezh-tw
traditional ChineseSee also #606 #734
Pending
#1388#713Ref miao1007/hexo-filter-plantuml#3