1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Tools: Fixed Android build

This commit is contained in:
Laurent Cozic 2021-11-21 16:38:56 +00:00
parent c972da1b15
commit bffd181f51
3 changed files with 3 additions and 5 deletions

View File

@ -36,7 +36,7 @@ class ResourceServer {
}
async start() {
this.port_ = await findAvailablePort([9167, 9267, 8167, 8267]);
this.port_ = await findAvailablePort(require('tcp-port-used'), [9167, 9267, 8167, 8267]);
if (!this.port_) {
this.logger().error('Could not find available port to start resource server. Please report the error at https://github.com/laurent22/joplin');
return;

View File

@ -10,9 +10,7 @@ export async function ip() {
return ip.ip;
}
export async function findAvailablePort(possiblePorts: number[], extraRandomPortsToTry = 20) {
const tcpPortUsed = require('tcp-port-used');
export async function findAvailablePort(tcpPortUsed: any, possiblePorts: number[], extraRandomPortsToTry = 20) {
for (let i = 0; i < extraRandomPortsToTry; i++) {
possiblePorts.push(Math.floor(8000 + Math.random() * 2000));
}

View File

@ -42,7 +42,7 @@ class OneDriveApiNodeUtils {
this.api().setAuth(null);
const port = await findAvailablePort(this.possibleOAuthDancePorts(), 0);
const port = await findAvailablePort(require('tcp-port-used'), this.possibleOAuthDancePorts(), 0);
if (!port) throw new Error(_('All potential ports are in use - please report the issue at %s', 'https://github.com/laurent22/joplin'));
const authCodeUrl = this.api().authCodeUrl(`http://localhost:${port}`);