memen45 / SubMusic

Sync music and podcasts to your Garmin watch from your own SubSonic or Ampache server
GNU General Public License v3.0
120 stars 13 forks source link

Save button in settings is unresponsive #44

Closed Adito5393 closed 2 months ago

Adito5393 commented 2 years ago

I have tried older versions of your app and I could simply config the server info via the Garmin Connect IQ. Now, when I plug in all the info & I try to press save... nothing happens. I try to go back, but the popup shows up that I will discard the changes...

Did you change anything in the UI on the latest releases?

What I tried already:

  1. Instead of copy & paste the info... manually type it via a mouse and keyboard attached to the phone. Strange that the tooltip shows share when I hold the mouse on the Save button: photo5996810798590179804

  2. Different API keys from Nextcloud

  3. Both API options: Subsonic and Ampache

  4. Uninstall app & reboot Garmin watch & try it again

Any idea how to debug the issue? Can you reproduce the issue? Just try to change your settings and save them.

Software info

SubMusic Updated: March 30, 2022 && Version: 0.1.24-yankee My phone info: S10e Android 10 One UI 2.5 Garmin watch: 745 Garmin Connect IQ version: 2.15 Nextcloud version 22.2.6

memen45 commented 2 years ago

Cannot reproduce, I can change and save settings without issue. Connect IQ on Android 11, version 2.15. SubMusic v0.1.24-yankee.

Adito5393 commented 2 years ago
  • are you connected with the watch? (Green 'my device' tab)

Yes

  • maybe try to remove cache/storage of both Garmin Connect apps?

Good idea. It does not work. I cleared cached, allowed the app all permissions (incl. storage), force stop & start..

  • is the device completely synced with your phone?

Yes, from both apps: Garmin connect and the IQ app.

Can I modify these settings via a file located on the phone or the watch? Can you tell me the path to hack my way into it 😄

Thanks for maintaining the app!

Adito5393 commented 2 years ago

Without thinking much, I had a look at the reviews on the google app play store of the connect IQ app. Look what I found: connect-iq-feedback

It means that the issue is upstream and it would be nice if you can label this issue as known issue or something and I can keep track of it and let you know once it's fixed.

Since we both have version 2.15, I think the difference lies in the Android version which I have 10. Version 11 brings some changes to the storage permissions. Check this Garmin thread also.

Adito5393 commented 2 years ago

@memen45 Meanwhile, if it's not too much work it would be great if we can put the server settings within a file on the watch storage and the app would check if the file exists and load those settings.

I could work on a PR if you are willing to guide me and accept my work. Depending on how fast I can set up the environment to program and test the code 😄 , since I have limited time available.

memen45 commented 2 years ago

Connect IQ watch apps do not have access to the USB mass storage directly. Each app has its own encrypted storage that can only ever be used by that app. There is an exception for sideloaded apps. When an app is sideloaded, there will be a settings file in the watch storage that can be modified. Note that this file is binary, so it is a bit tricky to edit the strings, but it is possible.

Theoretically, I see three possibilities for updating the settings:

The problem with the second option is, it is quite difficult and unintuitive to input text on a watch. The problem with the latter option is security. It would require central (temporal) storage on e.g. a SubMusic server (which does not exist) and some secure way for the watch to retrieve the settings from the server. I can imagine a secure implementation of such a server:

There should be some protection against spam inputs. If the unique/random numbers are sufficiently large, I think the limited time between receiving the TOTP and the watch request would be sufficiently small for a brute force to be infeasible (would require more requests per second than a ddos).

In total though, this would be quite a project to build I think, but let me know your thoughts or ideas.

memen45 commented 2 years ago

Check this Garmin thread also.

Found this thread too, did you try to install the older versions of Connect and Connect IQ apps?

Adito5393 commented 2 years ago

I like the external SubMusic server idea because I know java programming and my work is around writing and maintaining java backend API servers (full DevOps: developing and deploying, hosting). However, I have little knowledge about frontend frameworks. Do we even need a client-based frontend?

