Skip to content

Repository files navigation

The Piss List

An improved Fork of the Shitty List template, developed by Anticroom for better level management and useablity.

Improvements

  • PostgreSQL: Replaced JSON storage with a database for better reliability.
  • Staff Management: Management page to manage all list editors as owner. (/#/manage)
  • Admin Panel: Integrated page to add, edit, and reorder levels. (/#/admin)
  • Audit Logging: Staff actions are logged to Discord via webhooks.
  • Dual Lists: Two lists integrated in one with being able to switch between both on the navbar.

Setup Instructions

1. Supabase Database Setup

  1. Create a new project on Supabase.
  2. Navigate to the SQL Editor in the left sidebar.
  3. Paste this script and click Run to setup the database used for the list:
CREATE TABLE public.levels (
    id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
    name TEXT NOT NULL,
    rank INTEGER NOT NULL,
    data JSONB NOT NULL DEFAULT '{}'::jsonb
);

CREATE TABLE public.levels_2 (
    id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
    name TEXT NOT NULL,
    rank INTEGER NOT NULL,
    data JSONB NOT NULL DEFAULT '{}'::jsonb
);

create table public.packs (
  id text not null,
  name text not null,
  color text null,
  levels text[] null,
  list_type character varying(50) null default 'TPCL'::character varying,
  constraint packs_pkey primary key (id)
) TABLESPACE pg_default;

CREATE TABLE public.system (
    key TEXT PRIMARY KEY,
    data JSONB NOT NULL
);

CREATE TABLE public.submissions (
  id uuid not null,
  level_name character varying(255) null,
  username character varying(255) null,
  percent integer null,
  hz integer null,
  discord character varying(255) null,
  video_link text null,
  notes text null,
  status character varying(50) null default 'pending'::character varying,
  denial_reason text null,
  created_at timestamp without time zone null default now(),
  updated_at timestamp without time zone null default now(),
  reviewed_by character varying(255) null,
  reviewed_at timestamp without time zone null,
  submission_type character varying(50) null default 'record'::character varying,
  name character varying(255) null,
  id_gd character varying(255) null,
  author character varying(255) null,
  verifier character varying(255) null,
  verification text null,
  percent_to_qualify integer null,
  placement_suggestion text null,
  list_type character varying(50) null default 'TPCL'::character varying,
  constraint submissions_pkey primary key (id)
) TABLESPACE pg_default;

INSERT INTO public.system (key, data) VALUES 
('_logins', '{"management": [], "admins": []}'),
('_editors', '[]'),
('_vips', '[]'),
('rules', '{"level_rules": [], "record_rules": []}');

ALTER TABLE public.levels DISABLE ROW LEVEL SECURITY;
ALTER TABLE public.packs DISABLE ROW LEVEL SECURITY;
ALTER TABLE public.system DISABLE ROW LEVEL SECURITY;

2. Environment Variables

Create a .env file in your projects root folder. You will need these for local testing and Vercel deployment.

# a random string used to create bareer tokens
JWT_SECRET=[YOURJWTSTRING]

# transaction pooler for the database
POSTGRES_URL=postgresql://

# webhooks
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/
DISCORD_UPDATE_WEBHOOK_URL=https://discord.com/api/webhooks/
DISCORD_COMPLETION_WEBHOOK_URL=https://discord.com/api/webhooks/
DISCORD_UPDATE_WEBHOOK_URL_2=https://discord.com/api/webhooks/

# turnstile secret from Cloudflare for spam prevention
TURNSTILE_SECRET=0x4AAAAAAXXXXXXXXXXXXXXXXXX
  • DISCORD_WEBHOOK_URL: Private audit log for staff actions.

  • DISCORD_UPDATE_WEBHOOK_URL: Public channel for level placements/changes the first list.

  • DISCORD_UPDATE_WEBHOOK_URL_2: Public channel for level placements/changes the second list.

  • DISCORD_COMPLETION_WEBHOOK_URL: Public channel for new records.

  • TURNSTILE_SECRET: Turnstile secret used for preventing users from botting submissions, create one at Cloudflare.

  • POSTGRES_URL: A database transaction pooler using Supabase to store all the data served to the list.
    Go to your Supabase project, press the "Connect" button on the top bar, press the "Direct" tab, then select transaction pooler. You'll See a connection string below that similar to: postgresql://postgres.xXxXxXxXxXxXxXxXx:[YOUR-PASSWORD]@aws-1-us-east-2.pooler.supabase.com:6543/postgres
    Copy that and set it as your POSTGRES_URL env, but make sure to use the password you used when creating the Supabase project between the password brackets (make sure to delete the surrounding brackets afterwards)

3. Vercel Deployment

  1. Push this code to a GitHub repository.

  2. Go to Vercel and create a New Project.

  3. Import your GitHub repository.

  4. Add environment variables in the "Environment Variables" tab on your Vercel project

  5. Click Deploy.

4. Creating the First Owner Account

To access the admin panel, you must manually create the first management account in the database:

  1. Go to the Table Editor in Supabase.
  2. Select the system table.
  3. Edit the _logins row and update the management array to include your desired login as a owner:
{
  "management": [
    {
      "username": "admin",
      "email": "admin@gmail.com",
      "password": "1234"
    }
  ],
  "admins": [],
  "mods": []
}

Once your account is created, go to /#/manage on your list and login using the credentials you created from the previous step then you're done.


Developed by Anticroom with love and care ❤️

About

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages