squishjs 1.3.2 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Asset.js +14 -4
package/package.json
CHANGED
package/src/Asset.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { getAppDataPath } = require('./utils');
|
|
3
3
|
|
|
4
|
+
// assets is the old stuff, save it for backward compatibility
|
|
5
|
+
let _assetUrl = 'https://assets.homegames.io';
|
|
6
|
+
|
|
7
|
+
// dumb. probably a way to get around needing to do this in shared library between client and server
|
|
8
|
+
try {
|
|
9
|
+
_assetUrl = process?.env?.API_URL ? `${process.env.API_URL}/assets`: 'https://api.homegames.io/assets';
|
|
10
|
+
} catch (err) {
|
|
11
|
+
console.log('probably running in a browser');
|
|
12
|
+
console.error(err);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const ASSET_URL = _assetUrl;
|
|
16
|
+
|
|
4
17
|
class Asset {
|
|
5
18
|
constructor(info, data = null) {
|
|
6
19
|
this.info = info;
|
|
@@ -162,11 +175,8 @@ class Asset {
|
|
|
162
175
|
writeStream.on('close', () => {
|
|
163
176
|
resolve(filePath);
|
|
164
177
|
});
|
|
165
|
-
|
|
166
|
-
const apiUrl = this.getConfigValue('API_URL', null);
|
|
167
|
-
const assetUrl = apiUrl ? `${apiUrl}/assets` : 'https://assets.homegames.io';
|
|
168
178
|
|
|
169
|
-
getModule.get(`${
|
|
179
|
+
getModule.get(`${ASSET_URL}/${assetId}`, (res) => {
|
|
170
180
|
if (res.statusCode !== 200) {
|
|
171
181
|
reject('Bad response when downloading asset');
|
|
172
182
|
} else {
|