mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	fix enforcing node's http requests for sync
This commit is contained in:
		
							parent
							
								
									00faf758e8
								
							
						
					
					
						commit
						85d986534d
					
				@ -9,12 +9,13 @@ const syncOptions = require('./sync_options');
 | 
			
		||||
// this allows to support system proxy
 | 
			
		||||
 | 
			
		||||
function exec(opts) {
 | 
			
		||||
    const client = getClient(opts);
 | 
			
		||||
 | 
			
		||||
    // hack for cases where electron.net does not work but we don't want to set proxy
 | 
			
		||||
    if (opts.proxy === 'noproxy') {
 | 
			
		||||
        opts.proxy = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const client = getClient(opts);
 | 
			
		||||
    const proxyAgent = getProxyAgent(opts);
 | 
			
		||||
    const parsedTargetUrl = url.parse(opts.url);
 | 
			
		||||
 | 
			
		||||
@ -111,6 +112,8 @@ async function getImage(imageUrl) {
 | 
			
		||||
 | 
			
		||||
            request.on('error', err => reject(generateError(opts, err)));
 | 
			
		||||
 | 
			
		||||
            request.on('abort', err => reject(generateError(opts, err)));
 | 
			
		||||
 | 
			
		||||
            request.on('response', response => {
 | 
			
		||||
                if (![200, 201, 204].includes(response.statusCode)) {
 | 
			
		||||
                    reject(generateError(opts, response.statusCode + ' ' + response.statusMessage));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user