From b79831811ca781778ad158f5403e47d9c37b8706 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Tue, 13 Feb 2024 01:07:47 +1100 Subject: [PATCH 1/3] Update TS client to 1.0.12 --- .pnp.cjs | 20 ++++++-------------- package.json | 2 +- yarn.lock | 21 ++++++--------------- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/.pnp.cjs b/.pnp.cjs index 30f42f8..5bbffe1 100644 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -28,7 +28,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@napi-rs/canvas", "npm:0.1.45"],\ ["@octokit/rest", "npm:20.0.2"],\ - ["@toast/tokenservice-client", "npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"],\ + ["@toast/tokenservice-client", "npm:1.0.12::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.12%2Ftokenservice-client-1.0.12.tgz"],\ ["@types/ms", "npm:0.7.34"],\ ["@types/node", "npm:20.11.17"],\ ["@types/node-cron", "npm:3.0.11"],\ @@ -608,11 +608,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@toast/tokenservice-client", [\ - ["npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz", {\ - "packageLocation": "./.yarn/cache/@toast-tokenservice-client-npm-1.0.11-c95d3498fc-c910af2b01.zip/node_modules/@toast/tokenservice-client/",\ + ["npm:1.0.12::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.12%2Ftokenservice-client-1.0.12.tgz", {\ + "packageLocation": "./.yarn/cache/@toast-tokenservice-client-npm-1.0.12-11df688697-64112744b4.zip/node_modules/@toast/tokenservice-client/",\ "packageDependencies": [\ - ["@toast/tokenservice-client", "npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"],\ - ["undici", "npm:6.5.0"]\ + ["@toast/tokenservice-client", "npm:1.0.12::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.12%2Ftokenservice-client-1.0.12.tgz"],\ + ["undici", "npm:6.6.2"]\ ],\ "linkType": "HARD"\ }]\ @@ -779,7 +779,7 @@ const RAW_RUNTIME_STATE = ["daggerbot-ts", "workspace:."],\ ["@napi-rs/canvas", "npm:0.1.45"],\ ["@octokit/rest", "npm:20.0.2"],\ - ["@toast/tokenservice-client", "npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"],\ + ["@toast/tokenservice-client", "npm:1.0.12::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.12%2Ftokenservice-client-1.0.12.tgz"],\ ["@types/ms", "npm:0.7.34"],\ ["@types/node", "npm:20.11.17"],\ ["@types/node-cron", "npm:3.0.11"],\ @@ -1467,14 +1467,6 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["npm:6.5.0", {\ - "packageLocation": "./.yarn/cache/undici-npm-6.5.0-5598def435-0ad9289bd8.zip/node_modules/undici/",\ - "packageDependencies": [\ - ["undici", "npm:6.5.0"],\ - ["@fastify/busboy", "npm:2.0.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:6.6.2", {\ "packageLocation": "./.yarn/cache/undici-npm-6.6.2-a0bd6785a6-e08ac9c279.zip/node_modules/undici/",\ "packageDependencies": [\ diff --git a/package.json b/package.json index 135e03b..403a9b5 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "dependencies": { "@napi-rs/canvas": "0.1.45", "@octokit/rest": "20.0.2", - "@toast/tokenservice-client": "1.0.11", + "@toast/tokenservice-client": "1.0.12", "ansi-colors": "4.1.3", "dayjs": "1.11.10", "discord.js": "14.14.1", diff --git a/yarn.lock b/yarn.lock index 466e06f..f34cb98 100644 --- a/yarn.lock +++ b/yarn.lock @@ -429,12 +429,12 @@ __metadata: languageName: node linkType: hard -"@toast/tokenservice-client@npm:1.0.11": - version: 1.0.11 - resolution: "@toast/tokenservice-client@npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz" +"@toast/tokenservice-client@npm:1.0.12": + version: 1.0.12 + resolution: "@toast/tokenservice-client@npm:1.0.12::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.12%2Ftokenservice-client-1.0.12.tgz" dependencies: - undici: "npm:6.5.0" - checksum: 10/c910af2b01876ca53de3078cf6b20c3cd8619ed807c3ce573074bc886a8690e6edc43f961088acf4bc2a7e925e8a0cb0e35df930b5923b20ecbbad6fd9bf4c81 + undici: "npm:6.6.2" + checksum: 10/64112744b4bfefb9018f8125e5e54653ff8af3bff493ae1767bd6db0c123a9052dbfa8ea0a3e2f4d8db3ebfb6c2b6823104f288721ba9304c04734f64aeb46c9 languageName: node linkType: hard @@ -573,7 +573,7 @@ __metadata: dependencies: "@napi-rs/canvas": "npm:0.1.45" "@octokit/rest": "npm:20.0.2" - "@toast/tokenservice-client": "npm:1.0.11" + "@toast/tokenservice-client": "npm:1.0.12" "@types/ms": "npm:0.7.34" "@types/node": "npm:20.11.17" "@types/node-cron": "npm:3.0.11" @@ -1151,15 +1151,6 @@ __metadata: languageName: node linkType: hard -"undici@npm:6.5.0": - version: 6.5.0 - resolution: "undici@npm:6.5.0" - dependencies: - "@fastify/busboy": "npm:^2.0.0" - checksum: 10/0ad9289bd8dc8a5ee8cf81a48a629a59c33814702ae706b1d8e7c7fac3cfa85bd6a73943db5d9379f4d420858d239ed3857ec1003e517ddb67eb44fdbc227f3e - languageName: node - linkType: hard - "undici@npm:6.6.2": version: 6.6.2 resolution: "undici@npm:6.6.2" From 553e13c057328582268cf102ad256eca9417fdb5 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Tue, 13 Feb 2024 01:13:26 +1100 Subject: [PATCH 2/3] Update bash script to efficiently update container --- startDocker.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/startDocker.sh b/startDocker.sh index 5f07505..d09ebfd 100755 --- a/startDocker.sh +++ b/startDocker.sh @@ -1,6 +1,7 @@ #!/bin/bash +docker compose -f docker-compose.bot.yml down && \ docker compose -f docker-compose.bot.yml build && \ -docker compose -f docker-compose.bot.yml up -d +docker compose -f docker-compose.bot.yml up -d --remove-orphans exit 0 From 5cba023ff139de7426f59a38f3f52e5cc4050866 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Tue, 13 Feb 2024 08:22:19 +1100 Subject: [PATCH 3/3] Remove unused stuff --- .dockerignore | 6 ++---- .gitignore | 1 - botStartup.bat | 1 - startWithYarn.cjs | 1 - ufwReject.sh | 35 ----------------------------------- 5 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 botStartup.bat delete mode 100644 startWithYarn.cjs delete mode 100755 ufwReject.sh diff --git a/.dockerignore b/.dockerignore index 1d4e483..8936d2c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,6 @@ # Pointless stuff Dockerfile -docker-compose.yml +docker-compose.*.yml .ncurc.json .env .mailmap @@ -9,8 +9,6 @@ docker-compose.yml .github postgres-replica-stuff README.md -ufwReject.sh # Startup files -startWithYarn.cjs -botStartup.bat +startDocker.sh diff --git a/.gitignore b/.gitignore index c55b01c..9a2e64d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .env -ips.txt # Yarn stuff .yarn # TypeScript stuff diff --git a/botStartup.bat b/botStartup.bat deleted file mode 100644 index 7d5b42a..0000000 --- a/botStartup.bat +++ /dev/null @@ -1 +0,0 @@ -pm2 start startWithYarn.cjs --name Daggerbot diff --git a/startWithYarn.cjs b/startWithYarn.cjs deleted file mode 100644 index f26c1e2..0000000 --- a/startWithYarn.cjs +++ /dev/null @@ -1 +0,0 @@ -require('node:child_process').spawn('yarn node dist/index.js', {stdio: [null,process.stdout,process.stderr,null], windowsHide: true, shell: true}) \ No newline at end of file diff --git a/ufwReject.sh b/ufwReject.sh deleted file mode 100755 index d148a0a..0000000 --- a/ufwReject.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -if [ "$EUID" -ne 0 ]; then - echo "Please run this script as root or sudo" - exit 1 -fi - -# Store the IP addresses in a file -IP_ADDRESSES_STORE="ips.txt" - -# Scan the kernel log for IP addresses and store them in a file -dmesg | grep 'SRC=' | awk -F'SRC=' '{ print $2 }' | awk '{ print $1 }' | sort | uniq | head -n 5000 > "$IP_ADDRESSES_STORE" - -# Initialize a counter for new IPs -new_ips=0 - -# Store the output of ufw status in a variable -ufw_status=$(ufw status) - -# Populate the UFW reject rule with the IP addresses collected from the kernel log -while IFS= read -r ip -do - ip_prefix="${ip%.*}" - # Check if the IP is already in the UFW rules - if ! echo "$ufw_status" | grep -q "$ip" && [ "$ip_prefix" != "${TOAST_IP%.*}" ] - then - ufw reject from $ip - # Increment the counter - ((new_ips++)) - fi -done < "$IP_ADDRESSES_STORE" - -echo "Done populating UFW reject rule" -echo "$new_ips IP addresses were added" -exit 0