Rename project to Glimmer for luci.ooo

Rebrand from "urlshort" to "Glimmer" across the entire codebase:
Go module/imports, build targets, HTML templates, deploy scripts
(including renaming service files), config, and README.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
lucioandClaude Opus 4.6 committed 2026-04-02 03:00:08 -07:00
1 parent 5abdf2b6f2
commit 1bfad9ed7c
19 files changed
+104 -104

No files matched your search

+4 -4
View File
@@ -1,7 +1,7 @@
urlshort
urlshort.exe
urlshort.exe~
urlshort-arm
glimmer
glimmer.exe
glimmer.exe~
glimmer-arm
data/
node_modules/
+5 -5
View File
@@ -1,19 +1,19 @@
.PHONY: build build-arm run clean hash
build:
go build -ldflags="-s -w" -o urlshort.exe ./
go build -ldflags="-s -w" -o glimmer.exe ./
build-linux:
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o urlshort ./
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o glimmer ./
build-arm:
GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-s -w" -o urlshort-arm ./
GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-s -w" -o glimmer-arm ./
run: build
./urlshort.exe
./glimmer.exe
clean:
rm -f urlshort urlshort.exe urlshort-arm
rm -f glimmer glimmer.exe glimmer-arm
hash:
@read -p "Password: " pw && go run . --hash-password "$$pw"
+37 -37
View File
@@ -1,6 +1,6 @@
# urlshort
# Glimmer
A lightweight, single-binary URL shortener and pastebin built in Go. Designed to run on a Raspberry Pi Zero (512MB RAM, single-core ARM) with minimal dependencies and no external runtime requirements.
A lightweight, single-binary URL shortener and pastebin built in Go. Hosted on [luci.ooo](https://luci.ooo). Designed to run on a Raspberry Pi Zero (512MB RAM, single-core ARM) with minimal dependencies and no external runtime requirements.
---
@@ -47,15 +47,15 @@ A lightweight, single-binary URL shortener and pastebin built in Go. Designed to
## Project Layout
```
urlshort/
glimmer/
├── main.go # Entry point; flag parsing; --hash-password helper
├── config.toml # Runtime configuration (port, admin creds, db path)
├── go.mod / go.sum
├── Makefile
├── deploy/
│ ├── install.sh # Install script (auto-detects systemd vs SysV)
│ ├── urlshort.service # systemd unit file (Ubuntu 15.04+)
│ └── urlshort.init # SysV init script (Ubuntu 14.04 and older)
│ ├── glimmer.service # systemd unit file (Ubuntu 15.04+)
│ └── glimmer.init # SysV init script (Ubuntu 14.04 and older)
├── data/
│ └── urls.db # SQLite database (auto-created on first run)
└── internal/
@@ -144,7 +144,7 @@ length = 3 # Auto-generated slug length (characters)
### 3. Set your admin password
```bash
./urlshort --hash-password "your-secure-password"
./glimmer --hash-password "your-secure-password"
# or via make:
make hash
```
@@ -156,15 +156,15 @@ Copy the printed bcrypt hash into `config.toml` under `admin.password_hash`.
```bash
# Windows
make build
./urlshort.exe
./glimmer.exe
# Linux / macOS
make build-linux
./urlshort
./glimmer
# Raspberry Pi Zero (ARMv5)
make build-arm
# Copy urlshort-arm to the Pi, then run it there
# Copy glimmer-arm to the Pi, then run it there
```
The server starts on `http://localhost:8888` (or whatever port you set).
@@ -175,9 +175,9 @@ The server starts on `http://localhost:8888` (or whatever port you set).
| Target | Description |
|---|---|
| `make build` | Build `urlshort.exe` for Windows (stripped binary) |
| `make build-linux` | Build `urlshort` for Linux x86-64 |
| `make build-arm` | Cross-compile `urlshort-arm` for Raspberry Pi Zero (ARMv5) |
| `make build` | Build `glimmer.exe` for Windows (stripped binary) |
| `make build-linux` | Build `glimmer` for Linux x86-64 |
| `make build-arm` | Cross-compile `glimmer-arm` for Raspberry Pi Zero (ARMv5) |
| `make run` | Build then immediately run on Windows |
| `make clean` | Remove all compiled binaries |
| `make hash` | Interactively hash a password for `config.toml` |
@@ -191,7 +191,7 @@ The server starts on `http://localhost:8888` (or whatever port you set).
make build-arm
# Copy binary, config, and deploy scripts to the Pi
scp urlshort-arm [email protected]:~/urlshort
scp glimmer-arm [email protected]:~/glimmer
scp config.toml [email protected]:~/config.toml
scp -r deploy/ [email protected]:~/deploy/
```
@@ -204,31 +204,31 @@ The `deploy/` directory contains an install script and service files compatible
```bash
# On the Pi (or any Ubuntu/Debian host):
chmod +x urlshort
chmod +x glimmer
sudo ./deploy/install.sh
```
The script will:
- Create a dedicated `urlshort` system user
- Install the binary to `/opt/urlshort/`
- Install the config to `/etc/urlshort/config.toml`
- Create `/var/lib/urlshort/` for the database
- Create a dedicated `glimmer` system user
- Install the binary to `/opt/glimmer/`
- Install the config to `/etc/glimmer/config.toml`
- Create `/var/lib/glimmer/` for the database
- Register and enable the service (systemd or SysV, auto-detected)
**After install**, set your admin password hash in the config:
```bash
/opt/urlshort/urlshort -hash-password "your-secure-password"
# Paste the output into /etc/urlshort/config.toml → admin.password_hash
sudo systemctl start urlshort
/opt/glimmer/glimmer -hash-password "your-secure-password"
# Paste the output into /etc/glimmer/config.toml → admin.password_hash
sudo systemctl start glimmer
```
**Service management:**
```bash
sudo systemctl status urlshort
sudo systemctl restart urlshort
sudo journalctl -u urlshort -f # live logs
sudo systemctl status glimmer
sudo systemctl restart glimmer
sudo journalctl -u glimmer -f # live logs
```
---
@@ -247,7 +247,7 @@ sudo apt install -y nginx
### 2. Create a site config
```bash
sudo nano /etc/nginx/sites-available/urlshort
sudo nano /etc/nginx/sites-available/glimmer
```
Paste the following, replacing `short.example.com` with your domain:
@@ -271,7 +271,7 @@ server {
```
```bash
sudo ln -s /etc/nginx/sites-available/urlshort /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/glimmer /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
```
@@ -289,9 +289,9 @@ Certbot will automatically update the nginx config to add SSL and redirect HTTP
> **No public domain?** If running on a local network (e.g. Raspberry Pi at home), skip certbot and use a self-signed certificate instead:
> ```bash
> sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
> -keyout /etc/ssl/private/urlshort.key \
> -out /etc/ssl/certs/urlshort.crt \
> -subj "/CN=urlshort"
> -keyout /etc/ssl/private/glimmer.key \
> -out /etc/ssl/certs/glimmer.crt \
> -subj "/CN=glimmer"
> ```
> Then reference them manually in the nginx config (`ssl_certificate`, `ssl_certificate_key`).
@@ -354,7 +354,7 @@ sudo nginx -t && sudo systemctl reload nginx
base_url = "https://short.example.com"
```
Then restart the service: `sudo systemctl restart urlshort`
Then restart the service: `sudo systemctl restart glimmer`
### Verify everything works
@@ -365,8 +365,8 @@ curl -I http://short.example.com/
# Confirm HTTPS proxy is working
curl -I https://short.example.com/
# Check urlshort is running and nginx can reach it
sudo systemctl status urlshort
# Check glimmer is running and nginx can reach it
sudo systemctl status glimmer
sudo systemctl status nginx
```
@@ -448,7 +448,7 @@ write_timeout = "10s" # HTTP write timeout
[admin]
username = "admin" # Admin login username
password_hash = "$2a$10$..." # bcrypt hash — generate with: ./urlshort --hash-password
password_hash = "$2a$10$..." # bcrypt hash — generate with: ./glimmer --hash-password
session_hours = 24 # How long admin sessions last
[database]
@@ -462,7 +462,7 @@ length = 3 # Length of auto-generated slugs (recommended: 3
## Security Notes
- **Change the default password.** The default hash in `config.toml` is for the password `admin`. Run `./urlshort --hash-password` immediately.
- **Change the default password.** The default hash in `config.toml` is for the password `admin`. Run `./glimmer --hash-password` immediately.
- **CSRF protection** uses the double-submit cookie pattern. Every admin POST requires a `csrf_token` form field matching the `csrf` cookie value, compared with constant-time equality.
- **Sessions** are stored in memory. They are lost when the server restarts (acceptable for single-user use). Session IDs are 32 bytes of `crypto/rand`.
- **Paste tokens** are 12-character random strings. Token comparison uses `crypto/subtle.ConstantTimeCompare` to prevent timing attacks.
@@ -476,15 +476,15 @@ length = 3 # Length of auto-generated slugs (recommended: 3
```bash
export PATH="/c/Program Files/Go/bin:$PATH"
pkill -f urlshort.exe; sleep 1
go build -o urlshort.exe ./ && ./urlshort.exe &
pkill -f glimmer.exe; sleep 1
go build -o glimmer.exe ./ && ./glimmer.exe &
```
### Check logs
```bash
# If started with output redirected:
tail -f /tmp/urlshort.log
tail -f /tmp/glimmer.log
```
### Useful one-liners
+2 -2
View File
@@ -1,4 +1,4 @@
# URL Shortener Configuration
# Glimmer Configuration
[server]
port = 8888
@@ -9,7 +9,7 @@ write_timeout = "10s"
[admin]
username = "admin"
# Default password: "admin" — change this!
# Generate a new hash: ./urlshort --hash-password "your-password"
# Generate a new hash: ./glimmer --hash-password "your-password"
password_hash = "$2a$10$WXBoF7ZB7fIRl5smdGH9seqlNbXWiCS7ZbGNk0ONb9xjS8499gBpu"
session_hours = 24
+7 -7
View File
@@ -1,20 +1,20 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: urlshort
# Provides: glimmer
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: URL Shortener
# Description: URL Shortener and Pastebin server
# Short-Description: Glimmer
# Description: Glimmer and Pastebin server
### END INIT INFO
NAME=urlshort
DAEMON=/opt/urlshort/urlshort
DAEMON_ARGS="-config /etc/urlshort/config.toml"
NAME=glimmer
DAEMON=/opt/glimmer/glimmer
DAEMON_ARGS="-config /etc/glimmer/config.toml"
PIDFILE=/var/run/$NAME.pid
LOGFILE=/var/log/$NAME.log
RUN_AS=urlshort
RUN_AS=glimmer
. /lib/lsb/init-functions
@@ -1,15 +1,15 @@
[Unit]
Description=URL Shortener
Description=Glimmer
Documentation=https://github.com/
After=network.target
Wants=network.target
[Service]
Type=simple
User=urlshort
Group=urlshort
WorkingDirectory=/opt/urlshort
ExecStart=/opt/urlshort/urlshort -config /etc/urlshort/config.toml
User=glimmer
Group=glimmer
WorkingDirectory=/opt/glimmer
ExecStart=/opt/glimmer/glimmer -config /etc/glimmer/config.toml
Restart=on-failure
RestartSec=5
TimeoutStopSec=10
@@ -17,13 +17,13 @@ TimeoutStopSec=10
# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=urlshort
SyslogIdentifier=glimmer
# Hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ReadWritePaths=/var/lib/urlshort
ReadWritePaths=/var/lib/glimmer
[Install]
WantedBy=multi-user.target
+22 -22
View File
@@ -1,16 +1,16 @@
#!/bin/sh
# install.sh — Install urlshort as a system service on Ubuntu/Debian
# install.sh — Install glimmer as a system service on Ubuntu/Debian
# Works with systemd (Ubuntu 15.04+) and SysV init (older systems)
# Run as root: sudo ./install.sh
set -e
BINARY_SRC="./urlshort"
INSTALL_DIR="/opt/urlshort"
CONFIG_DIR="/etc/urlshort"
DATA_DIR="/var/lib/urlshort"
SERVICE_USER="urlshort"
SERVICE_NAME="urlshort"
BINARY_SRC="./glimmer"
INSTALL_DIR="/opt/glimmer"
CONFIG_DIR="/etc/glimmer"
DATA_DIR="/var/lib/glimmer"
SERVICE_USER="glimmer"
SERVICE_NAME="glimmer"
# ── Helpers ───────────────────────────────────────────────────────────────────
@@ -29,11 +29,11 @@ has_systemd() {
require_root
[ -f "$BINARY_SRC" ] || die "Binary '$BINARY_SRC' not found. Build first: GOOS=linux GOARCH=arm go build -o urlshort ."
[ -f "./deploy/urlshort.service" ] || die "deploy/urlshort.service not found."
[ -f "./deploy/urlshort.init" ] || die "deploy/urlshort.init not found."
[ -f "$BINARY_SRC" ] || die "Binary '$BINARY_SRC' not found. Build first: GOOS=linux GOARCH=arm go build -o glimmer ."
[ -f "./deploy/glimmer.service" ] || die "deploy/glimmer.service not found."
[ -f "./deploy/glimmer.init" ] || die "deploy/glimmer.init not found."
echo "Installing urlshort..."
echo "Installing glimmer..."
# ── Create service user ───────────────────────────────────────────────────────
@@ -53,10 +53,10 @@ chmod 750 "$DATA_DIR"
# ── Install binary ────────────────────────────────────────────────────────────
info "Installing binary to $INSTALL_DIR/urlshort"
cp "$BINARY_SRC" "$INSTALL_DIR/urlshort"
chown root:root "$INSTALL_DIR/urlshort"
chmod 755 "$INSTALL_DIR/urlshort"
info "Installing binary to $INSTALL_DIR/glimmer"
cp "$BINARY_SRC" "$INSTALL_DIR/glimmer"
chown root:root "$INSTALL_DIR/glimmer"
chmod 755 "$INSTALL_DIR/glimmer"
# ── Install config (only if not already present) ──────────────────────────────
@@ -64,12 +64,12 @@ if [ ! -f "$CONFIG_DIR/config.toml" ]; then
info "Installing default config to $CONFIG_DIR/config.toml"
cp ./config.toml "$CONFIG_DIR/config.toml"
# Point the database path at the data directory
sed -i 's|path = .*|path = "/var/lib/urlshort/urls.db"|' "$CONFIG_DIR/config.toml"
sed -i 's|path = .*|path = "/var/lib/glimmer/urls.db"|' "$CONFIG_DIR/config.toml"
chown root:"$SERVICE_USER" "$CONFIG_DIR/config.toml"
chmod 640 "$CONFIG_DIR/config.toml"
echo ""
echo " ** IMPORTANT: Edit $CONFIG_DIR/config.toml and set admin.password_hash."
echo " Generate a hash with: $INSTALL_DIR/urlshort -hash-password 'yourpassword'"
echo " Generate a hash with: $INSTALL_DIR/glimmer -hash-password 'yourpassword'"
echo ""
else
info "Config already exists at $CONFIG_DIR/config.toml — skipping"
@@ -79,17 +79,17 @@ fi
if has_systemd; then
info "Installing systemd service"
cp ./deploy/urlshort.service /etc/systemd/system/urlshort.service
chmod 644 /etc/systemd/system/urlshort.service
cp ./deploy/glimmer.service /etc/systemd/system/glimmer.service
chmod 644 /etc/systemd/system/glimmer.service
systemctl daemon-reload
systemctl enable "$SERVICE_NAME"
info "Service enabled. Start with: systemctl start $SERVICE_NAME"
info "View logs with: journalctl -u $SERVICE_NAME -f"
else
info "systemd not found — installing SysV init script"
cp ./deploy/urlshort.init /etc/init.d/urlshort
chmod 755 /etc/init.d/urlshort
update-rc.d urlshort defaults
cp ./deploy/glimmer.init /etc/init.d/glimmer
chmod 755 /etc/init.d/glimmer
update-rc.d glimmer defaults
info "Service enabled. Start with: service $SERVICE_NAME start"
info "View logs with: tail -f /var/log/$SERVICE_NAME.log"
fi
+1 -1
View File
@@ -1,4 +1,4 @@
module urlshort
module glimmer
go 1.26.1
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"strings"
"time"
"urlshort/internal/slug"
"glimmer/internal/slug"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"net/http"
"time"
"urlshort/internal/config"
"urlshort/internal/db"
"glimmer/internal/config"
"glimmer/internal/db"
)
type Server struct {
+2 -2
View File
@@ -3,13 +3,13 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Not Found — URL Shortener</title>
<title>Not Found — Glimmer</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<nav>
<ul><li><strong><a href="/">Shortener</a></strong></li></ul>
<ul><li><strong><a href="/">Glimmer</a></strong></li></ul>
<ul><li><a href="/">Home</a></li></ul>
</nav>
<main class="container" style="text-align:center;padding-top:4rem">
+2 -2
View File
@@ -3,13 +3,13 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Admin — URL Shortener</title>
<title>Admin — Glimmer</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<nav>
<ul><li><strong><a href="/">Shortener</a></strong></li></ul>
<ul><li><strong><a href="/">Glimmer</a></strong></li></ul>
<ul>
<li><a href="/">Home</a></li>
<li>
+1 -1
View File
@@ -9,7 +9,7 @@
</head>
<body>
<nav>
<ul><li><strong><a href="/">Shortener</a></strong></li></ul>
<ul><li><strong><a href="/">Glimmer</a></strong></li></ul>
<ul>
<li><a href="/">Home</a></li>
<li>
@@ -9,7 +9,7 @@
</head>
<body>
<nav>
<ul><li><strong><a href="/">Shortener</a></strong></li></ul>
<ul><li><strong><a href="/">Glimmer</a></strong></li></ul>
<ul>
<li><a href="/">Home</a></li>
<li>
+2 -2
View File
@@ -3,13 +3,13 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Edit Link — URL Shortener</title>
<title>Edit Link — Glimmer</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<nav>
<ul><li><strong><a href="/">Shortener</a></strong></li></ul>
<ul><li><strong><a href="/">Glimmer</a></strong></li></ul>
<ul>
<li><a href="/admin">Back to list</a></li>
<li>
+2 -2
View File
@@ -3,13 +3,13 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Admin Login — URL Shortener</title>
<title>Admin Login — Glimmer</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<nav>
<ul><li><strong><a href="/">Shortener</a></strong></li></ul>
<ul><li><strong><a href="/">Glimmer</a></strong></li></ul>
<ul><li><a href="/">Home</a></li></ul>
</nav>
<main>
+1 -1
View File
@@ -9,7 +9,7 @@
</head>
<body>
<nav>
<ul><li><strong><a href="/">Shortener</a></strong></li></ul>
<ul><li><strong><a href="/">Glimmer</a></strong></li></ul>
<ul><li>{{if .LoggedIn}}<a href="/admin/bin">Admin</a>{{else}}<a href="/admin/login">Admin</a>{{end}}</li></ul>
</nav>
<main class="container" style="max-width:860px">
+2 -2
View File
@@ -3,13 +3,13 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>URL Shortener</title>
<title>Glimmer</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<nav>
<ul><li><strong><a href="/">Shortener</a></strong></li></ul>
<ul><li><strong><a href="/">Glimmer</a></strong></li></ul>
<ul><li>{{if .LoggedIn}}<a href="/admin">Admin</a>{{else}}<a href="/admin/login">Admin</a>{{end}}</li></ul>
</nav>
<main class="container">
+3 -3
View File
@@ -8,9 +8,9 @@ import (
"golang.org/x/crypto/bcrypt"
"urlshort/internal/config"
"urlshort/internal/db"
"urlshort/internal/server"
"glimmer/internal/config"
"glimmer/internal/db"
"glimmer/internal/server"
)
func main() {