-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complex UI #32
Comments
|
As excited as I am about (2-b), I think the best way to move forward right now is to start with (3), and switch to (2-b) behind the scenes later (if the alternate configurator UI is functionally successful but just awkward to use). That does still leave open a question of whether any part of the data should be pre-populated, either (3-a) just public data (like calendar list info) or (3-b) private bot data (and so still requiring auth), or if (3-c) users would have to ask the bot for a dump of the data through Telegram to pass to the configurator (in addition to the dump the configurator gives them to pass back to the bot). (3-c) could be just a URL (if we can guarantee it fits within all browsers' limits), or might need to be a JSON file (extra awkward). The main benefit of (3-c) is that the configurator could be 100% client side, and so strictly live on GH Pages. It would also effortlessly handle privacy issues, as nothing that could be tied to any instance of metabot would be discoverable. |
The main blocker for me has been worrying about testing. I've poked around but haven't found anything that seems remotely as nice to work with as pytest (which has a couple plugins to use external JS test runners as if they were Python tests, but nothing as powerful as itself). @joetyson recommended https://jestjs.io/, which he said can both integrate with pytest and run headless (which is obviously important for things like headless continuous builds, but seems to be bizarrely rare—I thought testing to specific browser implementations stopped being a thing a decade ago :/). Honestly I'm tempted to try to find some decent JS parsing library and build my own test runner (which syntactically captures straightforward == assertions and such), but, bleh. Alternatively, just start building without tests (or only ones run manually), which is also bleh. |
So, if I do go the route of building my own test runner, Js2Py looks really neat (though this would still be a pretty huge undertaking). Another alternative would be to use something like pyjs to actually build the UI in Python (vaguely along the lines of—or perhaps even using [an extended]—MessageBuilder). All tests would remain 100% in Python, but the UI-building code would be "compiled" into HTML/JS (which would be assumed to be as correct as the tested Python source). |
Just to get unblocked, I'm going to experiment using (2-a), and just initially not have it be accessible on the production instance. This will be developed lockstep with the new |
Just to keep it dirt simple:
Next steps:
|
(See #93.) |
We're pretty well past the point where configuring the bot is awkward due to restrictions in Telegram clients' UI—#29 is a current example, but #31 will be a nightmare without some kind of WYSIWYG. Three alternatives:
Build a custom Telegram client. This could be a web app (either based on Webogram or a thin AJAXy wrapper over TDLib). It would go through the normal auth process to sign into the user's personal account, then either act as a full client with extra UI features (if based on Webogram) or only examine messages to metabot bots. This might technically violate section 1.3 of Telegram's API ToS.
Add a listening socket to metabot, letting admins pass messages to the bot from a custom client without going through Telegram. The actual web UI could be served over the socket or could be served from GitHub Pages and just set up CORS for the XHR endpoint. This shifts responsibility for authentication to us, but Telegram Login might be sufficient. (Revoking authentication might end up being impractical, but authorization could still be checked on every request.)
Build a web UI [on GH Pages] that just constructs a base64-encoded blob for the user to copy and paste into their Telegram client manually. This would be the easiest to implement, but would obviously be tedious (and error prone) to use (though less so—on both counts—than copying and pasting multiline strings, or trying to write Jinja2 templates by hand).
The text was updated successfully, but these errors were encountered: