Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed May 29, 2022
0 parents commit 6220f12
Show file tree
Hide file tree
Showing 151 changed files with 59,902 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage:
range: '75...100'
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 2
95 changes: 95 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
### GLOBAL VARIABLES ###

# If !false, Next's bundle(s) will be analyzed and report files generated
ANALYZE=false

# This will overwrite the NODE_ENV setting during runtime and for the compiled
# applications.
#
# Recognized values: test development production
# Default value: empty
NODE_ENV=

# MongoDB connect URI. Specify auth credentials if necessary. YOU MUST *NOT*
# SPECIFY A DATABASE AT THE END!
MONGODB_URI=mongodb://127.0.0.1:27017

# Dedicated port to be used by the MongoDB Memory Server during unit tests.
# Especially useful when stepping through code, since you can always access the
# db at `mongodb://127.0.0.1:MONGODB_MS_PORT` when the debugger is paused.
# Tip: call `jest.setTimeout()` with a large number (i.e. 10**6) to ensure the
# MongoClient isn't closed randomly leading to strange errors.
#
# Leave this blank to choose any random port (not recommended). Note: this
# option is also used when Node is started in debug mode, e.g. `node
# --inspect-brk` or `node --debug`.
MONGODB_MS_PORT=6666

# Determines the maximum allowed character length of an *entire* HTTP
# Authorization header. The default is 500.
AUTH_HEADER_MAX_LENGTH=500

# Controls which versions of the API will respond to requests. Examples (disable
# v1; disable v1 and v2; disable v3, v5, and v7):
# DISABLED_API_VERSIONS=1
# DISABLED_API_VERSIONS=1,2
# DISABLED_API_VERSIONS=3,5,7
#
# Note that `DISABLED_API_VERSIONS=` (i.e. empty) means no
# versions are disabled!
DISABLED_API_VERSIONS=

# Determines the number of items returned by paginated endpoints
RESULTS_PER_PAGE=100

# If !false, all rate limits and exponential soft banning will be ignored
IGNORE_RATE_LIMITS=false

# If !false, no one will be able to use the API
LOCKOUT_ALL_CLIENTS=false

# Controls what request methods are allowed. Empty means all are allowed
# (default).
#
# Example, to make API read-only:
# DISALLOWED_METHODS=POST,PUT
DISALLOWED_METHODS=

# Maximum allowed size of a request body (and content-length header value) in
# bytes. Should be a string like 1kb, 1mb, 500b
MAX_CONTENT_LENGTH_BYTES=100kb

### EXTERNAL SCRIPT VARIABLES ###
# (optional unless using the relevant external script)

# How often this script is going to be invoked. This doesn't determine anything
# automatically on its own, this is useful to ensure the script works no matter
# how often you decide to call it.
BAN_HAMMER_WILL_BE_CALLED_EVERY_SECONDS=60

# The maximum number of requests per BAN_HAMMER_RESOLUTION_WINDOW_SECONDS
# allowed by a single client.
BAN_HAMMER_MAX_REQUESTS_PER_WINDOW=100

# How far back into the past this script looks when checking a key or ip against
# BAN_HAMMER_MAX_REQUESTS_PER_WINDOW.
BAN_HAMMER_RESOLUTION_WINDOW_SECONDS=1

# The initial amount of time an offender is banned.
BAN_HAMMER_DEFAULT_BAN_TIME_MINUTES=5

# When an offender is banned twice in the same "period," they're banned for
# BAN_HAMMER_DEFAULT_BAN_TIME_MINUTES * BAN_HAMMER_RECIDIVISM_PUNISH_MULTIPLIER
# minutes instead of the default. This is also the length of the "period".
BAN_HAMMER_RECIDIVISM_PUNISH_MULTIPLIER=4

# The size of the request-log collection will not be allowed to exceed this
# amount. Oldest entries are deleted first.
PRUNE_DATA_MAX_LOGS=200000

# The size of the limited-log collection will not be allowed to exceed
# this amount. Oldest entries are deleted first.
PRUNE_DATA_MAX_BANNED=100000

### TOOLS FRONTEND VARIABLES ###
# (optional unless using tools)
150 changes: 150 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
'use strict';

const debug = require('debug')(`${require('./package.json').name}:eslint-config`);
const restrictedGlobals = require('confusing-browser-globals');

