Skip to content

Implement Remote Guide Sync, Bot Bypass, and Startup Auto-fetch#10

Closed
StandardCodebase wants to merge 4 commits into
mainfrom
testing-remote-sync
Closed

Implement Remote Guide Sync, Bot Bypass, and Startup Auto-fetch#10
StandardCodebase wants to merge 4 commits into
mainfrom
testing-remote-sync

Conversation

@StandardCodebase
Copy link
Copy Markdown
Owner

Overview:
Added ability to fetch remote Markdown guides from external repositories, bypassing common WAF bot-detection mechanisms. It implements an automated fetching routine on boot, patches Go 1.22 routing panics, and repairs the Docker build pipeline.

Specific Changes:

  • internal/handler/handler.go:

  • Updated ImportRemoteGuide: Replaced the standard http.Get call with a custom http.Client featuring a 15-second timeout and a spoofed browser User-Agent (Mozilla/5.0...). This prevents 502 Bad Gateway errors by bypassing bot blockers on platforms like Codeberg and GitHub.

  • Added SyncGuideOnStartup: Introduced a new background method that automatically downloads a specified remote guide, saves it directly to the data/clearnet/remote/ directory, and clears the manifestCache so the UI updates instantly on boot.

  • main.go:

  • Routing Stability: Removed duplicate route declarations for /import and /static/ on the http.ServeMux. This resolves the pattern conflicts panic introduced by Go 1.22's strict routing rules.

  • Startup Execution: Injected node.SyncGuideOnStartup() to automatically pull the official Git documentation on server initialization before the HTTP server starts listening.

  • Dockerfile:

  • Multi-Stage Build Fix: modified the Stage 1 builder (golang:1.26-alpine) to compile the Go binary directly from the source code, resolving the pull access denial when copying artifacts to the final, restricted reduser Alpine container.

@KrishnaSSH KrishnaSSH self-requested a review May 27, 2026 02:17
@KrishnaSSH KrishnaSSH self-assigned this May 27, 2026
Copy link
Copy Markdown
Collaborator

@KrishnaSSH KrishnaSSH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor

@StandardCodebase StandardCodebase deleted the testing-remote-sync branch May 27, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants