Skip to content

Commit

Permalink
Merge pull request #4 from Battlesquid/sapphire-impl
Browse files Browse the repository at this point in the history
Sapphire impl
  • Loading branch information
Battlesquid authored Jul 11, 2024
2 parents ad7f29e + c3caed6 commit 4e2b081
Show file tree
Hide file tree
Showing 122 changed files with 7,843 additions and 8,532 deletions.
25 changes: 25 additions & 0 deletions .env.vault
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#/-------------------.env.vault---------------------/
#/ cloud-agnostic vaulting standard /
#/ [how it works](https://dotenv.org/env-vault) /
#/--------------------------------------------------/

# development
DOTENV_VAULT_DEVELOPMENT="8Dc0EZ572iRxaIGzP/bRwZ0GhJCtewhgkgWryMHnnOamtqvB8S5H6ml842xs5cNtceHzQiZcEvQQD8xK7RLhJVF1g5mojxtDBKPVqzsRyfU5icTxOW21rhz5k6KgrBJwT4p+lirBPzbbcAelIQGsD3b3h1GAcV+cNXcP3P6SmBXPPmgR6xpsj868pe7XcGfpN03P7Vgvm3h1/jhUuKolO6x4SSf9DTYblzY4l50P6yteaM5wh3htjbcyJiFywtpzO9GF6Vy6kTfdqUU9crKoK3XS8fJ9NVLKCmZ2MU9ZL0WllrBv5JyN3TQlyON1zLYgaSWF5oWzCw0BNBDA8VD5a39Ig73VKKVkhCbFuxSgsyaEStckDzWme0HdymGTeWVZn7w1L4q4p/QVZiP6pmW47PLMFVzIwIXOXbjAse0M2Du2ZHSVXcUhItENb2Y9MFNRT0mWRoJYErYEtq+6oX08NKxkU4u+6kCi0iSt"
DOTENV_VAULT_DEVELOPMENT_VERSION=3

# ci
DOTENV_VAULT_CI="pJ5xC3/Rz5eLp76NgUjDoi4Uv7cdEIGhaC3nhUQ4eA/CjjLGJ+BdcYBp4iOLrk+vtG0HYq/3CiGw2ZciZlXziKO3I1FyU6njQmpAx/pZ+h22XDPE6LANlCT5k5wsh/JAadXh3KJwnk993ZV1wX14RJIdYfY41J1dFA5F6bLQNATHUJUomYDV/BTvHXNs0+xcV+IOFh6JxOA33Fk/daK8heucCiC9gumpcHOJWtbdyr/D+lj0KuW2fWrlr/nhuQ=="
DOTENV_VAULT_CI_VERSION=3

# staging
DOTENV_VAULT_STAGING="KlQe5hjzjgZpDdQAgh7FfnfWhaVFJ5JzKbhZ3XyGzs4dh8T/lKIEGC2wR7VG6WQOasaYOEJdtEin4QFqSauK7IB9ZwrCoE8IC01Nfa1O8cgQokqoHbagUpMxsMg3uqMDXIU/HGKP230DS4YCt0TwNYlcNov9tI0hF4cC47VoY/32WtHNNRMkJjgljkuXon0z/Hkqmi4Vbe07jhxXfxJFUa9qRvOR3XXV1nIv4LJ4GsaMjlpJKO0fvICbSc+X5g=="
DOTENV_VAULT_STAGING_VERSION=3

# production
DOTENV_VAULT_PRODUCTION="VhF5GTTWtFw47b9qTZTFZtG1PmXCTYiZDbZ3j+s9YS4r6DLyl8f9ZwCZc8NvP1qfKpSnyQP7P7eLvQjDKsJ9wG8Wlf0u4ETCv//hAS1LpWm3rv2mXc7LoXz2KxjOzQrWRWhw5gCJeVMt+ki6FodNuoJM8eMiMiw7eOw1vkJWTrpk6iozDtP2cHmnrm1i/lMjI6FJISeubVhdZ9f4XnGod3BbcaXkIZvtxYDdtil1KTQrwMPeJGu0t0f5+WdN4WymYScZSb94X4laRJo8WBvNi25llA4UTA+pQjqe7hxdbdv+OBM6geNZlREGd2EXBdzNAFBNWDL6M4iczrkTAn6R57SSOB7IVBk04K89x8L6hgE5vlYOebfozvk5cSrJT04PhVtcaAdHeDtQIAalpX1KsazOxNMprL350BZNRakx0BRlEIqrWu2BtGegX9B86oNpId3QvaNxbuO1YxGGK35DFL/hkIM3Eng7KGhRSSDUOD8xnjf1Yrw23Tu1ps2AAzjScdOETr0+W/E="
DOTENV_VAULT_PRODUCTION_VERSION=6

#/----------------settings/metadata-----------------/
DOTENV_VAULT="vlt_9a9f7a488fd44d4f65b4d3ef4eb12286e90b4356ecbaa3fb694350d0bc09d773"
DOTENV_API_URL="https://vault.dotenv.org"
DOTENV_CLI="npx dotenv-vault@latest"
13 changes: 0 additions & 13 deletions .eslintrc.json

This file was deleted.

95 changes: 47 additions & 48 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,61 +12,60 @@
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '30 0 * * 0'
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "30 0 * * 0"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
strategy:
fail-fast: false
matrix:
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ temp/
.env
dist/
config.json
.eslintcache
.eslintcache
.env*
.flaskenv*
!.env.project
!.env.vault
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ tmp/
temp/
.env
dist/
config.json
config.json
src/interactions
5 changes: 3 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"printWidth": 80,
"printWidth": 200,
"tabWidth": 4,
"semi": true,
"endOfLine": "lf"
"endOfLine": "lf",
"trailingComma": "none"
}
16 changes: 16 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { config } from "dotenv";
import { defineConfig } from "drizzle-kit";

config();

export default defineConfig({
schema: "./src/db/schema.ts",
out: "./drizzle",
dialect: "postgresql",
dbCredentials: {
host: process.env.DB_HOST!,
user: process.env.DB_USER!,
password: process.env.DB_PASSWORD!,
database: process.env.DB_NAME!
}
});
25 changes: 25 additions & 0 deletions drizzle/0000_futuristic_reavers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CREATE TABLE IF NOT EXISTS "channel_settings" (
"gid" varchar PRIMARY KEY NOT NULL,
"media_only" text[] NOT NULL,
"exempted_roles" text[] DEFAULT '{}'::text[] NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "log_settings" (
"gid" varchar PRIMARY KEY NOT NULL,
"t_log_ch" varchar,
"i_log_ch" varchar
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "verify_entry" (
"id" serial PRIMARY KEY NOT NULL,
"gid" varchar NOT NULL,
"uid" varchar NOT NULL,
"nick" varchar(32) NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "verify_settings" (
"gid" varchar NOT NULL,
"join_ch" varchar NOT NULL,
"roles" text[] NOT NULL,
"autogreet" boolean DEFAULT false NOT NULL
);
3 changes: 3 additions & 0 deletions drizzle/0001_flimsy_beyonder.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "log_settings" RENAME COLUMN "t_log_ch" TO "text";--> statement-breakpoint
ALTER TABLE "log_settings" RENAME COLUMN "i_log_ch" TO "image";--> statement-breakpoint
ALTER TABLE "log_settings" ADD COLUMN "moderation" varchar;
1 change: 1 addition & 0 deletions drizzle/0002_mighty_korath.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "log_settings" RENAME COLUMN "text" TO "message";
3 changes: 3 additions & 0 deletions drizzle/0003_furry_firedrake.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "channel_settings" RENAME TO "imageboard";--> statement-breakpoint
ALTER TABLE "imageboard" RENAME COLUMN "media_only" TO "boards";--> statement-breakpoint
ALTER TABLE "imageboard" RENAME COLUMN "exempted_roles" TO "whitelist";
3 changes: 3 additions & 0 deletions drizzle/0004_hot_mephisto.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "verify_entry" DROP CONSTRAINT "verify_entry_pkey";
ALTER TABLE "verify_entry" ADD CONSTRAINT "verify_entry_gid_uid_pk" PRIMARY KEY("gid","uid");--> statement-breakpoint
ALTER TABLE "verify_entry" DROP COLUMN IF EXISTS "id";
4 changes: 4 additions & 0 deletions drizzle/0005_bitter_lilandra.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE "verify_settings" RENAME COLUMN "join_ch" TO "welcome_channel";--> statement-breakpoint
ALTER TABLE "verify_settings" RENAME COLUMN "autogreet" TO "create_greeting";--> statement-breakpoint
ALTER TABLE "verify_settings" ALTER COLUMN "welcome_channel" DROP NOT NULL;--> statement-breakpoint
ALTER TABLE "verify_settings" ADD COLUMN "type" varchar NOT NULL DEFAULT 'message';
1 change: 1 addition & 0 deletions drizzle/0006_abnormal_red_hulk.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "verify_settings" RENAME COLUMN "welcome_channel" TO "new_user_channel";
1 change: 1 addition & 0 deletions drizzle/0007_lame_tusk.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "verify_settings" ALTER COLUMN "type" SET DEFAULT 'message';
Empty file added drizzle/0008_clumsy_loki.sql
Empty file.
4 changes: 4 additions & 0 deletions drizzle/0009_organic_scourge.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREATE TABLE IF NOT EXISTS "hall_of_fame" (
"gid" varchar PRIMARY KEY NOT NULL,
"halls" text[] DEFAULT '{}'::text[] NOT NULL
);
141 changes: 141 additions & 0 deletions drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"id": "6ff4997c-f83b-41a8-b801-91e3a290d154",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.channel_settings": {
"name": "channel_settings",
"schema": "",
"columns": {
"gid": {
"name": "gid",
"type": "varchar",
"primaryKey": true,
"notNull": true
},
"media_only": {
"name": "media_only",
"type": "text[]",
"primaryKey": false,
"notNull": true
},
"exempted_roles": {
"name": "exempted_roles",
"type": "text[]",
"primaryKey": false,
"notNull": true,
"default": "'{}'::text[]"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"public.log_settings": {
"name": "log_settings",
"schema": "",
"columns": {
"gid": {
"name": "gid",
"type": "varchar",
"primaryKey": true,
"notNull": true
},
"t_log_ch": {
"name": "t_log_ch",
"type": "varchar",
"primaryKey": false,
"notNull": false
},
"i_log_ch": {
"name": "i_log_ch",
"type": "varchar",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"public.verify_entry": {
"name": "verify_entry",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"gid": {
"name": "gid",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"uid": {
"name": "uid",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"nick": {
"name": "nick",
"type": "varchar(32)",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"public.verify_settings": {
"name": "verify_settings",
"schema": "",
"columns": {
"gid": {
"name": "gid",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"join_ch": {
"name": "join_ch",
"type": "varchar",
"primaryKey": false,
"notNull": true
},
"roles": {
"name": "roles",
"type": "text[]",
"primaryKey": false,
"notNull": true
},
"autogreet": {
"name": "autogreet",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
Loading

0 comments on commit 4e2b081

Please sign in to comment.