mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-11-04 09:25:15 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			977 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			977 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import internalDeadHost from "./dead-host.js";
 | 
						|
import internalProxyHost from "./proxy-host.js";
 | 
						|
import internalRedirectionHost from "./redirection-host.js";
 | 
						|
import internalStream from "./stream.js";
 | 
						|
 | 
						|
const internalReport = {
 | 
						|
	/**
 | 
						|
	 * @param  {Access}   access
 | 
						|
	 * @return {Promise}
 | 
						|
	 */
 | 
						|
	getHostsReport: (access) => {
 | 
						|
		return access
 | 
						|
			.can("reports:hosts", 1)
 | 
						|
			.then((access_data) => {
 | 
						|
				const userId = access.token.getUserId(1);
 | 
						|
 | 
						|
				const promises = [
 | 
						|
					internalProxyHost.getCount(userId, access_data.visibility),
 | 
						|
					internalRedirectionHost.getCount(userId, access_data.visibility),
 | 
						|
					internalStream.getCount(userId, access_data.visibility),
 | 
						|
					internalDeadHost.getCount(userId, access_data.visibility),
 | 
						|
				];
 | 
						|
 | 
						|
				return Promise.all(promises);
 | 
						|
			})
 | 
						|
			.then((counts) => {
 | 
						|
				return {
 | 
						|
					proxy: counts.shift(),
 | 
						|
					redirection: counts.shift(),
 | 
						|
					stream: counts.shift(),
 | 
						|
					dead: counts.shift(),
 | 
						|
				};
 | 
						|
			});
 | 
						|
	},
 | 
						|
};
 | 
						|
 | 
						|
export default internalReport;
 |