Merge pull request from bradganley/main

Changes for multiple deployments

(Thank you very much for the contribution!!!)
This commit is contained in:
Juni! 2024-12-28 14:17:52 -06:00 committed by GitHub
commit 733d02317e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 57 additions and 7 deletions

2
.dockerignore Normal file

@ -0,0 +1,2 @@
data*
session*

0
.env.example Normal file → Executable file

4
.gitignore vendored Normal file → Executable file

@ -2,4 +2,6 @@
.idea
node_modules
sessionData
data
data
bun.lockb
data

0
Dockerfile Normal file → Executable file

0
LICENSE Normal file → Executable file

34
README.md Normal file → Executable file

@ -1,3 +1,37 @@
# user-tracker
Tracks and reports on a users actions
## Docker
Docker image available on Dockerhub:
https://hub.docker.com/r/bradganley/buab
```
services:
bskybot_1:
image: bradganley/buab:0.0.1
restart: unless-stopped
volumes:
- ./sessionData:/sessionData
environment:
- NAME=Brad
- USER_DID=did:plc:pi3zhvcqttk2hrdpmkynqrfi
- TRACKER_BSKY_HANDLE=
- TRACKER_BSKY_PASSWORD=
- DEBUG_LOG_ACTIVE=true
- DEBUG_LOG_LEVEL=info
- JETSTREAM_URL=ws://<YOUR JETSREAM SERVER IP>:6008/subscribe
- SESSION_DATA_PATH=/sessionData
jetstream:
image: "ghcr.io/bluesky-social/jetstream:sha-ea96859b93d1790ff20bb168e5fc442d462cea1e"
container_name: jetstream1
restart: unless-stopped
environment:
- CURSOR_FILE=/data/cursor.json
ports:
- "6008:6008"
volumes:
- ./data:/data
```

BIN
bun.lockb

Binary file not shown.

14
docker-compose.yml Normal file → Executable file

@ -9,12 +9,21 @@ services:
- ./sessionData:/sessionData
env_file:
- .env
environment:
- NAME=Aaron
- USER_DID=did:plc:ksjfbda7262bbqmuoly54lww
#- TRACKER_BSKY_HANDLE=
#- TRACKER_BSKY_PASSWORD=
#- DEBUG_LOG_ACTIVE=true
#- DEBUG_LOG_LEVEL=info
#- JETSTREAM_URL='ws://jetstream:6008/subscribe'
#- SESSION_DATA_PATH='/sessionData'
networks:
- bun
jetstream:
image: "ghcr.io/juni-b-queer/jetstream-new:personal-branch"
image: "ghcr.io/bluesky-social/jetstream:sha-ea96859b93d1790ff20bb168e5fc442d462cea1e"
container_name: jetstream
restart: unless-stopped
environment:
@ -29,3 +38,6 @@ services:
networks:
bun:
driver: bridge
ipam:
config:
- subnet: 10.10.0.0/16

0
makefile Normal file → Executable file

0
package.json Normal file → Executable file

10
src/index.ts Normal file → Executable file

@ -33,7 +33,7 @@ let handlers = {
CreateSkeetAction.make(
(handler: HandlerAgent, commit: JetstreamEventCommit): string => {
// @ts-ignore
let text = "\"" + commit.commit.record?.text + "\"";
let text = <string>Bun.env.NAME + " posted \"" + commit.commit.record?.text + "\"";
if(text.length > 300){
text = text.substring(1, 301)
}
@ -59,7 +59,7 @@ let handlers = {
// @ts-ignore
[ActionTakenByUserValidator.make(<string>Bun.env.USER_DID)],
[
CreateSkeetAction.make("Aaron liked:", undefined, (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject => {
CreateSkeetAction.make(<string>Bun.env.NAME +" liked:", undefined, (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject => {
return commit.commit.record.subject as JetstreamSubject;
}),
LogInputTextAction.make("Like")
@ -74,7 +74,7 @@ let handlers = {
// @ts-ignore
[ActionTakenByUserValidator.make(<string>Bun.env.USER_DID)],
[
CreateSkeetAction.make("Aaron reposted:", undefined, (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject => {
CreateSkeetAction.make(<string>Bun.env.NAME + " reposted:", undefined, (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject => {
return commit.commit.record.subject as JetstreamSubject;
}),
LogInputTextAction.make("Repost")
@ -93,7 +93,7 @@ let handlers = {
[
CreateSkeetAction.make((handler: HandlerAgent, event: JetstreamEventCommit): string => {
const blockedDid = event.commit.record.subject
return "Aaron blocked a user: " + blockedDid;
return <string>Bun.env.NAME + " blocked a user: " + blockedDid;
}, undefined, undefined),
LogInputTextAction.make("Block"),
],
@ -115,7 +115,7 @@ async function initialize() {
initialize().then(() => {
jetstreamSubscription.createSubscription()
DebugLog.info("INIT", 'Initialized!')
DebugLog.info("INIT", 'Initialized and watching ' + <string>Bun.env.NAME + ' (' + <string>Bun.env.USER_DID + ')')
});