Refactoring into TypeScript

Updating all the JavaScript code into TypeScript files, cleaning up with
modules and many more classes and better separation. Far from complete.
Auto-logon functional again

After the rewrite, the auto-logon feature is functional again. Nothing
of the UI works.