60 Commits
Author SHA1 Message Date
New FutureandFuture New 4e2b757f37 feat(branding): refresh DDNS logo and GitHub social cover (#740)
* feat(branding): refresh DDNS logo and social cover

* test(branding): pin reviewed asset exports

* test(branding): remove brand asset checks

* fix(cache): tolerate small filesystem clock skew

* docs(branding): correct cover license reference

---------

Co-authored-by: Future New (WEILAI LIU) <weilail@microsoft.com>
2026-09-13 22:38:36 +08:00
27f0f1c0ac fix: correct DNS sync results and configuration retention (#739)
* fix: correct DNS sync results and configuration retention

Keep address families independent, reject failed update responses, preserve complete IPv6 addresses, and retain Studio drafts and effective extra settings. Add offline regressions and wire Studio tests into documentation builds.

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

* test(provider): make disk cache regressions deterministic

Align the cache fixture wall clock and file mtime so Windows Python 3.12 clock granularity cannot turn a freshly saved cache into a future-dated file. Keep real disk reads, all cache assertions, production expiry policy and CI matrices unchanged.

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-09-06 12:45:46 +08:00
3c8578e9f4 feat(mcp): add Streamable HTTP transport (#736)
* feat(mcp): add Streamable HTTP transport

Add a modern MCP 2026-07-28 HTTP endpoint for standalone and Web modes, with shared listener configuration, authentication, schema, tests, and bilingual documentation.

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

* fix(tests): support Python 2 HTTP assertions

Normalize response header names and call handler methods through their underlying functions so the HTTP tests behave consistently on Python 2.7 and Python 3.

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

* fix(mcp): harden HTTP request handling

Validate mirrored request IDs, align Config Studio listener checks, bound socket reads, and accept the binary wrapper's documented SIGINT exit status.

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

* fix(mcp): align HTTP negotiation validation

Reject unavailable Accept media types by quality and keep schema host validation consistent with runtime listener checks.

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

* fix(tests): validate host schema behavior

Assert accepted and rejected host samples instead of comparing Unicode escape representations that differ on Python 2.7.

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

* fix(tests): avoid cross-engine schema regex

Keep the schema pattern contract without executing its ECMA-262 Unicode escape through Python 2's incompatible regex engine.

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

* fix(mcp): validate HTTP request boundaries

Reject empty tokens and malformed JSON-RPC request shapes, and keep Config Studio bracket validation aligned with runtime listener handling.

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

* fix(mcp): tighten HTTP input validation

Reject legacy notifications, nested host brackets, and document the required JSON content type so validation remains consistent across runtime, schema, and Config Studio.

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

* fix(mcp): validate Origin before method errors

Apply the existing Origin policy to non-POST MCP requests and return CORS headers for configured allowed origins.

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

* docs(mcp): clarify proxy Origin allowlist

Explain that browser clients behind TLS termination must allowlist the public HTTPS origin even when the public page appears same-origin.

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

* docs(mcp): add standalone server guide

Move MCP client setup, transports, tools, security, and protocol limits into dedicated Chinese and English pages with matching navigation and index links.

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

* fix(mcp): reject duplicate routing headers

Reject repeated MCP protocol, method, and name headers before body consistency checks across Python 2 and Python 3.

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

* fix(mcp): validate named request headers

Validate Mcp-Name for tools/call, prompts/get, and resources/read before dispatching unsupported methods.

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-23 21:36:26 +08:00
08837bbd09 feat(agent): define portable project development contract (#734)
Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-21 14:02:26 +08:00
6e3d3560c7 fix(http): bound external requests in CI tests (#726)
* fix(tests): handle endpoint timeouts in fallback

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

* fix(http): add configurable request timeout

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-15 22:23:27 +08:00
CopilotandNewFuture 2e2daa50be Fix dashboard cache reads with small Windows mtime skew (#723)
* Initial plan

* fix(web): tolerate small cache timestamp skew

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

* fix(web): reject future cache timestamps

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

* test(web): cover future cache timestamps

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

* fix(web): tolerate small cache timestamp skew

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

* fix(test_web): keep cache fixture unicode-safe on Python 2.7

Co-authored-by: NewFuture <6290356+NewFuture@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>
2026-08-14 17:50:59 +08:00
c919f2c6af feat(mcp): add dependency-free DDNS server (#722)
* feat(mcp): add dependency-free DDNS server

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

* fix(mcp): stop cancelled DDNS updates

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-13 17:25:47 +08:00
c30822bd33 test(e2e): cover source and binary workflows (#719)
* test(e2e): cover source and binary workflows

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

* fix(e2e): stop compiled process groups

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

* ci(build): limit ARM BuildKit parallelism

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

* revert: remove ARM BuildKit workaround

The builder image is being rebuilt to address the zstd allocation failure at its source.

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

* fix(e2e): use OS-assigned dashboard port

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-12 15:39:51 +08:00
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
e58daa0a80 feat(docs): add configuration studio (#712)
* feat(docs): add configuration studio

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

* fix(config): address PR review feedback

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

* fix(docker): avoid 32-bit Nuitka compression OOM

Disable onefile compression only for 32-bit BuildKit targets, where zstd can exhaust the process address space.

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

* revert: restore compressed Linux binaries

The builder image has been rebuilt with the previous working toolchain.

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

* docs: remove English configuration studio

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

* chore: remove product design artifact

Restore the English configuration studio that was removed by mistake.

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

* fix(docs): protect credentials in address sources

Treat URL userinfo in IPv4 and IPv6 detection sources as sensitive so previews, copies, downloads, and duplicated providers exclude it by default.

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

* fix(docs): preserve explicit empty tokens

Keep runtime-significant empty token fields in credential-free exports while continuing to omit non-empty secrets.

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

* fix(docs): export entered credentials

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

* docs(config): clarify special source splitting

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-08 11:09:51 +08:00
e102ce5039 fix(docker): prevent zombie process accumulation (#711)
* fix(docker): prevent zombie process accumulation

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

* fix(docker): forward signals to startup processes

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-08 01:05:22 +08:00
06fceed0f7 feat(cache): add configurable cache max age (#709)
* feat(cache): add configurable cache max age

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

* test(cache): cover cache max age integration paths

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

* test(cache): fix portable regression test formatting

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

* style(test): format cache max age run test

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

---------

Co-authored-by: Future New (WEILAI LIU) <weilail@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-06 17:59:40 +08:00
iCastureandNew Future e61bc6b474 fix(ip): honor fallback order for index4/index6 rules (#690)
fix(ip): continue rule fallback when a resolver returns no result

Refactor get_ip() to evaluate one rule at a time and only stop when a
usable address is found.

This fixes index4/index6 fallback chains where resolvers such as url,
public, regex, cmd, or shell could return an empty result and prevent
later rules from running.

Update tests to cover fallback across multiple rule types for both IPv4
and IPv6.

Co-authored-by: New Future <NewFuture@users.noreply.github.com>
2026-08-05 15:42:02 +08:00
93d4698ff7 feat(provider.west): add West.cn DNS provider support (#628)
* Initial plan

* feat(provider.west): add West.cn DNS provider support

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

* refactor(provider.west): address review feedback - remove LINE_MAPPING, implement domain fallback, update docs

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

* fix(provider.west): improve logging format for root domain

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

* Apply suggestion from @Copilot

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

* fix(provider.west): correct comment about domain parsing order and clarify error code handling

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

* refactor(provider.west): simplify domain not found check to use code=404

Co-authored-by: NewFuture <6290356+NewFuture@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>
2026-06-12 12:04:51 +00:00
Copilot 7490657d82 Use HTTP ipify URL in documentation examples (#694)
* fix(ip): remove unavailable ipify cn endpoint

* test(ip): avoid substring matching in fallback test

* fix(ip): remove unavailable ipw endpoints

* fix(ip): add ddnsip public endpoints

* docs: use http ipify URL in examples

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-12 19:51:59 +08:00
CopilotandNewFuture f26d50678f refactor(provider): optimize cloudns implementation and add documentation (#664)
* Initial plan

* refactor(provider.cloudns): optimize and simplify implementation

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

* docs(providers): add comprehensive cloudns documentation and update indices

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

* fix(provider.cloudns): change default TTL from 3600s to 60s

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

* fix(provider.cloudns): fix Python 2.7 compatibility with dict unpacking

Co-authored-by: NewFuture <6290356+NewFuture@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>
2026-01-28 13:55:57 +08:00
iclart 81840212e0 feat(provider.cloudns): add ClouDNS.net DNS provider support (#663) 2026-01-27 13:58:29 +08:00
Copilot 21539a6cb4 fix(config): create parent directories for log file automatically (#600) 2025-11-21 00:17:09 +08:00
f99fd8f0b3 feat(provider): add EdgeOne DNS provider for non-accelerated domain records (#588)
* Initial plan

* feat(provider): add EdgeOne DNS provider for non-accelerated domains

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

* docs(provider): add EdgeOne DNS documentation for non-accelerated domains

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

* fix(provider): update EdgeOne provider aliases per feedback

- Acceleration domains: edgeone, edgeone_acc, teo_acc
- DNS records: edgeone_dns, teo_dns, edgeone_noacc
- Removed: teo, tencentedgeone, neo_acc, neo
- Updated documentation to reflect new aliases

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

* feat(provider): add extra parameter support and update documentation index

- Add edgeone_dns to provider index documentation (README.md)
- Add "teo" alias for backward compatibility (not documented)
- Enable EdgeOneProvider to support both acceleration and DNS records via extra['dns_record'] parameter
- Update provider aliases and documentation

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

* docs: create comprehensive new-provider agent guide

- Add detailed step-by-step guide for creating new DNS providers
- Include API analysis, implementation, testing, and documentation steps
- Provide code templates and examples for both BaseProvider and SimpleProvider
- Add completion checklist and common pitfalls
- Document all requirements including compatibility checks and index updates

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

* refactor(provider): change extra parameter from dns_record to teoDomainType

- Change EdgeOneProvider to use teoDomainType parameter instead of dns_record
- Support values: "dns" or "acceleration" (default)
- Parameter is case-insensitive
- EdgeOneDnsProvider now uses extra parameter to control behavior
- All 55 tests passing

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

* refactor(provider): simplify EdgeOneDnsProvider with helper method

- Extract common extra parameter preparation into _prepare_extra() method
- Reduces code duplication across _query_record, _create_record, _update_record
- All 55 tests passing

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

* refactor(provider): make EdgeOneDnsProvider more elegant and concise

- Use class attribute _default_domain_type = "dns" for clarity
- Replace _prepare_extra() with inline setdefault() for more Pythonic code
- setdefault() allows users to override teoDomainType if needed
- All 55 tests passing

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

* refactor(provider): use options instead of extra for teoDomainType

- Move teoDomainType from per-call extra to instance-level options
- More appropriate since provider type is fixed per instance
- EdgeOneProvider reads teoDomainType from self.options at initialization
- EdgeOneDnsProvider sets teoDomainType="dns" in __init__
- Simplified implementation: 28 lines vs 43 lines for EdgeOneDnsProvider
- All 55 tests passing

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

* refactor(provider): support both extra and options for teoDomainType with priority

- Remove __init__ from EdgeOneProvider, read directly from self.options
- Support teoDomainType in both extra (per-call) and options (initialization)
- extra parameter has higher priority than options
- Priority: extra > options > default ("acceleration")
- All 55 tests passing

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

* docs(provider): add teoDomainType parameter documentation for EdgeOne

- Document how to switch between acceleration domains and DNS records
- Explain extra.teoDomainType parameter usage
- Add configuration examples for both modes
- Update parameter tables with teoDomainType and extra
- Document priority: extra > initialization parameter
- Add bilingual documentation (Chinese and English)

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

* docs(provider): remove initialization parameter config example from EdgeOne

- Remove the example showing teoDomainType via initialization parameters
- Only document usage via extra parameter
- Remove priority note since only one method is documented
- Keep recommendation to use EdgeOneDnsProvider for cleaner code
- Update both Chinese and English documentation

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

* docs(agent): update new-provider guide with relative paths and schema notes

- Update CLI compatibility note to mention checking --dns parameter choices
- Change schema note to only require v4.0 (latest format) updates
- Replace "multi-provider format" with "latest schema format"
- Convert all absolute paths to relative paths from project root
- Remove /home/runner/work/DDNS/DDNS/ prefix from all file paths

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

* docs(agent): correct latest schema version to v4.1

- Update schema compatibility section to reference v4.1 instead of v4.0
- v4.1 is the latest schema format that requires updates

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

* feat(config): add edgeone_dns to CLI and schema v4.1

- Add edgeone_dns to CLI --dns parameter choices
- Add edgeone_dns to schema v4.1 provider enum (both legacy and multi-provider sections)
- Update provider descriptions to include EdgeOne DNS

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

* Apply suggestions from code review

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

* Refactor labels_to_prompts_mapping format

* fix(provider): filter teoDomainType from extra params before API call

- Remove teoDomainType from extra dict before passing to Tencent Cloud API
- Fixes "UnknownParameter - The parameter `extra_teoDomainType` is not recognized" error
- teoDomainType is internal parameter for routing, not for API requests
- All 55 tests passing

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

* docs(provider): update schema references to v4.1.json in EdgeOne docs

- Update all $schema references from v4.0.json to v4.1.json
- Applied to edgeone.md, edgeone.en.md, edgeone_dns.md, edgeone_dns.en.md
- Ensures documentation references the latest schema format

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

* Changes before error encountered

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

* fix(config): preserve nested extra dict from JSON/ENV config

- Process "extra" dict before extra_ prefixed keys to avoid flattening
- Fixes issue where {"extra":{"teoDomainType":"dns"}} was incorrectly transformed to {"extra_teoDomainType":"dns"}
- Maintains backward compatibility with extra_ prefixed keys
- Priority: explicit extra dict > extra_ prefixed keys > unknown keys

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

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* Update tests/test_provider_edgeone_dns.py

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

* Update tests/test_provider_edgeone_dns.py

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

* style: apply ruff formatting fixes

- Format 9 files with ruff
- Fix 2 linting issues automatically
- One complexity warning remains (C901) but doesn't affect functionality
- All code now follows consistent formatting standards

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

* docs(agent): add ruff installation instructions to new-provider guide

- Add pip3 install ruff command before formatting/linting steps
- Ensures developers have required tools before running verification
- Prevents common setup errors

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

* docs(config): clarify extra dict and extra_ prefix priority within config sources

- Add comments explaining that extra_ prefixed keys override nested extra dict values within the same source
- Improves code documentation clarity for config flattening logic
- Addresses feedback about intra-source priority ordering

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

* refactor(config): reduce complexity of _collect_extra method

- Extract _process_extra_from_source helper method to reduce cyclomatic complexity
- Fixes ruff C901 error (complexity was 14, now under threshold)
- Maintains all existing functionality and test coverage
- All 60 extra-related tests passing

Co-authored-by: NewFuture <6290356+NewFuture@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-11-15 16:44:59 +00:00
CopilotandNewFuture ae5e9d0dc8 fix(config): exclude $schema from extra parameters sent to DNS APIs (#576)
* Initial plan

* fix(config): exclude $schema from extra parameters to prevent API errors

Co-authored-by: NewFuture <6290356+NewFuture@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>
2025-11-03 08:14:21 +00:00
CopilotandNewFuture aba52bc517 fix(cloudflare): DNS record query conditions - Boolean encoding and extra filter fallback (#571)
* Initial plan

* Fix Boolean values in URL parameters and add fallback logic for extra filters

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

* Add documentation for extra filter and fallback behavior

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

* docs: improve formatting consistency in documentation

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

* refactor: move boolean conversion to cloudflare.py and simplify _query_record

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

* chore: fix ruff linting issues and add format commands to copilot instructions

Co-authored-by: NewFuture <6290356+NewFuture@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>
2025-10-20 15:51:13 +00:00
CopilotandNewFuture d910a06fb7 fix(provider): ensure extra params take priority over old_record in _update_record (#566)
* Initial plan

* fix(provider): ensure extra params take priority over old_record in _update_record

- Fixed cloudflare.py: Changed priority order for proxied, tags, and settings
- Added comprehensive tests for all providers to verify extra parameter priority
- Tests added/updated: cloudflare, huaweidns, alidns, dnspod, dnscom, aliesa, namesilo, tencentcloud
- All 218 provider tests passing

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

* fix(test): use Python 2.7 compatible mock import in aliesa test

- Changed from `from unittest.mock import patch` to `from base_test import patch`
- This ensures compatibility with Python 2.7 where mock is a separate package
- All 218 provider tests still passing

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

* fix(test): replace unsafe eval() with json.loads() in tencentcloud test

- Replaced eval(call_kwargs["body"]) with json.loads(call_kwargs["body"])
- Using eval() to parse JSON is a security risk and bad practice
- json.loads() is the safe and proper way to parse JSON strings
- All tests still passing

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

* fix(lint): remove trailing whitespace from blank line in tencentcloud test

- Fixed W293 linting error on line 236
- Removed trailing whitespace from blank line after import statement
- All tests still passing

Co-authored-by: NewFuture <6290356+NewFuture@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>
2025-10-15 16:08:45 +00:00
80813a0714 fix(config): restore log.file configuration for v4.1 multi-provider format (#564)
* Initial plan

* fix(config): restore log.file configuration for v4.1 multi-provider format

The _setup_logging function was incorrectly using an empty dict for log settings
when there were multiple providers in v4.1 format. This caused log.file and other
log configuration to be ignored.

Changed the condition from:
  json_config = all_json_configs[0] if len(all_json_configs) == 1 else {}
To:
  json_config = all_json_configs[0] if all_json_configs else {}

Since all provider configs inherit the same global log settings in v4.1 format,
we can safely use the first config for logging setup regardless of the number
of providers.

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

* refactor(test): move sys and logging imports to module level

Move sys and logging imports from inside test method to the top of the file,
following standard Python import conventions and matching the pattern used
in other test files in the repository.

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

* Update ddns/config/__init__.py

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

* Update tests/test_config_schema_v4_1.py

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

* fix(test): fix Python 2.7 compatibility and linting issues

- Use logging.INFO constant instead of hardcoded 20 for Python 2.7 compatibility
- Remove trailing whitespace and fix blank lines with whitespace (W291, W293)

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

* fix(test): make log_level test compatible with Python 2.7

Use assertIn to check for multiple acceptable log_level values since
getLevelName behaves differently in Python 2.7 vs 3.x. The test now
accepts integer 20, logging.INFO constant, or string "INFO" to ensure
compatibility across Python versions.

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

* Update ddns/config/__init__.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-10-15 14:00:14 +00:00
1600e57aff feat(config): add support for extra configuration fields (#562)
* Initial plan

* feat(config): add extra field support to Config class

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

* feat(config): complete extra field implementation with documentation

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

* docs(config): add practical examples for extra fields usage

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

* fix(config): remove func from known_keys, delete docs, update schema

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

* fix(config): revert v4.0.json changes and fix lint/format issues

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

* Remove statistics option from ruff-action args

* Update ddns/config/cli.py

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

* fix(config): fix lint error and Python 2.7 compatibility

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

* fix(config): remove redundant extra unpacking in provider init

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

* fix(config): make set_record call Python 2.7 compatible

Co-authored-by: NewFuture <6290356+NewFuture@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-10-13 17:06:56 +08:00
New Future 6f5984c588 fix(scheduler ): scheduler path and check (#550) 2025-08-16 01:20:09 +00:00
CopilotandNewFuture 1e0f066684 feat(ip): implement automatic failover for public IP detection APIs with unified interface (#549)
* Initial plan

* feat(ip): implement automatic failover for public IP detection APIs

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

* docs: update documentation for public IP automatic failover feature

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

* fix(ip): address PR feedback - remove backward compatibility, merge tests, change IPv6 URL

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

* feat(ip): restore url parameter support in public_v4/public_v6 functions

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

* fix(lint): resolve whitespace and formatting issues in IP module

Co-authored-by: NewFuture <6290356+NewFuture@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>
2025-08-14 23:50:12 +08: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
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
New Future feb8911f90 fix(cli): new config default path (#542)
Update cli.py
2025-07-25 16:51:18 +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
c2cad12380 refactor(http.proxy): add "SYSTEM" and fix "DIRECT" proxy, implement proxy list support with automatic fallback (#537)
* feat(http): implement proxy list support with fallback mechanism

- Add proxies parameter to request() function for proxy list support
- Maintain backward compatibility with single proxy parameter
- Implement proxy fallback logic that tries each proxy in order
- Update provider base classes to use proxy lists directly
- Add comprehensive tests for proxy list functionality
- Support None in proxy list to represent direct connection

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

* fix(http): handle empty proxy list edge case and remove duplicate function definition

- Fix empty proxy list to default to direct connection
- Remove duplicate function definition in request()
- Add test case for empty proxy list scenario

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

* fix(tests): correct provider proxy list test mocking

- Fix provider test mocking to use HttpResponse objects
- All proxy list tests now pass correctly
- Provider integration tests verify proxy list functionality

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

* fix(lint): resolve flake8 issues - remove whitespace and fix indentation

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

* refactor(http): remove proxy parameter and implement ProxiesHandler

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

* refactor(http): implement ProxiesHandler based on ProxyHandler with proxy_open override

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

* refactor(http): remove proxy wrapper class and string compatibility per feedback

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

* refactor(http): implement ProxiesHandler with proxy_open override as requested

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

* refactor(http): update endpoint URLs to use HTTP instead of HTTPS for testing

* feat: Add support for proxy settings in configuration

- Introduced a new "proxy" property in the schema to allow HTTP proxy settings in various formats.
- Updated tests to validate the handling of proxy settings, including special values and array formats.
- Enhanced environment variable loading to support proxy configurations, ensuring precedence rules are respected.
- Added tests for multi-provider configurations with independent proxy settings and global proxy overrides.

---------

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-20 18:51:40 +00:00
254335f407 feat(http.retry): Add HTTP auto-retry with exponential backoff (#536)
* Initial plan

* Implement HTTP RetryHandler with exponential backoff and auto-retry logic

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

* Simplify HTTP module by removing send_http_request and streamlining RetryHandler

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

* Simplify HTTP retry logic and remove RemoteDisconnected exception

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

* fix: resolve linting issues in http.py

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

* refactor: streamline request handling and retry logic in HTTP utilities

* fix http

* refactor: enhance HTTP request handling with retry logic and improve test coverage

* fix py2

* refactor: remove unused URLError references and enhance retry logic in RetryHandler

* refactor: consolidate HTTP request tests and enhance error handling

* fix: fix unittest failures in HTTP retry logic

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

* refactor: optimize retry logic in RetryHandler and adjust test delays for error handling

* fix: enhance SSL error handling in SSLFallbackHandler for better certificate error management

* fix: update error handling in RetryHandler tests to use socket exceptions instead of URLError

* fix py2 tests

* fix

---------

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-19 04:31:15 +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
876889ed84 feature(basicauth): use URL-embedded authentication and remove base64 dependency (#528)
* Initial plan

* Remove base64 dependency and use URL-embedded authentication for NoIP provider

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

* Address review feedback: fix imports, endpoint parsing, add auth tests, format code

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

* Address all review feedback: simplify imports, move auth logic to _validate, add httpbin test

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

* Address review feedback: permanently update endpoint in _validate, add endpoint validation, improve httpbin test

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

* Address code review feedback: simplify endpoint logic, add protocol validation, enhance auth tests

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

* Fix linting issues and improve httpbin test - address review feedback

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

* Fix send_http_request to handle URL-embedded auth and improve httpbin test

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

* Replace manual base64 auth with HTTPPasswordMgrWithDefaultRealm and improve httpbin test

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

* Address review feedback: simplify HTTP auth logic and use special characters in tests

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

* Address review feedback: fix original_url bug, enhance httpbin test with proper encoding and error handling

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

* Fix Python 2.7 compatibility: import URLError from ddns.util.http instead of urllib.error

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

* fix auth

---------

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-16 17:10:15 +00:00
5e1a8d5aaf feat(provider:edgeone): 支持腾讯EdgeOne Add Tencent Cloud EdgeOne DNS provider support (#521)
* Initial plan

* Implement Tencent Cloud EdgeOne DNS provider

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

* Refactor EdgeOne provider to inherit from TencentCloudProvider and simplify API logic

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

* Implement EdgeOne provider according to official acceleration domain APIs

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

* refactor(provider:EdgeOne): streamline API calls and improve test coverage

* Update tests/test_provider_edgeone.py

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

* IP_DOMAIN upper case

* update comments

* fix: address EdgeOne provider feedback - update alias, logging, and add documentation

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

* fix: simplify response handling in acceleration domain creation and update

* update docs

---------

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-14 17:44:30 +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
22c9cf8d54 feat(provider:NameSilo):添加NameSilo支持(待验证) (#514)
* Implement NameSilo DNS provider with comprehensive test coverage

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

* Refactor NameSilo provider based on code review feedback

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

* Add NameSilo to CLI, schema, and documentation

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

* Fix NameSilo provider based on code review feedback and resolve flake8 linting issues

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

* Add warning if ID is configured for NameSilo provider

NameSilo only requires API key (token) authentication and does not need the ID field. Added warning message to inform users when ID is unnecessarily configured.

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

* Fix NameSilo provider based on code review and add to README index

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

* Fix NameSilo provider based on code review: update domain parameter usage and clarify API parameter meanings

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

* Remove dict handling logic and single record test, fix rrhost parameter in NameSilo provider

Co-authored-by: NewFuture <6290356+NewFuture@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>
2025-07-13 14:10:55 +08:00
d9b0b825d1 feat(config): 支持当行注释 Add JSON comment support with # and // styles for configuration files (#515)
* Add JSON comment support with # and // styles

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

* Fix Python 2.7 compatibility and remove trailing whitespace

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

* Fix lint issues and simplify comment removal logic

Co-authored-by: NewFuture <6290356+NewFuture@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>
2025-07-13 02:58:38 +00:00
CopilotandNewFuture 3bb6241c5b refact(cache): Convert cache storage from pickle to JSON format (#512)
* Initial plan

* Convert cache storage from pickle to JSON format

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

* Address review feedback: use specific json imports and compact format

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

* Make cache file loading safer with try-catch around file opening

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

* Remove nested try-catch in cache load method as suggested

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

* Fix linting issues: remove whitespace from blank lines in test_cache.py

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

* Add comprehensive tests for Cache.new static method

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

* Fix Windows compatibility in cache test by using tempfile.mktemp() instead of hardcoded Unix path

Co-authored-by: NewFuture <6290356+NewFuture@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>
2025-07-12 08:11:15 +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
Charles Chin fd631c7d59 feat: current time as remark for aliesa (#509)
Signed-off-by: Charles Chin <eallion.s+github@gmail.com>
2025-07-09 16:49:00 +00:00
78b0e953da feat(AliESA) 阿里云边缘安全加速 DNS provider support (#498)
* Initial plan

* Implement AliESA (阿里云边缘安全加速) DNS provider with comprehensive tests and documentation

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

* Add manual site ID specification support for minimal permissions and enhanced documentation

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

* Refactor AliesaProvider to extend AlidnsProvider and use BaseProvider's _split_zone_and_sub with manual site ID support

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

* Add comprehensive unit tests following official ESA API documentation

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

* fix pipeline

* Refactor aliesa inheritance structure and address review comments

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

* Address review comments: fix lint issues, remove unsupported features from docs, clean up schema

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

* Address review comments: fix Python 2.7 compatibility, simplify tests, remove unsupported features, add configurable endpoints

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

* Address review comments: fix Python 2.7 compatibility, implement _validate method, fix lint issues, update docs

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

* Remove _split_zone_and_sub override as requested - focus on format checking

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

* Fix ESA API HTTP method issue and imports

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

* Refactor request method to avoid code duplication and improve TTL handling

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

* fix aliesa

* Refactor API attribute to endpoint in provider classes for consistency

* Remove redundant validation method from AliesaProvider class

* Update author attribution and improve documentation formatting in AliesaProvider

* Remove outdated configuration examples and tests for region endpoints in AliesaProvider documentation and tests

* Add Cloudflare DNS configuration guides in English and Chinese

* remove json content

* Refactor encoding methods and update domain splitting function across providers

* fix py2

* fix

* Update type hints and logging in AliDNS and AliESA providers

* 修改请求参数

* lower case

* update

* fix true

* improve query

* fix bug

* fix typos

* override  remark

* fix lint

---------

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-09 18:33:23 +08:00
492e4fbf91 Add No-IP (noip.com) Dynamic DNS Provider Support (#505)
* Initial plan

* Implement No-IP (noip.com) provider with comprehensive tests and documentation

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

* Fix lint issues and address code review feedback

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

* Update README files to include No-IP provider documentation links

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

* Refactor No-IP documentation for clarity and consistency; update JSON schema to include additional DNS providers

---------

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-04 18:00:43 +00: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
CopilotandNewFuture 1e351642d5 feat(config:line): 支持自定义线路参数 (#501)
* Initial plan

* Add line configuration support for DNS providers

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

* Add line parameter documentation to CLI, ENV, and README

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

* Implement line parameter in config.py and update v4.0 schema, fix lint issues

Co-authored-by: NewFuture <6290356+NewFuture@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>
2025-07-02 14:56:56 +00:00
CopilotandNewFuture 33a0c295c1 fix(cache): Implement per-record caching to fix partial failure issue (#500)
* Initial plan

* Implement per-record caching to fix partial failure issue

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

* Address review feedback: remove staging, fix Python 2 compatibility, remove cache cleanup and tests

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

* Address review feedback: add address to cache log and eliminate cache_key duplication

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

* fix(lint): Remove whitespace from blank line 103 to fix W293 lint error

Co-authored-by: NewFuture <6290356+NewFuture@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>
2025-07-02 12:38:01 +00: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 Future b3a5ff9817 Refactor(base): HMAC-SHA256 signature logic (#496)
* Refactor provider HMAC-SHA256 signature logic

Centralizes HMAC-SHA256 signature generation for AliDNS, HuaweiDNS, and TencentCloud providers into a unified function in _base.py. Removes provider-specific signature and hash helper methods, updating each provider to use the shared implementation. Cleans up and removes related unit tests for the old signature methods.

* Fix test config key from signing_string_template to signing_string_format

Corrects the test case configuration by renaming 'signing_string_template' to 'signing_string_format' to match the expected parameter name.

* rename hmac_sha256_digest to hmac_sha256

refactor(hmac): rename hmac_sha256_digest to hmac_sha256 and update its implementation

* Fix: Ensure Python 2/3 compatibility for HMAC-SHA256 encoding and hex conversion

* Refactor: Remove unnecessary warning log in CloudflareProvider and streamline test cases for CallbackProvider

* Enhance tests: Add random delay to avoid rate limiting in CallbackProvider integration tests

* Refactor: Simplify host extraction in AlidnsProvider's _request method
2025-07-02 02:57:16 +08:00
0653b68750 Fix(cache): loading bug and improve cache status logging (#495)
* Initial plan

* Fix cache loading bug and improve cache status logging

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

* fix(cache): improve cache implementation and add comprehensive unit tests

* refact(cache): replace data method with get for improved clarity and functionality

---------

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 00:29:37 +08:00