Game server backend and API for PokéRogue
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Frederico Santos 8e20875453
feat: Add admin Discord link endpoint (#49)
* feat: Add admin Discord link endpoint

* feat: Add Discord Guild ID flag to server configuration

* feat: Add logging for Discord ID addition in admin Discord link endpoint

* chore: Update variable name for Discord guild ID in account package

* chore: Add logging for Discord ID addition in admin Discord link endpoint

* chore: Add admin Discord link endpoint

* chore: Add logging for Discord ID addition in admin Discord link endpoint

* chore: Remove unnecessary code in handleAdminDiscordLink function

* chore: Update logging format in handleAdminDiscordLink function

* chore: Refactor handleAdminDiscordLink function for improved logging

* chore: Update Discord Bot Token and Discord Guild ID flags in server configuration

* chore: Refactor handleAccountInfo function for improved readability and error handling

* chore: Update server configuration flags for Discord Bot Token and Guild ID

* Refactor handleAdminDiscordLink function for improved error handling and logging

* feat: Add "Helper" role to Discord admin check for enhanced access control
5 days ago
.github Create FUNDING.yml 4 weeks ago
api feat: Add admin Discord link endpoint (#49) 5 days ago
db feat: Add admin Discord link endpoint (#49) 5 days ago
defs chore: Add additional fields to EggData struct 3 months ago
.dockerignore add GitHub actions workflows and build docker image (#9) 4 months ago
.gitignore Add newclear endpoint 4 months ago
.golangci.yml move linter args to config file 4 months ago
Dockerfile Added support for Discord OAuth2 (#25) 2 months ago
LICENSE Relicense under AGPL 5 months ago
README.md Update README.md 4 months ago
docker-compose.Development.yml make server automatically create DB schema if not exists (#5) 4 months ago
docker-compose.Example.yml Added support for Discord OAuth2 (#25) 2 months ago
go.mod feat: Add admin Discord link endpoint (#49) 5 days ago
go.sum feat: Add admin Discord link endpoint (#49) 5 days ago
rogueserver.go feat: Add admin Discord link endpoint (#49) 5 days ago

README.md

rogueserver

Hosting in Docker

It is advised that you host this in a docker container as it will be much easier to manage. There is a sample docker-compose file for setting up a docker container to setup this server.

Self Hosting outside of Docker:

Required Tools:

Installation:

The docker compose file should automatically implement a container with mariadb with an empty database and the default user and password combo of pokerogue:pokerogue

src/utils.ts:224-225 (in pokerogue)

Replace both URLs (one on each line) with the local API server address from rogueserver.go (0.0.0.0:8001) (or whatever port you picked)

If you are on Windows

Now that all of the files are configured: start up powershell as administrator:

cd C:\api\server\location\
go build .
.\rogueserver.exe --debug --dbuser yourusername --dbpass yourpassword 

The other available flags are located in rogueserver.go:34-43.

Then in another run this the first time then run npm run start from the rogueserver location from then on:

powershell -ep bypass
cd C:\server\location\
npm install
npm run start

You will need to allow the port youre running the API (8001) on and port 8000 to accept inbound connections through the Windows Advanced Firewall.

If you are on Linux

In whatever shell you prefer, run the following:

cd /api/server/location/
go build .
./rogueserver --debug --dbuser yourusername --dbpass yourpassword &

cd /server/location/
npm run start

If you have a firewall running such as ufw on your linux machine, make sure to allow inbound connections on the ports youre running the API and the pokerogue server (8000,8001). An example to allow incoming connections using UFW:

sudo ufw allow 8000,8001/tcp

This should allow you to reach the game from other computers on the same network.

Tying to a Domain

If you want to tie it to a domain like I did and make it publicly accessible, there is some extra work to be done.

I setup caddy and would recommend using it as a reverse proxy. caddy installation once its installed setup a config file for caddy:

pokerogue.exampledomain.com {
	reverse_proxy localhost:8000
}
pokeapi.exampledomain.com {
	reverse_proxy localhost:8001
} 

Preferably set up caddy as a service from here.

Once this is good to go, take your API url (https://pokeapi.exampledomain.com) and paste it on

src/utils.ts:224-225

in place of the previous 0.0.0.0:8001 address

Make sure that both 8000 and 8001 are portforwarded on your router.

Test that the server's game and game authentication works from other machines both in and outside of the network. Once this is complete, enjoy!