javascript-ampache 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.m.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/system/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/base.ts +21 -0
- package/src/system/index.ts +3 -3
package/dist/system/index.d.ts
CHANGED
|
@@ -245,7 +245,7 @@ export declare class System extends Base {
|
|
|
245
245
|
id: UID;
|
|
246
246
|
type: 'song' | 'podcast_episode' | 'search' | 'playlist';
|
|
247
247
|
format?: string;
|
|
248
|
-
}): Promise<
|
|
248
|
+
}): Promise<Blob>;
|
|
249
249
|
/**
|
|
250
250
|
* Get an art image file.
|
|
251
251
|
* @remarks MINIMUM_API_VERSION=400001
|
package/package.json
CHANGED
package/src/base.ts
CHANGED
|
@@ -58,6 +58,27 @@ export abstract class Base {
|
|
|
58
58
|
})
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
protected binary<T> (endpoint: string, includeAuth: boolean = true): Promise<Blob> {
|
|
62
|
+
let url = this.url + "/server/json.server.php?action=" + endpoint;
|
|
63
|
+
|
|
64
|
+
if (includeAuth) {
|
|
65
|
+
url += "&auth=" + this.sessionKey + "&version=" + this.version;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (this.debug) {
|
|
69
|
+
console.debug(
|
|
70
|
+
"javascript-ampache query URL %c" + url,
|
|
71
|
+
"color: black; font-style: italic; background-color: orange;padding: 2px"
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return fetch(url)
|
|
76
|
+
.then(response => response.blob())
|
|
77
|
+
.then(r => {
|
|
78
|
+
return r;
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
61
82
|
public setSessionKey(sessionKey: string) {
|
|
62
83
|
this.sessionKey = sessionKey;
|
|
63
84
|
}
|
package/src/system/index.ts
CHANGED
|
@@ -370,7 +370,7 @@ export class System extends Base {
|
|
|
370
370
|
}) {
|
|
371
371
|
let query = 'stream';
|
|
372
372
|
query += qs.stringify(params, '&');
|
|
373
|
-
return this.
|
|
373
|
+
return this.binary(query);
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
/**
|
|
@@ -389,7 +389,7 @@ export class System extends Base {
|
|
|
389
389
|
}) {
|
|
390
390
|
let query = 'download';
|
|
391
391
|
query += qs.stringify(params, '&');
|
|
392
|
-
return this.
|
|
392
|
+
return this.binary(query);
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
/**
|
|
@@ -405,7 +405,7 @@ export class System extends Base {
|
|
|
405
405
|
}) {
|
|
406
406
|
let query = 'get_art';
|
|
407
407
|
query += qs.stringify(params, '&');
|
|
408
|
-
return this.
|
|
408
|
+
return this.binary(query);
|
|
409
409
|
}
|
|
410
410
|
|
|
411
411
|
/**
|