sneed
This commit is contained in:
parent
1ec21fec49
commit
528a2f17e9
6 changed files with 47 additions and 12 deletions
|
@ -16,7 +16,7 @@ services:
|
||||||
- SITE_NAME=Drama
|
- SITE_NAME=Drama
|
||||||
- CLOUDFLARE_ZONE=vcxvdfgfc6r554etrgd
|
- CLOUDFLARE_ZONE=vcxvdfgfc6r554etrgd
|
||||||
- CLOUDFLARE_KEY=vcxvdfgfc6r554etrgd
|
- CLOUDFLARE_KEY=vcxvdfgfc6r554etrgd
|
||||||
- TENOR_KEY=vcxvdfgfc6r554etrgd
|
- GIPHY_KEY=vcxvdfgfc6r554etrgd
|
||||||
- MAILGUN_KEY=vcxvdfgfc6r554etrgd
|
- MAILGUN_KEY=vcxvdfgfc6r554etrgd
|
||||||
- MAILGUN_DOMAIN=rdrama.net
|
- MAILGUN_DOMAIN=rdrama.net
|
||||||
- FORCE_HTTPS=0
|
- FORCE_HTTPS=0
|
||||||
|
|
|
@ -87,8 +87,6 @@ app.config["CACHE_OPTIONS"]={'connection_pool':redispool} if app.config["CACHE_T
|
||||||
app.config["READ_ONLY"]=bool(int(environ.get("READ_ONLY", "0")))
|
app.config["READ_ONLY"]=bool(int(environ.get("READ_ONLY", "0")))
|
||||||
app.config["BOT_DISABLE"]=bool(int(environ.get("BOT_DISABLE", False)))
|
app.config["BOT_DISABLE"]=bool(int(environ.get("BOT_DISABLE", False)))
|
||||||
|
|
||||||
app.config["TENOR_KEY"]=environ.get("TENOR_KEY",'').strip()
|
|
||||||
|
|
||||||
|
|
||||||
Markdown(app)
|
Markdown(app)
|
||||||
cache = Cache(app)
|
cache = Cache(app)
|
||||||
|
|
22
files/routes/giphy.py
Normal file
22
files/routes/giphy.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
from flask import *
|
||||||
|
from os import environ
|
||||||
|
import requests
|
||||||
|
|
||||||
|
from files.__main__ import app
|
||||||
|
|
||||||
|
GIPHY_KEY = environ.get('GIPHY_KEY').rstrip()
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/giphy", methods=["GET"])
|
||||||
|
@app.route("/giphy<path>", methods=["GET"])
|
||||||
|
def giphy():
|
||||||
|
|
||||||
|
searchTerm = request.args.get("searchTerm", "")
|
||||||
|
limit = int(request.args.get("limit", ""))
|
||||||
|
if searchTerm and limit:
|
||||||
|
url = f"https://api.giphy.com/v1/gifs/search?q={searchTerm}&api_key={GIPHY_KEY}&limit={limit}"
|
||||||
|
elif searchTerm and not limit:
|
||||||
|
url = f"https://api.giphy.com/v1/gifs/search?q={searchTerm}&api_key={GIPHY_KEY}&limit=48"
|
||||||
|
else:
|
||||||
|
url = f"https://api.giphy.com/v1/gifs?api_key={GIPHY_KEY}&limit=48"
|
||||||
|
return jsonify(requests.get(url).json())
|
|
@ -25,11 +25,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
function tenor_api_key() {
|
|
||||||
return "{{'TENOR_KEY' | app_config}}"
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
22
giphy.py
Normal file
22
giphy.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
from flask import *
|
||||||
|
from os import environ
|
||||||
|
import requests
|
||||||
|
|
||||||
|
from files.__main__ import app
|
||||||
|
|
||||||
|
GIPHY_KEY = environ.get('GIPHY_KEY').rstrip()
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/giphy", methods=["GET"])
|
||||||
|
@app.route("/giphy<path>", methods=["GET"])
|
||||||
|
def giphy():
|
||||||
|
|
||||||
|
searchTerm = request.args.get("searchTerm", "")
|
||||||
|
limit = int(request.args.get("limit", ""))
|
||||||
|
if searchTerm and limit:
|
||||||
|
url = f"https://api.giphy.com/v1/gifs/search?q={searchTerm}&api_key={GIPHY_KEY}&limit={limit}"
|
||||||
|
elif searchTerm and not limit:
|
||||||
|
url = f"https://api.giphy.com/v1/gifs/search?q={searchTerm}&api_key={GIPHY_KEY}&limit=48"
|
||||||
|
else:
|
||||||
|
url = f"https://api.giphy.com/v1/gifs?api_key={GIPHY_KEY}&limit=48"
|
||||||
|
return jsonify(requests.get(url).json())
|
|
@ -24,7 +24,7 @@ docker-compose up
|
||||||
|
|
||||||
4- That's it! Visit `localhost` in your browser.
|
4- That's it! Visit `localhost` in your browser.
|
||||||
|
|
||||||
5- Optional: to configure the site settings and successsfully integrate it with the external services we use (hcaptcha, cloudflare, discord, tenor and mailgun), please edit the variables in the docker-compose.yml file.
|
5- Optional: to configure the site settings and successsfully integrate it with the external services we use (hcaptcha, cloudflare, discord, giphy and mailgun), please edit the variables in the docker-compose.yml file.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ source setup
|
||||||
4- That's it. Visit `localhost` in your browser.
|
4- That's it. Visit `localhost` in your browser.
|
||||||
|
|
||||||
|
|
||||||
5- Optional: to configure the site settings and successsfully integrate it with the external services we use (hcaptcha, cloudflare, discord, tenor and mailgun), please run this command and edit the variables:
|
5- Optional: to configure the site settings and successsfully integrate it with the external services we use (hcaptcha, cloudflare, discord, giphy and mailgun), please run this command and edit the variables:
|
||||||
|
|
||||||
```
|
```
|
||||||
nano /drama/docker-compose.yml
|
nano /drama/docker-compose.yml
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue