Major codebase cleanup after .insertr-add functionality overhaul
Consolidates duplicate code and removes technical debt accumulated during rapid development. This cleanup improves maintainability while preserving all functionality. Backend cleanup: - Remove unused legacy function findViableChildrenLegacy() - Consolidate duplicate SQL null string helper functions into shared utils - Unify text extraction functions across utils, engine, and id_generator - Consolidate duplicate attribute getter functions into single implementation Frontend cleanup: - Remove duplicate authentication methods (authenticateWithOAuth vs performOAuthFlow) - Remove unused hasPermission() method from auth.js - Centralize repetitive API endpoint construction in api-client.js - Reduce excessive console logging while preserving important error logs Impact: -144 lines of code, improved maintainability, no functionality changes All tests pass and builds succeed 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -393,9 +393,7 @@ func (disc *Discoverer) hasNoMeaningfulContent(node *html.Node) bool {
|
||||
}
|
||||
|
||||
// Extract text content
|
||||
var text strings.Builder
|
||||
disc.extractTextRecursive(node, &text)
|
||||
content := strings.TrimSpace(text.String())
|
||||
content := engine.ExtractTextContent(node)
|
||||
|
||||
// Empty or whitespace-only content
|
||||
if content == "" {
|
||||
@@ -424,25 +422,6 @@ func (disc *Discoverer) hasNoMeaningfulContent(node *html.Node) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// extractTextRecursive extracts text content from a node and its children
|
||||
func (disc *Discoverer) extractTextRecursive(node *html.Node, text *strings.Builder) {
|
||||
if node.Type == html.TextNode {
|
||||
text.WriteString(node.Data)
|
||||
return
|
||||
}
|
||||
|
||||
for child := node.FirstChild; child != nil; child = child.NextSibling {
|
||||
// Skip script and style content
|
||||
if child.Type == html.ElementNode {
|
||||
tag := strings.ToLower(child.Data)
|
||||
if tag == "script" || tag == "style" {
|
||||
continue
|
||||
}
|
||||
}
|
||||
disc.extractTextRecursive(child, text)
|
||||
}
|
||||
}
|
||||
|
||||
// copyFile copies a file from input to output directory
|
||||
func (disc *Discoverer) copyFile(filePath, inputDir, outputDir string) error {
|
||||
outputPath := disc.getOutputPath(filePath, inputDir, outputDir)
|
||||
|
||||
Reference in New Issue
Block a user