#!/bin/sh # wr - Minimal webring utility # Licensed under the MIT License. # This script should not be sourced, make sure to change the string 'wr' # in the following line to match this file's name [ 'wr' = "$( basename ${0} )" ] || return 1 # Edit DOMAIN and AUTHOR for your instance # Make sure that DOMAIN is ONLY the domain of your instance, and without trailing slash DOMAIN="webring.gumx.cc" AUTHOR="Ahmed (~gumxcc)" # Script metadata SCRIPT=$( basename "$0" ) VMAJOR=0 VMINOR=1 VPATCH=0 HOMEPAGE="https://webring.gumx.cc/" print_help () { cat << HELP_TEXT ${SCRIPT} v${VMAJOR}.${VMINOR}.${VPATCH} Minimal webring utility Usage: ${SCRIPT} add SITE_URL SITE_TITLE [AUTHOR_NAME] Add a new entry to the webring ${SCRIPT} [build] Build the webring ${SCRIPT} -h | --help | help Display this help message and exit ${SCRIPT} -v | --version | version Display the script version and exit Project homepage: <${HOMEPAGE}> HELP_TEXT } print_version () { VERSION="${VMAJOR}.${VMINOR}.${VPATCH}" printf '%s Version %s\n' "${SCRIPT}" "${VERSION}" } print_error () { ERROR_MSG=${1:-Unknown error} printf '%s: %s\n' "${SCRIPT}" "${ERROR_MSG}" >&2 } build_webring() { mkdir -p public printf '' > public/index.html cat << INDEX_PAGE_TOP > public/index.html webring

webring

An attempt to replicate Devine Lu Linvega's webring in a very minimal way, and with a lower technical bar.

members

join

  1. Clone the repository
  2. Add your site: ./wr add example.com "my site" "Your Name"
  3. Submit a patch via GitHub pull request, GitLab merge request, or git send-email
  4. Add prev/next links to your site footer: <a href="https://${DOMAIN}/example.com/previous">&larr; previous</a> / <a href="https://${DOMAIN}/example.com/next">next &rarr;</a>

host your own

  1. Clone the repository
  2. Clear existing entries: rm -fr entries/* public
  3. Add your webring as an entry: ./wr add yourdomain.com "my webring" "Your Name"
  4. Add member entries and run ./wr to build
  5. Deploy the public/ directory to any static host
INDEX_PAGE_BOTTOM } add_entry() { entry="$( basename ${1} )" entry_file="entries/${entry}" mkdir -p $( dirname ${entry_file} ) printf 'url="%s"\ntitle="%s"' "${1}" "${2}" > "${entry_file}" [ -n "${3}" ] && printf '\nauthor="%s"' "${3}" >> "${entry_file}" cat << ENTRY_LINKS Add the following links in your website, preferrably in the footer:

← previousnext →

You can style them as you please of course ENTRY_LINKS } if [ -z "${1}" ] || [ "${1}" = "build" ]; then printf 'Building the webring..' build_webring printf ' done\n' exit 0 fi ENTRY_URL='' ENTRY_TITLE='' ENTRY_AUTHOR='' case "${1}" in -h|--help|help) print_help exit 0 ;; -v|--version|version) print_version exit 0 ;; add) shift add_entry "${1}" "${2}" "${3}" exit 0 ;; *) print_error "${1}: Invalid argument" print_help >&2 exit 22 ;; esac trap "print_error 'Interrupt signal detected, output may be incomplete'" INT