forked from MarseyWorld/MarseyWorld
switch giphy verbiage to tenor
parent
6e8dca5f09
commit
233d8fc4eb
|
@ -7,7 +7,7 @@ export REDIS_URL='redis://redis:6379'
|
||||||
export PROXY_URL='http://localhost:18080'
|
export PROXY_URL='http://localhost:18080'
|
||||||
export LOG_DIRECTORY='/var/log/rdrama'
|
export LOG_DIRECTORY='/var/log/rdrama'
|
||||||
export SETTINGS_FILENAME='/site_settings.json'
|
export SETTINGS_FILENAME='/site_settings.json'
|
||||||
export GIPHY_KEY='blahblahblah'
|
export TENOR_KEY='blahblahblah'
|
||||||
export TURNSTILE_SITEKEY='blahblahblah'
|
export TURNSTILE_SITEKEY='blahblahblah'
|
||||||
export TURNSTILE_SECRET='blahblahblah'
|
export TURNSTILE_SECRET='blahblahblah'
|
||||||
export YOUTUBE_KEY='blahblahblah'
|
export YOUTUBE_KEY='blahblahblah'
|
||||||
|
|
|
@ -6921,7 +6921,7 @@ div.markdown {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.giphy {
|
.tenor {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: var(--gray-600);
|
background-color: var(--gray-600);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
|
@ -123,19 +123,19 @@ async function searchGifs(searchTerm) {
|
||||||
|
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
|
|
||||||
let response = await fetch("/giphy?searchTerm=" + searchTerm + "&limit=48");
|
let response = await fetch("/tenor?searchTerm=" + searchTerm + "&limit=48");
|
||||||
let data = await response.json()
|
let data = await response.json()
|
||||||
data = data.results
|
data = data.results
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
for (const e of data) {
|
for (const e of data) {
|
||||||
const url = e.media_formats.webp.url
|
const url = e.media_formats.webp.url
|
||||||
const insert = `<img class="giphy" loading="lazy" data-bs-dismiss="modal" src="${url}"></div>`
|
const insert = `<img class="tenor" loading="lazy" data-bs-dismiss="modal" src="${url}"></div>`
|
||||||
container.insertAdjacentHTML('beforeend', insert);
|
container.insertAdjacentHTML('beforeend', insert);
|
||||||
}
|
}
|
||||||
|
|
||||||
const giphy = document.getElementsByClassName('giphy')
|
const tenor = document.getElementsByClassName('tenor')
|
||||||
for (const element of giphy) {
|
for (const element of tenor) {
|
||||||
element.addEventListener('click', () => {insertGif (element.src)});
|
element.addEventListener('click', () => {insertGif (element.src)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ SECRET_KEY = environ.get("SECRET_KEY").strip()
|
||||||
PROXY_URL = environ.get("PROXY_URL").strip()
|
PROXY_URL = environ.get("PROXY_URL").strip()
|
||||||
LOG_DIRECTORY = environ.get("LOG_DIRECTORY")
|
LOG_DIRECTORY = environ.get("LOG_DIRECTORY")
|
||||||
SETTINGS_FILENAME = environ.get("SETTINGS_FILENAME")
|
SETTINGS_FILENAME = environ.get("SETTINGS_FILENAME")
|
||||||
GIPHY_KEY = environ.get("GIPHY_KEY").strip()
|
TENOR_KEY = environ.get("TENOR_KEY").strip()
|
||||||
TURNSTILE_SITEKEY = environ.get("TURNSTILE_SITEKEY").strip()
|
TURNSTILE_SITEKEY = environ.get("TURNSTILE_SITEKEY").strip()
|
||||||
TURNSTILE_SECRET = environ.get("TURNSTILE_SECRET").strip()
|
TURNSTILE_SECRET = environ.get("TURNSTILE_SECRET").strip()
|
||||||
YOUTUBE_KEY = environ.get("YOUTUBE_KEY").strip()
|
YOUTUBE_KEY = environ.get("YOUTUBE_KEY").strip()
|
||||||
|
|
|
@ -36,7 +36,7 @@ from .votes import *
|
||||||
from .feeds import *
|
from .feeds import *
|
||||||
if FEATURES['AWARDS']:
|
if FEATURES['AWARDS']:
|
||||||
from .awards import *
|
from .awards import *
|
||||||
from .giphy import *
|
from .tenor import *
|
||||||
from .holes import *
|
from .holes import *
|
||||||
if FEATURES['GAMBLING']:
|
if FEATURES['GAMBLING']:
|
||||||
from .lottery import *
|
from .lottery import *
|
||||||
|
|
|
@ -5,12 +5,12 @@ from files.routes.wrappers import *
|
||||||
|
|
||||||
from files.__main__ import app
|
from files.__main__ import app
|
||||||
|
|
||||||
@app.get("/giphy")
|
@app.get("/tenor")
|
||||||
@app.get("/giphy<path>")
|
@app.get("/tenor<path>")
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def giphy(v, path=None):
|
def tenor(v, path=None):
|
||||||
|
|
||||||
searchTerm = request.values.get("searchTerm", "").strip()
|
searchTerm = request.values.get("searchTerm", "").strip()
|
||||||
limit = 48
|
limit = 48
|
||||||
|
@ -19,9 +19,9 @@ def giphy(v, path=None):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if searchTerm and limit:
|
if searchTerm and limit:
|
||||||
url = f"https://tenor.googleapis.com/v2/search?media_filter=webp&q={searchTerm}&key={GIPHY_KEY}&limit={limit}"
|
url = f"https://tenor.googleapis.com/v2/search?media_filter=webp&q={searchTerm}&key={TENOR_KEY}&limit={limit}"
|
||||||
elif searchTerm and not limit:
|
elif searchTerm and not limit:
|
||||||
url = f"https://tenor.googleapis.com/v2/search?media_filter=webp&q={searchTerm}&key={GIPHY_KEY}&limit=48"
|
url = f"https://tenor.googleapis.com/v2/search?media_filter=webp&q={searchTerm}&key={TENOR_KEY}&limit=48"
|
||||||
else:
|
else:
|
||||||
url = f"https://tenor.googleapis.com/v2?media_filter=webp&key={GIPHY_KEY}&limit=48"
|
url = f"https://tenor.googleapis.com/v2?media_filter=webp&key={TENOR_KEY}&limit=48"
|
||||||
return requests.get(url, headers=HEADERS, timeout=5).json()
|
return requests.get(url, headers=HEADERS, timeout=5).json()
|
Loading…
Reference in New Issue