Skip to content

Commit 3c1a5f2

Browse files
committed
Merge remote-tracking branch 'origin/main' into colerogers.remote-config
2 parents ec67c78 + c1451e3 commit 3c1a5f2

File tree

23 files changed

+1684
-1609
lines changed

23 files changed

+1684
-1609
lines changed

2nd-gen/alerts-to-discord/functions/index.js

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
* limitations under the License.
1515
*/
1616
// [START v2import]
17+
1718
const {
1819
onNewFatalIssuePublished,
1920
} = require("firebase-functions/v2/alerts/crashlytics");
21+
const {
22+
onNewTesterIosDevicePublished,
23+
} = require("firebase-functions/v2/alerts/appDistribution");
2024
const logger = require("firebase-functions/logger");
2125
// [END v2import]
2226

@@ -56,13 +60,14 @@ async function postMessageToDiscord(botName, messageBody) {
5660
* to Discord whenever a new fatal issue occurs.
5761
*/
5862
// [START v2CrashlyticsAlertTrigger]
59-
exports.postmessagetodiscord = onNewFatalIssuePublished(async (event) => {
63+
exports.postfatalissuetodiscord = onNewFatalIssuePublished(async (event) => {
6064
// [END v2CrashlyticsAlertTrigger]
6165
// [START v2CrashlyticsEventPayload]
6266
// construct a helpful message to send to Discord
67+
const appId = event.appId;
6368
const {id, title, subtitle, appVersion} = event.data.payload.issue;
6469
const message = `
65-
🚨 New fatal issue in version ${appVersion} 🚨
70+
🚨 New fatal issue for ${appId} in version ${appVersion} 🚨
6671
6772
**${title}**
6873
@@ -77,7 +82,7 @@ id: \`${id}\`
7782
const response = await postMessageToDiscord("Crashlytics Bot", message);
7883
if (response.ok) {
7984
logger.info(
80-
`Posted fatal Crashlytics alert ${id} to Discord`,
85+
`Posted fatal Crashlytics alert ${id} for ${appId} to Discord`,
8186
event.data.payload,
8287
);
8388
} else {
@@ -86,7 +91,49 @@ id: \`${id}\`
8691
// [END v2SendToDiscord]
8792
} catch (error) {
8893
logger.error(
89-
`Unable to post fatal Crashlytics alert ${id} to Discord`,
94+
`Unable to post fatal Crashlytics alert ${id} for ${appId} to Discord`,
95+
error,
96+
);
97+
}
98+
});
99+
100+
/**
101+
* function triggered by App Distribution that publishes a message
102+
* to Discord whenever a new iOS tester device is registered.
103+
*/
104+
// [START v2AppDistributionAlertTrigger]
105+
exports.postnewduuidtodiscord = onNewTesterIosDevicePublished(async (event) => {
106+
// [END v2AppDistributionAlertTrigger]
107+
// [START v2AppDistributionEventPayload]
108+
// construct a helpful message to send to Discord
109+
const appId = event.appId;
110+
const {
111+
testerDeviceIdentifier,
112+
testerDeviceModelName,
113+
testerEmail,
114+
testerName,
115+
} = event.data.payload;
116+
const message = `
117+
📱 New iOS device registered by ${testerName} <${testerEmail}> for ${appId}
118+
119+
UDID **${testerDeviceIdentifier}** for ${testerDeviceModelName}
120+
`;
121+
// [END v2AppDistributionEventPayload]
122+
123+
try {
124+
// [START v2SendNewTesterIosDeviceToDiscord]
125+
const response = await postMessageToDiscord("AppDistribution Bot", message);
126+
if (response.ok) {
127+
logger.info(
128+
`Posted iOS device registration alert for ${testerEmail} to Discord`,
129+
);
130+
} else {
131+
throw new Error(response.error);
132+
}
133+
// [END v2SendNewTesterIosDeviceToDiscord]
134+
} catch (error) {
135+
logger.error(
136+
`Unable to post iOS device registration for ${testerEmail} to Discord`,
90137
error,
91138
);
92139
}

2nd-gen/alerts-to-discord/functions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"main": "index.js",
1717
"dependencies": {
1818
"firebase-admin": "^10.1.0",
19-
"firebase-functions": "^3.20.1",
19+
"firebase-functions": "^3.21.1",
2020
"node-fetch": "^2.6.7"
2121
},
2222
"devDependencies": {

authenticated-json-api/functions/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ app.post('/api/messages', async (req, res) => {
9292
app.get('/api/messages', async (req, res) => {
9393
// @ts-ignore
9494
const uid = req.user.uid;
95-
const category = `${req.query.category}`;
95+
const category = `${req.query?.category ?? ''}`;
9696

9797
/** @type admin.database.Query */
9898
let query = admin.database().ref(`/users/${uid}/messages`);

authenticated-json-api/public/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ <h5>Message Details</h5>
9898
</div>
9999

100100
<script src="https://code.getmdl.io/1.1.3/material.min.js"></script>
101-
<script src="/__/firebase/9.8.1/firebase-app-compat.js"></script>
102-
<script src="/__/firebase/9.8.1/firebase-auth-compat.js"></script>
103-
<script src="/__/firebase/9.8.1/firebase-database-compat.js"></script>
101+
<script src="/__/firebase/9.10.0/firebase-app-compat.js"></script>
102+
<script src="/__/firebase/9.10.0/firebase-auth-compat.js"></script>
103+
<script src="/__/firebase/9.10.0/firebase-database-compat.js"></script>
104104
<script src="/__/firebase/init.js"></script>
105105
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
106106
<script src="main.js"></script>

authorized-https-endpoint/public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ <h3>Authorized HTTP Function demo</h3>
8080
<!-- Import and configure the Firebase SDK -->
8181
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
8282
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
83-
<script src="/__/firebase/9.8.1/firebase-app-compat.js"></script>
84-
<script src="/__/firebase/9.8.1/firebase-auth-compat.js"></script>
83+
<script src="/__/firebase/9.10.0/firebase-app-compat.js"></script>
84+
<script src="/__/firebase/9.10.0/firebase-auth-compat.js"></script>
8585
<script src="/__/firebase/init.js"></script>
8686

8787
<script src="main.js"></script>

delete-unused-accounts-cron/functions/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
const functions = require('firebase-functions');
1919
const admin = require('firebase-admin');
2020
admin.initializeApp();
21-
const PromisePool = require('es6-promise-pool').default;
21+
const PromisePool = require('es6-promise-pool');
2222
// Maximum concurrent account deletions.
2323
const MAX_CONCURRENT = 3;
2424

email-confirmation/public/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ <h3>Very interesting website with Newsletter</h3>
100100
<!-- Import and configure the Firebase SDK -->
101101
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
102102
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
103-
<script src="/__/firebase/9.8.1/firebase-app-compat.js"></script>
104-
<script src="/__/firebase/9.8.1/firebase-auth-compat.js"></script>
105-
<script src="/__/firebase/9.8.1/firebase-database-compat.js"></script>
103+
<script src="/__/firebase/9.10.0/firebase-app-compat.js"></script>
104+
<script src="/__/firebase/9.10.0/firebase-auth-compat.js"></script>
105+
<script src="/__/firebase/9.10.0/firebase-database-compat.js"></script>
106106
<script src="/__/firebase/init.js"></script>
107107

108108
<script src="main.js"></script>

exif-images/public/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ <h6>Image Metadata:</h6>
6565
<!-- Import and configure the Firebase SDK -->
6666
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
6767
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
68-
<script src="/__/firebase/9.8.1/firebase-app-compat.js"></script>
69-
<script src="/__/firebase/9.8.1/firebase-auth-compat.js"></script>
70-
<script src="/__/firebase/9.8.1/firebase-storage-compat.js"></script>
71-
<script src="/__/firebase/9.8.1/firebase-database-compat.js"></script>
68+
<script src="/__/firebase/9.10.0/firebase-app-compat.js"></script>
69+
<script src="/__/firebase/9.10.0/firebase-auth-compat.js"></script>
70+
<script src="/__/firebase/9.10.0/firebase-storage-compat.js"></script>
71+
<script src="/__/firebase/9.10.0/firebase-database-compat.js"></script>
7272
<script src="/__/firebase/init.js"></script>
7373

7474
<script src="main.js"></script>

fcm-notifications/public/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ <h3>Send FCM notifications demo</h3>
8686
<!-- Import and configure the Firebase SDK -->
8787
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
8888
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
89-
<script src="/__/firebase/9.8.1/firebase-app-compat.js"></script>
90-
<script src="/__/firebase/9.8.1/firebase-auth-compat.js"></script>
91-
<script src="/__/firebase/9.8.1/firebase-messaging-compat.js"></script>
92-
<script src="/__/firebase/9.8.1/firebase-database-compat.js"></script>
89+
<script src="/__/firebase/9.10.0/firebase-app-compat.js"></script>
90+
<script src="/__/firebase/9.10.0/firebase-auth-compat.js"></script>
91+
<script src="/__/firebase/9.10.0/firebase-messaging-compat.js"></script>
92+
<script src="/__/firebase/9.10.0/firebase-database-compat.js"></script>
9393
<script src="/__/firebase/init.js"></script>
9494

9595
<script src="main.js"></script>

fulltext-search-firestore/public/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ <h3>Results</h3>
5656
<!-- Import and configure the Firebase SDK -->
5757
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
5858
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
59-
<script src="/__/firebase/9.8.1/firebase-app-compat.js"></script>
60-
<script src="/__/firebase/9.8.1/firebase-auth-compat.js"></script>
61-
<script src="/__/firebase/9.8.1/firebase-firestore-compat.js"></script>
62-
<script src="/__/firebase/9.8.1/firebase-firestore-compat.js"></script>
59+
<script src="/__/firebase/9.10.0/firebase-app-compat.js"></script>
60+
<script src="/__/firebase/9.10.0/firebase-auth-compat.js"></script>
61+
<script src="/__/firebase/9.10.0/firebase-firestore-compat.js"></script>
62+
<script src="/__/firebase/9.10.0/firebase-firestore-compat.js"></script>
6363

6464
<script src="/__/firebase/init.js"></script>
6565

0 commit comments

Comments
 (0)