rgriebl / brickstore

An offline BrickLink inventory management tool.
https://www.brickstore.dev/
GNU General Public License v3.0
116 stars 26 forks source link

SSL / Bricklink database issues #870

Closed jrobinson-uk closed 5 months ago

jrobinson-uk commented 5 months ago

Describe the bug Recently I've had issues with my BL credentials not persisting across excutions of brickstore. The result is that everytime I want to download my inventory or sync orders I have to re-enter my password time BL is loaded. Not a big hassle so have largely ignored. Now, since updating to 2023.2.1 I cannot load BL as it complains it can't open the BL database due to an SSL handshake issue

I've also spotted a number of error messages, before and since update, in the CLI output:

qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
Failed to load BrickLink password: "libsecret: unexpected content type: text/plain" (at /home/runner/work/brickstore/brickstore/src/common/config.cpp, 63)
Failed to load QNetworkInformation's default backend (at /home/runner/work/brickstore/brickstore/src/common/onlinestate.cpp, 30)
Could not load cookies for "BrickLink" : "libsecret: unexpected content type: text/plain" (at /home/runner/work/brickstore/brickstore/src/utility/persistentcookiejar.cpp, 33)
Using BrickLink price-guide retriever plugin: "Batched Affiliate API"
Picture cache: 4.0 GB
Importing orders from old cache: 0s 000ms 111us
Loading orders: 0s 000ms 001us
Loading database failed: "could not open database for reading (/home/james/.cache/BrickStore/database-v12): No such file or directory" (at /home/runner/work/brickstore/brickstore/src/bricklink/database.cpp, 513)
UI:
  Device pixel ratio: 1 / Qt::HighDpiScaleFactorRoundingPolicy::PassThrough
  Screen size in pix: 1920 x 1080
  Screen size in mm : 290 x 170
script: Loading scripts from directory: "/home/james/.local/share/BrickStore/extensions"
script:   [ ok ] classic-print-script.bs.qml
LDraw installation at /home/james/.cache/BrickStore/ldraw/complete.zip is not usable

This may be a missing dependancy or system config issue, but I don't know what

To Reproduce Steps to reproduce the behavior:

  1. Load brink link app image

Expected behavior Bricklink should load and initialise database

Screenshots Screenshot from 2024-04-16 14-47-29

System information NixOS 23.11 Bricklink : Linux-AppImage-BrickStore-2024.2.1-x86_64.AppImage


* **brickstore.ldraw**:
* **brickstore.locale**: en
* **build.arch**: x86_64
* **build.compiler**: GCC 10.5.0
* **build.date**: 2024-04-05T12:54:26.000
* **build.host**: fv-az701-980
* **build.number**: 1211
* **build.qt.version**: 6.6.2
* **hw.cpu**: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
* **hw.cpu.arch**: x86_64
* **hw.gpu**: Device
* **hw.gpu.arch**: intel
* **hw.memory.gb**: 15.4
* **os.arch**: x86_64
* **os.productname**: NixOS 23.11 (Tapir)
* **qt.debug**: false
* **qt.platformname**: xcb
* **qt.version**: 6.6.2
rgriebl commented 5 months ago

Sorry, can't help you with your exotic NixOS setup. According to https://nixos.wiki/wiki/Appimage NixOS does not directly support AppImages, but instead has to mess with their contained libraries (which clearly goes south as both libsecret and OpenSSL are broken for you) The 2024.4.1 AppImage works perfectly fine on Debian/sid and Ubuntu/22.04.

jrobinson-uk commented 5 months ago

As an update, I loaded bricklink whilst on my home network (I was on corporate network earlier). The database now loads successfully, so I suspect this is something to do with the network certificate there.

I still get some of the errors which prevent my credentials from persisting. Can you help explain what the errors mean so that I can investigate on the nixos side:

Linux-AppImage-BrickStore-2024.4.1-x86_64.AppImage installed in /home/james/.cache/appimage-run/caf8b8c2cecedef06a8093f8a284da50f12ff2e6a41cfeaba07377fd7a1042ce
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
Failed to load BrickLink password: "libsecret: unexpected content type: text/plain" (at /home/runner/work/brickstore/brickstore/src/common/config.cpp, 63)
Failed to load QNetworkInformation's default backend (at /home/runner/work/brickstore/brickstore/src/common/onlinestate.cpp, 30)
Could not load cookies for "BrickLink" : "libsecret: unexpected content type: text/plain" (at /home/runner/work/brickstore/brickstore/src/utility/persistentcookiejar.cpp, 33)
Using BrickLink price-guide retriever plugin: "Batched Affiliate API"
jrobinson-uk commented 5 months ago

I'm confused by the /home/runner/.... paths. I wanted to poke the file contents but the files/paths don't seem to exist. Are these standards linux mechanism or part of appimage?

