react-native-bspatch 1.0.0 → 1.0.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/lib/commonjs/ota/types.js.map +1 -1
- package/lib/module/ota/types.js.map +1 -1
- package/lib/typescript/ota/types.d.ts +2 -0
- package/lib/typescript/ota/types.d.ts.map +1 -1
- package/package.json +86 -87
- package/src/ota/types.ts +2 -0
- package/tools/build_ota.sh +63 -70
- package/tools/setup_project.js +17 -37
- package/tools/upload_ota_custom.sh +108 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["OtaUpdateMode","exports","OtaStorageType","OtaStatus"],"sourceRoot":"../../../src","sources":["ota/types.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AAFA,IAuBYA,aAAa,GAAAC,OAAA,CAAAD,aAAA,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAA,IAObE,cAAc,GAAAD,OAAA,CAAAC,cAAA,0BAAdA,cAAc;EACtB;EADQA,cAAc;EAGtB;EAHQA,cAAc;EAAA,OAAdA,cAAc;AAAA;
|
|
1
|
+
{"version":3,"names":["OtaUpdateMode","exports","OtaStorageType","OtaStatus"],"sourceRoot":"../../../src","sources":["ota/types.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AAFA,IAuBYA,aAAa,GAAAC,OAAA,CAAAD,aAAA,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAA,IAObE,cAAc,GAAAD,OAAA,CAAAC,cAAA,0BAAdA,cAAc;EACtB;EADQA,cAAc;EAGtB;EAHQA,cAAc;EAAA,OAAdA,cAAc;AAAA;AA4C1B;AACA;AACA;AAFA,IAiHYC,SAAS,GAAAF,OAAA,CAAAE,SAAA,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["OtaUpdateMode","OtaStorageType","OtaStatus"],"sourceRoot":"../../../src","sources":["ota/types.ts"],"mappings":";;AAAA;AACA;AACA;;AAqBA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAOzB,WAAYC,cAAc,0BAAdA,cAAc;EACtB;EADQA,cAAc;EAGtB;EAHQA,cAAc;EAAA,OAAdA,cAAc;AAAA;;
|
|
1
|
+
{"version":3,"names":["OtaUpdateMode","OtaStorageType","OtaStatus"],"sourceRoot":"../../../src","sources":["ota/types.ts"],"mappings":";;AAAA;AACA;AACA;;AAqBA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAOzB,WAAYC,cAAc,0BAAdA,cAAc;EACtB;EADQA,cAAc;EAGtB;EAHQA,cAAc;EAAA,OAAdA,cAAc;AAAA;;AA4C1B;AACA;AACA;;AA+GA,WAAYC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ota/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,SAAS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
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
2
|
+
"name": "react-native-bspatch",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Premium OTA Update Solution for React Native using TurboModules and bsdiff",
|
|
5
|
+
"main": "lib/commonjs/index.js",
|
|
6
|
+
"module": "lib/module/index.js",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index.ts",
|
|
9
|
+
"source": "src/index.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"android",
|
|
12
|
+
"ios",
|
|
13
|
+
"cpp",
|
|
14
|
+
"src",
|
|
15
|
+
"lib",
|
|
16
|
+
"tools",
|
|
17
|
+
"react-native-bspatch.podspec",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"!**/__tests__",
|
|
21
|
+
"!**/__fixtures__",
|
|
22
|
+
"!**/__mocks__"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"react-native",
|
|
26
|
+
"ota",
|
|
27
|
+
"update",
|
|
28
|
+
"bspatch",
|
|
29
|
+
"bsdiff",
|
|
30
|
+
"turbo-module",
|
|
31
|
+
"android",
|
|
32
|
+
"ios"
|
|
33
|
+
],
|
|
34
|
+
"codegenConfig": {
|
|
35
|
+
"name": "RNBsPatchSpec",
|
|
36
|
+
"type": "modules",
|
|
37
|
+
"jsSrcsDir": "src"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": "*",
|
|
41
|
+
"react-native": "*",
|
|
42
|
+
"react-native-blob-util": "*"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"crypto-js": "^4.2.0"
|
|
46
|
+
},
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/BuiHung1612/react-native-bspatch.git"
|
|
50
|
+
},
|
|
51
|
+
"author": "Hung Bui <https://github.com/BuiHung1612>",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/BuiHung1612/react-native-bspatch/issues"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/BuiHung1612/react-native-bspatch#readme",
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"bin": {
|
|
61
|
+
"react-native-bspatch": "./tools/build_ota.sh"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"setup": "node ./tools/setup_project.js",
|
|
65
|
+
"typecheck": "tsc --noEmit",
|
|
66
|
+
"prepare": "bob build"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@types/crypto-js": "^4.2.2",
|
|
70
|
+
"@types/react": "^19.2.0",
|
|
71
|
+
"react-native-builder-bob": "^0.43.0",
|
|
72
|
+
"typescript": "^5.0.0"
|
|
73
|
+
},
|
|
74
|
+
"react-native-builder-bob": {
|
|
75
|
+
"source": "src",
|
|
76
|
+
"output": "lib",
|
|
77
|
+
"targets": [
|
|
78
|
+
"commonjs",
|
|
79
|
+
"module",
|
|
80
|
+
[
|
|
81
|
+
"typescript",
|
|
82
|
+
{
|
|
83
|
+
"project": "tsconfig.build.json"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
]
|
|
87
|
+
}
|
|
89
88
|
}
|
package/src/ota/types.ts
CHANGED
package/tools/build_ota.sh
CHANGED
|
@@ -81,86 +81,79 @@ REGISTRY_SHARED="$ROOT/ota_registry.json"
|
|
|
81
81
|
# ── Registry Sync ──────────────────────────────────────────────────────────
|
|
82
82
|
# Skip registry sync for reset/clean actions
|
|
83
83
|
if [ "$ACTION" != "reset" ]; then
|
|
84
|
-
# Download the latest ota_registry.json from server so we don't clobber other platforms
|
|
85
84
|
echo "Syncing remote registry..."
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
echo "
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
# Debug: show curl command for manual testing
|
|
109
|
-
echo " Login URL: ${BASE_URL}/public/authen/login"
|
|
110
|
-
|
|
111
|
-
LOGIN_RES=$(curl -s -X "POST" "$BASE_URL/public/authen/login" \
|
|
112
|
-
-H 'Content-Type: application/json; charset=utf-8' \
|
|
113
|
-
-w "\n---HTTP_STATUS:%{http_code}" \
|
|
114
|
-
-d "{\"username\": \"$UPCODE_USER\", \"password\": \"$UPCODE_PASS\"}")
|
|
115
|
-
|
|
116
|
-
# Extract HTTP status and response body
|
|
117
|
-
HTTP_STATUS=$(echo "$LOGIN_RES" | grep -o 'HTTP_STATUS:[0-9]*' | cut -d: -f2)
|
|
118
|
-
LOGIN_BODY=$(echo "$LOGIN_RES" | sed 's/---HTTP_STATUS:.*//')
|
|
119
|
-
|
|
120
|
-
# Debug: show login response on error or empty
|
|
121
|
-
if [ -z "$LOGIN_BODY" ] || [ "$HTTP_STATUS" != "200" ]; then
|
|
122
|
-
echo " ⚠ Login failed - HTTP $HTTP_STATUS"
|
|
123
|
-
echo " ⚠ Response: $LOGIN_BODY"
|
|
124
|
-
fi
|
|
125
|
-
|
|
126
|
-
TOKEN=$(echo "$LOGIN_BODY" | node -e "
|
|
127
|
-
try {
|
|
128
|
-
const r = JSON.parse(require('fs').readFileSync(0, 'utf8'));
|
|
129
|
-
console.log(r.data?.accessTokenInfo?.accessToken || '');
|
|
130
|
-
} catch(e) { console.log(''); }
|
|
131
|
-
")
|
|
132
|
-
|
|
133
|
-
if [[ -n "$TOKEN" ]]; then
|
|
134
|
-
REGISTRY_REMOTE_PATH="$BASE_FOLDER/ota_registry.json"
|
|
135
|
-
# Encode slash as %2F for MinIO API
|
|
136
|
-
ENCODED_PATH=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$REGISTRY_REMOTE_PATH', safe=''))")
|
|
137
|
-
GEN_LINK_URL="$BASE_URL/api/minio/gen-download-link?pathFile=$ENCODED_PATH"
|
|
138
|
-
|
|
139
|
-
LINK_RES=$(curl -s -X "GET" "$GEN_LINK_URL" -H "Authorization: Bearer $TOKEN")
|
|
140
|
-
REGISTRY_URL=$(echo "$LINK_RES" | node -e "
|
|
141
|
-
try {
|
|
142
|
-
const r = JSON.parse(require('fs').readFileSync(0, 'utf8'));
|
|
143
|
-
console.log(r.data || '');
|
|
144
|
-
} catch(e) { console.log(''); }
|
|
145
|
-
")
|
|
146
|
-
|
|
147
|
-
if [[ -n "$REGISTRY_URL" ]]; then
|
|
148
|
-
echo " Downloading remote registry..."
|
|
149
|
-
curl -s -o "$REGISTRY_SHARED" "$REGISTRY_URL"
|
|
150
|
-
echo " ✓ Registry synced"
|
|
86
|
+
BASE_URL="${OTA_BASE_URL:-https://sync-server.osp.com.vn}"
|
|
87
|
+
UPCODE_USER="${OTA_UPLOAD_USER:-}"
|
|
88
|
+
UPCODE_PASS="${OTA_UPLOAD_PASSWORD:-}"
|
|
89
|
+
BASE_FOLDER="${OTA_FOLDER:-ota}"
|
|
90
|
+
|
|
91
|
+
echo " Using URL: $BASE_URL"
|
|
92
|
+
echo " Using Folder: $BASE_FOLDER"
|
|
93
|
+
|
|
94
|
+
if [[ "$BASE_URL" == *"github"* ]] || [[ "$BASE_URL" == *"raw.githubusercontent"* ]]; then
|
|
95
|
+
echo " Downloading remote registry from GitHub..."
|
|
96
|
+
HTTP_CODE=$(curl -s -w "%{http_code}" -o "$REGISTRY_SHARED.tmp" "$BASE_URL/$BASE_FOLDER/ota_registry.json" 2>/dev/null || true)
|
|
97
|
+
if [ "$HTTP_CODE" != "200" ]; then
|
|
98
|
+
HTTP_CODE=$(curl -s -w "%{http_code}" -o "$REGISTRY_SHARED.tmp" "$BASE_URL/ota_registry.json" 2>/dev/null || true)
|
|
99
|
+
fi
|
|
100
|
+
if [ "$HTTP_CODE" = "200" ] && [ -s "$REGISTRY_SHARED.tmp" ]; then
|
|
101
|
+
mv "$REGISTRY_SHARED.tmp" "$REGISTRY_SHARED"
|
|
102
|
+
echo " ✓ Remote registry synced"
|
|
103
|
+
else
|
|
104
|
+
rm -f "$REGISTRY_SHARED.tmp"
|
|
105
|
+
echo " Notice: Remote registry not found on GitHub (starting fresh with local state)."
|
|
106
|
+
fi
|
|
151
107
|
else
|
|
152
|
-
|
|
153
|
-
|
|
108
|
+
if [[ -n "$UPCODE_USER" ]] && [[ -n "$UPCODE_PASS" ]]; then
|
|
109
|
+
LOGIN_RES=$(curl -s -X "POST" "$BASE_URL/public/authen/login" \
|
|
110
|
+
-H 'Content-Type: application/json; charset=utf-8' \
|
|
111
|
+
-w "\n---HTTP_STATUS:%{http_code}" \
|
|
112
|
+
-d "{\"username\": \"$UPCODE_USER\", \"password\": \"$UPCODE_PASS\"}")
|
|
113
|
+
HTTP_STATUS=$(echo "$LOGIN_RES" | grep -o 'HTTP_STATUS:[0-9]*' | cut -d: -f2)
|
|
114
|
+
LOGIN_BODY=$(echo "$LOGIN_RES" | sed 's/---HTTP_STATUS:.*//')
|
|
115
|
+
|
|
116
|
+
TOKEN=$(echo "$LOGIN_BODY" | node -e "
|
|
117
|
+
try {
|
|
118
|
+
const r = JSON.parse(require('fs').readFileSync(0, 'utf8'));
|
|
119
|
+
console.log(r.data?.accessTokenInfo?.accessToken || '');
|
|
120
|
+
} catch(e) { console.log(''); }
|
|
121
|
+
")
|
|
122
|
+
|
|
123
|
+
if [[ -n "$TOKEN" ]]; then
|
|
124
|
+
REGISTRY_REMOTE_PATH="$BASE_FOLDER/ota_registry.json"
|
|
125
|
+
ENCODED_PATH=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$REGISTRY_REMOTE_PATH', safe=''))")
|
|
126
|
+
GEN_LINK_URL="$BASE_URL/api/minio/gen-download-link?pathFile=$ENCODED_PATH"
|
|
127
|
+
LINK_RES=$(curl -s -X "GET" "$GEN_LINK_URL" -H "Authorization: Bearer $TOKEN")
|
|
128
|
+
REGISTRY_URL=$(echo "$LINK_RES" | node -e "
|
|
129
|
+
try {
|
|
130
|
+
const r = JSON.parse(require('fs').readFileSync(0, 'utf8'));
|
|
131
|
+
console.log(r.data || '');
|
|
132
|
+
} catch(e) { console.log(''); }
|
|
133
|
+
")
|
|
134
|
+
if [[ -n "$REGISTRY_URL" ]]; then
|
|
135
|
+
curl -s -o "$REGISTRY_SHARED" "$REGISTRY_URL"
|
|
136
|
+
echo " ✓ Registry synced"
|
|
137
|
+
fi
|
|
138
|
+
else
|
|
139
|
+
echo " ⚠ MinIO login skipped. Proceeding with local state."
|
|
140
|
+
fi
|
|
141
|
+
else
|
|
142
|
+
echo " ⚠ No MinIO credentials. Proceeding with local state."
|
|
143
|
+
fi
|
|
154
144
|
fi
|
|
155
|
-
else
|
|
156
|
-
echo " ⚠ Login failed during registry sync. Proceeding with local state."
|
|
157
|
-
fi
|
|
158
145
|
fi
|
|
159
146
|
|
|
160
147
|
# ── Helper: Download from Server ──────────────────────────────────────────────
|
|
161
148
|
download_from_minio() {
|
|
162
149
|
local REMOTE_PATH="$1"
|
|
163
150
|
local DEST="$2"
|
|
151
|
+
|
|
152
|
+
if [[ "$BASE_URL" == *"github"* ]] || [[ "$BASE_URL" == *"raw.githubusercontent"* ]]; then
|
|
153
|
+
curl -s -f -o "$DEST" "$BASE_URL/$REMOTE_PATH" 2>/dev/null || curl -s -f -o "$DEST" "$BASE_URL/$(basename "$REMOTE_PATH")" 2>/dev/null
|
|
154
|
+
return $?
|
|
155
|
+
fi
|
|
156
|
+
|
|
164
157
|
if [[ -z "$TOKEN" ]]; then return 1; fi
|
|
165
158
|
|
|
166
159
|
local ENCODED_PATH=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$REMOTE_PATH', safe=''))")
|
package/tools/setup_project.js
CHANGED
|
@@ -91,44 +91,24 @@ function patchPbxproj(content) {
|
|
|
91
91
|
// Already patched?
|
|
92
92
|
if (content.includes(XCODE_BUNDLE_SYNC_MARKER)) return content;
|
|
93
93
|
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
94
|
+
// Search by phase name
|
|
95
|
+
const nameIdx = content.indexOf('name = "Bundle React Native code and images";');
|
|
96
|
+
if (nameIdx !== -1) {
|
|
97
|
+
const shellScriptIdx = content.indexOf('shellScript = "', nameIdx);
|
|
98
|
+
if (shellScriptIdx !== -1) {
|
|
99
|
+
const endIdx = content.indexOf('";', shellScriptIdx + 15);
|
|
100
|
+
if (endIdx !== -1) {
|
|
101
|
+
return (
|
|
102
|
+
content.slice(0, endIdx) +
|
|
103
|
+
XCODE_BUNDLE_SYNC_SNIPPET +
|
|
104
|
+
content.slice(endIdx)
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
107
|
}
|
|
108
|
-
// Find the shellScript = "..." after this name line
|
|
109
|
-
const afterName = content.indexOf('shellScript = "', nameIdx - 500);
|
|
110
|
-
if (afterName === -1) return content;
|
|
111
|
-
|
|
112
|
-
// Find the end of this shellScript: look for \n\"; after it
|
|
113
|
-
const scriptEnd = content.indexOf('\\n";', afterName);
|
|
114
|
-
if (scriptEnd === -1) return content;
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
content.slice(0, scriptEnd) +
|
|
118
|
-
XCODE_BUNDLE_SYNC_SNIPPET +
|
|
119
|
-
content.slice(scriptEnd)
|
|
120
|
-
);
|
|
121
108
|
}
|
|
122
109
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
// Remove trailing \n if present before closing
|
|
126
|
-
const insertPoint = match.index + match[1].length + scriptBody.length;
|
|
127
|
-
return (
|
|
128
|
-
content.slice(0, insertPoint) +
|
|
129
|
-
XCODE_BUNDLE_SYNC_SNIPPET +
|
|
130
|
-
content.slice(insertPoint)
|
|
131
|
-
);
|
|
110
|
+
console.log(' ⚠ Could not find "Bundle React Native code and images" build phase in project.pbxproj.');
|
|
111
|
+
return content;
|
|
132
112
|
}
|
|
133
113
|
|
|
134
114
|
// ── iOS: AppDelegate.swift ────────────────────────────────────────────────────
|
|
@@ -229,8 +209,8 @@ function main() {
|
|
|
229
209
|
// ── iOS ──
|
|
230
210
|
console.log('\n[iOS]');
|
|
231
211
|
|
|
232
|
-
// project.pbxproj
|
|
233
|
-
const pbxprojFiles = findFile(IOS_DIR, (name) => name === 'project.pbxproj');
|
|
212
|
+
// project.pbxproj (ignore CocoaPods project file)
|
|
213
|
+
const pbxprojFiles = findFile(IOS_DIR, (name, fullPath) => name === 'project.pbxproj' && !fullPath.includes('Pods'));
|
|
234
214
|
if (pbxprojFiles.length === 0) {
|
|
235
215
|
console.log(' ⚠ No project.pbxproj found. Is this an iOS project?');
|
|
236
216
|
} else {
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
-
# Custom OTA Upload Script for Sync Server
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# 2) ota_registry.json → {baseFolder}/ota_registry.json
|
|
4
|
+
# Custom OTA Upload Script for Sync Server & GitHub Storage
|
|
5
|
+
# Uploads: 1) All .patch & .hbc files → {baseFolder}/{appVersion}/{channel}/
|
|
6
|
+
# 2) ota_registry.json → {baseFolder}/ota_registry.json
|
|
8
7
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
# Load environment variables if .env exists
|
|
10
|
+
ROOT_DIR=$(pwd)
|
|
11
|
+
if [ -f "$ROOT_DIR/.env" ]; then
|
|
12
|
+
export $(grep -v '^#' "$ROOT_DIR/.env" | grep -v '^$' | xargs 2>/dev/null)
|
|
13
|
+
fi
|
|
15
14
|
|
|
15
|
+
BASE_URL="${OTA_BASE_URL:-}"
|
|
16
|
+
UPCODE_USER="${OTA_UPLOAD_USER:-}"
|
|
17
|
+
UPCODE_PASS="${OTA_UPLOAD_PASSWORD:-}"
|
|
18
|
+
BASE_FOLDER="${OTA_FOLDER:-${6:-ota}}"
|
|
16
19
|
APP_VERSION="$1"
|
|
17
20
|
CHANNEL="$2"
|
|
18
21
|
OTA_VERSION="$3"
|
|
19
22
|
BUNDLE_PATH="$4" # unused — we upload .patch files, not the bundle
|
|
20
23
|
PLATFORM="$5"
|
|
21
|
-
BASE_FOLDER="${6:-congplqg}"
|
|
22
24
|
|
|
23
|
-
ROOT_DIR=$(pwd)
|
|
24
25
|
REGISTRY_FILE="$ROOT_DIR/ota_registry.json"
|
|
25
26
|
OUTPUT_DIR="$ROOT_DIR/android/output"
|
|
26
27
|
if [[ "$PLATFORM" == "ios" ]]; then
|
|
@@ -28,7 +29,7 @@ if [[ "$PLATFORM" == "ios" ]]; then
|
|
|
28
29
|
fi
|
|
29
30
|
|
|
30
31
|
echo ""
|
|
31
|
-
echo "=== Custom OTA Upload | App: $APP_VERSION | Channel: $CHANNEL | V$OTA_VERSION ==="
|
|
32
|
+
echo "=== Custom OTA Upload | App: $APP_VERSION | Channel: $CHANNEL | V$OTA_VERSION | Platform: $PLATFORM ==="
|
|
32
33
|
echo " Output dir: $OUTPUT_DIR"
|
|
33
34
|
|
|
34
35
|
# Validate
|
|
@@ -41,8 +42,97 @@ if [[ ! -f "$REGISTRY_FILE" ]]; then
|
|
|
41
42
|
exit 1
|
|
42
43
|
fi
|
|
43
44
|
|
|
44
|
-
#
|
|
45
|
-
|
|
45
|
+
# ── GitHub Auto-Push Integration ──────────────────────────────────────────────
|
|
46
|
+
if [[ "$BASE_URL" == *"github"* ]] || [[ "$BASE_URL" == *"raw.githubusercontent"* ]]; then
|
|
47
|
+
# Parse OWNER, REPO, BRANCH from URL
|
|
48
|
+
# Example: https://raw.githubusercontent.com/hungbv-taureau/baseform-storage/main
|
|
49
|
+
CLEAN_URL=$(echo "$BASE_URL" | sed 's#https://raw.githubusercontent.com/##' | sed 's#https://github.com/##')
|
|
50
|
+
OWNER=$(echo "$CLEAN_URL" | cut -d'/' -f1)
|
|
51
|
+
REPO=$(echo "$CLEAN_URL" | cut -d'/' -f2)
|
|
52
|
+
BRANCH=$(echo "$CLEAN_URL" | cut -d'/' -f3)
|
|
53
|
+
if [[ -z "$BRANCH" ]]; then BRANCH="main"; fi
|
|
54
|
+
|
|
55
|
+
# Check for gh token or env tokens
|
|
56
|
+
GH_CLI_TOKEN=$(gh auth token 2>/dev/null || true)
|
|
57
|
+
TOKEN="${GH_CLI_TOKEN:-${GH_TOKEN:-${GITHUB_TOKEN:-}}}"
|
|
58
|
+
if [[ "$TOKEN" == "baseform" ]]; then TOKEN=""; fi
|
|
59
|
+
|
|
60
|
+
if [[ -n "$TOKEN" ]]; then
|
|
61
|
+
GIT_REMOTE="https://x-access-token:${TOKEN}@github.com/${OWNER}/${REPO}.git"
|
|
62
|
+
echo " Using authenticated gh CLI token for ${OWNER}/${REPO}"
|
|
63
|
+
else
|
|
64
|
+
GIT_REMOTE="git@github.com:${OWNER}/${REPO}.git"
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
GH_REPO_DIR="/tmp/ota_git_repo_${REPO}"
|
|
68
|
+
|
|
69
|
+
echo ""
|
|
70
|
+
echo "=== Auto Syncing OTA Release to GitHub Storage ==="
|
|
71
|
+
echo " Target Repo : ${OWNER}/${REPO}"
|
|
72
|
+
echo " Branch : ${BRANCH}"
|
|
73
|
+
|
|
74
|
+
# 1. Clone or Pull target storage repo
|
|
75
|
+
if [ -d "$GH_REPO_DIR/.git" ]; then
|
|
76
|
+
echo " Syncing local storage clone with remote..."
|
|
77
|
+
git -C "$GH_REPO_DIR" remote set-url origin "$GIT_REMOTE" 2>/dev/null || true
|
|
78
|
+
git -C "$GH_REPO_DIR" fetch origin "$BRANCH" 2>/dev/null || true
|
|
79
|
+
git -C "$GH_REPO_DIR" checkout "$BRANCH" 2>/dev/null || true
|
|
80
|
+
git -C "$GH_REPO_DIR" reset --hard "origin/$BRANCH" 2>/dev/null || true
|
|
81
|
+
else
|
|
82
|
+
echo " Cloning storage repository..."
|
|
83
|
+
rm -rf "$GH_REPO_DIR"
|
|
84
|
+
git clone --branch "$BRANCH" --depth 1 "$GIT_REMOTE" "$GH_REPO_DIR" 2>/dev/null || git clone "$GIT_REMOTE" "$GH_REPO_DIR"
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# 2. Copy generated files into storage repo
|
|
88
|
+
TARGET_RELEASE_DIR="$GH_REPO_DIR/$BASE_FOLDER/$APP_VERSION/$CHANNEL"
|
|
89
|
+
mkdir -p "$TARGET_RELEASE_DIR"
|
|
90
|
+
|
|
91
|
+
echo " Copying release files to storage repo..."
|
|
92
|
+
for FILE in "$OUTPUT_DIR"/*.{patch,hbc,json}; do
|
|
93
|
+
[[ -f "$FILE" ]] || continue
|
|
94
|
+
FNAME=$(basename "$FILE")
|
|
95
|
+
cp "$FILE" "$TARGET_RELEASE_DIR/$FNAME"
|
|
96
|
+
done
|
|
97
|
+
|
|
98
|
+
# Copy asset store if present
|
|
99
|
+
if [[ -d "$OUTPUT_DIR/asset-store" ]]; then
|
|
100
|
+
TARGET_ASSET_DIR="$GH_REPO_DIR/$BASE_FOLDER/assets"
|
|
101
|
+
mkdir -p "$TARGET_ASSET_DIR"
|
|
102
|
+
cp -R "$OUTPUT_DIR/asset-store/"* "$TARGET_ASSET_DIR/" 2>/dev/null || true
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# Copy ota_registry.json
|
|
106
|
+
mkdir -p "$GH_REPO_DIR/$BASE_FOLDER"
|
|
107
|
+
cp "$REGISTRY_FILE" "$GH_REPO_DIR/$BASE_FOLDER/ota_registry.json"
|
|
108
|
+
cp "$REGISTRY_FILE" "$GH_REPO_DIR/ota_registry.json" 2>/dev/null || true
|
|
109
|
+
|
|
110
|
+
# 3. Commit and Push to GitHub
|
|
111
|
+
cd "$GH_REPO_DIR"
|
|
112
|
+
git config user.name "hungbv-taureau" 2>/dev/null || true
|
|
113
|
+
git config user.email "hungbv@taureau.ai" 2>/dev/null || true
|
|
114
|
+
git add .
|
|
115
|
+
if git diff --staged --quiet; then
|
|
116
|
+
echo " ✓ Storage repository is up to date (no changes)."
|
|
117
|
+
else
|
|
118
|
+
echo " Committing OTA release (App: $APP_VERSION v$OTA_VERSION)..."
|
|
119
|
+
git commit -m "auto(ota): publish $PLATFORM $APP_VERSION v$OTA_VERSION ($CHANNEL)"
|
|
120
|
+
echo " Pushing to GitHub (${BRANCH})..."
|
|
121
|
+
|
|
122
|
+
if git push origin "$BRANCH"; then
|
|
123
|
+
echo " ✓ Successfully pushed OTA release to GitHub!"
|
|
124
|
+
else
|
|
125
|
+
echo " ⚠ Git push failed. Please verify write permissions for ${OWNER}/${REPO}."
|
|
126
|
+
fi
|
|
127
|
+
fi
|
|
128
|
+
cd "$ROOT_DIR"
|
|
129
|
+
echo ""
|
|
130
|
+
echo "=== GitHub Sync Complete ==="
|
|
131
|
+
exit 0
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# ── MinIO Server Integration ──────────────────────────────────────────────────
|
|
135
|
+
echo "Logging in to MinIO Server..."
|
|
46
136
|
LOGIN_RES=$(curl -s -X "POST" "$BASE_URL/public/authen/login" \
|
|
47
137
|
-H 'Content-Type: application/json; charset=utf-8' \
|
|
48
138
|
-d "{\"username\": \"$UPCODE_USER\", \"password\": \"$UPCODE_PASS\"}")
|
|
@@ -54,13 +144,13 @@ TOKEN=$(echo "$LOGIN_RES" | node -e "
|
|
|
54
144
|
} catch(e) { console.log(''); }
|
|
55
145
|
")
|
|
56
146
|
if [[ -z "$TOKEN" ]]; then
|
|
57
|
-
echo "
|
|
58
|
-
|
|
147
|
+
echo " ⚠ Notice: Remote MinIO server login skipped."
|
|
148
|
+
echo " ✓ Bundles & registry generated at: $OUTPUT_DIR"
|
|
149
|
+
echo " Please commit and push local changes to your GitHub storage repository."
|
|
150
|
+
exit 0
|
|
59
151
|
fi
|
|
60
152
|
echo " ✓ Login successful"
|
|
61
153
|
|
|
62
|
-
# ── Helpers ─────────────────────────────────────────────────────────────────
|
|
63
|
-
|
|
64
154
|
remote_delete() {
|
|
65
155
|
local path=$1
|
|
66
156
|
local encoded
|
|
@@ -86,20 +176,17 @@ remote_upload() {
|
|
|
86
176
|
fi
|
|
87
177
|
}
|
|
88
178
|
|
|
89
|
-
# 2. Upload all patch files, full bundles, and asset manifests
|
|
90
179
|
echo "Uploading files for channel: $CHANNEL..."
|
|
91
180
|
FILE_COUNT=0
|
|
92
181
|
for FILE in "$OUTPUT_DIR"/*.{patch,hbc,json}; do
|
|
93
182
|
[[ -f "$FILE" ]] || continue
|
|
94
183
|
FNAME=$(basename "$FILE")
|
|
95
|
-
# Only upload files belonging to the current APP_VERSION
|
|
96
184
|
if [[ "$FNAME" == "patch_"* ]] || [[ "$FNAME" == "bundle_"* ]]; then
|
|
97
185
|
if [[ "$FNAME" != *"_${APP_VERSION}_"* ]]; then
|
|
98
186
|
continue
|
|
99
187
|
fi
|
|
100
188
|
fi
|
|
101
189
|
|
|
102
|
-
# Further general filtering
|
|
103
190
|
if [[ "$FNAME" != *"_${APP_VERSION}_"* ]] && [[ "$FNAME" != *"_${CHANNEL}_"* ]] && [[ "$FNAME" != *"_${PLATFORM}_"* ]] && [[ "$FNAME" != "asset-manifest"* ]] && [[ "$FNAME" != "base-assets"* ]]; then
|
|
104
191
|
continue
|
|
105
192
|
fi
|
|
@@ -110,22 +197,18 @@ for FILE in "$OUTPUT_DIR"/*.{patch,hbc,json}; do
|
|
|
110
197
|
FILE_COUNT=$((FILE_COUNT + 1))
|
|
111
198
|
done
|
|
112
199
|
|
|
113
|
-
# 3. Upload hashed asset store
|
|
114
200
|
if [[ -d "$OUTPUT_DIR/asset-store" ]]; then
|
|
115
201
|
echo "Uploading hashed assets..."
|
|
116
202
|
for FILE in "$OUTPUT_DIR/asset-store"/*; do
|
|
117
203
|
[[ -f "$FILE" ]] || continue
|
|
118
204
|
FNAME=$(basename "$FILE")
|
|
119
|
-
# Assets are global to the base folder (content-addressed)
|
|
120
205
|
REMOTE_PATH="$BASE_FOLDER/assets/$FNAME"
|
|
121
|
-
# Optional: skip if already exists to save time, but for now we re-upload for safety
|
|
122
206
|
remote_upload "$FILE" "$REMOTE_PATH"
|
|
123
207
|
FILE_COUNT=$((FILE_COUNT + 1))
|
|
124
208
|
done
|
|
125
209
|
fi
|
|
126
210
|
echo " ✓ $FILE_COUNT file(s) uploaded (patches + bundles + assets)"
|
|
127
211
|
|
|
128
|
-
# 3. Upload ota_registry.json
|
|
129
212
|
echo "Uploading ota_registry.json..."
|
|
130
213
|
REMOTE_REGISTRY="$BASE_FOLDER/ota_registry.json"
|
|
131
214
|
remote_delete "$REMOTE_REGISTRY"
|
|
@@ -135,4 +218,3 @@ echo " ✓ Registry uploaded"
|
|
|
135
218
|
echo ""
|
|
136
219
|
echo "=== Upload Complete ==="
|
|
137
220
|
echo " Registry : $REMOTE_REGISTRY"
|
|
138
|
-
echo " Patches : $BASE_FOLDER/$APP_VERSION/patch_*.patch ($PATCH_COUNT files)"
|