Xzandro / sw-exporter

This tool will parse intercepted data from Summoners War and extract information on the monsters and runes of the user.
Apache License 2.0
414 stars 194 forks source link

[FEATURE] Support multiple SWARFARM accounts #357

Closed Lyrex closed 3 years ago

Lyrex commented 3 years ago

Summary Since the SWARFARM plugin is currently updated, this might be a good time to add support for synchronization of multiple SWARFARM accounts.

Detailed description Some of SWARFARMs endpoints require an API key to be able to upload or update the profile. Currently this is implemented by SWEX having a single configuration field that takes an API key. This assumes that all commands that SWEX captures belong to one wizard_id and that the entered API key belongs to a SWARFARM account that is linked with the same wizard_id. In order to be able to support multiple accounts, we would have to store (and be able to configure) pairs of wizard_id and api_key. I'm not sure on how this could be implemented in a user-friendly manner.
The simplest way would be to have a seperator-delimited list which contains all information necessary.
Example: "123456:098f6bcd4621d373cade4e832627b4f6;78901:74f6904bb8dede5f8eaddcc20a2a31ce"

That seems far from user-friendly but would work as a MVP. A next step could be a something along the lines of a two-column table where the first column is wizard_id and the second column is api_key. If we wanted to make it super user friendly, we could grab the name of the Summoner from the hub_user_login command, display that along the plain wizard_id and add some kind of popup-like "setup wizard" that would just require the user to enter api_key that belongs to the name they clicked on.

Expected behavior There should be a way to configure SWARFARM api_key's together with their linked wizard_id.
Every interaction with SWARFARM should do a lookup that retrieves a api_key from a KV-pair from the configuration store and use that for the SWARFARM API authentication.

QuatZo commented 3 years ago

I think that's really good idea, if implemented wisely. It adds the support for alt accounts, without a need of changing Swarfarm structure to handle multiple profiles per account. It may not be the best for users, since they need to switch accounts on Swarfarm between them, but it's still better than doing Full Import or changing API Key in Swarfarm plugin every time they want to change Swarfarm profile or account respectively.

Xzandro commented 3 years ago

This is already possible. Setting textareas support JSON data. The SWARFARMN plugin also has support for objects as well, so things like { "12345678": "19fc64e770084cafac2e2494d6cc0aec", "87654321": "36443dd2e6ad422dad433292b18efa5e" } should already work.

Closing for now, if you have additional feedback or in case there is something missing we can discuss it here and I will potentially reopen.