~cadence/cloudtube

ec9b0edadcdbffd948da6c1ccff8ea350ab43069 — Cadence Ember 6 months ago cd79699
Make VSCode type detection happier
M api/captions.js => api/captions.js +2 -0
@@ 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")

M api/thumbnails.js => api/thumbnails.js +2 -0
@@ 1,3 1,5 @@
/** @type {import("node-fetch").default} */
// @ts-ignore
const fetch = require("node-fetch")
const constants = require("../utils/constants.js")


M api/video.js => api/video.js +2 -0
@@ 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")

M background/feed-update.js => background/feed-update.js +2 -0
@@ 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")

M utils/converters.js => utils/converters.js +1 -1
@@ 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]}`
		}
	}

M utils/getuser.js => utils/getuser.js +2 -0
@@ 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)) {

M utils/request.js => utils/request.js +2 -0
@@ 1,3 1,5 @@
/** @type {import("node-fetch").default} */
// @ts-ignore
const fetch = require("node-fetch")

function request(url, options = {}) {