This commit introduces a new PUT endpoint `/api/v1/config/normalsub/edit_subpath`
to allow modification of the NormalSub service's subpath.
- Added `EditSubPathInputBody` Pydantic model for request validation.
- Implemented the API endpoint in `normalsub.py` router, calling the
corresponding `cli_api.edit_normalsub_subpath` function.
- Includes error handling for validation and general exceptions.
- Added `edit_normalsub_subpath` function to `cli_api.py` to
interact with the `normalsub.sh edit_subpath` command, including
input validation for the new subpath.
- Updated the `normal-sub` command in `cli.py`:
- Added 'edit_subpath' as a valid action.
- Introduced a '--subpath' option for specifying the new path.
- Modified the command logic to call the new API function when
the 'edit_subpath' action is selected.
This commit introduces a new 'edit_subpath' command to the
normalsub.sh script. This allows users to change the SUBPATH
variable in the .env file and automatically restarts the
hysteria-normal-sub service to apply the changes.
- Replace cron jobs with a systemd service for better reliability
- Add file locking mechanism to prevent conflicts on users.json
- Schedule traffic status updates every minute with proper error handling
- Maintain 6-hour backup schedule with independent lock management
- Add comprehensive logging for easier troubleshooting
This change resolves issues where system updates or other programs
would cause conflicts with the traffic monitoring process accessing
the users.json file simultaneously.
Modifies the Telegram bot's 'Add User' functionality.
After adding a user, the bot now attempts to retrieve and display
the Normal-SUB subscription link and its QR code if available.
If Normal-SUB is not found, it falls back to showing the direct
Hysteria2 IPv4 URI and QR code. The direct URI is also provided as a
fallback if Normal-SUB is shown.
Usernames are quoted in CLI calls
for robustness. Improved input validation for username, traffic,
and expiration days.