Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
const api = new mw.Api();
const user = 'OctraBot';
api.get({
action: 'query',
meta: 'tokens'
}).done((data) => {
console.log(data);
const token = data.query.tokens.csrftoken;
api.get({
action: 'query',
meta: 'globaluserinfo',
guiuser: user,
guiprop: 'rights|merged'
}).done((guiData) => {
const userWikis = guiData.query.globaluserinfo.merged;
let matchingWikis = userWikis.filter(
(userWiki) => {
let isWiktionary = userWiki.url.indexOf('wiktionary') > -1;
let isWikidata = userWiki.url.indexOf('wikidata') > -1;
let isBot = userWiki.groups && userWiki.groups.includes('bot');
return !isWiktionary && !isWikidata && isBot;
}
);
let wikisWithoutLocalCrat = matchingWikis.filter(
(matchingWiki) => {
console.log(`* https://tools.wmflabs.org/meta/stewardry/${matchingWiki.wiki}?bureaucrat=1`);
// damn CSP, need to figure out something
// let localApi = new mw.Api({ajax: {url: matchingWiki.url + '/w/api.php'}});
//
// localApi.get({
// action: 'query',
// list: 'allusers',
// augroup: 'bureaucrat'
// }).done(
// (allusers) => {
// let crats = allusers.query.allusers;
// console.log(crats);
// }
// )
}
);
});
});