Update README.org

dotnetflags
C-xC-c 5 years ago committed by GitHub
parent 107214eea9
commit 184293b5e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,10 +10,10 @@ the backend . A user's flags are stored between pages using
=GM_setValue= and =GM_getValue=. =GM_setValue= and =GM_getValue=.
Old versions of GreaseMonkey will be able to recieve updates to the Old versions of GreaseMonkey will be able to recieve updates to the
script through use of the =@updateURL= and =@downloadURL= directives, script through the =@updateURL= and =@downloadURL= directives, though
though these were depricated sometime in GreaseMonkey 3.x and updates these were depricated sometime in GreaseMonkey 3.x and updates are
are only checked from the location the script was downloaded from so only checked from the location the script was downloaded from so be
be careful where you upload links. careful where you upload links.
On self hosting, changing =back_end= to your domain /should/ be all On self hosting, changing =back_end= to your domain /should/ be all
you need to do, but don't take this as fact. you need to do, but don't take this as fact.
@ -39,42 +39,60 @@ declarations. Update your hecking browser.
- Magick.NET-Q8-AnyCPU - Magick.NET-Q8-AnyCPU
*** Setup *** Setup
1. Install .NET Core 1) [[https://dotnet.microsoft.com/download/dotnet-core][Install .NET Core]]
2. Clone and build the BantFlags solution. 2) Clone and build the BantFlags solution.
3. Create the database using [[https://github.com/C-xC-c/BantFlags/blob/master/Environment/database.sql][database.sql]]. 3) Create the database using [[https://github.com/C-xC-c/BantFlags/blob/master/Environment/database.sql][database.sql]].
+ *Change the password*. - *Change the password*.
4. configure =BantFlags/appsettings.example.json= with your connection 4) configure =BantFlags/appsettings.example.json= with your connection
string and webroot (where you'll serve the flags from *without a string and webroot (where you'll serve the flags from *without a
trailing /*) and rename it to =appsettings.json= trailing slash*) and rename it to =appsettings.json=
+ The location of the BantFlags application and the served content - See below for an example appsettings.json.
are not necessarly the same. If you leave it empty, or provide a - ASP.NET Core applications look for a folder called =wwwroot= in
nonexistant path the application will look for the =wwwroot= the same directory as the application for static files. However
folder inside the working directory. you can choose to logically seperate these by providing a vaild
+ For example, you may place =BantFlags.dll= and directory to =webroot=.
=appsettings.json= in =/etc/bantflags/= and point =webroot= at - That is to say, if the bantflags application is in
=/var/www/html= and bantflags will server static content from =/var/www/bantflags/BantFlags.dll=, the program will look for
that directory, or leave =webroot= empty and bantflags will look the folder =/var/www/bantflags/wwwroot/= to host static content,
for static content in =/etc/bantflags/wwwroot= or whatever directory is provided to =wwwroot=.
5. Create a folder called =keys= in the directory you will be hosting 5) If you're hosting on your GNU/Linux distribution of choice, Create a
bantflags from. folder called =keys= in the same directory as the bantflags
+ E.G. =/etc/bantflags/keys/= executable.
+ ASP.NET Core uses some cryptic bullshit anti forgery token when - E.G. =/var/www/bantflags/keys/=
processing HTML forms, and it's unable to persistantly store the - This is because ASP.NET Core uses some cryptic bullshit anti
decryption keys in memory on GNU + Linux. This directory will forgery token when processing HTML forms, and it's unable to
store said keys when you or users upload flags to /upload. The persistantly store the decryption keys in memory on
path is hardcoded to =AppDomain.CurrentDomain.BaseDirectory=, GNU/Linux. This directory will store said keys when you or
users upload flags to /upload. The path uses
=AppDomain.CurrentDomain.BaseDirectory= internally,
I.E. wherever the program is. I.E. wherever the program is.
6. Add flags to the backend either by querying the database directly 6) Add flags to the backend by uploading them to the flag console (/Upload).
and placing images *with the same name* in ={webroot}/flags/= or - Flags must be 16x11 pixels and under 15kb. Their names must not
by using /upload. exceed 100 characters and cannot contain either "||" or ",".
7. Configure your webserver of choice to forward requests to kestral 7) Configure your webserver of choice to forward requests to kestral
+ [[https://github.com/C-xC-c/BantFlags/blob/master/Environment/nginx.conf][Example nginx config.]] - [[https://github.com/C-xC-c/BantFlags/blob/master/Environment/nginx.conf][Example nginx config.]]
8. Run with =dotnet BantFlags.dll= or create a service to run it as a 8) Run with =dotnet BantFlags.dll= or create a service to run it as a
daemon. daemon.
+ [[https://github.com/C-xC-c/BantFlags/blob/master/Environment/bantflags.service][Example systemd service.]] - [[https://github.com/C-xC-c/BantFlags/blob/master/Environment/bantflags.service][Example systemd service.]]
9. ??? 9) ???
10. profit. 10) profit.
**** Example appsettings.json
#+BEGIN_SRC javascript
{
"dbconfig": {
"connectionstring": "Server=localhost;Port=3306;User ID=user;Password=password;Database=bantflags",
"poolsize": 2,
"boards": [
"bant",
"nap",
"srsbsn"
]
},
"webroot": "/var/www/html",
"staging-password": "supersecretpassword"
}
#+END_SRC
*** Database *** Database
Tables look like this: Tables look like this:
@ -94,8 +112,10 @@ Tables look like this:
where post_nr and flag in *postflags* are the id fields in their where post_nr and flag in *postflags* are the id fields in their
respective tables. respective tables.
*** API *** API
The backend exposes three endpoints used by the userscript to get and The backend exposes three endpoints for the userscript to get and post
post flags, and a flags directory storing the images themselves. flags. Flags themselves are hosted from the =flags/= directory. This
will be whatever value you gave to =webroot= (or
=/path/to/bantflags/wwwroot/= if no value is provided) + =flags/=.
| route | purpse | | route | purpse |
|------------+--------------------------------------------| |------------+--------------------------------------------|
@ -105,8 +125,8 @@ post flags, and a flags directory storing the images themselves.
| /flags/* | The flag images | | /flags/* | The flag images |
** Backwards Compatibility ** Backwards Compatibility
The API is 1:1 compatable with all previous versions of bantflags, but The API is 1:1 compatable with all previous versions of
also encodes a new =version= variable when getting flags which allows bantflags. Further improvements are achieved by encoding a =version=
for breaking changes in the script while the backend only sends data variable when poking endpoints which allows for breaking changes in
it knows is parsable. See [[https://github.com/C-xC-c/BantFlags/tree/master/Docs/][Docs/{endpoint}]] the script and backend while guaranteeing data can be parsed on both
for version compatibility. ends. See [[https://github.com/C-xC-c/BantFlags/tree/master/Docs/][Docs/{endpoint}]] for changes and compatibility.

Loading…
Cancel
Save