A web application designed to manage roster upkeep for the 501st Legion StarSim ArmA group.
Want to request a new page, feature, or report a bug? Submit an Issue to get started!
Want to help with the development? First please check out our guidelines then follow the instructions below to setup your development environment!
This project is built with the latest versions on .NET and Visual Studio 2022 - the preview ones to be exact. You will need to install both the .NET Preview and the Visual Studio Preview. If you already have the Visual Studio Installer, you can get the Visual Studio preview from the installer.
The application uses a PostgreSQL 12
database to store all of its information. You can install it from here. You need the latest version, and should also install pgAdmin from the installer as well. pgAdmin is used to manage Postgre databases.
Once the installer is running, you will be walked through the setup of the local database. Make sure to remember the password you use for it. While you can change it later if you forget, its more difficult to do.
Any mail server will work for this part, but on a Windows machine I recommend using hMailServer. Install this after the database is setup, as you can use the database as a place to hold all of the mail data hMailServer will be using.
Once hMailServer is installed, open the hMailServer Administrator application. On the left, click Domains. From there, click the Add...
button on the top right. Input the domain name you want to use (this can be anything). Click save. Then, go and edit the new domain you just created. Under the Names
tab, click Add...
once again, and input localhost
. This binds the domain to your localhost
so it can be accessed locally.
Once done, I recommend going to Settings - Advanced - Auto-ban
and turning it off for your development environment.
Next, go to Settings - Protocols - SMTP
, then click Delivery of e-mail
tab and input 127.0.0.1
into the Local host name
.
Then, go back to your domain. Under the new icon that has your domain name, click on the Accounts
folder on the left side. Click Add...
to add a new account.
Give it an address, such as no-reply
, and a password. Save your account, and you are all good to go.
Launch pgAdmin. You may be asked to do some initial setup. Once done, log into your local database. You should see the Mail Server database if you used Postgre for the Mail Server. From there, you can right click on the Databases
tab on the left, and create a new database. Give it a simple name, and hit save.
The new database will be created. Ensure that under Schemas
there is a public
schema. If there isn't one, right click on Schemas
and hit create, name it public
and hit save.
A small aspect of the application is linking to Discord. In order to operate that correctly, you need a Discord bot. Head over to the Discord Developer Portal and in the applications page, select New Application
. The name will be public, so pick wisely. Once done, you should be on the application page. If not, select your new application from your list of applications.
Once done, hit the Bot
button on the left, and then the Add Bot
button on your screen. Hit yes the the prompt.
Create a new Discord server on your Discord client. Give it a name you will remember.
Go back to the Discord developer portal. Click on the OAuth2
button, and then hit the Add Redirect
button. Add both of these redirects:
https://localhost:5000/authorization-code/discord-callback
https://localhost:5001/authorization-code/discord-callback
Once done, scroll down to the OAuth2 URL Generator. You can select a redirect URL, but it is not needed. In the scopes
section, select bot
and applications.commands
. When you select bot, a new panel opens up called Bot Permissions. From that panel select either Administrator
or select Send Messages, Read Messages, Manage Roles, Embed Links
and Change Nickname
. Then, copy the link displayed under the scopes
section, and paste it into your browser in a new tab. Going to this page will ask you to invite the bot to your server. Select the sever you just created.
If you don't have Discord developer mode enabled, follow these steps to do so.
Leave this page open, we will come back to it for values later.
Clone the repo from github using your favorite code editor (or other method). Once the repo is installed, there is file that needs to be added before the application will run. In the startup project FiveOhFirstDataCore
, create a folder called Config
. Inside that folder, create a file called website_config.json
. The format for this file is as follows:
{
"ConnectionStrings": {
"database": "Host=localhost;Port=5432;Username=postgres;Password=admin;Database=FiveOhFirstMock;",
},
"Email": {
"Client": "localhost",
"Port": 587,
"User": "no-reply@501stlegion-a3",
"RequireLogin": true,
"Password": "no-reply",
"Email": "no-reply@501stlegion-a3.com"
},
"Discord": {
"ClientId": "837347779545792603",
"HomeGuild": 843853804059099197,
"ClientSecret": "X_qDGc8fK_r8lxATGiWyn_Xy405UzK95",
"Token": "ODM3MzQ3Nzc5NTQ1NzkyNjAz.YIrO4w.oppk3qeSb1n3qvaxq5XV0VI1_AY"
}
}
To explain this:
ConnectionStrings:database
- This is the PostgreSQL connection string. It will be used when connecting to the database.
Email
- This section holds the email configuration
Client
- The email client you are connecting to. Leave it aslocalhost
unless you host your mail sever elsewhere.Port
- The port to connect to. By default for hMailServer,587
is the port you want.User
- The email (without a.com
or similar) of the user who will be sending system emails.RequireLogin
- If this user needs to be logged in.Password
- The password for the user.Email
- The email to send system messages from. This is how it will look to the user who gets an email.no-reply@my-host.com
is a good format.
Discord
- This section holds Discord Configuration
ClientId
- The client ID for your program. On the discord developer page for your application, go theGeneral Information
and hit copy for the Application ID. Paste it in replacement of the existing ID.HomeGuild
- This is the home server for the bot. Using these instructions get the server ID for the server you created in the previous step.ClientSecret
- This is the secret for your bot. On the Discord Developer portal, under OAuth2, click copy for the Client Secret (top right). DO NOT SHARE THIS VALUE. At any point if you share this vale on accident, click the Regenerate button.Token
- This is your bot token. Under theBot
tab in the Discord Developer portal, click Copy. DO NOT SHARE THIS VALUE. At any point if you share this value on accident, click the Regenerate button.
To make sure everything is running, just start the startup project from Visual Studio (or your code editor).
At any point if a change is made to the database objects, a new migration is needed. Every release will have its own migration, that should never be deleted. Deleting a release migration will cause loss of data.
To add a new migration for your changes, go to the Packet Manager Console in Visual Studio. Type Add-Migration Dev-MyName-MigrationName
where MyName is your name and MigrationName is the name of the migration. If at any point you need to revert this, type Remove-Migration
. Never remove migrations labeled Release
.
There should only be a single migration per release, so keep your commits to including at most one additional Dev
migration. Any new changes should be removed with Remove-Migration
and a new migration added. As this breaks the database when the app attempts to update it, make sure to Drop Cascade
the Schema
and create a new public
schema whenever you remove and old migration and add a new migration.
There is a few testing accounts you can find in the InitalAccountPopulationService
. The development admin account is Soyvolon
. All development account passwords are foo
.