| 12345678910111213141516171819202122232425262728293031323334353637 |
- 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;
|