feat: add optional sleep time feature to webhooktimer#2
Merged
XHyperDEVX merged 1 commit intomainfrom Mar 28, 2026
Merged
Conversation
Add optional sleep time feature - a time period during which webhooks won't be triggered even if timer expires. Changes: - Add SleepTimeStart and SleepTimeEnd fields to TimerEntry model (HH:MM format) - Update SQLite database schema with new columns - Add isSleepTime() helper to check if current time falls within sleep window - Handle sleep times that span midnight (e.g., 23:00-06:00) - Use Europe/Berlin timezone for time calculations - Update all SQL queries (Create, Update, Toggle, StartAll) - Add UI in timer modal with checkbox toggle and time inputs - Update JavaScript to handle sleep time in form submission and editing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added optional sleep time feature to webhooktimer - a time period during which webhooks won't be triggered even if timer expires.
Changes Made
Backend (Go)
internal/models/timer.go: Added two new fields to TimerEntry struct:
SleepTimeStart- Start time in HH:MM format (24-hour)SleepTimeEnd- End time in HH:MM format (24-hour)internal/models/db.go: Updated SQLite schema to include:
sleep_time_startTEXT columnsleep_time_endTEXT columninternal/timer/manager.go:
isSleepTime()helper that checks if current time falls within sleep windowparseTime()helper to parse HH:MM stringsrunTimer()to skip webhook execution during sleep timeinternal/handlers/handlers.go:
Frontend (HTML/JavaScript)
Usage
Powered by CTO.new