Hi there, asking for some clarfications:
1.form the task description “Setup sqlite for storing auth data.” where this db has to be hosted? CapRover in the app list has no available sqllite alone, hovewer there is N8N.io and some other sql variations
2. “Read Discourse API token from Env variable.” to get discourse api token I need an access to admin panel. But when I’m logged to service I don’t see any admin panel
Ad1. Sqlite is just a file, doesn’t need a separate db server. I chose it specifically to make deployment easier
Ad2 I’ll send you the token in DM
well, so when a user fill the form, telegram bot is sending a msg to him, like on this screen. from the task: “Then the bot sends a discourse message to that username with a unique link. Clicking it will save the user id and telegram chat id in sqlite for later use.”
how this link should looks like? should be included in this message, like “hello user, link”? how all of this is related to discourse?
We can make the exact text of that configurable in the future. For now let’s make it a:
Here's your link to authenticate you with discourse
notifications bot - https://...
The goal of the auth process it to give a user an ability to tell the bot which discourse account is theirs. Clicking the link is proof of ownership of that account. This way you won’t be able to maliciously subscribe to some other person’s discourse notifications on Telegram
link to caprover instance? like https://discourse-telegram-bot.cap.sealcode.org/confirmation
and after clicking the link, bot shall send back user name and telegram chat id?
yep!
I guess it’s not necessary to send it back to the user at this point. Just store it in the sqlite db so we later know which telegram account to send the notificatoins for that discourse user to
what about UI? e.g the authentication form, what to use for styling and the structure? I could try to use some of our libraries, or I can use some templates library for nodejs
The UI can be just an unstyled form handled with express. No need for anything fancy here at this stage
to cr D1399
Sent my comments to D1399
fixed D1399, however I’m still not sure what about endpoints, how to setup and test them
Endpoints are express routes. Please let me know what kind of assistance you need to unblock you
What to test? this endpoint https://discourse-telegram-bot.cap.sealcode.org is not working untill I deploy app, I locally work on http://localhost:3000. does it make a sense to test localhost endpoints?
It does! You can at least monitor if the GET endpoint is returning a valid HTML form, etc. Even if the app in tests is not actually connected to a bot/discourse API, you can still check if filling the form leaves the proper traces in the database, or you can even setup spies (Spies - Sinon.JS) to see what http requests are sent by the backend
arc tests are suspended, like 5 min so far, when my tests are passing
ziomek@ziomek-HP:~/Documents/sealcode/discourse-telegram-bot$ arc diff --update D1399
Launching editor "editor"...
Update the revision comments, then save and exit.
Linting...
OKAY No lint messages.
LINT OKAY No lint problems.
Running unit tests...
It looks like some open port not being closed at the end of tests, maybe? Please submit a new diff with arc diff --update D1399 --nounit
, so I can take a look
From now on it actually might be good to always supplement any questions with a diff, so it’s easier to debug
so I did now D1399
When running npm run tests-reports
(the command that arc is set up to run to get tests result), the output seems to loop a telegram bot error:
Try investigating why this might be the case.
Also, I’ve left a comment on the diff - about probably something you already knew, but I added it anyway for the sake of it
I may know, when arcanist run tests, it does not have access to env with telegram bot token, so it fails, but it works locally cuz I have access to env token. So I can not push tests that includes telegram bot
u I updated diff, now I don’t see any error, but tests are suspended the same as previously