Skip to content

Conversation

@NiXTheDev
Copy link
Contributor

  • Setting to set a 404 image
  • Fix some sql injection possibilities via prepared statements
  • Fix other misc stuff
  • Allow using a local server(default to api.telegram.org)
  • Config instructions in readme
  • Cleaned up unused imports

NiXTheDev and others added 30 commits December 27, 2025 13:56
- Add @std/log package for structured logging
- Create centralized logger utility in utils/logger.ts
- Replace all console.log/error calls with appropriate logger levels
- Update error messages to use logger.error
- Update info messages to use logger.info
- Update debug messages to use logger.debug
- Update warning messages to use logger.warn
- Refactor models/user.ts to use withDB helper
- Refactor models/gad7_score.ts to use withDB helper
- Add updateGadScore, deleteGadScore, getAllGadScoresByUserId functions
- Refactor models/entry.ts to use withDB helper
- Refactor models/journal.ts to use withDB helper
- Refactor models/journal_entry_photo.ts to use withDB helper
- Improve error handling consistency across model functions
- Remove manual database open/close operations
…fix typos

- Fix excessive non-null assertions (!) in main.ts and handlers
- Add ctx.from and ctx.chatId guards for safer access
- Replace ctx.from?.id! with safe checks and error messages
- Replace timestamp and id assertions with null coalescing
- Add comprehensive date input validation in handlers/register.ts
  - Validates YYYY/MM/DD format
  - Checks date existence
  - Validates minimum age (13 years)
  - Validates maximum age (120 years)
  - Validates dates not in future
- Remove commented-out dropOrphanedSelfies function
- Remove unused import comment in main.ts
- Fix typos: questionaire -> questionnaire, guage -> gauge,
  immediatly -> immediately, Anxietey -> Anxiety
- Update import of questionaireKeyboard to questionnaireKeyboard
- Add MAX_FILE_SIZE_BYTES constant (10MB limit)
- Add file size validation in handlers/new_entry.ts for selfies
- Add file size validation in handlers/new_journal_entry.ts for photos
- Update handlers/set_404_image.ts to use MAX_FILE_SIZE_BYTES constant
- All 32 tests pass (4 kitty engine tests require --allow-net)
- Format code with deno fmt
- Add outer try-catch blocks to phq9_assessment and gad7_assessment
- Fix remaining ctx.chatId! non-null assertions in gad7_assessment
- Add consistent error logging with user ID for database operations
- Standardize error messages with ❌ emoji for failures
- Add nested try-catch for reply errors in outer handlers
- All 32 core tests pass (4 kitty tests require --allow-net)
- Fix SQL injection vulnerability in user.ts (use parameterized queries)
- Simplify userExists function using COUNT instead of EXISTS + loop
- Improve error messages with specific context (user ID, entry ID, etc.)
- Add proper logging for database operation failures
- Ensure all error messages include relevant identifiers
- All 32 core tests pass
- Fix typo: processs -> process in set_404_image.ts
- Improve date validation message for clarity
- Update age validation message for clarity
- All 32 core tests pass
Copy link
Owner

@CodeCanna CodeCanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HOLY CONTRIBUTIONS BATMAN!! Thank you so much for all of your contributions to this project. They are most welcome and appreciated. FOSS for the win!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you forget to add this to .gitignore? :3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likely, but then we need to gitignore all images

Copy link
Owner

@CodeCanna CodeCanna Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I would think we would ignore all images in the custom 404 image directory because those are dynamic user settings, then we can set the default 404.png in /assets to a more neutral image?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I suppose so, though I we need a separate location for the default

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I'm not sure if I'm doing something wrong, but the bot won't run on my laptop after merging the changes. I can see all of the tests passed in Github so that's why I think it's something I'm doing. I'm getting

error: Import "@std/dotenv" not a dependency and not in import map from "file:///home/awesomepilot/Documents/programming/deno/jotbot/main.ts"
  hint: If you want to use the JSR package, try running `deno add jsr:@std/dotenv`
    at file:///home/awesomepilot/Documents/programming/deno/jotbot/main.ts:2:22

When I add that dependency I get

error: Uncaught SyntaxError: The requested module '../constants/strings.ts' does not provide an export named 'telegramDownloadUrl'
import { telegramDownloadUrl } from "../constants/strings.ts";

Am I doing something wrong here? To be honest this is the first time someone has contributed to one of my projects like this, so I could be missing something. If all of your tests passed it should run for me, before I started making changes I thought I should ask.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how that happened, but i am already working on a fix

@CodeCanna CodeCanna merged commit c32ecb2 into CodeCanna:main Dec 27, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants