-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize JS and introduce shared types
- Loading branch information
Showing
33 changed files
with
15,844 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
16.20.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as functions from "firebase-functions"; | ||
import * as admin from "firebase-admin"; | ||
const db = admin.firestore(); | ||
|
||
const twitterCollection = db.collection("twitterbot/last-known/sets"); | ||
const mastodonCollection = db.collection("mastodonbot/last-known/sets"); | ||
|
||
import { diff, standardSets, toot, tweet } from "./lib"; | ||
|
||
admin.initializeApp(); | ||
|
||
export async function detectRotations(context: any) { | ||
const config = functions.config(); | ||
const apiSets = await standardSets(); | ||
|
||
await diff(twitterCollection, apiSets).then(async (setDifferences) => { | ||
if ( | ||
setDifferences.addedSets.size == 0 && | ||
setDifferences.removedSets.size == 0 | ||
) { | ||
functions.logger.info( | ||
`No sets changed, not tweeting (${setDifferences.unchangedSets.size} sets accounted for)` | ||
); | ||
return; | ||
} | ||
await tweet(config, setDifferences); | ||
}); | ||
|
||
await diff(mastodonCollection, apiSets).then(async (setDifferences) => { | ||
if ( | ||
setDifferences.addedSets.size == 0 && | ||
setDifferences.removedSets.size == 0 | ||
) { | ||
functions.logger.info( | ||
`No sets changed, not tooting (${setDifferences.unchangedSets.size} sets accounted for)` | ||
); | ||
return; | ||
} | ||
await toot(config, setDifferences); | ||
}); | ||
} |
55 changes: 55 additions & 0 deletions
55
firebase/functions/dist/firebase/functions/detect_rotations.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
firebase/functions/dist/firebase/functions/detect_rotations.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.