fix(core): update
This commit is contained in:
@ -6,14 +6,15 @@ export class Detector {
|
||||
|
||||
public async isActive(urlArg: string): Promise<boolean> {
|
||||
const parsedUrl = this.smarturlInstance.parseUrl(urlArg);
|
||||
if (parsedUrl.host === 'localhost') {
|
||||
if (parsedUrl.hostname === 'localhost') {
|
||||
console.log(`detector target is localhost on port ${parsedUrl.port}`);
|
||||
const result = await this.smartnetworkInstance.isLocalPortAvailable(parseInt(parsedUrl.port, 10));
|
||||
return result;
|
||||
const portUnused = await this.smartnetworkInstance.isLocalPortUnused(parseInt(parsedUrl.port, 10));
|
||||
const portAvailable = !portUnused;
|
||||
return portAvailable;
|
||||
} else {
|
||||
console.log(`detector target is remote domain ${parsedUrl.host} on port ${parsedUrl.port}`);
|
||||
const result = await this.smartnetworkInstance.isRemotePortAvailable(parsedUrl.host, parseInt(parsedUrl.port, 10));
|
||||
return result;
|
||||
const postAvailable = await this.smartnetworkInstance.isRemotePortAvailable(parsedUrl.host, parseInt(parsedUrl.port, 10));
|
||||
return postAvailable;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user