kopia lustrzana https://github.com/badgen/badgen.net
feat: migrate /peertube. Fix #572
rodzic
f5e72c4c00
commit
e9dccf4391
|
@ -45,7 +45,6 @@ export const liveBadgeList = [
|
|||
'jsdelivr',
|
||||
// social
|
||||
'devrant',
|
||||
'peertube',
|
||||
'reddit',
|
||||
// chat
|
||||
'gitter',
|
||||
|
|
|
@ -12,6 +12,7 @@ import chromeWebStore from '../pages/api/chrome-web-store'
|
|||
import vsMarketplace from '../pages/api/vs-marketplace'
|
||||
import hackage from '../pages/api/hackage'
|
||||
import pypi from '../pages/api/pypi'
|
||||
import peertube from '../pages/api/peertube'
|
||||
import discord from '../pages/api/discord'
|
||||
import matrix from '../pages/api/matrix'
|
||||
import runkit from '../pages/api/runkit'
|
||||
|
@ -34,6 +35,7 @@ export default {
|
|||
codeclimate: codeclimate.meta,
|
||||
codecov: codecov.meta,
|
||||
travis: travis.meta,
|
||||
peertube: peertube.meta,
|
||||
discord: discord.meta,
|
||||
matrix: matrix.meta,
|
||||
runkit: runkit.meta,
|
||||
|
|
|
@ -2,7 +2,7 @@ import got from 'got'
|
|||
|
||||
export default got.extend({
|
||||
timeout: {
|
||||
request: 4200,
|
||||
request: 4600,
|
||||
},
|
||||
retry: {
|
||||
limit: 0,
|
||||
|
|
|
@ -64,6 +64,7 @@ const nextConfig = {
|
|||
'/discord',
|
||||
'/matrix',
|
||||
'/runkit',
|
||||
'/peertube',
|
||||
// discontinued
|
||||
'/apm',
|
||||
'/lgtm',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import got from '../libs/got'
|
||||
import { millify } from '../libs/utils'
|
||||
import { createBadgenHandler, PathArgs } from '../libs/create-badgen-handler'
|
||||
import got from '../../libs/got'
|
||||
import { millify } from '../../libs/utils'
|
||||
import { createBadgenHandler, PathArgs } from '../../libs/create-badgen-handler-next'
|
||||
|
||||
const BRAND_COLOR = 'F1680D'
|
||||
|
||||
|
@ -27,7 +27,7 @@ async function handler ({ instance, topic, 'video-uuid': videoUUID }: PathArgs)
|
|||
|
||||
switch (topic) {
|
||||
case 'comments': {
|
||||
const { total } = await client.get(`/videos/${videoUUID}/comment-threads`).json<any>()
|
||||
const { total } = await client.get(`videos/${videoUUID}/comment-threads`).json<any>()
|
||||
return {
|
||||
subject: 'comments',
|
||||
status: millify(total),
|
||||
|
@ -35,19 +35,27 @@ async function handler ({ instance, topic, 'video-uuid': videoUUID }: PathArgs)
|
|||
}
|
||||
}
|
||||
case 'views': {
|
||||
const { views } = await client.get(`/videos/${videoUUID}`).json<any>()
|
||||
const { views } = await client.get(`videos/${videoUUID}`).json<any>()
|
||||
return {
|
||||
subject: 'views',
|
||||
status: millify(views),
|
||||
color: BRAND_COLOR
|
||||
}
|
||||
}
|
||||
default:
|
||||
return {
|
||||
subject: 'peertube',
|
||||
status: 'unknown topic',
|
||||
color: 'grey'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function votesHandler ({ instance, 'video-uuid': videoUUID, format }: PathArgs) {
|
||||
const client = createClient(instance)
|
||||
const { likes, dislikes } = await client.get(`/videos/${videoUUID}`).json<any>()
|
||||
console.log(33)
|
||||
const { likes, dislikes } = await client.get(`videos/${videoUUID}`).json<any>()
|
||||
console.log(44)
|
||||
|
||||
switch (format) {
|
||||
case 'likes': {
|
||||
|
@ -76,7 +84,7 @@ async function followersHandler ({ instance, account, channel }: PathArgs) {
|
|||
const client = createClient(instance)
|
||||
|
||||
if (channel) {
|
||||
const { followersCount } = await client.get(`/video-channels/${channel}`).json<any>()
|
||||
const { followersCount } = await client.get(`video-channels/${channel}`).json<any>()
|
||||
return {
|
||||
subject: 'followers',
|
||||
status: millify(followersCount),
|
||||
|
@ -84,7 +92,7 @@ async function followersHandler ({ instance, account, channel }: PathArgs) {
|
|||
}
|
||||
}
|
||||
|
||||
const { followersCount } = await client.get(`/accounts/${account}`).json<any>()
|
||||
const { followersCount } = await client.get(`accounts/${account}`).json<any>()
|
||||
return {
|
||||
subject: 'followers',
|
||||
status: millify(followersCount),
|
|
@ -142,10 +142,6 @@
|
|||
"source": "/packagist/:match*",
|
||||
"destination": "https://v2022.badgen.net/packagist/:match*"
|
||||
},
|
||||
{
|
||||
"source": "/peertube/:match*",
|
||||
"destination": "https://v2022.badgen.net/peertube/:match*"
|
||||
},
|
||||
{
|
||||
"source": "/pub/:match*",
|
||||
"destination": "https://v2022.badgen.net/pub/:match*"
|
||||
|
|
Ładowanie…
Reference in New Issue