feat(app/web): update ratelimit and placeholders (#826)

This commit is contained in:
Simon Lecoq
2022-01-28 02:22:42 +01:00
committed by GitHub
parent 9f4e255c85
commit 3945af02d1
12 changed files with 3124 additions and 28 deletions

View File

@@ -90,11 +90,25 @@
tab: "overview",
palette: "light",
clipboard: null,
requests: { limit: 0, used: 0, remaining: 0, reset: 0 },
requests: {rest:{limit:0, used:0, remaining:0, reset:NaN}, graphql:{limit:0, used:0, remaining:0, reset:NaN}},
cached: new Map(),
config: Object.fromEntries(Object.entries(metadata.core.web).map(([key, { defaulted }]) => [key, defaulted])),
metadata: Object.fromEntries(Object.entries(metadata).map(([key, { web }]) => [key, web])),
hosted: null,
docs:{
overview:{
link:"https://github.com/lowlighter/metrics#-documentation",
name:"Complete documentation",
},
markdown:{
link:"https://github.com/lowlighter/metrics/blob/master/.github/readme/partials/documentation/setup/shared.md",
name:"Setup using the shared instance",
},
action:{
link:"https://github.com/lowlighter/metrics/blob/master/.github/readme/partials/documentation/setup/action.md",
name:"Setup using GitHub Action on a profile repository",
}
},
plugins: {
base: {},
list: [],
@@ -251,6 +265,11 @@
preview() {
return /-preview$/.test(this.version)
},
//Rate limit reset
rlreset() {
const reset = new Date(Math.max(this.requests.graphql.reset, this.requests.rest.reset))
return `${reset.getHours()}:${reset.getMinutes()}`
}
},
//Methods
methods: {
@@ -299,6 +318,10 @@
}
finally {
this.generated.pending = false
try {
const { data: requests } = await axios.get("/.requests")
this.requests = requests
} catch {}
}
},
},