diff --git a/src/services/tunnel.ts b/src/services/tunnel.ts index 5c04164..bd7708d 100644 --- a/src/services/tunnel.ts +++ b/src/services/tunnel.ts @@ -41,7 +41,9 @@ export class TunnelService { async start(): Promise { console.log( - `Setting up ${this.config.useServeo ? "Serveo" : "Localtunnel"} tunnel on port ${this.config.port}...`, + `Setting up ${ + this.config.useServeo ? "Serveo" : "Localtunnel" + } tunnel on port ${this.config.port}...` ); const tunnel = this.config.useServeo @@ -56,7 +58,7 @@ export class TunnelService { this.registerCleanupHandlers(); console.log( - "Tunnel is running. Watching for changes. Press Ctrl+C to stop.", + "Tunnel is running. Watching for changes. Press Ctrl+C to stop." ); await this.watchForChanges(); } @@ -129,7 +131,7 @@ export class TunnelService { tunnelUrl: string; cleanup: () => Promise; }) => void, - reject: (reason: Error) => void, + reject: (reason: Error) => void ): void { let tunnelUrl = ""; @@ -165,7 +167,8 @@ export class TunnelService { await this.updateBitteConfig({ url: this.tunnelUrl }); await new Promise((resolve) => setTimeout(resolve, 1000)); - const signedMessage = await this.pluginService.auth.authenticateOrCreateKey(); + const signedMessage = + await this.pluginService.auth.authenticateOrCreateKey(); if (!signedMessage) { throw new Error("Failed to authenticate or create a key."); } @@ -175,7 +178,7 @@ export class TunnelService { if (!isValid || !accountId) { throw new Error( - "OpenAPI specification validation failed or missing account ID.", + "OpenAPI specification validation failed or missing account ID." ); } @@ -186,7 +189,7 @@ export class TunnelService { if (!result) { console.log( - "Initial registration failed. Waiting for file changes to retry...", + "Initial registration failed. Waiting for file changes to retry..." ); return; } @@ -214,7 +217,7 @@ export class TunnelService { private async handleFileChange( event: { filename: string | null }, - projectDir: string, + projectDir: string ): Promise { if (!this.tunnelUrl || !this.pluginId) return; @@ -222,14 +225,15 @@ export class TunnelService { if (this.shouldIgnorePath(relativePath)) return; console.log( - `Change detected in ${relativePath}. Attempting to update or register the plugin...`, + `Change detected in ${relativePath}. Attempting to update or register the plugin...` ); const { accountId } = await validateAndParseOpenApiSpec( - getSpecUrl(this.tunnelUrl), + getSpecUrl(this.tunnelUrl) + ); + const authentication = await this.pluginService.auth.getAuthentication( + accountId ); - const authentication = - await this.pluginService.auth.getAuthentication(accountId); const result = authentication ? await this.pluginService.update(this.pluginId, accountId) @@ -274,7 +278,7 @@ export class TunnelService { const updatedConfig = { ...existingConfig, ...data }; await appendToEnv( BITTE_CONFIG_ENV_KEY, - JSON.stringify(updatedConfig, null, 2), + JSON.stringify(updatedConfig, null, 2) ); console.log("BITTE_CONFIG updated successfully."); }