Compare commits

..

3 Commits

Author SHA1 Message Date
dependabot[bot]
e522caeb29 Bump axios from 1.5.1 to 1.6.0
Bumps [axios](https://github.com/axios/axios) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.5.1...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-11 10:51:37 +00:00
Simon J
5ce2e4efb7 Bump libs (#179) 2023-10-11 17:19:24 +11:00
Simon J
8ef9ca80b6 Fix issue #177 (#178) 2023-10-11 12:45:27 +11:00
5 changed files with 785 additions and 539 deletions

View File

@@ -7,53 +7,52 @@
"license": "GPL-3.0-only",
"dependencies": {
"@svrooij/sonos": "^2.5.0",
"@types/express": "^4.17.17",
"@types/fs-extra": "^11.0.1",
"@types/jsonwebtoken": "^9.0.1",
"@types/jws": "^3.2.5",
"@types/morgan": "^1.9.4",
"@types/express": "^4.17.19",
"@types/fs-extra": "^11.0.2",
"@types/jsonwebtoken": "^9.0.3",
"@types/jws": "^3.2.6",
"@types/morgan": "^1.9.6",
"@types/node": "^16.11.7",
"@types/randomstring": "^1.1.8",
"@types/sharp": "^0.31.1",
"@types/underscore": "^1.11.4",
"@types/uuid": "^9.0.1",
"@types/xmldom": "0.1.31",
"axios": "^1.3.4",
"dayjs": "^1.11.7",
"@types/randomstring": "^1.1.9",
"@types/underscore": "^1.11.11",
"@types/uuid": "^9.0.5",
"@types/xmldom": "0.1.32",
"axios": "^1.6.0",
"dayjs": "^1.11.10",
"eta": "^2.0.1",
"express": "^4.18.2",
"fp-ts": "^2.13.1",
"fs-extra": "^11.1.0",
"jsonwebtoken": "^9.0.0",
"fp-ts": "^2.16.1",
"fs-extra": "^11.1.1",
"jsonwebtoken": "^9.0.2",
"jws": "^4.0.0",
"libxmljs2": "^0.31.0",
"libxmljs2": "^0.32.0",
"morgan": "^1.10.0",
"node-html-parser": "^6.1.5",
"randomstring": "^1.2.3",
"sharp": "^0.31.3",
"node-html-parser": "^6.1.10",
"randomstring": "^1.3.0",
"sharp": "^0.32.6",
"soap": "^1.0.0",
"ts-md5": "^1.3.1",
"typescript": "^4.9.5",
"typescript": "^5.2.2",
"underscore": "^1.13.6",
"urn-lib": "^2.0.0",
"uuid": "^9.0.0",
"winston": "^3.8.2",
"uuid": "^9.0.1",
"winston": "^3.11.0",
"xmldom-ts": "^0.3.1"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/jest": "^29.4.0",
"@types/mocha": "^10.0.1",
"@types/supertest": "^2.0.12",
"@types/tmp": "^0.2.3",
"chai": "^4.3.7",
"get-port": "^6.1.2",
"image-js": "^0.35.3",
"jest": "^29.4.3",
"nodemon": "^2.0.21",
"@types/chai": "^4.3.7",
"@types/jest": "^29.5.5",
"@types/mocha": "^10.0.2",
"@types/supertest": "^2.0.14",
"@types/tmp": "^0.2.4",
"chai": "^4.3.10",
"get-port": "^7.0.0",
"image-js": "^0.35.4",
"jest": "^29.7.0",
"nodemon": "^3.0.1",
"supertest": "^6.3.3",
"tmp": "^0.2.1",
"ts-jest": "^29.0.5",
"ts-jest": "^29.1.1",
"ts-mockito": "^2.6.1",
"ts-node": "^10.9.1",
"xmldom-ts": "^0.3.1",

View File

@@ -956,6 +956,7 @@ export class Subsonic implements MusicService {
};
if (credentials.type == "navidrome") {
// todo: there does not seem to be a test for this??
return Promise.resolve({
...genericSubsonic,
flavour: () => "navidrome",
@@ -964,7 +965,7 @@ export class Subsonic implements MusicService {
TE.tryCatch(
() =>
axios.post(
`${this.url}/auth/login`,
this.url.append({ pathname: '/auth/login' }).href(),
_.pick(credentials, "username", "password")
),
() => new AuthFailure("Failed to get bearerToken")

View File

@@ -928,6 +928,34 @@ describe("Subsonic", () => {
});
});
describe("bearerToken", () => {
describe("when flavour is generic subsonic", () => {
it("should return undefined", async () => {
const credentials = { username: "foo", password: "bar" };
const token = { ...credentials, type: "subsonic", bearer: undefined }
const client = await subsonic.login(asToken(token));
const bearerToken = await pipe(client.bearerToken(credentials))();
expect(bearerToken).toStrictEqual(E.right(undefined));
});
});
describe("when flavour is navidrome", () => {
it("should get a bearerToken from navidrome", async () => {
const credentials = { username: "foo", password: "bar" };
const token = { ...credentials, type: "navidrome", bearer: undefined }
const client = await subsonic.login(asToken(token));
mockPOST.mockImplementationOnce(() => Promise.resolve(ok({ token: 'theBearerToken' })))
const bearerToken = await pipe(client.bearerToken(credentials))();
expect(bearerToken).toStrictEqual(E.right('theBearerToken'));
expect(axios.post).toHaveBeenCalledWith(url.append({ pathname: '/auth/login' }).href(), credentials)
});
});
});
describe("getting genres", () => {
describe("when there are none", () => {
beforeEach(() => {

View File

@@ -50,7 +50,7 @@
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
"typeRoots": [
"./typings",
"node_modules/@types"
"./node_modules/@types"
]
/* List of folders to include type definitions from. */,
// "types": ["src/customTypes/scale-that-svg.d.ts"], /* Type declaration files to be included in compilation. */

1226
yarn.lock

File diff suppressed because it is too large Load Diff