mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-22 07:37:29 +00:00
Make VSCode type detection happier
This commit is contained in:
parent
cd7969973b
commit
ec9b0edadc
@ -1,3 +1,5 @@
|
|||||||
|
/** @type {import("node-fetch").default} */
|
||||||
|
// @ts-ignore
|
||||||
const fetch = require("node-fetch")
|
const fetch = require("node-fetch")
|
||||||
const {getUser} = require("../utils/getuser")
|
const {getUser} = require("../utils/getuser")
|
||||||
const constants = require("../utils/constants.js")
|
const constants = require("../utils/constants.js")
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/** @type {import("node-fetch").default} */
|
||||||
|
// @ts-ignore
|
||||||
const fetch = require("node-fetch")
|
const fetch = require("node-fetch")
|
||||||
const constants = require("../utils/constants.js")
|
const constants = require("../utils/constants.js")
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
const {request} = require("../utils/request")
|
const {request} = require("../utils/request")
|
||||||
|
/** @type {import("node-fetch").default} */
|
||||||
|
// @ts-ignore
|
||||||
const fetch = require("node-fetch")
|
const fetch = require("node-fetch")
|
||||||
const {render} = require("pinski/plugins")
|
const {render} = require("pinski/plugins")
|
||||||
const db = require("../utils/db")
|
const db = require("../utils/db")
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
const Denque = require("denque")
|
const Denque = require("denque")
|
||||||
|
/** @type {import("node-fetch").default} */
|
||||||
|
// @ts-ignore
|
||||||
const fetch = require("node-fetch")
|
const fetch = require("node-fetch")
|
||||||
const constants = require("../utils/constants")
|
const constants = require("../utils/constants")
|
||||||
const db = require("../utils/db")
|
const db = require("../utils/db")
|
||||||
|
@ -151,7 +151,7 @@ function preroundedCountToText(count) {
|
|||||||
for (const scale of [[1e9, "B"], [1e6, "M"], [1e3, "K"]]) {
|
for (const scale of [[1e9, "B"], [1e6, "M"], [1e3, "K"]]) {
|
||||||
if (count >= scale[0]) {
|
if (count >= scale[0]) {
|
||||||
// YouTube returns 3 significant figures. At least it does for channels.
|
// YouTube returns 3 significant figures. At least it does for channels.
|
||||||
const rounded = (count/scale[0]).toPrecision(3)
|
const rounded = (count/+scale[0]).toPrecision(3)
|
||||||
return `${rounded}${scale[1]}`
|
return `${rounded}${scale[1]}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ class User {
|
|||||||
this.token = token
|
this.token = token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return {{instance?: string, save_history?: boolean, local?: boolean, quality?: number}} */
|
||||||
getSettings() {
|
getSettings() {
|
||||||
if (this.token) {
|
if (this.token) {
|
||||||
return db.prepare("SELECT * FROM Settings WHERE token = ?").get(this.token) || {}
|
return db.prepare("SELECT * FROM Settings WHERE token = ?").get(this.token) || {}
|
||||||
@ -39,6 +40,7 @@ class User {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return {{instance?: string, save_history?: boolean, local?: boolean, quality?: number}} */
|
||||||
getSettingsOrDefaults() {
|
getSettingsOrDefaults() {
|
||||||
const settings = this.getSettings()
|
const settings = this.getSettings()
|
||||||
for (const key of Object.keys(constants.user_settings)) {
|
for (const key of Object.keys(constants.user_settings)) {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/** @type {import("node-fetch").default} */
|
||||||
|
// @ts-ignore
|
||||||
const fetch = require("node-fetch")
|
const fetch = require("node-fetch")
|
||||||
|
|
||||||
function request(url, options = {}) {
|
function request(url, options = {}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user