LeoKlaus / plappa

An Audiobook client for Jellyfin and AudioBookShelf, written in Swift/SwiftUI.
https://plappa.me
159 stars 0 forks source link

[BUG] cannot log in #137

Closed pounat closed 4 days ago

pounat commented 6 days ago

Describe the bug I’ve put in the correct info. Server, with port. Correct username and password. No error shows up. The login button just gets pressed and nothing happens. The same info works on the audiobookshelf app, and the ShelfPlayer app.

Logs [6/22/2024, 9:57 AM] [plappa] Encountered an error while decoding auth response: Die Daten konnten nicht gelesen werden, da sie nicht das korrekte Format haben. dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Number 31674.624062768 is not representable in Swift." UserInfo={NSDebugDescription=Number 31674.624062768 is not representable in Swift.}))) [6/22/2024, 10:04 AM] [AudioBookShelfAPIHandler] Couldn't connect to server: Zeitüberschreitung bei der Anforderung.

Environment(please complete the following information):

LeoKlaus commented 6 days ago

Hi Nathan, thank you for reporting this!

Can you check what the server returns when you send the following request:

curl --request POST \
  --url https://abs.yourdomain.com/login \
  --header 'Content-Type: application/json' \
  --data '{
    "username": "demo",
    "password": "demopass"
}'

The response should look something like this:

{
  "user": {
    "id": "root",
    "username": "root",
    "type": "root",
    "token": "exJhbGciOiJI6IkpXVCJ9.eyJ1c2Vyi5NDEyODc4fQ.ZraBFohS4Tg39NszY",
    "mediaProgress": [
      {
            ...
      }
    ],
    "seriesHideFromContinueListening": [],
    "bookmarks": [],
    "isActive": true,
    "isLocked": false,
    "lastSeen": 1669010786013,
    "createdAt": 1666543632566,
    "permissions": {
      "download": true,
      "update": true,
      "delete": true,
      "upload": true,
      "accessAllLibraries": true,
      "accessAllTags": true,
      "accessExplicitContent": true
    },
    "librariesAccessible": [],
    "itemTagsAccessible": []
  },
  "userDefaultLibraryId": "lib_c1u6t4p45c35rf0nzd",
  "serverSettings": {
        ...
  },
  "Source": "docker"
}
thedualspace commented 4 days ago

Getting a similar error, the response returns the JSON below.

It looks like the error I get has to do with my bookmark. The error "Number 5043.874960674001 is not representable in Swift" corresponds to the time property on the first bookmark.

