[codex] fix lan refresh and cron calendar semantics#34
Merged
zachyzissou merged 2 commits intomainfrom Feb 24, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes two LAN-focused issues: manual refresh reliability for LAN clients and correct cron scheduling semantics for day/month/day-of-week fields.
Changes:
- Extended local host detection to include private LAN/link-local addresses (not just loopback) for anonymous refresh authorization when
ALLOW_ANONYMOUS_LOCAL_REFRESH=true - Implemented full cron day-of-month, month, and day-of-week matching with standard OR semantics when both DOM and DOW are restricted
- Fixed JavaScript event handler to use
event.currentTargetinstead ofevent.targetfor reliable button state updates
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| web/assets/app.js | Fixed refresh button handler to use event.currentTarget for correct button reference |
| test_integration.py | Added integration tests for LAN host detection and cron day/month/dow scheduling |
| docker-compose.yml | Enabled ALLOW_ANONYMOUS_LOCAL_REFRESH=true for expected LAN default behavior |
| app/server.py | Extended _is_local_host() to include private/link-local IPs; implemented full cron field validation and matching logic including DOM/DOW/month semantics |
| TROUBLESHOOTING.md | Added token-based refresh example for when APP_REFRESH_TOKEN is configured |
| README.md | Updated configuration table to document CLI_BIN, ALLOW_ANONYMOUS_LOCAL_REFRESH, and APP_REFRESH_TOKEN |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
This PR implements the top two LAN-focused fixes from review:
Problem
1) LAN refresh reliability
The Web UI calls
POST /refreshwithout auth headers. Backend auth previously only allowed anonymous refresh from loopback (127.0.0.1/::1/localhost) when enabled, which caused refresh failures for users accessing the UI from other LAN devices.2) Cron calendar semantics
cron_nextaccepted full 5-field cron expressions but only matched minute/hour.day-of-month,month, andday-of-weekwere ignored, causing incorrect scheduling for non-trivial expressions.Changes
LAN refresh behavior
ALLOW_ANONYMOUS_LOCAL_REFRESH=true:::ffff:192.168.1.5)event.currentTarget, ensuring button state updates correctly regardless of click target inside the button.ALLOW_ANONYMOUS_LOCAL_REFRESH=trueindocker-compose.ymlfor expected LAN default behavior.Cron matching correctness
7->0for Sunday).DOM OR DOWwhen both are restricted).Regression coverage
cron_nexthandling of day/month/day-of-week constraints.Documentation alignment
CLI_BIN(actual env used by runtime, replacing outdated key name)ALLOW_ANONYMOUS_LOCAL_REFRESHAPP_REFRESH_TOKENValidation performed
python3 -m black app/server.py test_integration.pypython3 -m py_compile app/server.py test_integration.pynpm cinpm run -s lint:jsnpm run -s lint:mdValidation limits in this local shell
test_integration.py) is not runnable here because this host only has Python 3.9 available, while the project runtime requires Python 3.11+ (datetime.UTC). CI on PR validates against supported versions.