patrickjane / ut-passes

Access .pkpass passes on Ubuntu Touch
MIT License
4 stars 4 forks source link

unable to import pkpasses from Stanstead Express #10

Closed Danfro closed 1 year ago

Danfro commented 1 year ago

I tried to import some train tickets for Stanstead Express, but importing fails.

They are several passes zipped into one file passes.pkpasses. Importing that gives: " Pass "passes.pkpasses" could not be imported (Pass could not be opened (archiv does not contain a valid pass)). [translated from German, so original wording might be slightly different.

I tried to unzip the passes into single files. Importing them gives as error message: "Pass information ist ungültig (illegal value). In English that would be "Pass information is not valid (illegal value)".

I know hard to troubleshoot. If there is anything I can look out for let me know. But the log mainly contains the same info as the error message within the app.

patrickjane commented 1 year ago

Thanks for the hint. Could you send me the files so I can debug the app? => mg.m@gmx.net

Danfro commented 1 year ago

I did send them to your email. For at least a small bit of extra confidentiality I added a password: StansteadExpress.

patrickjane commented 1 year ago

Are you sure? I did not receive any mail. Also checked spam folders, but nothing.

patrickjane commented 1 year ago

Nevermind, found your email. Will check it now.

patrickjane commented 1 year ago

@Danfro So how many tickets should this be? Because when I unzip the file, it appearently gives me 2 different passes, but each of which having 5 versions, where I can't spot any differences. So the original .pkpass file contains another 10 .pkpass files, of which appearently only 2 are needed.

Is this file opening fine in your iOS wallet app on the iPhone? Because I cannot see any description of nested .pkass files in the specification (https://developer.apple.com/library/archive/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/PackageStructure.html#//apple_ref/doc/uid/TP40012026-CH1-SW1).

[edit] While it seems to be missing in the official specification, at least I was able to find a hint: https://github.com/alexandercerutti/passkit-generator/wiki/API-Documentation-Reference#bundling-multiple-passes-together

[edit2] Actually there is differences between Pass1 version 1 to 5. It seems to be all the same pass, but 5 different versions. Maybe iOS updated the pass via webservice to fetch the latest updates for your ticket, but stored the history within the bundle? Does not make this any less complicated to implement.

Anyway, the app currently does not support bundled .pkpass files. One way to workaround this to unzip into single files and import separately. I read that you tried this. So there seems to be issues on top of that, so the passes seem to have some unknown or unexpected contents. I will check it.

patrickjane commented 1 year ago

Okay, good news first: I was able to fix the opening issues with single extracted passes. The app supported UTF8 and UTF32 json documents, but not UTF16 (and your pass was UTF16 encoded). I added UTF16 support and now it opens fine.

Next up will be support for bundled passes; this will be a bit less trivial. I will publish an update as soon as its ready.

Danfro commented 1 year ago

Thanks a lot for looking into this.

I do not have an iOS device, so no idea on that end. I am just happy passes app does allow us UT users to use the convenient .passes. The files I could download from nationalrail right after booking the trip.

I am not 100% sure how it "should" be, but we had three tickets for a total of 5 people. One was a group ticked for three and the other two where single tickets. And since all was a return trip, that would explain the 10 tickets.

If you have further questions please ask or feel free to ping me on Telegram.

patrickjane commented 1 year ago

I have it implemented to 90%. Will publish an update tomorrow which supports pass bundles.

Danfro commented 1 year ago

Sounds promising. Looking forward to testing. 👍️

patrickjane commented 1 year ago

Just published the update.

One more question: I was unable to open the file you provided on my iPhone. Did one of you successfully open the file on the iPhone? Are you sure you provided the file which was sent by the ticket provider, or has it been modified before sending to me by mail?

Danfro commented 1 year ago

Sorry for the late reply. I did send you the file as I got it. No modifications. I do not have an iPhone, so I have no idea if it works there.

Also I am afraid, but even after the update, I can still not open that passes file I send to you.

patrickjane commented 1 year ago

Ah, indeed, I haven't touched the import-function. It seems to rely still on the single pass contents. If the pass is copied into the storage directory, it will open fine. Its a minor issue, will fix today. Just something I forgot to adjust.

patrickjane commented 1 year ago

Just published the update. Should work now.

Danfro commented 1 year ago

OpenStore still shows 1.3.0 as latest version for focal. That might need an extra publish job?

Also the code in the repo still shows 1.2.4 as latest version in manifest.json.in

patrickjane commented 1 year ago

Okay I dont know whats wrong here; open-store statistics show the 1.3.1 revision, but the official app page shows 1.3.0 as version. Whats even more weird, the app page also shows 1.3.1 changelog. No clue whats going wrong here. Maybe it will take some time on store side?

Oh and for the repo, I just forgot to push the changes alltogether. Thats why github showed 1.2.4 still.

Danfro commented 1 year ago

Maybe the server is a bit slow. The website and OpenStore app respond very slowly. Lets just wait a bit more...

patrickjane commented 1 year ago

*Sigh, I uploaded to the xenial channel, not focal. Should be available now, though it pretty much bricked the xenial channel I guess. What a mess.

Danfro commented 1 year ago

Great! Just updated. The passes where imported. Many thanks for the work!

Danfro commented 1 year ago

Fixed with v1.3.1. So we can close this issue.