mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-12 19: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 {getUser} = require("../utils/getuser")
|
||||
const constants = require("../utils/constants.js")
|
||||
|
@ -1,3 +1,5 @@
|
||||
/** @type {import("node-fetch").default} */
|
||||
// @ts-ignore
|
||||
const fetch = require("node-fetch")
|
||||
const constants = require("../utils/constants.js")
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
const {request} = require("../utils/request")
|
||||
/** @type {import("node-fetch").default} */
|
||||
// @ts-ignore
|
||||
const fetch = require("node-fetch")
|
||||
const {render} = require("pinski/plugins")
|
||||
const db = require("../utils/db")
|
||||
|
@ -1,4 +1,6 @@
|
||||
const Denque = require("denque")
|
||||
/** @type {import("node-fetch").default} */
|
||||
// @ts-ignore
|
||||
const fetch = require("node-fetch")
|
||||
const constants = require("../utils/constants")
|
||||
const db = require("../utils/db")
|
||||
|
@ -151,7 +151,7 @@ function preroundedCountToText(count) {
|
||||
for (const scale of [[1e9, "B"], [1e6, "M"], [1e3, "K"]]) {
|
||||
if (count >= scale[0]) {
|
||||
// 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]}`
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ class User {
|
||||
this.token = token
|
||||
}
|
||||
|
||||
/** @return {{instance?: string, save_history?: boolean, local?: boolean, quality?: number}} */
|
||||
getSettings() {
|
||||
if (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() {
|
||||
const settings = this.getSettings()
|
||||
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")
|
||||
|
||||
function request(url, options = {}) {
|
||||
|
Loading…
Reference in New Issue
Block a user