Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/MiranDaniel/f1rewall
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranDaniel committed Nov 18, 2021
2 parents 49c674d + aeb6d19 commit eb80326
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*venv*
*pycache*
*pycache*
*VS*
35 changes: 32 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"""
Copyright 2021 MiranDaniel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""

Expand All @@ -19,6 +16,38 @@
print(exc)
quit(1)

if "dark_theme" not in config:
print("!! Theme not defined")
if "recaptcha" in config:
if "public" not in config["recaptcha"]:
print("!! Recaptcha public key is not defined, exiting")
quit(1)
if "private" not in config["recaptcha"]:
print("!! Recaptcha private key is not defined, exiting")
quit(1)
else:
print("!! Recaptcha config doesnt exist, exiting")
quit(1)

if "discord" in config:
if "welcome_room" not in config["discord"]:
print("!! Discord welcome room not defined, exiting")
quit(1)
if "private" not in config["discord"]:
print("!! Discord private key is not defined, exiting")
quit(1)
else:
print("!! Discord config doesnt exist, exiting")
quit(1)

if "server" in config:
if "port" not in config["server"]:
print("!! Server port not defined, exiting")
quit(1)
else:
print("!! Sever config not defined, exiting")
quit(1)

def recaptcha(token):
recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify'
payload = {
Expand Down
4 changes: 4 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# anyone with your Discord private key can controll your bot!
#


# false for light theme
# true for dark theme
dark_theme: false
Expand All @@ -13,13 +14,16 @@ recaptcha:
public:

# DO NOT LEAK THIS
# put your private recapthca key here!
private:

discord:
# users will be invited to this room, it should be public
# put your welcome room ID here
welcome_room:

# DO NOT LEAK THIS
# put your Discord bot token here
private:

server:
Expand Down
14 changes: 14 additions & 0 deletions docs/cloudflare_tunnel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# How to set up the Cloudflare tunnel to host your gateway

**Warning: this method requires you to change your domain namesevers to Cloudflare**

Cloudflare tunnel is an easy way to host your gateway on a subdomain (ex. chat.<>.<>)

## Cloudflare docs

1. https://support.cloudflare.com/hc/en-us/articles/201720164-Creating-a-Cloudflare-account-and-adding-a-website
2. https://support.cloudflare.com/hc/en-us/articles/205195708
3. https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide

## Notes
When setting up your tunnel, it's application localhost post has to match your preconfigured port in config.yaml!
20 changes: 20 additions & 0 deletions docs/customising.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# How to customise your gateway

This gateway is fully customisables.

## Logo customisation

To change the app logo, head to `static/wordmark.png` and replace it with yours.

## Background customisation

To change the background, head to `static/background.png` and replace it with the background you want.
You can also apply gradients in the `templates/index.html` file.

## Theme customisation

To customise the theme, change the `dark_theme` value in your `config.yaml` file.

## Website design customisation

To customise the rest of the website, simply edit the `templates/index.html` file to fit your needs.
31 changes: 24 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# f1rewall
*The sleek, simple and scalable invite gateway for your Discord community*

---


Light theme default | Dark theme default
:-------------------------:|:-------------------------:
<img src="https://media.discordapp.net/attachments/795438999761977394/910258446681657374/unknown.png" height="200"/> | <img src="https://cdn.discordapp.com/attachments/795438999761977394/910258701204602920/unknown.png" height="200"/>

*All websites elements can be customised easily*

---

## Setup guide:

Expand Down Expand Up @@ -54,11 +66,13 @@ Congrats! Your recaptcha is now ready!
2. Run `sh run.sh` to start the server
3. The script will now host your gateway on the port specified in config.yaml

### 5. Firewall configuration
## Network configuration

### 1. Firewall configuration

1. Configure your firewall and open the port specified in config.yaml

### 6. DNS configuration
### 2a. DNS configuration

Remember to set a static IP and host on port 80.
If you want to stop the Apache server from running on port 80, use `sudo systemctl stop apache2`
Expand All @@ -67,26 +81,29 @@ Follow this guide to redirect your chat.<>.<> domain to your chat gateway. https

You can also use the CloudFlare Argo Tunnel.

### 6. Additional configuration
### 2b. CloudFlare tunnel configuration

Read the documentation file in `docs/clouflare_tunnel.md`

## Discord configuration

1. Make sure the gateway works
2. Disallow users on your server from making new invites, let only the bot create them
3. Put your logo in static/wordmark.png
4. Put the website background in static/background.png
5. Set the `dark_theme` value in config.yaml to set the website text color

## Modifications

The website look can be changed in the templates/index.html file
## Customisation

Read the documentation file in `docs/customisation.md`

## Support

This project is provided for free. Free as in freedom, not beer.

If you're having issues with the app please open an issue or discussion thread.

I'll try my best to help you.
Private support can be provided. Find the contact information on https://mirandaniel.com/

## Donations

Expand Down
7 changes: 6 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<html lang="en">

<!--
Copyright 2021 MiranDaniel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down

0 comments on commit eb80326

Please sign in to comment.