Git Product home page Git Product logo

magicaltavern-api's Introduction

Contributors Forks Stargazers Issues MIT License


magicaltavern api

This repository provides an SQLite database, a RESTful API for use with magicaltavern-bot or your own implementations of a magicaltavern-web-client, and last but not least a website for the magicaltavern service, with which users can enroll into Pen and Paper campaigns.
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

This repository provides a JSON-based database handler, a RESTful API for use with magicaltavern-bot, your own implementations of a magicaltavern-web-endpoint, and last but not least a website for the magicaltavern service, with which users can enroll into Pen and Paper campaigns.

(back to top)

Built With

  • Python 3.9
  • Flask
  • SQLAlchemy
  • SQLite
  • SQLAlchemy-serializer

(back to top)

Getting Started

To get a local development environment up and running, follow these steps.

Prerequisites

  • On Windows: Install Windows Subsystem for Linux. Use the WSL Terminal for this Project.

  • python 3.9

  • pip

    python -m ensurepip --upgrade
  • venv

Installation

  1. Clone the repo and cd into it.

    git clone https://github.com/bitfl0wer/magicaltavern-web.git
    cd ./magicaltavern-web
  2. Create a venv and activate it.

    python3 -m venv ./venv venv
    source ./venv/bin/activate
  3. Install requirements. Either:

    pip install -r requirements.txt

    or

    python -m pip install -r requirements.txt
  4. Add an API key to the database. See the API documentation.

  5. Create the file ${PROJECTDIR}/app_configurator.py using the following template:

    from flask import Flask
    
    
    def configure(app: Flask) -> Flask:
        app.config[
            "SECRET_KEY"
        ] = ""
        app.config["DISCORD_CLIENT_ID"] = 
        app.config["DISCORD_CLIENT_SECRET"] = ""
        app.config["DISCORD_REDIRECT_URI"] = "http://127.0.0.1:7777/callback"
        return app

    Fill in the value SECRET_KEY and add the ID and Client Secret of a Discord Application that you plan to use for the project.

  6. Start the development environment with

    python main.py

(back to top)

Usage

WIP!

For more examples, please refer to the Documentation

(back to top)

Roadmap

  • Website!
    • Campaign Enroll Feature
    • Discord OAuth Login
    • E-Mail and Password Login
  • 1-Factor Email Authentication

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the AGPL v3.0 License. See LICENSE.txt for more information.

(back to top)

Contact

Nerds Playing PnP - [email protected]

Project Link: https://github.com/bitfl0wer/magicaltavern-web

(back to top)

Acknowledgments

  • Fugi
    • Added Dockerfile and corresponding configuration for easy Docker Deploy functionality! Also reviewed my code on the big rewrite :)
  • SaltyOne
    • Is currently working on all website related issues, and is a second project maintainer. ❤️
  • Casey
    • Reviewed my pull request and suggested changes! Thanks, casey! :>

(back to top)

magicaltavern-api's People

Contributors

bitfl0wer avatar juhi838b avatar fugimuffi avatar klloprop avatar

Stargazers

Vivien avatar Fugi avatar  avatar

Watchers

 avatar

Forkers

juhi838b

magicaltavern-api's Issues

API Version 1.1 needed

api/v1_0/campaigns.py:

@campaigns_api.route("/api/v1.0/campaigns/int:key/", methods=["PUT"]) # TODO: This breaks the magicaltavern-bot. An API Version v1.1 has to be created which has @campaigns_api.route("/api/v1.0/campaigns/int:key/player/", methods=["PUT"]) instead of the current PUT function.
This issue got created during the merge request, to keep the current website code running, since it relies on a different version of this put request, but it breaks the bot. This is entirely my fault, since I did not create a new API Version for this change. This needs to be done now though.

Website Design

Website looks bland. It works but it isn't pretty, we need to figure out how this is supposed to look so somebody (likely me) can start designing.

Admin Panel to configure user permissions

As mentioned in #19 , I think that there should be an Admin Panel on the website, with which admins can manage the access level of other users. API functionality has to be provided for this.

Rewrite Website to rely on API v2 code

The Branch apiv2 will feature several, thorough refactorings. For example: We now explicitly distinguish between Website-Routes (Code, that uses the API to display website pages) and the API (code, that the bot and website endpoint rely on). This means, that the API v2 will not touch any part of the website logic. The website logic will have to be updated to target the new v2 API. Documentation will be written for the v2 API by me.

Add ability to delete profile

There needs to be a method triggered by a button on the profile page which allows oneself to delete their profile. The deletion functionality does not necessarily need to be implemented yet (simply open a new issue for that, and I'll take care of it), but I'd like the following criteria to be implemented:

A button on the profile page, which allows oneself to delete your profile. Clicking button triggers a flask route/method.
The method can be a dummy method for now.
Clicking the button should raise a confirmation prompt. Something along the way of "Are you sure that you really want to do this?"
The method should not be triggerable by entering a URL into the browser. I.e.: entering [...]/profile/delete into your address bar should not be enough to delete your profile, since it'd bypass the confirmation prompt.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.