168 Commits
Author SHA1 Message Date
New Future 6f5984c588 fix(scheduler ): scheduler path and check (#550) 2025-08-16 01:20:09 +00:00
New Future 1463020411 fix(scheduler): 优化 Windows 打包和定时任务 and command executio… (#547)
* feat(scheduler): enhance Windows task scheduling and command execution handling
fix(install): update version fetching logic in installation script
test(scheduler): refactor tests to remove VBS script dependency and validate command execution

* feat(versioning): enhance version resolution logic and update release links in documentation

* feat(scheduler): improve DDNS command retrieval and set working directory for task scheduling

* test: update command assertions to handle list output and improve readability

* fix: update curl command to use progress meter in installation scripts and documentation

* fix: adjust packaging to include contents of .dist folder directly and update release notes for EXE warnings

* feat: add Windows app build and packaging steps to publish workflow
2025-08-13 17:02:44 +00:00
New Future b9bd2ab333 ci:update patch release 2025-08-11 12:37:31 +00:00
09af9a094d feat(install): 一键安装脚本 add POSIX-compatible one-click installation script with multilingual support and comprehensive testing (#546)
* Initial plan

* feat(install): add one-click installation script with multi-platform support

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* fix(install): address review feedback - POSIX sh compatibility, multilingual support, API proxy, and CI tests

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* fix(install): address feedback - simplify logic, update URLs, add OpenWrt testing, improve sudo handling

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* update scripts

* mv test scripts

* update test scirpts

* update tests

* fix tests

* fix ci

* update test

* fix tests

* set-ua

* fix tests in docker

* fix tests

* fix version

* fix version check

* fix tests

* fix proxy

* fix tests

* enhance download functionality with timeout and improved SSL handling

* update proxy validation to use a real release asset for improved reliability

* fix proxy

* fix download result code

* fix test proxy

* fix ertry

* fix retry

* info message

* update README and installation scripts to support remote URL and proxy configuration

* wget 兼容

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix libc detect

* fix beta check

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
Co-authored-by: New Future <NewFuture@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-10 18:11:22 +00:00
f7a92b3903 chore(lint): replace flake8 and black with ruff for unified linting and formatting (#544)
* Initial plan

* feat: replace flake8 and black with ruff for unified linting and formatting

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* refactor: use astral-sh/ruff-action@v3 for cleaner CI workflow

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* run format

* use fmt skip

* fix cloudflare

* fix cron

* fix cron

* fix fileio tests

* fix fileio tests

* fix cron

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
Co-authored-by: New Future <NewFuture@users.noreply.github.com>
2025-08-09 11:29:35 +08:00
6c24557505 feat(cli): add task subcommand for automated scheduled task management (#541)
* Initial plan

* feat(cli): implement task subcommand with cross-platform scheduler support

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* docs(cli): add task subcommand documentation

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* fix(cli,task): address review feedback - move task handler to cli, remove defaults, improve fallback status checking

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* refactor(task): convert TaskManager class to functions and handle task commands entirely in CLI

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* fix(cli,tests): remove handle_task_command from exports and rename test file

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* feat(task): add enable and disable commands for scheduled tasks

* add task tests

* refactor(task): simplify task command handling and update status retrieval

* update task

* test(task): update subcommand tests to assert exit codes and rename delete to uninstall

* Add unit tests for DDNS task subcommand functionality and enhance existing tests

- Introduced comprehensive unit tests for the DDNS task subcommand, covering help, status, install, enable, disable, delete, and argument handling.
- Added tests for file I/O operations in the ddns.util.fileio module, ensuring proper directory creation, file reading/writing, and error handling.
- Enhanced test coverage for task scheduling functions, including systemd and cron installations, with additional checks for argument handling.
- Updated existing tests to improve compatibility and reliability across different operating systems, particularly for path handling on Windows.
- Refactored task command building tests to ensure correct command generation with various argument types, including lists and boolean flags.

* refactor(task): improve command execution and path handling for DDNS tasks

* remove DEVNULL

* fix(task): ensure proper task interval handling and add sudo for task commands in test script

* add and fix tests

* fix lint

* refactor(cli): organize DDNS arguments into groups and improve task subcommand handling

* fix tests

* +x

* fix py2 and types

* rm sudo

* fix(tests): use sudo for task installation and uninstallation in test script

* update test command

* always force

* fix format

* docs: add task management parameters and usage examples to CLI documentation

* update log

* docs: update CLI task management instructions and examples

* fix py2

* fix task in python2

* fix lint

* refactor tasks

* update tests

* add schtasks-based task scheduler implementation and unit tests

* Enhance scheduler functionality and improve error handling

- Added a 60-second timeout to subprocess calls in BaseScheduler to prevent hanging.
- Improved error logging in BaseScheduler to capture command failures.
- Refactored CronScheduler to remove unnecessary variable initialization.
- Updated SystemdScheduler to handle PermissionError and provide user feedback for permission issues.
- Enhanced file I/O functions in fileio.py to return default values on exceptions.
- Improved unit tests for scheduler classes to ensure robust testing of functionality and error handling.
- Added lifecycle operation tests for SystemdScheduler to validate install, enable, disable, and uninstall processes.
- Ensured consistent status reporting across multiple calls in SystemdScheduler.
- Cleaned up test code for better readability and maintainability.

* fix lint

* Refactor scheduler command execution and enhance error handling in BaseScheduler and LaunchdScheduler tests

* fix tests

* Add unittest configuration to settings and improve SchtasksScheduler error handling

* Refactor code for improved readability and maintainability in various test files and the DnspodProvider class

* Refactor LaunchdScheduler tests for improved readability and error handling

* fix py2

* fix mac launchd test

* fix lint

* fix macos tests

* fix windows test

* patch readme

* update doc

* Update tests/test_scheduler_cron.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
Co-authored-by: New Future <NewFuture@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-07 17:58:43 +00:00
e66dcf0240 feat(config): 支持远程配置文件 add remote HTTP(S) config loading support (#539)
* Initial plan

* feat(config): add remote HTTP(S) configuration loading support

- Add URL detection in load_config() function to support remote configuration files
- Leverage existing ddns.util.http module for HTTP requests with proxy, SSL, and auth support
- Support embedded authentication in URLs (https://user:pass@host/config.json)
- Maintain full backward compatibility with local file loading
- Skip file existence check for URLs in config path validation
- Add comprehensive test suite with 16 test cases covering various scenarios
- Support all existing configuration formats including v4.1 providers format
- Pass proxy and SSL settings from CLI/environment to HTTP requests

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* fix(config): address code review feedback for remote config loading

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* docs(config): add remote HTTP(S) configuration examples and update README

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* fix(config): Python 2 compatibility and code structure improvements

- Fix Python 2.7 compatibility in test_config_file_remote.py:
  - Remove encoding parameter from open() function
  - Add proper try/except import for URLError (Python 2/3 compatibility)
- Extract proxy and SSL parameter extraction outside function call in config/__init__.py
- Move remote config example from main README list to CLI usage examples section

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* fix(config,docs): address PR feedback and lint issues

- Remove remote config from README feature list, add as example code instead
- Fix proxy_settings fallback chain in config/__init__.py
- Add HTTP response body logging in config/file.py and fix line length
- Add real integration test for https://ddns.newfuture.cc/tests/config/debug.json
- Fix all flake8 lint issues: remove unused imports, clean whitespace

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Update ddns/config/file.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(docs,test,build): update README.en.md, add real remote tests, and improve test skipping logic

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* feat(http): add default user-agent and fix lint issues

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* feat(http): implement default user-agent handling and update related tests

* feat(http): add default User-Agent handling in request function and enhance related tests

* fix(tests): update proxy handling in multi-config tests and improve user agent type check

* fix(http): add retry logic to remote config loading and improve error messages

* chore(tests): update test structure for multi-config functionality

* fix(tests): remove unnecessary CLI argument mock in multi-config test

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
Co-authored-by: New Future <NewFuture@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 01:46:01 +00:00
96b4ca2e0c feat(config): 支持多配置文件和多服务商 优化http support multi config/providers (#531)
* Initial plan

* Implement multi-provider and multi-config file support

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Complete multi-provider and multi-config support with comprehensive testing

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Address code review feedback: fix exit behavior, remove special env handling, fix log level

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Add object-with-configs array support for improved JSON schema validation

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Address code review feedback: simplify config path handling, remove load_config function, and improve debug provider logic

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Address final code review feedback: improve log handling, provider logging, and debug assignment logic

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Address final review feedback: simplify debug provider logic and remove array format support

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Fix lint issues: remove whitespace from blank lines and apply black formatting

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Implement schema v4.1 with multi-provider support using providers array format

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Address code review feedback: rename tests, use global log settings, simplify config logic, remove configs format support

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Fix lint issues and simplify complex functions to reduce cyclomatic complexity

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Address code review feedback: enhance config functions and inline simple logic

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Fix Python 2.7 compatibility and lint issues in test_config_schema_v4_1.py

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Simplify config logic, fix Python 2.7 compatibility, and improve code formatting

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Optimize config logic and enhance schema v4.0/v4.1 compatibility tests

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Update file.py

* Update file.py

* Update file.py

* Update file.py

* Fix critical bug in multi-provider config processing and clean up lint issues

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* fix

* 优化测试代码格式,移除多余空行并调整注释位置
* refactor: update HTTP request handling and improve error processing

- Refactored imports for better clarity and organization.
- Added custom HTTP error processor to handle all HTTP error status codes gracefully.
- Enhanced SSL certificate loading with additional paths for Windows.
- Updated test cases to use HTTP instead of HTTPS for testing endpoints.
- Added tests for handling HTTP 400 Bad Request and SSL auto fallback behavior.

* update http

* update docs

* refactor: enhance SSL handling in SSLAutoFallbackHandler for better compatibility

* add multi tests

* fix patch and add rename fileds

* refactor: update provider field naming in configuration tests for consistency

* update doc link

* fix encoding

* fix

* 清理编码问题

* fix 编码问题

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
2025-07-17 18:54:09 +00:00
New FutureandCopilot 0eea4c6850 doc(providers): all providers doc (#522)
* doc(providers): all providers doc

- Enhanced No-IP documentation with clearer authentication methods and examples.
- Added official links and improved parameter descriptions for No-IP.
- Updated TencentCloud documentation to streamline API key acquisition and configuration examples.
- Improved troubleshooting sections for both providers, including common issues and error codes.
- Standardized JSON configuration examples across both providers.
- Added schema validation reference in configuration examples.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-14 16:35:13 +00:00
New Future 458f354067 fix(http): fix and refactor http (#520)
* refact(http): simplify connection handling and utilize urllib's built-in redirect support

* refact(HttpResponse): 修改头部处理方式,支持不区分大小写的查找

* feat(ip): 添加SSL验证配置并优化HTTP请求处理

* refact(ip): 修改导入方式,优化模块结构

* fix error log tests

* fix tests

* revert: restore test_provider_dnspod.py to master state

* add noip tests

* 更新构建工作流,移除冗余的可执行文件测试;在HTTP请求测试中添加真实API请求和JSON响应解析的测试用例
2025-07-13 17:36:35 +00:00
New Future 485e6a3e26 Refact(config): 统一配置 (#506)
* Add unit tests for configuration loading and JSON handling

- Introduced comprehensive unit tests for the ddns.config.__init__ module, covering various scenarios for the load_config function, including configuration merging, error handling, and CLI integration.
- Created a new test suite for the JSON configuration module, validating loading, saving, and edge cases for JSON files.
- Removed outdated SSL configuration tests that are no longer relevant to the current implementation.

* feat(provider): add endpoint parameter to SimpleProvider and update user agent format
feat(cli): add endpoint argument to load_config
test(tests): add tests for endpoint handling and user agent formatting

* feat(doc): add comprehensive configuration documentation for DDNS system

* feat: Update environment variable handling and documentation

- Changed default values for DDNS_INDEX4 and DDNS_INDEX6 from "default" to ["default"] in env.md and json.md.
- Enhanced documentation for index4 and index6 to clarify handling of special prefixes (regex, cmd, shell) and their impact on splitting.
- Updated schema to reflect new default values and added support for custom API endpoints and SSL settings.
- Improved test coverage for environment variable handling, including special cases for proxy and SSL settings.
- Refactored tests to ensure proper handling of environment variables and their precedence over defaults.
- Minor adjustments to test cases for consistency and clarity.

* fix config and tests

* fix error

* fix tests

* fix tests

* fix

* Add comprehensive unit tests for configuration file loading

- Introduced a new test suite for the configuration file loading module, covering JSON and AST parsing, fallback logic, error handling, and various edge cases.
- Replaced references to `load_json_config` with `load_file_config` in existing tests to unify configuration loading methods.
- Removed the outdated `test_config_json.py` file as its functionality is now covered in the new test suite.

* Fix test_load_config_priority_order mock parameter names for clarity

* Add main entry point for test execution in configuration tests

* Enhance Config class to flatten single-element lists and improve configuration loading tests

* fix tests

* update tests

* fix: 修复类型注释以支持 None 类型并更新测试用例描述

* fix lint

* fix py2.7

* feat: 添加对51dns和aliesa的支持,并更新SSL参数处理

* Refactor unit tests for configuration modules

- Updated test descriptions to specify the ddns.config.env and ddns.config.file modules.
- Removed redundant comments and improved clarity in test cases.
- Consolidated test cases for loading configurations from various sources, ensuring better readability and maintainability.
- Enhanced edge case handling and validation in load_config tests.
- Improved assertions and mock setups for better accuracy in testing configuration loading behavior.

* fix unicode_literals

* fix lint and tests

* fix tests

* fix py2 tests

* fix tests and update doc

* fix py2.7 test

* fix py2 patch

* 更新配置文件加载器,修复编码问题

* fix encoding for py2

* 更新 get_ip 函数参数,修改文档以支持阿里云ESA和No-IP自定义端点,添加多个DNS服务示例

* Refactor documentation for DNS providers:
- Updated DNSpod documentation by removing redundant configuration examples and enhancing the complete configuration example.
- Added English and Chinese documentation for HE.net (Hurricane Electric) with detailed configuration steps and troubleshooting tips.
- Introduced English and Chinese documentation for Huawei Cloud DNS, including access key authentication and endpoint configuration.
- Enhanced No-IP documentation by clarifying authentication methods and providing comprehensive configuration examples.
- Improved Tencent Cloud DNS documentation with additional endpoint options and detailed permission requirements.

* Add documentation for new DNS providers and update existing provider guides

- Introduced Debug Provider documentation in both English and Chinese.
- Added DNS.COM configuration guide in English and Chinese, including authentication methods and troubleshooting.
- Updated DNSPod documentation to include separate guides for DNSPod China and DNSPod Global, with detailed configuration examples.
- Revised HE.net documentation to streamline configuration examples and optional parameters.
- Enhanced Huawei Cloud DNS documentation with clearer endpoint selection and optional parameters.
- Updated No-IP documentation to clarify authentication methods and response codes.

* Fix stdout and stderr encoding in test setup for compatibility with non-UTF-8 systems

* Update environment variable documentation to remove dot-to-underscore conversion

* Refactor configuration loading and error handling in ddns.config module

- Removed logging in favor of direct stderr/stdout output for error messages.
- Simplified the configuration generation logic in load_config.
- Enhanced error handling for missing configuration files and invalid formats.
- Updated unit tests to reflect changes in output handling and error scenarios.

* update config document

* fix lint

* 更新 Python 配置文档,添加 GitHub Copilot 使用指南和配置生成逻辑,优化配置加载流程

* Refactor Config class to replace dict() method with md5() for generating hash of configurations; update tests to reflect changes in default values and utility methods.

* Enhance environment variable handling in load_config function; prioritize DDNS_PROXY over standard proxies, and improve test coverage for proxy configurations and environment variable management.

* 添加缓存模块及其测试用例,支持文件缓存功能;新增调试和回调配置文件,更新构建工作流以测试不同配置

* rename

* 优化测试用例以确保在空配置情况下正确退出;使用临时目录避免干扰

* fix env test
2025-07-12 11:04:25 +08:00
New FutureandCopilot 3d155b671e Refact(tests): improve base ,test, and instructions (#503)
* refactor(domain): Replace _split_custom_domain and _join_domain with standalone functions

* docs: Add contribution guidelines and repository structure documentation

* fix(tests): Skip real HTTP integration to avoid too much request

* fix(tests): Add retry logic for real callback tests to handle transient failures

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(tests): Implement retry logic for provider.set_record calls in real integration tests

* fix(tests): Update CI environment checks for real integration tests on macOS and other platforms

* Update tests/test_provider_cloudflare.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-03 19:14:03 +08:00
43fe2792c6 [feature] Add SSL certificate validation configuration support (#499)
* Initial plan

* Add SSL certificate validation configuration support

- Add --ssl CLI argument with options: true, false, auto, /path/to/cert.pem
- Add DDNS_SSL environment variable support
- Add ssl field to JSON configuration with default "auto"
- Integrate SSL config with provider initialization in main.py
- Update documentation in README.md, doc/cli.md, doc/json.md, doc/env.md
- Add comprehensive tests for SSL configuration integration
- Support configuration priority: CLI > JSON > Environment Variables

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Fix SSL config test linting issues and rename file

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Fix SSL config tests: Python 2.7 compatibility and improved state management

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* Fix SSL config test isolation and flake8 issues

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>

* fix workflow

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
Co-authored-by: New Future <NewFuture@users.noreply.github.com>
2025-07-02 11:24:31 +00:00
New FutureandCopilot f1a764d3c2 refact(provider): 巨大重构 (#484)
* abc

* update base

* update

* add doc

* dnspod class provider

* lint

* fix lint

* 类型检查

* add alidns

* cloudflare

* dnspod 国际版

* Update pyproject.toml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* update dnscom

* Update dnspod.py

* fix lint

* 提供兼容的encode 和 quote 方法

* huawei dns

* 名称兼容

* join domain

* static

* update base

* add callback

* update http

* fix and update hw

* merge

* refactor: reorganize imports and enhance logging in provider modules

* refactor: update method signatures to use None as default for extra parameters

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update ddns/provider/__init__.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* resolve comments

* update doc

* update doc

* using self logger

* update format

* Refactor config handling and update provider docs

Refactored argument parsing and config file logic in ddns/util/config.py for clarity and improved debug handling. Updated provider development documentation to clarify standard and non-standard DNS provider requirements and examples. Added 'print' as a valid DNS provider in the v4.0 schema and improved enum formatting for log options. Minor logging and message adjustments in ddns/__main__.py.

* Rename PrintProvider to DebugProvider and update references

Renamed PrintProvider to DebugProvider and updated all references in the codebase, including configuration defaults and schema. This change standardizes the provider naming and improves clarity by using 'debug' instead of 'print' for the default DNS provider.

* Add logger support to Cache and BaseProvider classes

Introduced logger injection for Cache and BaseProvider to improve logging consistency and flexibility. Updated main entry to pass logger instances, enhanced debug log formats, and fixed a documentation reference in provider.md.

* update callback

* fix lint

* Add and refine provider authentication validation

Introduces a _validate method to BaseProvider and its subclasses to ensure authentication credentials are properly set. Refactors CallbackProvider to simplify parameter replacement and validation. Adds stricter validation for CloudflareProvider, requiring a valid email for auth_id. Updates HTTP parameter handling in BaseProvider for improved query and body management.

* fix py2

* fix import

* fix dnspod and Improve logging and robustness in DDNS provider and utils

Enhanced logging throughout the DDNS provider base and main entrypoint for better traceability, including more informative log messages and additional warning/critical logs. Improved the robustness of domain splitting and zone ID resolution logic. Updated dnspod provider methods with doc links and fixed parameter handling. Refactored config to disable cache in debug mode, and standardized string quoting and regex usage in IP utility functions for consistency.

* Mask sensitive data in logs for URL and body

Introduced the _mask_sensitive_data method to obfuscate sensitive information such as authentication tokens in URLs and request bodies before logging. Updated logging statements to use this masking for improved security.

* Add unit tests for BaseProvider and update CI workflow

Introduces a test suite for BaseProvider in tests/test_base_provider.py and initializes the tests package. Updates the GitHub Actions workflow to run unit tests as part of the build process.

* Remove unused encoding parameter from _quote method

The _quote static method in BaseProvider no longer accepts the unused 'encoding' parameter, aligning its signature with actual usage and simplifying the code.

* Remove unused 'errors' parameter from _quote method

The _quote static method in BaseProvider no longer accepts the 'errors' parameter, as it was not used. The type annotation and call to quote have been updated accordingly.

* Refactor CallbackProvider and add unit tests

Refactored CallbackProvider to improve variable replacement and HTTP method handling in set_record. Added comprehensive unit tests for CallbackProvider covering initialization, variable replacement, HTTP request logic, and error handling. Minor cleanup in get_system_info_str to remove redundant comment.

* Rename and update provider test files, add DebugProvider tests

Renamed test_base_provider.py to test_provider_base.py and test_callback_provider.py to test_provider_callback.py for consistency. Updated imports and minor formatting in test_provider_callback.py. Added comprehensive unit and integration tests for DebugProvider in new test_provider_debug.py.

* he tests

* Refactor tests to use shared BaseProviderTestCase

Introduces a new test_base.py with BaseProviderTestCase to provide common setup and utilities for provider tests. Refactors test_provider_base.py, test_provider_callback.py, test_provider_debug.py, and test_provider_he.py to inherit from BaseProviderTestCase, reducing code duplication and improving maintainability.

* Improve test configuration and Python 2.7 compatibility

Added mock installation for Python 2.7 in CI and as an optional dependency. Enhanced pyproject.toml with unified unittest and pytest configuration, coverage, and flake8 settings. Added a comprehensive tests/README.md for running and writing tests. Refactored test_provider_base.py to use _TestProvider for clarity and consistency.

* fix py2 pip

* fix pip2

* install pip

* tmp dir

* Use PY env variable for Python 2.7 setup in CI

Replaces hardcoded 'python2' with the PY environment variable in the build workflow for Python 2.7. This improves flexibility and consistency in the CI setup.

* Add stub DNS record methods to DebugProvider and HeProvider

Introduces _query_zone_id, _create_record, _update_record, and _query_record methods to DebugProvider and HeProvider. DebugProvider raises NotImplementedError for create/update, while HeProvider returns False for these methods. This prepares both providers for a unified interface and future extension.

* fix debug

* fix tests

* fix typos

* fix id check

* callback 兼容python2

* add SimpleProvider

* fix

* fix lint

* remove duplicate code

* fix lint

* fix tests

* query with condition

* fix test for py2

* fix debug tests

* run ut in more system

* add unit tests for SimpleProvider and update README

* Refactor dnspod provider and add comprehensive tests

Refactored the DnspodProvider to improve record querying logic, parameter handling, and logging. Expanded the provider development guide with detailed instructions and best practices for both SimpleProvider and BaseProvider. Added a full-featured test suite for DnspodProvider, including unit and integration tests, and updated test documentation for improved clarity and usage instructions.

* fix type

* format

* Add unit tests for AlidnsProvider and CloudflareProvider

Added comprehensive unit and integration tests for AlidnsProvider and CloudflareProvider in tests/test_provider_alidns.py and tests/test_provider_cloudflare.py. Also updated type hints in set_record methods in ddns/provider/_base.py for better type accuracy.

* Add and update provider tests; fix datetime usage

Added comprehensive unit and integration tests for DnscomProvider and HuaweiDNSProvider. Updated test authorship to GitHub Copilot. Improved test structure and naming for SimpleProvider. Fixed datetime usage in alidns.py and huaweidns.py to use timezone-aware UTC. Cleaned up and clarified test README instructions.

* Use datetime.utcnow() for UTC timestamps

Replaced usage of datetime.now(timezone.utc) with datetime.utcnow() in AlidnsProvider and HuaweiDNSProvider to avoid deprecation warnings and ensure compatibility. Updated related tests to mock datetime.utcnow() instead of datetime.now().

* Add unit tests for DnspodComProvider

Introduces unit and integration tests for the DnspodComProvider class, verifying class constants, initialization, inheritance, API endpoint differences, and default line settings.

* feat: Add TencentCloudProvider and implement related unit tests

- Introduced TencentCloudProvider for Tencent Cloud DNSPod API integration.
- Updated existing provider classes to utilize datetime.utcnow() for consistent UTC timestamp handling.
- Refactored unit tests for AlidnsProvider, CallbackProvider, DnscomProvider, and HuaweiDNSProvider to use the new now() method for timestamp generation.
- Added comprehensive unit tests for TencentCloudProvider covering initialization, validation, signature generation, record querying, creation, and updating.
- Ensured compatibility with existing functionality while enhancing test coverage and reliability.

* fix tests

* always use the time

* fix TencentCloudProvider

* fix lint

* Add new feature to process user input

Introduced a function to handle and validate user input, improving the robustness of the input processing workflow.

* Update unit tests for various DNS providers

* Refactor test imports to use base_test.py for consistency across provider tests

* Enhance CallbackProvider and HTTP utilities

- Updated CallbackProvider to include User-Agent header in requests.
- Improved handling of GET and POST methods based on the presence of auth_token.
- Added a new HTTP utilities module for better HTTP request handling, including SSL verification and redirect following.
- Implemented comprehensive unit tests for the new HTTP utilities, covering various scenarios including SSL handling, redirects, and error responses.
- Added real integration tests for CallbackProvider using httpbin.org to validate actual HTTP interactions.
- Enhanced test coverage for SimpleProvider, including verification of sensitive data masking and initialization options.

* Refactor provider constants and response handling

- Changed class constants from CamelCase (ContentType, DecodeResponse) to snake_case (content_type, decode_response) for consistency across providers.
- Updated the default value of `verify_ssl` to "auto" in SimpleProvider.
- Adjusted the initialization of providers to accept `verify_ssl` as a parameter.
- Modified the handling of headers in HTTP requests to ensure `accept` and `content-type` are set correctly.
- Updated tests to reflect changes in constant naming and initialization parameters.
- Enhanced error handling in HTTP requests to provide more informative messages.

* Refactor unit tests to use MagicMock for improved clarity and consistency

* Enhance TencentCloudProvider with improved zone ID querying and response handling in unit tests

* Refactor HTTP callback handling and enhance error logging

- Improved error handling in CallbackProvider to log exceptions and empty responses.
- Introduced HttpResponse class to encapsulate HTTP response details, including status, reason, headers, and body.
- Updated send_http_request to return HttpResponse objects instead of raw response strings.
- Enhanced tests for CallbackProvider and send_http_request to validate logging and response handling.
- Added unit tests for HttpResponse and decoding response bodies with various character sets.

* Enhance TencentCloudProvider with improved header handling and signature generation in unit tests

* Enhance error handling and logging in DnspodProvider and TencentCloudProvider unit tests

* Enhance Python 2/3 compatibility in test_util_http.py with utility functions for string encoding and decoding

* fix py2 and time

* fix tests

* disable push build

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests/test_provider_cloudflare.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* update doc

* Refactor TencentCloudProvider methods to use consistent parameter naming for subdomains; update documentation for DNSPod provider authentication methods; enhance error handling in tests to return False instead of raising exceptions for non-existent records; improve masking of sensitive data in URLs; add tests for URL-encoded sensitive data handling.

* Add Callback Provider documentation and enhance DNSPod and Tencent Cloud guides

- Introduced a comprehensive documentation for the Callback Provider, detailing configuration, request methods, variable replacements, usage scenarios, and troubleshooting tips.
- Updated DNSPod documentation to include a link to Tencent Cloud DNSPod for better user guidance.
- Added a new Tencent Cloud DNS configuration guide in both English and Chinese, outlining authentication methods, configuration examples, optional parameters, and troubleshooting steps.
- Enhanced test cases for AlidnsProvider to validate signature generation and request handling, ensuring proper HTTP interactions and error handling.
- Improved error message validation in DNSPod tests to ensure clarity in authentication failure messages.

* Enhance documentation and validation for DNS providers; add Callback Provider configuration guide and improve error handling messages for Cloudflare, DNS.COM, HE.net, and HuaweiDNS providers.

* Update tests/test_provider_callback.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests/test_provider_dnscom.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests/test_provider_debug.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests/test_provider_he.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-01 19:08:11 +08:00
New Future 8e910b46e6 Update release.md 2025-06-24 09:15:28 +08:00
New Future b6215fb01c doc(release): 调整排版 2025-06-20 00:23:56 +08:00
New Future 57c357cbfa doc(readme): update docker platforms 2025-06-20 00:13:58 +08:00
New Future a1395ac4d2 ci: replace url for pypi 2025-06-19 10:44:30 +08:00
New Future ecee2bf644 Setup.cfg for py2 (#483) 2025-06-18 16:53:10 +00:00
New FutureandCopilot 860e601be5 fix(pypi): patch.py version (#482)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-18 21:33:13 +08:00
New Future 9e256de792 verbose 2025-06-16 18:43:02 +08:00
New Future 83b2bdd47f set fetch-depth for pypi 2025-06-16 18:39:24 +08:00
New Future cf66975105 fix(ci): fetch-tags in pypi 2025-06-16 18:35:45 +08:00
New FutureandCopilot baf1fdc30c refact(py): Refactor structure (#481)
* 目录结构重构
* update config
* rename dns to provider
* patch version info
* remove version replace
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* add ENV GITHUB_REF_NAME to docker build
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-16 01:41:34 +08:00
New Future c4dc2a9dc6 [skip ci] update release doc 2025-06-13 11:08:50 +08:00
New Future 287b2c39b7 next also for alpha 2025-06-13 10:22:44 +08:00
New Future 1f269c67b4 update docker tag 2025-06-13 10:19:46 +08:00
New Future 2fe1363203 fix build-nuitka-docker.yml 2025-06-13 00:39:49 +08:00
New FutureandCopilot d673108f77 chore(ci): 重构pipeline using prebuilt docker (#478)
* remove pyinstaller and use prebuilt docker
* Attest
* add prebuilt in production
* add lto
* auto add hidden modules
* add png

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix build

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-12 16:37:24 +00:00
New Future 5c11c6c6fa build(docker): improve prebuild container size (#477)
* update dockerfiles
* add runname
2025-06-12 17:59:04 +08:00
New Future 979cfedc8b rename 2025-06-12 09:18:42 +08:00
New Future cb01cf7f14 fix build script 2025-06-12 00:57:46 +08:00
New Future 5986c4eaad fix typo 2025-06-12 00:33:58 +08:00
New Future 03155759f6 fix 2025-06-12 00:21:45 +08:00
New Future e5279e2714 fix annotation 2025-06-12 00:16:42 +08:00
New Future 011f87e3f6 fix docker build args 2025-06-12 00:07:04 +08:00
New Future c6da7c23d2 rename 2025-06-11 23:59:37 +08:00
New Future d67d9f3e93 fix 2025-06-11 23:23:41 +08:00
New Future 932b49a8c6 fix permissions 2025-06-11 21:53:04 +08:00
New Future 8436e404fe rename and fix nuitka builder 2025-06-11 21:39:10 +08:00
New Future cdc5d35d93 build buitka builder 2025-06-11 21:16:51 +08:00
New Future 307db763eb fix typos in release doc 2025-06-11 07:00:41 +08:00
New Future 58601073f6 doc(release): 更新release文档 2025-06-10 16:56:18 +00:00
New Future 98e3b0e5f2 build(ci): extend build timeout 2025-06-10 21:07:01 +08:00
New Future f051cc9d40 build(bin): 统一Linux build python 版本,添加Glibc 支持 (#473)
* build(bin): glibc versions
* fix patch
* fix binary build
* use python3.8 for all linux and docker build
* fix encoding and tests
2025-06-10 12:10:32 +00:00
New Future de2792fb2c 恢复qemu build and tag 2025-06-09 17:45:36 +00:00
New Future 1606820cab update tag name 2025-06-09 17:30:37 +00:00
New Future aa6f1b136b push frist 2025-06-09 17:18:49 +00:00
New Future 6c1cfcef83 fix typos 2025-06-09 16:22:21 +00:00
New Future e7abe58537 fast test 2025-06-09 16:10:34 +00:00