Skip to content

Commit

Permalink
feat: Add legacy fallback options for subsonic communication #136
Browse files Browse the repository at this point in the history
* Add config options for using legacy authentication and ignoring TLS cert errors
* Fallback to legacy auth if subsonic error code 41 is detected
  • Loading branch information
FoxxMD committed Feb 13, 2024
1 parent f231d4e commit 41c6969
Show file tree
Hide file tree
Showing 7 changed files with 2,232 additions and 2,146 deletions.
18 changes: 18 additions & 0 deletions src/backend/common/infrastructure/config/source/subsonic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ export interface SubsonicData extends CommonSourceData, PollingOptions {
* @examples [30]
* */
maxInterval?: number

/**
* If your subsonic server is using self-signed certs you may need to disable TLS errors in order to get a connection
*
* WARNING: This should be used with caution as your traffic may not be encrypted.
*
* @default false
* */
ignoreTlsErrors?: boolean

/**
* Older Subsonic versions, and some badly implemented servers (Nextcloud), use legacy authentication which sends your password in CLEAR TEXT. This is less secure than the newer, recommended hashing authentication method but in some cases it is needed. See "Authentication" section here => https://www.subsonic.org/pages/api.jsp
*
* If this option is not specified it will be turned on if the subsonic server responds with error code 41 "Token authentication not supported for LDAP users." -- See Error Handling section => https://www.subsonic.org/pages/api.jsp
*
* @default false
* */
legacyAuthentication?: boolean
}
export interface SubSonicSourceConfig extends CommonSourceConfig {
data: SubsonicData
Expand Down
134 changes: 67 additions & 67 deletions src/backend/common/schema/aio-client.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"ClientAIOConfig": {
"import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/clients\",{assert:{\"resolution-mode\":\"import\"}}).ClientAIOConfig": {
"anyOf": [
{
"$ref": "#/definitions/LastfmClientAIOConfig"
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/lastfm\",{assert:{\"resolution-mode\":\"import\"}}).LastfmClientAIOConfig"
},
{
"$ref": "#/definitions/ListenBrainzClientAIOConfig"
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/listenbrainz\",{assert:{\"resolution-mode\":\"import\"}}).ListenBrainzClientAIOConfig"
},
{
"$ref": "#/definitions/MalojaClientAIOConfig"
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/maloja\",{assert:{\"resolution-mode\":\"import\"}}).MalojaClientAIOConfig"
}
],
"title": "ClientAIOConfig"
"title": "import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/clients\",{assert:{\"resolution-mode\":\"import\"}}).ClientAIOConfig"
},
"CommonClientData": {
"import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/index\",{assert:{\"resolution-mode\":\"import\"}}).CommonClientData": {
"properties": {
"maxRequestRetries": {
"default": 1,
Expand Down Expand Up @@ -44,7 +44,7 @@
1
],
"title": "deadLetterRetries",
"type": "boolean"
"type": "number"
},
"refreshEnabled": {
"default": true,
Expand All @@ -59,7 +59,7 @@
"description": "Options used for increasing verbosity of logging in MS (used for debugging)",
"properties": {
"match": {
"$ref": "#/definitions/MatchLoggingOptions",
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/index\",{assert:{\"resolution-mode\":\"import\"}}).MatchLoggingOptions",
"title": "match"
}
},
Expand All @@ -80,10 +80,44 @@
"type": "number"
}
},
"title": "CommonClientData",
"title": "import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/index\",{assert:{\"resolution-mode\":\"import\"}}).CommonClientData",
"type": "object"
},
"import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/index\",{assert:{\"resolution-mode\":\"import\"}}).MatchLoggingOptions": {
"description": "Scrobble matching (between new source track and existing client scrobbles) logging options. Used for debugging.",
"properties": {
"confidenceBreakdown": {
"default": false,
"description": "Include confidence breakdowns in track match logging, if applicable",
"examples": [
false
],
"title": "confidenceBreakdown",
"type": "boolean"
},
"onMatch": {
"default": false,
"description": "Log to DEBUG when a new track DOES match an existing scrobble",
"examples": [
false
],
"title": "onMatch",
"type": "boolean"
},
"onNoMatch": {
"default": false,
"description": "Log to DEBUG when a new track does NOT match an existing scrobble",
"examples": [
false
],
"title": "onNoMatch",
"type": "boolean"
}
},
"title": "import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/index\",{assert:{\"resolution-mode\":\"import\"}}).MatchLoggingOptions",
"type": "object"
},
"LastfmClientAIOConfig": {
"import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/lastfm\",{assert:{\"resolution-mode\":\"import\"}}).LastfmClientAIOConfig": {
"properties": {
"configureAs": {
"default": "client",
Expand All @@ -101,10 +135,10 @@
"data": {
"allOf": [
{
"$ref": "#/definitions/CommonClientData"
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/index\",{assert:{\"resolution-mode\":\"import\"}}).CommonClientData"
},
{
"$ref": "#/definitions/LastfmData"
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/lastfm\",{assert:{\"resolution-mode\":\"import\"}}).LastfmData"
}
],
"description": "Specific data required to configure this client",
Expand Down Expand Up @@ -140,10 +174,10 @@
"name",
"type"
],
"title": "LastfmClientAIOConfig",
"title": "import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/lastfm\",{assert:{\"resolution-mode\":\"import\"}}).LastfmClientAIOConfig",
"type": "object"
},
"LastfmData": {
"import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/lastfm\",{assert:{\"resolution-mode\":\"import\"}}).LastfmData": {
"properties": {
"apiKey": {
"description": "API Key generated from Last.fm account",
Expand Down Expand Up @@ -198,10 +232,10 @@
"apiKey",
"secret"
],
"title": "LastfmData",
"title": "import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/lastfm\",{assert:{\"resolution-mode\":\"import\"}}).LastfmData",
"type": "object"
},
"ListenBrainzClientAIOConfig": {
"import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/listenbrainz\",{assert:{\"resolution-mode\":\"import\"}}).ListenBrainzClientAIOConfig": {
"properties": {
"configureAs": {
"default": "client",
Expand All @@ -217,7 +251,7 @@
"type": "string"
},
"data": {
"$ref": "#/definitions/ListenBrainzClientData",
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/listenbrainz\",{assert:{\"resolution-mode\":\"import\"}}).ListenBrainzClientData",
"description": "Specific data required to configure this client",
"title": "data"
},
Expand Down Expand Up @@ -251,10 +285,10 @@
"name",
"type"
],
"title": "ListenBrainzClientAIOConfig",
"title": "import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/listenbrainz\",{assert:{\"resolution-mode\":\"import\"}}).ListenBrainzClientAIOConfig",
"type": "object"
},
"ListenBrainzClientData": {
"import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/listenbrainz\",{assert:{\"resolution-mode\":\"import\"}}).ListenBrainzClientData": {
"properties": {
"maxRequestRetries": {
"default": 1,
Expand Down Expand Up @@ -283,7 +317,7 @@
1
],
"title": "deadLetterRetries",
"type": "boolean"
"type": "number"
},
"refreshEnabled": {
"default": true,
Expand All @@ -298,7 +332,7 @@
"description": "Options used for increasing verbosity of logging in MS (used for debugging)",
"properties": {
"match": {
"$ref": "#/definitions/MatchLoggingOptions",
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/index\",{assert:{\"resolution-mode\":\"import\"}}).MatchLoggingOptions",
"title": "match"
}
},
Expand Down Expand Up @@ -345,13 +379,13 @@
"token",
"username"
],
"title": "ListenBrainzClientData",
"title": "import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/listenbrainz\",{assert:{\"resolution-mode\":\"import\"}}).ListenBrainzClientData",
"type": "object"
},
"MalojaClientAIOConfig": {
"import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/maloja\",{assert:{\"resolution-mode\":\"import\"}}).MalojaClientAIOConfig": {
"properties": {
"data": {
"$ref": "#/definitions/MalojaClientData",
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/maloja\",{assert:{\"resolution-mode\":\"import\"}}).MalojaClientData",
"description": "Specific data required to configure this client",
"title": "data"
},
Expand Down Expand Up @@ -385,10 +419,10 @@
"name",
"type"
],
"title": "MalojaClientAIOConfig",
"title": "import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/maloja\",{assert:{\"resolution-mode\":\"import\"}}).MalojaClientAIOConfig",
"type": "object"
},
"MalojaClientData": {
"import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/maloja\",{assert:{\"resolution-mode\":\"import\"}}).MalojaClientData": {
"properties": {
"apiKey": {
"description": "API Key for Maloja server",
Expand Down Expand Up @@ -425,7 +459,7 @@
1
],
"title": "deadLetterRetries",
"type": "boolean"
"type": "number"
},
"refreshEnabled": {
"default": true,
Expand All @@ -440,7 +474,7 @@
"description": "Options used for increasing verbosity of logging in MS (used for debugging)",
"properties": {
"match": {
"$ref": "#/definitions/MatchLoggingOptions",
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/index\",{assert:{\"resolution-mode\":\"import\"}}).MatchLoggingOptions",
"title": "match"
}
},
Expand Down Expand Up @@ -473,44 +507,10 @@
"apiKey",
"url"
],
"title": "MalojaClientData",
"type": "object"
},
"MatchLoggingOptions": {
"description": "Scrobble matching (between new source track and existing client scrobbles) logging options. Used for debugging.",
"properties": {
"confidenceBreakdown": {
"default": false,
"description": "Include confidence breakdowns in track match logging, if applicable",
"examples": [
false
],
"title": "confidenceBreakdown",
"type": "boolean"
},
"onMatch": {
"default": false,
"description": "Log to DEBUG when a new track DOES match an existing scrobble",
"examples": [
false
],
"title": "onMatch",
"type": "boolean"
},
"onNoMatch": {
"default": false,
"description": "Log to DEBUG when a new track does NOT match an existing scrobble",
"examples": [
false
],
"title": "onNoMatch",
"type": "boolean"
}
},
"title": "MatchLoggingOptions",
"title": "import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/maloja\",{assert:{\"resolution-mode\":\"import\"}}).MalojaClientData",
"type": "object"
},
"RequestRetryOptions": {
"import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/common\",{assert:{\"resolution-mode\":\"import\"}}).RequestRetryOptions": {
"properties": {
"maxRequestRetries": {
"default": 1,
Expand All @@ -531,18 +531,18 @@
"type": "number"
}
},
"title": "RequestRetryOptions",
"title": "import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/common\",{assert:{\"resolution-mode\":\"import\"}}).RequestRetryOptions",
"type": "object"
}
},
"properties": {
"clientDefaults": {
"$ref": "#/definitions/RequestRetryOptions",
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/common\",{assert:{\"resolution-mode\":\"import\"}}).RequestRetryOptions",
"title": "clientDefaults"
},
"clients": {
"items": {
"$ref": "#/definitions/ClientAIOConfig"
"$ref": "#/definitions/import(\"/home/foxx/code/multi-scrobbler/src/backend/common/infrastructure/config/client/clients\",{assert:{\"resolution-mode\":\"import\"}}).ClientAIOConfig"
},
"title": "clients",
"type": "array"
Expand Down
Loading

0 comments on commit 41c6969

Please sign in to comment.