Skip to content

Commit

Permalink
Main (#149)
Browse files Browse the repository at this point in the history
* Update common.py

* Update common.py

* Adds a warning when a user is impersonating someone else

* Update base.html

* Corrected impersonate

* Update manage_game.html

* Added staff management to let necromancer add mods

Also adds volunteers and future legacy status update compatibility

* Update moderator.py

* Corrected macro in moderator sidebar

* Corrected is_volunteer

* Update moderator.py

* Zombie Tree and Volunteer ReWorking

* Improved UI for game management

* Update manage_game.html

* Corrected game start form

* Update manage_game.html

* Update manage_game.html

* Game start form corrections

* Update manage_game.html

* Update manage_game.html

* Added Glyphicons

* Create _bootstrap.scss

* Many many revisions to game start date

* Update moderator.py

* Update moderator.py

* Ui fixes

* Update moderator.py

* Update moderator.py

* FIxed mod auth

* Update moderator.py

Localized tz

* Update manage_game.html

* Update manage_game.html

* Update manage_game.html

* Added email template altering

Probably broke a million other things along the way. Also fixed supply code generation to solve error with non-5 inputs

* Fixed paths

* Updated game email altering UI

* Update email_templates.html

* Condensed email template code and included instructions

* Update email_templates.html

* Condensed code

* Update moderator.py

* Update moderator.py

* Updated views

* Update moderator.py

* Update player.py

* Update player.py

* Set moderator.py for testing

* Update moderator.py

* Update player.py

* Update player.py

* Update player.py

* Update player.py

* Update player.py

* Major revisions to OZ pool handling

Included function to randomize OZs
Altered players to have a setting "is_oz" denoting if their setting in the pool is to make them an OZ

* Adds a way to see previous zombie trees

* Removed game model changes

* Revised game model

* Added null permissions to models

* Removed urls to allow for model changes

* Update moderator.py

* Re-added Fields after migration

* Update dashboard.py

* Update dashboard.py

* Update moderator.py

* Update dashboard.py

* Update manage_oz.html

* UI Fixes

* Update dashboard.py

* Update previous_games.html

* Added signup hours to signup locations

* Enabled signups edits to be displayed live on the index page

* Update dashboard.scss

* Updated style for previous games

* Update previous_games.html

* Update previous_games.html

* Update dashboard.py

* Update previous_games.html

* Added the basic structure to implement legacy points

* Altered admin class to implement legacy in backend

Also hid game archive page but still permit access

* Update admin.py

* Fixed user admin to display legacy pts

* Update admin.py

* Update admin.py

* Update signup.py

* Update admin.py

* Update legacy.py

* Update signup.py

* Update admin.py

* Added manage legacy view

* Update signup.py

* Update moderator.py

* Update user.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Removed a glitch causing duplicate users to appear

* Finished Legacy Token implementation

Users will now be prompted to spend legacy tokens if they have them. They will also be given access to volunteer emails

* Implements score display

Allows mods to have fun showing off fake scores while allowing players to hide or show their score

* Revert "Implements score display"

This reverts commit 3361b0b.

* Update player.py

* Revert "Revert "Implements score display""

This reverts commit 45a3d86.

* Fixed typos

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Update moderator.py

* Tests for email template

* more testing

* Corrected form autofill with email information

* Added functionality to send reminder and start emails

* Corrected bulk OZ edits

* Corrected legacy usage to remove tokens

* Update manage_oz.html

* Update moderator.py

* Implemented Stun Verification

* Corrected Mod Dashboard to add a legacy user group

* Update index.html

* Update moderator_sidebar.html

* Update moderator.py

* Update dashboard.py

* Update manage_game.html

* Update dashboard.py

* Update stun_verification.html

* Update dashboard.py

* Update index.html

* Added Lifetime Stats; Fixed Stun Times

* Fixed Timezone localize

* Update moderator.py

* Update moderator.py

* Update stun_verification.html

* Update moderator.py

* Altered cosmetics

* Update moderator.py

* Added user signup on the webpage

* Tweaks

* Update dashboard.py

* Bug squash

* Update admin.py

* Attempted implementing dynamic variables

* UI Improvements

* Update index.html

* Update index.html

* Update countdown.js

* More UI Tweaks

* Players can toggle score visibility

* UI Tweaks

* Allows user objects to not be deleted upon kill?

* Corrected migrations history

* Fixed a bunch of setup issues when cloning repo (#1)

* fix issues with setup of dev environment

* ui and styling fixes

* add django_su as a package

* remove print statements and broken button on player dashboard

* fix broken collapses on mission details

Co-authored-by: Tiger Kong <tig567899@users.noreply.github.com>

* added ability to delete signup locations and cleaned up whitespacing

* Faction modification page (#20)

added ability to add/edit/delete factions, and add/remove players to faction

* API basic setup (#24)

Changes: 
- Added authentication and player info endpoints
- Serializers
- Added utility functions to simplify future API development
- Documentation added for API

* Enable Previous Games View (#29)

Redesigning and enabling previous games page

* Api stuns tags tiger (#30)

* Added tag/stun for players

* Updated API documentation to reflect server side changes.

* Localized api stun email times (#31)

* initial nav redo and using desktop index page

* added new mobile index page and fixed previous games

* fixing dashboard

* Added supply codes API (#34)

* Added supply code redeeming capability

* Added supply code documentation

* Fixed volunteer addition (#36)

* Small fixes to coundown and adding tweets (#33)

* Update index.html

Changed the website welcome to contain game specific info

* Update index.html

* adding graceful error when user exists on signup (#39)

* Increased functionality (#41)

Allows for self-emailing and emailing just mods or spectators as desired

* Solved glitch with starting game accidentally

* Bug squash in dashboard (#40)

Fixed confusion with "sign up" button to create an account
Imported User model to dashboard to fix errors with legacy users

* Corrected self-emailing bug

* adding privacy_policy to footer (#42)

* Enables HTML code to be written in emails (#44)

Force sends the email as HTML subtype when selected. De-selected by default.

* Now gets most recent game player per user (#48)

* Stun view (#47)

* Corrected min-zombie score

* Enables viewing of tags/stuns

Should eventually be corrected to account for daylight savings time

* initial fixes to backend

* verify all button, redesign tags table

Co-authored-by: Pranav Krishnan <pranavkrsh@gmail.com>

* Timezone fixes and minor bug tweak in stun verification

* Fixing email to send in batches of 100 (#49)

* fixing email to send in batches of 100

* Fix broken tags for zombos

* Update moderator.py

Tiny little typo fix that was causing grief

* Changed tags to include a type

Type indicated via an Enum field

* Update tag.py

* Updated tag manager for type implementation

* Implementation of TagType (#51)

* Implementation of TagType

Includes the defaulting of TagType to Stun to allow for ease of tree replacement
Also includes a script for converting old trees

* Fixes an issue with players reporting times in the future

* Added tools for easing tag changes

* Added more functionality to tag backend

* Update admin.py

Added OZ searching and type listing for ease of use

* Anti-similar-tag

This is an attempt to prevent players from submitting a kill twice retroactively and having it slip past the mod team unnocited. Also prevents players from having two people submit the same kill. Needs to be reviewed.

* Update moderator.py

Can't extended a list with a set of tags, so this works instead

* Update player.py

Updated tagtypes to the new tree. Instituted a way for tag descriptions to appear on hovering over edges

Co-authored-by: UW HvZ <40743370+uwhvz@users.noreply.github.com>

* Tag conversion command patch (#52)

* Update __init__.py

* Update player.py

* Update admin.py

* Update old_tree_recovery.py

* Update dashboard.py

* Create old_tag_recovery

* Rename old_tag_recovery to old_tag_recovery.py

* Update old_tag_recovery.py

* Get tag lists tiger (#57)

* Added tag list api route

* Update README.md

* Update API Documentation.md

* Added player list API  (#58)

* Added api to get all players associated with current game

* Fixed small style issues

* Added manual ordering to match website functionality

* Update API Documentation.md

* Added moderator and spectator data

* Update API Documentation.md

* Tag API bugfix (#59)

* some bugfixes

* Update API Documentation.md

* Weekend Game Rules (#60)

* Made intro more generic

* Added weekend rules

* Emails, Codes, and Guides (#54)

* Saves Emails for Player View

A longwinded way of saving data sent in emails for convenient access in the dashboard

* Aesthetics

Modified emails to allow players to see all sent emails when game is not running

* Enables saving of player made emails

* Implements the New Player Guide

* Creates Printable Player Codes

:D

* Compatibility fix

* Email formating corrections

* Made corrections to email groupings

Also player code display

* Fixed moderator usage

* Update dashboard.py

* Email tweaks

* Added Minecraft

* Fixed letter error

* UI Changes and Improvements

Changed dependencies to include reportlab

Added public score functionality

Corrected total stun/kill counter

General UI Changes

* Improved Player Code Downloads

* Added Drop Down Bar for Panels

* Cosmetic changes

Fixed drop down menus and font sizes

* Even more cosmetics

* Update navbar.html

Co-authored-by: UW HvZ <40743370+uwhvz@users.noreply.github.com>

* modifié :         Pipfile
	modifié :         Pipfile.lock
	modifié :         app/management/commands/old_tag_recovery.py
	modifié :         app/templates/jinja2/components/navbar.html
	modifié :         app/templates/jinja2/dashboard/index.html
	modifié :         app/templates/jinja2/index.html
	modifié :         app/views/dashboard.py
	modifié :         app/views/moderator.py
	modifié :         uwhvz/settings/common.py

* Add files via upload

* Update player_sidebar.html

* Update navbar.html

* Add player guide html

* Update navbar.html

* May 2022 Website Update

* Server files more up to date than repo

* updated dashboard game start/end dates

* Signup Location Deletion Prevention

Prevents accidental deletion by providing an aria modal popup instead of just immediately killing the object.

* Require alphanumeric codes

This will prevent players from entering non-alphanumeric codes when customizing. This is implemented in regex since it is twice as fast as a for loop.

* Extended zombie tree colour scheme

Added another colour option for super long trees

* Extended zombie tree colour scheme

* Added Game Archive Option

* Updated text for homepage

* Archive Zombie Tree

Adds an option for Necro to automagically add the zombie tree to the public facing website

* - Removed outdated Pipenv (Pipefile and Pipefile.lock)
- Added requirements.txt file

* - Deleted migrations again because pain
- Added handling in case no game yet exists, not complete yet. This is mostly helpful for local testing

* Added Visible boolean toggle

Added visibility toggle to allow email registering on backend that can't be seen by players. This currently has no functionality but could be useful for later on tweaks of allowing sending emails without them showing on the website to players.

* Add visibility toggle for emails

This makes emails toggled as invisible actually invisible

* Added email visibility toggled

heckin mobile website stuff. This makes the email visibility toggle apply to mobile.

* Altered Base Emails to be Objects

Rather than the current fixed format

* Clarify html documentation

Added Monday clarity

* Removed reference to txt emails

No one uses txt formatting anymore

* Updated email template forms

Removed txt formatting and initial email states

* Updated email templates

These now use the new email model to ensure players cannot view the email templates, but it enables parsing and updating of email templates without the need to restart the website. Pretty nifty eh?

* Update signup and start emails

These emails now use the new dynamic objects rather than the static email templates

* Added dynamic dashboard welcome

We used the email object for this. Not the greatest. But it will suffice for now.

* Added dynamic dashboard welcome

This will make life easier going forward

* Added dynamic dashboard welcome

This just makes it appear during game startup

* Different data target than normal volunteer

This fixes a name conflict that prevented Strong Volunteer from being accessed

* - Added functionality to query play data based on a supply code for the active game
- Added link to moderator actions
- Created new player_search.html file for page
- Implemented search logic via post call & redirect

* - Html template change of name

* - Made a fix to dynamic email templates

* - Made fixes to dashboard display behaviour

* Visual Fix for Necro Email View

This fix doesn't actually change the objects on the backend but ensures they are displayed correctly in the initial state of the email templates

* Objects need name specification for get

* - Fixed html render behaviour for dashboard (still Jank tho)

* - Temporarily re-implemented static signup emails

* - Updated strong volunteer actions to only be active if game is running

* - Added a new comment cause wasn't clear
- Added functionality to game management screen allowing sending mod mail directly to a specific user via player code

* - Fixed dashboard message rendering to only display USER group messages intended for the current user

* Server-side migration completed

---------

Co-authored-by: Pranav Krishnan <30536795+pkrshnan@users.noreply.github.com>
Co-authored-by: Tiger Kong <tig567899@users.noreply.github.com>
Co-authored-by: Pranav Krishnan <pranavkrsh@gmail.com>
Co-authored-by: firemaster1294 <48422004+firemaster1294@users.noreply.github.com>
Co-authored-by: --global <--global>
Co-authored-by: Kanwarpal Brar <brar.kanwarpal.school@gmail.com>
Co-authored-by: Kanwarpal Brar <kanwar@cloudsparklabs.com>
  • Loading branch information
7 people authored May 1, 2023
1 parent 267d748 commit 19a85fd
Show file tree
Hide file tree
Showing 141 changed files with 6,894 additions and 1,723 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,12 @@ node_modules
*.sqlite3
/static/
/media/

production.py
development.py
common.py
app_game
db-old-feb-2022
git_pull.sh
*.csv
*.wsgi
296 changes: 296 additions & 0 deletions API Documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@


# API Documentation

Below is the documentation for the UWHvZ API. Endpoints will be added, and this document is subject to be expanded upon.

All endpoints, except the ones marked with a \*, require authentication using two cookies named `sessionid` and `csrftoken`.

## Login*

`/api/v1/auth/login/`

#### Method

`POST`

#### Body parameters

- `username`: email address of the account
- `password`: password of the account.

#### Success Response

`Success`

Authenticates the user with the associated username. Attaches two cookies with names `sessionid` and `csrftoken` which identify the user sessions.

#### Failure Response

`401` - Login failure, incorrect credentials.

## Logout

`/api/v1/auth/logout/`

#### Method

`GET`

#### Parameters

None

#### Body Parameters

None

#### Success Response

`Success`

`200` - Refreshes `csrftoken` and removes `sessionid` cookie.

#### Failure Response

`403 Logout Failed`

This means you had invalid cookies.

## Account Information

**Note**: This endpoint is currently only built for players. Moderator and spectator information collecting may be added later.

`/api/v1/account_info/`

#### Method

`GET`

#### Parameters

None

#### Body Parameters

None

#### Success Response

`200` - Returns a JSON Object with the fields:

| Name | Type | Description |
| ------------ | ------------------- | ------------------------------------------------------------ |
| `code` | String | Player code as a string |
| `roleChar` | Char | One character that represents the role of the player. `H` for human, `Z` for zombie, and `S` for spectators |
| `is_oz` | Boolean | Whether the player is an OZ |
| `name` | String | Player's name |
| `email` | String | Player's email |
| `score` | Integer | Player's score |
| `shop_score` | Integer | Player's points available for use in the shop. |
| `game` | Game (see below) | Game that this player is associated with. **Use this to check if the user is currently playing.** |
| `faction` | Faction (see below) | Faction that the player is associated with. |

##### Game

| Name | Type | Description |
| -------- | ------ | ------------------------------------------------------------ |
| `name` | String | Game name |
| `status` | String | This is the game status, and can be either `running`, `finished`, or `signups`. |
| started\_on | String | Time that the current game started. Given in ISO8601. |
| ended\_on | String | Time that the current game ended, in ISO8601 format. This field is null if the current game has not finished yet. |

##### Faction

| Name | Type | Description |
| ------------- | ------ | ------------------- |
| `name` | String | Name of faction |
| `description` | String | Faction description |
| `modifiers` | Array(Modifier, see below) | List of Modifiers that a faction gives. |

##### Modifier

| Name | Type | Description |
| ----------------- | ------ | ----------- |
| `modifier_amount` | String | Quantity of modifier |
| `type` | String | Type of modifier - `O` for one time use, `S` for supply codes, and `T` on tags. |

#### Failure Response

`401`: The user is not logged in.

`403`: The user is not a player.

## Get Tag List

`/api/v1/view_tags/`

Gets all tags associated with logged in player.

#### Method

`GET`

#### Parameters

None

#### Body Parameters

None

#### Success Response

`200` - Returns a JSON object with the fields:

| Name | Type | Description |
| ------------ | -------------------------------- | ------------------------------------------------------- |
| `unverified` | Array of Tag objects (see below) | A list of the unverified tags associated with a player. |
| `verified` | Array of Tag objects (see below) | A list of the verified tags associated with a player. |
| `received` | Array of Tag objects (see below) | A list of the received tags associated with a player. |

##### Tag

| Name | Type | Description |
| ---------------- | -------- | ------------------------------------------------------------ |
| `initiator_name` | string | Name of the initiating player. |
| `initiator_role` | char | A character denoting the role of the initiating player. Should be 'H' or 'Z'. |
| `receiver_name` | string | Name of the receiving player. |
| `receiver_role` | char | A character denoting the role of the receiving player. Should be 'H' or 'Z'. |
| `points` | integer | The points this particular tag is worth, depending on any modifiers plus the value of the receiving player |
| `location` | string | The location of the tag given. If blank, this was not given when the tag was submitted. |
| `time` | datetime | A time string in ISO8601 format (Ex: 2020-08-11T19:29:25Z) |
| `description` | string | The description of the tag given. If blank, this information was not given when the tag was submitted. |
| `tag_type` | char | A character denoting the type of tag, stun or kill. Should be 'S' or 'K', respectively. |

#### Failure Response

`401` - The user is not logged in.

`403` - The user is not a player.

## Get Player List

`/api/v1/get_player_list/`

Gets all players playing in the same game as the logged in user.

#### Method

`GET`

#### Parameters

None

#### Body Parameters

None

#### Success Response

`200` - Returns a JSON object with the following fields:

| Name | Type | Description |
| ------------ | ------------------------------------- | ------------------------------------------------------------ |
| `players` | List of Player (see below) objects | A list of all active players in the game, either as humans or zombies, sorted in alphabetical order by name. |
| `moderators` | List of Moderator (see below) objects | A list of all current moderators in the game, sorted in alphabetical order by name. |
| `spectators` | List of Spectator (see below) objects | A list of all current spectators in the game, sorted in alphabetical order by name. |

##### Player

| Name | Type | Description |
| ---------------- | ------- | ------------------------------------------------------------ |
| `roleChar` | char | One character that represents the role of the player. `H` for human, `Z` for zombie, and `S` for spectators |
| `name` | string | Player's name. |
| `processedScore` | integer | If the player has chosen to share their score publicly, this will be the player's score. Otherwise, a `-1` value here means that the score is hidden. |

##### Moderator

| Name | Type | Description |
| ------- | ------ | ------------------------------------------------------------ |
| `name` | string | Moderator's full name. |
| `score` | string | This can be any string up to 180 characters long, and is the moderator's made up "score". |

##### Spectator

| Name | Type | Description |
| ------ | ------ | --------------------- |
| `name` | string | Spectator's full name |

#### Failure Response

`401` - The user is not logged in.

`403` - The user is not a player.

## Stun or Tag

`/api/v1/stun_tag/`

Reports a stun or a tag, depending on whether the logged in player is a human or a zombie.

#### Method

`POST`

#### Parameters

None

#### Body Parameters

| Name | Type | Description |
| ------------- | -------------- | -------------------------------------------------- |
| `code` | String | Code of player who is getting stunned/tagged |
| `time` | 64 bit Integer | Timestamp in Unix epoch time of the event |
| `location` | String | **Optional**. The location, specified as a string. |
| `description` | String | **Optional**. A description of the stun or tag. |

#### Success Response

`200` - Returns the target's full name as a string.

#### Failure Response

`400` - Request was malformed in some way.

`403` - User given is not a player. Cannot register stun or tag.

`404` - The target is not an active player. Cannot register stun or tag.

`409` - An identical stun or tag has been found. The current one is a duplicate.

## Redeem a Supply Code

`/api/v1/supply_code/`

Reports a stun or a tag, depending on whether the logged in player is a human or a zombie.

#### Method

`POST`

#### Parameters

None

#### Body Parameters

| Name | Type | Description |
| ------ | ------ | -------------------- |
| `code` | String | Supply code to claim |

#### Success Response

`200` - Returns the target's full name as a string.

#### Failure Response

`400` - Request was malformed in some way.

`401` - Not logged in

`403` - User given is not a player or is not human.

`404` - The target is not an active player.
23 changes: 0 additions & 23 deletions Pipfile

This file was deleted.

Loading

0 comments on commit 19a85fd

Please sign in to comment.