Open browntownington opened 3 years ago
@browntownington that's a very good point and we have thought a lot about what would be the best approach here. The difference between pressing the icon and opening the extension is in the former, the alias is created immediately and we want to minimize the risk of conflict (i.e. if the alias already exists). That's why a random alias is picked in this case.
Great thanks the explanation @nguyenkims ! I guess there are two scenarios here: 1) new site and no alias exists : No problems since no alias exists it can be created without conflict 2) existing site where you may want to autofill email and alias already exists already.
But since simplelogin has catch-all function for custom domain where the simplelogin will create the alias the first time it received a mail.
Why does the browser addon even need to create the alias. Why not allow the first email from the sender to create the alias. This way you don't need to follow about complexities of adding an alias that may already exists. All the addon needs to do is look at the url TDL and autofill this with the custom domain appended.
Or have I missed something ;)
Ah not everyone has a custom domain and not all custom domains have the catch-all enabled :).
Now I see the conundrum @nguyenkims :)
Get current page name from TDL similar to how it's already done. Look up alias's for sender that contains the same name If match is found return alias address. If not found create it.
The issue with this is that you have to either have the addon back a call back every time you load a new website OR you have to wait for the callback to be made when you press the autofill button. The ideal solution would be if the addon was able to cache a copy of the alias database then perhaps then perhaps the callback could be local and thus also most instance when the autofill is selected.
I'm sure the team have already looked at this too. I'll keep thinking.
Thanks for the idea. I think the alias quick creation (aka pressing the icon) has a lot of room for improvement. It can never be perfect for all use cases though so we need to rather target the most common scenario, which is a user arrives on the website for the first time and just wants to quickly create an alias for this website. The alias should be easy to remember so having the website name in the alias is a good idea.
Thanks for the idea. I think the alias quick creation (aka pressing the icon) has a lot of room for improvement. It can never be perfect for all use cases though so we need to rather target the most common scenario, which is a user arrives on the website for the first time and just wants to quickly create an alias for this website. The alias should be easy to remember so having the website name in the alias is a good idea.
I was thinking about it could be possible to template this in the settings input,
const inputTemplate = 'foo.${domain}---my-vab_${host}.${domain}'; // The value of the input stored in settings
const variables = {
domain: 'mydomain.com',
host: 'myhost'
random: () => Math.random() // min/max length, inclusive bounds
} as const // define the variables that can be replaced
const result = inputTemplate.replace(/\${(.*?)}/g, (_, variable) => variables[variable] || '')
Using this style of code, the user can decide how they want the in browser generated button to create emails, you can also apply it to what is created in the extension window, which can be a separate setting.
It would essentially be a slim down version of https://github.com/janl/mustache.js (or it could just be https://github.com/janl/mustache.js)
When pressing the browser extension icon. Default new alias (if using custom domain) is current website @ custom domain. But when using the Simplelogin button for email field it only generates a random alias.