xanthics / gw2craft

Driving force behind gw2crafts
http://gw2crafts.net
MIT License
68 stars 16 forks source link

Feature: Remember API Key #56

Closed RonStrauss closed 2 years ago

RonStrauss commented 2 years ago

I had an idea to add a QoL improvement to remember your used API keys.

The first idea that came to mind is to add autocomplete="one-time-code" to #api_key's attributes, located in MyPrint.py.

Another would be to add a <select> so the user could add associated information to each key. I'd be happy to do it if you don't mind.

xanthics commented 2 years ago

Currently looking in to it. Wasn't aware this was a browser feature

RonStrauss commented 2 years ago

Thanks for the quick reply 😃

Now that I think about it, username would be a more fitting property for the autocomplete.

I'm currently working on an implementation of the mentioned <select> method, using localstorage with javascript. Hope it will be useful for you 😄

xanthics commented 2 years ago

This implementation works with limited testing. demo at http://gw2crafts.net/demo.html -- lmk if that matches what you are looking for and I'll push my code/close this

    page.append('<br /><br /><iframe name="dummyframe" id="dummyframe" style="display: none;"></iframe><form id ="gw2apiform" target="dummyframe"><input type="text" id="api_key" name="gw2 api key" autocomplete="one-time-code" placeholder="Enter API key here" style=\'text-align: center;\'></form><br />')
    page.append('<button type="submit" form="gw2apiform" onclick="updateBank(document.getElementById(\'api_key\').value.trim());" style=\'text-align: center;\'>Get Bank Content</button>\n')

I've been in the slow/lazy process of rebuilding the site ( see https://gw2crafts.net/beta/armorcrafting.html ) but I don't know if/what that will go live.

RonStrauss commented 2 years ago

The rebuild looks great!

Doesn't seem to trigger an auto-complete prompt for me, for some reason. Maybe that's just on my end.

I'm sorry, just read the 'about' page and noticed you're against implementing localstorage, my bad!

xanthics commented 2 years ago

Doesn't seem to trigger an auto-complete prompt for me, for some reason. Maybe that's just on my end.

Tested on firefox and chrome, what browser are you using? image

I'm sorry, just read the 'about' page and noticed you're against implementing localstorage, my bad!

I'm fine with local storage, that was just a statement of the site at that time. The rewrite is going to use local storage for most recent api key (keep only 1 probably)

RonStrauss commented 2 years ago

Running latest chrome 101.0.4951.54, windows 10 (64-bit).

xanthics commented 2 years ago

Version 101.0.4951.67 (Official Build) (64-bit) here. Shouldn't make a difference with a feature this old.

To be clear, only the demo page has it implemented atm.

RonStrauss commented 2 years ago

Yes I'm trying it on demo.html, it's probably something on my end.

EDIT: It was something on my end, some flags in the experimental features. Consider this closed @xanthics 😃

xanthics commented 2 years ago

Excellent. I've pushed 8bdc143515d78f8cb2e6e78994e7fa36c8566df8 and am generating a set of guides that will include this autocomplete implementation.