Repository for a website that shows random photos of birds of prey from Wikimedia. https://birds.bateleur.org
Go to file
Hexaitos 85d7b89097 Remove unnecessary CSS 2024-11-13 16:27:23 +01:00
public Remove unnecessary CSS 2024-11-13 16:27:23 +01:00
views Clean up code, add license, add README 2024-11-13 14:27:23 +01:00
.ruby-version first commit 2024-11-10 14:12:42 +01:00
COPYING.md Clean up code, add license, add README 2024-11-13 14:27:23 +01:00
Gemfile Clean up code, add license, add README 2024-11-13 14:27:23 +01:00
Gemfile.lock Add bundler 2024-11-11 23:31:18 +01:00
README.md add systemd service template 2024-11-13 14:36:20 +01:00
categories.txt Better API call, add more categories 2024-11-12 00:06:10 +01:00
get_images_by_category.rb Clean up code, add license, add README 2024-11-13 14:27:23 +01:00
get_random_image.rb Clean up code, add license, add README 2024-11-13 14:27:23 +01:00
predator_pics.service add systemd service template 2024-11-13 14:36:20 +01:00
server.rb Clean up code, add license, add README 2024-11-13 14:27:23 +01:00

README.md

Predator Pics (birds.bateleur.org)

Predator Pics is a website that uses the API of Wikimedia Common to display a random image of a bird of prey. There is a Mastodon / Fediverse bot called “Bot of Prey” that uses the API of this website as its backend.

How it works

  1. The program choses a random category from the categories.txt file located in this repository
  2. It then sends an API request to receive a list of all (<= 500) photos located within that category on Wikimedia Commons
  3. It then chooses one of the photos it received at random, saves important metadata (like author, license and description) and displays it on the webpage

How to run and install it

If you wish to run your own instance of Predator Pics, you must have Ruby installed (tested on Ruby 3.2.2); youll also need the bundler gem that you can install by running gem install bundler after having installed Ruby. It is generally recommended to not install Ruby through your distributions package manager rather, install Ruby through a Ruby version manager like rbenv (https://rbenv.org).

Then clone this repository and install the required gems by running bundle install from your terminal within the cloned repository. Afterwards, start the server by running ruby server.rb. The server (usually thin) will then start in production mode and serve the website on localhost:4567.

Reverse proxy

If you wish to make Predator Pics accessible via the Internet, youll want to use a reverse proxy. My preferred method of doing that is by using Caddy. First, install Caddy and then remove everything located in the /etc/caddy/Caddyfile file and paste the following into it, replacing example.com with your actual domain name:

example.com {
        encode zstd gzip

        reverse_proxy :4567
}

Autostart

You can use the predator_pics.service template and adjust it to your own needs and setup. Afterwards, move it to /etc/systemd/system and enable and start it with (sudo) systemctl enable --now predator_pics.