84 Commits
Author SHA1 Message Date
d14594f14d feat(web): add local management dashboard (#718)
* feat(web): add local management dashboard

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

* fix(web): address review and Python 2 compatibility

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

* chore: remove design session artifacts

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

* fix(web): harden packaged resources and HTTP semantics

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

* test(web): support Python 2 handler mocks

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

* fix(web): detect all external schedulers

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

---------

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-11 18:23:17 +00:00
New Future 6f5984c588 fix(scheduler ): scheduler path and check (#550) 2025-08-16 01:20:09 +00:00
New Future 411764e1b5 filter out: bz2,csv (#525) 2025-07-15 11:13:24 +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 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 bdc9979c10 feat(log+doc): 增加log配置,完善文档 (#480)
* update log config

* add cli 文档

* update cli config

* add docker 文档
2025-06-13 13:48:15 +00: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 46918ef98d feat(config): 支持环境变量传递数组参数 Support array in environment variables and improve logic (#476)
* feat(config): 环境变量支持数组
* 简单参数支持‘,’分割
* fix typo and update doc
* 优化逻辑
2025-06-11 17:36:40 +00:00
New Future 55f47e195e fix python2 none unicode issues (#474)
* utf8-for-none
* 兼容python2
2025-06-11 12:28:28 +00:00
New Future 58601073f6 doc(release): 更新release文档 2025-06-10 16:56:18 +00: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 484b9701a5 build(docker): 优化build检查和push tag (#470)
* build(docker): 优化docker build检查

* docker publish tag

* remove qemu

* group docker build

* fix build

* test

* fix variant

* fix variantFlag

* fix upload
2025-06-06 12:21:14 +08:00
New Future 618f08ee7c feat(config): 优化配置文件加载逻辑,支持用户目录和系统目录 (#468)
* feat(config): Optimize configuration file loading logic
当前目录 config.json
用户目录 ~/.ddns/config.json
系统目录 /etc/ddns/config.json
2025-06-04 22:49:05 +08:00
New Future 9ed9223750 version 2025-06-02 17:40:48 +00:00
New Future da19b8c0c4 更新配置文件模式至v4.0 重构日志配置,(#465)
Break changes
* 移除调试模式,

* 添加日志级别和输出文件
2025-06-02 08:16:27 +00:00
New FutureandCopilot 4f82472c54 优化docker镜像 (#459)
* 删除重复库, 减少docker体积
* 首次失败自动停止
* python3 优先
* 怎加python2检查
* Nuitka/Nuitka-Action

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-28 17:13:13 +00:00
New Future 4260629751 docker build multi-arch (#457)
* full arch support: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x
* 启动立即执行一次 #451
break changes:
* 二进制 ddns 文件移到到 /bin/ddns #451
* 启动workdir /ddns
* 默认配置文件 /ddns/config.json
2025-05-27 09:14:27 +08:00
New Future 7cf577e858 using Nuitka for binary (#456)
* nuitka package binary

* update pipeline

* update test

* fix lint

* update build

* fix path

* imageio

* 兼容powershell

* update build

* update build

* lowercase

* fix build

* fix versiob build

* fix build
2025-05-27 00:21:47 +08:00
New Future 58ceb45d6c fix(run): remove legacy regex support and fix lint (#454)
BREAKING CHANGE:  regex must be start with `regex:` now
2025-04-09 19:46:34 +08:00
ZCTMDCandNew Future b7a6aee7d4 get_ip whith try/catch (#453)
* get_ip whith try/catch

* 去除多余代码

---------

Co-authored-by: New Future <NewFuture@users.noreply.github.com>
2025-04-09 19:24:08 +08:00
老周部落 530d14c35f fix(run): domain name uniformly lowercase to avoid problems (#433) 2024-04-06 23:06:46 +08:00
New Future 63bfc5a5b4 V3 (#423)
* fix lint

* 主版本移除python2支持
2024-02-14 17:01:18 +08:00
rxBit 4fcd03b4e0 fix: proxy config (#398) 2023-05-16 15:15:09 +08:00
LeadroyaLandNew Future a9f381e844 修复cache为False时的崩溃问题 (#389)
原先代码存在逻辑问题,在cache配置为False情况下仍然创建了Cache结构体,导致认为创建出的Cache对象是合法对象,析构时open(False)抛出异常。

Co-authored-by: New Future <NewFuture@users.noreply.github.com>
2023-04-19 18:34:46 +08:00
老周部落 a1a8f8565c feat(run): support custom cache file (#376)
* feat(run): support custom cache file

* fix cannot using C style conditional operator

* fix lint

* fix lint
2022-12-04 12:04:33 +08:00
老周部落andNew Future 60a3aa2669 feat(run): support add time when change dns record (#372)
* feat(run): support add time when change dns record

* fix function name

Co-authored-by: New Future <NewFuture@users.noreply.github.com>
2022-12-01 16:01:55 +08:00
New Future ecca03760f Replace version (#340)
* replace version

* rm Travis

* update badge
2022-07-28 18:34:33 +08:00
New Future 1c6bea688b build(matrix): multi-os in github actions (#336)
* build(matrix): multi-os

* fix(matrix): array

* fix(matrix): python cache

* add docker build in CI

* fix build

* fix pip arguments

* fix macos build

* use bash

* build all

* run.py

* allow fail

* test windows 10 py3

* debug

* test

* test

* fix encode in windows

* fix actions and format

* fix lint

* fix lint

* extend time
2022-07-26 21:41:55 +08:00
New Future edc9c8c511 fix lint 2022-07-12 13:22:03 +00:00
New Future 98f83c5997 feat(config): support environment variables 2021-06-14 11:53:45 +00:00
New Future 91a82eb244 feat(config): cli argument supports to set config 2021-06-14 08:39:04 +00:00
FerricIon a21a0d8857 Update run.py (#253)
thanks @FerricIon
2021-04-13 11:36:26 +08:00
空言andNew Future 0417d15e30 update systemd install script (#216)
* add systemd install script

* rename systemd script

* fix

* fix

* fix: update readme, python script

* Update systemd.sh

update

* Update systemd.sh

Co-authored-by: New Future <NewFuture@users.noreply.github.com>
2020-11-24 22:27:34 +08:00
NewFututre f126bf8f84 update cache #197 2020-09-07 22:08:22 +08:00
Yifan TongandNew Future e424df3729 feat(config): index4/6允许使用列表提供多个规则 (#188)
* feat(config): index4/6允许使用列表提供多个规则

* fix(config): 修改逻辑及schema

Co-authored-by: New Future <NewFuture@users.noreply.github.com>
2020-07-22 12:05:24 +08:00
NewFututre cb66a053da doc(readme): update readme and log 2020-03-24 18:40:09 +08:00
NewFututre 331b11c2f2 feat(ttl): support ttl and update schema #14 2019-11-09 14:37:25 +08:00
NewFututre e360ed61e6 fix(dnspod): UA #104 2019-11-02 21:18:53 +08:00
NewFututre 3f2a44b266 feat(run): 优化显示信息 2019-11-02 14:58:49 +08:00
NewFututre 593194fe93 feat(debug): show config path when debug 2019-11-02 14:49:44 +08:00
NewFututre 8f184468f9 fix(config): fix #104 dnspod.com 2019-11-02 01:49:22 +08:00
tongyifan c4d7b8cec6 fix(ip): 修复Python3中check_output返回类型为bytes导致的错误 2019-10-24 18:24:24 +08:00
NewFututre 65ec7baeea feat(ip): 支持自定义URL
* 更换默认IP提取API
* 支持自定义url `url:https:\\xxx.com`

#36 #85 #83
2019-09-15 15:27:17 +08:00
New f236dc5b50 feat(index): 使用命令行输入作为目标IP 2019-08-11 14:04:50 +08:00
New 9282b00e8e refactor(log): warning to warn 2019-05-04 03:03:38 +08:00
New 2b8389f4ec feat(cli): add short ‘-v’ for version 2019-05-04 01:52:46 +08:00
New a093cdb785 ci(tavis): date time 2019-05-02 14:16:26 +08:00
New e0b18e0bbd fix(pip): setup celan and version 2019-05-02 13:47:21 +08:00
New cd77e3f94a refactor(import): change import to import from 2019-05-02 04:17:14 +08:00
New af7d21e473 feat(cli): version & help info 2019-05-02 03:36:25 +08:00