diff options
-rw-r--r-- | CREDITS.md | 30 | ||||
-rwxr-xr-x | scripts/generate-code-contributors.sh | 27 | ||||
-rwxr-xr-x | scripts/generate-code-contributors.ts | 80 | ||||
-rwxr-xr-x | scripts/prune-storage.ts | 2 |
4 files changed, 110 insertions, 29 deletions
diff --git a/CREDITS.md b/CREDITS.md index f8006fc17..f1dd95a6c 100644 --- a/CREDITS.md +++ b/CREDITS.md | |||
@@ -30,6 +30,36 @@ | |||
30 | * [sticmac](https://github.com/sticmac) | 30 | * [sticmac](https://github.com/sticmac) |
31 | * [luzpaz](https://github.com/luzpaz) | 31 | * [luzpaz](https://github.com/luzpaz) |
32 | * [qsypoq](https://github.com/qsypoq) | 32 | * [qsypoq](https://github.com/qsypoq) |
33 | * [noplanman](https://github.com/noplanman) | ||
34 | * [Nautigsam](https://github.com/Nautigsam) | ||
35 | * [benabbottnz](https://github.com/benabbottnz) | ||
36 | * [ewft](https://github.com/ewft) | ||
37 | * [WildYorkies](https://github.com/WildYorkies) | ||
38 | * [Ealhad](https://github.com/Ealhad) | ||
39 | * [DatBewar](https://github.com/DatBewar) | ||
40 | * [ReK2Fernandez](https://github.com/ReK2Fernandez) | ||
41 | * [jlebras](https://github.com/jlebras) | ||
42 | * [alcalyn](https://github.com/alcalyn) | ||
43 | * [mkody](https://github.com/mkody) | ||
44 | * [lucas-dclrcq](https://github.com/lucas-dclrcq) | ||
45 | * [zapashcanon](https://github.com/zapashcanon) | ||
46 | * [1000i100](https://github.com/1000i100) | ||
47 | * [zeograd](https://github.com/zeograd) | ||
48 | * [sesn](https://github.com/sesn) | ||
49 | * [ALSai](https://github.com/ALSai) | ||
50 | * [sschueller](https://github.com/sschueller) | ||
51 | * [TrashMacNugget](https://github.com/TrashMacNugget) | ||
52 | * [FrozenDroid](https://github.com/FrozenDroid) | ||
53 | * [anmol26s](https://github.com/anmol26s) | ||
54 | * [AugierLe42e](https://github.com/AugierLe42e) | ||
55 | * [ctlaltdefeat](https://github.com/ctlaltdefeat) | ||
56 | * [jomo](https://github.com/jomo) | ||
57 | * [memoryboxes](https://github.com/memoryboxes) | ||
58 | * [norrist](https://github.com/norrist) | ||
59 | * [SansPseudoFix](https://github.com/SansPseudoFix) | ||
60 | * [tuxayo](https://github.com/tuxayo) | ||
61 | * [victor-long](https://github.com/victor-long) | ||
62 | * [ewasion](https://github.com/ewasion) | ||
33 | 63 | ||
34 | 64 | ||
35 | # Translations | 65 | # Translations |
diff --git a/scripts/generate-code-contributors.sh b/scripts/generate-code-contributors.sh deleted file mode 100755 index 46bf86234..000000000 --- a/scripts/generate-code-contributors.sh +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | set -eu | ||
4 | |||
5 | echo -e "# Code\n" | ||
6 | |||
7 | curl -s https://api.github.com/repos/chocobozzz/peertube/contributors | \ | ||
8 | jq -r 'map(" * [" + .login + "](" + .url + ")") | .[]' | \ | ||
9 | sed 's/api.github.com\/users/github.com/g' | ||
10 | |||
11 | ################################################### | ||
12 | |||
13 | echo -e "\n\n# Translations\n" | ||
14 | |||
15 | curl -s \ | ||
16 | -H "Accept: application/json" \ | ||
17 | -H "X-Auth-User: $(grep trad.framasoft.org.username ~/.config/zanata.ini | sed 's@.*=@@')" \ | ||
18 | -H "X-Auth-Token: $(grep trad.framasoft.org.key ~/.config/zanata.ini | sed 's@.*=@@')" \ | ||
19 | "https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2018-01-01..$(date +%Y-%m-%d)" \ | ||
20 | | jq -r 'map(" * [" + .username + "](https://trad.framasoft.org/zanata/profile/view/" + .username + ")") | .[]' | ||
21 | |||
22 | ################################################### | ||
23 | |||
24 | echo -e "\n\n# Design\n" | ||
25 | |||
26 | echo -e "By [Olivier Massain](https://twitter.com/omassain)\n" | ||
27 | echo -e "Icons from [Robbie Pearce](https://robbiepearce.com/softies/)" \ No newline at end of file | ||
diff --git a/scripts/generate-code-contributors.ts b/scripts/generate-code-contributors.ts new file mode 100755 index 000000000..0cce62180 --- /dev/null +++ b/scripts/generate-code-contributors.ts | |||
@@ -0,0 +1,80 @@ | |||
1 | import { doRequest } from '../server/helpers/requests' | ||
2 | import { readFileSync } from 'fs' | ||
3 | |||
4 | run() | ||
5 | .then(() => process.exit(0)) | ||
6 | .catch(err => { | ||
7 | console.error(err) | ||
8 | process.exit(-1) | ||
9 | }) | ||
10 | |||
11 | async function run () { | ||
12 | |||
13 | { | ||
14 | const contributors = await fetchGithub('https://api.github.com/repos/chocobozzz/peertube/contributors') | ||
15 | |||
16 | console.log('# Code\n') | ||
17 | for (const contributor of contributors) { | ||
18 | const contributorUrl = contributor.url.replace('api.github.com/users', 'github.com') | ||
19 | console.log(` * [${contributor.login}](${contributorUrl})`) | ||
20 | } | ||
21 | } | ||
22 | |||
23 | { | ||
24 | const zanataConfig = readFileSync(require('os').homedir() + '/.config/zanata.ini').toString() | ||
25 | const zanataUsername = zanataConfig.match('.username=([^\n]+)')[1] | ||
26 | const zanataToken = zanataConfig.match('.key=([^\n]+)')[1] | ||
27 | |||
28 | const translators = await fetchZanata(zanataUsername, zanataToken) | ||
29 | |||
30 | console.log('\n\n# Translations\n') | ||
31 | for (const translator of translators) { | ||
32 | console.log(` * [${translator.username}](https://trad.framasoft.org/zanata/profile/view/${translator.username})`) | ||
33 | } | ||
34 | } | ||
35 | |||
36 | { | ||
37 | console.log('\n\n# Design\n') | ||
38 | console.log('By [Olivier Massain](https://twitter.com/omassain)\n') | ||
39 | console.log('Icons from [Robbie Pearce](https://robbiepearce.com/softies/)') | ||
40 | } | ||
41 | } | ||
42 | |||
43 | function get (url: string, headers: any = {}) { | ||
44 | return doRequest({ | ||
45 | uri: url, | ||
46 | json: true, | ||
47 | headers: Object.assign(headers, { | ||
48 | 'User-Agent': 'PeerTube-App' | ||
49 | }) | ||
50 | }).then(res => res.body) | ||
51 | } | ||
52 | |||
53 | async function fetchGithub (url: string) { | ||
54 | let next = url | ||
55 | let allResult = [] | ||
56 | |||
57 | let i = 1 | ||
58 | |||
59 | // Hard limit | ||
60 | while (i < 20) { | ||
61 | const result = await get(next + '?page=' + i) | ||
62 | if (result.length === 0) break | ||
63 | |||
64 | allResult = allResult.concat(result) | ||
65 | i++ | ||
66 | } | ||
67 | |||
68 | return allResult | ||
69 | } | ||
70 | |||
71 | async function fetchZanata (zanataUsername: string, zanataPassword: string) { | ||
72 | const today = new Date().toISOString().split('T')[0] | ||
73 | const url = `https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2018-01-01..${today}` | ||
74 | |||
75 | const headers = { | ||
76 | 'X-Auth-User': zanataUsername, | ||
77 | 'X-Auth-Token': zanataPassword | ||
78 | } | ||
79 | return get(url, headers) | ||
80 | } | ||
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts index 1973725c8..bc59da6af 100755 --- a/scripts/prune-storage.ts +++ b/scripts/prune-storage.ts | |||
@@ -1,7 +1,5 @@ | |||
1 | import * as prompt from 'prompt' | 1 | import * as prompt from 'prompt' |
2 | import { createReadStream } from 'fs' | ||
3 | import { join } from 'path' | 2 | import { join } from 'path' |
4 | import { createInterface } from 'readline' | ||
5 | import { readdirPromise, unlinkPromise } from '../server/helpers/core-utils' | 3 | import { readdirPromise, unlinkPromise } from '../server/helpers/core-utils' |
6 | import { CONFIG } from '../server/initializers/constants' | 4 | import { CONFIG } from '../server/initializers/constants' |
7 | import { VideoModel } from '../server/models/video/video' | 5 | import { VideoModel } from '../server/models/video/video' |