Skip to content

online cooperative jigsaw puzzles

pommicket/jigsaw

Repository files navigation

jigsaw

online cooperative jigsaw puzzles

https://s.pommicket.com/jigsaw/index.html

about

this is the source code for a website where you can complete jigsaw puzzles with your friends. it includes the ability to choose a random picture from the wikimedia commons, or to use the picture of the day.

running locally

you can run this website locally by installing rust, then running

cargo run --release

in the server directory. you will now be able to access the website via file:///.../jigsaw/index.html

contributing

please contribute ! you can also report bugs you find or improvmenets you want to the github issues page.

hosting your own instance

this website consists of a backend written in rust, and a frontend which is just static files.

to host it, first create a jigsaw user (useradd jigsaw), and install postgresql. then run sudo -u postgres psql, and enter

CREATE USER jigsaw;
GRANT ALL PRIVILEGES ON DATABASE jigsaw TO jigsaw;
GRANT CREATE ON SCHEMA public TO jigsaw;
\q

copy over the server directory to your server and run cargo build --release there. install python3, and run getfeaturedpictures.py to get the list of featured pictures (this will take a while). now you can run the target/release/jigsaw-server executable to start the backend, or create a systemd service to run it for you, e.g. as in the jigsaw-server.service file.

now for the front-end, first change the WEBSOCKET_URL_REMOTE constant in game.js to a subdomain of your domain. run a proxy on your server to forward websocket traffic from that subdomain to port 54472 (this port can be configured in server/src/main.rs). with apache2 this can be done as follows:

<VirtualHost *:443>
    ServerName <your subdomain>
    ProxyPass "/" "ws://localhost:54472/"
    ProxyPassReverse "/" "ws://localhost:54472/"
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/<your domain>/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/<your domain>/privkey.pem
</VirtualHost>

and that's it! you can update the files with the upload.sh script, modifying the RCLONE_DEST variable to point to where your static files are stored, and REMOTE to point to the jigsaw user of your server. to use this script you will also need to add the following to your sudoers file:

jigsaw ALL= NOPASSWD: /bin/systemctl start jigsaw-server.service
jigsaw ALL= NOPASSWD: /bin/systemctl stop jigsaw-server.service
jigsaw ALL= NOPASSWD: /bin/systemctl restart jigsaw-server.service

to allow the jigsaw user to manage the jigsaw-server service.

license

WTFPL

About

online cooperative jigsaw puzzles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published