squishjs 1.3.0 → 1.3.2
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 +4 -14
package/package.json
CHANGED
package/src/Asset.js
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
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://assets.homegames.io';
|
|
10
|
-
} catch (err) {
|
|
11
|
-
console.log('probably running in a browser');
|
|
12
|
-
console.error(err);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const ASSET_URL = _assetUrl;
|
|
16
|
-
|
|
17
4
|
class Asset {
|
|
18
5
|
constructor(info, data = null) {
|
|
19
6
|
this.info = info;
|
|
@@ -175,8 +162,11 @@ class Asset {
|
|
|
175
162
|
writeStream.on('close', () => {
|
|
176
163
|
resolve(filePath);
|
|
177
164
|
});
|
|
165
|
+
|
|
166
|
+
const apiUrl = this.getConfigValue('API_URL', null);
|
|
167
|
+
const assetUrl = apiUrl ? `${apiUrl}/assets` : 'https://assets.homegames.io';
|
|
178
168
|
|
|
179
|
-
getModule.get(`${
|
|
169
|
+
getModule.get(`${assetUrl}/${assetId}`, (res) => {
|
|
180
170
|
if (res.statusCode !== 200) {
|
|
181
171
|
reject('Bad response when downloading asset');
|
|
182
172
|
} else {
|