Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
shields
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
shields.io
shields
Commits
6f2c0a22
Unverified
Commit
6f2c0a22
authored
1 year ago
by
hymbz
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix greasyfork 404 bug (#9632)
parent
8e868cda
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
services/greasyfork/greasyfork-base.js
+13
-5
13 additions, 5 deletions
services/greasyfork/greasyfork-base.js
services/greasyfork/greasyfork-downloads.tester.js
+4
-0
4 additions, 0 deletions
services/greasyfork/greasyfork-downloads.tester.js
with
17 additions
and
5 deletions
services/greasyfork/greasyfork-base.js
+
13
−
5
View file @
6f2c0a22
import
Joi
from
'
joi
'
import
{
nonNegativeInteger
}
from
'
../validators.js
'
import
{
BaseJsonService
}
from
'
../index.js
'
import
{
BaseJsonService
,
NotFound
}
from
'
../index.js
'
const
schema
=
Joi
.
object
({
daily_installs
:
nonNegativeInteger
,
...
...
@@ -16,9 +16,17 @@ export default class BaseGreasyForkService extends BaseJsonService {
static
defaultBadgeData
=
{
label
:
'
greasy fork
'
}
async
fetch
({
scriptId
})
{
return
this
.
_requestJson
({
schema
,
url
:
`https://greasyfork.org/scripts/
${
scriptId
}
.json`
,
})
try
{
return
await
this
.
_requestJson
({
schema
,
url
:
`https://greasyfork.org/scripts/
${
scriptId
}
.json`
,
})
}
catch
(
e
)
{
if
(
!
(
e
instanceof
NotFound
))
throw
e
return
this
.
_requestJson
({
schema
,
url
:
`https://sleazyfork.org/scripts/
${
scriptId
}
.json`
,
})
}
}
}
This diff is collapsed.
Click to expand it.
services/greasyfork/greasyfork-downloads.tester.js
+
4
−
0
View file @
6f2c0a22
...
...
@@ -17,3 +17,7 @@ t.create('Total Installs')
t
.
create
(
'
Total Installs (not found)
'
)
.
get
(
'
/dt/000000.json
'
)
.
expectBadge
({
label
:
'
installs
'
,
message
:
'
not found
'
})
t
.
create
(
'
Total Installs (sleazyfork)
'
)
.
get
(
'
/dt/374903.json
'
)
.
expectBadge
({
label
:
'
installs
'
,
message
:
isMetric
})
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment