Skip to content

Commit 5b415ef

Browse files
committed
upd
1 parent 58353ec commit 5b415ef

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/Source.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Source {
9191
}
9292

9393
get apiVersion() {
94-
return this.plugin.api || this.plugin.constructor.api || 1;
94+
return this.plugin.api || 1;
9595
}
9696

9797
/**
@@ -115,11 +115,11 @@ class Source {
115115
*
116116
* @param {User} user
117117
* @param {string} id
118-
* @returns {Promise<PlaylistItemDesc?>}
118+
* @returns {Promise<PlaylistItemDesc | undefined>}
119119
*/
120-
getOne(user, id) {
121-
return this.get(user, [id])
122-
.then((items) => items[0]);
120+
async getOne(user, id) {
121+
const [item] = await this.get(user, [id]);
122+
return item;
123123
}
124124

125125
/**
@@ -164,6 +164,10 @@ class Source {
164164

165165
/**
166166
* Get playlists for a specific user from this media source.
167+
*
168+
* @param {User} user
169+
* @param {string} userID
170+
* @returns {Promise<unknown>}
167171
*/
168172
async getUserPlaylists(user, userID) {
169173
if (this.apiVersion < 3 || !this.plugin.getUserPlaylists) {
@@ -177,6 +181,10 @@ class Source {
177181

178182
/**
179183
* Get playlists for a specific user from this media source.
184+
*
185+
* @param {User} user
186+
* @param {string} playlistID
187+
* @returns {Promise<unknown>}
180188
*/
181189
async getPlaylistItems(user, playlistID) {
182190
if (this.apiVersion < 3 || !this.plugin.getPlaylistItems) {
@@ -203,6 +211,9 @@ class Source {
203211
throw new SourceNoImportError({ name: this.type });
204212
}
205213

214+
/**
215+
* @param {import('./Uwave')} uw
216+
*/
206217
static async plugin(uw, { source: SourcePlugin, baseOptions = {} }) {
207218
debug('registering plugin', SourcePlugin);
208219
if (SourcePlugin.api == null || SourcePlugin.api < 3) {

src/Uwave.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ class UwaveServer extends EventEmitter {
273273
*
274274
* @param {string} sourceType
275275
* @param {Source} source
276-
* @private
277276
*/
278277
insertSourceInternal(sourceType, source) {
279278
this.#sources.set(sourceType, source);
@@ -285,7 +284,6 @@ class UwaveServer extends EventEmitter {
285284
* Only source plugins using Media Source API 3 or higher can be removed.
286285
*
287286
* @param {string} sourceType
288-
* @private
289287
*/
290288
removeSourceInternal(sourceType) {
291289
const source = this.#sources.get(sourceType);

src/routes/sources.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

3-
const router = require('router');
3+
const { Router } = require('express');
44
const route = require('../route');
55
const protect = require('../middleware/protect');
66
const schema = require('../middleware/schema');
77
const controller = require('../controllers/sources');
88
const validations = require('../validations');
99

1010
function sourceRoutes() {
11-
return router()
11+
return Router()
1212
.use(protect())
1313
// GET /sources/:source/search - Search for media in a single source.
1414
.get(

0 commit comments

Comments
 (0)