rr- / szurubooru

Image board engine, Danbooru-style.
GNU General Public License v3.0
664 stars 175 forks source link

Social embeds with oEmbed and Open Graph #643

Open po5 opened 3 months ago

po5 commented 3 months ago

Differences with the approaches in #421, #422 and #441:

Things that can be improved later:

Meant to be used with an nginx config like:

location ~ ^/booru/(post/[0-9]+)(?:/.*)?$ {
    set $query $1;
    proxy_pass http://127.0.0.1:6666/index/$query;
    proxy_set_header Accept "*/*";
}

Discord image Twitter image

Closes #416

ninjazan420 commented 2 months ago

May be a stupid question, but I have never changed something server side wise. So how could I implement it, after changing the files? What I do for client side updates is docker compose down && docker compose build && docker compose up -d, but it doesn't catch the server updates :)

Thanks for your help!

milezzz commented 1 week ago

I merged this branch on a fresh git pull of rr-:master and I get 502 bad gateway errors. See screenshot.

CleanShot 2024-07-08 at 02 07 40@2x

The domain is behind cloudflare, if that matters. Any clue what could be causing this? Pulling my hair out :/

TiredSysOp commented 1 week ago

I merged this branch on a fresh git pull of rr-:master and I get 502 bad gateway errors. See screenshot.

CleanShot 2024-07-08 at 02 07 40@2x

The domain is behind cloudflare, if that matters. Any clue what could be causing this? Pulling my hair out :/

Post logs and check this https://github.com/rr-/szurubooru/wiki/Common-errors

milezzz commented 1 week ago

Well doesn't seem to be a permission issue. When I remove the embed merge and rebuild everything works again. Sorry here's the docker-compose logs output:


server-1  | INFO  [alembic.runtime.migration] Will assume transactional DDL.
server-1  | Starting szurubooru API on port 6666 - Running on 4 threads
server-1  | Traceback (most recent call last):
server-1  |   File "/usr/bin/waitress-serve-3", line 33, in <module>
server-1  |     sys.exit(load_entry_point('waitress==1.4.4', 'console_scripts', 'waitress-serve')())
server-1  |   File "/usr/lib/python3.8/site-packages/waitress/runner.py", line 270, in run
server-1  |     app = resolve(module, obj_name)
server-1  |   File "/usr/lib/python3.8/site-packages/waitress/runner.py", line 211, in resolve
server-1  |     obj = __import__(module_name, fromlist=segments[:1])
server-1  |   File "/opt/app/szurubooru/facade.py", line 11, in <module>
server-1  |     from szurubooru import api, config, db, errors, middleware, rest
server-1  |   File "/opt/app/szurubooru/api/__init__.py", line 2, in <module>
server-1  |     import szurubooru.api.embed_api
server-1  |   File "/opt/app/szurubooru/api/embed_api.py", line 13, in <module>
server-1  |     with open(f"{config.config['data_dir']}/../index.htm") as index:
server-1  | FileNotFoundError: [Errno 2] No such file or directory: '/data//../index.htm'```