Fixed source integrations after refactoring

This commit is contained in:
squidfunk 2020-09-27 22:58:33 +02:00
parent c7ddada630
commit baeb4cc5bd
7 changed files with 11 additions and 14 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"assets/javascripts/bundle.js": "assets/javascripts/bundle.4fb8c892.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.4fb8c892.min.js.map",
"assets/javascripts/bundle.js": "assets/javascripts/bundle.9db80570.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.9db80570.min.js.map",
"assets/javascripts/vendor.js": "assets/javascripts/vendor.e3b5b4d0.min.js",
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.e3b5b4d0.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.2693be28.min.js",

View File

@ -173,7 +173,7 @@
</div>
{% block scripts %}
<script src="{{ 'assets/javascripts/vendor.e3b5b4d0.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.4fb8c892.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.9db80570.min.js' | url }}"></script>
{%- set translations = {} -%}
{%- for key in [
"clipboard.copy",

View File

@ -22,7 +22,7 @@
import { Repo, User } from "github-types"
import { Observable, from } from "rxjs"
import { filter, map } from "rxjs/operators"
import { map } from "rxjs/operators"
import { round } from "utilities"
@ -48,12 +48,11 @@ export function fetchSourceFactsFromGitHub(
: `https://api.github.com/users/${user}`
return from(fetch(url).then(res => res.json()))
.pipe(
filter(({ status }) => status === 200),
map(({ response }) => {
map(data => {
/* GitHub repository */
if (typeof repo !== "undefined") {
const { stargazers_count, forks_count }: Repo = response
const { stargazers_count, forks_count }: Repo = data
return [
`${round(stargazers_count || 0)} Stars`,
`${round(forks_count || 0)} Forks`
@ -61,7 +60,7 @@ export function fetchSourceFactsFromGitHub(
/* GitHub user/organization */
} else {
const { public_repos }: User = response
const { public_repos }: User = data
return [
`${round(public_repos || 0)} Repositories`
]

View File

@ -22,7 +22,7 @@
import { ProjectSchema } from "gitlab"
import { Observable, from } from "rxjs"
import { filter, map } from "rxjs/operators"
import { map } from "rxjs/operators"
import { round } from "utilities"
@ -46,8 +46,6 @@ export function fetchSourceFactsFromGitLab(
const url = `https://${base}/api/v4/projects/${encodeURIComponent(project)}`
return from(fetch(url).then(res => res.json()))
.pipe(
filter(({ status }) => status === 200),
map(({ response }) => response),
map(({ star_count, forks_count }: ProjectSchema) => ([
`${round(star_count)} Stars`,
`${round(forks_count)} Forks`