EsServer v2.0 • Hardened Image & Video Architecture

Mega S4, Google Cloud Project, & Catbox.moe Setup Guide

EsServer v2.0 is purpose-built for sharing both images (image/*) and videos (video/*) from your Pixel 11 Pro XL across three hardened endpoints: Mega S4 Object Storage, Google Cloud Project (Cloud Storage), and Catbox.moe.

Endpoint 01 • Pre-Configured Default

Mega S4 Object Storage (Images & Video via Private SigV4 Gateway)

Your Mega S4 bucket (esserver in ap-tokyo-2) remains strictly private on Mega's object storage cluster. When you share an image or video from your Pixel 11 Pro XL, EsServer uploads it using AWS4-HMAC-SHA256 in 64 KB streaming chunks and copies a clean, permanent link (https://bowiegroodle.com/s4/<key>) to your clipboard.

EsServer Field Pre-Loaded Mega S4 Value Security & Media Role
Endpoint URL https://s3.ap-tokyo-2.megas4.com Authenticated PUT endpoint using AWS4-HMAC-SHA256 payload signing.
Bucket Name esserver Private Mega S4 bucket—anonymous direct bucket reads are blocked.
Region ap-tokyo-2 Tokyo S4 region scope (auto-normalized by EsServer).
Gateway URL Prefix https://bowiegroodle.com/s4 Streams images and HTTP 206 Partial Content byte-range video playback behind Cloudflare.
One-Tap Restore in EsServer

All Mega S4 credentials are pre-populated in EsServer v2.0. If you ever edit the fields, tap Load S4 Defaults inside the Mega S4 section to restore the working configuration immediately.

Endpoint 02 • CIS Google Cloud Benchmark Compliant

Google Cloud Project Setup (dell-server-clawdbot)

Pre-configured for your billing-enabled project dell-server-clawdbot. Enforces Public Access Prevention (CIS 5.1), Uniform Bucket-Level Access (CIS 5.2), a bucket-scoped Service Account HMAC key, on-device 7-day AWS4-HMAC-SHA256 Presigned URLs, and a 30-day automated lifecycle delete rule.

Open Google Cloud Shell (dell-server-clawdbot) and either paste the All-in-One Block below or run Steps 1–5 individually:

★

All-in-One Copy & Paste Block for dell-server-clawdbot (Recommended)

Click Copy All-in-One Commands and paste directly into your Google Cloud Shell terminal prompt:

bash • All-in-One Setup for dell-server-clawdbot
PROJECT_ID="dell-server-clawdbot"
BUCKET_NAME="esserver-vault-dell-server-clawdbot"
REGION="australia-southeast1"
SA_NAME="esserver-uploader"
SA_EMAIL="${SA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com"

gcloud config set project "${PROJECT_ID}"
gcloud services enable storage.googleapis.com iam.googleapis.com --project="${PROJECT_ID}"

gcloud storage buckets create "gs://${BUCKET_NAME}" \
  --project="${PROJECT_ID}" \
  --location="${REGION}" \
  --uniform-bucket-level-access \
  --public-access-prevention

cat > /tmp/esserver-lifecycle.json <<'EOF'
{
  "rule": [
    {
      "action": {"type": "Delete"},
      "condition": {"age": 30}
    }
  ]
}
EOF

gcloud storage buckets update "gs://${BUCKET_NAME}" \
  --project="${PROJECT_ID}" \
  --lifecycle-file=/tmp/esserver-lifecycle.json
rm -f /tmp/esserver-lifecycle.json

gcloud iam service-accounts create "${SA_NAME}" \
  --project="${PROJECT_ID}" \
  --display-name="EsServer Least-Privilege Image and Video Uploader"

sleep 5

gcloud storage buckets add-iam-policy-binding "gs://${BUCKET_NAME}" \
  --project="${PROJECT_ID}" \
  --member="serviceAccount:${SA_EMAIL}" \
  --role="roles/storage.objectUser"

gcloud storage hmac create "${SA_EMAIL}" --project="${PROJECT_ID}"

echo "===================================================="
echo "Endpoint URL       : https://storage.googleapis.com"
echo "Bucket Name        : ${BUCKET_NAME}"
echo "Region             : ${REGION}"
echo "Gateway URL Prefix : https://bowiegroodle.com/gcp"
echo "===================================================="
1

Step 1: Set Active Project to dell-server-clawdbot & Enable APIs

If you prefer running one step at a time, start by targeting dell-server-clawdbot and enabling the Cloud Storage & IAM APIs:

bash • Step 1: Activate dell-server-clawdbot
gcloud config set project dell-server-clawdbot
gcloud services enable storage.googleapis.com iam.googleapis.com --project=dell-server-clawdbot
2

Step 2: Create the Private Bucket (gs://esserver-vault-dell-server-clawdbot)

Creates your private bucket in Sydney (australia-southeast1) with Public Access Prevention (CIS 5.1) and Uniform Bucket-Level Access (CIS 5.2):

bash • Step 2: Create Hardened Private Bucket
gcloud storage buckets create gs://esserver-vault-dell-server-clawdbot \
  --project=dell-server-clawdbot \
  --location=australia-southeast1 \
  --uniform-bucket-level-access \
  --public-access-prevention
3

Step 3: Apply the 30-Day Automated Lifecycle Delete Policy

Automatically deletes uploaded screenshots and videos after 30 days:

bash • Step 3: Attach 30-Day Auto-Delete Lifecycle Policy
cat > /tmp/esserver-lifecycle.json <<'EOF'
{
  "rule": [
    {
      "action": {"type": "Delete"},
      "condition": {"age": 30}
    }
  ]
}
EOF

gcloud storage buckets update gs://esserver-vault-dell-server-clawdbot \
  --project=dell-server-clawdbot \
  --lifecycle-file=/tmp/esserver-lifecycle.json
rm -f /tmp/esserver-lifecycle.json
4

Step 4: Create the Service Account & Bind It Strictly to Your Bucket

Creates [email protected], waits 5 seconds for propagation, and grants roles/storage.objectUser on gs://esserver-vault-dell-server-clawdbot only:

bash • Step 4: Create Service Account & Bucket-Only IAM Binding
gcloud iam service-accounts create esserver-uploader \
  --project=dell-server-clawdbot \
  --display-name="EsServer Least-Privilege Image and Video Uploader"

sleep 5

gcloud storage buckets add-iam-policy-binding gs://esserver-vault-dell-server-clawdbot \
  --project=dell-server-clawdbot \
  --member="serviceAccount:[email protected]" \
  --role="roles/storage.objectUser"
5

Step 5: Generate Your S3-Interoperability HMAC Key Pair

Outputs your accessId (starts with GOOG1E...) and 40-character secret:

bash • Step 5: Generate HMAC Key for dell-server-clawdbot
gcloud storage hmac create [email protected] \
  --project=dell-server-clawdbot
6

Enter Your Google Cloud Project Credentials in EsServer

In EsServer on your Pixel 11 Pro XL, select Google Cloud Project (GCS) and enter:

EsServer Field Value to Enter
Endpoint URL https://storage.googleapis.com
Bucket Name esserver-vault-dell-server-clawdbot
Region australia-southeast1
Service Account HMAC Access Key GOOG1EJ3YTZKFFESCSNW2SDQK2QSNT5CTUJ3RIPXQIOGDQBK6T4S66FOGVC5Y
Service Account HMAC Secret <40-character base64 secret> (the secret: printed by Step 5)
Gateway URL Prefix https://bowiegroodle.com/gcp (clean zero-key URL — never exposes credentials or query strings in the link)
Endpoint 03 • Instant Community Host

Catbox.moe & Litterbox Setup (Account userhash for Images & Video)

Catbox.moe supports direct image and video uploads (.png, .jpg, .gif, .webp, .mp4, .webm) up to 200 MB permanently, or up to 1 GB on Litterbox with automatic 1h / 12h / 24h / 72h self-destruction.

1

Log In at Catbox.moe

Sign in to your account (or register in 15 seconds) at:

https://catbox.moe/user/login.php
2

Copy Your 25-Character userhash from Manage Account

Open the Account Management page and copy the alphanumeric token shown next to "Your userhash is:":

https://catbox.moe/user/manage.php
Security Posture Tip for Sensitive Screenshots or Videos on Catbox

Unlike Mega S4, Google Cloud Project, and Local PostgreSQL 18, Catbox URLs are public once uploaded. When using Catbox for sensitive clips or screenshots, toggle Use Litterbox Temporary Storage inside EsServer so the file is automatically purged after 1h, 12h, 24h, or 72h, or keep your userhash configured so you can delete uploads from catbox.moe/user/manage.php at any time.

Endpoint 04 • Self-Hosted Local Database Vault

Local PostgreSQL 18 Setup (Scoped Role & Hardened sudo Provisioning Script)

Stores images and videos directly inside your local PostgreSQL 18 service (/usr/local/pgsql/bin/postgres) using an isolated database (esserver_media), a dedicated schema owned by postgres (vault.media_objects with STORAGE EXTERNAL TOAST binary storage), and a strictly scoped least-privilege role (esserver_app) that has DML-only (SELECT, INSERT, DELETE) access and is blocked in pg_hba.conf from touching any other database on the server.

PostgreSQL TCP port 5432 remains bound strictly to 127.0.0.1; uploads from your Pixel 11 Pro XL travel over TLS to https://bowiegroodle.com/pg/upload authenticated by a 256-bit Bearer API Key (hmac.compare_digest), and return clean, credential-free links like https://bowiegroodle.com/pg/a9b0a4b9.png.

1

Run the Ready-Made sudo Provisioning Script on Your Server

The provisioning script is already saved on your server at /home/andrew/python-scripts/esserver-s4-proxy/setup_postgres_esserver.sh. Run it with sudo to apply the database, scoped user, schema, and pg_hba.conf scram-sha-256 rules:

sudo /home/andrew/python-scripts/esserver-s4-proxy/setup_postgres_esserver.sh

Full contents of setup_postgres_esserver.sh (CIS PostgreSQL 18 Benchmark posture):

bash • /home/andrew/python-scripts/esserver-s4-proxy/setup_postgres_esserver.sh (sudo)
#!/usr/bin/env bash
set -euo pipefail

PSQL_BIN="/usr/local/pgsql/bin/psql"
PG_HBA="/var/lib/postgresql/18/data/pg_hba.conf"
DB_NAME="esserver_media"
DB_USER="esserver_app"
DB_PASS="3d5c93ee544e80a3e7aa56a059ab7e9119371ace"
PG_API_KEY="espg_4bb578351405809a846bc862fc5dd698f3bd4d0b"
ENV_FILE="/home/andrew/.env"
PROXY_ENV_FILE="/home/andrew/python-scripts/esserver-s4-proxy/pg_config.env"

# 1. Create least-privilege role esserver_app (NOSUPERUSER, NOCREATEDB, SCRAM-SHA-256)
sudo -u postgres "${PSQL_BIN}" -v ON_ERROR_STOP=1 -d postgres <<SQL
SET password_encryption = 'scram-sha-256';
DO \$\$
BEGIN
    IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = '${DB_USER}') THEN
        CREATE ROLE ${DB_USER} WITH
            LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT NOREPLICATION NOBYPASSRLS
            CONNECTION LIMIT 32 ENCRYPTED PASSWORD '${DB_PASS}';
    ELSE
        ALTER ROLE ${DB_USER} WITH
            LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT NOREPLICATION NOBYPASSRLS
            CONNECTION LIMIT 32 ENCRYPTED PASSWORD '${DB_PASS}';
    END IF;
END
\$\$;
ALTER ROLE ${DB_USER} SET statement_timeout = '60s';
ALTER ROLE ${DB_USER} SET idle_in_transaction_session_timeout = '30s';
ALTER ROLE ${DB_USER} SET lock_timeout = '10s';
SQL

# 2. Create isolated database esserver_media & dedicated schema vault
DB_EXISTS=$(sudo -u postgres "${PSQL_BIN}" -tAc "SELECT 1 FROM pg_database WHERE datname = '${DB_NAME}';" -d postgres)
if [[ "${DB_EXISTS}" != "1" ]]; then
    sudo -u postgres "${PSQL_BIN}" -v ON_ERROR_STOP=1 -d postgres \
        -c "CREATE DATABASE ${DB_NAME} WITH OWNER = postgres ENCODING = 'UTF8';"
fi

sudo -u postgres "${PSQL_BIN}" -v ON_ERROR_STOP=1 -d "${DB_NAME}" <<SQL
REVOKE ALL ON DATABASE ${DB_NAME} FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM PUBLIC;

CREATE SCHEMA IF NOT EXISTS vault AUTHORIZATION postgres;
REVOKE ALL ON SCHEMA vault FROM PUBLIC;

CREATE TABLE IF NOT EXISTS vault.media_objects (
    object_key       VARCHAR(64) PRIMARY KEY CHECK (object_key ~ '^[a-zA-Z0-9._-]+$'),
    original_name    TEXT NOT NULL,
    mime_type        VARCHAR(127) NOT NULL,
    size_bytes       BIGINT NOT NULL CHECK (size_bytes > 0 AND size_bytes <= 536870912),
    sha256_hex       CHAR(64) NOT NULL,
    payload          BYTEA NOT NULL,
    created_at       TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    expires_at       TIMESTAMPTZ NOT NULL DEFAULT (NOW() + INTERVAL '30 days')
);
ALTER TABLE vault.media_objects ALTER COLUMN payload SET STORAGE EXTERNAL;
CREATE INDEX IF NOT EXISTS idx_media_objects_expires_at ON vault.media_objects (expires_at);

GRANT CONNECT ON DATABASE ${DB_NAME} TO ${DB_USER};
GRANT USAGE ON SCHEMA vault TO ${DB_USER};
GRANT SELECT, INSERT, DELETE ON TABLE vault.media_objects TO ${DB_USER};
ALTER ROLE ${DB_USER} IN DATABASE ${DB_NAME} SET search_path = vault;
SQL
2

PostgreSQL 18 Credentials in EsServer (Pre-Populated by Default)

All fields below are pre-populated in EsServer v2.0 (tap Load Postgres Defaults at any time to restore them):

EsServer Field Pre-Populated Value
Upload Endpoint URL https://bowiegroodle.com/pg/upload
Database Name esserver_media
Schema vault
Scoped DB Role esserver_app (NOSUPERUSER, DML-only, SCRAM-SHA-256)
Bearer API Key espg_4bb578351405809a846bc862fc5dd698f3bd4d0b
Gateway URL Prefix https://bowiegroodle.com/pg (clean zero-key URL)
Part 05 • Media Capabilities

Image & Video Sharing Matrix Across All Four Endpoints

EsServer registers for both image/* and video/* in the Android Share Sheet and provides dedicated Upload Image and Upload Video buttons on the main dashboard.

Endpoint Max Image / Video Size Playback & Download Behavior Security & Retention Model
Mega S4 Object Storage Up to 5 GB Inline HTML5 video player (HTTP 206 Partial Content byte-range streaming) + direct image/video download via bowiegroodle.com/s4. Private S4 bucket; authenticated by local server SigV4 gateway.
Google Cloud Project (GCS) Up to 5 GB Inline HTML5 video player (HTTP 206 Partial Content) + direct image/video download via bowiegroodle.com/gcp. Zero-public-access bucket + local OAuth2 Bearer gateway + 30-day auto-delete.
Catbox.moe / Litterbox 200 MB (Catbox)
1 GB (Litterbox)
Inline HTML5 video player + direct download for .mp4, .webm, .png, .jpg, .webp. Account-linked via userhash or auto-expiring (1h–72h) via Litterbox.
PostgreSQL 18 (Local Service) Up to 512 MB Inline HTML5 video player (HTTP 206 Partial Content byte-range slicing from BYTEA) + direct download via bowiegroodle.com/pg. Scoped esserver_app role (DML-only on esserver_media.vault, SCRAM-SHA-256) + 30-day TTL purge.
Part 06 • Build Output & Design Tokens

Confirmed App Location & Slate Dark Theme Specification

Both the EsServer v2.0 Android app and this documentation portal implement the Slate dark palette from dev.bowiegroodle.com/themes/dark with a selective Pink highlight (#F472B6).

Project Directory: /home/andrew/android-apps/EsServer
Compiled APK: /home/andrew/android-apps/EsServer/EsServer.apk
backgroundInset#171B22
Recessed areas: code blocks, editor wells, inset controls
backgroundCanvas#1B1F27
Dominant main page/screen background
surfaceDefault#222731
Navigation panels, sidebars, and grouped content
surfaceElevated#2A303B
Floating Share Sheet modal, popovers, and toasts
surfaceHover#323A47
Subtle hover feedback on interactive surfaces
borderSubtle#343D4A
Decorative dividers and quiet boundaries
borderStrong#495567
Visible control outlines needing definition
accentPink#F472B6
Primary actions, links, selection, and focus
Copied to clipboard