diff --git a/application/.gitignore b/.gitignore similarity index 100% rename from application/.gitignore rename to .gitignore diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..0c8c0824 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + diff --git a/application/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md similarity index 100% rename from application/CODE_OF_CONDUCT.md rename to CODE_OF_CONDUCT.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..4cc59902 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# Tornium +**Tornium** is a third-party, general purpose website and Discord bot dedicated to simplifying the playing of [Torn City](https://torn.com) built from scratch with love <3. + +More information about how to use the site, set up a Discord bot, etc. can be found in the [documentation](https://docs.tornium.com). If you need any help, join the [support server](https://discord.gg/pPcqTRTRyF). + +## Supported Features +- Discord user verification +- User stat estimation +- Chain list generation +- Faction banking (via Discord) +- Discord stakeout notifications +- And more!! + +## Installation +Installation is not currently documented, but should be mostly straightforward. Ask in the support server if you have any questions/issues installing it. + +## Contributing +Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. + +All commits must be signed with a Signed-off-by line in the commit description matching the commit author. This certifies (under the Developer Certificate of Origin) that you have written the code or have the right to submit the code to the project. Full details can be found at https://developercertificate.org/. + +## Donating +Donations are accepted with both real life money and in-game money. However, due to restrictions with Torn's RMT rules, donors using real life money should NOT expect anything (e.g. additional features, support, etc.) from their contributions. Contributions with real life money will go towards server costs (and other hosting costs). + +Donate to https://www.buymeacoffee.com/tornium via buymeacoffee! + +## License +Most of Tornium is licensed under [AGPLv3](https://www.gnu.org/licenses/agpl-3.0.en.html), however sections may have different licensing. Be sure to read the `LICENSE` files in the various root directories and the license headers within the respective files. diff --git a/application/CHANGELOG.md b/application/CHANGELOG.md deleted file mode 100644 index 4a6760cf..00000000 --- a/application/CHANGELOG.md +++ /dev/null @@ -1,146 +0,0 @@ -# Changelog - -All notable changes to all core projects (https://github.com/dssecret/tornium-pro[tornium], https://github.com/Tornium/tornium-celery[tornium-celery], and http://github.com/Tornium/tornium-commons[tornium-commons]) will be documented in this file. - -The format is based on https://keepachangelog.com/en/1.0.0/[Keep a Changelog], -and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Versioning]. - -## [UNRELEASED] - -### Added - -- Added stocks data under the Torn section -- Added support for OC initiated result messages -- Added DM message to OC delayers -- Added faction tag support to verification template -- Added item price/quantity notifications -- Added security notification via Discord upon new log in -- [SECURITY] Added Discord SSO -- Added NAPs status under stakeout info -- Added faction member person stat reports -- Added leaving hospital stakeouts (#172) -- Added armory stock tracking -- [ADMIN] Added option for admin accounts to view other user accounts -- [tornium-core] Added global caching support to Flask endpoints -- [tornium-core] Added Discord thread support to channel selectors - -### Change - -- Changed chain list generator UI and backend to improve UI/UX and performance -- [tornium-commons] Changed DBuckets to be in more compliance with the Discord documentation -- Changed API key storage to occur in a separate database - -### Fixed - -- Fixed MIME type of certain API endpoints (#178) -- [SECURITY] Fixed 2FA configuration -- Fixed flashing of Tornium logo on load -- [SECURITY] Fixed `next` session parameter being retained after sign-in - -### Removed - -- Removed AttackModel and related endpoints -- Removed deprecated stakeouts - -## 0.3.1 - May 3, 2023 - -### Added - -- [dev] Added pre-commit support -- [tornium-commons] Added docstrings -- [tornium-commons] Added Discord rateliming buckets -- [tornium-commons] Added support for Redis Lua scripts -- [dev] Added prettier support -- Added next support via session for authentication -- [in-prog] Added frontend support for stocks notifications - -### Changed - -- [tornium-celery] Changed Discord ratelimiting to use Discord buckets that follow spec - -### Deprecated - -- Deprecated assist request forwarding options (to be removed in the v0.5.x release cycle) -- Deprecated AttackModel and related endpoints (to be removed in the v0.4.x release cycle) - -### Fixed - -- Fixed OD logger enable/disable configuration - -## 0.3.0 - Mar 17, 2023 - -### Added - -- Migrated config to use `utils.config.Config` from `settings.py` (#117) -- Added `user.fetch_attacks_runner` and `user.stat_db_attacks_user` -- Added auto-cancellation of vault withdrawals -- Added color theme support -- Added account settings endpoint -- Added TOTP support -- Added /faction member slash commands to Skynet -- Added support for stakeouts rework - -### Changed - -- Changed `/stats/db` to allow unauthenticated users -- Change Tornium to split into three projects -- [tornium-celery] Changed `tasks.api.#` tasks to support gevent -- [tornium-celery] Changed `tasks.api.#` tasks to decrease redis usage - -### Deprecated - -- Deprecated pre-existing stakeouts (to be removed in the v0.4.x release cycle) - -### Fixed - -- Fixed Tox CI runs (due to broken dependency installation) -- Fixed `bot/verify` when `user` is None - -### Removed - -- [tornium-celery] Removed `autosleep` parameter from `tasks.api.tornget` and `tasks.api.torn_stats_get` - -## 0.2.0 - Feb 14, 2023 - -### Added - -- Added attack saving into DB via AttackModel -- Added personal stat model -- Added personal stat model creation to user.update_user -- Added additional columns to `torn/user` -- Added personal stat table to `torn/user` -- Added automatic channel/role removal upon fail (#108) -- Added support to cancel last request via `/cancel` -- Added support for Tornium Flask extensions (no slash commands) -- Added `bs_to_range` utility function -- Added `overflow-x` to DataTables -- Added `pyproject.toml` support - -### Changed - -- Changed chain list generator to use algorithm found in the Discord command -- Changed chain list generator UI -- Changed CHANGELOG.adoc to use https://keepachangelog.com/en/1.0.0/[Keep a Changelog] formatting -- Changed TickModel to use bulk insert in `tasks.stocks.fetch_stock_ticks` -- Changed `StatModel` to use `ObjectID` as primary key instead of incrementing ID -- Changed Flask app to utilize factory - -### Fixed - -- Fixed timestamp sorting in `stat/db.js` and `stat/list.js` -- Fixed invoker not set in @invoker_exists (#109) -- Fixed variance and FF check in `/api/stat` -- Fixed chain list generator sorting (#35) -- Fixed `bot/verify` multi-line embed (#110) -- Fixed removed/deleted guilds remaining in database (#112) -- Fixed cancel buttons on withdrawal requests (#115) - -### Removed - -- Removed `faction/armory` endpoints -- Removed ddtrace required dependency (now optional) -- Removed admin endpoints - -## 0.1.0 - Jan 26, 2023 - -- Added all pre-existing features diff --git a/application/README.md b/application/README.md deleted file mode 100644 index 103bc42b..00000000 --- a/application/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# Tornium - -A third party, general-purpose website and Discord bot dedicated to simplifying the playing of (https://www.torn.com)[Torn City] built from scratch with love <3. - -Tornium is split into three main repositories: - -- [https://www.github.com/Tornium/tornium-core](tornium-core) - Flask app for frontend and Discord bot -- [https://www.github.com/Tornium/tornium-celery](tornium-celery) - Celery app containing Celery tasks and configuration -- [https://www.github.com/Tornium/tornium-commons](tornium-commons) - common utility functions and classes for Tornium -- Plus several features built on Tornium extensions - -## Features - -- Faction banking -- OD detection -- Discord-based retaliation notifications -- Discord-based OC ready and delay notifications -- Discord-based stakeouts -- Discord-based user verification -- Discord-based stock verification -- Stat database -- Chain list generator -- And more!! - -## Installation - -Not yet documented. - -### Optional packages - -Tornium can be run without all of the below optional packages, but will auto-detect installation and run with those packages if they are installed. - -- ddtrace - for monitoring of the flask and celery instances -- orjson - for increased performance in encoding and decoding of JSON in all API calls - -## Tornium Extensions - -Tornium partially supports extensions for new Discord commands and new Flask endpoints (with no support for Celery tasks currently). However, over-writing pre-existing commands and endpoints is not supported. A template for Tornium extensions can be found at [https://github.com/dssecret/tornium-extension-template](dssecret/tornium-extension-template). Extensions automatically install into Tornium upon start up of Tornium with auto-detection of extensions (must start with `tornium-`). For more information or if you find any issues, please open an issue in either repository. - -NOTE: Tornium extensions must be released as open source code under a GPLv3 or another GPL license due to the restrictions of the [https://github.com/dssecret/tornium-pro/blob/master/LICENSE](tornium license). For more details, take a look at [https://www.gnu.org/licenses/gpl-3.0.en.html](GPL website). - -## License - -Tornium repositories are licensed under [https://github.com/dssecret/tornium-pro/blob/master/LICENSE](AGPLv3). For information about how the AGPL license affects you, please take a look at the [https://www.gnu.org/licenses/agpl-3.0.en.html](GNU website). - -## Release Notes - -This project follows [https://semver.org/](semver v2.0) so all bug fixes, breaking changes, features, etc. can be found in the [https://github.com/dssecret/tornium-pro/blob/master/CHANGELOG.adoc](changelog). - -## Contributing to Tornium - -All commits must be signed with a `Signed-off-by` line in the commit description matching the commit author. This certifies (under the Developer Certificate of Origin) that you have written the code or have the right to submit the code to the project. Full details can be found [https://developercertificate.org/](here). - -## Donations - -Donations are accepted with both real life money and in-game money. However, due to restrictions with -Torn's RMT rules, donors using real life money should NOT expect anything (e.g. additional features, -support, etc.) from their contributions. Contributions with real life money will go towards -server costs (and other hosting costs). - -Donate [https://www.buymeacoffee.com/tornium](here) via buymeacoffee! - -== Contact - -- tiksan on Discord at @tiksan -- tiksan on Torn at [https://www.torn.com/profiles.php?XID=2383326](tiksan [2383326\]) diff --git a/application/SECURITY.md b/application/SECURITY.md deleted file mode 100644 index 7ceca089..00000000 --- a/application/SECURITY.md +++ /dev/null @@ -1,8 +0,0 @@ -# Security Policy - -If there are any vulnerabilities in Tornium, please report them as soon as possible. - -1. Contact the developer directly via email at security (at) tornium.com or via Discord at [tiksan#9110](https://discordapp.com/users/695828257949352028). -2. Describe the vulnerability. If you have a fix, feel free to include it in the message. -3. The vulnerability will be evaluated and a fix will be released to address it if necessary. -4. Once a fix is released or if the vulnerability is not addressed within 30 days, you are free to disclose the vulnerability. Otherwise, please do not disclose the vulnerability until a fix is released. diff --git a/celery/CODE_OF_CONDUCT.adoc b/celery/CODE_OF_CONDUCT.adoc deleted file mode 100644 index 29ce91df..00000000 --- a/celery/CODE_OF_CONDUCT.adoc +++ /dev/null @@ -1,126 +0,0 @@ -= Contributor Covenant Code of Conduct - -== Our Pledge - -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, caste, color, religion, or sexual -identity and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -== Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the overall - community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or advances of - any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email address, - without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -== Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders 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, and will communicate reasons for moderation -decisions when appropriate. - -== Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -== Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -dssecret#9110 on Discord. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -== Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -=== 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -=== 2. Warning - -**Community Impact**: A violation through a single incident or series of -actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or permanent -ban. - -=== 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -=== 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within the -community. - -== Attribution - -This Code of Conduct is adapted from the Contributor Covenant, -version 2.1, available at -https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. - -Community Impact Guidelines were inspired by -Mozilla's code of conduct enforcement ladder. - -For answers to common questions about this code of conduct, see the FAQ at -https://www.contributor-covenant.org/faq. Translations are available at -https://www.contributor-covenant.org/translations. \ No newline at end of file diff --git a/celery/README.adoc b/celery/README.adoc deleted file mode 100644 index e69de29b..00000000 diff --git a/celery/tox.ini b/celery/tox.ini deleted file mode 100644 index b559f7fc..00000000 --- a/celery/tox.ini +++ /dev/null @@ -1,69 +0,0 @@ -[tox] -envlist = - py{38},bandit,format,lint -skipsdist = true -isolated_build = true - -[gh-actions] -python = - 3.8: py38 - -[testenv] -skip_install = true -deps = -e .[ci] -commands = - black --line-length 120 --check . - flake8 --max-line-length 120 . - bandit --ini tox.ini -r . - -[testenv:format] -skip_install = true -deps = - black -commands = black --line-length 120 . -allowlist_externals = black - -[testenv:lint] -skip_install = true -deps = - flake8 -commands = flake8 --max-line-length 120 . -allowlist_externals = flake8 - -[testenv:bandit] -skip_install = true -deps = - bandit -commands = bandit --ini tox.ini -r . -allowlist_externals = bandit - -[testenv:isort] -skip_install = true -deps = - isort -commands = isort --line-length 120 --check-only --diff . -allowlist_externals = isort - -[bandit] -exclude = ./.tox,.git,__pycache__,./venv -skips = B201,B311,B112 - -[flake8] -exclude = ./.tox,./.git,__pycache__,./venv -max-line-length = 120 -extend-ignore = - # E203: Black autoformatting - E203, - # E266: multiple # in comment - E266, - # E402: invocation of ddtrace and other packages before normal packages - E402, - # E501: line too long - E501, - # F401: ? - F401, - # E712: peewee query (? == True) - E712 - -[black] -line-length = 120 diff --git a/commons/CODE_OF_CONDUCT.adoc b/commons/CODE_OF_CONDUCT.adoc deleted file mode 100644 index 29ce91df..00000000 --- a/commons/CODE_OF_CONDUCT.adoc +++ /dev/null @@ -1,126 +0,0 @@ -= Contributor Covenant Code of Conduct - -== Our Pledge - -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, caste, color, religion, or sexual -identity and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -== Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the overall - community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or advances of - any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email address, - without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -== Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders 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, and will communicate reasons for moderation -decisions when appropriate. - -== Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -== Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -dssecret#9110 on Discord. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -== Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -=== 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -=== 2. Warning - -**Community Impact**: A violation through a single incident or series of -actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or permanent -ban. - -=== 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -=== 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within the -community. - -== Attribution - -This Code of Conduct is adapted from the Contributor Covenant, -version 2.1, available at -https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. - -Community Impact Guidelines were inspired by -Mozilla's code of conduct enforcement ladder. - -For answers to common questions about this code of conduct, see the FAQ at -https://www.contributor-covenant.org/faq. Translations are available at -https://www.contributor-covenant.org/translations. \ No newline at end of file diff --git a/commons/README.adoc b/commons/README.adoc deleted file mode 100644 index e69de29b..00000000 diff --git a/commons/SECURITY.md b/commons/SECURITY.md deleted file mode 100644 index 7ceca089..00000000 --- a/commons/SECURITY.md +++ /dev/null @@ -1,8 +0,0 @@ -# Security Policy - -If there are any vulnerabilities in Tornium, please report them as soon as possible. - -1. Contact the developer directly via email at security (at) tornium.com or via Discord at [tiksan#9110](https://discordapp.com/users/695828257949352028). -2. Describe the vulnerability. If you have a fix, feel free to include it in the message. -3. The vulnerability will be evaluated and a fix will be released to address it if necessary. -4. Once a fix is released or if the vulnerability is not addressed within 30 days, you are free to disclose the vulnerability. Otherwise, please do not disclose the vulnerability until a fix is released.