not so small webring backend, written in go
Go to file
Alexander Karpov bf62b8f427
added telegram oauth, submittions, dispaly order, admin
* major changes

Introduce full user system and approval workflow
——————————————————————————————————————————

Login & sessions

    Telegram one‑click login (/login → /auth/telegram) with HMAC verification

    New users and sessions tables; telegram_id now optional, TTL‑based cleanup job

    Secure session_id cookie (configurable TTL and Secure/SameSite flags)

User dashboard (/user)

    Lists the member’s sites and their uptime status

    Forms to submit new site or update requests; validation and slug/url sanitisation

    View pending requests with change diff

Request storage

    update_requests table captures create/update ops as JSONB “changed_fields”

Admin review

    /admin/requests interface to approve / reject queued requests

    Approval auto‑creates sites (with ordered display_order) or patches existing ones, then refreshes favicon

Super‑admin panel

    /admin/setup lists all users, toggle is_admin and forcibly logs them out

Notifications

    On every new request, all admins with a Telegram ID receive a Markdown summary via bot API

Public UI tweaks

    Header shows login/logout, role‑aware links and call‑to‑action cards

    /submit page creates a queued request

Config & env

    Added TELEGRAM_BOT_TOKEN, TELEGRAM_BOT_USERNAME, SESSION_TTL_HOURS, SESSION_SECURE_COOKIE

    .env.template updated accordingly

Migrations 004–010

    Users, sessions, foreign key on sites, display_order, update_requests, telegram_id nullability

BREAKING CHANGE

    Environment must supply Telegram bot credentials

    Database must be migrated; existing “dashboard” auth remains but admin routes are now session‑protected where applicable
2025-08-08 16:36:09 +03:00
.github/workflows added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
cmd/server added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
docs added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
internal added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
migrations added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
static added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
.air.toml added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
.env.template added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
.gitguardian.yml added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
.gitignore added favicon for sites, list all sites api and page, disabled cors for api, minor fixes 2024-07-17 02:48:53 +03:00
.golangci.yml added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
Dockerfile added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
embedded.go added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
go.mod added favicon for sites, list all sites api and page, disabled cors for api, minor fixes 2024-07-17 02:48:53 +03:00
go.sum added favicon for sites, list all sites api and page, disabled cors for api, minor fixes 2024-07-17 02:48:53 +03:00
Makefile added telegram oauth, submittions, dispaly order, admin 2025-08-08 16:36:09 +03:00
README.md feat: Implement slugs and id reordering (#2) 2025-06-19 14:34:18 +03:00

Webring Relay Service

This project is a webring relay service built with Go. It manages a list of websites, checks their uptime, and provides a dashboard for administration.

Features

  • Dashboard for managing websites in the webring
  • Automatic uptime checking of websites (with proxy support)
  • API endpoints for navigating the webring
  • Basic authentication for the dashboard

Prerequisites

  • Go 1.16 or later
  • PostgreSQL database

Installation

edit .env to set correct path to database

go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
go mod tidy
cp .env.template .env
make migrate-up

Local Run

go run cmd/server/main.go

or download prebuild version

wget https://github.com/Alexander-D-Karpov/webring/releases/latest/download/webring
chmod +x webring
./webring

Usage

  • Access the dashboard at http://localhost:8080/dashboard (use the credentials set in your .env file)
  • API endpoints:
    • Next site: GET /{slug}/next/data
    • Previous site: GET /{slug}/prev/data
    • Random site: GET /{slug}/random/data
    • Full data for a site: GET /{slug}/data
  • Redirect endpoints:
    • Visit site: GET /{slug}
    • Next site: GET /{slug}/next
    • Previous site: GET /{slug}/prev
    • Random site: GET /{slug}/random