From e1f628614651e201d74b4e82324d9bdd2971bad6 Mon Sep 17 00:00:00 2001 From: "mark.bracke@tactics.be" Date: Fri, 21 Feb 2025 11:18:15 +0100 Subject: [PATCH 1/2] Adds (backward-compatible) support for https using an extra constructor argument 'useSsl' --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/printer.ts | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 137ce31..bfe59af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 21/02/2025 0.9.24 + +- Added support for epson printers communicating over SSL + ## 31/03/2023 0.9.11 - Bugfix for Symbols diff --git a/package.json b/package.json index 509f3c4..2bd8b4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@baemingo/epson-printer-sdk", - "version": "0.9.23", + "version": "0.9.24", "description": "A modern and simple \"connect-less\" integration against EPSON printers", "license": "MIT", "publishConfig": { diff --git a/src/printer.ts b/src/printer.ts index 8e5499e..f2df4a1 100644 --- a/src/printer.ts +++ b/src/printer.ts @@ -10,8 +10,9 @@ const EPSON_XML_HEADER = class EpsonPrinter { private url; - constructor(ip: string) { - this.url = `http://${ip}/cgi-bin/epos/service.cgi?devid=local_printer&timeout=10000`; + constructor(ip: string, useSsl?: boolean) + { + this.url = `${useSsl == true ? 'https' : 'http'}://${ip}/cgi-bin/epos/service.cgi?devid=local_printer&timeout=10000` } public async send(print: EpsonPrint) { From d4152cfcb388761b02b9e5a86854326b9df1ef25 Mon Sep 17 00:00:00 2001 From: "mark.bracke@tactics.be" Date: Fri, 21 Feb 2025 11:35:43 +0100 Subject: [PATCH 2/2] Prettified constructor; useSsl now uses the default value false in stead of potentially null --- src/printer.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/printer.ts b/src/printer.ts index f2df4a1..a14720f 100644 --- a/src/printer.ts +++ b/src/printer.ts @@ -10,9 +10,8 @@ const EPSON_XML_HEADER = class EpsonPrinter { private url; - constructor(ip: string, useSsl?: boolean) - { - this.url = `${useSsl == true ? 'https' : 'http'}://${ip}/cgi-bin/epos/service.cgi?devid=local_printer&timeout=10000` + constructor(ip: string, useSsl = false) { + this.url = `${useSsl ? 'https' : 'http'}://${ip}/cgi-bin/epos/service.cgi?devid=local_printer&timeout=10000` } public async send(print: EpsonPrint) {