From 3afb0c1120692db6eb5a8f9f82be85896da5f68a Mon Sep 17 00:00:00 2001 From: Joseph Garcia Date: Wed, 6 Nov 2024 20:31:01 -0700 Subject: [PATCH 1/2] 1.0.11 --- package-lock.json | 4 ++-- package.json | 2 +- src/Asset.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 59666b1..2c9d909 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "squishjs", - "version": "1.0.10", + "version": "1.0.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "squishjs", - "version": "1.0.10", + "version": "1.0.11", "license": "ISC" } } diff --git a/package.json b/package.json index 3300832..9a97535 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "squishjs", - "version": "1.0.10", + "version": "1.0.11", "description": "squish & unsquish stuff", "scripts": { "test": "node testRunner.js" diff --git a/src/Asset.js b/src/Asset.js index 4c5b724..b31f6ae 100644 --- a/src/Asset.js +++ b/src/Asset.js @@ -164,7 +164,8 @@ class Asset { }); let data = ''; - getModule.get(`https://assets.homegames.io/${assetId}`, (res) => { + const assetSource = this.info?.source? || 'https://assets.homegames.io'; + getModule.get(`${assetSource}/${assetId}`, (res) => { res.on('data', (chunk) => { data += chunk; writeStream.write(chunk); From 4981c128fd35fb092ed767b0b313fa8b96d3d368 Mon Sep 17 00:00:00 2001 From: Joseph Garcia Date: Wed, 6 Nov 2024 20:32:53 -0700 Subject: [PATCH 2/2] cool --- src/Asset.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Asset.js b/src/Asset.js index b31f6ae..89b1483 100644 --- a/src/Asset.js +++ b/src/Asset.js @@ -157,7 +157,6 @@ class Asset { const filePath = `${path}/${fileHash}`; const writeStream = this.fs.createWriteStream(filePath); - const getModule = this.https; writeStream.on('close', () => { resolve(filePath); @@ -165,6 +164,9 @@ class Asset { let data = ''; const assetSource = this.info?.source? || 'https://assets.homegames.io'; + + const getModule = assetSource.startsWith('https') ? this.https : this.http; + getModule.get(`${assetSource}/${assetId}`, (res) => { res.on('data', (chunk) => { data += chunk;