mirror of https://github.com/hunshcn/gh-proxy
				
				
				
			
						commit
						0dd233715b
					
				
							
								
								
									
										8
									
								
								index.js
								
								
								
								
							
							
						
						
									
										8
									
								
								index.js
								
								
								
								
							| 
						 | 
					@ -65,10 +65,10 @@ async function fetchHandler(e) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // cfworker 会把路径中的 `//` 合并成 `/`
 | 
					    // cfworker 会把路径中的 `//` 合并成 `/`
 | 
				
			||||||
    path = urlObj.href.substr(urlObj.origin.length + PREFIX.length).replace(/^https?:\/+/, 'https://')
 | 
					    path = urlObj.href.substr(urlObj.origin.length + PREFIX.length).replace(/^https?:\/+/, 'https://')
 | 
				
			||||||
    const exp1 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:releases|archive)\/.*$/
 | 
					    const exp1 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:releases|archive)\/.*$/i
 | 
				
			||||||
    const exp2 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:blob)\/.*$/
 | 
					    const exp2 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:blob)\/.*$/i
 | 
				
			||||||
    const exp3 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:info|git-upload-pack).*$/
 | 
					    const exp3 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:info|git-upload-pack).*$/i
 | 
				
			||||||
    const exp4 = /^(?:https?:\/\/)?raw\.githubusercontent\.com\/.+?\/.+?\/.+?\/.+$/
 | 
					    const exp4 = /^(?:https?:\/\/)?raw\.githubusercontent\.com\/.+?\/.+?\/.+?\/.+$/i
 | 
				
			||||||
    if (path.search(exp1) === 0 || !Config.jsdelivr && path.search(exp2) === 0 || !Config.cnpmjs && (path.search(exp3) === 0 || path.search(exp4))) {
 | 
					    if (path.search(exp1) === 0 || !Config.jsdelivr && path.search(exp2) === 0 || !Config.cnpmjs && (path.search(exp3) === 0 || path.search(exp4))) {
 | 
				
			||||||
        return httpHandler(req, path)
 | 
					        return httpHandler(req, path)
 | 
				
			||||||
    } else if (path.search(exp2) === 0) {
 | 
					    } else if (path.search(exp2) === 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue