82 Commits

Author SHA1 Message Date
04bbad6a4b fix(deps): update dependency @types/node to v20.16.10 2024-09-27 17:02:14 +00:00
Lee
c7853d4153 Merge pull request 'fix(deps): update dependency @types/node to v20.16.9' (#32) from renovate/node-20.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 21s
Publish Docker Image / docker (push) Successful in 43s
Reviewed-on: #32
2024-09-26 15:15:27 +00:00
1481bd1d00 fix(deps): update dependency @types/node to v20.16.9 2024-09-26 13:01:56 +00:00
Lee
1bf3c86a4c Merge pull request 'fix(deps): update dependency @types/node to v20.16.9' (#28) from renovate/node-20.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 26s
Publish Docker Image / docker (push) Successful in 44s
Reviewed-on: #28
2024-09-26 12:39:42 +00:00
Lee
6727e1177c Merge pull request 'fix(deps): update dependency tsup to v8.3.0' (#30) from renovate/tsup-8.x-lockfile into master
Some checks failed
Publish Docker Image / docker (push) Waiting to run
Deploy CI / deploy (push) Has been cancelled
Reviewed-on: #30
2024-09-26 12:39:37 +00:00
47f3f8b1e0 fix(deps): update dependency tsup to v8.3.0 2024-09-17 05:01:52 +00:00
27703ff009 fix(deps): update dependency @types/node to v20.16.4 2024-09-04 01:01:53 +00:00
Lee
f788f574c0 Merge pull request 'fix(deps): update dependency @types/node to v20.16.3' (#27) from renovate/node-20.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 21s
Publish Docker Image / docker (push) Successful in 46s
Reviewed-on: #27
2024-09-02 08:12:28 +00:00
Lee
6c19559964 Merge pull request 'fix(deps): update dependency @influxdata/influxdb-client to v1.35.0' (#26) from renovate/influxdata-influxdb-client-1.x-lockfile into master
Some checks failed
Publish Docker Image / docker (push) Waiting to run
Deploy CI / deploy (push) Failing after 5s
Reviewed-on: #26
2024-09-02 08:12:23 +00:00
Lee
f83ff0a7a6 Merge pull request 'fix(deps): update dependency axios to v1.7.7' (#25) from renovate/axios-1.x-lockfile into master
Some checks failed
Publish Docker Image / docker (push) Waiting to run
Deploy CI / deploy (push) Has been cancelled
Reviewed-on: #25
2024-09-02 08:12:15 +00:00
ee69ce3c8d fix(deps): update dependency @types/node to v20.16.3 2024-09-01 16:01:58 +00:00
8f47e210d5 fix(deps): update dependency @influxdata/influxdb-client to v1.35.0 2024-09-01 15:02:01 +00:00
8c1055b468 fix(deps): update dependency axios to v1.7.7 2024-09-01 15:01:56 +00:00
Lee
42558f3500 Merge pull request 'fix(deps): update dependency @influxdata/influxdb-client to v1.35.0' (#14) from renovate/influxdata-influxdb-client-1.x-lockfile into master
All checks were successful
Publish Docker Image / docker (push) Successful in 48s
Deploy CI / deploy (push) Successful in 27s
Reviewed-on: #14
2024-09-01 14:19:32 +00:00
Lee
0a3e8f28ba Merge pull request 'fix(deps): update dependency winston to v3.14.2' (#22) from renovate/winston-3.x-lockfile into master
Some checks failed
Deploy CI / deploy (push) Failing after 6s
Publish Docker Image / docker (push) Has been cancelled
Reviewed-on: #22
2024-09-01 14:19:21 +00:00
Lee
419b2b0286 Merge pull request 'fix(deps): update dependency @types/node to v20.16.3' (#23) from renovate/node-20.x-lockfile into master
Some checks failed
Deploy CI / deploy (push) Failing after 5s
Publish Docker Image / docker (push) Has been cancelled
Reviewed-on: #23
2024-09-01 14:19:12 +00:00
Lee
59816d7410 Merge pull request 'fix(deps): update dependency axios to v1.7.7' (#24) from renovate/axios-1.x-lockfile into master
Some checks failed
Publish Docker Image / docker (push) Waiting to run
Deploy CI / deploy (push) Has been cancelled
Reviewed-on: #24
2024-09-01 14:19:03 +00:00
cdb7dbf18f fix(deps): update dependency axios to v1.7.5 2024-08-23 14:01:43 +00:00
4696d512eb fix(deps): update dependency @types/node to v20.15.0 2024-08-16 19:01:44 +00:00
3793071c2d fix(deps): update dependency winston to v3.14.2 2024-08-14 18:01:48 +00:00
Lee
43e9492a47 Merge pull request 'fix(deps): update dependency axios to v1.7.4' (#21) from renovate/axios-1.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 50s
Publish Docker Image / docker (push) Successful in 1m13s
Reviewed-on: #21
2024-08-14 08:45:43 +00:00
745e4e6fe5 fix(deps): update dependency axios to v1.7.4 2024-08-13 20:01:35 +00:00
Lee
3274e3bc2d Merge pull request 'fix(deps): update dependency @types/node to v20.14.15' (#16) from renovate/node-20.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 23s
Publish Docker Image / docker (push) Successful in 1m5s
Reviewed-on: #16
2024-08-13 17:28:40 +00:00
c463cdff0a fix(deps): update dependency @types/node to v20.14.15 2024-08-11 07:01:33 +00:00
Lee
4c7a46e493 Merge pull request 'fix(deps): update dependency tsup to v8.2.4' (#18) from renovate/tsup-8.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 51s
Publish Docker Image / docker (push) Successful in 54s
Reviewed-on: #18
2024-08-11 06:41:40 +00:00
01df7d1e13 fix(deps): update dependency tsup to v8.2.4 2024-08-10 12:01:33 +00:00
Lee
dc06a3877d Merge pull request 'fix(deps): update dependency axios to v1.7.3' (#17) from renovate/axios-1.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 19s
Publish Docker Image / docker (push) Successful in 40s
Reviewed-on: #17
2024-08-10 11:37:31 +00:00
Lee
c816304a71 Merge pull request 'fix(deps): update dependency typescript to v5.5.4' (#19) from renovate/typescript-5.x-lockfile into master
Some checks failed
Deploy CI / deploy (push) Failing after 5s
Publish Docker Image / docker (push) Has been cancelled
Reviewed-on: #19
2024-08-10 11:37:20 +00:00
Lee
32a50e9de4 Merge pull request 'fix(deps): update dependency winston to v3.14.1' (#20) from renovate/winston-3.x-lockfile into master
Some checks failed
Publish Docker Image / docker (push) Waiting to run
Deploy CI / deploy (push) Has been cancelled
Reviewed-on: #20
2024-08-10 11:37:12 +00:00
2bfe562269 fix(deps): update dependency winston to v3.14.1 2024-08-10 11:36:38 +00:00
c381d82e2a fix(deps): update dependency typescript to v5.5.4 2024-08-10 11:36:32 +00:00
d12287a13a fix(deps): update dependency axios to v1.7.3 2024-08-10 11:36:21 +00:00
f193dacd14 fix(deps): update dependency @influxdata/influxdb-client to v1.34.0 2024-08-10 11:34:45 +00:00
Lee
6a9ccad31c Update renovate.json
All checks were successful
Deploy CI / deploy (push) Successful in 15s
Publish Docker Image / docker (push) Successful in 1m2s
2024-08-10 11:34:03 +00:00
cf49d249bd chore(deps): update docker/build-push-action action to v6
All checks were successful
Publish Docker Image / docker (push) Successful in 48s
2024-08-10 11:33:00 +00:00
Lee
85b5b7cbce Merge pull request 'fix(deps): update dependency axios to v1.6.8' (#9) from renovate/axios-1.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 21s
Publish Docker Image / docker (push) Successful in 41s
Reviewed-on: #9
2024-08-10 11:30:57 +00:00
Lee
71239fa078 Merge pull request 'fix(deps): update dependency typescript to v5.4.5' (#10) from renovate/typescript-5.x-lockfile into master
Some checks failed
Publish Docker Image / docker (push) Waiting to run
Deploy CI / deploy (push) Has been cancelled
Reviewed-on: #10
2024-08-10 11:30:52 +00:00
Lee
66f067990b Merge pull request 'fix(deps): update dependency winston to v3.13.0' (#11) from renovate/winston-3.x-lockfile into master
Some checks failed
Publish Docker Image / docker (push) Waiting to run
Deploy CI / deploy (push) Has been cancelled
Reviewed-on: #11
2024-08-10 11:30:43 +00:00
Lee
9701ecdcd7 Update data/servers.json
Some checks failed
Deploy CI / deploy (push) Successful in 54s
Publish Docker Image / docker (push) Has been cancelled
2024-08-10 11:29:01 +00:00
Lee
adf46b9cb8 Update data/servers.json
All checks were successful
Deploy CI / deploy (push) Successful in 1m2s
Publish Docker Image / docker (push) Successful in 59s
2024-06-02 18:56:39 +00:00
9f40efa75a fix(deps): update dependency winston to v3.13.0 2024-04-05 23:47:40 +00:00
6984c35710 fix(deps): update dependency typescript to v5.4.3 2024-03-23 20:51:03 +00:00
f395b66d77 fix(deps): update dependency axios to v1.6.8 2024-03-23 20:50:56 +00:00
Lee
627fe5f38f Update data/servers.json
All checks were successful
Deploy CI / deploy (push) Successful in 28s
Publish Docker Image / docker (push) Successful in 1m16s
2024-03-20 05:54:51 +00:00
Lee
ba4807f33f Update .gitea/workflows/publish.yml
All checks were successful
Publish Docker Image / docker (push) Successful in 59s
2024-03-17 00:52:56 +00:00
Lee
3f791ad52a Merge pull request 'fix(deps): update dependency winston to v3.12.0' (#8) from renovate/winston-3.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 20s
Publish Docker Image / docker (push) Successful in 50s
Reviewed-on: #8
2024-03-13 20:11:09 +00:00
Lee
bfe26c2250 Merge pull request 'fix(deps): update dependency tsup to v8.0.2' (#6) from renovate/tsup-8.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 20s
Publish Docker Image / docker (push) Successful in 45s
Reviewed-on: #6
2024-03-13 19:55:57 +00:00
Lee
b1451f9e88 Merge pull request 'fix(deps): update dependency axios to v1.6.7' (#5) from renovate/axios-1.x-lockfile into master
All checks were successful
Deploy CI / deploy (push) Successful in 21s
Publish Docker Image / docker (push) Successful in 1m15s
Reviewed-on: #5
2024-03-13 19:54:11 +00:00
Lee
d8fafec1ba server: remove Rainpixel
All checks were successful
Deploy CI / deploy (push) Successful in 29s
Publish Docker Image / docker (push) Successful in 1m7s
2024-03-13 19:50:27 +00:00
666036ef2e fix(deps): update dependency winston to v3.12.0 2024-03-06 01:14:15 +00:00
7f457497e3 fix(deps): update dependency tsup to v8.0.2 2024-03-06 00:19:18 +00:00
7ea96c5cc3 fix(deps): update dependency axios to v1.6.7 2024-03-06 00:19:11 +00:00
Lee
e208b99192 Update grafana-dashboard.json 2024-02-09 10:08:45 +00:00
Lee
58696a9566 Update grafana-dashboard.json 2024-02-08 01:08:01 +00:00
Lee
908e9e1618 Merge pull request 'chore(deps): update actions/cache action to v4' (#4) from renovate/actions-cache-4.x into master
All checks were successful
Publish Docker Image / docker (push) Successful in 1m1s
Reviewed-on: #4
2024-01-23 06:16:38 +00:00
3496865c2e chore(deps): update actions/cache action to v4 2024-01-17 17:01:29 +00:00
21c3677d0e server: add Stray
All checks were successful
Deploy CI / deploy (push) Successful in 14s
Publish Docker Image / docker (push) Successful in 43s
2024-01-16 17:18:27 +00:00
466f96b649 server: add Shotbow
All checks were successful
Deploy CI / deploy (push) Successful in 14s
Publish Docker Image / docker (push) Successful in 43s
2024-01-16 17:05:40 +00:00
4b2a428646 server: add Monumenta
All checks were successful
Deploy CI / deploy (push) Successful in 15s
Publish Docker Image / docker (push) Successful in 46s
2024-01-16 17:01:36 +00:00
20acbfd7f4 server: add Complex Gaming
All checks were successful
Deploy CI / deploy (push) Successful in 15s
Publish Docker Image / docker (push) Successful in 47s
2024-01-16 16:31:45 +00:00
d2d1597b72 Merge branch 'master' of https://git.fascinated.cc/mc-tracker/backend
All checks were successful
Deploy CI / deploy (push) Successful in 14s
Publish Docker Image / docker (push) Successful in 55s
2024-01-13 17:37:26 +00:00
d468e2b070 server: remove tubnet 2024-01-13 17:37:25 +00:00
4a81455f96 meow
All checks were successful
Deploy CI / deploy (push) Successful in 15s
Publish Docker Image / docker (push) Successful in 1m12s
2024-01-13 12:34:20 +00:00
6221a58062 update influx err msg
All checks were successful
Deploy CI / deploy (push) Successful in 14s
Publish Docker Image / docker (push) Successful in 43s
2024-01-10 14:21:30 +00:00
98cb26e310 feat: add server latency to the influx points
All checks were successful
Deploy CI / deploy (push) Successful in 15s
Publish Docker Image / docker (push) Successful in 45s
2024-01-10 10:47:25 +00:00
ab53e24978 server: add cubecraft bedrock
All checks were successful
Deploy CI / deploy (push) Successful in 15s
Publish Docker Image / docker (push) Successful in 47s
2024-01-09 14:59:47 +00:00
3f399bec10 organize server config
All checks were successful
Deploy CI / deploy (push) Successful in 16s
Publish Docker Image / docker (push) Successful in 48s
2024-01-09 14:51:15 +00:00
cf72d4886a update readme 2024-01-09 02:31:10 +00:00
3bed998640 fix dockerfile file
All checks were successful
Deploy CI / deploy (push) Successful in 20s
Publish Docker Image / docker (push) Successful in 45s
2024-01-06 09:28:06 +00:00
4b7b43c036 add finisheding msg
Some checks failed
Deploy CI / deploy (push) Successful in 21s
Publish Docker Image / docker (push) Has been cancelled
2024-01-06 09:27:09 +00:00
d15f1613f0 cleanup
All checks were successful
Deploy CI / deploy (push) Successful in 20s
Publish Docker Image / docker (push) Successful in 42s
2024-01-06 06:03:30 +00:00
1bd47d2b60 update actions
All checks were successful
Deploy CI / deploy (push) Successful in 20s
Publish Docker Image / docker (push) Successful in 48s
2024-01-06 05:13:53 +00:00
a8bc162d8b server: add rainpixel
All checks were successful
deploy / deploy (push) Successful in 22s
Publish Docker Image / docker (push) Successful in 46s
2024-01-06 05:01:32 +00:00
cf66e8c488 fix: update grafana dashboard
All checks were successful
deploy / deploy (push) Successful in 20s
2024-01-04 07:44:44 +00:00
2b8af4050b Merge branch 'master' of https://git.fascinated.cc/mc-tracker/backend
All checks were successful
deploy / deploy (push) Successful in 20s
Publish Docker Image / docker (push) Successful in 41s
2024-01-04 07:26:03 +00:00
3568e195b9 server: add InvadedLands 2024-01-04 07:26:02 +00:00
2d0f4ddca1 server: add manacube 2024-01-04 07:24:08 +00:00
9ffa0c549c server: add minecadia 2024-01-04 07:24:00 +00:00
4543309fd1 server: add op legends 2024-01-04 07:23:45 +00:00
Lee
2780f4f5f6 Delete package-lock.json
All checks were successful
deploy / deploy (push) Successful in 23s
Publish Docker Image / docker (push) Successful in 43s
2024-01-04 04:14:46 +00:00
169d53f2cf server: add Tubnet
All checks were successful
deploy / deploy (push) Successful in 19s
Publish Docker Image / docker (push) Successful in 43s
2024-01-04 04:04:20 +00:00
74ccee0381 server: add Minemen Club 2024-01-04 04:04:03 +00:00
15 changed files with 1313 additions and 4763 deletions

View File

@ -1,9 +1,16 @@
name: "deploy" name: "Deploy CI"
on: on:
push: push:
branches: branches:
- master - master
paths-ignore: # Files in here will not trigger a build
- "README.md"
- "LICENSE"
- "grafana-dashboard.json"
- "storage-tracker.sh"
- "useful-stuff.md"
- ".gitea/workflows/publish.yml"
jobs: jobs:
deploy: deploy:

View File

@ -10,6 +10,7 @@ on:
- "grafana-dashboard.json" - "grafana-dashboard.json"
- "storage-tracker.sh" - "storage-tracker.sh"
- "useful-stuff.md" - "useful-stuff.md"
- ".gitea/workflows/ci.yml"
jobs: jobs:
docker: docker:
@ -19,7 +20,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Restore Docker Cache - name: Restore Docker Cache
uses: actions/cache@v3 uses: actions/cache@v4
id: docker-cache id: docker-cache
with: with:
path: /usr/bin/docker path: /usr/bin/docker
@ -42,26 +43,11 @@ jobs:
username: ${{ secrets.REPO_USERNAME }} username: ${{ secrets.REPO_USERNAME }}
password: ${{ secrets.REPO_TOKEN }} password: ${{ secrets.REPO_TOKEN }}
- name: Restore Docker Build Cache
uses: actions/cache@v3
id: build-cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx
- name: Build and Push (Latest) - name: Build and Push (Latest)
uses: docker/build-push-action@v5 uses: docker/build-push-action@v6
with: with:
push: true push: true
context: . context: .
tags: fascinated/mc-tracker:latest tags: fascinated/mc-tracker:latest
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
- name: Save Docker Build Cache
if: steps.build-cache.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/.buildx-cache
cp -r /tmp/.buildx-cache/. /tmp/.buildx-cache-new
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

View File

@ -4,8 +4,9 @@ ENV NODE_ENV=production
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY ["package.json", "pnpm-lock.yaml", "./"] COPY ["package.json", "pnpm-lock.yaml", "./"]
COPY . .
RUN pnpm install --production --silent RUN pnpm install --production --silent
COPY . .
CMD pnpm run build && pnpm run start CMD pnpm run build && pnpm run start

View File

@ -1,2 +1,9 @@
# backend # Mc Tracker
You can view the live instance of this project [here](https://mc-tracker.fascinated.cc).
## Features
- Track Minecraft server's player count over time
- See player count peaks (all time)
- Minecraft Java and Bedrock support

View File

@ -1,4 +1,14 @@
[ [
{
"name": "HiveMC",
"ip": "geo.hivebedrock.network",
"type": "PE"
},
{
"name": "Cubecraft - Bedrock",
"ip": "play.cubecraft.net",
"type": "PE"
},
{ {
"name": "WildNetwork", "name": "WildNetwork",
"ip": "play.wildnetwork.net", "ip": "play.wildnetwork.net",
@ -44,11 +54,6 @@
"ip": "gtm.network", "ip": "gtm.network",
"type": "PC" "type": "PC"
}, },
{
"name": "HiveMC",
"ip": "geo.hivebedrock.network",
"type": "PE"
},
{ {
"name": "Purple Prison", "name": "Purple Prison",
"ip": "MCSL.PURPLE.WTF", "ip": "MCSL.PURPLE.WTF",
@ -63,5 +68,65 @@
"name": "Hoplite", "name": "Hoplite",
"ip": "hoplite.gg", "ip": "hoplite.gg",
"type": "PC" "type": "PC"
},
{
"name": "Minemen Club",
"ip": "minemen.club",
"type": "PC"
},
{
"name": "OPLegends",
"ip": "play.oplegends.com",
"type": "PC"
},
{
"name": "Minecadia",
"ip": "play.minecadia.com",
"type": "PC"
},
{
"name": "Manacube",
"ip": "play.manacube.com",
"type": "PC"
},
{
"name": "InvadedLands",
"ip": "invadedlands.net",
"type": "PC"
},
{
"name": "Complex Gaming",
"ip": "hub.mc-complex.com",
"type": "PC"
},
{
"name": "Monumenta",
"ip": "server.playmonumenta.com",
"type": "PC"
},
{
"name": "Shotbow",
"ip": "play.shotbow.net",
"type": "PC"
},
{
"name": "Stray",
"ip": "stray.gg",
"type": "PC"
},
{
"name": "Aetheria Anarchy",
"ip": "aetheria.cc",
"type": "PC"
},
{
"name": "VexedMC",
"ip": "play.vexedmc.com",
"type": "PC"
},
{
"name": "AzureMC",
"ip": "play.azuremc.org",
"type": "PC"
} }
] ]

File diff suppressed because it is too large Load Diff

4084
package-lock.json generated

File diff suppressed because it is too large Load Diff

698
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,3 @@
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["config:recommended", ":dependencyDashboard"]
"extends": [ }
"local>Fascinated/renovate-config"
]
}

View File

@ -1,6 +1,7 @@
import Influx from "./influx/influx"; import Influx from "./influx/influx";
import ServerManager from "./server/serverManager"; import ServerManager from "./server/serverManager";
import WebsiteManager from "./website/websiteManager"; import WebsiteManager from "./website/websiteManager";
import {logger} from "./utils/logger";
/** /**
* The influx database instance. * The influx database instance.
@ -9,3 +10,5 @@ export const influx = new Influx();
new ServerManager(); new ServerManager();
new WebsiteManager(); new WebsiteManager();
logger.info("Done loading!");

View File

@ -31,22 +31,22 @@ export default class Server {
/** /**
* The name of the server. * The name of the server.
*/ */
private name: string; private readonly name: string;
/** /**
* The IP address of the server. * The IP address of the server.
*/ */
private ip: string; private readonly ip: string;
/** /**
* The port of the server. * The port of the server.
*/ */
private port: number | undefined; private readonly port: number | undefined;
/** /**
* The type of server. * The type of server.
*/ */
private type: ServerType; private readonly type: ServerType;
/** /**
* The resolved server information from * The resolved server information from
@ -69,6 +69,7 @@ export default class Server {
* @returns the ping response or undefined if the server is offline * @returns the ping response or undefined if the server is offline
*/ */
public async pingServer(): Promise<Ping | undefined> { public async pingServer(): Promise<Ping | undefined> {
const before = Date.now();
try { try {
let response; let response;
@ -92,10 +93,14 @@ export default class Server {
new Point("playerCount") new Point("playerCount")
.tag("name", this.getName()) .tag("name", this.getName())
.intField("playerCount", response.playerCount) .intField("playerCount", response.playerCount)
.intField("latency", Date.now() - before)
.timestamp(response.timestamp) .timestamp(response.timestamp)
); );
} catch (err) { } catch (err) {
logger.warn(`Failed to write ping to influxdb`, err); logger.warn(
`Failed to write point to Influx for ${this.getName()} - ${this.getIP()}`,
err
);
} }
return Promise.resolve(response); return Promise.resolve(response);
@ -138,6 +143,7 @@ export default class Server {
const serverPing = new javaPing.MinecraftServer(ip, port); const serverPing = new javaPing.MinecraftServer(ip, port);
// todo: do something to get the latest protocol? (is this even needed??)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
serverPing.ping(Config.pinger.timeout, 765, (err, res) => { serverPing.ping(Config.pinger.timeout, 765, (err, res) => {
if (err || res == undefined) { if (err || res == undefined) {

View File

@ -20,8 +20,8 @@ export default class ServerManager {
} }
logger.info(`Loaded ${this.servers.length} servers!`); logger.info(`Loaded ${this.servers.length} servers!`);
cron.schedule(Config.pinger.pingCron, () => { cron.schedule(Config.pinger.pingCron, async () => {
this.pingServers(); await this.pingServers();
}); });
cron.schedule(Config.pinger.dnsInvalidationCron, () => { cron.schedule(Config.pinger.dnsInvalidationCron, () => {
@ -43,13 +43,4 @@ export default class ServerManager {
logger.info("Finished pinging servers!"); logger.info("Finished pinging servers!");
} }
/**
* Returns the servers.
*
* @returns the servers
*/
public getServers(): Server[] {
return this.servers;
}
} }

View File

@ -1,41 +0,0 @@
import fs from "fs";
/**
* Creates a directory at the given path.
*
* @param path the path to the file
* @param recursive whether to create the directory tree if it doesn't exist (defaults to true)
* @returns a promise that resolves when the file is created
*/
export async function createDirectory(
path: string,
recursive?: boolean
): Promise<void> {
if (recursive == undefined) {
recursive = true; // Set to true by default
}
return new Promise((resolve, reject) => {
fs.mkdir(path, { recursive: recursive }, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
}
/**
* Checks if a file exists at the given path.
*
* @param path the path to the file
* @returns a promise that returns true if the file exists, false otherwise
*/
export async function exists(path: string): Promise<boolean> {
return new Promise((resolve) => {
fs.exists(path, (exists) => {
resolve(exists);
});
});
}

View File

@ -14,12 +14,12 @@ export default class Website {
/** /**
* The name of the website. * The name of the website.
*/ */
private name: string; private readonly name: string;
/** /**
* The url of the website. * The url of the website.
*/ */
private url: string; private readonly url: string;
constructor({ name, url }: WebsiteOptions) { constructor({ name, url }: WebsiteOptions) {
this.name = name; this.name = name;

View File

@ -19,8 +19,8 @@ export default class WebsiteManager {
} }
logger.info(`Loaded ${this.websites.length} websites!`); logger.info(`Loaded ${this.websites.length} websites!`);
cron.schedule(Config.pinger.pingCron, () => { cron.schedule(Config.pinger.pingCron, async () => {
this.pingWebsites(); await this.pingWebsites();
}); });
} }
@ -35,13 +35,4 @@ export default class WebsiteManager {
logger.info("Finished pinging websites!"); logger.info("Finished pinging websites!");
} }
/**
* Returns the websites.
*
* @returns the websites
*/
public getWebsites(): Website[] {
return this.websites;
}
} }