From a6766b20080c4366992a0972747dcf2fd7a995d4 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Tue, 2 May 2017 18:37:24 +0000 Subject: [PATCH] Initial structure for discordbot addition --- README.md | 9 ++------- discordbot/README.md | 6 ++++++ webapp/README.md | 8 ++++++++ config.example.py => webapp/config.example.py | 2 +- requirements.txt => webapp/requirements.txt | 0 run.py => webapp/run.py | 0 run_c9.py => webapp/run_c9.py | 0 {titanembeds => webapp/titanembeds}/__init__.py | 0 {titanembeds => webapp/titanembeds}/app.py | 0 .../titanembeds}/blueprints/__init__.py | 0 .../titanembeds}/blueprints/api/__init__.py | 0 .../titanembeds}/blueprints/api/api.py | 0 .../titanembeds}/blueprints/embed/__init__.py | 0 .../titanembeds}/blueprints/embed/embed.py | 0 .../titanembeds}/blueprints/user/__init__.py | 0 .../titanembeds}/blueprints/user/user.py | 0 .../titanembeds}/database/__init__.py | 0 .../titanembeds}/database/authenticated_users.py | 0 .../titanembeds}/database/custom_redislite.py | 0 .../titanembeds}/database/guilds.py | 0 .../titanembeds}/database/keyvalue_properties.py | 0 .../titanembeds}/database/unauthenticated_bans.py | 0 .../titanembeds}/database/unauthenticated_users.py | 0 {titanembeds => webapp/titanembeds}/decorators.py | 0 {titanembeds => webapp/titanembeds}/discordrest.py | 0 {titanembeds => webapp/titanembeds}/oauth.py | 0 .../titanembeds}/static/css/administrate_guild.css | 0 .../titanembeds}/static/css/embedstyle.css | 0 .../titanembeds}/static/css/style.css | 0 .../titanembeds}/static/js/administrate_guild.js | 0 .../titanembeds}/static/js/embed.js | 0 .../titanembeds}/static/titanembeds.mp4 | Bin .../titanembeds}/static/titanembeds.ogg | Bin .../titanembeds}/static/titanembeds.webm | Bin .../templates/administrate_guild.html.j2 | 0 .../titanembeds}/templates/dashboard.html.j2 | 0 .../titanembeds}/templates/embed.html.j2 | 0 .../titanembeds}/templates/google_analytics.html.j2 | 0 .../titanembeds}/templates/index.html.j2 | 0 .../titanembeds}/templates/signin_complete.html.j2 | 0 .../titanembeds}/templates/site_layout.html.j2 | 0 {titanembeds => webapp/titanembeds}/utils.py | 0 {tmp => webapp/tmp}/.gitinclude | 0 43 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 discordbot/README.md create mode 100644 webapp/README.md rename config.example.py => webapp/config.example.py (89%) rename requirements.txt => webapp/requirements.txt (100%) rename run.py => webapp/run.py (100%) rename run_c9.py => webapp/run_c9.py (100%) rename {titanembeds => webapp/titanembeds}/__init__.py (100%) rename {titanembeds => webapp/titanembeds}/app.py (100%) rename {titanembeds => webapp/titanembeds}/blueprints/__init__.py (100%) rename {titanembeds => webapp/titanembeds}/blueprints/api/__init__.py (100%) rename {titanembeds => webapp/titanembeds}/blueprints/api/api.py (100%) rename {titanembeds => webapp/titanembeds}/blueprints/embed/__init__.py (100%) rename {titanembeds => webapp/titanembeds}/blueprints/embed/embed.py (100%) rename {titanembeds => webapp/titanembeds}/blueprints/user/__init__.py (100%) rename {titanembeds => webapp/titanembeds}/blueprints/user/user.py (100%) rename {titanembeds => webapp/titanembeds}/database/__init__.py (100%) rename {titanembeds => webapp/titanembeds}/database/authenticated_users.py (100%) rename {titanembeds => webapp/titanembeds}/database/custom_redislite.py (100%) rename {titanembeds => webapp/titanembeds}/database/guilds.py (100%) rename {titanembeds => webapp/titanembeds}/database/keyvalue_properties.py (100%) rename {titanembeds => webapp/titanembeds}/database/unauthenticated_bans.py (100%) rename {titanembeds => webapp/titanembeds}/database/unauthenticated_users.py (100%) rename {titanembeds => webapp/titanembeds}/decorators.py (100%) rename {titanembeds => webapp/titanembeds}/discordrest.py (100%) rename {titanembeds => webapp/titanembeds}/oauth.py (100%) rename {titanembeds => webapp/titanembeds}/static/css/administrate_guild.css (100%) rename {titanembeds => webapp/titanembeds}/static/css/embedstyle.css (100%) rename {titanembeds => webapp/titanembeds}/static/css/style.css (100%) rename {titanembeds => webapp/titanembeds}/static/js/administrate_guild.js (100%) rename {titanembeds => webapp/titanembeds}/static/js/embed.js (100%) rename {titanembeds => webapp/titanembeds}/static/titanembeds.mp4 (100%) rename {titanembeds => webapp/titanembeds}/static/titanembeds.ogg (100%) rename {titanembeds => webapp/titanembeds}/static/titanembeds.webm (100%) rename {titanembeds => webapp/titanembeds}/templates/administrate_guild.html.j2 (100%) rename {titanembeds => webapp/titanembeds}/templates/dashboard.html.j2 (100%) rename {titanembeds => webapp/titanembeds}/templates/embed.html.j2 (100%) rename {titanembeds => webapp/titanembeds}/templates/google_analytics.html.j2 (100%) rename {titanembeds => webapp/titanembeds}/templates/index.html.j2 (100%) rename {titanembeds => webapp/titanembeds}/templates/signin_complete.html.j2 (100%) rename {titanembeds => webapp/titanembeds}/templates/site_layout.html.j2 (100%) rename {titanembeds => webapp/titanembeds}/utils.py (100%) rename {tmp => webapp/tmp}/.gitinclude (100%) diff --git a/README.md b/README.md index 5661420..2abbc78 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,10 @@ There was a time when Discord doesn't support embedding the chat on a webpage. B - Moderation Features (Kick & ban users by IP addresses, toggling guest users) - Discord OAuth support. (Allows those who have a discord account to access the embed) - Responsive material design! (Thanks materializecss!!) -- All features are done via REST apis (respects discord's rate limiting). Although do not provide consistant connection to Discord, they are easier to maintain and does not often "disconnects" from Discord servers. # Installation -Would you like to run your own copy of Titan Embeds? -1. Clone the repo (make sure you have python 2.7 installed on your system. This project depends on that specific python version) -2. Install the pip requirements `pip install -r requirements.txt` -3. Clone `config.example.py` and rename it to `config.py`. Edit the file to your standards -4. Make sure that the bot is online in the websockets once. This is required because the bot cannot send messages until it has used the ws. Use something like discord.py to log the bot into discord websockets. You can close it afterwards. So basically if the bot account is online ONCE in it's lifespan- you're good. -5. Run the development web via `python run.py` -- Though we suggest to use a better server software (look into gunicorn, nginx, uwsgi, etc) +Would you like to run your own copy of Titan Embeds? There are two parts that integrate nicely together. The webapp (website) handles the frontend and communication with the database to retrieve server messages, etc. The discordbot (bot) handles the communcation +between Discord's websockets and pushing out the data to the database for the webapp. Check out the respective folder for their installation (pay attention to the python versions!) instructions. ## Join us! diff --git a/discordbot/README.md b/discordbot/README.md new file mode 100644 index 0000000..0472b08 --- /dev/null +++ b/discordbot/README.md @@ -0,0 +1,6 @@ +# Titan - DiscordBot Portion +The DiscordBot portion handles the communcation with Discord's websockets to provide real-time updates. The bot's primary role is to push content to the webapp's database to be retrieved at a later time. +It also includes misc. features to moderate guest users, etc. + +# Installation +1. TODO, Sorry about that! (Though if you want to get ahead, install the latest discord.py pip package and that will require **Python 3.5**) \ No newline at end of file diff --git a/webapp/README.md b/webapp/README.md new file mode 100644 index 0000000..8fb833b --- /dev/null +++ b/webapp/README.md @@ -0,0 +1,8 @@ +# Titan - WebApp Portion +The webapp portion handles the frontend (it's what the users see). The webapp highly depends on the discordbot to push websockets data to the database. + +# Installation +1. Clone the repo (make sure you have **Python 2.7** installed on your system. This webapp portion depends on that specific python version) +2. Install the pip requirements `pip install -r requirements.txt` +3. Clone `config.example.py` and rename it to `config.py`. Edit the file to your standards +4. Run the development web via `python run.py` -- Though we suggest to use a better server software (look into gunicorn, nginx, uwsgi, etc) \ No newline at end of file diff --git a/config.example.py b/webapp/config.example.py similarity index 89% rename from config.example.py rename to webapp/config.example.py index 0e427b2..786e614 100644 --- a/config.example.py +++ b/webapp/config.example.py @@ -5,7 +5,7 @@ config = { 'client-secret': "Your discord client secret", 'bot-token': "Discord bot token", - 'app-location': "/var/www/Titan/", + 'app-location': "/var/www/Titan/webapp/", 'app-secret': "Type something random here, go wild.", 'database-uri': "driver://username:password@host:port/database", diff --git a/requirements.txt b/webapp/requirements.txt similarity index 100% rename from requirements.txt rename to webapp/requirements.txt diff --git a/run.py b/webapp/run.py similarity index 100% rename from run.py rename to webapp/run.py diff --git a/run_c9.py b/webapp/run_c9.py similarity index 100% rename from run_c9.py rename to webapp/run_c9.py diff --git a/titanembeds/__init__.py b/webapp/titanembeds/__init__.py similarity index 100% rename from titanembeds/__init__.py rename to webapp/titanembeds/__init__.py diff --git a/titanembeds/app.py b/webapp/titanembeds/app.py similarity index 100% rename from titanembeds/app.py rename to webapp/titanembeds/app.py diff --git a/titanembeds/blueprints/__init__.py b/webapp/titanembeds/blueprints/__init__.py similarity index 100% rename from titanembeds/blueprints/__init__.py rename to webapp/titanembeds/blueprints/__init__.py diff --git a/titanembeds/blueprints/api/__init__.py b/webapp/titanembeds/blueprints/api/__init__.py similarity index 100% rename from titanembeds/blueprints/api/__init__.py rename to webapp/titanembeds/blueprints/api/__init__.py diff --git a/titanembeds/blueprints/api/api.py b/webapp/titanembeds/blueprints/api/api.py similarity index 100% rename from titanembeds/blueprints/api/api.py rename to webapp/titanembeds/blueprints/api/api.py diff --git a/titanembeds/blueprints/embed/__init__.py b/webapp/titanembeds/blueprints/embed/__init__.py similarity index 100% rename from titanembeds/blueprints/embed/__init__.py rename to webapp/titanembeds/blueprints/embed/__init__.py diff --git a/titanembeds/blueprints/embed/embed.py b/webapp/titanembeds/blueprints/embed/embed.py similarity index 100% rename from titanembeds/blueprints/embed/embed.py rename to webapp/titanembeds/blueprints/embed/embed.py diff --git a/titanembeds/blueprints/user/__init__.py b/webapp/titanembeds/blueprints/user/__init__.py similarity index 100% rename from titanembeds/blueprints/user/__init__.py rename to webapp/titanembeds/blueprints/user/__init__.py diff --git a/titanembeds/blueprints/user/user.py b/webapp/titanembeds/blueprints/user/user.py similarity index 100% rename from titanembeds/blueprints/user/user.py rename to webapp/titanembeds/blueprints/user/user.py diff --git a/titanembeds/database/__init__.py b/webapp/titanembeds/database/__init__.py similarity index 100% rename from titanembeds/database/__init__.py rename to webapp/titanembeds/database/__init__.py diff --git a/titanembeds/database/authenticated_users.py b/webapp/titanembeds/database/authenticated_users.py similarity index 100% rename from titanembeds/database/authenticated_users.py rename to webapp/titanembeds/database/authenticated_users.py diff --git a/titanembeds/database/custom_redislite.py b/webapp/titanembeds/database/custom_redislite.py similarity index 100% rename from titanembeds/database/custom_redislite.py rename to webapp/titanembeds/database/custom_redislite.py diff --git a/titanembeds/database/guilds.py b/webapp/titanembeds/database/guilds.py similarity index 100% rename from titanembeds/database/guilds.py rename to webapp/titanembeds/database/guilds.py diff --git a/titanembeds/database/keyvalue_properties.py b/webapp/titanembeds/database/keyvalue_properties.py similarity index 100% rename from titanembeds/database/keyvalue_properties.py rename to webapp/titanembeds/database/keyvalue_properties.py diff --git a/titanembeds/database/unauthenticated_bans.py b/webapp/titanembeds/database/unauthenticated_bans.py similarity index 100% rename from titanembeds/database/unauthenticated_bans.py rename to webapp/titanembeds/database/unauthenticated_bans.py diff --git a/titanembeds/database/unauthenticated_users.py b/webapp/titanembeds/database/unauthenticated_users.py similarity index 100% rename from titanembeds/database/unauthenticated_users.py rename to webapp/titanembeds/database/unauthenticated_users.py diff --git a/titanembeds/decorators.py b/webapp/titanembeds/decorators.py similarity index 100% rename from titanembeds/decorators.py rename to webapp/titanembeds/decorators.py diff --git a/titanembeds/discordrest.py b/webapp/titanembeds/discordrest.py similarity index 100% rename from titanembeds/discordrest.py rename to webapp/titanembeds/discordrest.py diff --git a/titanembeds/oauth.py b/webapp/titanembeds/oauth.py similarity index 100% rename from titanembeds/oauth.py rename to webapp/titanembeds/oauth.py diff --git a/titanembeds/static/css/administrate_guild.css b/webapp/titanembeds/static/css/administrate_guild.css similarity index 100% rename from titanembeds/static/css/administrate_guild.css rename to webapp/titanembeds/static/css/administrate_guild.css diff --git a/titanembeds/static/css/embedstyle.css b/webapp/titanembeds/static/css/embedstyle.css similarity index 100% rename from titanembeds/static/css/embedstyle.css rename to webapp/titanembeds/static/css/embedstyle.css diff --git a/titanembeds/static/css/style.css b/webapp/titanembeds/static/css/style.css similarity index 100% rename from titanembeds/static/css/style.css rename to webapp/titanembeds/static/css/style.css diff --git a/titanembeds/static/js/administrate_guild.js b/webapp/titanembeds/static/js/administrate_guild.js similarity index 100% rename from titanembeds/static/js/administrate_guild.js rename to webapp/titanembeds/static/js/administrate_guild.js diff --git a/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js similarity index 100% rename from titanembeds/static/js/embed.js rename to webapp/titanembeds/static/js/embed.js diff --git a/titanembeds/static/titanembeds.mp4 b/webapp/titanembeds/static/titanembeds.mp4 similarity index 100% rename from titanembeds/static/titanembeds.mp4 rename to webapp/titanembeds/static/titanembeds.mp4 diff --git a/titanembeds/static/titanembeds.ogg b/webapp/titanembeds/static/titanembeds.ogg similarity index 100% rename from titanembeds/static/titanembeds.ogg rename to webapp/titanembeds/static/titanembeds.ogg diff --git a/titanembeds/static/titanembeds.webm b/webapp/titanembeds/static/titanembeds.webm similarity index 100% rename from titanembeds/static/titanembeds.webm rename to webapp/titanembeds/static/titanembeds.webm diff --git a/titanembeds/templates/administrate_guild.html.j2 b/webapp/titanembeds/templates/administrate_guild.html.j2 similarity index 100% rename from titanembeds/templates/administrate_guild.html.j2 rename to webapp/titanembeds/templates/administrate_guild.html.j2 diff --git a/titanembeds/templates/dashboard.html.j2 b/webapp/titanembeds/templates/dashboard.html.j2 similarity index 100% rename from titanembeds/templates/dashboard.html.j2 rename to webapp/titanembeds/templates/dashboard.html.j2 diff --git a/titanembeds/templates/embed.html.j2 b/webapp/titanembeds/templates/embed.html.j2 similarity index 100% rename from titanembeds/templates/embed.html.j2 rename to webapp/titanembeds/templates/embed.html.j2 diff --git a/titanembeds/templates/google_analytics.html.j2 b/webapp/titanembeds/templates/google_analytics.html.j2 similarity index 100% rename from titanembeds/templates/google_analytics.html.j2 rename to webapp/titanembeds/templates/google_analytics.html.j2 diff --git a/titanembeds/templates/index.html.j2 b/webapp/titanembeds/templates/index.html.j2 similarity index 100% rename from titanembeds/templates/index.html.j2 rename to webapp/titanembeds/templates/index.html.j2 diff --git a/titanembeds/templates/signin_complete.html.j2 b/webapp/titanembeds/templates/signin_complete.html.j2 similarity index 100% rename from titanembeds/templates/signin_complete.html.j2 rename to webapp/titanembeds/templates/signin_complete.html.j2 diff --git a/titanembeds/templates/site_layout.html.j2 b/webapp/titanembeds/templates/site_layout.html.j2 similarity index 100% rename from titanembeds/templates/site_layout.html.j2 rename to webapp/titanembeds/templates/site_layout.html.j2 diff --git a/titanembeds/utils.py b/webapp/titanembeds/utils.py similarity index 100% rename from titanembeds/utils.py rename to webapp/titanembeds/utils.py diff --git a/tmp/.gitinclude b/webapp/tmp/.gitinclude similarity index 100% rename from tmp/.gitinclude rename to webapp/tmp/.gitinclude