rgriebl commented 5 months ago

Again ... NixOS messes with the AppImage and somehow breaks libsecret (which saves your password) in the process. I can't help you with that. Maybe try asking on a NixOS forum / mailing list?

As for the /home/runner/... paths: BrickStore tells you where that specific debug output was generated in the C++ source code and the full path comes from the build environment on GitHub. If you want to have a look at the source code yourself, then just ignore the /home/runner/work/brickstore/brickstore/ prefix and look up the remaining path in BrickStore's git repository here.

jrobinson-uk commented 5 months ago

Thanks,

I'm going to attempt to wrap the *.deb package in a "derivation" (nixos package) and avoid the appImage setup and see if that helps

joalcava commented 5 months ago

I'm having a very similar issues running Fedora 39, Im not an expert so I dont know how to debug this, here is the log in case you can give it a look.

❯ ./Linux-AppImage-BrickStore-2024.4.1-x86_64.AppImage             [21:48:32] 
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
Failed to load QNetworkInformation's default backend (at /home/runner/work/brickstore/brickstore/src/common/onlinestate.cpp, 30)
qUncompress: Input data is corrupted (at unknown, 0)
Using BrickLink price-guide retriever plugin: "Batched Affiliate API"
Picture cache: 4.0 GB
Loading database failed: "could not open database for reading (/home/joalcava/.cache/BrickStore/database-v12): No such file or directory" (at /home/runner/work/brickstore/brickstore/src/bricklink/database.cpp, 513)
UI:
  Device pixel ratio: 2 / Qt::HighDpiScaleFactorRoundingPolicy::PassThrough
  Screen size in pix: 1440 x 900
  Screen size in mm : 300 x 190
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslSocket (at unknown, 0)
qt.network.ssl: The backend named "cert-only" does not support TLS (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslSocket (at unknown, 0)
qt.network.ssl: The backend named "cert-only" does not support TLS (at unknown, 0)
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed (at unknown, 0)
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslSocket (at unknown, 0)
qt.network.ssl: The backend named "cert-only" does not support TLS (at unknown, 0)
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslKey (at unknown, 0)
qt.network.ssl: Active TLS backend does not support key creation (at unknown, 0)
qt.network.ssl: The backend "cert-only" does not support QSslSocket (at unknown, 0)
qt.network.ssl: The backend named "cert-only" does not support TLS (at unknown, 0)
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed (at unknown, 0)
script: Loading scripts from directory: "/home/joalcava/.local/share/BrickStore/extensions"
script:   [ ok ] classic-print-script.bs.qml
 (at /home/runner/work/brickstore/brickstore/src/desktop/checkforupdates.cpp, 78)

Could not parse GitHub JSON reply: "illegal value" (at /home/runner/work/brickstore/brickstore/src/desktop/checkforupdates.cpp, 79)
^C
joalcava commented 5 months ago

After building the same version from source it works perfectly fine. So looks like the problem is isolated to the AppImage itself

jrobinson-uk commented 5 months ago

With a bit of trail and error I've built a package for nixos which currently compile and seems to address all the ssl issues. I do however get an error on start up which I can't work out.

Looks like a missing dependancy? Screenshot from 2024-04-22 16-20-50

I've look at the code but can't work out the issue.

joalcava commented 5 months ago

@jrobinson-uk How are you building it? are you using QT Creator or Linux packages? Take a look at the docs for building: https://www.brickstore.dev/compile. Looks like you are missing the Image Format plugin, you can add it in QT Creator or install the package qt6-image-formats-plugins (that's the name it has in Ubuntu, you will have to find it for Nix)

jrobinson-uk commented 5 months ago

@joalcava, yeah that turned out to be the case, I'd added to my build settings but my system had cached the previous build (or something. Nix uses an declaritive text based approach to packaging that uses nix packages.

bricklink launches now and seems to work well. Any further issues I'll raise seperately

rgriebl commented 4 months ago

@joalcava I've managed to get BrickStore compiled as a flatpak. This would probably be the best option for you on Fedora. Would you mind giving this a try?

https://github.com/rgriebl/brickstore/actions/runs/8975909445

joalcava commented 4 months ago

@rgriebl Thanks for taking the time to create the flatpak build, I confirm that it works. One thing I noticed is that no shortcut/menu entry was created, the only way for me to run it is through the terminal. Other than that, all features are working perfectly fine!

rgriebl commented 4 months ago

@joalcava This one should now have both a start menu entry and the BSX file types associations working: https://github.com/rgriebl/brickstore/actions/runs/9001142307

joalcava commented 4 months ago

@rgriebl I tested the build, the entry is in the menu and it works, but the bsx file association was not set automatically, I had to manually set it. I'm not sure if that was your intent.