Commit Graph

1922 Commits

Author SHA1 Message Date
yusing
af68eb4b18 build: create placeholder JS files and tidy Go modules
- Add script logic to create empty placeholder files for minified JS files
  so go vet won't complain about missing files
- Run go mod tidy in root and agent directory to clean up dependencies
2026-02-26 01:03:02 +08:00
yusing
9927267149 chore: improve refresh-compat.sh with error handling and fix sed application
Add `set -euo pipefail` for strict error handling, check for clean working tree before running, and add trap for cleanup. Move sed replacements from patch file to actual changed Go files to correctly apply sonic-to-json transformations after checkout.
2026-02-26 00:46:12 +08:00
yusing
af8cddc1b2 chore: add AGENTS.md 2026-02-26 00:39:10 +08:00
yusing
c74da5cba9 build: make POST_BUILD always run 2026-02-26 00:35:44 +08:00
yusing
c23cf8ef06 ci: refactor compat branch refresh to use patch-based approach 2026-02-26 00:34:48 +08:00
yusing
733716ba2b build(cli): fix build path and unify build command
Use the shared build target for CLI binaries and upload
artifacts to GitHub releases on tag builds.
2026-02-25 14:40:06 +08:00
yusing
0716d3dc0d chore(example): add netbird docker compose example v0.27.0 2026-02-25 12:09:05 +08:00
yusing
b64944cfc3 fix(rules): add nil guard to entrypoint retrieval in route command 2026-02-25 12:04:34 +08:00
yusing
5b068469ef fix(goutils/server): set ConnContext in http3 server to preserve context values
- This fixes http3 connections not able to retrieve entrypoint from context, and also causing panic in `route` rule command
2026-02-25 12:02:47 +08:00
yusing
6576b7640a chore(deps: update dependencies 2026-02-24 18:14:39 +08:00
yusing
d4e552754e fix(Makefile): update WEBUI_DIR and DOCS_DIR to use absolute paths
Changed WEBUI_DIR to resolve to an absolute path using the current working directory,
and updated DOCS_DIR to be relative to WEBUI_DIR
2026-02-24 18:12:47 +08:00
yusing
9ca2983a52 docs(rules): document new dynamic variables and redaction 2026-02-24 18:11:35 +08:00
yusing
ed2ca236b0 feat(api): accept rule config block string in playground
Update playground request to take rules as a string and parse
either YAML list or DSL config, with tests and swagger updates.
2026-02-24 18:11:17 +08:00
yusing
0eba045104 feat(rules): add $redacted dynamic variable for masking sensitive values
Introduces a new `$redacted` dynamic variable that wraps its single
argument with `strutils.Redact`, allowing sensitive values (e.g.,
authorization headers, query parameters) to be masked in rule
expressions.

The variable accepts exactly one argument, which may itself be a nested
dynamic variable expression such as `$header(Authorization)` or
`$arg(token)`, enabling patterns like `$redacted($header(Authorization))`.

Adds corresponding tests covering plain string redaction, nested header
and query arg wrapping, and the error case when no argument is provided.
2026-02-24 15:17:28 +08:00
yusing
77f2779114 fix(rules): expand nested function args
Allow $func(...) expressions inside function arguments by
extracting nested calls and expanding them before evaluation.
2026-02-24 15:15:42 +08:00
yusing
743eb03b27 fix(scripts): correct repo root path in update-wiki
The repoRootAbs was resolving to the script directory instead of the
repository root. Fixed by resolving two levels up from import.meta.dir.

Also optimized writeImplDocToMdx to skip writes when content is unchanged
and removed unused return value from syncImplDocs.
2026-02-24 15:10:03 +08:00
Yuzerion
d2d686b4d1 feat(rules): introduce block DSL, phase-based execution (#203)
* chore(deps): update submodule goutils

* docs(http): remove default client from README.md

* refactor(rules): introduce block DSL, phase-based execution, and flow validation

- add block syntax parser/scanner with nested @blocks and elif/else support
- restructure rule execution into explicit pre/post phases with phase flags
- classify commands by phase and termination behavior
- enforce flow semantics (default rule handling, dead-rule detection)
- expand HTTP flow coverage with block + YAML parity tests and benches
- refresh rules README/spec and update playground/docs integration
- Default rules act as fallback handlers that execute only when no matching non-default rule exists in the pre phase
- IfElseBlockCommand now returns early when a condition matches with a nil Do block, instead of falling through to else blocks
- Add nil check for auth handler to allow requests when no auth is configured

* fix(rules): buffer log output before writing to stdout/stderr

* refactor(api/rules): remove IsResponseRule field from ParsedRule and related logic

* docs(rules): update examples to use block syntax
2026-02-24 10:44:47 +08:00
yusing
169358659a refactor(middleware): improve response body modification gating
Refactor response body modification to only allow text-like content types
(JSON, YAML, XML, etc.) instead of all HTML responses.

Body modification is now
blocked for binary content and transfer/content encoded responses, while status
code and headers can still be modified.

This prevents issues with compressed or streaming responses while
maintaining the ability to modify text-based API responses.
2026-02-23 23:46:41 +08:00
yusing
0850ea3918 docs(http): remove default client from README.md 2026-02-23 14:51:30 +08:00
yusing
dd84d57f10 chore(deps): update submodule goutils 2026-02-23 14:51:03 +08:00
yusing
0aae9f07d1 chore(vscode): update YAML schema paths in settings example 2026-02-23 11:34:44 +08:00
yusing
ac1d8f3487 docs(readme): remove API endpoints section and clarify proxmox log streaming descriptions 2026-02-23 11:34:33 +08:00
yusing
6e8f5fb58d fix(server): fix race with closing listener first then shutdown 2026-02-23 11:28:09 +08:00
yusing
3001417a37 fix(health): only send recovery notification after down notification
Previously, up notifications were sent whenever a service recovered,
even if no down notification had been sent (e.g., when recovering
before the failure threshold was met). This could confuse users who
would receive "service is up" notifications without ever being
notified of a problem.

Now, recovery notifications are only sent when a prior down
notification exists, ensuring notification pairs are always complete.
2026-02-23 11:05:19 +08:00
yusing
730757e2c3 chore(ci): update GitHub Actions workflow to include versioned tags for CLI binary builds 2026-02-22 19:59:00 +08:00
yusing
be53b961b6 chore(env): add LOCAL_API_ADDR to env example 2026-02-22 19:55:26 +08:00
yusing
f6a82a3b7c docs(api): update swagger docs with field descriptions and operationId rename
- Add minimum: 0 validation to LogRetention properties (days, keep_size, last)
- Add "interned" descriptions to fstype, path, and name fields
- Rename operationId and x-id from "routes" to "list" for GET /route endpoint
2026-02-22 19:54:56 +08:00
yusing
4e5ded13fb fix(api/proxmox): add websocket validation to journalctl and tail endpoints
Add required websocket check at the beginning of both journalctl and tail endpoint handlers to ensure these endpoints only accept websocket connections.
2026-02-22 19:54:09 +08:00
yusing
2305eca90b feat(cli): add CLI application with automatic command generation from swagger
Add a new CLI application (`cmd/cli/`) that generates command-line interface commands from the API swagger specification. Includes:
- Main CLI entry point with command parsing and execution
- Code generator that reads swagger.json and generates typed command handlers
- Makefile targets (`gen-cli`, `build-cli`) for generating and building the CLI
- GitHub Actions workflow to build cross-platform CLI binaries (linux/amd64, linux/arm64)
2026-02-22 19:51:49 +08:00
yusing
4580543693 refactor(icons): improve favicon fetching with custom HTTP client and content-type validation
Replace the existing HTTP client with a custom-configured client that skips TLS verification for favicon fetching,
and add explicit Content-Type validation to ensure only valid image responses are accepted.

This fixes potential issues with SSL certificate validation and prevents processing of non-image responses.
2026-02-22 16:06:13 +08:00
yusing
bf54b51036 chore(http): remove stale default_client.go 2026-02-22 16:05:30 +08:00
yusing
8ba937ec4a refactor(middleware): replace sensitive fields with redacted types 2026-02-22 16:05:02 +08:00
yusing
0f78158c64 refactor: fix lint errors; improve error handling 2026-02-22 16:04:25 +08:00
yusing
3a7d1f8b18 refactor: modernize code with go fix 2026-02-21 13:03:21 +08:00
yusing
64ffe44a2d refactor(systeminfo): correct field usage regarding update to gopsutil submodule 2026-02-21 13:00:00 +08:00
yusing
dea37a437b chore: apply golangci-lint fmt 2026-02-21 12:56:51 +08:00
yusing
ee973f7997 chore(deps): upgrade dependencies and submodules 2026-02-21 12:53:34 +08:00
yusing
8756baf7fc fix(docs): remove application/json from /file/content API 2026-02-18 19:13:00 +08:00
yusing
a12bdeaf55 refactor(middleware): replace path prefix checks with function-based approach
Replace simple path prefix-based enforcement/bypass mechanism with a more
flexible function-based approach. This allows for more complex conditions
to determine when middleware should be enforced or bypassed.

- Add checkReqFunc and checkRespFunc types for flexible condition checking
- Replace enforcedPathPrefixes with separate enforce and bypass check functions
- Add static asset path detection for automatic bypassing
- Separate request and response check logic for better granularity
2026-02-18 19:12:07 +08:00
yusing
f7676b2dbd chore(go.mod): add backoff library for retrying operations 2026-02-18 18:17:29 +08:00
yusing
add7884a36 feat(icons): improve search ranking with priority-based matching
Restructure icon search to use a tiered ranking system:
- Exact matches get highest priority (rank 0)
- Prefix matches ranked by name length (rank 100+)
- Contains matches ranked by relevance (rank 500+)
- Fuzzy matches as fallback (rank 1000+)

Also refactors InitCache to use switch statements for clarity
and updates goutils submodule.
2026-02-18 18:13:34 +08:00
yusing
115fba4ff4 feat(route): allow empty listening port in port specification
Support the ":proxy" format where only the proxy port is specified.
When the listening port part is empty, it defaults to 0 instead of
returning a parse error.
2026-02-18 14:37:23 +08:00
yusing
bb757b2432 refactor: replace custom helper with stdlib strings.* 2026-02-18 14:26:29 +08:00
yusing
c2d8cca3b4 refactor(docs): migrate wiki generation to MDX format
- Convert markdown output to  fumadocs MDX
- Add api-md2mdx.ts for markdown to MDX transformation
- Remove sidebar auto-update functionality
- Change output directory from src/impl to content/docs/impl
- Update DOCS_DIR path in Makefile to local wiki directory
- Copy swagger.json directly instead of generating markdown
- Add argparse dependency for CLI argument parsing
2026-02-18 14:05:40 +08:00
yusing
20695c52e8 docs: unify header to import path for package docs 2026-02-18 03:25:32 +08:00
yusing
7baf0b6fe5 refactor(metrics): reorganize system info collection into separate functions
Split the monolithic AllSystemInfo handler into smaller, focused functions:
- Extract streamSystemInfo for channel consumption
- Add queueSystemInfo for safe non-blocking queue operations
- Create collectSystemInfoRound for parallel agent data collection
- Implement handleRoundResult for consistent round result processing
- Replace custom exponential backoff with cenkalti/backoff/v5 library

This improves code maintainability and separates concerns within the metrics API endpoint.
2026-02-16 20:19:18 +08:00
yusing
863f16862b chore: update screenshots 2026-02-16 10:48:41 +08:00
yusing
b4a9f44f4e fix(makefile): correct minify-js receipe syntax v0.26.0 2026-02-16 08:33:55 +08:00
yusing
ae45854977 fix(makefile): update minify-js target to conditionally skip based on agent and socket-proxy flags 2026-02-16 08:24:14 +08:00
yusing
b272f3ffb7 refactor(scripts): enhance update-wiki script directory link resolution with parent fallback
Add fallback logic to rewriteImplMarkdown to traverse parent directories when resolving directory links, allowing paths like "internal/watcher/events" to resolve via their parent "internal/watcher" if no exact match exists. Also update built-in import to use explicit "node:" protocol.
2026-02-16 08:13:47 +08:00