From cacb1599e3b126960819626ec3fd55bed75f878b Mon Sep 17 00:00:00 2001 From: Cyril Date: Wed, 27 Jan 2021 21:40:23 +0100 Subject: [PATCH 1/2] Allow for passwords that contain spaces, fix #15 --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 2c4b7a5..4faa7d7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -117,7 +117,7 @@ async function run() { const retData = { success: false, } as IRetData; - const [username, password] = str.split(" "); + const [username, password] = str.split(/ (.+)/, 2); const data: any = { username, password, From 297f87c55db4eb00fc48d030947828d2f58441cd Mon Sep 17 00:00:00 2001 From: Cyril Date: Wed, 27 Jan 2021 21:47:52 +0100 Subject: [PATCH 2/2] Fix style issues and linting issues, and a typo, too --- src/client.ts | 2 +- src/index.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/client.ts b/src/client.ts index 50709e7..e36cc8f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -238,7 +238,7 @@ export class Client extends EventEmitter { } const cookieJar = new toughCookie.CookieJar(this.api.context.cookies); return await Util.DownloadFile(url, { - responseType: "buffer", + responseType: "buffer", headers: { Authorization: "skypetoken=" + this.api.context.skypeToken.value, RegistrationToken: this.api.context.registrationToken.raw, diff --git a/src/index.ts b/src/index.ts index 4faa7d7..d2d2fae 100644 --- a/src/index.ts +++ b/src/index.ts @@ -46,7 +46,7 @@ if (options.help) { console.log(commandLineUsage([ { header: "Matrix Skype Puppet Bridge", - content: "A matrix puppet bridge for skype", + content: "A matrix puppet bridge for Skype", }, { header: "Options", @@ -117,7 +117,8 @@ async function run() { const retData = { success: false, } as IRetData; - const [username, password] = str.split(/ (.+)/, 2); + const TOKENS_TO_EXTRACT = 2; + const [username, password] = str.split(/ (.+)/, TOKENS_TO_EXTRACT); const data: any = { username, password, @@ -128,7 +129,7 @@ async function run() { data.state = client.getState; await client.disconnect(); } catch (err) { - log.verbose("Failed to log in as new user, perhaps the password is worng?"); + log.verbose("Failed to log in as new user, perhaps the password is wrong?"); log.silly(err); retData.error = "Username or password wrong"; return retData;