{

"user":{
    "id":"0e37de84-3187-46f9-8633-882d89c63fc8",
    "oldUserId":null,
    "username":"redacted",
    "email":null,
    "type":"root",
    "token":"redacted",
    "mediaProgress":[
        {
            "id":"e9c893fb-e93a-4cee-856f-3fb350156734",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"5c82485a-ae77-4a06-80b3-48c620738a2b",
            "episodeId":null,
            "mediaItemId":"e03cdf35-6ea4-4b2c-8c40-5785d73f009a",
            "mediaItemType":"book",
            "duration":436,
            "progress":1,
            "currentTime":436.006,
            "isFinished":true,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1706528325101,
            "startedAt":1705594584225,
            "finishedAt":1706528325101
        },
        {
            "id":"a1bf5826-5aee-4f0b-bddc-b5b47473d6f0",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"31a68550-b4c2-4f58-ac6d-8641d0c2cf30",
            "episodeId":null,
            "mediaItemId":"eeaa1648-d58d-4724-9e8c-1dca447baf3b",
            "mediaItemType":"book",
            "duration":58834.718344,
            "progress":0.027350129858998477,
            "currentTime":1609.137186926,
            "isFinished":false,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1708436904669,
            "startedAt":1705594716702,
            "finishedAt":null
        },
        {
            "id":"5b5da090-299a-4604-8a1c-cb800185b80b",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"e80bfcd0-1df9-4580-9f24-dfbed18b2002",
            "episodeId":null,
            "mediaItemId":"4756d699-70ba-420e-9a3d-0b5e00cd61eb",
            "mediaItemType":"book",
            "duration":62628.02576199999,
            "progress":0.058261318177076096,
            "currentTime":3648.791335722,
            "isFinished":false,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1705667842223,
            "startedAt":1705595780972,
            "finishedAt":null
        },
        {
            "id":"4ee24c2c-9388-48da-a0ce-2231b528a76f",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"25d8159d-320b-4c67-9fff-6290be48bf5a",
            "episodeId":null,
            "mediaItemId":"d6982cda-be3d-4d3c-88b5-e78f7632ca8f",
            "mediaItemType":"book",
            "duration":0,
            "progress":0,
            "currentTime":0,
            "isFinished":false,
            "hideFromContinueListening":false,
            "ebookLocation":"epubcfi(/6/22!/4[Munroe_WHATIF_int_F]/4/2/1:0)",
            "ebookProgress":0.05121951219512195,
            "lastUpdate":1718817351621,
            "startedAt":1706490142930,
            "finishedAt":null
        },
        {
            "id":"b110d0a3-cda7-47d9-ac2c-2f705eda5f8c",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"1278a994-d54a-4813-94e1-5a3338ee4b64",
            "episodeId":null,
            "mediaItemId":"da7ed9f7-8739-4971-88f7-9478b7572f83",
            "mediaItemType":"book",
            "duration":100020.52000600005,
            "progress":0.05133519933401654,
            "currentTime":5134.573332000002,
            "isFinished":false,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1708435486767,
            "startedAt":1706530963288,
            "finishedAt":null
        },
        {
            "id":"31797ee0-5a76-4c88-8afa-9215207ce6ac",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"4b13f22b-1011-4480-b37b-3ed24e734ced",
            "episodeId":null,
            "mediaItemId":"7f8b31bb-1351-49c3-8e85-e88e6aeb6c0f",
            "mediaItemType":"book",
            "duration":58635.355,
            "progress":0.09112209890432146,
            "currentTime":5342.9766176,
            "isFinished":false,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1711651352607,
            "startedAt":1709148196667,
            "finishedAt":null
        },
        {
            "id":"7bd48684-a825-4694-a0df-b968f0e4605a",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"7ace232c-7f0b-4f31-9810-201f8b9a6000",
            "episodeId":null,
            "mediaItemId":"c092ea2a-783a-4b2e-b201-2c490aff0baf",
            "mediaItemType":"book",
            "duration":0,
            "progress":1,
            "currentTime":0,
            "isFinished":true,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1715766306673,
            "startedAt":1715766306673,
            "finishedAt":1715766306673
        },
        {
            "id":"f206f1bc-3142-45b7-8189-1217eee00bad",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"716b947c-3ee9-47f3-98c8-c9f9b0f3563e",
            "episodeId":null,
            "mediaItemId":"19753040-915a-4121-a051-721506b9686e",
            "mediaItemType":"book",
            "duration":55538.62530399998,
            "progress":0,
            "currentTime":0,
            "isFinished":false,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1718786128503,
            "startedAt":1715766566779,
            "finishedAt":null
        },
        {
            "id":"a353c115-8ccb-4f6b-be80-f09cbacea379",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"107400d0-13ec-481b-9561-16f22a9cd36f",
            "episodeId":null,
            "mediaItemId":"ab61ee6d-1349-45d9-b9f6-92e58da2ff81",
            "mediaItemType":"book",
            "duration":55083.023673,
            "progress":1,
            "currentTime":55083.023673,
            "isFinished":true,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1718669312512,
            "startedAt":1715791773710,
            "finishedAt":1718669312512
        },
        {
            "id":"b4b1b273-32de-4c18-9755-4c843ffec82d",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"d26c2fed-da28-46e4-a32b-edbc0c84c548",
            "episodeId":null,
            "mediaItemId":"96bb9818-cb30-472b-b8f2-7faee830f5d5",
            "mediaItemType":"book",
            "duration":27831.614692999996,
            "progress":0.0014456811804066752,
            "currentTime":40.235641582,
            "isFinished":false,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1718894612435,
            "startedAt":1718707958690,
            "finishedAt":null
        },
        {
            "id":"7d07632f-229f-47fc-87d8-27b185fbf840",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"d26c2fed-da28-46e4-a32b-edbc0c84c548",
            "episodeId":null,
            "mediaItemId":"96bb9818-cb30-472b-b8f2-7faee830f5d5",
            "mediaItemType":"book",
            "duration":27831.614692999996,
            "progress":0.00004201922435690139,
            "currentTime":1.169462862,
            "isFinished":false,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1718707958718,
            "startedAt":1718707958718,
            "finishedAt":null
        },
        {
            "id":"e9799ca2-888c-4a3a-bbb7-b48c0cabb4c3",
            "userId":"0e37de84-3187-46f9-8633-882d89c63fc8",
            "libraryItemId":"311c31c3-059f-438e-a57f-419126e277b9",
            "episodeId":null,
            "mediaItemId":"bd7047f4-ab32-49e6-bd72-541971aee71b",
            "mediaItemType":"book",
            "duration":65572.35,
            "progress":0.3486634571994903,
            "currentTime":22862.682247695,
            "isFinished":false,
            "hideFromContinueListening":false,
            "ebookLocation":null,
            "ebookProgress":null,
            "lastUpdate":1719307065322,
            "startedAt":1718707965146,
            "finishedAt":null
        }
    ],
    "seriesHideFromContinueListening":[
    ],
    "bookmarks":[
        {
            "libraryItemId":"107400d0-13ec-481b-9561-16f22a9cd36f",
            "title":"16 May 2024 at 23:37:57",
            "time":5042.874960674001,
            "createdAt":1715899066396
        },
        {
            "libraryItemId":"311c31c3-059f-438e-a57f-419126e277b9",
            "title":"Telomere",
            "time":9055.067525717,
            "createdAt":1718964781016
        },
        {
            "libraryItemId":"311c31c3-059f-438e-a57f-419126e277b9",
            "title":"Telomere2",
            "time":9911.658245825,
            "createdAt":1718965695928
        }
    ],
    "isActive":true,
    "isLocked":false,
    "lastSeen":1719307043680,
    "createdAt":1705594228599,
    "permissions":{
        "download":true,
        "update":true,
        "delete":true,
        "upload":true,
        "accessAllLibraries":true,
        "accessAllTags":true,
        "accessExplicitContent":true
    },
    "librariesAccessible":[
    ],
    "itemTagsSelected":[
    ],
    "hasOpenIDLink":false
},
"userDefaultLibraryId":"6e774c9a-65fb-4df1-82a1-446ed8cdaa6d",
"serverSettings":{
    "id":"server-settings",
    "scannerFindCovers":true,
    "scannerCoverProvider":"google",
    "scannerParseSubtitle":false,
    "scannerPreferMatchedMetadata":false,
    "scannerDisableWatcher":false,
    "storeCoverWithItem":false,
    "storeMetadataWithItem":false,
    "metadataFileFormat":"json",
    "rateLimitLoginRequests":10,
    "rateLimitLoginWindow":600000,
    "backupSchedule":false,
    "backupsToKeep":2,
    "maxBackupSize":1,
    "loggerDailyLogsToKeep":7,
    "loggerScannerLogsToKeep":2,
    "homeBookshelfView":1,
    "bookshelfView":1,
    "podcastEpisodeSchedule":"0 * * * *",
    "sortingIgnorePrefix":false,
    "sortingPrefixes":[
        "the",
        "a"
    ],
    "chromecastEnabled":false,
    "dateFormat":"dd/MM/yyyy",
    "timeFormat":"HH:mm",
    "language":"en-us",
    "logLevel":2,
    "version":"2.10.1",
    "buildNumber":1,
    "authLoginCustomMessage":null,
    "authActiveAuthMethods":[
        "local"
    ],
    "authOpenIDIssuerURL":null,
    "authOpenIDAuthorizationURL":null,
    "authOpenIDTokenURL":null,
    "authOpenIDUserInfoURL":null,
    "authOpenIDJwksURL":null,
    "authOpenIDLogoutURL":null,
    "authOpenIDTokenSigningAlgorithm":"RS256",
    "authOpenIDButtonText":"Login with OpenId",
    "authOpenIDAutoLaunch":false,
    "authOpenIDAutoRegister":false,
    "authOpenIDMatchExistingBy":null
},
"ereaderDevices":[
],
"Source":"docker"

}

LeoKlaus commented 4 days ago

It looks like the error I get has to do with my bookmark.

Sounds about right, thank you for the update! According to the ABS docs, the time should be an integer, so that's what plappa is expecting. Did you create those bookmarks using the WebUI?

I'll see how I can catch this.

thedualspace commented 4 days ago

Ah interesting, I created the bookmark with ShelfPlayer. I think a ticket will have to be opened over there to resolve the root of the problem.

I'll delete the bookmarks after sorting through them and try again, but catching the error so you can still log in would be great!

LeoKlaus commented 4 days ago

I've just pushed an update to TestFlight that should fix the issue. If you want to try it, you can join the TestFlight-Beta here: https://testflight.apple.com/join/oSAekRD5

thedualspace commented 4 days ago

Log in is now working as expected, great work.

thanks for the quick turnaround 👌

pounat commented 4 days ago

Yes the TestFlight update did the trick! I never use bookmarks. But I used just ONE the other day in ShelfPlayer. Like the only bookmark I’ve done in my life with an audiobook. And it caused an issue lol. Thank! And sorry I never saw your first comment on this to try. Glad you figured it out tho

LeoKlaus commented 4 days ago

Great to hear, I'll close this then!