1
0
Fork 0

Fix git credits

This commit is contained in:
Chocobozzz 2018-06-22 17:06:32 +02:00
parent cd080b1a6b
commit 92d83c6a78
No known key found for this signature in database
GPG key ID: 583A612D890159BE
4 changed files with 110 additions and 29 deletions

View file

@ -30,6 +30,36 @@
* [sticmac](https://github.com/sticmac) * [sticmac](https://github.com/sticmac)
* [luzpaz](https://github.com/luzpaz) * [luzpaz](https://github.com/luzpaz)
* [qsypoq](https://github.com/qsypoq) * [qsypoq](https://github.com/qsypoq)
* [noplanman](https://github.com/noplanman)
* [Nautigsam](https://github.com/Nautigsam)
* [benabbottnz](https://github.com/benabbottnz)
* [ewft](https://github.com/ewft)
* [WildYorkies](https://github.com/WildYorkies)
* [Ealhad](https://github.com/Ealhad)
* [DatBewar](https://github.com/DatBewar)
* [ReK2Fernandez](https://github.com/ReK2Fernandez)
* [jlebras](https://github.com/jlebras)
* [alcalyn](https://github.com/alcalyn)
* [mkody](https://github.com/mkody)
* [lucas-dclrcq](https://github.com/lucas-dclrcq)
* [zapashcanon](https://github.com/zapashcanon)
* [1000i100](https://github.com/1000i100)
* [zeograd](https://github.com/zeograd)
* [sesn](https://github.com/sesn)
* [ALSai](https://github.com/ALSai)
* [sschueller](https://github.com/sschueller)
* [TrashMacNugget](https://github.com/TrashMacNugget)
* [FrozenDroid](https://github.com/FrozenDroid)
* [anmol26s](https://github.com/anmol26s)
* [AugierLe42e](https://github.com/AugierLe42e)
* [ctlaltdefeat](https://github.com/ctlaltdefeat)
* [jomo](https://github.com/jomo)
* [memoryboxes](https://github.com/memoryboxes)
* [norrist](https://github.com/norrist)
* [SansPseudoFix](https://github.com/SansPseudoFix)
* [tuxayo](https://github.com/tuxayo)
* [victor-long](https://github.com/victor-long)
* [ewasion](https://github.com/ewasion)
# Translations # Translations

View file

@ -1,27 +0,0 @@
#!/bin/sh
set -eu
echo -e "# Code\n"
curl -s https://api.github.com/repos/chocobozzz/peertube/contributors | \
jq -r 'map(" * [" + .login + "](" + .url + ")") | .[]' | \
sed 's/api.github.com\/users/github.com/g'
###################################################
echo -e "\n\n# Translations\n"
curl -s \
-H "Accept: application/json" \
-H "X-Auth-User: $(grep trad.framasoft.org.username ~/.config/zanata.ini | sed 's@.*=@@')" \
-H "X-Auth-Token: $(grep trad.framasoft.org.key ~/.config/zanata.ini | sed 's@.*=@@')" \
"https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2018-01-01..$(date +%Y-%m-%d)" \
| jq -r 'map(" * [" + .username + "](https://trad.framasoft.org/zanata/profile/view/" + .username + ")") | .[]'
###################################################
echo -e "\n\n# Design\n"
echo -e "By [Olivier Massain](https://twitter.com/omassain)\n"
echo -e "Icons from [Robbie Pearce](https://robbiepearce.com/softies/)"

View file

@ -0,0 +1,80 @@
import { doRequest } from '../server/helpers/requests'
import { readFileSync } from 'fs'
run()
.then(() => process.exit(0))
.catch(err => {
console.error(err)
process.exit(-1)
})
async function run () {
{
const contributors = await fetchGithub('https://api.github.com/repos/chocobozzz/peertube/contributors')
console.log('# Code\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# Translations\n')
for (const translator of translators) {
console.log(` * [${translator.username}](https://trad.framasoft.org/zanata/profile/view/${translator.username})`)
}
}
{
console.log('\n\n# Design\n')
console.log('By [Olivier Massain](https://twitter.com/omassain)\n')
console.log('Icons from [Robbie Pearce](https://robbiepearce.com/softies/)')
}
}
function get (url: string, headers: any = {}) {
return doRequest({
uri: url,
json: true,
headers: Object.assign(headers, {
'User-Agent': 'PeerTube-App'
})
}).then(res => res.body)
}
async function fetchGithub (url: string) {
let next = url
let allResult = []
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++
}
return allResult
}
async function fetchZanata (zanataUsername: string, zanataPassword: string) {
const today = new Date().toISOString().split('T')[0]
const url = `https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2018-01-01..${today}`
const headers = {
'X-Auth-User': zanataUsername,
'X-Auth-Token': zanataPassword
}
return get(url, headers)
}

View file

@ -1,7 +1,5 @@
import * as prompt from 'prompt' import * as prompt from 'prompt'
import { createReadStream } from 'fs'
import { join } from 'path' import { join } from 'path'
import { createInterface } from 'readline'
import { readdirPromise, unlinkPromise } from '../server/helpers/core-utils' import { readdirPromise, unlinkPromise } from '../server/helpers/core-utils'
import { CONFIG } from '../server/initializers/constants' import { CONFIG } from '../server/initializers/constants'
import { VideoModel } from '../server/models/video/video' import { VideoModel } from '../server/models/video/video'