@hot-updater/aws 0.12.3 → 0.12.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/dist/lambda/index.cjs +9 -12
- package/package.json +2 -3
package/dist/lambda/index.cjs
CHANGED
|
@@ -4664,7 +4664,7 @@ var getUpdateInfo2 = async (s32, bucketName, {
|
|
|
4664
4664
|
};
|
|
4665
4665
|
|
|
4666
4666
|
// lambda/index.ts
|
|
4667
|
-
var s3 = new import_client_s32.S3Client();
|
|
4667
|
+
var s3 = new import_client_s32.S3Client({ region: HotUpdater.S3_REGION });
|
|
4668
4668
|
function parseS3Url(url) {
|
|
4669
4669
|
try {
|
|
4670
4670
|
const parsedUrl = new URL(url);
|
|
@@ -4695,22 +4695,14 @@ async function signUpdateInfoFileUrl(updateInfo) {
|
|
|
4695
4695
|
var app = new Hono2();
|
|
4696
4696
|
app.get("/api/check-update", async (c) => {
|
|
4697
4697
|
try {
|
|
4698
|
-
const { headers
|
|
4699
|
-
let bucketName;
|
|
4700
|
-
if (origin?.s3?.domainName) {
|
|
4701
|
-
const domainName = origin.s3.domainName;
|
|
4702
|
-
[bucketName] = domainName.split(".s3");
|
|
4703
|
-
}
|
|
4704
|
-
if (!bucketName) {
|
|
4705
|
-
return c.json({ error: "Bucket name not found." }, 500);
|
|
4706
|
-
}
|
|
4698
|
+
const { headers } = c.env.request;
|
|
4707
4699
|
const bundleId = headers["x-bundle-id"]?.[0]?.value;
|
|
4708
4700
|
const appPlatform = headers["x-app-platform"]?.[0]?.value;
|
|
4709
4701
|
const appVersion = headers["x-app-version"]?.[0]?.value;
|
|
4710
4702
|
if (!bundleId || !appPlatform || !appVersion) {
|
|
4711
4703
|
return c.json({ error: "Missing required headers." }, 400);
|
|
4712
4704
|
}
|
|
4713
|
-
const updateInfo = await getUpdateInfo2(s3,
|
|
4705
|
+
const updateInfo = await getUpdateInfo2(s3, HotUpdater.S3_BUCKET_NAME, {
|
|
4714
4706
|
platform: appPlatform,
|
|
4715
4707
|
bundleId,
|
|
4716
4708
|
appVersion
|
|
@@ -4721,7 +4713,12 @@ app.get("/api/check-update", async (c) => {
|
|
|
4721
4713
|
const finalInfo = await signUpdateInfoFileUrl(updateInfo);
|
|
4722
4714
|
return c.json(finalInfo);
|
|
4723
4715
|
} catch {
|
|
4724
|
-
return c.json(
|
|
4716
|
+
return c.json(
|
|
4717
|
+
{
|
|
4718
|
+
error: "Internal Server Error"
|
|
4719
|
+
},
|
|
4720
|
+
500
|
|
4721
|
+
);
|
|
4725
4722
|
}
|
|
4726
4723
|
});
|
|
4727
4724
|
app.get("*", async (c) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/aws",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.5",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/src/index.cjs",
|
|
7
7
|
"module": "dist/src/index.js",
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"require": "./dist/sdk/index.cjs"
|
|
28
28
|
},
|
|
29
29
|
"./lambda": {
|
|
30
|
-
"import": "./dist/lambda/index.js",
|
|
31
30
|
"require": "./dist/lambda/index.cjs"
|
|
32
31
|
}
|
|
33
32
|
},
|
|
@@ -53,7 +52,7 @@
|
|
|
53
52
|
"@aws-sdk/client-s3": "^3.685.0",
|
|
54
53
|
"@aws-sdk/credential-providers": "^3.744.0",
|
|
55
54
|
"@aws-sdk/lib-storage": "^3.685.0",
|
|
56
|
-
"@hot-updater/plugin-core": "0.12.
|
|
55
|
+
"@hot-updater/plugin-core": "0.12.5",
|
|
57
56
|
"aws-lambda": "^1.0.7"
|
|
58
57
|
},
|
|
59
58
|
"scripts": {
|