feat: Initial commit

This commit is contained in:
Pazaz committed 2024-07-01 02:13:45 -04:00
commit d7b1d69a8b
1160 files changed
+35708

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
data/*
prisma/*
public/*
ref/*
view/*
src/3rdparty/*
+101
View File
@@ -0,0 +1,101 @@
/**
* TODO: Use flat config file as eslintrc is deprecated.
* https://eslint.org/docs/latest/use/configure/configuration-files
*/
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
overrides: [
{
env: {
node: true,
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script'
}
},
{
files: ['src/**/*.test.ts'],
extends: ['plugin:vitest/legacy-recommended'],
plugins: ['vitest'],
rules: {
'vitest/no-focused-tests': 'error',
'vitest/no-disabled-tests': 'warn',
'vitest/consistent-test-it': 'warn',
'vitest/require-top-level-describe': [
'error',
{
'maxNumberOfTopLevelDescribes': 1
}
]
}
}
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: ['@typescript-eslint', 'unused-imports'],
rules: {
indent: ['error', 4, { SwitchCase: 1 }],
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'always'],
/**
* https://eslint.org/docs/latest/rules/no-constant-condition#checkloops
*
* Allows constant conditions in loops but not in if statements
*/
'no-constant-condition': ['error', { checkLoops: false }],
/**
* (jkm) this rule is included in the default ruleset, we should consider
* resolving the issues and setting it to error
* https://eslint.org/docs/latest/rules/no-case-declarations
*/
'no-case-declarations': 'warn',
/**
* (jkm)
* The following rules are included in @typescript-eslint/recommended
* I have set them to warn instead of error, to avoid having to fix them
* We should consider fixing them and setting them to error
*/
'@typescript-eslint/no-namespace': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
/**
* https://eslint.org/docs/latest/rules/no-unused-vars
*/
'@typescript-eslint/no-unused-vars': [
// TODO: Set to error
'warn',
{
/**
* Allow variables prefixed with underscores to skip this rule.
* There aren't many good reasons to have unused variables,
* but the codebase has 100s of them.
*/
'vars': 'all',
'varsIgnorePattern': '^_',
/**
* Allow parameters prefixed with underscores to skip this rule.
* This is a common practice for router methods with req and res parameters.
*/
'args': 'all',
'argsIgnorePattern': '^_',
}
],
/**
* https://github.com/sweepline/eslint-plugin-unused-imports
*/
'unused-imports/no-unused-imports': 'error',
}
};
+19
View File
@@ -0,0 +1,19 @@
* text=auto
*.js text
*.ts text
*.jpg binary
*.png binary
*.gif binary
*.zip binary
*.ico binary
*.sf2 binary
*.wasm binary
*.mid binary
*.ob2 binary
*.base binary
*.frame binary
*.synth binary
+26
View File
@@ -0,0 +1,26 @@
out/
.env
package-lock.json
tsconfig.tsbuildinfo
node_modules/
# coverage reports
coverage/
# intellij
.idea/
# these are artifacts generated from other repos
public/loader.jar
public/runescape*.jar
public/downloads/LostCityInstaller.msi
### Windows ###
Thumbs.db
[Dd]esktop.ini
*.lnk
### macOS ###
.DS_Store
._*
+17
View File
@@ -0,0 +1,17 @@
# Handle Github Desktop bug on Windows
# https://github.com/typicode/husky/issues/1072
if [ "$OS" = "Windows_NT" ]; then
npx.cmd --no -- @commitlint/cli --edit $1
exit 0
fi
case "$(uname)" in
# Handle Github Desktop bug on Windows systems with WSL installed
# https://github.com/desktop/desktop/issues/12562
*CYGWIN* | *MINGW* | *MSYS*)
npx.cmd --no -- @commitlint/cli --edit $1
;;
*)
npx --no -- @commitlint/cli --edit $1
;;
esac
+17
View File
@@ -0,0 +1,17 @@
# Handle Github Desktop bug on Windows
# https://github.com/typicode/husky/issues/1072
if [ "$OS" = "Windows_NT" ]; then
npx.cmd lint-staged --verbose
exit 0
fi
case "$(uname)" in
# Handle Github Desktop bug on Windows systems with WSL installed
# https://github.com/desktop/desktop/issues/12562
*CYGWIN* | *MINGW* | *MSYS*)
npx.cmd lint-staged --verbose
;;
*)
npx lint-staged --verbose
;;
esac
+8
View File
@@ -0,0 +1,8 @@
data/*
prisma/*
public/*
view/*
*.json
*.yml
*.md
+11
View File
@@ -0,0 +1,11 @@
{
"printWidth": 250,
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"trailingComma": "none",
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "auto"
}
+14
View File
@@ -0,0 +1,14 @@
import { RuleConfigSeverity, type UserConfig } from '@commitlint/types';
/**
* https://commitlint.js.org/reference/configuration.html
*/
const Configuration: UserConfig = {
extends: ['@commitlint/config-conventional'],
formatter: '@commitlint/format',
rules: {
'subject-case': [RuleConfigSeverity.Disabled, 'always', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']],
}
};
export default Configuration;
+15
View File
@@ -0,0 +1,15 @@
[
{
"id": 1,
"region": "Central USA",
"address": "https://w1.225.2004scape.org",
"portOffset": 0
},
{
"id": 2,
"region": "Central USA",
"address": "https://w2.225.2004scape.org",
"members": true,
"portOffset": 3
}
]
+6
View File
@@ -0,0 +1,6 @@
{
"ignore": ["node_modules", "data", "dump"],
"watch": ["src"],
"exec": "node --import @swc-node/register/esm-register --enable-source-maps --no-warnings",
"ext": "ts,js,json"
}
+71
View File
@@ -0,0 +1,71 @@
{
"name": "2004scape-website",
"version": "1.0.0",
"type": "module",
"imports": {
"#jagex2/*": "./src/jagex/*",
"#lostcity/*": "./src/lostcity/*"
},
"scripts": {
"start": "npm i && npm run ts-loader src/lostcity/app.ts",
"ts-loader": "node --import @swc-node/register/esm-register --enable-source-maps --no-warnings"
},
"lint-staged": {
"package.json": "sort-package-json",
"*.{js,ts}": [
"npm run lint:staged",
"leasot --skip-unsupported --exit-nicely"
]
},
"dependencies": {
"@fastify/cookie": "^9.3.1",
"@fastify/cors": "^9.0.1",
"@fastify/formbody": "^7.4.0",
"@fastify/multipart": "^8.2.0",
"@fastify/session": "^10.8.0",
"@fastify/static": "^7.0.4",
"@fastify/view": "^9.1.0",
"@types/node-forge": "^1.3.11",
"bcrypt": "^5.1.1",
"dotenv": "^16.4.5",
"ejs": "^3.1.10",
"fastify": "^4.27.0",
"kleur": "^4.1.5",
"kysely": "^0.27.3",
"mysql2": "^3.9.7",
"node-forge": "^1.3.1"
},
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@commitlint/types": "^19.0.3",
"@swc-node/register": "1.9.0",
"@swc/core": "1.5.7",
"@swc/helpers": "^0.5.11",
"@types/bcrypt": "^5.0.2",
"@types/ejs": "^3.1.5",
"@types/eslint": "^8.56.10",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"eslint": "^8.57.0",
"eslint-plugin-unused-imports": "^3.2.0",
"eslint-plugin-vitest": "^0.5.4",
"husky": "^9.0.11",
"leasot": "^13.3.0",
"lint-staged": "^15.2.2",
"nodemon": "^3.1.0",
"prettier": "3.2.5",
"prisma": "^5.14.0",
"prisma-kysely": "^1.8.0",
"sort-package-json": "^2.10.0",
"tinybench": "^2.8.0",
"typescript": "^5.4.5",
"vitest": "^1.6.0"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.9.5"
},
"prisma": {
"seed": "npm run ts-loader src/lostcity/db/seed.ts"
}
}
@@ -0,0 +1,11 @@
-- CreateTable
CREATE TABLE `account` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`username` VARCHAR(191) NOT NULL,
`password` VARCHAR(191) NOT NULL,
`registration_ip` VARCHAR(191) NULL,
`registration_date` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
UNIQUE INDEX `account_username_key`(`username`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@@ -0,0 +1,19 @@
-- CreateTable
CREATE TABLE `newspost` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`category_id` INTEGER NOT NULL,
`title` TINYTEXT NOT NULL,
`content` TEXT NOT NULL,
`date` DATETIME(3) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `newspost_category` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(191) NOT NULL,
`style` VARCHAR(191) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@@ -0,0 +1,9 @@
-- CreateTable
CREATE TABLE `npc_hiscore` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`npc_id` INTEGER NOT NULL,
`account_id` INTEGER NOT NULL,
`kill_count` INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@@ -0,0 +1,15 @@
-- CreateTable
CREATE TABLE `friendlist` (
`account_id` INTEGER NOT NULL,
`friend_account_id` INTEGER NOT NULL,
PRIMARY KEY (`account_id`, `friend_account_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `ignorelist` (
`account_id` INTEGER NOT NULL,
`ignore_account_id` INTEGER NOT NULL,
PRIMARY KEY (`account_id`, `ignore_account_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@@ -0,0 +1,20 @@
-- CreateTable
CREATE TABLE `public_chat` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`account_id` INTEGER NOT NULL,
`message` VARCHAR(191) NOT NULL,
`date` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `private_chat` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`from_account_id` INTEGER NOT NULL,
`to_account_id` INTEGER NOT NULL,
`message` VARCHAR(191) NOT NULL,
`date` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE `newspost` ADD COLUMN `updated` DATETIME(3) NULL DEFAULT CURRENT_TIMESTAMP(3),
MODIFY `date` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3);
+3
View File
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "mysql"
+79
View File
@@ -0,0 +1,79 @@
generator kysely {
provider = "prisma-kysely"
output = "../src/lostcity/db"
fileName = "types.ts"
enumFileName = "enums.ts"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model account {
id Int @id @default(autoincrement())
username String @unique
password String
registration_ip String?
registration_date DateTime @default(now())
}
model newspost {
id Int @id @default(autoincrement())
category_id Int
title String @db.TinyText
content String @db.Text
date DateTime @default(now())
updated DateTime? @default(now()) @updatedAt
}
model newspost_category {
id Int @id @default(autoincrement())
name String
// css style class
style String
}
model npc_hiscore {
id Int @id @default(autoincrement())
npc_id Int
account_id Int
kill_count Int @default(0)
}
model friendlist {
account_id Int
friend_account_id Int
@@id([account_id, friend_account_id])
}
model ignorelist {
account_id Int
ignore_account_id Int
@@id([account_id, ignore_account_id])
}
model public_chat {
id Int @id @default(autoincrement())
account_id Int
message String
date DateTime @default(now())
}
model private_chat {
id Int @id @default(autoincrement())
from_account_id Int
to_account_id Int
message String
date DateTime @default(now())
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 854 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Loaded 100 of 1160 files, more files were not shown because too many files have changed in this diff. Show more