137 Commits
Author SHA1 Message Date
New Futureandopenhands e9ad33e88b Feat/v5 web mcp (#745)
* feat(rust): add Web dashboard and MCP services

Share configuration, status and synchronization between Web and MCP; add authenticated HTTP, stdio lifecycle support, in-process scheduling and offline regression tests. Exercise native tests on the existing Windows/macOS/Linux CI matrix.

Co-authored-by: openhands <openhands@all-hands.dev>

* ci(rust): allow manual cross-platform validation

Enable workflow_dispatch for feature-branch CI without requiring PR creation. Preserve matrices, permissions, publishing boundaries and trusted-branch cache policy.

Co-authored-by: openhands <openhands@all-hands.dev>

* ci(rust): validate feature branch pushes

Run the existing Rust cross-platform matrix for feat/** pushes while retaining trusted-branch-only cache writes and unchanged release triggers.

Co-authored-by: openhands <openhands@all-hands.dev>

* ci(rust): remove temporary branch trigger

The v5 pull request now exists and runs the complete native matrix, so restore the original trusted push branches while retaining Web/MCP paths and tests.

Co-authored-by: openhands <openhands@all-hands.dev>

---------

Co-authored-by: openhands <openhands@all-hands.dev>
2026-09-12 12:09:26 +08:00
93b79d2103 feat(v5): prepare the Rust DDNS development line (#728)
* feat(rust): add parallel DDNS MVP

Add a synchronous Rust client with compatible configuration, IP discovery, caching, and the first four providers.

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

* fix(rust): address review compatibility gaps

Handle DNSPod failures safely, accept Python-compatible log thresholds, document Rust regex limits, and tolerate non-Unicode environment entries.

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

* fix(rust): preserve generated provider options

Serialize endpoint overrides and --extra.* values so generated configuration files reproduce accepted CLI settings.

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

* fix(rust): align provider and config behavior

Keep provider lookup parameters scoped, continue DNSPod zone discovery safely, and match Python configuration and regex semantics.

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

* fix(rust): harden credentials and CI scoping

Redact provider credentials, align remaining config/cache behavior, and avoid running language-specific builds for unrelated changes while preserving required checks.

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

* fix(rust): preserve authenticated URL compatibility

Translate embedded URL credentials to Basic auth, align generated TTL defaults, and run Rust checks for the abc PR target.

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

* fix(rust): isolate caches and aggregate safe errors

Keep Python cache files untouched, redact retained failures, and continue multi-provider runs after log setup errors.

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

* feat(rust): complete providers and distribution

Port the remaining DNS providers and aliases, add protected native/container release workflows, and provide a checksum-aware Rust installer.

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

* docs(agents): register Rust development guide

Keep the generated project structure contract aligned with the new bilingual Rust documentation.

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

* fix(rust): address review feedback

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

* refactor(rust): simplify core design

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

* refactor(rust): use typed borrowed core

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

* refactor(rust): streamline transport state

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

* test(rust): share provider fixtures

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

* test(rust): expand end-to-end coverage

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

* fix(rust): simplify provider modes and lookup handling

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

* chore(v5): prepare isolated Rust development line

Keep Rust changes on the v5 integration line and prepare artifacts without publishing or changing the stable Python entrypoint.

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

* fix(rust): redact credential-bearing URL paths

Hide non-root URL paths in diagnostics and omit URI text from transport errors while preserving actual request URLs.

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

* fix(rust): fully mask credential values

Replace credential prefixes and suffixes with a constant opaque marker while retaining raw and percent-encoded masking.

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

* fix(rust): correct provider signing and zone lookup errors

Use RFC3986 canonical queries for Huawei signing. Distinguish documented NameSilo and ClouDNS zone misses from authentication, HTTP, and provider failures. Add offline regressions and matching V5 documentation.

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

* fix(rust): preserve address spelling for regex rules

Match regex rules against the extracted address text without IPv6 canonicalization, while retaining strict IpAddr validation and parsed return values. Cover original spelling, invalid candidates, family filtering, and matching boundaries.

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

* fix(rust): reject unusable local IPs and malformed record lists

Filter loopback and unspecified addresses before local indexing. Reject malformed ClouDNS, Huawei, and NameSilo record lookups without creating duplicates while retaining valid empty responses. Isolate installer test globals and cleanup traps in subshells.

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

* fix(rust): keep DNS.COM signatures out of diagnostics

Use the sensitive request path for signed DNS.COM bodies, omit raw HTTP and JSON failure responses, and redact signatures echoed in API messages. Preserve request signing and ordinary HTTP diagnostics with offline regressions.

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

* fix(rust): mask form credentials and validate upgrades before replacement

Reuse the form encoder for credential redaction and smoke-test temporary installer binaries before replacing a working installation. Cover rejected upgrades and existing trailing-period IP parsing without changing address extraction.

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

* fix(rust): preserve provider updates and V5 preparation contracts

Send Huawei canonical query bytes unchanged, accept nonempty single-label domains at configuration ingress, and honor AliDNS/ESA extras on unchanged addresses. Require V5 prereleases in artifact preparation with offline regression coverage.

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

* fix(rust): accept separated negative CLI integers

Recognize negative integer tokens as required scalar values without consuming option names. Preserve per-option range validation and cover log-level aliases, inline parity, and real CLI execution.

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

* fix(ci): use architecture names for Rust QEMU setup

Install only the arm64 emulator on the amd64 OCI preparation runner while preserving linux/amd64,linux/arm64 for Buildx. Strengthen offline workflow contracts to distinguish the two inputs.

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-12 00:39:34 +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
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
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
1d04b4eb0f feat(docs): redesign documentation experience (#715)
* feat(docs): redesign documentation experience

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

* fix(docs): preserve Config Studio state

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

* fix(docs): clarify credential diagnostics

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

* fix(docs): address review feedback

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-10 09:37:20 +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
Copilot 4fec62d95d Remove Alibaba Cloud ESA promotional links (#697)
* docs(aliesa): remove Alibaba Cloud ESA promo links

* docs(readme): remove ESA footer sponsor image

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-14 10:43:37 +08:00
CopilotandNewFuture fec8a65e69 docs: Condense edge-ddns-proxy references to single-line mentions (#662)
* Initial plan

* Add edge-ddns-proxy introduction to documentation

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

* Simplify edge-ddns-proxy introduction to one sentence

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-22 13:24:59 +00:00
e18d4bcd96 docs: add ESA Pages and Edge Function deployment guide (#659)
* Initial plan

* docs: add ESA Pages and Function deployment guide

- Created comprehensive Chinese documentation (esa-deploy.md)
- Added navigation entries in VitePress config
- Added sidebar entries for both Chinese and English
- Documented deployment steps, configuration, and troubleshooting

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

* docs: remove unnecessary sections from ESA deploy guide

- Removed "构建缓存" and "预览环境" sections
- Removed "监控指标" section
- Removed entire "故障排除" section
- Removed "优化建议" section

Simplified the documentation based on feedback to focus on essential deployment information.

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

* add esa

* update links

---------

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>
2026-01-19 01:14:27 +08:00
8afc0920dd docs: update schema references from v4.0.json to v4.1.json (#651)
* Initial plan

* docs: update schema references from v4.0.json to v4.1.json

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

* fix: revert schema/v4.0.json to keep v4.0 definition unchanged

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

* docs: update schema file links to v4.1.json in provider README

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>
2026-01-14 15:46:15 +00:00
9a932675e1 Move favicon.ico and img to docs/public, update references, and improve edge function 404 handling with ESA Cache (#643)
* Initial plan

* docs: move favicon and img to docs/public and update all references

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

* fix: update .gitignore to ignore generated subdirs and correct _config.yml paths

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

* refactor: use symbolic links for schema and tests instead of copying

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

* feat: add Vite config to preserve symbolic links in VitePress

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

* refactor: link only tests/config instead of entire tests directory

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

* feat: return 404.html when URLs don't match any pattern in esa.js

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

* fix: properly handle 404.html response headers in esa.js

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

* fix: prevent infinite loop and improve error handling in 404.html fetch

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

* feat: increase 404.html cache duration to 6 hours

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

* feat: cache 404.html response in ESA Cache

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

* Update docs/esa.js

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>
2026-01-13 17:35:21 +08:00
0e466dc496 feat(docs): add automated documentation website builder using VitePress 2.0 (#634)
* Initial plan

* feat(docs): add static documentation website builder script

Add build_docs.py script to convert markdown docs to static HTML website with:
- Responsive navigation bar with collapsible directory tree
- In-page table of contents (right sidebar, hidden on small screens)
- Language switcher (Chinese/English)
- Pure static HTML output (no server-side processing)
- Footer with GitHub links and edit page link
- Mobile-friendly responsive design

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

* style: format build_docs.py with ruff

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

* refactor(docs): use MkDocs with Material theme instead of custom parser

Replace custom markdown parser with industry-standard tools:
- MkDocs: Popular static site generator for documentation
- Material for MkDocs: Modern, feature-rich theme

Benefits:
- Mature, well-tested codebase used by thousands of projects
- Built-in features: search, navigation, TOC, code highlighting
- Active development with regular updates
- Extensive documentation and community support
- Beautiful, responsive design out of the box
- Easy to maintain with configuration-based approach

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

* refactor(docs): use VitePress instead of MkDocs for documentation

Replace MkDocs with VitePress - a Vue-powered static site generator:
- VitePress: Modern, fast, designed for documentation
- Vue 3 + Vite stack with instant HMR
- Built-in i18n, search, dark mode, responsive design
- Chinese-friendly (created by Evan You)

Features:
- Responsive navigation with collapsible sidebar
- In-page TOC automatically generated
- Bilingual support (Chinese/English)
- Local search with keyboard shortcuts
- Light/Dark mode toggle
- Edit page links to GitHub
- Pure static HTML output

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

* feat(docs): add automated setup and build with npm run build

Add automated directory setup for VitePress build:
- Created scripts/setup-docs.mjs to auto-setup docs structure
- Updated package.json with 'build' command that runs setup + build
- Updated docs:dev to include setup automatically
- Simplified workflow to one command: npm run build

Changes:
- npm run build now handles everything automatically
- No need for separate bash script
- Directory structure created on-demand
- Updated BUILD_DOCS.md with simplified instructions

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

* fix(docs): improve VitePress configuration per feedback

Addressed all feedback items:
1. Fixed edit link mapping: index.html now correctly maps to README.md/README.en.md in GitHub
2. Added schema directory to build output via public/ directory
3. Removed /doc/ prefix from all URLs - doc/ is now the web root
4. Fixed path references in README files during setup

Changes:
- Updated editLink to use function for proper README mapping
- Modified setup script to copy doc/ contents to docs root (not docs/doc/)
- Added schema/ to public/ directory for static asset serving
- Fixed /doc/ path references in copied README files
- Updated all navigation and sidebar paths to remove /doc/ prefix

URLs now work as:
- / (homepage from README.md)
- /docker, /install (no /doc/ prefix)
- /config/cli, /providers/dnspod (clean paths)
- /schema/v4.0.json (accessible in build)

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

* fix(docs): preserve original /doc/ paths in documentation

Per user feedback, reverted path modifications:
- No longer replace /doc/ paths in README files
- Restored doc/ directory structure (docs/doc/)
- Updated VitePress navigation to use /doc/ prefix
- Edit links correctly map to source files in doc/ directory

Changes:
- setup-docs.mjs: removed path replacement, copy doc/ to docs/doc/
- config.mts: restored /doc/ prefix in all navigation and sidebar paths
- URLs now match original documentation: /doc/docker, /doc/providers/dnspod

This preserves the original documentation structure and paths as they
appear in the source repository.

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

* fix(docs): remove /doc/ prefix from URLs and ignore intermediate files

Per user feedback, changed URLs from /doc/xxx.html to /xxx.html:

Changes:
1. Updated setup-docs.mjs to copy doc/ contents to docs/ root (not docs/doc/)
2. Modified path replacement to handle both links and image src attributes
3. Updated VitePress config.mts to remove /doc/ prefix from all nav/sidebar paths
4. Updated .gitignore to exclude intermediate copied files from commits
5. Removed docs/index.md and docs/en/index.md from git tracking

URLs now:
- /docker.html instead of /doc/docker.html
- /providers/dnspod.html instead of /doc/providers/dnspod.html
- /config/cli.html instead of /doc/config/cli.html
- Images at /img/ddns.svg instead of /doc/img/ddns.svg
- Schema files remain at /schema/v4.0.json

Intermediate files generated during build are now gitignored and won't be committed.

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

* refactor(docs): move build scripts to doc/ directory

Moved documentation build scripts from root and scripts/ to doc/ directory:
- Moved scripts/setup-docs.mjs → doc/setup-docs.mjs
- Moved build_docs.sh → doc/build_docs.sh
- Removed empty scripts/ directory
- Updated package.json to reference new script locations
- Updated BUILD_DOCS.md with new directory structure

This organizes all documentation-related files under doc/ directory,
keeping the repository root cleaner.

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

* refactor(docs): consolidate into single doc/ directory

Eliminated docs/ directory, consolidated everything under doc/:
- Moved docs/.vitepress/ → doc/.vitepress/
- Removed docs/ directory entirely
- Updated package.json to use doc/ instead of docs/
- Updated .gitignore to reflect new structure (doc/.vitepress/dist/, doc/index.md, doc/en/, doc/public/)
- Updated setup-docs.mjs to generate files within doc/
- Updated BUILD_DOCS.md documentation

Structure now:
- doc/ contains source files, VitePress config, and generated intermediate files
- All build artifacts stay within doc/.vitepress/dist/
- Simpler single-directory structure without doc/docs nesting

Commands remain the same:
- npm run build
- npm run docs:dev
- npm run docs:preview

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

* refactor(docs): move package.json to doc/ directory

Moved package.json to doc/ directory to consolidate all documentation-related files:
- Moved package.json from root → doc/package.json
- Updated package.json scripts to use relative paths (. instead of doc)
- Updated BUILD_DOCS.md with new usage instructions (cd doc first)
- Updated build_docs.sh to work from within doc/ directory
- .gitignore already handles node_modules/ globally

All documentation dependencies and configuration now in single doc/ directory.

Usage:
```bash
cd doc
npm install
npm run build
```

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

* feat(docs): add install.sh to public, auto-redirects, and ensure README→index.html mapping

Implemented three enhancements:

1. Copy install.sh to public/ directory
   - install.sh now accessible at /install.sh in build
   - Users can download directly from documentation site

2. Add automatic redirects for old URLs
   - Created custom VitePress theme with redirect logic
   - /doc/xxx URLs redirect to /xxx
   - /doc/xxx.en.html URLs redirect to /en/xxx.html
   - Maintains backward compatibility with old links

3. README.md renders as index.html with correct edit links
   - Already configured: index.md maps to README.md for editing
   - en/index.md maps to README.en.md for editing
   - Edit links work correctly for both Chinese and English homepages

Updated BUILD_DOCS.md with new features documentation.

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

* feat(docs): upgrade to VitePress 2.0 (next)

Upgraded VitePress from v1.x to v2.0 (next tag):
- Updated package.json to use "vitepress": "next"
- Currently using v2.0.0-alpha.15
- Tested build successfully - all features working
- Updated BUILD_DOCS.md to reflect VitePress 2.0

VitePress 2.0 benefits:
- Better performance and faster build times
- Improved developer experience
- Enhanced features and bug fixes
- Future-ready with latest Vue 3 + Vite improvements

Build tested and confirmed working with no breaking changes.

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

* fix(docs): remove redundant build script and fix copyright years

Changes per user feedback:
1. Removed doc/build_docs.sh (redundant - standard npm commands sufficient)
2. Updated copyright in config.mts line 133: "Copyright © 2016 ~ 2024 NewFuture"
3. Updated copyright in config.mts line 305: "Copyright © 2016 ~ 2024 NewFuture"

Usage now simplified to standard npm commands:
- cd doc && npm install
- npm run build
- npm run docs:dev
- npm run docs:preview

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

* fix(docs): dynamic copyright year, move redirects to esa.js, update providers link

Per user feedback:
1. Made copyright year dynamic: `${new Date().getFullYear()}` (line 305)
2. Moved redirect logic from theme/index.ts to esa.js for server-side handling
3. Changed providers link from "概述 /providers/README" to "所有服务商 /providers/index" (line 70)

Changes:
- config.mts: Dynamic copyright calculation, updated providers navigation
- esa.js: Added redirect logic for /doc/ URLs (301 permanent redirects)
- theme/index.ts: Removed client-side redirect logic (now handled server-side)

Redirects now handled at edge function level for better SEO and performance.

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

* fix(docs): improve redirects, provider link, and add code-to-GitHub link conversion

Per user feedback (comment #3736692270):
1. Moved .en.html redirect logic before general /doc/ redirect in esa.js
2. Added /index.en.html → /en/ redirect
3. Changed providers/README URL to providers/ (line 39)
4. Added markdown transformer to convert code links (e.g., /ddns/provider/dnspod.py) to GitHub links

Changes:
- esa.js: Reordered redirect logic (en first), added index.en.html redirect
- config.mts: Changed providers link from /providers/README to /providers/
- config.mts: Added markdown.config to transform inline code paths to GitHub links

Code paths like `/ddns/provider/dnspod.py` in documentation will now automatically link to GitHub repository.

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

* feat(docs): enable dead link check, add sitemap, llms.txt, and GitHub Actions build

Per user feedback (comment #3736806631):
1. Changed redirects to 301 permanent redirects in esa.js (line 183)
2. Enabled dead link checking in config.mts (ignoreDeadLinks: false)
3. Added sitemap generation (sitemap.hostname: https://ddns.newfuture.cc)
4. Added llms.txt generation via buildEnd hook for AI/LLM context
5. Created GitHub Actions workflow (.github/workflows/build-docs.yml) to build docs on push

Changes:
- esa.js: Clarified 301 redirect comment
- config.mts: Enabled dead link check, added sitemap config, added buildEnd hook for llms.txt
- .github/workflows/build-docs.yml: New workflow to build and optionally deploy docs

GitHub Action triggers on:
- Push to master/main (doc/, README*, schema/ paths)
- Pull requests
- Manual workflow dispatch

Build output includes sitemap.xml and llms.txt for better SEO and AI integration.

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

* fix(docs): update Node.js to v24, retention to 7 days, simplify BUILD_DOCS

Per user feedback (comment #3736833266):
1. Updated Node.js version from v20 to v24 in build-docs.yml (line 33)
2. Changed artifact retention from 30 to 7 days (line 50)
3. Simplified BUILD_DOCS.md - removed verbose explanations, kept essentials

Changes:
- .github/workflows/build-docs.yml: Node 24, 7-day retention
- BUILD_DOCS.md: Condensed from 327 to 40 lines, focused on quick start and essential commands

BUILD_DOCS.md now provides concise reference instead of lengthy tutorial.

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(docs): simplify link transformer, extract llms.txt template, add docs agent

Per user feedback (comment #3737275691):
1. Simplified markdown transformer to only process link (a tag) hrefs instead of code_inline tokens
2. Extracted llms.txt content to separate template file (doc/llms.txt) with:
   - Complete documentation structure with all page URLs
   - All schema file URLs (v4.0, v2.8, v2)
   - Template variable {{DATE}} for build-time replacement
3. Deleted BUILD_DOCS.md and created .github/agents/docs.agent.md:
   - Comprehensive documentation maintenance agent
   - Full guide for updating docs, navigation, providers
   - Build/test procedures and common tasks
   - Guidelines for writing and link handling

Changes:
- config.mts: Transform link hrefs (not inline code), read llms.txt from template
- doc/llms.txt: New template with full doc/schema URLs
- .github/agents/docs.agent.md: New documentation maintenance agent
- BUILD_DOCS.md: Deleted (replaced by agent instructions)

Link transformer now only modifies existing <a> tags, preserving markdown styling.

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

* fix(docs): add metadata to docs agent, fix markdown syntax, add v4.1.json schema

Per user feedback (comment #3737334654):
1. Added YAML metadata to docs.agent.md (name, description) following new-provider.agent.md format
2. Fixed markdown syntax to be GitHub-compatible:
   - Changed inline code blocks in list items to properly formatted code blocks
   - Ensured all code examples are in fenced code blocks
3. Added missing v4.1.json schema to llms.txt (was only showing v4.0, v2.8, v2)

Changes:
- .github/agents/docs.agent.md: Added YAML frontmatter, fixed markdown formatting
- doc/llms.txt: Added v4.1 schema URL (first in list as newest version)

All schema files now documented: v4.1, v4.0, v2.8, v2

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

* refactor(docs): restructure to docs/ directory with cleaner organization

Per user feedback (comment #3737399407):
1. Renamed doc/ → docs/
2. Moved all .en.md files → docs/en/*.md (removed .en suffix)
3. Moved install.sh → docs/install.sh (source file, not copied)
4. Moved favicon.ico → docs/favicon.ico (source file)
5. Simplified setup-docs.mjs - no longer copies English files or install.sh
6. Updated all path references:
   - GitHub Actions workflow: doc/ → docs/
   - .gitignore: doc/ → docs/
   - VitePress config: edit links now map to docs/
   - Documentation agent: updated structure docs

New Structure:
- docs/ (was doc/)
  - config/, providers/, dev/ (Chinese markdown)
  - en/ (English markdown, no .en suffix)
    - config/, providers/, dev/
  - install.sh (source)
  - favicon.ico (source)
  - llms.txt (template)

Build command unchanged: cd docs && npm run build

All English documentation now sourced directly from docs/en/ instead of being generated.

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

* fix(docs): update documentation links from /doc/ to docs/ in README files

Per user feedback (comment #3737497400):
1. Updated setup-docs.mjs to properly replace /doc/ → docs/ → / in README processing
2. Updated all /doc/ links to docs/ in README.md:
   - Image src: /doc/img/ddns.svg → docs/img/ddns.svg
   - Docker docs: /doc/docker.md → docs/docker.md
   - Config docs: /doc/config/* → docs/config/*
   - Provider docs: /doc/providers/* → docs/providers/*
3. Updated all /doc/ links to docs/en/ in README.en.md:
   - Image src: /doc/img/ddns.svg → docs/img/ddns.svg
   - Docker docs: /doc/docker.en.md → docs/en/docker.md
   - Config docs: /doc/config/*.en.md → docs/en/config/*.md
   - Provider docs: /doc/providers/*.en.md → docs/en/providers/*.md

Changes:
- docs/setup-docs.mjs: Two-step replacement (/doc/ → docs/ → /) for GitHub links
- README.md: All documentation links now use docs/ prefix
- README.en.md: All documentation links now use docs/en/ prefix

Verified: No /doc/ links remain in README files or .github markdown files.

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

* refactor(docs): simplify setup script and move to .vitepress directory

Per user feedback (comment #3737562776):
1. Moved setup-docs.mjs to docs/.vitepress/ directory
2. Simplified link replacement logic:
   - Removed unnecessary /doc/ processing code
   - Now only converts docs/ → / (Chinese version)
   - And docs/en/ → / (English version)
   - Since README files already use correct docs/ prefix
3. Updated package.json script paths to reference .vitepress/setup-docs.mjs
4. Updated path variables in script to work from .vitepress/ location

Changes:
- docs/.vitepress/setup-docs.mjs: New location, simplified logic
- docs/package.json: Updated setup script path
- Removed obsolete /doc/ → docs/ replacement steps

Build process now simpler and cleaner.

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

* fix(docs): fix all broken documentation links

Per user feedback (comment #3737640946):
Fixed all broken links throughout the documentation:

1. Fixed providers/README links → providers/ (clean URL)
2. Removed all .en.md suffixes from links (files now in docs/en/ with .md extension)
3. Fixed /doc/ prefix references → proper docs/ paths
4. Fixed cross-references between Chinese and English docs:
   - Chinese providers/README.md → ../en/providers/*.md for English docs
   - English docs use relative paths within en/ directory
5. Fixed redirect_to URLs in dnscom.md files
6. Fixed image URL: /doc/img/ → /img/

Changes affect 28 files:
- All config documentation (cli.md, env.md, json.md) in both languages
- All provider documentation in both languages
- Developer documentation (dev/config.md)
- Docker documentation
- Provider README files

All dead links now resolved. Documentation navigation works correctly.

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

* fix(docs): fix remaining dead links in generated index.md and provider files

Per user feedback (comment #3737692822):
Fixed all remaining dead links:

1. Enhanced setup-docs.mjs to handle ./doc/ prefix links:
   - Added replacement for (./doc/ → (/
   - Added replacement for /providers/index → /providers/
   - Now correctly converts README links to clean web URLs

2. Fixed provider documentation links:
   - callback.md and debug.md: Added "Return to All Providers" links
   - English versions: Added /en/providers/ links
   - Removed broken ./../../README links

All dead links now resolved:
- ./doc/install → /install
- ./doc/providers/* → /providers/*
- ./doc/config/* → /config/*
- /providers/index → /providers/
- Provider files now link to /providers/ and /en/providers/

Dead link checking should now pass successfully.

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

* fix(docs): fix all remaining dead links in documentation

Per user feedback (comment #3737728554):
Fixed all remaining dead links throughout documentation:

1. Enhanced setup-docs.mjs:
   - Added replacement for ](doc/ pattern
   - Handles more link format variations

2. Fixed config files (6 files):
   - config/cli.md: providers/ → ../providers/, providers/callback → ../providers/callback
   - config/json.md: docker.md → ../docker.md, providers/ → ../providers/
   - en/config/env.md: providers/callback → ../providers/callback, docker → ../docker, providers/ → ../providers/
   - en/config/json.md: docker.md → ../docker.md, providers/ → ../providers/

3. Fixed provider files (6 files):
   - providers/callback.md, debug.md, README.md: ../../README.md → /
   - en/providers/callback.md, debug.md: ../../README.md → /en/
   - en/providers/he.md: ../json.md → ../config/json.md

All dead links resolved:
✓ ./providers/index → ../providers/
✓ ./providers/callback → ../providers/callback
✓ ./docker → ../docker
✓ ./../../README → / (or /en/)
✓ ../json → ../config/json
✓ ](doc/ → ](/

Dead link checking should now pass successfully with zero errors.

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

* fix(docs): add VitePress rewrites to map providers/README.md to /providers/

Per user feedback (comment #3737780259):
Fixed `/providers/index` dead links by adding VitePress rewrites configuration.

Changes to docs/.vitepress/config.mts:
1. Added rewrites mapping:
   - providers/README.md → providers/index.md
   - en/providers/README.md → en/providers/index.md
2. Updated sidebar links:
   - /providers/index → /providers/
   - /en/providers/index → /en/providers/

This tells VitePress that the README.md files in providers directories should be accessible via the /providers/ URL (with cleanUrls enabled).

All /providers/index links now correctly resolve to /providers/

Dead link checking should now pass with zero errors.

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

* fix(docs): fix providers/index links and simplify setup script

Per user feedback (comment #3737836475):
1. Fixed dead links in config/env.md files:
   - ./providers/ → ../providers/ (both Chinese and English)
2. Simplified setup-docs.mjs:
   - Removed unnecessary doc/ processing (README no longer contains doc/)
   - Merged logic for both README files into single processReadme function
   - Cleaner, more maintainable code with less duplication

Changes:
- docs/config/env.md: Fixed providers/ link
- docs/en/config/env.md: Fixed providers/ link
- docs/.vitepress/setup-docs.mjs: Refactored with shared function

Dead link checking should now pass with zero errors.

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

* refactor(docs): remove providers/index replacement from setup script

Per user feedback (comment #3737887893):
Removed `/providers/index` → `/providers/` replacement from setup-docs.mjs.
This should be fixed in markdown files instead, not in the setup script.

Simplified setup script by removing unnecessary transformation logic.

Changes:
- docs/.vitepress/setup-docs.mjs: Removed line 29 replacement

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

* fix(docs): update remaining /doc/ references to docs/ in README files

Per user feedback (comment #3737970179):
Updated all remaining /doc/ references to docs/ or docs/en/ in both README files.

Changes in README.md:
- doc/install.md → docs/install.md
- All doc/providers/*.md → docs/providers/*.md (10 provider links)

Changes in README.en.md:
- doc/install.en.md → docs/en/install.md
- doc/providers/dnspod.en.md → docs/en/providers/dnspod.md
- doc/providers/alidns.en.md → docs/en/providers/alidns.md

All documentation links now correctly use docs/ prefix for GitHub navigation.

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

* fix(docs): update all remaining doc/ references to docs/ in README files

Per user feedback (comment #3738298603):
Updated ALL remaining doc/ references to docs/ or docs/en/ in both README files.

Changes in README.md (13 links):
- doc/providers/edgeone.md → docs/providers/edgeone.md
- doc/providers/noip.md → docs/providers/noip.md
- doc/config/cli.md → docs/config/cli.md (3 occurrences)
- doc/config/json.md → docs/config/json.md (2 occurrences)
- doc/config/env.md → docs/config/env.md (2 occurrences)
- doc/providers/ → docs/providers/ (3 occurrences)

Changes in README.en.md (13 links):
- doc/providers/*.en.md → docs/en/providers/*.md (9 provider links)
- doc/config/cli.en.md → docs/en/config/cli.md
- doc/config/json.en.md → docs/en/config/json.md
- doc/config/env.en.md → docs/en/config/env.md
- doc/providers/ → docs/en/providers/

All documentation links now use correct docs/ prefix with NO /doc/ references remaining.

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

* refactor(docs): integrate setup logic into config.mts

Per user feedback (comment #3738600577):
Integrated setup-docs.mjs functionality into config.mts.

Changes:
1. Removed standalone setup-docs.mjs file
2. Added setupDocs() function in config.mts that runs before config export
3. Simplified package.json scripts - removed setup step
4. Setup now runs automatically when config loads (works for both dev and build)

Benefits:
- Single configuration file - easier to maintain
- No separate setup script needed
- Automatic execution on both dev and build
- Cleaner package.json scripts
- Same functionality, simpler implementation

Build command: `npm run build` or `npm run docs:dev`

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

* update link

* /doc/img/ddns.svg

* fix docs paths

* fix docs

* fix docs url

---------

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-01-12 23:48:37 +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
09af9a094d feat(install): 一键安装脚本 add POSIX-compatible one-click installation script with multilingual support and comprehensive testing (#546)
* Initial plan

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

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

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

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

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

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

* update scripts

* mv test scripts

* update test scirpts

* update tests

* fix tests

* fix ci

* update test

* fix tests

* set-ua

* fix tests in docker

* fix tests

* fix version

* fix version check

* fix tests

* fix proxy

* fix tests

* enhance download functionality with timeout and improved SSL handling

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

* fix proxy

* fix download result code

* fix test proxy

* fix ertry

* fix retry

* info message

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

* wget 兼容

* Apply suggestion from @Copilot

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

* Apply suggestion from @Copilot

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

* Apply suggestion from @Copilot

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

* fix libc detect

* fix beta check

---------

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

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

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

* docs(cli): add task subcommand documentation

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

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

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

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

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

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

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

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

* add task tests

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

* update task

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

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

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

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

* remove DEVNULL

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

* add and fix tests

* fix lint

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

* fix tests

* +x

* fix py2 and types

* rm sudo

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

* update test command

* always force

* fix format

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

* update log

* docs: update CLI task management instructions and examples

* fix py2

* fix task in python2

* fix lint

* refactor tasks

* update tests

* add schtasks-based task scheduler implementation and unit tests

* Enhance scheduler functionality and improve error handling

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

* fix lint

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

* fix tests

* Add unittest configuration to settings and improve SchtasksScheduler error handling

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

* Refactor LaunchdScheduler tests for improved readability and error handling

* fix py2

* fix mac launchd test

* fix lint

* fix macos tests

* fix windows test

* patch readme

* update doc

* Update tests/test_scheduler_cron.py

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

---------

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Update ddns/config/file.py

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

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

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

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

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

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

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

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

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

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

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

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
Co-authored-by: New Future <NewFuture@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 01:46:01 +00:00
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
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
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 FutureandCopilot 0eea4c6850 doc(providers): all providers doc (#522)
* doc(providers): all providers doc

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-14 16:35:13 +00:00
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
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
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
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
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
New FutureandCopilot f1a764d3c2 refact(provider): 巨大重构 (#484)
* abc

* update base

* update

* add doc

* dnspod class provider

* lint

* fix lint

* 类型检查

* add alidns

* cloudflare

* dnspod 国际版

* Update pyproject.toml

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

* update dnscom

* Update dnspod.py

* fix lint

* 提供兼容的encode 和 quote 方法

* huawei dns

* 名称兼容

* join domain

* static

* update base

* add callback

* update http

* fix and update hw

* merge

* refactor: reorganize imports and enhance logging in provider modules

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

* Apply suggestions from code review

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

* Update ddns/provider/__init__.py

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

* resolve comments

* update doc

* update doc

* using self logger

* update format

* Refactor config handling and update provider docs

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

* Rename PrintProvider to DebugProvider and update references

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

* Add logger support to Cache and BaseProvider classes

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

* update callback

* fix lint

* Add and refine provider authentication validation

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

* fix py2

* fix import

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

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

* Mask sensitive data in logs for URL and body

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

* Add unit tests for BaseProvider and update CI workflow

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

* Remove unused encoding parameter from _quote method

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

* Remove unused 'errors' parameter from _quote method

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

* Refactor CallbackProvider and add unit tests

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

* Rename and update provider test files, add DebugProvider tests

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

* he tests

* Refactor tests to use shared BaseProviderTestCase

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

* Improve test configuration and Python 2.7 compatibility

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

* fix py2 pip

* fix pip2

* install pip

* tmp dir

* Use PY env variable for Python 2.7 setup in CI

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

* Add stub DNS record methods to DebugProvider and HeProvider

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

* fix debug

* fix tests

* fix typos

* fix id check

* callback 兼容python2

* add SimpleProvider

* fix

* fix lint

* remove duplicate code

* fix lint

* fix tests

* query with condition

* fix test for py2

* fix debug tests

* run ut in more system

* add unit tests for SimpleProvider and update README

* Refactor dnspod provider and add comprehensive tests

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

* fix type

* format

* Add unit tests for AlidnsProvider and CloudflareProvider

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

* Add and update provider tests; fix datetime usage

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

* Use datetime.utcnow() for UTC timestamps

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

* Add unit tests for DnspodComProvider

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

* feat: Add TencentCloudProvider and implement related unit tests

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

* fix tests

* always use the time

* fix TencentCloudProvider

* fix lint

* Add new feature to process user input

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

* Update unit tests for various DNS providers

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

* Enhance CallbackProvider and HTTP utilities

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

* Refactor provider constants and response handling

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

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

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

* Refactor HTTP callback handling and enhance error logging

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

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

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

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

* fix py2 and time

* fix tests

* disable push build

* Apply suggestions from code review

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

* Update tests/test_provider_cloudflare.py

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

* update doc

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

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

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

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

* Update tests/test_provider_callback.py

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

* Update tests/test_provider_dnscom.py

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

* Update tests/test_provider_debug.py

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

* Update tests/test_provider_he.py

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-01 19:08:11 +08:00
New Future 57c357cbfa doc(readme): update docker platforms 2025-06-20 00:13:58 +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 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 3b7d291bd5 优化ico (#467)
* Optimize ico
* Update readme
* Flatten badge
2025-06-03 13:33:05 +00:00
New Future 6c74f42f24 update release doc 2025-06-02 16:20:34 +00:00
New Future 7491693174 update realease actions 2025-06-02 15:46:40 +00:00
New Future da19b8c0c4 更新配置文件模式至v4.0 重构日志配置,(#465)
Break changes
* 移除调试模式,

* 添加日志级别和输出文件
2025-06-02 08:16:27 +00:00
New Future e667f5b3ae redesign icons (svg logo + favicon) (#461) 2025-05-30 18:36:47 +00:00
New Future 6c0dccfbe0 fix docker release job 2025-05-27 09:37:10 +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
b1n23 28471a3351 华为云支持配置TTL (#424)
华为云支持配置TTL,优先匹配级数最长的主域名
2024-02-26 11:32:13 +08:00
New Future 63bfc5a5b4 V3 (#423)
* fix lint

* 主版本移除python2支持
2024-02-14 17:01:18 +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
New Future 70952ca777 doc(readme):update release badge (#341) 2022-07-28 22:19:29 +08:00
New Future ecca03760f Replace version (#340)
* replace version

* rm Travis

* update badge
2022-07-28 18:34:33 +08:00
New Future 7a1bf5cc6a remove azure pipelines (#339)
* remove azure pipelines

* fix docker test

* fix docker test

* fix docker test
2022-07-28 11:46:07 +08:00
New Future 816a265500 doc(README.md): update badge (#335) 2022-07-24 11:05:49 +08:00
New Future 9579ae1ec7 (doc):remove interface (#327)
remove interface
2022-07-13 19:56:25 +08:00
NN708 9cfdc14fbb Support environment variables in Docker image (#304)
* feat(docker): add entrypoint.sh

* docs(docker): example using environment variables
2022-03-01 10:54:59 +08:00
Leonhardt92 5e420fbe4a Update README.md (#273)
阿里云 accesskey文档已失效
2021-07-21 12:58:27 +08:00