strukturart / greg

Calendar for KaiOS
MIT License
26 stars 6 forks source link

The data of the account <name> could not be loaded #34

Closed zeekoe closed 10 months ago

zeekoe commented 11 months ago

Hi! First of all, thanks for creating this app! It looks great, and was one of the reasons I dared to try the jump to KaiOs and the 8110. I installed the "Nov 23, 2022" release and added my Nextcloud account. Now it says "The data of the account could not be loaded". Looking at the source code, this would mean some kind of network error, as the other error (an incorrect login) is not logged. I think I don't see logs in nginx too (I do see a PROPFIND from an x86_64 machine at more or less the same time, but that can't be it). My Browser app can access the internet. Do you have suggestions on how to further debug? Or... do I need to install the latest master code first, instead of the latest release? Things to know:

strukturart commented 11 months ago

can you still install apps via the KaiOS store? If so, I could add you as an all tester. If not and you have the option to sideload apps, I will publish a release in the next few minutes.

https://github.com/strukturart/greg/releases/tag/1.0

strukturart commented 11 months ago

If updating the app doesn't solve the problem, I'll do a test with a nextcloud acc later today. I'm waiting for your feedback

zeekoe commented 11 months ago

Thanks a lot! Updating didn't seem possible with OmniSD (I have installed GerdaOS, so no Kai Store), so I did a clean install of the new & improved version. Now it says "the big loading has begun" when I press "Reload all events", then nothing happens. I don't see the HTTPS request coming in in my server logs.

As for debugging: I'm quite proficient in Java, know how to use the Developer console in browsers, but am really new to KaiOs. It seems I can't just open the app in a regular web browser because of cross origin restrictions. I didn't get the Firefox ESR thingy with WebIDE to work, Can I run locally in a "newish" way?

I tried 'adb root' then adb forward tcp:6000 localfilesystem:/data/local/debugger-socket telnet shows me that there is something out there, but Firefox (v 116) can't connect, so I'm lost in remote debugging, too.

strukturart commented 11 months ago

Currently this browser is the best alternative for sideloading apps: https://classic.waterfox.net/

how to do: https://sonata8.com/post/sideloading-and-deploying-apps-to-kai-os/ or https://wiki.bananahackers.net/sideloading/webide

This afternoon I fixed the bug that prevented you from saving events in a nextcloud account. Now it should work, at least it worked for me. please install the latest version.

https://github.com/strukturart/greg/releases/tag/1.0

strukturart commented 11 months ago

@zeekoe Did the last update solve your problem?

zeekoe commented 11 months ago

Thanks again, those were the tools I needed! I already tried the 1.0 version, but didn't work before. Waterfox lead me to the problem: LetsEncrypt certificates are not supported by default, and requests fail very silently because of security considerations. Using the b2g-certificates I got them on.

Now I got it somewhat working. I see calendar entries that I don't see on other apps. Partly that might be a data issue; apparently I have some very old recurring items without an end date. I think I can fix that in some way.

Some problems that arose afterwards:

strukturart commented 11 months ago

Calendar entries are not sorted correctly (apparently Nextcloud doesn't send them sorted...) (also no big issue)

The events will be sorted as soon as you switch to event-list view With softRight you have the option to sort the events by: last modified or by start date

sort_events();

I can not select another calendar than 'local' when editing or creating events. Do you have the same observation? Does the select box open and you can't select the calendar names?

zeekoe commented 11 months ago

Sorting => clear, thanks!

Does the select box open and you can't select the calendar names? Yes indeed. A screen opens with "Select" on top, then "local (o)", left soft = "Cancel", middle = "SELECT". That's all.

Also after removing the app and adding just a single new CalDAV calendar.

strukturart commented 11 months ago

Here the calendar names of your CalDav acc are queried and saved. You should receive a notification when this happens https://github.com/strukturart/greg/blob/72253895a7ad8d7d5a85676323b5d562eeb45d60/application/app.js#L411

zeekoe commented 11 months ago

I don't see that message. I can see the load_caldav working, up until side_toaster('all event reloaded', 2000). But I didn't ever see the calendar list has been updated.

In your latest commit I saw this being moved up: let cn = [ { name: 'local', id: 'local-id', data: '', type: 'local', }, ]; Isn't that a problem when working offline?

I might add some debugging here and there to pinpoint the problem; could take a few days...

strukturart commented 11 months ago

new version new happiness https://github.com/strukturart/greg/releases/tag/1.0

You're right, there was a problem that when you switch from online to offline the calendar name wasn't updated. this version should solve the problem.

If the user is offline, the calendar list is updated and events can only be created in the local calendar. I did that because I haven't yet implemented a queue that creates events cache in the offline status and tries to upload them at a later time.

zeekoe commented 10 months ago

Hi strukturart, thanks again. Today I finally had the time to dive deeper into this. I need some fixes for my recurring items (with probably strange / unusual settings :)) and I wanted to make them myself. I found out that you have a nice "run.sh" script that spins up a server after some npm magic.

I tried various browsers, also with "Allow CORS" extension enabled. Modern Firefox & Vivaldi still give CORS problems even with the "Allow CORS" extension. Waterfox gives a 301 on .well-known/caldav, and then a 401 unauthorized on the OPTIONS request on remote.php/dav. I tried two accounts with different passwords; both of them work well on the real device.

Could you tell me with what browser and additional add-ons / settings you bypass the CORS limitation?

strukturart commented 10 months ago

There is a special feature in KaiOS, please read this article: https://kaios.dev/2023/02/advanced-kaios-development-cors-tcp-sockets-and-lets-encrypt-ssl-certificates/

zeekoe commented 10 months ago

Thanks! So I understand it is not possible to test/debug Nextcloud syncing on a Desktop machine, and I need to do this on my phone?

strukturart commented 10 months ago

Due to CORS restrictions, I would test it on your phone

strukturart commented 10 months ago

What you can do locally, however, is subscribe to a public calendar with greg, which also works without KaiOS.

strukturart commented 10 months ago

@zeekoe were you able to test it?

zeekoe commented 10 months ago

Thanks. I don't make use of such a calendar currently, and it's my "own" calendar that gives odd results in greg. So I need to find time to isolate the problem, or do a deep-debug session. I'll let you know. Thanks a lot for all of your help!