@hot-updater/aws 0.19.8 → 0.20.0-rc.0
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/dist/lambda/index.cjs +11 -7
- package/package.json +4 -4
package/dist/lambda/index.cjs
CHANGED
|
@@ -3188,7 +3188,7 @@ var import_dist_cjs = __toESM$1(require_dist_cjs());
|
|
|
3188
3188
|
* @param {string} options.privateKey - CloudFront private key
|
|
3189
3189
|
* @returns {Promise<T|null>} - Update response object with fileUrl or null
|
|
3190
3190
|
*/
|
|
3191
|
-
const withSignedUrl = async ({ data, reqUrl, keyPairId, privateKey }) => {
|
|
3191
|
+
const withSignedUrl = async ({ data, reqUrl, keyPairId, privateKey, expiresSeconds = 60 }) => {
|
|
3192
3192
|
if (!data) return null;
|
|
3193
3193
|
const { storageUri,...rest } = data;
|
|
3194
3194
|
if (data.id === NIL_UUID || !data.storageUri) return {
|
|
@@ -3203,7 +3203,7 @@ const withSignedUrl = async ({ data, reqUrl, keyPairId, privateKey }) => {
|
|
|
3203
3203
|
url: url.toString(),
|
|
3204
3204
|
keyPairId,
|
|
3205
3205
|
privateKey,
|
|
3206
|
-
dateLessThan: new Date(Date.now() +
|
|
3206
|
+
dateLessThan: new Date(Date.now() + expiresSeconds * 1e3).toISOString()
|
|
3207
3207
|
});
|
|
3208
3208
|
return {
|
|
3209
3209
|
...rest,
|
|
@@ -3228,7 +3228,7 @@ const processDefaultValues = (channel, minBundleId) => ({
|
|
|
3228
3228
|
actualChannel: channel === "default" ? "production" : channel,
|
|
3229
3229
|
actualMinBundleId: minBundleId === "default" ? NIL_UUID : minBundleId
|
|
3230
3230
|
});
|
|
3231
|
-
const handleUpdateRequest = async (c, params, strategy) => {
|
|
3231
|
+
const handleUpdateRequest = async (c, params, strategy, expiresSeconds) => {
|
|
3232
3232
|
try {
|
|
3233
3233
|
const cdnHost = c.req.header("host");
|
|
3234
3234
|
if (!cdnHost) return c.json({ error: "Missing host header." }, 500);
|
|
@@ -3255,7 +3255,8 @@ const handleUpdateRequest = async (c, params, strategy) => {
|
|
|
3255
3255
|
data: updateInfo,
|
|
3256
3256
|
reqUrl: c.req.url,
|
|
3257
3257
|
keyPairId: CLOUDFRONT_KEY_PAIR_ID,
|
|
3258
|
-
privateKey: CLOUDFRONT_PRIVATE_KEY
|
|
3258
|
+
privateKey: CLOUDFRONT_PRIVATE_KEY,
|
|
3259
|
+
expiresSeconds
|
|
3259
3260
|
});
|
|
3260
3261
|
return c.json(appUpdateInfo);
|
|
3261
3262
|
} catch (error) {
|
|
@@ -3286,7 +3287,8 @@ app.get("/api/check-update", async (c) => {
|
|
|
3286
3287
|
minBundleId,
|
|
3287
3288
|
...fingerprintHash ? { fingerprintHash } : { appVersion }
|
|
3288
3289
|
};
|
|
3289
|
-
|
|
3290
|
+
const expiresSeconds = 60;
|
|
3291
|
+
return handleUpdateRequest(c, params, fingerprintHash ? "fingerprint" : "appVersion", expiresSeconds);
|
|
3290
3292
|
} catch (error) {
|
|
3291
3293
|
console.error("Legacy endpoint error:", error);
|
|
3292
3294
|
return c.json({ error: "Internal Server Error" }, 500);
|
|
@@ -3313,7 +3315,8 @@ app.get("/api/check-update/app-version/:platform/:appVersion/:channel/:minBundle
|
|
|
3313
3315
|
minBundleId: actualMinBundleId,
|
|
3314
3316
|
appVersion
|
|
3315
3317
|
};
|
|
3316
|
-
|
|
3318
|
+
const expiresSeconds = 60 * 60 * 24 * 365;
|
|
3319
|
+
return handleUpdateRequest(c, params, "appVersion", expiresSeconds);
|
|
3317
3320
|
});
|
|
3318
3321
|
app.get("/api/check-update/fingerprint/:platform/:fingerprintHash/:channel/:minBundleId/:bundleId", async (c) => {
|
|
3319
3322
|
const { platform, fingerprintHash, channel, minBundleId, bundleId } = c.req.param();
|
|
@@ -3336,7 +3339,8 @@ app.get("/api/check-update/fingerprint/:platform/:fingerprintHash/:channel/:minB
|
|
|
3336
3339
|
minBundleId: actualMinBundleId,
|
|
3337
3340
|
fingerprintHash
|
|
3338
3341
|
};
|
|
3339
|
-
|
|
3342
|
+
const expiresSeconds = 60 * 60 * 24 * 365;
|
|
3343
|
+
return handleUpdateRequest(c, params, "fingerprint", expiresSeconds);
|
|
3340
3344
|
});
|
|
3341
3345
|
app.get("*", async (c) => {
|
|
3342
3346
|
return c.env.callback(null, c.env.request);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/aws",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.20.0-rc.0",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"mime": "^4.0.4",
|
|
46
46
|
"picocolors": "^1.0.0",
|
|
47
47
|
"@clack/prompts": "0.10.0",
|
|
48
|
-
"@hot-updater/core": "0.
|
|
49
|
-
"@hot-updater/js": "0.
|
|
48
|
+
"@hot-updater/core": "0.20.0-rc.0",
|
|
49
|
+
"@hot-updater/js": "0.20.0-rc.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@aws-sdk/client-cloudfront": "3.772.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@aws-sdk/credential-providers": "3.772.0",
|
|
58
58
|
"@aws-sdk/lib-storage": "3.772.0",
|
|
59
59
|
"aws-lambda": "1.0.7",
|
|
60
|
-
"@hot-updater/plugin-core": "0.
|
|
60
|
+
"@hot-updater/plugin-core": "0.20.0-rc.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "tsdown",
|