Rebuild credits
Had to update the script now we use weblate
This commit is contained in:
parent
e0b56b7495
commit
41ee83423c
3 changed files with 448 additions and 315 deletions
|
@ -5,6 +5,7 @@ registerTSPaths()
|
|||
import { doRequest } from '../server/helpers/requests'
|
||||
import { readFileSync } from 'fs-extra'
|
||||
import { uniqBy } from 'lodash'
|
||||
import { execCLI } from '@shared/extra-utils'
|
||||
|
||||
run()
|
||||
.then(() => process.exit(0))
|
||||
|
@ -14,33 +15,20 @@ run()
|
|||
})
|
||||
|
||||
async function run () {
|
||||
const blacklist = getContributorsBlacklist()
|
||||
|
||||
{
|
||||
const contributors = await fetchGithub('https://api.github.com/repos/chocobozzz/peertube/contributors')
|
||||
let contributors = await getGitContributors()
|
||||
contributors = contributors.concat(getZanataContributors())
|
||||
contributors = contributors.filter(c => blacklist[c.username] !== true)
|
||||
|
||||
console.log('# Code contributors\n')
|
||||
for (const contributor of contributors) {
|
||||
const contributorUrl = contributor.url.replace('api.github.com/users', 'github.com')
|
||||
console.log(` * [${contributor.login}](${contributorUrl})`)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const zanataConfig = readFileSync(require('os').homedir() + '/.config/zanata.ini').toString()
|
||||
const zanataUsername = zanataConfig.match('.username=([^\n]+)')[1]
|
||||
const zanataToken = zanataConfig.match('.key=([^\n]+)')[1]
|
||||
|
||||
const translators = await fetchZanata(zanataUsername, zanataToken)
|
||||
|
||||
console.log('\n\n# Translation contributors\n')
|
||||
for (const translator of translators) {
|
||||
console.log(` * [${translator.username}](https://trad.framasoft.org/zanata/profile/view/${translator.username})`)
|
||||
}
|
||||
console.log('# Code & Translators contributors\n')
|
||||
for (const contributor of contributors) {
|
||||
console.log(` * ${contributor.username}`)
|
||||
}
|
||||
|
||||
{
|
||||
console.log('\n\n# Design\n')
|
||||
console.log(' * [Olivier Massain](https://twitter.com/omassain)')
|
||||
console.log(' * [Olivier Massain](https://dribbble.com/omassain)')
|
||||
|
||||
console.log('\n\n# Icons\n')
|
||||
console.log(' * [Robbie Pearce](https://robbiepearce.com/softies/)')
|
||||
|
@ -49,47 +37,140 @@ async function run () {
|
|||
}
|
||||
}
|
||||
|
||||
function get (url: string, headers: any = {}) {
|
||||
return doRequest<any>({
|
||||
uri: url,
|
||||
json: true,
|
||||
headers: Object.assign(headers, {
|
||||
'User-Agent': 'PeerTube-App'
|
||||
})
|
||||
}).then(res => res.body)
|
||||
async function getGitContributors () {
|
||||
const output = await execCLI(`git --no-pager shortlog -sn < /dev/tty | sed 's/^\\s\\+[0-9]\\+\\s\\+//g'`)
|
||||
|
||||
return output.split('\n')
|
||||
.filter(l => !!l)
|
||||
.map(l => ({ username: l }))
|
||||
}
|
||||
|
||||
async function fetchGithub (url: string) {
|
||||
let next = url
|
||||
let allResult = []
|
||||
// Zanata is dead, don't loose the contributors name
|
||||
function getZanataContributors () {
|
||||
return [ { 'username': 'abdhessuk', 'name': 'Abd Hessuk' }, { 'username': 'abidin24', 'name': 'abidin toumi' }, {
|
||||
'username': 'aditoo',
|
||||
'name': 'Lorem Ipsum'
|
||||
}, { 'username': 'alice', 'name': 'Alice' }, { 'username': 'anastasia', 'name': 'Anastasia' }, {
|
||||
'username': 'autom',
|
||||
'name': 'Filip Bengtsson'
|
||||
}, { 'username': 'balaji', 'name': 'Balaji' }, { 'username': 'bristow', 'name': 'Cédric F.' }, {
|
||||
'username': 'butterflyoffire',
|
||||
'name': 'ButterflyOfFire'
|
||||
}, { 'username': 'chocobozzz', 'name': 'Chocobozzz' }, { 'username': 'claichou', 'name': 'Claire Mohin' }, {
|
||||
'username': 'degrange',
|
||||
'name': 'Degrange Mathieu'
|
||||
}, { 'username': 'dibek', 'name': 'Giuseppe Di Bella' }, { 'username': 'edu', 'name': 'eduardo' }, {
|
||||
'username': 'ehsaan',
|
||||
'name': 'ehsaan'
|
||||
}, { 'username': 'esoforte', 'name': 'Ondřej Kotas' }, { 'username': 'fkohrt', 'name': 'Florian Kohrt' }, {
|
||||
'username': 'giqtaqisi',
|
||||
'name': 'Ian Townsend'
|
||||
}, { 'username': 'goofy', 'name': 'goofy' }, { 'username': 'gorkaazk', 'name': 'Gorka Azkarate Zubiaur' }, {
|
||||
'username': 'gwendald',
|
||||
'name': 'GwendalD'
|
||||
}, { 'username': 'h3zjp', 'name': 'h3zjp' }, { 'username': 'jfblanc', 'name': 'Joan Francés Blanc' }, {
|
||||
'username': 'jhertel',
|
||||
'name': 'Jean Hertel'
|
||||
}, { 'username': 'jmf', 'name': 'Jan-Michael Franz' }, { 'username': 'jorropo', 'name': 'Jorropo' }, {
|
||||
'username': 'kairozen',
|
||||
'name': 'Geoffrey Baudelet'
|
||||
}, { 'username': 'kedemferre', 'name': 'Kédem Ferré' }, { 'username': 'kousha', 'name': 'Kousha Zanjani' }, {
|
||||
'username': 'krkk',
|
||||
'name': 'Karol Kosek'
|
||||
}, { 'username': 'landrok', 'name': 'Landrok' }, { 'username': 'leeroyepold48', 'name': 'Leeroy Epold' }, {
|
||||
'username': 'm4sk1n',
|
||||
'name': 'marcin mikołajczak'
|
||||
}, { 'username': 'matograine', 'name': 'tom ngr' }, { 'username': 'medow', 'name': 'Mahir Ahmed' }, {
|
||||
'username': 'mhu',
|
||||
'name': 'Max Hübner'
|
||||
}, { 'username': 'midgard', 'name': 'Midgard' }, { 'username': 'nbrucy', 'name': 'N. B.' }, {
|
||||
'username': 'nitai',
|
||||
'name': 'nitai bezerra'
|
||||
}, { 'username': 'noncommutativegeo', 'name': 'Andrea Panontin' }, { 'username': 'nopsidy', 'name': 'McFlat' }, {
|
||||
'username': 'nvivant',
|
||||
'name': 'Nicolas Vivant'
|
||||
}, { 'username': 'osoitz', 'name': 'Osoitz' }, { 'username': 'outloudvi', 'name': 'Outvi V' }, {
|
||||
'username': 'quentin',
|
||||
'name': 'Quentí'
|
||||
}, { 'username': 'quentind', 'name': 'Quentin Dupont' }, { 'username': 'rafaelff', 'name': 'Rafael Fontenelle' }, {
|
||||
'username': 'rigelk',
|
||||
'name': 'Rigel Kent'
|
||||
}, { 'username': 's8321414', 'name': 'Jeff Huang' }, { 'username': 'sato_ss', 'name': 'Satoshi Shirosaka' }, {
|
||||
'username': 'sercom_kc',
|
||||
'name': 'SerCom_KC'
|
||||
}, { 'username': 'severo', 'name': 'Sylvain Lesage' }, { 'username': 'silkevicious', 'name': 'Sylke Vicious' }, {
|
||||
'username': 'sosha',
|
||||
'name': 'Sosha'
|
||||
}, { 'username': 'spla', 'name': 'spla' }, { 'username': 'strubbl', 'name': 'Sven' }, {
|
||||
'username': 'swedneck',
|
||||
'name': 'Tim Stahel'
|
||||
}, { 'username': 'tagomago', 'name': 'Tagomago' }, { 'username': 'talone', 'name': 'TitiAlone' }, {
|
||||
'username': 'thibaultmartin',
|
||||
'name': 'Thibault Martin'
|
||||
}, { 'username': 'tirifto', 'name': 'Tirifto' }, { 'username': 'tuxayo', 'name': 'Victor Grousset/tuxayo' }, {
|
||||
'username': 'unextro',
|
||||
'name': 'Ondřej Pokorný'
|
||||
}, { 'username': 'unzarida', 'name': 'unzarida' }, { 'username': 'vincent', 'name': 'Vincent Laporte' }, {
|
||||
'username': 'wanhua',
|
||||
'name': 'wanhua'
|
||||
}, { 'username': 'xinayder', 'name': 'Alexandre' }, { 'username': 'xosem', 'name': 'Xosé M.' }, {
|
||||
'username': 'zveryok',
|
||||
'name': 'Nikitin Stanislav'
|
||||
}, { 'username': '6543', 'name': '6543' }, { 'username': 'aasami', 'name': 'Miroslav Ďurian' }, {
|
||||
'username': 'alidemirtas',
|
||||
'name': 'Ali Demirtas'
|
||||
}, { 'username': 'alpha', 'name': 'Alpha' }, { 'username': 'ariasuni', 'name': 'Mélanie Chauvel' }, {
|
||||
'username': 'bfonton',
|
||||
'name': 'Baptiste Fonton'
|
||||
}, { 'username': 'c0dr', 'name': 'c0dr lnx' }, { 'username': 'canony', 'name': 'canony' }, {
|
||||
'username': 'cat',
|
||||
'name': 'Cat'
|
||||
}, { 'username': 'clerie', 'name': 'Clemens Riese' }, { 'username': 'curupira', 'name': 'Curupira' }, {
|
||||
'username': 'dhsets',
|
||||
'name': 'djsets'
|
||||
}, { 'username': 'digitalkiller', 'name': 'Digital Killer' }, { 'username': 'dwsage', 'name': 'd.w. sage' }, {
|
||||
'username': 'flauta',
|
||||
'name': 'Andrea Primiani'
|
||||
}, { 'username': 'frankstrater', 'name': 'Frank Sträter' }, { 'username': 'gillux', 'name': 'gillux' }, {
|
||||
'username': 'gunchleoc',
|
||||
'name': 'GunChleoc'
|
||||
}, { 'username': 'jaidedtd', 'name': 'Jenga Phoenix' }, { 'username': 'joss2lyon', 'name': 'Josselin' }, {
|
||||
'username': 'kekkotranslates',
|
||||
'name': 'Francesco'
|
||||
}, { 'username': 'kingu', 'name': 'Allan Nordhøy' }, { 'username': 'kittybecca', 'name': 'Rivka bat Tsvi' }, {
|
||||
'username': 'knuxify',
|
||||
'name': 'knuxify'
|
||||
}, { 'username': 'lapor', 'name': 'Kristijan Tkalec' }, { 'username': 'laufor', 'name': 'Lau For' }, {
|
||||
'username': 'lstamellos',
|
||||
'name': 'Loukas Stamellos'
|
||||
}, { 'username': 'lw1', 'name': 'Lukas Winkler' }, { 'username': 'mablr', 'name': 'Mablr' }, {
|
||||
'username': 'marcinmalecki',
|
||||
'name': 'Marcin Małecki'
|
||||
}, { 'username': 'mayana', 'name': 'Mayana' }, { 'username': 'mikeorlov', 'name': 'Michael Orlov' }, {
|
||||
'username': 'nin',
|
||||
'name': 'nz'
|
||||
}, { 'username': 'norbipeti', 'name': 'NorbiPeti' }, { 'username': 'ppnplus', 'name': 'Phongpanot Phairat' }, {
|
||||
'username': 'predatorix',
|
||||
'name': 'Predatorix'
|
||||
}, { 'username': 'robin', 'name': 'Robin Lahtinen' }, { 'username': 'rond', 'name': 'rondnelly nunes' }, {
|
||||
'username': 'secreet',
|
||||
'name': 'Secreet'
|
||||
}, { 'username': 'sftblw', 'name': 'sftblw' }, { 'username': 'sporiff', 'name': 'Ciarán Ainsworth' }, {
|
||||
'username': 'tekuteku',
|
||||
'name': 'tekuteku'
|
||||
}, { 'username': 'thecatjustmeow', 'name': 'Nguyen Huynh Hung' }, { 'username': 'tmota', 'name': 'Tiago Mota' }, {
|
||||
'username': 'uranix',
|
||||
'name': 'Michal Mauser'
|
||||
}, { 'username': 'wakutiteo', 'name': 'Markel' }, {
|
||||
'username': 'wonderingdane',
|
||||
'name': 'Nicolai Ireneo-Larsen'
|
||||
}, { 'username': 'zeynepeliacik', 'name': 'Zeynep Can' } ]
|
||||
}
|
||||
|
||||
let i = 1
|
||||
|
||||
// Hard limit
|
||||
while (i < 20) {
|
||||
const result = await get(next + '?page=' + i)
|
||||
if (result.length === 0) break
|
||||
|
||||
allResult = allResult.concat(result)
|
||||
i++
|
||||
function getContributorsBlacklist () {
|
||||
return {
|
||||
'Florian Bigard': true,
|
||||
'chocobozzz': true,
|
||||
'Rigel': true
|
||||
}
|
||||
|
||||
return allResult
|
||||
}
|
||||
|
||||
async function fetchZanata (zanataUsername: string, zanataPassword: string) {
|
||||
const today = new Date().toISOString().split('T')[0]
|
||||
const year2018 = `https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2018-01-01..2019-01-01`
|
||||
const year2019 = `https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2019-01-01..${today}`
|
||||
|
||||
const headers = {
|
||||
'X-Auth-User': zanataUsername,
|
||||
'X-Auth-Token': zanataPassword
|
||||
}
|
||||
const [ results2018, results2019 ] = await Promise.all([
|
||||
get(year2018, headers),
|
||||
get(year2019, headers)
|
||||
])
|
||||
|
||||
return uniqBy(results2018.concat(results2019) as { username: string }[], 'username')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue