Skip to content

Commit e6a969d

Browse files
authored
Merge branch 'dev' into fit52/async-network-interceptor
2 parents 381d2b9 + a65cdd0 commit e6a969d

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
- Not sending the inComplete xhrRequest. ([#1365](https://github.com/Instabug/Instabug-React-Native/pull/1365))
1414

15+
- Added more search capabilities to the find-token.sh script. e.g., searching in .env file for react config. [#1366](https://github.com/Instabug/Instabug-React-Native/pull/1366)
16+
1517
## [14.3.0](https://github.com/Instabug/Instabug-React-Native/compare/v14.1.0...14.3.0)
1618

1719
### Added

scripts/find-token.sh

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
#!/bin/sh
22

33
# Searches for app token within source files.
4+
JSON_APP_TOKEN=$(
5+
grep "app_token" -r -A 1 -m 1 --exclude-dir={node_modules,ios,android} --include=instabug.json ./ |
6+
sed 's/[[:space:]]//g' |
7+
grep -o ":[\"\'][0-9a-zA-Z]*[\"\']" |
8+
cut -d ":" -f 2 |
9+
cut -d "\"" -f 2 |
10+
cut -d "'" -f 2
11+
)
12+
13+
if [ ! -z "${JSON_APP_TOKEN}" ]; then
14+
echo $JSON_APP_TOKEN
15+
exit 0
16+
fi
417

518
INIT_APP_TOKEN=$(
619
grep "Instabug.init({" -r -A 6 -m 1 --exclude-dir={node_modules,ios,android} --include=\*.{js,ts,jsx,tsx} ./ |
7-
grep "token:[[:space:]]*[\"\'][0-9a-zA-Z]*[\"\']" |
20+
grep "token[[:space:]]*:[[:space:]]*[\"\'][0-9a-zA-Z]*[\"\']" |
821
grep -o "[\"\'][0-9a-zA-Z]*[\"\']" |
922
cut -d "\"" -f 2 |
1023
cut -d "'" -f 2
11-
)
24+
)
1225

1326
if [ ! -z "${INIT_APP_TOKEN}" ]; then
1427
echo $INIT_APP_TOKEN
@@ -20,12 +33,38 @@ START_APP_TOKEN=$(
2033
grep -o "[\"\'][0-9a-zA-Z]*[\"\']" |
2134
cut -d "\"" -f 2 |
2235
cut -d "'" -f 2
23-
)
36+
)
2437

2538
if [ ! -z "${START_APP_TOKEN}" ]; then
2639
echo $START_APP_TOKEN
2740
exit 0
2841
fi
2942

43+
ENV_APP_TOKEN=$(
44+
grep "INSTABUG_APP_TOKEN" -r -A 1 -m 1 --exclude-dir={node_modules,ios,android} --include=\*.env ./ |
45+
sed 's/[[:space:]]//g' |
46+
grep -o "INSTABUG_APP_TOKEN=.*" |
47+
cut -d "=" -f 2
48+
)
49+
50+
if [ ! -z "${ENV_APP_TOKEN}" ]; then
51+
echo $ENV_APP_TOKEN
52+
exit 0
53+
fi
54+
55+
CONSTANTS_APP_TOKEN=$(
56+
grep "INSTABUG_APP_TOKEN" -r -A 1 -m 1 --exclude-dir={node_modules,ios,android} --include=\*.{js,ts,jsx,tsx} ./ |
57+
sed 's/[[:space:]]//g' |
58+
grep -o "=[\"\'][0-9a-zA-Z]*[\"\']" |
59+
cut -d "=" -f 2 |
60+
cut -d "\"" -f 2 |
61+
cut -d "'" -f 2
62+
)
63+
64+
if [ ! -z "${CONSTANTS_APP_TOKEN}" ]; then
65+
echo $CONSTANTS_APP_TOKEN
66+
exit 0
67+
fi
68+
3069
echo "Couldn't find Instabug's app token"
3170
exit 1

0 commit comments

Comments
 (0)