More flags for r/banter
https://flags.plum.moe
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
C-xC-c
6aaf3af929
|
5 years ago | |
---|---|---|
BantFlags | 5 years ago | |
.gitattributes | 5 years ago | |
.gitignore | 5 years ago | |
BantFlags.sln | 5 years ago | |
LICENSE.md | 5 years ago | |
README.org | 5 years ago | |
database.sql | 5 years ago |
README.org
BantFlags
A user script and backend enabling user created flags on bant, originally based on extraflags.
Running
Prerequisites
- .NET core 3.1
- Mariadb / mysql
.NET dependancies
- Nito.AsyncEX
- Newtonsoft.Json
- MySql.Data
- Microsoft.AspNetCore.Mvc.NewtonsoftJson
- Microsoft.AspNetCore.StaticFiles
- Microsoft.EntityFrameworkCore.SqlServer
- Microsoft.EntityFrameworkCore.Tools
Setup
- Install .NET
- Clone and build the BantFlags .NET project.
-
Create the database using
database.sql
.- Change the password.
-
configure
BantFlags/appsettings.example.json
with your connection string and webroot (the directory you wish to serve the flags from) and rename it toappsettings.json
- The location of the BantFlags application and the served content
are not necessarly the same. If you leave it empty, or provide a
nonexistant path the application will look for the
wwwroot
folder inside the working directory. - This should be placed either in inside the working directory or the same directory as the program.
- The location of the BantFlags application and the served content
are not necessarly the same. If you leave it empty, or provide a
nonexistant path the application will look for the
- Add flags to the backend (currently only possible by querying the
database directly), and place image with the same name in
{webroot}/flags/
. -
Configure your webserver of choice to forward requests to kestral
- Example nginx config.
- Run the application
- ???
- profit.
Such a setup should map 1:1 to the userscript just by changing the
variable back_end
though I can't say I've ever tried it.
Database
Tables look like this: posts
id | post_nr | board |
1 | 12345 | bant |
2 | 56789 | bant |
flags
id | flag |
1 | patchouli |
2 | chen |
postflags
id | post_nr | flag |
1 | 1 | 1 |
2 | 1 | 2 |
2 | 2 | 2 |
where post_nr and flag in postflags are the primary key in their respective tables.
API
The backend exposes three endpoints used by the userscript to get and post flags, and a flags directory storing the images themselves.
route | purpse |
---|---|
/api/get | Get flags in a thread |
/api/post | Add flags to the database |
/api/flags | List the flags we support |
/flags/* | The flag images |