twitch support
parent
665fac86f2
commit
a5c7d5c054
|
@ -32,6 +32,8 @@ class Orgy(Base):
|
|||
return self.type == OrgyTypes.YOUTUBE
|
||||
def is_rumble(self):
|
||||
return self.type == OrgyTypes.RUMBLE
|
||||
def is_twitch(self):
|
||||
return self.type == OrgyTypes.TWITCH
|
||||
|
||||
def __repr__(self):
|
||||
return f"<{self.__class__.__name__}(id={self.id}, type={self.type}, data={self.data} title={self.title})>"
|
||||
|
@ -52,6 +54,9 @@ def create_orgy(link, title):
|
|||
elif re.match(rumble_regex, normalized_link):
|
||||
orgy_type = OrgyTypes.RUMBLE
|
||||
data = normalized_link
|
||||
elif re.match(twitch_regex, normalized_link):
|
||||
orgy_type = OrgyTypes.TWITCH
|
||||
data = re.search(twitch_regex, normalized_link).group(3)
|
||||
else:
|
||||
assert False
|
||||
|
||||
|
|
|
@ -1268,6 +1268,7 @@ GIRL_NAMES = {
|
|||
class OrgyTypes:
|
||||
YOUTUBE = 1
|
||||
RUMBLE = 2
|
||||
TWITCH = 3
|
||||
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import scoped_session, sessionmaker
|
||||
|
|
|
@ -128,6 +128,7 @@ yt_id_regex = re.compile('[\w\-]{5,20}', flags=re.A)
|
|||
|
||||
rumble_regex = re.compile('https://rumble\.com/embed/([a-zA-Z0-9]*)/\?pub=([a-zA-Z0-9]*)',flags=re.I|re.A)
|
||||
bare_youtube_regex = re.compile('https:\/\/youtube\.com\/watch\?([\w\-.#&/=?@%+]{7,})',flags=re.I|re.A)
|
||||
twitch_regex = re.compile('(https:\/\/)?(www\.)?twitch.tv/(.*)',flags=re.I|re.A)
|
||||
|
||||
link_fix_regex = re.compile("(\[.*?\]\()(?!http|\/)(.*?\))" + NOT_IN_CODE_OR_LINKS, flags=re.A)
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ def chat(v):
|
|||
abort(403, f"Need at least {TRUESCORE_CHAT_MINIMUM} truescore for access to chat!")
|
||||
orgy = get_orgy()
|
||||
if orgy:
|
||||
return render_template("orgy.html", v=v, messages=messages, orgy = orgy)
|
||||
return render_template("orgy.html", v=v, messages=messages, orgy = orgy, site = SITE)
|
||||
else:
|
||||
return render_template("chat.html", v=v, messages=messages)
|
||||
|
||||
|
|
|
@ -18,6 +18,12 @@
|
|||
<lite-youtube videoid="{{orgy.data}}" params="autoplay=1&modestbranding=1"/>
|
||||
{% elif orgy.is_rumble() %}
|
||||
<iframe class="rumble rumble-player" width="100%" src="{{orgy.data}}" frameborder="0" allowfullscreen></iframe>
|
||||
{% elif orgy.is_twitch() %}
|
||||
<iframe
|
||||
src="https://player.twitch.tv/?channel={{orgy.data}}&parent={{site}}"
|
||||
class="rumble-player"
|
||||
allowfullscreen>
|
||||
</iframe>
|
||||
{%endif%}
|
||||
</div>
|
||||
<a href="/old_chat" class="btn btn-primary ml-auto" value="Old Chat">Old Chat</a>
|
||||
|
|
|
@ -2,5 +2,5 @@ add_header Referrer-Policy "same-origin";
|
|||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
|
||||
add_header X-Frame-Options "deny";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
add_header Content-Security-Policy "default-src 'none'; frame-ancestors 'none'; form-action 'self'; manifest-src 'self'; worker-src 'self'; base-uri 'self'; font-src 'self'; style-src-elem 'self'; style-src-attr 'unsafe-inline'; style-src 'self' 'unsafe-inline'; script-src-elem 'self' challenges.cloudflare.com; script-src-attr 'none'; script-src 'self' challenges.cloudflare.com; media-src 'self' https:; img-src 'self' https: data:; frame-src challenges.cloudflare.com www.youtube-nocookie.com platform.twitter.com rumble.com; connect-src 'self' tls-use1.fpapi.io api.fpjs.io;";
|
||||
add_header Content-Security-Policy "default-src 'none'; frame-ancestors 'none'; form-action 'self'; manifest-src 'self'; worker-src 'self'; base-uri 'self'; font-src 'self'; style-src-elem 'self'; style-src-attr 'unsafe-inline'; style-src 'self' 'unsafe-inline'; script-src-elem 'self' challenges.cloudflare.com; script-src-attr 'none'; script-src 'self' challenges.cloudflare.com; media-src 'self' https:; img-src 'self' https: data:; frame-src challenges.cloudflare.com www.youtube-nocookie.com platform.twitter.com rumble.com player.twitch.tv; connect-src 'self' tls-use1.fpapi.io api.fpjs.io;";
|
||||
add_header Cross-Origin-Opener-Policy "same-origin";
|
||||
|
|
Loading…
Reference in New Issue