forked from rDrama/rDrama
Merge branch 'master' of https://github.com/Aevann1/Drama
commit
60df8ae429
|
@ -1,7 +1,7 @@
|
||||||
import bleach
|
import bleach
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from bleach.linkifier import LinkifyFilter
|
from bleach.linkifier import LinkifyFilter
|
||||||
from urllib.parse import ParseResult, urlunparse
|
from urllib.parse import ParseResult, urlunparse, urlencode, urlparse, parse_qs
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from .get import *
|
from .get import *
|
||||||
from os import path
|
from os import path
|
||||||
|
@ -205,6 +205,13 @@ def sanitize(text, linkgen=False, flair=False):
|
||||||
|
|
||||||
for i in re.finditer('(/comments/.*?)"', sanitized):
|
for i in re.finditer('(/comments/.*?)"', sanitized):
|
||||||
url = i.group(1)
|
url = i.group(1)
|
||||||
if not "sort=" in url: sanitized = sanitized.replace(url, f"{url}?sort=controversial")
|
p = urlparse(url).query
|
||||||
|
p = parse_qs(p)
|
||||||
|
|
||||||
|
if 'sort' not in p:
|
||||||
|
p['sort'] = ['controversial']
|
||||||
|
|
||||||
|
url_noquery = url.split('?')[0]
|
||||||
|
sanitized = sanitized.replace(url, f"{url_noquery}?{urlencode(p, True)}")
|
||||||
|
|
||||||
return sanitized
|
return sanitized
|
|
@ -717,7 +717,6 @@ CREATE TABLE public.domains (
|
||||||
can_submit boolean,
|
can_submit boolean,
|
||||||
can_comment boolean,
|
can_comment boolean,
|
||||||
reason integer,
|
reason integer,
|
||||||
show_thumbnail boolean,
|
|
||||||
embed_function character varying(64),
|
embed_function character varying(64),
|
||||||
embed_template character varying(32) DEFAULT NULL::character varying,
|
embed_template character varying(32) DEFAULT NULL::character varying,
|
||||||
sandbox_embed boolean DEFAULT false
|
sandbox_embed boolean DEFAULT false
|
||||||
|
@ -870,7 +869,7 @@ CREATE TABLE public.modactions (
|
||||||
target_comment_id integer,
|
target_comment_id integer,
|
||||||
created_utc integer DEFAULT 0,
|
created_utc integer DEFAULT 0,
|
||||||
kind character varying(32) DEFAULT NULL::character varying,
|
kind character varying(32) DEFAULT NULL::character varying,
|
||||||
_note character varying(256) DEFAULT NULL::character varying
|
_note character varying(350) DEFAULT NULL::character varying
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue