feat(core): add insights output (#575)
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
this.palette = (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")
|
||||
}
|
||||
catch (error) {}
|
||||
//Embed
|
||||
this.embed = !!(new URLSearchParams(location.search).get("embed"))
|
||||
//From local storage
|
||||
this.localstorage = !!(new URLSearchParams(location.search).get("localstorage"))
|
||||
//User
|
||||
const user = location.pathname.split("/").pop()
|
||||
if ((user) && (user !== "about")) {
|
||||
@@ -18,8 +22,6 @@
|
||||
else {
|
||||
this.searchable = true
|
||||
}
|
||||
//Embed
|
||||
this.embed = !!(new URLSearchParams(location.search).get("embed"))
|
||||
//Init
|
||||
await Promise.all([
|
||||
//GitHub limit tracker
|
||||
@@ -80,6 +82,10 @@
|
||||
this.error = null
|
||||
this.metrics = null
|
||||
this.pending = true
|
||||
if (this.localstorage) {
|
||||
this.metrics = JSON.parse(localStorage.getItem("local.metrics") ?? "null")
|
||||
return
|
||||
}
|
||||
this.metrics = (await axios.get(`/about/query/${this.user}`)).data
|
||||
}
|
||||
catch (error) {
|
||||
@@ -143,6 +149,7 @@
|
||||
hosted: null,
|
||||
user: "",
|
||||
embed: false,
|
||||
localstorage: false,
|
||||
searchable: false,
|
||||
requests: { limit: 0, used: 0, remaining: 0, reset: 0 },
|
||||
palette: "light",
|
||||
|
||||
Reference in New Issue
Block a user