mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 16:00:25 +08:00 
			
		
		
		
	优化页面优化相关代码
This commit is contained in:
		@@ -8,6 +8,7 @@ import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/utils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/utils/fnv"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/utils/minifiers"
 | 
			
		||||
	"github.com/iwind/TeaGo/lists"
 | 
			
		||||
	"github.com/iwind/TeaGo/types"
 | 
			
		||||
	"io"
 | 
			
		||||
@@ -442,7 +443,7 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId
 | 
			
		||||
 | 
			
		||||
	// Page optimization
 | 
			
		||||
	if this.web.Optimization != nil && resp.Body != nil && this.cacheRef != nil /** must under cache **/ {
 | 
			
		||||
		err := this.web.Optimization.FilterResponse(this.URL(), resp)
 | 
			
		||||
		err := minifiers.MinifyResponse(this.web.Optimization, this.URL(), resp)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			this.write50x(err, http.StatusBadGateway, "Page Optimization: fail to read content from origin", "内容优化:从源站读取内容失败", false)
 | 
			
		||||
			return
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								internal/utils/minifiers/minify.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								internal/utils/minifiers/minify.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
 | 
			
		||||
//go:build !plus
 | 
			
		||||
 | 
			
		||||
package minifiers
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// MinifyResponse minify response body
 | 
			
		||||
func MinifyResponse(config *serverconfigs.HTTPPageOptimizationConfig, url string, resp *http.Response) error {
 | 
			
		||||
	// stub
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user