We could use a framework to generate our source code for the frontend and backend based on our architecture. I read the docs of JHipster some months ago and I look forward to trying it out in a real-world application.

Regarding the implementation:

  • user goes to SubMusic webapp,

The webapp should allow users to register with an email & support login via 3rd party apps, e.g.: Github There are open-source projects that only handle that. E.g. keycloak

  • fills in the desired settings
  • fills in a random number generated by the watch app
  • send to server to store for e.g. 10 minutes,
  • receives the temporary unique identification number (like a TOTP) from the server
  • fills in the unique number on the watch

Indeed, each user should add a device -> pairing device to the account flow

  • the watch requests the settings json file from the server using the unique number + the generated random number

This would be the sync/update flow of the settings from the server webapp to the watch app.

This indeed is a whole project that could be up and running super fast if we use a framework to autogenerate all the source code. As long as we make sure that the server extra feature will never break the basic watch app functionally, this would be an awesome optional UI.

Found this thread too, did you try to install the older versions of Connect and Connect IQ apps?

I am using Connect app for other devices, e.g. bike computer, and I will not even try that to avoid future problems. My bike computer recently got a firmware update 😕

What do you think about JHipster? Have you ever heard of it?

I worked with Quarkus and I would love to try their blueprint (docs), instead of using Spring.

memen45 commented 2 years ago

Thanks for your comments! I really like the idea for adding account logins and storing the data on the server. I do not know JHipster and could not quickly determine the benefit it provides (visualisation + generation of database schemas?). Keycloak seems to be a very useful solution, but again, never used it, and for minimum viable product maybe not yet necessary.

In order to keep it simple (and deliver a minimum viable product) I think the server can be simplified to a

The server can simply remove the data after x minutes, or after the watch requested it.

For the account login solution: I now remember that the watch can also use OAuth to connect to a server. I have not managed to get that working yet (I was planning on doing OAuth on the music server). This OAuth feature could also be used to login on a SubMusic server through your phone. That would eliminate the exposure of the device id. The server should thus provide

I also thought of yet another solution: the android Garmin SDK can be used in a simple android app. The user can fill in the settings, then send it over Bluetooth to the watch. This requires the watch to be connected to the phone.

Currently, I would be inclined to the MVP solution. The server could be very lightweight (either generated, or C++, or e.g. expressjs). The webapp could be something simple in Vue + Bootstrap, quite easy to do for MVP at least.
Considering time, contributor friendliness and required hosting resources, what would be your preferred solution + technology choices?

Adito5393 commented 2 years ago

Indeed, JHipster would provide source code for the backend + the frontend based on our design diagram. In theory, it's great, but there are many things that can go wrong & we would be stuck with that generated architecture. -> I'm okey with skipping it :)

API design: (maybe we can draft it with endpoints & specs) I don't fully understand the user flow in connection to the 3 HTTP methods. Is there a type of diagram or user case flow that could help me better visualize the API?

Do you think it will be too much work if we try to draft the API in some tool? e.g. postman? Or if you are familiar with something else, I currently don't have a preference.

GET request - returns the html form page that can do the POST request and shows the id to fill in on the watch

Does this mean the user needs to fill in an id on the watch? Even though there is no keyboard input? Maybe just an confirmation would be enough from the watch side?

I have more experience with MVC (from java background), however, I can learn MVP if you think it will be faster to implement.

I could deliver the backend written in Java & hosted on heroku as a docker container. We don't need persistant storage because it can obtain the current settings from the watch storage.

Do you already own a domain for this project? Or should we look into a free option? (e.g. duck DNS?)

I would love to spend more time on the API design and in the end, offer it via the OpenAPI specs (auto-generated) HTML (check the swagger pet store example).

Upcoming 2 weeks I will be on holiday. Afterwards, I would have limited time available during weekends.