fix thumbnails and add opera-proxy to docker

master
Aevann1 2022-10-06 21:07:45 +02:00
parent 73e1819199
commit 3cf838af29
6 changed files with 15 additions and 1378 deletions

View File

@ -11,6 +11,7 @@ services:
environment:
- DATABASE_URL=postgresql://postgres@postgres:5432
- REDIS_URL=redis://redis
- OPERA_URL=http://opera-proxy:18080
links:
- "redis"
- "postgres"
@ -37,3 +38,9 @@ services:
- POSTGRES_HOST_AUTH_METHOD=trust
ports:
- "5432:5432"
opera-proxy:
container_name: "opera-proxy"
image: yarmak/opera-proxy
ports:
- "18080:18080"

View File

@ -957,7 +957,8 @@ YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
ADMIGGERS = {SIDEBAR_THREAD, BANNER_THREAD, BADGE_THREAD, SNAPPY_THREAD}
proxies = {"http":"http://127.0.0.1:18080","https":"http://127.0.0.1:18080"}
OPERA_URL = environ.get("OPERA_URL", "http://localhost:18080")
proxies = {"http":OPERA_URL,"https":OPERA_URL}
blackjack = environ.get("BLACKJACK", "").strip()

View File

@ -112,7 +112,7 @@ def process_video(file):
def process_image(filename=None, resize=0, trim=False, uploader=None, patron=False):
def process_image(filename=None, resize=0, trim=False, uploader=None, patron=False, db=None):
size = os.stat(filename).st_size
if size > 16 * 1024 * 1024 or not patron and size > 8 * 1024 * 1024:
@ -180,6 +180,7 @@ def process_image(filename=None, resize=0, trim=False, uploader=None, patron=Fal
user_id=uploader or g.v.id,
size=os.stat(filename).st_size
)
g.db.add(media)
db = db or g.db
db.add(media)
return filename

View File

@ -598,7 +598,7 @@ def thumbnail_thread(pid):
for chunk in image_req.iter_content(1024):
file.write(chunk)
post.thumburl = process_image(name, resize=100, uploader=post.author_id)
post.thumburl = process_image(name, resize=100, uploader=post.author_id, db=db)
db.add(post)
db.commit()
db.close()

View File

@ -14,10 +14,10 @@ server {
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:5001/socket.io;
proxy_pass http://localhost:5001/socket.io;
}
location /chat {
proxy_pass http://127.0.0.1:5001/chat;
proxy_pass http://localhost:5001/chat;
}
location /images/ {

1372
redis.conf

File diff suppressed because it is too large Load Diff