Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost
|
@ -187,6 +187,7 @@
|
|||
{"name":"marseyflagnorway","class":"Marsey Flags"},
|
||||
{"name":"marseyflagpakistan","class":"Marsey Flags"},
|
||||
{"name":"marseyflagpalestine","class":"Marsey Flags"},
|
||||
{"name":"marseyflagperu","class":"Marsey Flags"},
|
||||
{"name":"marseyflagphillipines","class":"Marsey Flags"},
|
||||
{"name":"marseyflagpoland","class":"Marsey Flags"},
|
||||
{"name":"marseyflagportugal","class":"Marsey Flags"},
|
||||
|
|
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 3.9 KiB |
|
@ -4,6 +4,7 @@ from urllib.parse import urlencode, urlparse, parse_qs
|
|||
from flask import *
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.dialects.postgresql import TSVECTOR
|
||||
from files.__main__ import Base
|
||||
from files.classes.votes import CommentVote
|
||||
from files.helpers.const import *
|
||||
|
@ -59,6 +60,7 @@ class Comment(Base):
|
|||
realupvotes = Column(Integer, default=1)
|
||||
body = Column(String)
|
||||
body_html = Column(String)
|
||||
body_ts = Column(TSVECTOR(), server_default=FetchedValue())
|
||||
ban_reason = Column(String)
|
||||
wordle_result = Column(String)
|
||||
treasure_amount = Column(String)
|
||||
|
|
|
@ -14,11 +14,10 @@ valid_params = [
|
|||
'author',
|
||||
'domain',
|
||||
'over18',
|
||||
"post",
|
||||
"before",
|
||||
"after",
|
||||
"title",
|
||||
"exact",
|
||||
'post',
|
||||
'before',
|
||||
'after',
|
||||
'title',
|
||||
search_operator_hole,
|
||||
]
|
||||
|
||||
|
@ -90,14 +89,7 @@ def searchposts(v):
|
|||
)
|
||||
else: posts = posts.filter(Submission.author_id == author.id)
|
||||
|
||||
if 'exact' in criteria and 'full_text' in criteria:
|
||||
regex_str = '[[:<:]]'+criteria['full_text']+'[[:>:]]' # https://docs.oracle.com/cd/E17952_01/mysql-5.5-en/regexp.html "word boundaries"
|
||||
if 'title' in criteria:
|
||||
words = [Submission.title.regexp_match(regex_str)]
|
||||
else:
|
||||
words = [or_(Submission.title.regexp_match(regex_str), Submission.body.regexp_match(regex_str))]
|
||||
posts = posts.filter(*words)
|
||||
elif 'q' in criteria:
|
||||
if 'q' in criteria:
|
||||
if('title' in criteria):
|
||||
words = [or_(Submission.title.ilike('%'+x+'%')) \
|
||||
for x in criteria['q']]
|
||||
|
@ -183,9 +175,6 @@ def searchposts(v):
|
|||
@app.get("/search/comments")
|
||||
@auth_required
|
||||
def searchcomments(v):
|
||||
|
||||
return {"error": "Searching comments is disabled temporarily."}, 403
|
||||
|
||||
query = request.values.get("q", '').strip()
|
||||
|
||||
try: page = max(1, int(request.values.get("page", 1)))
|
||||
|
@ -217,14 +206,10 @@ def searchcomments(v):
|
|||
|
||||
else: comments = comments.filter(Comment.author_id == author.id)
|
||||
|
||||
if 'exact' in criteria and 'full_text' in criteria:
|
||||
regex_str = '[[:<:]]'+criteria['full_text']+'[[:>:]]' # https://docs.oracle.com/cd/E17952_01/mysql-5.5-en/regexp.html "word boundaries"
|
||||
words = [Comment.body.regexp_match(regex_str)]
|
||||
comments = comments.filter(*words)
|
||||
elif 'q' in criteria:
|
||||
words = [or_(Comment.body.ilike('%'+x+'%')) \
|
||||
for x in criteria['q']]
|
||||
comments = comments.filter(*words)
|
||||
if 'q' in criteria:
|
||||
comments = comments.filter(Comment.body_ts.match(
|
||||
' & '.join(criteria['q']),
|
||||
postgresql_regconfig='english'))
|
||||
|
||||
if 'over18' in criteria: comments = comments.filter(Comment.over_18 == True)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ from files.helpers.alerts import *
|
|||
from files.helpers.const import *
|
||||
from files.helpers.actions import *
|
||||
from files.classes.award import AWARDS
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy import func, nullslast
|
||||
import os
|
||||
from files.classes.mod_logs import ACTIONTYPES, ACTIONTYPES2
|
||||
from files.classes.badges import BadgeDef
|
||||
|
@ -25,8 +25,12 @@ def marseys(v):
|
|||
if SITE == 'rdrama.net':
|
||||
marseys = g.db.query(Marsey, User).join(User, Marsey.author_id == User.id).filter(Marsey.submitter_id==None)
|
||||
sort = request.values.get("sort", "usage")
|
||||
if sort == "usage": marseys = marseys.order_by(Marsey.count.desc(), User.username).all()
|
||||
else: marseys = marseys.order_by(User.username, Marsey.count.desc()).all()
|
||||
if sort == "usage":
|
||||
marseys = marseys.order_by(Marsey.count.desc(), User.username).all()
|
||||
elif sort == "added":
|
||||
marseys = marseys.order_by(nullslast(Marsey.created_utc.desc()), User.username).all()
|
||||
else: # implied sort == "author"
|
||||
marseys = marseys.order_by(User.username, Marsey.count.desc()).all()
|
||||
|
||||
original = os.listdir("/asset_submissions/marseys/original")
|
||||
for marsey, user in marseys:
|
||||
|
@ -150,6 +154,7 @@ def log(v):
|
|||
if admin_id:
|
||||
actions = actions.filter_by(user_id=admin_id)
|
||||
kinds = set([x.kind for x in actions])
|
||||
kinds.add(kind)
|
||||
types2 = {}
|
||||
for k,val in types.items():
|
||||
if k in kinds: types2[k] = val
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<th>Usage</th>
|
||||
{% if SITE == 'rdrama.net' %}
|
||||
<th><a href="?sort=author">Author</a></th>
|
||||
<th><a href="?sort=added">Added</a></th>
|
||||
<th>Original File</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
|
@ -26,6 +27,7 @@
|
|||
<td><img class="marsey" loading="lazy" data-bs-toggle="tooltip" alt=":#{{marsey.name}}:" title=":{{marsey.name}}:" src="/e/{{marsey.name}}.webp"></td>
|
||||
<td>{{marsey.count}}</td>
|
||||
<td>{% include "user_in_table.html" %}</td>
|
||||
<td {% if marsey.created_utc != None %}data-time="{{marsey.created_utc}}"{% endif %}></td>
|
||||
<td>
|
||||
{% if marsey.og %}
|
||||
<a href="/asset_submissions/marseys/original/{{marsey.og}}">{{marsey.og}}</a>
|
||||
|
|
|
@ -76,10 +76,6 @@
|
|||
<button onClick="addParam()" class="searchparam mb-1">title:true</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div>
|
||||
<div style="display: inline-block; width: 150px; text-align: center;">Exact Match Only:</div>
|
||||
<button onClick="addParam()" class="searchparam mb-1">exact:true</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
|
10
schema.sql
|
@ -391,7 +391,8 @@ CREATE TABLE public.comments (
|
|||
slots_result character varying(36),
|
||||
blackjack_result character varying(860),
|
||||
treasure_amount character varying(10),
|
||||
wordle_result character varying(115)
|
||||
wordle_result character varying(115),
|
||||
body_ts tsvector GENERATED ALWAYS AS (to_tsvector('english'::regconfig, (body)::text)) STORED
|
||||
);
|
||||
|
||||
|
||||
|
@ -1620,6 +1621,13 @@ CREATE INDEX comment_parent_index ON public.comments USING btree (parent_comment
|
|||
CREATE INDEX comment_post_id_index ON public.comments USING btree (parent_submission);
|
||||
|
||||
|
||||
--
|
||||
-- Name: comments_body_ts_idx; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX comments_body_ts_idx ON public.comments USING gin (body_ts);
|
||||
|
||||
|
||||
--
|
||||
-- Name: comments_user_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
|
26
seed-db.sql
|
@ -249,10 +249,16 @@ INSERT INTO public.hat_defs VALUES (755, 'Ski-mask EYES', 'When 2 eyes isn''t en
|
|||
INSERT INTO public.hat_defs VALUES (757, 'Beanie baby tag', 'Now you''re a plush, into the jar with you-parx5', 2, 500, NULL, 1664602656);
|
||||
INSERT INTO public.hat_defs VALUES (758, 'Target', 'Bullseye!', 2, 500, NULL, 1664604233);
|
||||
INSERT INTO public.hat_defs VALUES (760, 'Foxy Grandpa', 'Goddamn you are one foxy grandpa-SalaciousWombat', 2, 500, NULL, 1664633035);
|
||||
|
||||
|
||||
|
||||
|
||||
INSERT INTO public.hat_defs VALUES (764, 'Generic Religious Figurehead', 'Good morning', 2, 500, NULL, 1664640654);
|
||||
INSERT INTO public.hat_defs VALUES (762, 'Cthulhu Mask', 'I would kiss that cutie.', 2, 500, NULL, 1664638109);
|
||||
INSERT INTO public.hat_defs VALUES (763, 'Top Hat (pentagram)', 'mages vs matriarchy headgear', 2, 500, NULL, 1664638170);
|
||||
INSERT INTO public.hat_defs VALUES (770, 'Shroom head', 'You really went so long without a shower mushrooms grew?', 2, 500, NULL, 1664658333);
|
||||
INSERT INTO public.hat_defs VALUES (771, 'Escoffion', 'Look dark... AND STYLISH!', 2, 500, NULL, 1664658375);
|
||||
INSERT INTO public.hat_defs VALUES (772, 'Attifet', 'You''re a European woman in the 1600s??', 2, 500, NULL, 1664658421);
|
||||
INSERT INTO public.hat_defs VALUES (774, 'French Fries', 'Now your salty and tasty!', 2, 500, NULL, 1664658675);
|
||||
INSERT INTO public.hat_defs VALUES (775, 'Condiment Top', 'Now you can squirt out tasty condiments!', 2, 500, NULL, 1664658867);
|
||||
INSERT INTO public.hat_defs VALUES (767, 'bleh', 'froggy go “bleh”', 2, 500, NULL, 1664646019);
|
||||
INSERT INTO public.hat_defs VALUES (768, 'PLAYER 1', 'you only have 2 lives left oop', 2, 500, NULL, 1664646508);
|
||||
|
||||
INSERT INTO public.hat_defs VALUES (723, 'Hohol', 'Мій предок :)', 2, 500, NULL, 1663892328);
|
||||
INSERT INTO public.hat_defs VALUES (750, 'Cave Man', 'UNGA BUNGA UNGA BUNGA OOO OOO', 2, 500, NULL, 1664595865);
|
||||
|
@ -263,6 +269,7 @@ INSERT INTO public.hat_defs VALUES (715, 'Inspector Gadget', '"Go go Gadget Brow
|
|||
INSERT INTO public.hat_defs VALUES (724, 'Spartan Helmet', 'THIS IS SPARTA!', 2, 500, NULL, 1663892367);
|
||||
INSERT INTO public.hat_defs VALUES (751, 'Butter', 'Southern-fried and full of love.', 2, 500, NULL, 1664595886);
|
||||
INSERT INTO public.hat_defs VALUES (754, 'Crusader helmet', 'RETAKE THE HOLY LAND!', 2, 500, NULL, 1664595954);
|
||||
INSERT INTO public.hat_defs VALUES (766, 'book', 'i can read! heheh', 2, 500, NULL, 1664645746);
|
||||
INSERT INTO public.hat_defs VALUES (676, 'Kepi', 'Army cap for those unlucky enough to be French', 2, 500, NULL, 1663303083);
|
||||
INSERT INTO public.hat_defs VALUES (678, 'Turkroach', 'Come on Carp this one''s hilarious. It''s semi transparent to clarify', 2, 500, NULL, 1663305640);
|
||||
INSERT INTO public.hat_defs VALUES (679, 'Judge Dredd', 'THIS USER IS THE LAW', 2, 500, NULL, 1663309533);
|
||||
|
@ -908,7 +915,7 @@ INSERT INTO public.hat_defs VALUES (504, 'Iron Crown of Lombardy', 'This isn''t
|
|||
-- Name: hat_defs_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
SELECT pg_catalog.setval('public.hat_defs_id_seq', 765, true);
|
||||
SELECT pg_catalog.setval('public.hat_defs_id_seq', 777, true);
|
||||
|
||||
|
||||
--
|
||||
|
@ -1245,6 +1252,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES
|
|||
('marseychad',2,'canthal tilt jaw hunter eyes',NULL),
|
||||
('marseychadthundercock',2,'vvc virgin foid pimp hot player big dick huge cock ouch gigachad meme',NULL),
|
||||
('marseychadyes',2,'based gigachad',NULL),
|
||||
('marseycharlesiii',2,'king england britain royalty royal monarch',1664652665),
|
||||
('marseycharlesmanson',2,'charlie manson charliemanson murderer killer swastika crazy psycho schizo helterskelter prison cult',NULL),
|
||||
('marseychartbar',2,'stats statistics chart graph plot data bar column',NULL),
|
||||
('marseychartgaussian',2,'stats statistics chart graph plot data gaussian normal bell distribution',NULL),
|
||||
|
@ -1539,7 +1547,6 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES
|
|||
('marseyfingergoodjob',2,'cute encourage positive respect k-pop thumbs up congrats gif animated congratulations nice ok great',NULL),
|
||||
('marseyfingerhearts',2,'cute love k-pop',NULL),
|
||||
('marseyfingerwords',2,'cute long tldr didnt read',NULL),
|
||||
('marseyflagperu',2,'peru soccer south america latinx flag',1664491371),
|
||||
('marseyflakes',2,'parsley seasoning salt pepper spice food seasoning',NULL),
|
||||
('marseyflamethrower',2,'vietname soldier fire',NULL),
|
||||
('marseyflamewar',2,'troll fight fire reaction gasoline',NULL),
|
||||
|
@ -1573,6 +1580,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES
|
|||
('marseyfugg',2,'spurdo sparde fugg',NULL),
|
||||
('marseyfugg2',2,'spurdo sparde',NULL),
|
||||
('marseyfunko',2,'action figure doll funko toy soy',NULL),
|
||||
('marseyfuntriptime',2,'lsd drugs joy happy gay schizo',1664656681),
|
||||
('marseyfuriosa',2,'mad max madmax imperator furryosa fury road furyroad post apocalyptic apocalypse australian australia',NULL),
|
||||
('marseyfurry',2,'fursona furry fursuit kitsune',NULL),
|
||||
('marseyfurry2',2,'furry fur degenerate sex',NULL),
|
||||
|
@ -1625,6 +1633,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES
|
|||
('marseygoose2',2,'goose geese kill cat bird death bite chomp',NULL),
|
||||
('marseygossip',2,'tea rotary phone popcorn gabbing',NULL),
|
||||
('marseygrad',2,'graduate graduation school degree diploma hat tassel animated college university',NULL),
|
||||
('marseygrapes',2,'fat roman emperor fruit chubby snacking healthy',1664677557),
|
||||
('marseygras',2,'mardi gras fat tuesday nola new orleans neworleans holiday louisiana mardigras carnival beads mask',NULL),
|
||||
('marseygrass',2,'reaction outside touchgrass touch grass',NULL),
|
||||
('marseygrilling',2,'barbecue bbq centrist boomer barbeque',NULL),
|
||||
|
@ -1723,6 +1732,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES
|
|||
('marseyjamming',2,'mp3 headphones beat ipod music happy',NULL),
|
||||
('marseyjanny',2,'jannie unpaid volunteer administrator janitor free moderator',NULL),
|
||||
('marseyjanny2',2,'jannie unpaid volunteer administrator janitor free moderator',NULL),
|
||||
('marseyjannymini',2,'janny minigun gun clean gatling jannie animated',1664657815),
|
||||
('marseyjapanese',2,'nippon rising sun weeb japan animated',NULL),
|
||||
('marseyjason',2,'hockey mask horror halloween kill fridaythe13th knife stab voorheys friday the 13th evil monster holiday',NULL),
|
||||
('marseyjavelin',2,'ukraine russia missile rocket rpg grenade launcher kyiv kiev kiyv zelensky putin tank',NULL),
|
||||
|
@ -1997,6 +2007,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES
|
|||
('marseyoldguard',2,'napoleon war soldier musket french france history europe reaction',NULL),
|
||||
('marseyoldtimey',2,'cartoon disney vintage olde classic retro',NULL),
|
||||
('marseyonacid',2,'tripping trippy drugs lcd animated',NULL),
|
||||
('marseyoperaphantom',2,'phantom opera music incel mask',1664677165),
|
||||
('marseyopossum',2,'possum trash',NULL),
|
||||
('marseyoppenheimer',2,'scientist nuke bomb ww2 atomic nuclear mushroom cloud',NULL),
|
||||
('marseyorca',2,'orca whale idate smoke smoking anime weeks sal',NULL),
|
||||
|
@ -2127,6 +2138,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES
|
|||
('marseypunished2',2,'punished venom snake metal gear solid kojima eyepatch drama',NULL),
|
||||
('marseypunisher',2,'thin blue line rightoid police cops',NULL),
|
||||
('marseypuppy',2,'dog dalle2 puppy',NULL),
|
||||
('marseypureevil',2,'satan evil demon pointy horns',1664656928),
|
||||
('marseypusheen',2,'grey gray',NULL),
|
||||
('marseypussyhat',2,'feminist feminism activism activist protester protesting foid gussy woman birthing person roasty roastie thot slut whore',NULL),
|
||||
('marseyputin',2,'vladimir russian kgb moscow ukraine dictator leader',NULL),
|
||||
|
@ -2197,6 +2209,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES
|
|||
('marseyrussel',2,'old pipe history',NULL),
|
||||
('marseyrussiadolls',2,'toys ussr babushka matryoshka soviet',NULL),
|
||||
('marseyrussiaglow',2,'animated russia red putin fsb kgb glow trump commie communist hat comrade',NULL),
|
||||
('marseyrussian',2,'russian putin russia vodka adidas tracksuit vatnik ai alcohol beer drunk moscow',1664643821),
|
||||
('marseyrustyventure',2,'dramamine venture bros brothers adult swim cartoon character glasses goattee goatee beard',NULL),
|
||||
('marseysad',2,'concerned worried waiting prepared reaction',NULL),
|
||||
('marseysad2',2,'reaction disappointed disappointment upset',NULL),
|
||||
|
@ -2525,6 +2538,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES
|
|||
('marseyupmarsey',2,'upvote vote upmarsey arrow reddit up animated',NULL),
|
||||
('marseyupset',2,'marsey upset tears',1663697961),
|
||||
('marseyupvote',2,'updoot upmarsey agree yes good based true',1664181430),
|
||||
('marseyupvote2',2,'upvote reddit narwhal orangered updoot',1664658174),
|
||||
('marseyusa',2,'burger patriot america freedom liberty justice love independence freedom guns trump biden state flag',NULL),
|
||||
('marseyuwuw',2,'fursona furry fursuit',NULL),
|
||||
('marseyvampire',2,'undead sanguine horror spooky halloween fangs holiday monster',NULL),
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE public.comments ADD COLUMN body_ts tsvector
|
||||
GENERATED ALWAYS AS (to_tsvector('english', body)) STORED;
|
||||
CREATE INDEX comments_body_ts_idx ON public.comments USING GIN (body_ts);
|
|
@ -12,8 +12,10 @@ cp ./env /env
|
|||
sed -i 's/^/export /g;s/=/="/g;s/$/"/g' /env
|
||||
. /env
|
||||
|
||||
cp ./startup.sh /s
|
||||
cp ./startup_chat.sh /s2
|
||||
mkdir /scripts
|
||||
cp ./startup.sh /scripts/s
|
||||
cp ./startup_chat.sh /scripts/s2
|
||||
chmod +x /scripts/*
|
||||
|
||||
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||
|
@ -79,4 +81,4 @@ echo "psql -U postgres" > /p
|
|||
echo "tmux -S /tmp/s a -t 0" > /c
|
||||
echo "tmux -S /tmp/s a -t 1" > /c2
|
||||
echo "cd /rDrama && git pull" > /g
|
||||
echo '{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": true, "login_required": false}' > /site_settings.json
|
||||
echo '{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": true, "login_required": false}' > /site_settings.json
|
||||
|
|