module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['jest', 'jest-dom', '@typescript-eslint', 'import'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@next/next/recommended'
],
parserOptions: {
ecmaVersion: 8,
sourceType: 'module',
ecmaFeatures: {
impliedStrict: true,
experimentalObjectRestSpread: true,
jsx: true
},
extraFileExtensions: ['.mjs', '.cjs'],
project: 'tsconfig.eslint.json'
},
env: {
es6: true,
node: true,
jest: true,
'jest/globals': true,
browser: true,
webextensions: true
},
rules: {
'no-console': 'warn',
'no-return-await': 'warn',
'no-await-in-loop': 'warn',
'import/no-unresolved': [
'error',
{
commonjs: true
}
],
'no-restricted-globals': ['warn'].concat(restrictedGlobals),
'no-extra-boolean-cast': 'off',
'no-empty': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/prefer-ts-expect-error': 'warn',
'@typescript-eslint/no-floating-promises': [
'error',
{ ignoreVoid: true, ignoreIIFE: true }
],
'@typescript-eslint/ban-ts-comment': [
'warn',
{
'ts-expect-error': 'allow-with-description',
minimumDescriptionLength: 6
}
],
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_+',
varsIgnorePattern: '^_+',
caughtErrorsIgnorePattern: '^ignored?\\d*$',
caughtErrors: 'all'
}
],
// ? Ever since v4, we will rely on TypeScript to catch these
'no-undef': 'off',
'@typescript-eslint/no-var-requires': 'off',
'no-unused-vars': 'off',
// ? Broken as of next 12.0.7
'@next/next/no-page-custom-font': 'off'
},
overrides: [
{
files: ['*.test.*'],
extends: ['plugin:jest/all', 'plugin:jest/style', 'plugin:jest-dom/recommended'],
rules: {
'jest/lowercase': 'off',
'jest/consistent-test-it': 'off',
'jest/require-top-level-describe': 'off',
'jest/valid-describe': 'off',
'jest/no-hooks': 'off',
'jest/require-to-throw-message': 'off',
'jest/prefer-called-with': 'off',
'jest/prefer-spy-on': 'off',
'jest/no-if': 'off',
'jest/no-disabled-tests': 'warn',
'jest/no-commented-out-tests': 'warn',
'jest/require-hook': 'off',
'jest/no-alias-methods': 'off',
'jest/no-conditional-in-test': 'off'
}
}
],
settings: {
react: {
version: 'detect'
},
'import/extensions': ['.ts', '.tsx', '.js', '.jsx'],
// ? Switch parsers depending on which type of file we're looking at
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
'babel-eslint': ['.js', '.jsx']
},
'import/resolver': {
alias: {
map: [
// ! If changed, also update these aliases in tsconfig.json,
// ! webpack.config.js, next.config.ts, and jest.config.js
['universe', './src'],
['multiverse', './lib'],
['testverse', './test'],
['externals', './external-scripts'],
['types', './types'],
['package', './package.json'],
// ? These are used at various points (including at compile time by
// ? Next.js) to get mongo schema configuration and/or test dummy data.
// ! Must be defined if using @xunnamius/mongo-schema
['configverse/get-schema-config', './src/backend/db.ts'],
// ! Must be defined if using @xunnamius/mongo-test
['configverse/get-dummy-data', './test/db.ts']
],
extensions: ['.js', '.jsx', '.ts', '.tsx']
},
typescript: {}
},
'import/ignore': [
// ? Don't go complaining about anything that we don't own
'.*/node_modules/.*',
'.*/bin/.*'
]
},
ignorePatterns: ['coverage', 'dist', 'bin', 'build', '/next.config.js'],
globals: {
page: true,
browser: true,
context: true,
jestPuppeteer: true
}
};

debug('exports: %O', module.exports);
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# See https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-code-owners

* @Xunnamius
82 changes: 82 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and
expression, level of experience, education, socioeconomic status, nationality,
personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- Racism or sexism in any shape or form
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at
[[email protected]][1]. All complaints will be reviewed and
investigated and will result in a response that is deemed necessary and
appropriate to the circumstances. The project team is obligated to maintain
confidentiality with regard to the reporter of an incident. Further details of
specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at
[https://www.contributor-covenant.org/version/1/4/code-of-conduct.html][2]

For answers to common questions about this code of conduct, see
[https://www.contributor-covenant.org/faq][3]

[homepage]: https://www.contributor-covenant.org
[1]: mailto:[email protected]
[2]: https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[3]: https://www.contributor-covenant.org/faq
Loading

0 comments on commit 6220f12

Please sign in to comment.