diff --git a/.dockerignore b/.dockerignore
deleted file mode 100644
index 69e77963..00000000
--- a/.dockerignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.git/
-.github/
-types_/
-config.template.toml
-Dockerfile
-LICENSE
-migration.sql
-pyproject.toml
-README.md
diff --git a/.env.template b/.env.template
deleted file mode 100644
index 272b8279..00000000
--- a/.env.template
+++ /dev/null
@@ -1,2 +0,0 @@
-POSTGRES_USER=mystbin
-POSTGRES_PASSWORD=mystbin
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
deleted file mode 100644
index 901d5753..00000000
--- a/.github/CONTRIBUTING.md
+++ /dev/null
@@ -1,39 +0,0 @@
-## Contributing to Mystbin!
-
-First off, thanks for taking the time to contribute. It makes the service substantially better. :+1:
-
-The following is a set of guidelines for contributing to the repository. These are guidelines, not hard rules.
-
-## Good Bug Reports
-
-Please be aware of the following things when filing bug reports.
-
-1. Don't open duplicate issues. Please search your issue to see if it has been asked already. Duplicate issues will be closed.
-2. When filing a bug about exceptions or tracebacks, please include the *complete* traceback. Without the complete traceback the issue might be **unsolvable** and you will be asked to provide more information.
-3. Make sure to provide enough information to make the issue workable. The issue template will generally walk you through the process, but they are enumerated here as well:
- - A **summary** of your bug report. This is generally a quick sentence or two to describe the issue in human terms.
- - Guidance on **how to reproduce the issue**. Ideally, this should have a paste ID that allows us to run and see the issue for ourselves to debug. **Please make sure any of your tokens are not displayed**. If you cannot provide a paste ID, then let us know what the steps were, how often it happens, etc.
- - Tell us **what you expected to happen**. That way we can meet that expectation.
- - Tell us **what actually happens**. What ends up happening in reality? It's not helpful to say "it fails" or "it doesn't work". Say *how* it failed, do you get an error? Does it hang? How are the expectations different from reality?
- - Tell us **information about your environment**. What web browser(s) does this occur on, etc?
-
-If the bug report is missing this information then it'll take us longer to fix the issue. We will probably ask for clarification, and barring that if no response was given then the issue will be closed.
-
-## Submitting a Pull Request
-
-Submitting a pull request is fairly simple, just make sure it focuses on a single aspect and doesn't manage to have scope creep, and it's probably good to go. It would be incredibly lovely if the style is consistent to that found in the project. This project follows PEP-8 guidelines (mostly) with a column limit of 125.
-There are provided tool rules in `pyproject.toml` for `isort`, `black` and `pyright` when working on the backend side of things.
-There are rules provided for prettier when working on the frontend side of things.
-
-There are actions that run on new PRs and if those checks fail then the PR will not be accepted.
-
-NOTE: We do not provide `black` and `isort` in the requirements files for the backend. Feel free to install these yourself.
-
-### Git Commit Guidelines
-
-- Use present tense (e.g. "Add feature" not "Added feature")
-- Limit all lines to 72 characters or fewer.
-- Reference issues or pull requests outside the first line.
- - Please use the shorthand `#123` and not the full URL.
-
-If you do not meet any of these guidelines, don't fret. Chances are they will be fixed upon rebasing but please do try to meet them to remove some workload.
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
deleted file mode 100644
index c4927e4f..00000000
--- a/.github/FUNDING.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-github: [IAmTomahawkx, EvieePy, AbstractUmbra]
-ko_fi: AbstractUmbra
diff --git a/.github/workflows/build-echo.yaml b/.github/workflows/build-echo.yaml
new file mode 100644
index 00000000..ebaec5d1
--- /dev/null
+++ b/.github/workflows/build-echo.yaml
@@ -0,0 +1,26 @@
+name: build-echo
+
+on:
+ push:
+ branches:
+ - main
+ paths:
+ - echo/**
+ pull_request:
+ paths:
+ - echo/**
+
+jobs:
+ build:
+ runs-on: ubuntu-24.04
+ steps:
+ - name: set up buildx
+ uses: docker/setup-buildx-action@v3
+ - name: build and push
+ uses: docker/build-push-action@v6
+ with:
+ # push: true
+ tags: echo:latest
+ context: "{{defaultContext}}:echo"
+ env:
+ SOURCE_DATE_EPOCH: 0
diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml
deleted file mode 100644
index d6fb51ff..00000000
--- a/.github/workflows/build_and_push.yaml
+++ /dev/null
@@ -1,87 +0,0 @@
-# This workflow uses actions that are not certified by GitHub.
-# They are provided by a third-party and are governed by
-# separate terms of service, privacy policy, and support
-# documentation.
-
-# GitHub recommends pinning actions to a commit SHA.
-# To get a newer version, you will need to update the SHA.
-# You can also reference a tag or branch, but the action may change without warning.
-
-name: Create and publish a Docker image
-
-on:
- workflow_dispatch:
- push:
- branches:
- - main
- paths:
- - '**.html'
- - '**.css'
- - '**.js'
- - '**.py'
- - '**.toml'
- - '**.svg'
-
-concurrency:
- cancel-in-progress: true
- group: ci-${{ github.ref }}
-
-env:
- REGISTRY: ghcr.io
- IMAGE_NAME: ${{ github.repository }}
-
-jobs:
- build-and-push-image:
- runs-on: ubuntu-latest
- env:
- GIT_SHA: ${GITHUB_SHA::7}
- permissions:
- contents: read
- packages: write
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v3
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
-
- - name: Log in to the Container registry
- uses: docker/login-action@master
- with:
- registry: ${{ env.REGISTRY }}
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Extract metadata (tags, labels) for Docker
- id: meta
- uses: docker/metadata-action@master
- with:
- images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
-
- - name: Generate lowername image
- id: image-name
- run: |
- echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >> "${GITHUB_OUTPUT}"
- env:
- IMAGE_NAME: '${{ env.IMAGE_NAME }}'
-
- - name: Get short SHA
- id: slug
- run: echo "GIT_SHORT_SHA7=$(echo ${GITHUB_SHA} | cut -c1-7)" >> "$GITHUB_OUTPUT"
-
- - name: Build and push Docker image
- uses: docker/build-push-action@v5
- with:
- context: .
- push: true
- tags: |
- ${{ steps.meta.outputs.tags }}
- ghcr.io/${{ steps.image-name.outputs.IMAGE_NAME_LC }}:${{ steps.slug.outputs.GIT_SHORT_SHA7 }}
- ghcr.io/${{ steps.image-name.outputs.IMAGE_NAME_LC }}:latest
- labels: ${{ steps.meta.outputs.labels }}
diff --git a/.github/workflows/coverage_and_lint.yml b/.github/workflows/coverage_and_lint.yml
deleted file mode 100644
index 3b592a73..00000000
--- a/.github/workflows/coverage_and_lint.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-name: Type Coverage and Linting
-
-on:
- push:
- branches:
- - main
- pull_request:
- branches:
- - main
- types: [opened, reopened, synchronize]
-
-jobs:
- check:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- python-version: ["3.11", "3.x"]
-
- name: "Type Coverage and Linting @ ${{ matrix.python-version }}"
- steps:
- - name: "Checkout Repository"
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: "Setup Python @ ${{ matrix.python-version }}"
- id: setup-python
- uses: actions/setup-python@v4
- with:
- python-version: "${{ matrix.python-version }}"
- cache: "pip"
-
- - name: "Install Python deps @ ${{ matrix.python-version }}"
- id: install-deps
- run: |
- pip install -Ur requirements.txt
- - name: "Run Pyright @ ${{ matrix.python-version }}"
- uses: jakebailey/pyright-action@v1
- with:
- no-comments: ${{ matrix.python-version != '3.x' }}
- warnings: false
-
- - name: Lint with Ruff
- if: ${{ always() && steps.install-deps.outcome == 'success' }}
- uses: chartboost/ruff-action@v1
diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml
deleted file mode 100644
index a3151976..00000000
--- a/.github/workflows/deploy.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: Deploy
-
-on:
- workflow_run:
- workflows: ["Create and publish a Docker image"]
- branches: [main]
- types:
- - completed
-
-jobs:
- deploy:
- name: Deploy bot
- runs-on: ubuntu-latest
- steps:
- - name: Remote deploy
- uses: appleboy/ssh-action@master
- with:
- host: ${{ secrets.SSH_HOST }}
- key: ${{ secrets.SSH_KEY }}
- port: ${{ secrets.SSH_PORT }}
- script: |
- cd ~/mystbin
- git reset --hard HEAD || true
- git pull origin main
- docker compose --profile redis pull
- docker compose --profile redis up --build -d mystbin
- username: ${{ secrets.SSH_USER }}
diff --git a/.github/workflows/signoff.yaml b/.github/workflows/signoff.yaml
index e61a4b3d..29167d37 100644
--- a/.github/workflows/signoff.yaml
+++ b/.github/workflows/signoff.yaml
@@ -1,4 +1,5 @@
name: validate-signoff
+
on:
pull_request:
types:
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 8350ffdb..00000000
--- a/.gitignore
+++ /dev/null
@@ -1,164 +0,0 @@
-# Byte-compiled / optimized / DLL files
-__pycache__/
-*.py[cod]
-*$py.class
-
-# C extensions
-*.so
-
-# Distribution / packaging
-.Python
-build/
-develop-eggs/
-dist/
-downloads/
-eggs/
-.eggs/
-lib/
-lib64/
-parts/
-sdist/
-var/
-wheels/
-share/python-wheels/
-*.egg-info/
-.installed.cfg
-*.egg
-MANIFEST
-
-# PyInstaller
-# Usually these files are written by a python script from a template
-# before PyInstaller builds the exe, so as to inject date/other infos into it.
-*.manifest
-*.spec
-
-# Installer logs
-pip-log.txt
-pip-delete-this-directory.txt
-
-# Unit test / coverage reports
-htmlcov/
-.tox/
-.nox/
-.coverage
-.coverage.*
-.cache
-nosetests.xml
-coverage.xml
-*.cover
-*.py,cover
-.hypothesis/
-.pytest_cache/
-cover/
-
-# Translations
-*.mo
-*.pot
-
-# Django stuff:
-*.log
-local_settings.py
-db.sqlite3
-db.sqlite3-journal
-
-# Flask stuff:
-instance/
-.webassets-cache
-
-# Scrapy stuff:
-.scrapy
-
-# Sphinx documentation
-docs/_build/
-
-# PyBuilder
-.pybuilder/
-target/
-
-# Jupyter Notebook
-.ipynb_checkpoints
-
-# IPython
-profile_default/
-ipython_config.py
-
-# pyenv
-# For a library or package, you might want to ignore these files since the code is
-# intended to run in multiple environments; otherwise, check them in:
-# .python-version
-
-# pipenv
-# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
-# However, in case of collaboration, if having platform-specific dependencies or dependencies
-# having no cross-platform support, pipenv may install dependencies that don't work, or not
-# install all needed dependencies.
-#Pipfile.lock
-
-# poetry
-# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
-# This is especially recommended for binary packages to ensure reproducibility, and is more
-# commonly ignored for libraries.
-# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
-#poetry.lock
-
-# pdm
-# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
-#pdm.lock
-# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
-# in version control.
-# https://pdm.fming.dev/#use-with-ide
-.pdm.toml
-
-# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
-__pypackages__/
-
-# Celery stuff
-celerybeat-schedule
-celerybeat.pid
-
-# SageMath parsed files
-*.sage.py
-
-# Environments
-.env
-.venv
-env/
-venv/
-ENV/
-env.bak/
-venv.bak/
-
-# Spyder project settings
-.spyderproject
-.spyproject
-
-# Rope project settings
-.ropeproject
-
-# mkdocs documentation
-/site
-
-# mypy
-.mypy_cache/
-.dmypy.json
-dmypy.json
-
-# Pyre type checker
-.pyre/
-
-# pytype static type analyzer
-.pytype/
-
-# Cython debug symbols
-cython_debug/
-
-# PyCharm
-# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
-# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
-# and can be added to the global gitignore or merged into this file. For a more nuclear
-# option (not recommended) you can uncomment the following to ignore the entire idea folder.
-#.idea/
-
-# Config Files...
-config.toml
-.config.toml
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index ac8b63ea..00000000
--- a/Dockerfile
+++ /dev/null
@@ -1,26 +0,0 @@
-FROM python:3.12-slim
-
-LABEL org.opencontainers.image.source=https://github.com/pythonistaguild/mystbin
-LABEL org.opencontainers.image.description="Container for running MystB.in"
-LABEL org.opencontainers.image.licenses=GPLv3
-
-RUN mkdir -p /etc/apt/keyrings \
- && apt update -y \
- && apt-get install --no-install-recommends -y \
- # deps for building python deps
- git \
- build-essential \
- libcurl4-gnutls-dev \
- gnutls-dev \
- libmagic-dev \
- && rm -rf /var/lib/apt/lists/*
-
-# copy project requirement files here to ensure they will be cached.
-WORKDIR /app
-COPY requirements.txt ./
-
-# install runtime deps
-RUN pip install -Ur requirements.txt
-
-COPY . /app/
-ENTRYPOINT python -O launcher.py
diff --git a/LICENSE b/LICENSE
old mode 100755
new mode 100644
index f288702d..551248d6
--- a/LICENSE
+++ b/LICENSE
@@ -1,190 +1,178 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
+Copyright (C) 2007 Free Software Foundation, Inc.
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
Preamble
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
+The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
+The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
+software for all its users.
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
+When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
+Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
- 0. Definitions.
+0. Definitions.
- "This License" refers to version 3 of the GNU General Public License.
+"This License" refers to version 3 of the GNU Affero General Public License.
- "Copyright" also means copyright-like laws that apply to other kinds of
+"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
+"The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
- To "modify" a work means to copy from or adapt all or part of the work
+To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
+exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
- A "covered work" means either the unmodified Program or a work based
+A "covered work" means either the unmodified Program or a work based
on the Program.
- To "propagate" a work means to do anything with it that, without
+To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
+computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
+To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
- An interactive user interface displays "Appropriate Legal Notices"
+An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
+work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
- 1. Source Code.
+1. Source Code.
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
+The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
form of a work.
- A "Standard Interface" means an interface that either is an official
+A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
- The "System Libraries" of an executable work include anything, other
+The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
+implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
- The "Corresponding Source" for a work in object code form means all
+The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
+control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
+which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
- The Corresponding Source need not include anything that users
+The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
- The Corresponding Source for a work in source code form is that
+The Corresponding Source for a work in source code form is that
same work.
- 2. Basic Permissions.
+2. Basic Permissions.
- All rights granted under this License are granted for the term of
+All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
+content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
- You may make, run and propagate covered works that you do not
+You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
+in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
+not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
+Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+3. Protecting Users' Legal Rights From Anti-Circumvention Law.
- No covered work shall be deemed part of an effective technological
+No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
- When you convey a covered work, you waive any legal power to forbid
+When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
@@ -192,9 +180,9 @@ modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
- 4. Conveying Verbatim Copies.
+4. Conveying Verbatim Copies.
- You may convey verbatim copies of the Program's source code as you
+You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
@@ -202,12 +190,12 @@ non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
- You may charge any price or no price for each copy that you convey,
+You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
- 5. Conveying Modified Source Versions.
+5. Conveying Modified Source Versions.
- You may convey a work based on the Program, or the modifications to
+You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
@@ -232,19 +220,19 @@ terms of section 4, provided that you also meet all of these conditions:
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
- A compilation of a covered work with other separate and independent
+A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
+beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
- 6. Conveying Non-Source Forms.
+6. Conveying Non-Source Forms.
- You may convey a covered work in object code form under the terms
+You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
@@ -290,75 +278,75 @@ in one of these ways:
Source of the work are being offered to the general public at no
charge under subsection 6d.
- A separable portion of the object code, whose source code is excluded
+A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
- A "User Product" is either (1) a "consumer product", which means any
+A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
+actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
- "Installation Information" for a User Product means any methods,
+"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
+a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
- If you convey an object code work under this section in, or with, or
+If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
+by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
- The requirement to provide Installation Information does not include a
+The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
+the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
- Corresponding Source conveyed, and Installation Information provided,
+Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
- 7. Additional Terms.
+7. Additional Terms.
- "Additional permissions" are terms that supplement the terms of this
+"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
+that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
- When you convey a copy of a covered work, you may at your option
+When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
- Notwithstanding any other provision of this License, for material you
+Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
@@ -385,74 +373,74 @@ that material) supplement the terms of this License with terms:
any liability that these contractual assumptions directly impose on
those licensors and authors.
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
+All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
+restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
- If you add terms to a covered work in accord with this section, you
+If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
- Additional terms, permissive or non-permissive, may be stated in the
+Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
- 8. Termination.
+8. Termination.
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
+You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
- However, if you cease all violation of this License, then your
+However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
- Moreover, your license from a particular copyright holder is
+Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
- Termination of your rights under this section does not terminate the
+Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
+this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
- 9. Acceptance Not Required for Having Copies.
+9. Acceptance Not Required for Having Copies.
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
+You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
+to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
- 10. Automatic Licensing of Downstream Recipients.
+10. Automatic Licensing of Downstream Recipients.
- Each time you convey a covered work, the recipient automatically
+Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
+propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
- An "entity transaction" is a transaction transferring control of an
+An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
+organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
@@ -460,43 +448,43 @@ give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
+You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
- 11. Patents.
+11. Patents.
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
+A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
- A contributor's "essential patent claims" are all patent claims
+A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
+consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
- Each contributor grants you a non-exclusive, worldwide, royalty-free
+Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
- In the following three paragraphs, a "patent license" is any express
+In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
+sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
- If you convey a covered work, knowingly relying on a patent license,
+If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
@@ -504,13 +492,13 @@ then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
+license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
- If, pursuant to or in connection with a single transaction or
+If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
@@ -518,10 +506,10 @@ or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
- A patent license is "discriminatory" if it does not include within
+A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
+specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
@@ -533,73 +521,83 @@ for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
- Nothing in this License shall be construed as excluding or limiting
+Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
- 12. No Surrender of Others' Freedom.
+12. No Surrender of Others' Freedom.
- If conditions are imposed on you (whether by court order, agreement or
+If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
+excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
+not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
- 13. Use with the GNU Affero General Public License.
+13. Remote Network Interaction; Use with the GNU General Public License.
- Notwithstanding any other provision of this License, you have
+Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
- 14. Revised Versions of this License.
+14. Revised Versions of this License.
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
+The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
+Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
+If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
+Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
- 15. Disclaimer of Warranty.
+15. Disclaimer of Warranty.
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
- 16. Limitation of Liability.
+16. Limitation of Liability.
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
@@ -609,9 +607,9 @@ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
- 17. Interpretation of Sections 15 and 16.
+17. Interpretation of Sections 15 and 16.
- If the disclaimer of warranty and limitation of liability provided
+If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
@@ -622,53 +620,42 @@ copy of the Program in return for a fee.
How to Apply These Terms to Your New Programs
- If you develop a new program, and you want it to be of the greatest
+If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
- To do so, attach the following notices to the program. It is safest
+To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
-
- Copyright (C)
+ MystBin: Easily share code or text
+ Copyright (C) 2024 - current PythonistaGuild
This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ GNU Affero General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
+If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
+You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
+For more information on this, and how to apply and follow the GNU AGPL, see
.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/README.md b/README.md
index f3c7f7bf..31762e16 100644
--- a/README.md
+++ b/README.md
@@ -1,38 +1,15 @@
# MystBin
-Easily share code and text.
+Easily share code or text with syntax highlighting and themes for readability.
-[Website](https://mystb.in)
+## Usage
-[API Documentation](https://mystb.in/api/documentation)
+Share and view pastes on the [Website](https://mystb.in).
-[Install on VSCode](https://marketplace.visualstudio.com/items?itemName=PythonistaGuild.mystbin)
+Read the [API docs](https://api.mystb.in/docs) to create your own integrations,
+or install the official [VS Code extension](https://marketplace.visualstudio.com/items?itemName=PythonistaGuild.mystbin) to share code from your editor!
+## Information
-### Running without Docker
-**Requirements:**
-- Postgres
-
-**Setup:**
-- Clone
-- Copy `config.template.toml` into `config.toml`
- - Set Database connection DSN.
- - Optionally set URLs to a running Redis Instance.
-- ! If you haven't already: Create a Database in `postgres` (Default `mystbin`)
-- Install dependencies (Preferably to a `venv`): `pip install -Ur requirements.txt`
-- Optionally in `core/server.py` set `ignore_localhost=` to `False` in the RateLimit Middleware for testing.
-- Run: `python launcher.py`
-
-### Running with Docker
-**Requirements**
-- Docker
-- Docker Compose
-
-**Setup:**
-- Clone
-- Copy `config.template.toml` into `config.toml`
- - The default config for database (and redis) should work Out of Box.
-- Optionally in `core/server.py` set `ignore_localhost=` to `False` in the RateLimit Middleware for testing.
-- Run `docker compose up -d` to start the services.
- - If you want to use redis for session/limit handling, run with the redis profile: `docker compose --profile redis up -d`
- - The redis container doesn't expose connections outside of the network, but for added security edit `redis.conf` and change the password.
+If you'd like to contribute please read our [contribution guidelines](https://github.com/PythonistaGuild/.github/blob/main/CONTRIBUTING.md).
+Interested in self-hosting MystBin? See the readme in each components' directory.
diff --git a/config.template.toml b/config.template.toml
deleted file mode 100644
index 939b9327..00000000
--- a/config.template.toml
+++ /dev/null
@@ -1,28 +0,0 @@
-[SERVER]
-host = "localhost"
-port = 8181
-session_secret = "" # Run: import secrets; print(secrets.token_urlsafe(64))
-maintenance = false
-
-[DATABASE]
-dsn = "postgres://mystbin:mystbin@database:5432/mystbin"
-
-[LIMITS]
-paste_get = { rate = 30, per = 60, priority = 1, bucket = "ip" }
-paste_get_day = { rate = 7200, per = 86400, priority = 2, bucket = "ip" }
-paste_post = { rate = 10, per = 60, priority = 1, bucket = "ip" }
-paste_post_day = { rate = 1440, per = 86400, priority = 2, bucket = "ip" }
-global_limit = { rate = 21600, per = 86400, priority = 1, bucket = "ip" }
-
-[PASTES]
-char_limit = 300_000
-file_limit = 5
-name_limit = 25
-
-[REDIS] # optional key
-limiter = "redis://redis:6379/0" # required if key present
-sessions = "redis://redis:6379/1" # required if key present
-
-[GITHUB] # optional key
-token = "..." # a github token capable of creating gists, non-optional if the above key is provided
-timeout = 10 # how long to wait between posting gists if there's an influx of tokens posted. Non-optional
diff --git a/core/__init__.py b/core/__init__.py
deleted file mode 100644
index 57aab0c8..00000000
--- a/core/__init__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from .config import CONFIG as CONFIG
-from .database import Database as Database
-from .server import Application as Application
diff --git a/core/config.py b/core/config.py
deleted file mode 100644
index 68603261..00000000
--- a/core/config.py
+++ /dev/null
@@ -1,34 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from __future__ import annotations
-
-from typing import TYPE_CHECKING
-
-import tomllib
-
-
-if TYPE_CHECKING:
- from types_.config import Config
-
-
-__all__ = ("CONFIG",)
-
-
-with open("config.toml", "rb") as fp:
- CONFIG: Config = tomllib.load(fp) # type: ignore
diff --git a/core/database.py b/core/database.py
deleted file mode 100644
index 5c31c05b..00000000
--- a/core/database.py
+++ /dev/null
@@ -1,299 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from __future__ import annotations
-
-import asyncio
-import datetime
-import logging
-from typing import TYPE_CHECKING, Any, Self
-
-import aiohttp
-import asyncpg
-
-from core import CONFIG
-
-from . import utils
-from .models import FileModel, PasteModel
-from .scanners import SecurityInfo, Services
-
-
-if TYPE_CHECKING:
- _Pool = asyncpg.Pool[asyncpg.Record]
- from types_.config import Github
- from types_.github import PostGist
- from types_.scanner import ScannerSecret
-else:
- _Pool = asyncpg.Pool
-
-
-LOGGER: logging.Logger = logging.getLogger(__name__)
-
-
-class Database:
- pool: _Pool
-
- def __init__(self, *, dsn: str, session: aiohttp.ClientSession | None = None, github_config: Github | None) -> None:
- self._dsn: str = dsn
- self.session: aiohttp.ClientSession | None = session
- self._handling_tokens = bool(self.session and github_config)
-
- if self._handling_tokens:
- LOGGER.info("Setup to handle Discord Tokens.")
- assert github_config # guarded by if here
-
- self._gist_token = github_config["token"]
- self._gist_timeout = github_config["timeout"]
- # tokens bucket for gist posting: {paste_id: token\ntoken}
- self.__tokens_bucket: dict[str, str] = {}
- self.__token_lock = asyncio.Lock()
- self.__token_task = asyncio.create_task(self._token_task())
-
- async def __aenter__(self) -> Self:
- await self.connect()
- return self
-
- async def __aexit__(self, *_: Any) -> None:
- task: asyncio.Task[None] | None = getattr(self, "__token_task", None)
- if task:
- task.cancel()
-
- await self.close()
-
- async def _token_task(self) -> None:
- # won't run unless pre-reqs are met in __init__
- while True:
- if self.__tokens_bucket:
- async with self.__token_lock:
- await self._post_gist_of_tokens()
-
- await asyncio.sleep(self._gist_timeout)
-
- def _handle_discord_tokens(self, tokens: list[str], paste_id: str) -> None:
- if not self._handling_tokens or not tokens:
- return
-
- LOGGER.info(
- "Discord bot token located and added to token bucket. Current bucket size is: %s", len(self.__tokens_bucket)
- )
-
- self.__tokens_bucket[paste_id] = "\n".join(tokens)
-
- async def _post_gist_of_tokens(self) -> None:
- assert self.session # guarded in caller
- json_payload: PostGist = {
- "description": "MystBin found these Discord tokens in a public paste, and posted them here to invalidate them. If you intended to share these, please apply a password to the paste.",
- "files": {},
- "public": True,
- }
-
- github_headers = {
- "Accept": "application/vnd.github+json",
- "Authorization": f"Bearer {self._gist_token}",
- "X-GitHub-Api-Version": "2022-11-28",
- }
-
- current_tokens = self.__tokens_bucket
- self.__tokens_bucket = {}
-
- for paste_id, tokens in current_tokens.items():
- filename = str(datetime.datetime.now(datetime.UTC)) + "-tokens.txt"
- json_payload["files"][filename] = {"content": f"https://mystb.in/{paste_id}:\n{tokens}"}
-
- success = False
-
- try:
- async with self.session.post(
- "https://api.github.com/gists", headers=github_headers, json=json_payload
- ) as resp:
- success = resp.ok
-
- if not success:
- response_body = await resp.text()
- LOGGER.error(
- "Failed to create gist with token bucket with response status code %s and response body:\n\n%s",
- resp.status,
- response_body,
- )
- except (aiohttp.ClientError, aiohttp.ClientOSError) as error:
- success = False
- LOGGER.error("Failed to handle gist creation due to a client or operating system error", exc_info=error)
-
- if success:
- LOGGER.info("Gist created and invalidated tokens from %s pastes.", len(current_tokens))
- else:
- self.__tokens_bucket.update(current_tokens)
-
- async def connect(self) -> None:
- try:
- pool: asyncpg.Pool[asyncpg.Record] | None = await asyncpg.create_pool(dsn=self._dsn)
- except Exception as e:
- raise RuntimeError from e
-
- if not pool:
- raise RuntimeError("Failed to connect to the database... No additional information.")
-
- with open("schema.sql") as fp:
- await pool.execute(fp.read())
-
- self.pool = pool
- LOGGER.info("Successfully connected to the database.")
-
- async def close(self) -> None:
- try:
- await asyncio.wait_for(self.pool.close(), timeout=10)
- except TimeoutError:
- LOGGER.warning("Failed to greacefully close the database connection...")
- else:
- LOGGER.info("Successfully closed the database connection.")
-
- async def fetch_paste(self, identifier: str, *, password: str | None) -> PasteModel | None:
- assert self.pool
-
- paste_query: str = """
- UPDATE pastes SET views = views + 1 WHERE id = $1
- RETURNING *,
- CASE WHEN password IS NOT NULL THEN true
- ELSE false END AS has_password,
- CASE WHEN password = CRYPT($2, password) THEN true
- ELSE false END AS password_ok
- """
-
- file_query: str = """
- SELECT * FROM files WHERE parent_id = $1
- """
-
- async with self.pool.acquire() as connection:
- record: asyncpg.Record | None = await connection.fetchrow(paste_query, identifier, password)
-
- if not record:
- return
-
- paste: PasteModel = PasteModel(record)
- if paste.expires and paste.expires <= datetime.datetime.now(tz=datetime.timezone.utc):
- await connection.execute("DELETE FROM pastes WHERE id = $1", identifier)
- return
-
- if paste.has_password and not paste.password_ok:
- return paste
-
- records: list[asyncpg.Record] = await connection.fetch(file_query, identifier)
- paste.files = [FileModel(d) for d in records]
-
- return paste
-
- async def create_paste(self, *, data: dict[str, Any]) -> PasteModel:
- assert self.pool
-
- paste_query: str = """
- INSERT INTO pastes (id, expires, password, safety)
- VALUES ($1, $2, (SELECT crypt($3, gen_salt('bf')) WHERE $3 is not null), $4)
- RETURNING *
- """
-
- file_query: str = """
- INSERT INTO files (parent_id, content, filename, loc, annotation, warning_positions)
- VALUES ($1, $2, $3, $4, $5, $6)
- RETURNING *
- """
-
- files: list[dict[str, Any]] = data["files"]
- expiry: str | None = data["expires"]
- password: str | None = data["password"]
-
- async with self.pool.acquire() as connection:
- while True:
- identifier: str = utils.generate_id()
- safety: str = utils.generate_safety_token()
-
- try:
- paster: asyncpg.Record | None = await connection.fetchrow(
- paste_query,
- identifier,
- expiry,
- password,
- safety,
- )
- except asyncpg.exceptions.UniqueViolationError:
- continue
- else:
- break
-
- assert paster
-
- paste: PasteModel = PasteModel(paster)
- async with connection.transaction():
- for index, file in enumerate(files, 1):
- name: str = (file.get("filename") or f"file_{index}")[-CONFIG["PASTES"]["name_limit"] :]
- name = "_".join(name.splitlines())
-
- # Normalise newlines...
- content: str = file["content"].replace("\r\n", "\n").replace("\r", "\n")
- loc: int = file["content"].count("\n") + 1
-
- positions: list[int] = []
- extra: str = ""
-
- secrets: list[ScannerSecret] = SecurityInfo.scan_file(content)
- for payload in secrets:
- service: Services = payload["service"]
-
- extra += f"{service.value}, "
- positions += [t[0] for t in payload["tokens"]]
-
- if not password and self._handling_tokens and service is Services.discord:
- self._handle_discord_tokens(tokens=[t[1] for t in payload["tokens"]], paste_id=paste.id)
-
- extra = extra.removesuffix(", ")
- annotation = f"Contains possibly sensitive data from: {extra}" if extra else ""
-
- row: asyncpg.Record | None = await connection.fetchrow(
- file_query,
- paste.id,
- content,
- name,
- loc,
- annotation,
- sorted(positions),
- )
-
- if row:
- paste.files.append(FileModel(row))
-
- return paste
-
- async def fetch_paste_security(self, *, token: str) -> PasteModel | None:
- query: str = """SELECT * FROM pastes WHERE safety = $1"""
-
- async with self.pool.acquire() as connection:
- record: asyncpg.Record | None = await connection.fetchrow(query, token)
- if not record:
- return
-
- paste: PasteModel = PasteModel(record=record)
- if paste.expires and paste.expires <= datetime.datetime.now(tz=datetime.timezone.utc):
- await connection.execute("DELETE FROM pastes WHERE id = $1", token)
- return
-
- return paste
-
- async def delete_paste_security(self, *, token: str) -> None:
- query: str = """DELETE FROM pastes WHERE safety = $1"""
-
- async with self.pool.acquire() as connection:
- await connection.execute(query, token)
diff --git a/core/models.py b/core/models.py
deleted file mode 100644
index 414d097f..00000000
--- a/core/models.py
+++ /dev/null
@@ -1,85 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-import datetime
-from collections.abc import Iterator, Mapping
-from typing import Any
-
-import asyncpg
-
-
-class BaseModel(Mapping[str, Any]):
- __slots__ = ("record",)
-
- def __init__(self, record: asyncpg.Record | dict[str, Any], /) -> None:
- self.record: dict[str, Any] = dict(record)
-
- def __getitem__(self, key: str) -> Any:
- return self.record[key]
-
- def __iter__(self) -> Iterator[str]:
- return iter(self.record)
-
- def __len__(self) -> int:
- return len(self.record)
-
- def serialize(self, *, exclude: list[str] = ["file_index"]) -> dict[str, Any]:
- new: dict[str, Any] = {}
-
- for key, value in self.record.items():
- if key in exclude:
- continue
-
- if isinstance(value, datetime.datetime):
- new[key] = value.isoformat()
- else:
- new[key] = value
-
- if isinstance(self, PasteModel) and self.files:
- new["files"] = [f.serialize() for f in self.files]
-
- return new
-
-
-class FileModel(BaseModel):
- def __init__(self, record: asyncpg.Record | dict[str, Any]) -> None:
- super().__init__(record)
-
- self.parent_id: str = record["parent_id"]
- self.content: str = record["content"]
- self.filename: str = record["filename"]
- self.loc: int = record["loc"]
- self.charcount: int = record["charcount"]
- self.index: int = record["file_index"]
- self.annotation: str | None = record["annotation"]
- self.warning_positions: list[int] = record["warning_positions"]
-
-
-class PasteModel(BaseModel):
- def __init__(self, record: asyncpg.Record) -> None:
- super().__init__(record)
-
- self.id: str = record["id"]
- self.created_at: datetime.datetime = record["created_at"]
- self.expires: datetime.datetime | None = record["expires"]
- self.password: str | None = record["password"]
- self.views: int = record["views"]
- self.safety: str = record["safety"]
- self.has_password: bool | None = record.get("has_password", None)
- self.password_ok: bool | None = record.get("password_ok", None)
- self.files: list[FileModel] = []
diff --git a/core/scanners.py b/core/scanners.py
deleted file mode 100644
index 12433e37..00000000
--- a/core/scanners.py
+++ /dev/null
@@ -1,134 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from __future__ import annotations
-
-import base64
-import binascii
-import enum
-import logging
-import re
-from typing import TYPE_CHECKING, ClassVar
-
-
-if TYPE_CHECKING:
- from types_.scanner import ScannerSecret
-
-
-logger: logging.Logger = logging.getLogger(__name__)
-
-
-class Services(enum.Enum):
- discord = "Discord"
- pypi = "PyPi"
- github = "GitHub"
-
-
-class BaseScanner:
- REGEX: ClassVar[re.Pattern[str]]
- SERVICE: ClassVar[Services]
-
- @classmethod
- def match(cls, content: str) -> ScannerSecret:
- matches: list[tuple[int, str]] = [(m.start(0), m.group(0)) for m in cls.REGEX.finditer(content)]
-
- payload: ScannerSecret = {
- "service": cls.SERVICE,
- "tokens": matches,
- }
-
- return payload
-
-
-class DiscordScanner(BaseScanner):
- REGEX = re.compile(r"[a-zA-Z0-9_-]{23,28}\.[a-zA-Z0-9_-]{6,7}\.[a-zA-Z0-9_-]{27,}")
- SERVICE = Services.discord
-
- @staticmethod
- def validate_discord_token(token: str) -> bool:
- try:
- # Just check if the first part validates as a user ID
- (user_id, _, _) = token.split(".")
- user_id = int(base64.b64decode(user_id + "=" * (len(user_id) % 4), validate=True))
- except (ValueError, binascii.Error):
- return False
- else:
- return True
-
- @classmethod
- def match(cls, content: str) -> ScannerSecret:
- matches: list[tuple[int, str]] = [
- (m.start(0), m.group(0)) for m in cls.REGEX.finditer(content) if cls.validate_discord_token(m.group(0))
- ]
-
- payload: ScannerSecret = {
- "service": cls.SERVICE,
- "tokens": matches,
- }
-
- return payload
-
-
-class PyPiScanner(BaseScanner):
- REGEX = re.compile(r"pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{70,}")
- SERVICE = Services.pypi
-
-
-class GitHubScanner(BaseScanner):
- REGEX = re.compile(r"((ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36})")
- SERVICE = Services.github
-
-
-class SecurityInfo:
- __SERVICE_MAPPING: ClassVar[dict[Services, type[BaseScanner]]] = {
- Services.discord: DiscordScanner,
- Services.pypi: PyPiScanner,
- Services.github: GitHubScanner,
- }
-
- @classmethod
- def scan_file(
- cls,
- file: str,
- /,
- *,
- allowed: list[Services] | None = None,
- disallowed: list[Services] | None = None,
- ) -> list[ScannerSecret]:
- """Scan for tokens in a given files content.
-
- You may pass a list of allowed or disallowed Services.
- If both lists are empty (Default) all available services will be scanned.
- """
- disallowed = disallowed or []
- allowed = allowed or list(Services)
-
- services: list[Services] = [s for s in allowed if s not in disallowed]
- secrets: list[ScannerSecret] = []
-
- for service in services:
- scanner: type[BaseScanner] | None = cls.__SERVICE_MAPPING.get(service, None)
- if not scanner:
- logging.warning("The provided service %r is not a supported or a valid service.", service)
- continue
-
- found: ScannerSecret = scanner.match(file)
- if found["tokens"]:
- secrets.append(found)
-
- return secrets
diff --git a/core/server.py b/core/server.py
deleted file mode 100644
index bed80bc3..00000000
--- a/core/server.py
+++ /dev/null
@@ -1,112 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-import logging
-
-import aiohttp
-import starlette_plus
-from starlette.middleware import Middleware
-from starlette.routing import Mount, Route
-from starlette.schemas import SchemaGenerator
-from starlette.staticfiles import StaticFiles
-
-from core.database import Database
-from views import *
-
-from .config import CONFIG
-
-
-logger: logging.Logger = logging.getLogger(__name__)
-
-
-class Application(starlette_plus.Application):
- def __init__(self, *, database: Database, session: aiohttp.ClientSession | None = None) -> None:
- self.database: Database = database
- self.session: aiohttp.ClientSession | None = session
- self.schemas: SchemaGenerator | None = None
-
- views: list[starlette_plus.View] = [
- HTMXView(self),
- APIView(self),
- DocsView(self),
- ]
- routes: list[Mount | Route] = [Mount("/static", app=StaticFiles(directory="web/static"), name="static")]
-
- if redis_key := CONFIG.get("REDIS"):
- limit_url = redis_key["limiter"]
- session_url = redis_key["sessions"]
- else:
- limit_url = None
- session_url = None
-
- limit_redis = starlette_plus.Redis(url=limit_url)
- sess_redis = starlette_plus.Redis(url=session_url)
-
- global_limits = [CONFIG["LIMITS"]["global_limit"]]
- middleware = [
- Middleware(
- starlette_plus.middleware.RatelimitMiddleware,
- ignore_localhost=True,
- redis=limit_redis,
- global_limits=global_limits,
- ),
- Middleware(
- starlette_plus.middleware.SessionMiddleware,
- secret=CONFIG["SERVER"]["session_secret"],
- redis=sess_redis,
- max_age=86400,
- ),
- ]
-
- if CONFIG["SERVER"]["maintenance"]:
- # inject a catch all before any route...
- routes.append(Route("/", self.maint_mode, methods=["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]))
- routes.append(
- Route("/{path:path}", self.maint_mode, methods=["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"])
- )
-
- super().__init__(on_startup=[self.event_ready], views=views, routes=routes, middleware=middleware)
-
- @staticmethod
- async def maint_mode(request: starlette_plus.Request) -> starlette_plus.Response:
- return starlette_plus.FileResponse("web/maint.html")
-
- @starlette_plus.route("/docs")
- @starlette_plus.route("/documentation")
- async def documentation_redirect(self, request: starlette_plus.Request) -> starlette_plus.Response:
- return starlette_plus.RedirectResponse("/api/documentation")
-
- @starlette_plus.route("/documents", methods=["POST"])
- @starlette_plus.route("/api/documents", methods=["POST"])
- async def documents_redirect(self, request: starlette_plus.Request) -> starlette_plus.Response:
- # Compat redirect route...
- return starlette_plus.RedirectResponse("/api/paste", status_code=308)
-
- async def event_ready(self) -> None:
- self.schemas = SchemaGenerator(
- {
- "openapi": "3.1.0",
- "info": {
- "title": "MystBin API",
- "version": "4.0",
- "summary": "API Documentation",
- "description": "MystBin - Easily share code and text.",
- },
- }
- )
- logger.info("MystBin application has successfully started!")
diff --git a/core/utils.py b/core/utils.py
deleted file mode 100644
index b525a15a..00000000
--- a/core/utils.py
+++ /dev/null
@@ -1,159 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from __future__ import annotations
-
-import base64
-import binascii
-import datetime
-import json
-import re
-import secrets
-from typing import Any
-
-import starlette_plus
-
-from core import CONFIG
-
-
-TOKEN_REGEX = re.compile(r"[a-zA-Z0-9_-]{23,28}\.[a-zA-Z0-9_-]{6,7}\.[a-zA-Z0-9_-]{27,}")
-
-
-def generate_id() -> str:
- return secrets.token_hex(9)
-
-
-def generate_safety_token() -> str:
- return secrets.token_urlsafe(64)
-
-
-async def json_or_text(request: starlette_plus.Request) -> dict[str, Any] | str:
- text: str = str(await request.body())
-
- try:
- data: dict[str, Any] = json.loads(text)
- except json.JSONDecodeError:
- return text
-
- return data
-
-
-def validate_paste(data: dict[str, Any]) -> starlette_plus.Response | None:
- limit: int = CONFIG["PASTES"]["char_limit"]
- file_limit: int = CONFIG["PASTES"]["file_limit"]
-
- try:
- files: list[dict[str, str | None]] = data["files"]
- except KeyError:
- return starlette_plus.JSONResponse({"error": 'Missing the "files" parameter.'}, status_code=400)
-
- if len(files) > file_limit:
- return starlette_plus.JSONResponse(
- {"error": f'Paste exceeds the file limit of "{file_limit}" files.'},
- status_code=400,
- )
-
- for index, file in enumerate(files):
- try:
- content: str | None = file["content"]
- except KeyError:
- return starlette_plus.JSONResponse(
- {"error": f'The file at index "{index}" is missing the content parameter.'},
- status_code=400,
- )
-
- if not content:
- return starlette_plus.JSONResponse(
- {"error": f'The file at index "{index}" has no content.'},
- status_code=400,
- )
-
- if len(content) > limit:
- return starlette_plus.JSONResponse(
- {"error": f'The file at index "{index}" exceeds content size limits of "{limit}" characters.'},
- status_code=400,
- )
-
-
-def validate_discord_token(token: str) -> bool:
- try:
- # Just check if the first part validates as a user ID
- (user_id, _, _) = token.split(".")
- user_id = int(base64.b64decode(user_id + "==", validate=True))
- except (ValueError, binascii.Error):
- return False
- else:
- return True
-
-
-def pluralize(count: int, singular: str) -> str:
- return singular if count == 1 else singular + "s"
-
-
-def natural_time(
- td: datetime.timedelta,
- /,
- *,
- source: datetime.datetime | None = None,
-) -> str:
- now = source or datetime.datetime.now(datetime.UTC)
-
- then = now - td
- future = then > now
-
- seconds = round(td.total_seconds())
-
- if seconds < 60 and not future:
- return "now"
-
- ago = "{delta} from now" if future else "{delta} ago"
-
- years, seconds = divmod(seconds, 60 * 60 * 24 * 365)
- months, seconds = divmod(seconds, 60 * 60 * 24 * 30)
- weeks, seconds = divmod(seconds, 60 * 60 * 24 * 7)
- days, seconds = divmod(seconds, 60 * 60 * 24)
- hours, seconds = divmod(seconds, 60 * 60)
- minutes, seconds = divmod(seconds, 60)
-
- ret = ""
-
- if years:
- ret += f"{years} {pluralize(years, 'year')}"
- if months:
- ret += f", {months} {pluralize(months, 'month')}"
- elif months:
- ret += f"{months} {pluralize(months, 'month')}"
- elif weeks:
- ret += f"{weeks} {pluralize(weeks, 'week')}"
- if days:
- ret += f", {days} {pluralize(days, 'day')}"
- elif days:
- ret += f"{days} {pluralize(days, 'day')}"
-
- if hours and not years and not months and not weeks and not days:
- if ret:
- ret += ", "
- ret += f"{hours} {pluralize(hours, 'hour')}"
- if minutes and not years and not months and not weeks and not days and not hours:
- if ret:
- ret += ", "
- ret += f"{minutes} {pluralize(minutes, 'minute')}"
-
- formatted_ret = ", ".join(ret.split(", ")[:2])
-
- return ago.format(delta=formatted_ret)
diff --git a/docker-compose.yaml b/docker-compose.yaml
deleted file mode 100644
index f9f7c016..00000000
--- a/docker-compose.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-services:
- mystbin:
- image: ghcr.io/pythonistaguild/mystbin
- container_name: mystbin
- ports:
- - 8181:8181
- restart: unless-stopped
- depends_on:
- database:
- condition: service_healthy
- restart: true
- volumes:
- - ./config.toml:/app/config.toml:ro
-
- database:
- image: postgres:16
- container_name: mystbin-database
- restart: unless-stopped
- healthcheck:
- test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
- interval: 10s
- timeout: 5s
- retries: 5
- env_file: .env
- environment:
- - PG_DATA=/var/lib/postgresql/data
- - POSTGRES_DB=mystbin
- volumes:
- - mystbin_pg_data:/var/lib/postgresql/data
-
- redis:
- image: redis:latest
- container_name: mystbin-redis
- restart: unless-stopped
- profiles:
- - redis
- volumes:
- - "./redis.conf:/config/redis.conf:ro"
- command: ["redis-server", "/config/redis.conf"]
-
-volumes:
- mystbin_pg_data:
diff --git a/echo/.dockerignore b/echo/.dockerignore
new file mode 100644
index 00000000..a7e18840
--- /dev/null
+++ b/echo/.dockerignore
@@ -0,0 +1,2 @@
+data/
+target/
diff --git a/echo/.gitattributes b/echo/.gitattributes
new file mode 100644
index 00000000..efdba876
--- /dev/null
+++ b/echo/.gitattributes
@@ -0,0 +1,2 @@
+* text=auto
+*.sh text eol=lf
diff --git a/echo/.gitignore b/echo/.gitignore
new file mode 100644
index 00000000..a85e1073
--- /dev/null
+++ b/echo/.gitignore
@@ -0,0 +1,5 @@
+.env
+compose.override.yaml
+config.json
+data/
+target/
diff --git a/echo/Cargo.lock b/echo/Cargo.lock
new file mode 100644
index 00000000..5561ab04
--- /dev/null
+++ b/echo/Cargo.lock
@@ -0,0 +1,3575 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "addr2line"
+version = "0.24.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler2"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
+
+[[package]]
+name = "ahash"
+version = "0.8.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
+dependencies = [
+ "cfg-if",
+ "getrandom",
+ "once_cell",
+ "version_check",
+ "zerocopy",
+]
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "allocator-api2"
+version = "0.2.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
+
+[[package]]
+name = "android-tzdata"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
+
+[[package]]
+name = "android_system_properties"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "anyhow"
+version = "1.0.93"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
+
+[[package]]
+name = "async-stream"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476"
+dependencies = [
+ "async-stream-impl",
+ "futures-core",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "async-stream-impl"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "async-trait"
+version = "0.1.83"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "atoi"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "atomic"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba"
+
+[[package]]
+name = "atomic"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d818003e740b63afc82337e3160717f4f63078720a810b7b903e70a5d1d2994"
+dependencies = [
+ "bytemuck",
+]
+
+[[package]]
+name = "atomic-waker"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
+[[package]]
+name = "autocfg"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
+
+[[package]]
+name = "backtrace"
+version = "0.3.74"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
+dependencies = [
+ "addr2line",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "base64"
+version = "0.21.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "base64ct"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
+
+[[package]]
+name = "binascii"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72"
+
+[[package]]
+name = "bitflags"
+version = "2.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "block-buffer"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "bstr"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22"
+dependencies = [
+ "memchr",
+ "serde",
+]
+
+[[package]]
+name = "bumpalo"
+version = "3.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
+
+[[package]]
+name = "bytemuck"
+version = "1.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d"
+
+[[package]]
+name = "byteorder"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+
+[[package]]
+name = "bytes"
+version = "1.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
+
+[[package]]
+name = "cc"
+version = "1.1.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945"
+dependencies = [
+ "shlex",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "chrono"
+version = "0.4.38"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
+dependencies = [
+ "android-tzdata",
+ "iana-time-zone",
+ "js-sys",
+ "num-traits",
+ "serde",
+ "wasm-bindgen",
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "chrono-tz"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb"
+dependencies = [
+ "chrono",
+ "chrono-tz-build",
+ "phf",
+]
+
+[[package]]
+name = "chrono-tz-build"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1"
+dependencies = [
+ "parse-zoneinfo",
+ "phf",
+ "phf_codegen",
+]
+
+[[package]]
+name = "const-oid"
+version = "0.9.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
+
+[[package]]
+name = "cookie"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"
+dependencies = [
+ "percent-encoding",
+ "time",
+ "version_check",
+]
+
+[[package]]
+name = "core-foundation"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
+
+[[package]]
+name = "cpufeatures"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "crc"
+version = "3.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636"
+dependencies = [
+ "crc-catalog",
+]
+
+[[package]]
+name = "crc-catalog"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
+
+[[package]]
+name = "crossbeam-deque"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
+dependencies = [
+ "crossbeam-epoch",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-epoch"
+version = "0.9.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-queue"
+version = "0.3.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-utils"
+version = "0.8.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
+
+[[package]]
+name = "crypto-common"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
+dependencies = [
+ "generic-array",
+ "typenum",
+]
+
+[[package]]
+name = "der"
+version = "0.7.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0"
+dependencies = [
+ "const-oid",
+ "pem-rfc7468",
+ "zeroize",
+]
+
+[[package]]
+name = "deranged"
+version = "0.3.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
+dependencies = [
+ "powerfmt",
+]
+
+[[package]]
+name = "deunicode"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "339544cc9e2c4dc3fc7149fd630c5f22263a4fdf18a98afd0075784968b5cf00"
+
+[[package]]
+name = "devise"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1d90b0c4c777a2cad215e3c7be59ac7c15adf45cf76317009b7d096d46f651d"
+dependencies = [
+ "devise_codegen",
+ "devise_core",
+]
+
+[[package]]
+name = "devise_codegen"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "71b28680d8be17a570a2334922518be6adc3f58ecc880cbb404eaeb8624fd867"
+dependencies = [
+ "devise_core",
+ "quote",
+]
+
+[[package]]
+name = "devise_core"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b035a542cf7abf01f2e3c4d5a7acbaebfefe120ae4efc7bde3df98186e4b8af7"
+dependencies = [
+ "bitflags",
+ "proc-macro2",
+ "proc-macro2-diagnostics",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "digest"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
+dependencies = [
+ "block-buffer",
+ "const-oid",
+ "crypto-common",
+ "subtle",
+]
+
+[[package]]
+name = "dotenvy"
+version = "0.15.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
+
+[[package]]
+name = "echo"
+version = "1.0.0"
+dependencies = [
+ "base64 0.22.1",
+ "chrono",
+ "figment",
+ "once_cell",
+ "rand",
+ "regex",
+ "reqwest",
+ "rocket",
+ "rocket-validation",
+ "rocket_db_pools",
+ "scalar-doc",
+ "serde",
+ "sqlx",
+ "tokio",
+ "validator",
+]
+
+[[package]]
+name = "either"
+version = "1.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "encoding_rs"
+version = "0.8.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
+[[package]]
+name = "errno"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
+dependencies = [
+ "libc",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "etcetera"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943"
+dependencies = [
+ "cfg-if",
+ "home",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "event-listener"
+version = "2.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
+
+[[package]]
+name = "fastrand"
+version = "2.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6"
+
+[[package]]
+name = "figment"
+version = "0.10.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8cb01cd46b0cf372153850f4c6c272d9cbea2da513e07538405148f95bd789f3"
+dependencies = [
+ "atomic 0.6.0",
+ "pear",
+ "serde",
+ "serde_json",
+ "toml",
+ "uncased",
+ "version_check",
+]
+
+[[package]]
+name = "flume"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181"
+dependencies = [
+ "futures-core",
+ "futures-sink",
+ "spin",
+]
+
+[[package]]
+name = "fnv"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+
+[[package]]
+name = "foreign-types"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
+dependencies = [
+ "foreign-types-shared",
+]
+
+[[package]]
+name = "foreign-types-shared"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
+
+[[package]]
+name = "form_urlencoded"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
+dependencies = [
+ "percent-encoding",
+]
+
+[[package]]
+name = "futures"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-channel"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
+dependencies = [
+ "futures-core",
+ "futures-sink",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
+
+[[package]]
+name = "futures-executor"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-intrusive"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f"
+dependencies = [
+ "futures-core",
+ "lock_api",
+ "parking_lot",
+]
+
+[[package]]
+name = "futures-io"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
+
+[[package]]
+name = "futures-sink"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
+
+[[package]]
+name = "futures-task"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
+
+[[package]]
+name = "futures-util"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "memchr",
+ "pin-project-lite",
+ "pin-utils",
+ "slab",
+]
+
+[[package]]
+name = "generator"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e"
+dependencies = [
+ "cc",
+ "libc",
+ "log",
+ "rustversion",
+ "windows",
+]
+
+[[package]]
+name = "generic-array"
+version = "0.14.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "wasi",
+]
+
+[[package]]
+name = "gimli"
+version = "0.31.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
+
+[[package]]
+name = "glob"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+
+[[package]]
+name = "globset"
+version = "0.4.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19"
+dependencies = [
+ "aho-corasick",
+ "bstr",
+ "log",
+ "regex-automata 0.4.8",
+ "regex-syntax 0.8.5",
+]
+
+[[package]]
+name = "globwalk"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757"
+dependencies = [
+ "bitflags",
+ "ignore",
+ "walkdir",
+]
+
+[[package]]
+name = "h2"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8"
+dependencies = [
+ "bytes",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "futures-util",
+ "http 0.2.12",
+ "indexmap",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tracing",
+]
+
+[[package]]
+name = "h2"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "http 1.1.0",
+ "indexmap",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tracing",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.14.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
+dependencies = [
+ "ahash",
+ "allocator-api2",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
+
+[[package]]
+name = "hashlink"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
+dependencies = [
+ "hashbrown 0.14.5",
+]
+
+[[package]]
+name = "heck"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+dependencies = [
+ "unicode-segmentation",
+]
+
+[[package]]
+name = "hermit-abi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
+
+[[package]]
+name = "hermit-abi"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
+
+[[package]]
+name = "hex"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
+
+[[package]]
+name = "hkdf"
+version = "0.12.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"
+dependencies = [
+ "hmac",
+]
+
+[[package]]
+name = "hmac"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
+dependencies = [
+ "digest",
+]
+
+[[package]]
+name = "home"
+version = "0.5.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
+dependencies = [
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "http"
+version = "0.2.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1"
+dependencies = [
+ "bytes",
+ "fnv",
+ "itoa",
+]
+
+[[package]]
+name = "http"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
+dependencies = [
+ "bytes",
+ "fnv",
+ "itoa",
+]
+
+[[package]]
+name = "http-body"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
+dependencies = [
+ "bytes",
+ "http 0.2.12",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "http-body"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
+dependencies = [
+ "bytes",
+ "http 1.1.0",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
+dependencies = [
+ "bytes",
+ "futures-util",
+ "http 1.1.0",
+ "http-body 1.0.1",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "httparse"
+version = "1.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946"
+
+[[package]]
+name = "httpdate"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
+
+[[package]]
+name = "humansize"
+version = "2.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7"
+dependencies = [
+ "libm",
+]
+
+[[package]]
+name = "hyper"
+version = "0.14.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85"
+dependencies = [
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "futures-util",
+ "h2 0.3.26",
+ "http 0.2.12",
+ "http-body 0.4.6",
+ "httparse",
+ "httpdate",
+ "itoa",
+ "pin-project-lite",
+ "socket2",
+ "tokio",
+ "tower-service",
+ "tracing",
+ "want",
+]
+
+[[package]]
+name = "hyper"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a"
+dependencies = [
+ "bytes",
+ "futures-channel",
+ "futures-util",
+ "h2 0.4.6",
+ "http 1.1.0",
+ "http-body 1.0.1",
+ "httparse",
+ "itoa",
+ "pin-project-lite",
+ "smallvec",
+ "tokio",
+ "want",
+]
+
+[[package]]
+name = "hyper-rustls"
+version = "0.27.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333"
+dependencies = [
+ "futures-util",
+ "http 1.1.0",
+ "hyper 1.5.0",
+ "hyper-util",
+ "rustls 0.23.17",
+ "rustls-pki-types",
+ "tokio",
+ "tokio-rustls",
+ "tower-service",
+]
+
+[[package]]
+name = "hyper-tls"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
+dependencies = [
+ "bytes",
+ "http-body-util",
+ "hyper 1.5.0",
+ "hyper-util",
+ "native-tls",
+ "tokio",
+ "tokio-native-tls",
+ "tower-service",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b"
+dependencies = [
+ "bytes",
+ "futures-channel",
+ "futures-util",
+ "http 1.1.0",
+ "http-body 1.0.1",
+ "hyper 1.5.0",
+ "pin-project-lite",
+ "socket2",
+ "tokio",
+ "tower-service",
+ "tracing",
+]
+
+[[package]]
+name = "iana-time-zone"
+version = "0.1.61"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
+dependencies = [
+ "android_system_properties",
+ "core-foundation-sys",
+ "iana-time-zone-haiku",
+ "js-sys",
+ "wasm-bindgen",
+ "windows-core",
+]
+
+[[package]]
+name = "iana-time-zone-haiku"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "idna"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
+dependencies = [
+ "unicode-bidi",
+ "unicode-normalization",
+]
+
+[[package]]
+name = "idna"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
+dependencies = [
+ "unicode-bidi",
+ "unicode-normalization",
+]
+
+[[package]]
+name = "if_chain"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed"
+
+[[package]]
+name = "ignore"
+version = "0.4.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b"
+dependencies = [
+ "crossbeam-deque",
+ "globset",
+ "log",
+ "memchr",
+ "regex-automata 0.4.8",
+ "same-file",
+ "walkdir",
+ "winapi-util",
+]
+
+[[package]]
+name = "indexmap"
+version = "2.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
+dependencies = [
+ "equivalent",
+ "hashbrown 0.15.0",
+ "serde",
+]
+
+[[package]]
+name = "inlinable_string"
+version = "0.1.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb"
+
+[[package]]
+name = "ipnet"
+version = "2.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708"
+
+[[package]]
+name = "is-terminal"
+version = "0.4.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
+dependencies = [
+ "hermit-abi 0.4.0",
+ "libc",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
+
+[[package]]
+name = "js-sys"
+version = "0.3.72"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9"
+dependencies = [
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+dependencies = [
+ "spin",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.161"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
+
+[[package]]
+name = "libm"
+version = "0.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
+
+[[package]]
+name = "libsqlite3-sys"
+version = "0.27.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
+dependencies = [
+ "cc",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
+
+[[package]]
+name = "lock_api"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
+dependencies = [
+ "autocfg",
+ "scopeguard",
+]
+
+[[package]]
+name = "log"
+version = "0.4.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
+
+[[package]]
+name = "loom"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5"
+dependencies = [
+ "cfg-if",
+ "generator",
+ "scoped-tls",
+ "serde",
+ "serde_json",
+ "tracing",
+ "tracing-subscriber",
+]
+
+[[package]]
+name = "matchers"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
+dependencies = [
+ "regex-automata 0.1.10",
+]
+
+[[package]]
+name = "md-5"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
+dependencies = [
+ "cfg-if",
+ "digest",
+]
+
+[[package]]
+name = "memchr"
+version = "2.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
+
+[[package]]
+name = "mime"
+version = "0.3.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
+
+[[package]]
+name = "minimal-lexical"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+
+[[package]]
+name = "miniz_oxide"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
+dependencies = [
+ "adler2",
+]
+
+[[package]]
+name = "mio"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
+dependencies = [
+ "hermit-abi 0.3.9",
+ "libc",
+ "wasi",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "multer"
+version = "3.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b"
+dependencies = [
+ "bytes",
+ "encoding_rs",
+ "futures-util",
+ "http 1.1.0",
+ "httparse",
+ "memchr",
+ "mime",
+ "spin",
+ "tokio",
+ "tokio-util",
+ "version_check",
+]
+
+[[package]]
+name = "native-tls"
+version = "0.2.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466"
+dependencies = [
+ "libc",
+ "log",
+ "openssl",
+ "openssl-probe",
+ "openssl-sys",
+ "schannel",
+ "security-framework",
+ "security-framework-sys",
+ "tempfile",
+]
+
+[[package]]
+name = "nom"
+version = "7.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
+dependencies = [
+ "memchr",
+ "minimal-lexical",
+]
+
+[[package]]
+name = "nu-ansi-term"
+version = "0.46.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
+dependencies = [
+ "overload",
+ "winapi",
+]
+
+[[package]]
+name = "num-bigint-dig"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151"
+dependencies = [
+ "byteorder",
+ "lazy_static",
+ "libm",
+ "num-integer",
+ "num-iter",
+ "num-traits",
+ "rand",
+ "smallvec",
+ "zeroize",
+]
+
+[[package]]
+name = "num-conv"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
+
+[[package]]
+name = "num-integer"
+version = "0.1.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "num-iter"
+version = "0.1.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
+dependencies = [
+ "autocfg",
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-traits"
+version = "0.2.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
+dependencies = [
+ "autocfg",
+ "libm",
+]
+
+[[package]]
+name = "num_cpus"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
+dependencies = [
+ "hermit-abi 0.3.9",
+ "libc",
+]
+
+[[package]]
+name = "object"
+version = "0.36.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.20.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
+
+[[package]]
+name = "openssl"
+version = "0.10.68"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5"
+dependencies = [
+ "bitflags",
+ "cfg-if",
+ "foreign-types",
+ "libc",
+ "once_cell",
+ "openssl-macros",
+ "openssl-sys",
+]
+
+[[package]]
+name = "openssl-macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "openssl-probe"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
+
+[[package]]
+name = "openssl-src"
+version = "300.3.2+3.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "openssl-sys"
+version = "0.9.104"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741"
+dependencies = [
+ "cc",
+ "libc",
+ "openssl-src",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
+name = "overload"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
+
+[[package]]
+name = "parking_lot"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "parse-zoneinfo"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24"
+dependencies = [
+ "regex",
+]
+
+[[package]]
+name = "paste"
+version = "1.0.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
+
+[[package]]
+name = "pear"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bdeeaa00ce488657faba8ebf44ab9361f9365a97bd39ffb8a60663f57ff4b467"
+dependencies = [
+ "inlinable_string",
+ "pear_codegen",
+ "yansi",
+]
+
+[[package]]
+name = "pear_codegen"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4bab5b985dc082b345f812b7df84e1bef27e7207b39e448439ba8bd69c93f147"
+dependencies = [
+ "proc-macro2",
+ "proc-macro2-diagnostics",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "pem-rfc7468"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"
+dependencies = [
+ "base64ct",
+]
+
+[[package]]
+name = "percent-encoding"
+version = "2.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
+
+[[package]]
+name = "pest"
+version = "2.7.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442"
+dependencies = [
+ "memchr",
+ "thiserror",
+ "ucd-trie",
+]
+
+[[package]]
+name = "pest_derive"
+version = "2.7.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd"
+dependencies = [
+ "pest",
+ "pest_generator",
+]
+
+[[package]]
+name = "pest_generator"
+version = "2.7.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e"
+dependencies = [
+ "pest",
+ "pest_meta",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "pest_meta"
+version = "2.7.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d"
+dependencies = [
+ "once_cell",
+ "pest",
+ "sha2",
+]
+
+[[package]]
+name = "phf"
+version = "0.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
+dependencies = [
+ "phf_shared",
+]
+
+[[package]]
+name = "phf_codegen"
+version = "0.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a"
+dependencies = [
+ "phf_generator",
+ "phf_shared",
+]
+
+[[package]]
+name = "phf_generator"
+version = "0.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
+dependencies = [
+ "phf_shared",
+ "rand",
+]
+
+[[package]]
+name = "phf_shared"
+version = "0.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
+dependencies = [
+ "siphasher",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
+
+[[package]]
+name = "pin-utils"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+
+[[package]]
+name = "pkcs1"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
+dependencies = [
+ "der",
+ "pkcs8",
+ "spki",
+]
+
+[[package]]
+name = "pkcs8"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
+dependencies = [
+ "der",
+ "spki",
+]
+
+[[package]]
+name = "pkg-config"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
+
+[[package]]
+name = "powerfmt"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
+
+[[package]]
+name = "ppv-lite86"
+version = "0.2.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
+dependencies = [
+ "zerocopy",
+]
+
+[[package]]
+name = "proc-macro-error"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
+dependencies = [
+ "proc-macro-error-attr",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro-error-attr"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.88"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "proc-macro2-diagnostics"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+ "version_check",
+ "yansi",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "rand"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
+dependencies = [
+ "libc",
+ "rand_chacha",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "ref-cast"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931"
+dependencies = [
+ "ref-cast-impl",
+]
+
+[[package]]
+name = "ref-cast-impl"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "regex"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata 0.4.8",
+ "regex-syntax 0.8.5",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
+dependencies = [
+ "regex-syntax 0.6.29",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax 0.8.5",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.6.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
+
+[[package]]
+name = "reqwest"
+version = "0.12.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b"
+dependencies = [
+ "base64 0.22.1",
+ "bytes",
+ "encoding_rs",
+ "futures-core",
+ "futures-util",
+ "h2 0.4.6",
+ "http 1.1.0",
+ "http-body 1.0.1",
+ "http-body-util",
+ "hyper 1.5.0",
+ "hyper-rustls",
+ "hyper-tls",
+ "hyper-util",
+ "ipnet",
+ "js-sys",
+ "log",
+ "mime",
+ "native-tls",
+ "once_cell",
+ "percent-encoding",
+ "pin-project-lite",
+ "rustls-pemfile 2.2.0",
+ "serde",
+ "serde_json",
+ "serde_urlencoded",
+ "sync_wrapper",
+ "system-configuration",
+ "tokio",
+ "tokio-native-tls",
+ "tower-service",
+ "url",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+ "windows-registry",
+]
+
+[[package]]
+name = "ring"
+version = "0.17.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
+dependencies = [
+ "cc",
+ "cfg-if",
+ "getrandom",
+ "libc",
+ "spin",
+ "untrusted",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "rocket"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a516907296a31df7dc04310e7043b61d71954d703b603cc6867a026d7e72d73f"
+dependencies = [
+ "async-stream",
+ "async-trait",
+ "atomic 0.5.3",
+ "binascii",
+ "bytes",
+ "either",
+ "figment",
+ "futures",
+ "indexmap",
+ "log",
+ "memchr",
+ "multer",
+ "num_cpus",
+ "parking_lot",
+ "pin-project-lite",
+ "rand",
+ "ref-cast",
+ "rocket_codegen",
+ "rocket_http",
+ "serde",
+ "serde_json",
+ "state",
+ "tempfile",
+ "time",
+ "tokio",
+ "tokio-stream",
+ "tokio-util",
+ "ubyte",
+ "version_check",
+ "yansi",
+]
+
+[[package]]
+name = "rocket-validation"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b0bd0f76c16ddcc84567f362bdf9c0075968e096288da9a42bf1da9a3e42e47"
+dependencies = [
+ "rocket",
+ "validator",
+]
+
+[[package]]
+name = "rocket_codegen"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "575d32d7ec1a9770108c879fc7c47815a80073f96ca07ff9525a94fcede1dd46"
+dependencies = [
+ "devise",
+ "glob",
+ "indexmap",
+ "proc-macro2",
+ "quote",
+ "rocket_http",
+ "syn 2.0.79",
+ "unicode-xid",
+ "version_check",
+]
+
+[[package]]
+name = "rocket_db_pools"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6578b2740ceee3e78bff63fe9299d964b7e68318446cdcb9af3b9cab46e1e9d"
+dependencies = [
+ "rocket",
+ "rocket_db_pools_codegen",
+ "sqlx",
+ "version_check",
+]
+
+[[package]]
+name = "rocket_db_pools_codegen"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "842e859f2e87a23efc0f81e25756c0fb43f18726e62daf99da7ea19fbc56cebd"
+dependencies = [
+ "devise",
+ "quote",
+]
+
+[[package]]
+name = "rocket_http"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e274915a20ee3065f611c044bd63c40757396b6dbc057d6046aec27f14f882b9"
+dependencies = [
+ "cookie",
+ "either",
+ "futures",
+ "http 0.2.12",
+ "hyper 0.14.31",
+ "indexmap",
+ "log",
+ "memchr",
+ "pear",
+ "percent-encoding",
+ "pin-project-lite",
+ "ref-cast",
+ "serde",
+ "smallvec",
+ "stable-pattern",
+ "state",
+ "time",
+ "tokio",
+ "uncased",
+]
+
+[[package]]
+name = "rsa"
+version = "0.9.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc"
+dependencies = [
+ "const-oid",
+ "digest",
+ "num-bigint-dig",
+ "num-integer",
+ "num-traits",
+ "pkcs1",
+ "pkcs8",
+ "rand_core",
+ "signature",
+ "spki",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustc-demangle"
+version = "0.1.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
+
+[[package]]
+name = "rustix"
+version = "0.38.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811"
+dependencies = [
+ "bitflags",
+ "errno",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "rustls"
+version = "0.21.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
+dependencies = [
+ "ring",
+ "rustls-webpki 0.101.7",
+ "sct",
+]
+
+[[package]]
+name = "rustls"
+version = "0.23.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f1a745511c54ba6d4465e8d5dfbd81b45791756de28d4981af70d6dca128f1e"
+dependencies = [
+ "once_cell",
+ "rustls-pki-types",
+ "rustls-webpki 0.102.8",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-pemfile"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
+dependencies = [
+ "base64 0.21.7",
+]
+
+[[package]]
+name = "rustls-pemfile"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50"
+dependencies = [
+ "rustls-pki-types",
+]
+
+[[package]]
+name = "rustls-pki-types"
+version = "1.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b"
+
+[[package]]
+name = "rustls-webpki"
+version = "0.101.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
+dependencies = [
+ "ring",
+ "untrusted",
+]
+
+[[package]]
+name = "rustls-webpki"
+version = "0.102.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
+[[package]]
+name = "rustversion"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248"
+
+[[package]]
+name = "ryu"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
+
+[[package]]
+name = "same-file"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "scalar-doc"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d144ef6022602a2adcb35a28254e1a9600484054a57e912e3da9632e83c52075"
+dependencies = [
+ "anyhow",
+ "serde",
+ "serde_json",
+ "tera",
+]
+
+[[package]]
+name = "schannel"
+version = "0.1.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1"
+dependencies = [
+ "windows-sys 0.59.0",
+]
+
+[[package]]
+name = "scoped-tls"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "sct"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
+dependencies = [
+ "ring",
+ "untrusted",
+]
+
+[[package]]
+name = "security-framework"
+version = "2.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
+dependencies = [
+ "bitflags",
+ "core-foundation",
+ "core-foundation-sys",
+ "libc",
+ "security-framework-sys",
+]
+
+[[package]]
+name = "security-framework-sys"
+version = "2.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "serde"
+version = "1.0.210"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.210"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "610f75ff4a8e3cb29b85da56eabdd1bff5b06739059a4b8e2967fef32e5d9944"
+dependencies = [
+ "itoa",
+ "memchr",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "serde_spanned"
+version = "0.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "serde_urlencoded"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
+dependencies = [
+ "form_urlencoded",
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "sha1"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
+
+[[package]]
+name = "sha2"
+version = "0.10.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
+
+[[package]]
+name = "sharded-slab"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
+dependencies = [
+ "lazy_static",
+]
+
+[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
+[[package]]
+name = "signal-hook-registry"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "signature"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
+dependencies = [
+ "digest",
+ "rand_core",
+]
+
+[[package]]
+name = "siphasher"
+version = "0.3.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
+
+[[package]]
+name = "slab"
+version = "0.4.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "slug"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "882a80f72ee45de3cc9a5afeb2da0331d58df69e4e7d8eeb5d3c7784ae67e724"
+dependencies = [
+ "deunicode",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "smallvec"
+version = "1.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+
+[[package]]
+name = "socket2"
+version = "0.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
+dependencies = [
+ "libc",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "spin"
+version = "0.9.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
+dependencies = [
+ "lock_api",
+]
+
+[[package]]
+name = "spki"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
+dependencies = [
+ "base64ct",
+ "der",
+]
+
+[[package]]
+name = "sqlformat"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7bba3a93db0cc4f7bdece8bb09e77e2e785c20bfebf79eb8340ed80708048790"
+dependencies = [
+ "nom",
+ "unicode_categories",
+]
+
+[[package]]
+name = "sqlx"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa"
+dependencies = [
+ "sqlx-core",
+ "sqlx-macros",
+ "sqlx-mysql",
+ "sqlx-postgres",
+ "sqlx-sqlite",
+]
+
+[[package]]
+name = "sqlx-core"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6"
+dependencies = [
+ "ahash",
+ "atoi",
+ "byteorder",
+ "bytes",
+ "chrono",
+ "crc",
+ "crossbeam-queue",
+ "either",
+ "event-listener",
+ "futures-channel",
+ "futures-core",
+ "futures-intrusive",
+ "futures-io",
+ "futures-util",
+ "hashlink",
+ "hex",
+ "indexmap",
+ "log",
+ "memchr",
+ "once_cell",
+ "paste",
+ "percent-encoding",
+ "rustls 0.21.12",
+ "rustls-pemfile 1.0.4",
+ "serde",
+ "serde_json",
+ "sha2",
+ "smallvec",
+ "sqlformat",
+ "thiserror",
+ "tokio",
+ "tokio-stream",
+ "tracing",
+ "url",
+ "webpki-roots",
+]
+
+[[package]]
+name = "sqlx-macros"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "sqlx-core",
+ "sqlx-macros-core",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "sqlx-macros-core"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8"
+dependencies = [
+ "dotenvy",
+ "either",
+ "heck",
+ "hex",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "serde",
+ "serde_json",
+ "sha2",
+ "sqlx-core",
+ "sqlx-mysql",
+ "sqlx-postgres",
+ "sqlx-sqlite",
+ "syn 1.0.109",
+ "tempfile",
+ "tokio",
+ "url",
+]
+
+[[package]]
+name = "sqlx-mysql"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418"
+dependencies = [
+ "atoi",
+ "base64 0.21.7",
+ "bitflags",
+ "byteorder",
+ "bytes",
+ "chrono",
+ "crc",
+ "digest",
+ "dotenvy",
+ "either",
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-util",
+ "generic-array",
+ "hex",
+ "hkdf",
+ "hmac",
+ "itoa",
+ "log",
+ "md-5",
+ "memchr",
+ "once_cell",
+ "percent-encoding",
+ "rand",
+ "rsa",
+ "serde",
+ "sha1",
+ "sha2",
+ "smallvec",
+ "sqlx-core",
+ "stringprep",
+ "thiserror",
+ "tracing",
+ "whoami",
+]
+
+[[package]]
+name = "sqlx-postgres"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e"
+dependencies = [
+ "atoi",
+ "base64 0.21.7",
+ "bitflags",
+ "byteorder",
+ "chrono",
+ "crc",
+ "dotenvy",
+ "etcetera",
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-util",
+ "hex",
+ "hkdf",
+ "hmac",
+ "home",
+ "itoa",
+ "log",
+ "md-5",
+ "memchr",
+ "once_cell",
+ "rand",
+ "serde",
+ "serde_json",
+ "sha2",
+ "smallvec",
+ "sqlx-core",
+ "stringprep",
+ "thiserror",
+ "tracing",
+ "whoami",
+]
+
+[[package]]
+name = "sqlx-sqlite"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa"
+dependencies = [
+ "atoi",
+ "chrono",
+ "flume",
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-intrusive",
+ "futures-util",
+ "libsqlite3-sys",
+ "log",
+ "percent-encoding",
+ "serde",
+ "sqlx-core",
+ "tracing",
+ "url",
+ "urlencoding",
+]
+
+[[package]]
+name = "stable-pattern"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4564168c00635f88eaed410d5efa8131afa8d8699a612c80c455a0ba05c21045"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "state"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b8c4a4445d81357df8b1a650d0d0d6fbbbfe99d064aa5e02f3e4022061476d8"
+dependencies = [
+ "loom",
+]
+
+[[package]]
+name = "stringprep"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"
+dependencies = [
+ "unicode-bidi",
+ "unicode-normalization",
+ "unicode-properties",
+]
+
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
+[[package]]
+name = "syn"
+version = "1.0.109"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.79"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "sync_wrapper"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "system-configuration"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"
+dependencies = [
+ "bitflags",
+ "core-foundation",
+ "system-configuration-sys",
+]
+
+[[package]]
+name = "system-configuration-sys"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "tempfile"
+version = "3.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b"
+dependencies = [
+ "cfg-if",
+ "fastrand",
+ "once_cell",
+ "rustix",
+ "windows-sys 0.59.0",
+]
+
+[[package]]
+name = "tera"
+version = "1.20.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab9d851b45e865f178319da0abdbfe6acbc4328759ff18dafc3a41c16b4cd2ee"
+dependencies = [
+ "chrono",
+ "chrono-tz",
+ "globwalk",
+ "humansize",
+ "lazy_static",
+ "percent-encoding",
+ "pest",
+ "pest_derive",
+ "rand",
+ "regex",
+ "serde",
+ "serde_json",
+ "slug",
+ "unic-segment",
+]
+
+[[package]]
+name = "thiserror"
+version = "1.0.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "thread_local"
+version = "1.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+]
+
+[[package]]
+name = "time"
+version = "0.3.36"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
+dependencies = [
+ "deranged",
+ "itoa",
+ "num-conv",
+ "powerfmt",
+ "serde",
+ "time-core",
+ "time-macros",
+]
+
+[[package]]
+name = "time-core"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
+
+[[package]]
+name = "time-macros"
+version = "0.2.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
+dependencies = [
+ "num-conv",
+ "time-core",
+]
+
+[[package]]
+name = "tinyvec"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
+[[package]]
+name = "tokio"
+version = "1.40.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
+dependencies = [
+ "backtrace",
+ "bytes",
+ "libc",
+ "mio",
+ "pin-project-lite",
+ "signal-hook-registry",
+ "socket2",
+ "tokio-macros",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "tokio-native-tls"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
+dependencies = [
+ "native-tls",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-rustls"
+version = "0.26.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
+dependencies = [
+ "rustls 0.23.17",
+ "rustls-pki-types",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-stream"
+version = "0.1.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1"
+dependencies = [
+ "futures-core",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-util"
+version = "0.7.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "futures-sink",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
+name = "toml"
+version = "0.8.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
+dependencies = [
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "toml_edit",
+]
+
+[[package]]
+name = "toml_datetime"
+version = "0.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.22.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
+dependencies = [
+ "indexmap",
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "winnow",
+]
+
+[[package]]
+name = "tower-service"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
+
+[[package]]
+name = "tracing"
+version = "0.1.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
+dependencies = [
+ "log",
+ "pin-project-lite",
+ "tracing-attributes",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-attributes"
+version = "0.1.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
+dependencies = [
+ "once_cell",
+ "valuable",
+]
+
+[[package]]
+name = "tracing-log"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
+dependencies = [
+ "log",
+ "once_cell",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.3.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
+dependencies = [
+ "matchers",
+ "nu-ansi-term",
+ "once_cell",
+ "regex",
+ "sharded-slab",
+ "smallvec",
+ "thread_local",
+ "tracing",
+ "tracing-core",
+ "tracing-log",
+]
+
+[[package]]
+name = "try-lock"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+
+[[package]]
+name = "typenum"
+version = "1.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
+
+[[package]]
+name = "ubyte"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f720def6ce1ee2fc44d40ac9ed6d3a59c361c80a75a7aa8e75bb9baed31cf2ea"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "ucd-trie"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
+
+[[package]]
+name = "uncased"
+version = "0.9.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697"
+dependencies = [
+ "serde",
+ "version_check",
+]
+
+[[package]]
+name = "unic-char-property"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221"
+dependencies = [
+ "unic-char-range",
+]
+
+[[package]]
+name = "unic-char-range"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc"
+
+[[package]]
+name = "unic-common"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc"
+
+[[package]]
+name = "unic-segment"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23"
+dependencies = [
+ "unic-ucd-segment",
+]
+
+[[package]]
+name = "unic-ucd-segment"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700"
+dependencies = [
+ "unic-char-property",
+ "unic-char-range",
+ "unic-ucd-version",
+]
+
+[[package]]
+name = "unic-ucd-version"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4"
+dependencies = [
+ "unic-common",
+]
+
+[[package]]
+name = "unicode-bidi"
+version = "0.3.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
+
+[[package]]
+name = "unicode-normalization"
+version = "0.1.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
+dependencies = [
+ "tinyvec",
+]
+
+[[package]]
+name = "unicode-properties"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"
+
+[[package]]
+name = "unicode-segmentation"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
+
+[[package]]
+name = "unicode-xid"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
+
+[[package]]
+name = "unicode_categories"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
+
+[[package]]
+name = "untrusted"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+
+[[package]]
+name = "url"
+version = "2.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
+dependencies = [
+ "form_urlencoded",
+ "idna 0.5.0",
+ "percent-encoding",
+]
+
+[[package]]
+name = "urlencoding"
+version = "2.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
+
+[[package]]
+name = "validator"
+version = "0.16.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b92f40481c04ff1f4f61f304d61793c7b56ff76ac1469f1beb199b1445b253bd"
+dependencies = [
+ "idna 0.4.0",
+ "lazy_static",
+ "regex",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "url",
+ "validator_derive",
+]
+
+[[package]]
+name = "validator_derive"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc44ca3088bb3ba384d9aecf40c6a23a676ce23e09bdaca2073d99c207f864af"
+dependencies = [
+ "if_chain",
+ "lazy_static",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "regex",
+ "syn 1.0.109",
+ "validator_types",
+]
+
+[[package]]
+name = "validator_types"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "111abfe30072511849c5910134e8baf8dc05de4c0e5903d681cbd5c9c4d611e3"
+dependencies = [
+ "proc-macro2",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "valuable"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
+
+[[package]]
+name = "vcpkg"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+
+[[package]]
+name = "version_check"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+
+[[package]]
+name = "walkdir"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
+dependencies = [
+ "same-file",
+ "winapi-util",
+]
+
+[[package]]
+name = "want"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+dependencies = [
+ "try-lock",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
+
+[[package]]
+name = "wasite"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
+
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.95"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+ "wasm-bindgen-macro",
+]
+
+[[package]]
+name = "wasm-bindgen-backend"
+version = "0.2.95"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
+dependencies = [
+ "bumpalo",
+ "log",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-futures"
+version = "0.4.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.95"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.95"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+ "wasm-bindgen-backend",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.95"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
+
+[[package]]
+name = "web-sys"
+version = "0.3.72"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "webpki-roots"
+version = "0.25.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
+
+[[package]]
+name = "whoami"
+version = "1.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d"
+dependencies = [
+ "redox_syscall",
+ "wasite",
+]
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-util"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
+dependencies = [
+ "windows-sys 0.59.0",
+]
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
+dependencies = [
+ "windows-targets 0.48.5",
+]
+
+[[package]]
+name = "windows-core"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "windows-registry"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0"
+dependencies = [
+ "windows-result",
+ "windows-strings",
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "windows-result"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "windows-strings"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
+dependencies = [
+ "windows-result",
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+dependencies = [
+ "windows-targets 0.48.5",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm 0.48.5",
+ "windows_aarch64_msvc 0.48.5",
+ "windows_i686_gnu 0.48.5",
+ "windows_i686_msvc 0.48.5",
+ "windows_x86_64_gnu 0.48.5",
+ "windows_x86_64_gnullvm 0.48.5",
+ "windows_x86_64_msvc 0.48.5",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm 0.52.6",
+ "windows_aarch64_msvc 0.52.6",
+ "windows_i686_gnu 0.52.6",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc 0.52.6",
+ "windows_x86_64_gnu 0.52.6",
+ "windows_x86_64_gnullvm 0.52.6",
+ "windows_x86_64_msvc 0.52.6",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "winnow"
+version = "0.6.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "yansi"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
+dependencies = [
+ "is-terminal",
+]
+
+[[package]]
+name = "zerocopy"
+version = "0.7.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
+dependencies = [
+ "byteorder",
+ "zerocopy-derive",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.7.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.79",
+]
+
+[[package]]
+name = "zeroize"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
diff --git a/echo/Cargo.toml b/echo/Cargo.toml
new file mode 100644
index 00000000..c38a1b4c
--- /dev/null
+++ b/echo/Cargo.toml
@@ -0,0 +1,27 @@
+[package]
+name = "echo"
+version = "1.0.0"
+publish = false
+edition = "2021"
+
+[dependencies]
+base64 = "0.22.1"
+chrono = { version = "0.4.38", features = ["serde"] }
+figment = { version = "0.10.19", features = ["json"] }
+once_cell = "1.20.2"
+rand = "0.8.5"
+regex = "1.11.1"
+reqwest = { version = "0.12.8", features = ["json", "native-tls-alpn", "native-tls-vendored"] }
+rocket = { version = "0.5.1", features = ["json"] }
+rocket-validation = "0.2.0"
+rocket_db_pools = { version = "0.2.0", features = ["sqlx_postgres"] }
+scalar-doc = "0.1.0"
+serde = "1.0.210"
+sqlx = { version = "0.7.4", features = ["chrono"] }
+tokio = "1.40.0"
+validator = "0.16.1"
+
+[profile.release]
+lto = true
+strip = true
+codegen-units = 1
diff --git a/echo/Dockerfile b/echo/Dockerfile
new file mode 100644
index 00000000..d8862e2d
--- /dev/null
+++ b/echo/Dockerfile
@@ -0,0 +1,54 @@
+FROM rust:1.82.0 AS build
+
+ARG PROFILE=release
+
+WORKDIR /build
+
+RUN mkdir bin && \
+ apt update -y && apt upgrade -y && apt install -y musl-tools && \
+ rustup target add x86_64-unknown-linux-musl
+
+# NOTE: Due to caching this is actually faster than using
+# Two separate cargo builds (one without source present).
+RUN --mount=type=cache,target=target \
+ --mount=type=cache,target=/usr/local/cargo/git \
+ --mount=type=cache,target=/usr/local/cargo/registry \
+ --mount=type=bind,source=src,target=src \
+ --mount=type=bind,source=openapi.json,target=openapi.json \
+ --mount=type=bind,source=Cargo.toml,target=Cargo.toml,readwrite \
+ --mount=type=bind,source=Cargo.lock,target=Cargo.lock,readwrite \
+ # Use musl target as the binary is about 1MiB smaller
+ cargo build --profile $PROFILE --target x86_64-unknown-linux-musl && \
+ # The "dev" target directory is named "debug" instead
+ [ $PROFILE = "dev" ] && FOLDER="debug" || FOLDER="release"; \
+ # Copy output into an unmounted directory for copying
+ cp target/x86_64-unknown-linux-musl/$FOLDER/echo /build/bin && \
+ cp target/x86_64-unknown-linux-musl/$FOLDER/healthcheck /build/bin
+
+FROM scratch AS image
+
+ARG PROFILE
+
+LABEL org.opencontainers.image.title="MystBin Echo"
+LABEL org.opencontainers.image.authors="Lilly Rose Berner "
+
+EXPOSE 8000
+WORKDIR /opt/echo
+
+# Non-empty value to enable
+ENV RUST_BACKTRACE=$PROFILE
+
+ENV PATH=/opt/echo/bin
+ENV ROCKET_CONFIG=/etc/opt/echo/Rocket.toml
+
+COPY Rocket.toml $ROCKET_CONFIG
+
+COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
+
+# Copy last so prior steps are cached doing many rebuilds
+COPY --from=build /build/bin bin
+
+HEALTHCHECK --interval=5s --start-interval=1s --retries=1 --timeout=5s --start-period=1m CMD ["healthcheck"]
+
+USER 101:101
+CMD ["echo"]
diff --git a/echo/README.md b/echo/README.md
new file mode 100644
index 00000000..7e35dbed
--- /dev/null
+++ b/echo/README.md
@@ -0,0 +1,12 @@
+# Echo
+
+Run development environment:
+
+```sh
+cp example.config.json config.json
+vim config.json # Edit to your liking
+
+PROFILE=dev sh -c 'docker compose up --build --watch'
+```
+
+To run a production-like setup instead run `docker compose up`.
diff --git a/echo/Rocket.toml b/echo/Rocket.toml
new file mode 100644
index 00000000..5b8ab7fb
--- /dev/null
+++ b/echo/Rocket.toml
@@ -0,0 +1,8 @@
+[default]
+ident = "Echo"
+
+address = "0.0.0.0"
+ip_header = "x-forwarded-for"
+
+[default.databases.postgres]
+url = "postgres://echo@db"
diff --git a/echo/docker-compose.yaml b/echo/docker-compose.yaml
new file mode 100644
index 00000000..131106c7
--- /dev/null
+++ b/echo/docker-compose.yaml
@@ -0,0 +1,68 @@
+name: echo
+
+services:
+ echo:
+ build:
+ context: .
+ args:
+ - PROFILE
+ cap_drop:
+ - ALL
+ read_only: true
+ security_opt:
+ - no-new-privileges=true
+ networks:
+ - public
+ - hidden
+ ports:
+ - ${HOST:-127.0.0.1}:${PORT:-8000}:8000
+ restart: always
+ depends_on:
+ db:
+ restart: true
+ condition: service_healthy
+ environment:
+ - ECHO_CONFIG=/etc/opt/echo/config.json
+ volumes:
+ - ./config.json:/etc/opt/echo/config.json:ro
+ develop:
+ watch:
+ - path: src/
+ action: rebuild
+
+ db:
+ image: postgres:17-alpine
+ cap_add:
+ - CHOWN
+ - DAC_READ_SEARCH
+ - FOWNER
+ - SETGID
+ - SETUID
+ cap_drop:
+ - ALL
+ read_only: true
+ security_opt:
+ - no-new-privileges=true
+ networks:
+ - hidden
+ restart: always
+ tmpfs:
+ - /tmp
+ - /run/postgresql
+ environment:
+ - POSTGRES_HOST_AUTH_METHOD=trust
+ volumes:
+ - ./schema:/docker-entrypoint-initdb.d:ro
+ - ./data/postgres:/var/lib/postgresql/data:rw
+ healthcheck:
+ test: ["CMD", "pg_isready", "-U", "echo"]
+ interval: 5s
+ start_interval: 1s
+ retries: 1
+ timeout: 5s
+ start_period: 1m
+
+networks:
+ public:
+ hidden:
+ internal: true
diff --git a/echo/example.config.json b/echo/example.config.json
new file mode 100644
index 00000000..4b410664
--- /dev/null
+++ b/echo/example.config.json
@@ -0,0 +1,8 @@
+{
+ "allowed_hosts": ["http://localhost:1234", "https://mystb.in"],
+ "github_token": "github_pat_KOBfYbSdPtOGcvSMdkoUye_IWEadGCSJxVffBVHZZRSCXBqvhKzKTaddmyBaZcHxWLdJQIOhJbpsbiEWx",
+ "extra_scanners": [
+ { "name": "PyPi", "pattern": "pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{70,}", "invalidate": true },
+ { "name": "GitHub", "pattern": "((ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36})", "invalidate": true }
+ ]
+}
diff --git a/echo/openapi.json b/echo/openapi.json
new file mode 100644
index 00000000..4b6ebab0
--- /dev/null
+++ b/echo/openapi.json
@@ -0,0 +1,466 @@
+{
+ "openapi": "3.1.3",
+ "info": {
+ "title": "MystBin API",
+ "description": "MystBin API endpoints and types.",
+ "version": "5.0.0",
+ "contact": {
+ "name": "MystBin",
+ "email": "support@mystb.in"
+ }
+ },
+ "tags": [
+ {
+ "name": "Paste",
+ "description": "Endpoints relating to Pastes."
+ },
+ {
+ "name": "Security",
+ "description": "Endpoints relating to Security tokens."
+ }
+ ],
+ "servers": [
+ {
+ "url": "https://api.mystb.in",
+ "description": "The MystBin production server."
+ }
+ ],
+ "paths": {
+ "/pastes": {
+ "post": {
+ "summary": "Create New Paste",
+ "description": "Create a new Paste containing up to five files.",
+ "operationId": "create-paste",
+ "tags": ["Paste"],
+ "requestBody": {
+ "description": "Data used to create a new Paste.",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreatePaste"
+ }
+ },
+ "text/plain": {
+ "schema": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 300000,
+ "description": "Content for a Paste containing a single File."
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "A new Paste has been created.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "$ref": "#/components/schemas/Paste"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Request body malformed or incorrect.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "422": {
+ "description": "Request body contained semantic errors.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/pastes/{id}": {
+ "parameters": [
+ {
+ "schema": {
+ "type": "string"
+ },
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "description": "The Paste id."
+ }
+ ],
+ "get": {
+ "summary": "Fetch Existing Paste",
+ "description": "View an existing Paste.",
+ "operationId": "get-paste",
+ "tags": ["Paste"],
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "format": "password",
+ "description": "A password to access a secret Paste. Must have `Password` prefix."
+ },
+ "required": false,
+ "in": "header",
+ "name": "Authorization"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "The requested Paste.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Paste"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "You are not authorized to view the requested Paste.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "The requested Paste does not exist, has too many views, or has expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/security/{token}": {
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "format": "password",
+ "description": "The security token returned when creating the Paste."
+ },
+ "required": true,
+ "in": "path",
+ "name": "token"
+ }
+ ],
+ "get": {
+ "summary": "Security Token Info",
+ "description": "View which Paste a particular security token is associated with.",
+ "operationId": "security-info",
+ "tags": ["Security"],
+ "responses": {
+ "200": {
+ "description": "Information about the Paste associated with this token.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PasteInfo"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "The provided security token is not valid.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ },
+ "delete": {
+ "summary": "Delete Paste with Security Token",
+ "description": "Delete the Paste associated with this security token.",
+ "operationId": "security-delete",
+ "tags": ["Security"],
+ "responses": {
+ "200": {
+ "description": "The Paste has successfully been deleted.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PasteInfo"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "The provided security token is not valid.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Position": {
+ "title": "Position",
+ "type": "object",
+ "description": "Describes a position inside a File.",
+ "properties": {
+ "line": {
+ "type": "integer",
+ "description": "A line inside a File."
+ },
+ "char": {
+ "type": "integer",
+ "description": "A specific character on the aforementioned line."
+ }
+ }
+ },
+ "Annotation": {
+ "title": "Annotation",
+ "type": "object",
+ "description": "Auto-generated notices about File contents. May disclose things such as authentication tokens that were accidentally included.",
+ "properties": {
+ "head": {
+ "type": "object",
+ "description": "Annotated area start.",
+ "items": {
+ "$ref": "#/components/schemas/Position"
+ }
+ },
+ "tail": {
+ "type": "object",
+ "description": "Annotated area end.",
+ "items": {
+ "$ref": "#/components/schemas/Position"
+ }
+ },
+ "content": {
+ "type": "string",
+ "description": "Reason this annotation was generated. Should be shown to the end user."
+ }
+ },
+ "example": {
+ "head": {
+ "line": 3,
+ "char": 5
+ },
+ "tail": {
+ "line": 3,
+ "char": 15
+ },
+ "content": "Contains a MystBin authentication token!"
+ }
+ },
+ "File": {
+ "title": "File",
+ "type": "object",
+ "description": "A File associated with a Paste.",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "A short name for the File."
+ },
+ "content": {
+ "type": "string",
+ "description": "The File's content."
+ },
+ "language": {
+ "type": "string",
+ "nullable": true,
+ "description": "Syntax highlighting language for the File."
+ },
+ "lines": {
+ "type": "integer",
+ "description": "Amount of newlines the content has."
+ },
+ "characters": {
+ "type": "integer",
+ "description": "Total character count inside the content."
+ },
+ "annotations": {
+ "type": "array",
+ "description": "Auto-generated notices about File content.",
+ "items": {
+ "$ref": "#/components/schemas/Annotation"
+ }
+ }
+ },
+ "example": {
+ "name": "beaver.txt",
+ "content": "Beavers are soo cute!",
+ "language": "plaintext",
+ "lines": 1,
+ "characters": 21,
+ "annotations": []
+ }
+ },
+ "Paste": {
+ "title": "Paste",
+ "type": "object",
+ "description": "A Paste containing one or more Files.",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "An auto-generated unique identifier for this Paste."
+ },
+ "created_at": {
+ "type": "string",
+ "description": "Timestamp at which this Paste was created.",
+ "format": "date-time"
+ },
+ "expires_at": {
+ "type": "string",
+ "description": "Timestamp at which this Paste will automatically be deleted.",
+ "format": "date-time",
+ "nullable": true
+ },
+ "views": {
+ "type": "integer",
+ "description": "Amount of times this Paste has been accessed after creation."
+ },
+ "max_views": {
+ "type": "integer",
+ "description": "Total amount of accesses before the Paste is automatically deleted.",
+ "nullable": true
+ },
+ "files": {
+ "type": "array",
+ "description": "The Files associated with this Paste.",
+ "items": {
+ "$ref": "#/components/schemas/File"
+ }
+ },
+ "security": {
+ "type": "string",
+ "description": "A unique token that allows deleting the Paste. Present when creating a Paste only.",
+ "nullable": true
+ }
+ }
+ },
+ "PasteInfo": {
+ "title": "PasteInfo",
+ "type": "object",
+ "description": "Sparse information about a Paste.",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "The unique identifier for the Paste."
+ }
+ }
+ },
+ "CreateFile": {
+ "title": "CreateFile",
+ "type": "object",
+ "description": "Data used to create a new File.",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 32,
+ "description": "The File's name. Defaults to 'unknown'."
+ },
+ "content": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 300000,
+ "description": "The File's content."
+ },
+ "language": {
+ "type": "string",
+ "description": "Syntax highlighting language for the File."
+ }
+ },
+ "required": ["content"],
+ "example": {
+ "name": "beaver.txt",
+ "content": "Beavers are soo cute!"
+ }
+ },
+ "CreatePaste": {
+ "title": "CreatePaste",
+ "type": "object",
+ "description": "Data used to create a new Paste.",
+ "properties": {
+ "files": {
+ "type": "array",
+ "minItems": 1,
+ "maxItems": 5,
+ "description": "Files to create inside this Paste.",
+ "items": {
+ "$ref": "#/components/schemas/CreateFile"
+ }
+ },
+ "password": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 72,
+ "format": "password",
+ "description": "An optional secret required to view the Paste."
+ },
+ "max_views": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 128,
+ "description": "The maximum amount of times this Paste may be accessed."
+ },
+ "expires_at": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Timestamp at which this Paste will automatically be deleted."
+ }
+ },
+ "required": ["files"],
+ "example": {
+ "files": [
+ {
+ "name": "secret.txt",
+ "content": "This file disappears after you view it!"
+ }
+ ],
+ "password": "shh",
+ "max_views": 1
+ }
+ },
+ "ErrorResponse": {
+ "title": "ErrorResponse",
+ "type": "object",
+ "description": "Generic response when something went wrong.",
+ "properties": {
+ "message": {
+ "type": "string",
+ "description": "The error message."
+ },
+ "errors": {
+ "type": "object",
+ "description": "Detailed information on the error. May not be present."
+ }
+ },
+ "required": ["message"]
+ }
+ }
+ }
+}
diff --git a/echo/schema/00-init.sh b/echo/schema/00-init.sh
new file mode 100644
index 00000000..60152ec9
--- /dev/null
+++ b/echo/schema/00-init.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -euf -o pipefail
+
+psql -v ON_ERROR_STOP=1 --username "postgres" --dbname "postgres" <<-EOSQL
+ CREATE ROLE echo WITH login;
+ CREATE DATABASE echo WITH OWNER echo;
+EOSQL
diff --git a/echo/schema/01-base.sh b/echo/schema/01-base.sh
new file mode 100644
index 00000000..d8b0c1ab
--- /dev/null
+++ b/echo/schema/01-base.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -euf -o pipefail
+
+psql -v ON_ERROR_STOP=1 --username "echo" --dbname "echo" <<-EOSQL
+ CREATE EXTENSION IF NOT EXISTS pgcrypto;
+
+ CREATE TABLE IF NOT EXISTS pastes (
+ id TEXT PRIMARY KEY,
+ created_at TIMESTAMPTZ NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
+ expires_at TIMESTAMPTZ,
+ views BIGINT NOT NULL DEFAULT 0,
+ max_views SMALLINT,
+ password TEXT,
+ safety TEXT UNIQUE
+ );
+
+ -- Index by safety keys for faster lookup to delete.
+ CREATE UNIQUE INDEX IF NOT EXISTS pastes_safety_idx ON pastes (safety);
+
+ CREATE TABLE IF NOT EXISTS files (
+ id BIGSERIAL PRIMARY KEY NOT NULL,
+ paste_id TEXT REFERENCES pastes(id) ON DELETE CASCADE,
+ name TEXT NOT NULL,
+ content TEXT NOT NULL,
+ language TEXT, -- highlight.js syntax highlighting language
+ lines INTEGER NOT NULL GENERATED ALWAYS AS (LENGTH(REGEXP_REPLACE(content, '[^\n]', '', 'g')) + 1) STORED,
+ characters INTEGER NOT NULL GENERATED ALWAYS AS (LENGTH(content)) STORED
+ );
+
+ CREATE TABLE IF NOT EXISTS annotations (
+ id BIGSERIAL PRIMARY KEY NOT NULL,
+ file_id BIGINT REFERENCES files(id) ON DELETE CASCADE,
+ head_line INTEGER NOT NULL,
+ head_char INTEGER NOT NULL,
+ tail_line INTEGER NOT NULL,
+ tail_char INTEGER NOT NULL,
+ content TEXT NOT NULL
+ );
+EOSQL
diff --git a/echo/src/bin/healthcheck.rs b/echo/src/bin/healthcheck.rs
new file mode 100644
index 00000000..3648e1f3
--- /dev/null
+++ b/echo/src/bin/healthcheck.rs
@@ -0,0 +1,16 @@
+use std::{
+ io::{Read, Write},
+ net::TcpStream,
+};
+
+fn main() {
+ let mut stream = TcpStream::connect("127.0.0.1:8000").expect("tcp connect");
+
+ let data = "GET /health HTTP/1.1\r\n\r\n";
+ stream.write_all(data.as_bytes()).expect("write data");
+
+ let mut buffer = [0; 12];
+ stream.read(&mut buffer).expect("read data");
+
+ assert!(buffer == "HTTP/1.1 200".as_bytes(), "response is not ok");
+}
diff --git a/echo/src/config.rs b/echo/src/config.rs
new file mode 100644
index 00000000..a39ff97c
--- /dev/null
+++ b/echo/src/config.rs
@@ -0,0 +1,19 @@
+use std::sync::Arc;
+
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Deserialize, Serialize)]
+pub struct ScannerConfig {
+ pub name: Arc,
+ pub pattern: String,
+ pub invalidate: bool,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+pub struct Config {
+ // CORS
+ pub allowed_hosts: Vec,
+ // Secret Scanning
+ pub github_token: String,
+ pub extra_scanners: Vec,
+}
diff --git a/echo/src/cors.rs b/echo/src/cors.rs
new file mode 100644
index 00000000..d5d5ef77
--- /dev/null
+++ b/echo/src/cors.rs
@@ -0,0 +1,46 @@
+use rocket::{
+ fairing::{Fairing, Info, Kind},
+ http::Header,
+ options, Request, Response,
+};
+
+use crate::config::Config;
+
+// Ensure the server responds to all preflight requests
+#[options("/<_..>")]
+pub fn snatcher() {}
+
+pub struct CorsHeaders;
+
+#[rocket::async_trait]
+impl Fairing for CorsHeaders {
+ fn info(&self) -> Info {
+ Info {
+ name: "CORS Headers",
+ kind: Kind::Response,
+ }
+ }
+
+ async fn on_response<'r>(&self, request: &'r Request<'_>, response: &mut Response<'r>) {
+ let origin = match request.headers().get_one("Origin") {
+ Some(value) => value,
+ None => return,
+ };
+
+ let config = request.rocket().state::().unwrap();
+
+ if !config.allowed_hosts.iter().any(|x| x == origin) {
+ return;
+ }
+
+ response.set_header(Header::new("Access-Control-Allow-Origin", origin));
+
+ response.set_header(Header::new(
+ "Access-Control-Allow-Methods",
+ "DELETE, GET, PATCH, POST, PUT, QUERY",
+ ));
+ response.set_header(Header::new("Access-Control-Max-Age", "86400"));
+ response.set_header(Header::new("Access-Control-Allow-Credentials", "true"));
+ response.set_header(Header::new("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization"));
+ }
+}
diff --git a/echo/src/database/background_task.rs b/echo/src/database/background_task.rs
new file mode 100644
index 00000000..84ab789b
--- /dev/null
+++ b/echo/src/database/background_task.rs
@@ -0,0 +1,58 @@
+use std::time::Duration;
+
+use rocket::{
+ fairing::{self, Fairing, Info, Kind},
+ Build, Rocket,
+};
+use rocket_db_pools::{
+ sqlx::{self},
+ Database,
+};
+use tokio::time;
+
+use super::PgDatabase;
+
+pub struct BackgroundTask;
+
+#[rocket::async_trait]
+impl Fairing for BackgroundTask {
+ fn info(&self) -> Info {
+ Info {
+ name: "Database Cleanup Task",
+ kind: Kind::Ignite,
+ }
+ }
+
+ async fn on_ignite(&self, rocket: Rocket) -> fairing::Result {
+ let mut interval = time::interval(Duration::from_secs(3600));
+ let db = PgDatabase::fetch(&rocket).expect("database").0.clone();
+
+ tokio::spawn(async move {
+ loop {
+ match db.acquire().await {
+ Ok(mut conn) => {
+ let result = sqlx::query(
+ "
+ DELETE FROM pastes
+ WHERE views >= max_views OR expires_at <= NOW()
+ ",
+ )
+ .execute(&mut *conn)
+ .await;
+
+ if let Err(error) = result {
+ eprintln!("Failed to delete expired pastes! {}", error);
+ }
+ }
+ Err(error) => {
+ eprint!("Failed to acquire database connection! {}", error);
+ }
+ }
+
+ interval.tick().await;
+ }
+ });
+
+ Ok(rocket)
+ }
+}
diff --git a/echo/src/database/mod.rs b/echo/src/database/mod.rs
new file mode 100644
index 00000000..d78d9985
--- /dev/null
+++ b/echo/src/database/mod.rs
@@ -0,0 +1,9 @@
+use rocket_db_pools::{sqlx, Database};
+
+pub mod background_task;
+pub mod pastes;
+pub mod security;
+
+#[derive(Database)]
+#[database("postgres")]
+pub struct PgDatabase(sqlx::PgPool);
diff --git a/echo/src/database/pastes.rs b/echo/src/database/pastes.rs
new file mode 100644
index 00000000..1143e074
--- /dev/null
+++ b/echo/src/database/pastes.rs
@@ -0,0 +1,282 @@
+use crate::{
+ models::pastes::{Annotation, CreateFile, CreatePaste, File, Paste},
+ result::{HTTPError, Result},
+ scanners::scan_file,
+ utils::generate_id,
+};
+use rocket_db_pools::{
+ sqlx::{self, Row},
+ Connection,
+};
+use sqlx::{postgres::PgRow, Acquire, Postgres, Transaction};
+
+use super::PgDatabase;
+
+impl Paste {
+ pub async fn fetch<'r>(
+ conn: &mut Connection,
+ id: String,
+ password: Option<&'r str>,
+ ) -> Result {
+ let query = format!(
+ "
+ WITH _ AS (
+ UPDATE
+ pastes
+ SET
+ views = views + 1
+ WHERE
+ id = $1 AND {}
+ )
+ SELECT
+ created_at,
+ expires_at,
+ views + 1 AS views, -- account for in-progress update above
+ max_views,
+ CASE WHEN password IS NULL THEN true ELSE
+ CASE WHEN $2 IS NULL THEN false ELSE password = CRYPT($2, password) END
+ END AS authenticated
+ FROM
+ pastes
+ WHERE
+ id = $1 AND
+ CASE WHEN max_views IS NULL THEN true ELSE views <= max_views END AND
+ CASE WHEN expires_at IS NULL THEN true ELSE expires_at > CURRENT_TIMESTAMP END
+ ",
+ match password {
+ None => "password IS NULL",
+ Some(_) => "password = CRYPT($2, password)",
+ },
+ );
+
+ let result = sqlx::query(&query)
+ .bind(&id)
+ .bind(password)
+ .fetch_one(&mut ***conn)
+ .await;
+
+ match result {
+ Ok(row) => {
+ let authenticated = row.get("authenticated");
+
+ if authenticated {
+ let files = File::fetch(conn, &id).await?;
+ Ok(Paste::from_row(row, id, files, None))
+ } else {
+ Err(HTTPError::new(401, "Provided password is not valid."))
+ }
+ }
+ Err(_) => {
+ return Err(HTTPError::new(
+ 404,
+ "Requested paste does not exist, has too many views, or has expired.",
+ ))
+ }
+ }
+ }
+
+ pub async fn create<'r>(
+ conn: &mut Connection,
+ data: CreatePaste<'r>,
+ ) -> Result {
+ let mut tx = match (&mut **conn).begin().await {
+ Ok(tx) => tx,
+ Err(_) => return Err(HTTPError::new(500, "Failed to create paste.")),
+ };
+
+ let mut paste = loop {
+ let id = generate_id(20);
+ let safety = generate_id(64);
+
+ let result = sqlx::query(
+ "
+ INSERT INTO pastes (id, expires_at, max_views, password, safety)
+ VALUES ($1, $2, $3, (SELECT CRYPT($4, gen_salt('bf')) WHERE $4 IS NOT NULL), $5)
+ RETURNING created_at, expires_at, views, max_views
+ ",
+ )
+ .bind(&id)
+ .bind(data.expires_at())
+ .bind(data.max_views())
+ .bind(data.password())
+ .bind(&safety)
+ .fetch_one(&mut *tx)
+ .await;
+
+ match result {
+ Ok(row) => {
+ let files = Vec::with_capacity(data.files().len());
+ break Paste::from_row(row, id, files, Some(safety));
+ }
+ Err(error) => {
+ let inner = error.as_database_error();
+
+ // However unlikely it is, the id or safety was a duplicate.
+ if inner.is_some() && inner.unwrap().is_unique_violation() {
+ continue;
+ }
+
+ return Err(HTTPError::new(500, "Failed to create paste."));
+ }
+ }
+ };
+
+ let invalidate_secrets = data.password().is_none();
+
+ for file in data.files() {
+ let file = File::create(&mut tx, paste.id(), file, invalidate_secrets).await?;
+ paste.add_file(file);
+ }
+
+ match tx.commit().await {
+ Ok(_) => Ok(paste),
+ Err(_) => Err(HTTPError::new(500, "Failed to create paste.")),
+ }
+ }
+
+ fn from_row(row: PgRow, id: String, files: Vec, safety: Option) -> Self {
+ let created_at = row.get("created_at");
+ let expires_at = row.get("expires_at");
+
+ let views = row.get("views");
+ let max_views = row.get("max_views");
+
+ Paste::new(id, created_at, expires_at, views, max_views, files, safety)
+ }
+}
+
+impl File {
+ async fn fetch(conn: &mut Connection, paste_id: &str) -> Result> {
+ let result = sqlx::query(
+ "
+ SELECT id, name, content, language, lines, characters
+ FROM files
+ WHERE paste_id = $1
+ ORDER BY id ASC
+ ",
+ )
+ .bind(paste_id)
+ .fetch_all(&mut ***conn)
+ .await;
+
+ let rows = match result {
+ Ok(rows) => rows,
+ Err(_) => return Err(HTTPError::new(500, "Unable to fetch paste files.")),
+ };
+
+ let mut files = Vec::with_capacity(rows.len());
+
+ for row in rows {
+ let id = row.get("id");
+ let annotations = Annotation::fetch(conn, &id).await?;
+
+ files.push(File::from_row(row, annotations));
+ }
+
+ Ok(files)
+ }
+
+ async fn create<'r>(
+ tx: &mut Transaction<'_, Postgres>,
+ paste_id: &str,
+ file: &'r CreateFile<'r>,
+ invalidate_secrets: bool,
+ ) -> Result {
+ let result = sqlx::query(
+ "
+ INSERT INTO files (paste_id, name, content, language)
+ VALUES ($1, $2, $3, $4)
+ RETURNING id, name, content, language, lines, characters
+ ",
+ )
+ .bind(paste_id)
+ .bind(file.name().or(Some("unknown")))
+ .bind(file.content())
+ .bind(file.language())
+ .fetch_one(&mut **tx)
+ .await;
+
+ match result {
+ Ok(row) => {
+ let id: i64 = row.get("id");
+ let annotations =
+ Annotation::create(tx, id, file.content(), invalidate_secrets).await?;
+
+ return Ok(File::from_row(row, annotations));
+ }
+ Err(_) => return Err(HTTPError::new(500, "Failed to create paste.")),
+ }
+ }
+
+ fn from_row(row: PgRow, annotations: Vec) -> Self {
+ let name = row.get("name");
+ let content = row.get("content");
+ let language = row.get("language");
+
+ let lines = row.get("lines");
+ let characters = row.get("characters");
+
+ File::new(name, content, language, lines, characters, annotations)
+ }
+}
+
+impl Annotation {
+ async fn fetch(conn: &mut Connection, file_id: &i64) -> Result> {
+ let result = sqlx::query_as::<_, Annotation>(
+ "
+ SELECT head_line, head_char, head_char, tail_line, tail_char, content
+ FROM annotations
+ WHERE file_id = $1
+ ORDER BY id ASC
+ ",
+ )
+ .bind(file_id)
+ .fetch_all(&mut ***conn)
+ .await;
+
+ match result {
+ Ok(annotations) => Ok(annotations),
+ Err(_) => return Err(HTTPError::new(500, "Unable to fetch file annotations.")),
+ }
+ }
+
+ async fn create(
+ tx: &mut Transaction<'_, Postgres>,
+ file_id: i64,
+ content: &str,
+ invalidate_secrets: bool,
+ ) -> Result> {
+ let scans = scan_file(content, invalidate_secrets).await;
+ let mut annotations = Vec::with_capacity(scans.len());
+
+ for scan in scans {
+ let mut content = format!("Mystb.in found a secret for {}.", scan.service);
+
+ if scan.invalidated {
+ content += " This secret has been invalidated.";
+ }
+
+ let result = sqlx::query(
+ "
+ INSERT INTO annotations (file_id, head_line, head_char, tail_line, tail_char, content)
+ VALUES ($1, $2, $3, $4, $5, $6)
+ ",
+ )
+ .bind(file_id)
+ .bind(scan.head.line())
+ .bind(scan.head.char())
+ .bind(scan.tail.line())
+ .bind(scan.tail.char())
+ .bind(&content)
+ .execute(&mut **tx)
+ .await;
+
+ match result {
+ Ok(_) => annotations.push(Annotation::new(scan.head, scan.tail, content)),
+ Err(_) => return Err(HTTPError::new(500, "Failed to create paste.")),
+ };
+ }
+
+ Ok(annotations)
+ }
+}
diff --git a/echo/src/database/security.rs b/echo/src/database/security.rs
new file mode 100644
index 00000000..1a53ee5d
--- /dev/null
+++ b/echo/src/database/security.rs
@@ -0,0 +1,40 @@
+use rocket_db_pools::{
+ sqlx::{self},
+ Connection,
+};
+
+use crate::{
+ models::security::SparsePasteInfo,
+ result::{HTTPError, Result},
+};
+
+use super::PgDatabase;
+
+impl SparsePasteInfo {
+ pub async fn get(mut conn: Connection, token: &str) -> Result {
+ let result =
+ sqlx::query_as::<_, SparsePasteInfo>("SELECT id FROM pastes WHERE safety = $1")
+ .bind(token)
+ .fetch_one(&mut **conn)
+ .await;
+
+ match result {
+ Ok(result) => Ok(result),
+ Err(_) => Err(HTTPError::new(404, "Invalid safety token provided.")),
+ }
+ }
+
+ pub async fn delete(mut conn: Connection, token: &str) -> Result {
+ let result = sqlx::query_as::<_, SparsePasteInfo>(
+ "DELETE FROM pastes WHERE safety = $1 RETURNING id",
+ )
+ .bind(token)
+ .fetch_one(&mut **conn)
+ .await;
+
+ match result {
+ Ok(result) => Ok(result),
+ Err(_) => Err(HTTPError::new(404, "Invalid safety token provided.")),
+ }
+ }
+}
diff --git a/echo/src/main.rs b/echo/src/main.rs
new file mode 100644
index 00000000..e40436b2
--- /dev/null
+++ b/echo/src/main.rs
@@ -0,0 +1,47 @@
+use std::env;
+
+use config::Config;
+use cors::CorsHeaders;
+use database::{background_task::BackgroundTask, PgDatabase};
+use figment::providers::{Format, Json};
+use rocket::{catchers, fairing::AdHoc, figment, routes};
+use rocket_db_pools::Database;
+use routes::{docs, health, pastes, security};
+use scanners::InitScanners;
+
+pub mod config;
+pub mod cors;
+pub mod database;
+pub mod models;
+pub mod result;
+pub mod routes;
+pub mod scanners;
+pub mod utils;
+
+#[rocket::launch]
+fn rocket() -> _ {
+ let routes = routes![
+ routes::get_root,
+ cors::snatcher,
+ docs::get_docs,
+ docs::get_spec,
+ health::health,
+ pastes::get_paste,
+ pastes::create_paste_simple,
+ pastes::create_paste_structured,
+ security::get_security,
+ security::delete_security,
+ ];
+
+ let path = env::var("ECHO_CONFIG").expect("ECHO_CONFIG not set");
+ let provider = rocket::Config::figment().merge(Json::file(path));
+
+ rocket::custom(provider)
+ .mount("/", routes)
+ .attach(AdHoc::config::())
+ .attach(PgDatabase::init())
+ .attach(CorsHeaders)
+ .attach(InitScanners)
+ .attach(BackgroundTask)
+ .register("/", catchers![rocket_validation::validation_catcher])
+}
diff --git a/echo/src/models/mod.rs b/echo/src/models/mod.rs
new file mode 100644
index 00000000..29edf71c
--- /dev/null
+++ b/echo/src/models/mod.rs
@@ -0,0 +1,2 @@
+pub mod pastes;
+pub mod security;
diff --git a/echo/src/models/pastes.rs b/echo/src/models/pastes.rs
new file mode 100644
index 00000000..30d4d4d8
--- /dev/null
+++ b/echo/src/models/pastes.rs
@@ -0,0 +1,237 @@
+use std::result;
+
+use chrono::{DateTime, Utc};
+use rocket_validation::Validate;
+use serde::{Deserialize, Serialize};
+use sqlx::{postgres::PgRow, FromRow, Row};
+use validator::ValidationError;
+
+use crate::result::{HTTPError, Result};
+
+#[derive(Serialize)]
+pub struct Position {
+ line: i32,
+ char: i32,
+}
+
+impl Position {
+ pub fn line(&self) -> i32 {
+ self.line
+ }
+
+ pub fn char(&self) -> i32 {
+ self.char
+ }
+
+ pub fn new(line: i32, char: i32) -> Self {
+ Position { line, char }
+ }
+}
+
+#[derive(Serialize)]
+pub struct Annotation {
+ head: Position,
+ tail: Position,
+ content: String,
+}
+
+impl Annotation {
+ pub fn new(head: Position, tail: Position, content: String) -> Self {
+ Annotation {
+ head,
+ tail,
+ content,
+ }
+ }
+}
+
+impl FromRow<'_, PgRow> for Annotation {
+ fn from_row(row: &PgRow) -> std::result::Result {
+ let head_line = row.get("head_line");
+ let head_char = row.get("head_char");
+
+ let tail_line = row.get("tail_line");
+ let tail_char = row.get("tail_char");
+
+ let content = row.get("content");
+
+ let head = Position {
+ line: head_line,
+ char: head_char,
+ };
+
+ let tail = Position {
+ line: tail_line,
+ char: tail_char,
+ };
+
+ Ok(Annotation {
+ head,
+ tail,
+ content,
+ })
+ }
+}
+
+#[derive(Serialize)]
+pub struct File {
+ name: String,
+ content: String,
+ language: Option,
+
+ lines: i32,
+ characters: i32,
+
+ annotations: Vec,
+}
+
+impl File {
+ pub fn new(
+ name: String,
+ content: String,
+ language: Option,
+ lines: i32,
+ characters: i32,
+ annotations: Vec,
+ ) -> Self {
+ File {
+ name,
+ content,
+ language,
+ lines,
+ characters,
+ annotations,
+ }
+ }
+}
+
+#[derive(Serialize)]
+pub struct Paste {
+ id: String,
+
+ created_at: DateTime,
+ expires_at: Option>,
+
+ views: i64,
+ max_views: Option,
+
+ files: Vec,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ security: Option,
+}
+
+impl Paste {
+ pub fn id(&self) -> &str {
+ &self.id
+ }
+
+ pub fn add_file(&mut self, file: File) {
+ self.files.push(file);
+ }
+
+ pub fn new(
+ id: String,
+ created_at: DateTime,
+ expires_at: Option>,
+ views: i64,
+ max_views: Option,
+ files: Vec,
+ security: Option,
+ ) -> Self {
+ Paste {
+ id,
+ created_at,
+ expires_at,
+ views,
+ max_views,
+ files,
+ security,
+ }
+ }
+}
+
+#[derive(Deserialize, Serialize, Validate)]
+pub struct CreateFile<'r> {
+ #[validate(length(min = 1, max = 32), custom(function = "no_newlines"))]
+ name: Option<&'r str>,
+ #[validate(length(min = 1, max = 300_000))]
+ // Using String instead of str because of newlines:
+ // https://github.com/somehowchris/rocket-validation/issues/41
+ content: String,
+ #[validate(length(min = 1, max = 32), custom(function = "no_newlines"))]
+ language: Option<&'r str>,
+}
+
+fn no_newlines(name: &str) -> result::Result<(), ValidationError> {
+ if !name.contains("\n") {
+ Ok(())
+ } else {
+ Err(ValidationError::new("Found newline in unsupported field."))
+ }
+}
+
+impl<'r> CreateFile<'r> {
+ pub fn name(&self) -> Option<&'r str> {
+ self.name
+ }
+
+ pub fn content(&self) -> &str {
+ &self.content
+ }
+
+ pub fn language(&self) -> Option<&'r str> {
+ self.language
+ }
+}
+
+#[derive(Deserialize, Serialize, Validate)]
+pub struct CreatePaste<'r> {
+ #[validate(length(min = 1, max = 5))]
+ files: Vec>,
+ #[validate(length(min = 1, max = 72))]
+ password: Option<&'r str>,
+ #[validate(range(min = 1, max = 128))]
+ max_views: Option,
+ expires_at: Option>,
+}
+
+impl<'r> CreatePaste<'r> {
+ pub fn files(&self) -> &'r Vec {
+ &self.files
+ }
+
+ pub fn password(&self) -> Option<&'r str> {
+ self.password
+ }
+
+ pub fn max_views(&self) -> Option {
+ self.max_views
+ }
+
+ pub fn expires_at(&self) -> Option> {
+ self.expires_at
+ }
+
+ pub fn from_content(content: String) -> Result {
+ if content.len() < 1 || content.len() > 300_000 {
+ return Err(HTTPError::new(
+ 422,
+ "Must be between 1 and 300000 in length!",
+ ));
+ }
+
+ let file = CreateFile {
+ name: None,
+ content,
+ language: None,
+ };
+
+ Ok(CreatePaste {
+ files: vec![file],
+ password: None,
+ max_views: None,
+ expires_at: None,
+ })
+ }
+}
diff --git a/echo/src/models/security.rs b/echo/src/models/security.rs
new file mode 100644
index 00000000..f5d1c41a
--- /dev/null
+++ b/echo/src/models/security.rs
@@ -0,0 +1,7 @@
+use serde::Serialize;
+use sqlx::prelude::FromRow;
+
+#[derive(FromRow, Serialize)]
+pub struct SparsePasteInfo {
+ id: String,
+}
diff --git a/echo/src/result.rs b/echo/src/result.rs
new file mode 100644
index 00000000..a2889f3e
--- /dev/null
+++ b/echo/src/result.rs
@@ -0,0 +1,26 @@
+use std::result;
+
+use rocket::{http::Status, serde::json::Json, Responder};
+use serde::Serialize;
+
+#[derive(Serialize)]
+pub struct Error {
+ message: E,
+}
+
+#[derive(Responder)]
+pub struct HTTPError {
+ inner: (Status, Json>),
+}
+
+impl HTTPError {
+ pub fn new(code: u16, message: E) -> HTTPError {
+ let status = Status::from_code(code).expect("http status");
+
+ HTTPError {
+ inner: (status, Json(Error { message })),
+ }
+ }
+}
+
+pub type Result = result::Result>;
diff --git a/echo/src/routes/docs.rs b/echo/src/routes/docs.rs
new file mode 100644
index 00000000..ab1b717b
--- /dev/null
+++ b/echo/src/routes/docs.rs
@@ -0,0 +1,20 @@
+use rocket::{
+ get,
+ response::content::{RawHtml, RawJson},
+};
+use scalar_doc::{Documentation, Theme};
+
+#[get("/docs")]
+pub fn get_docs() -> RawHtml {
+ let docs = Documentation::new("MystBin API Documentation", "/docs/spec.json")
+ .theme(Theme::Alternate)
+ .build()
+ .unwrap();
+
+ RawHtml(docs)
+}
+
+#[get("/docs/spec.json")]
+pub fn get_spec() -> RawJson<&'static str> {
+ RawJson(include_str!("../../openapi.json"))
+}
diff --git a/echo/src/routes/health.rs b/echo/src/routes/health.rs
new file mode 100644
index 00000000..a0485342
--- /dev/null
+++ b/echo/src/routes/health.rs
@@ -0,0 +1,20 @@
+use rocket::get;
+use rocket_db_pools::{
+ sqlx::{self, Row},
+ Connection,
+};
+
+use crate::{
+ database::PgDatabase,
+ result::{HTTPError, Result},
+};
+
+#[get("/health")]
+pub async fn health(mut db: Connection) -> Result {
+ let result = sqlx::query("SELECT 'ok'").fetch_one(&mut **db).await;
+
+ match result {
+ Ok(row) => Ok(row.get(0)),
+ Err(_) => Err(HTTPError::new(503, "Database connection unhealthy.")),
+ }
+}
diff --git a/echo/src/routes/mod.rs b/echo/src/routes/mod.rs
new file mode 100644
index 00000000..f72b2219
--- /dev/null
+++ b/echo/src/routes/mod.rs
@@ -0,0 +1,11 @@
+use rocket::{get, response::Redirect, uri};
+
+pub mod docs;
+pub mod health;
+pub mod pastes;
+pub mod security;
+
+#[get("/")]
+pub fn get_root() -> Redirect {
+ Redirect::temporary(uri!("/docs"))
+}
diff --git a/echo/src/routes/pastes.rs b/echo/src/routes/pastes.rs
new file mode 100644
index 00000000..ec6c2e8a
--- /dev/null
+++ b/echo/src/routes/pastes.rs
@@ -0,0 +1,40 @@
+use crate::{
+ database::PgDatabase,
+ models::pastes::{CreatePaste, Paste},
+ result::Result,
+ utils::PasswordHeader,
+};
+use rocket::{get, post, serde::json::Json};
+use rocket_db_pools::Connection;
+use rocket_validation::Validated;
+
+#[get("/pastes/")]
+pub async fn get_paste<'r>(
+ mut conn: Connection,
+ id: String,
+ password: Option>,
+) -> Result> {
+ let password = match password {
+ Some(value) => Some(value.get()),
+ None => None,
+ };
+
+ Ok(Json(Paste::fetch(&mut conn, id, password).await?))
+}
+
+#[post("/pastes", format = "text/plain", data = "")]
+pub async fn create_paste_simple<'r>(
+ mut conn: Connection,
+ data: String,
+) -> Result> {
+ let paste = CreatePaste::from_content(data)?;
+ Ok(Json(Paste::create(&mut conn, paste).await?))
+}
+
+#[post("/pastes", format = "application/json", data = "")]
+pub async fn create_paste_structured<'r>(
+ mut conn: Connection,
+ data: Validated>>,
+) -> Result> {
+ Ok(Json(Paste::create(&mut conn, data.0 .0).await?))
+}
diff --git a/echo/src/routes/security.rs b/echo/src/routes/security.rs
new file mode 100644
index 00000000..9aa73d21
--- /dev/null
+++ b/echo/src/routes/security.rs
@@ -0,0 +1,20 @@
+use rocket::{delete, get, serde::json::Json};
+use rocket_db_pools::Connection;
+
+use crate::{database::PgDatabase, models::security::SparsePasteInfo, result::Result};
+
+#[get("/security/")]
+pub async fn get_security(
+ conn: Connection,
+ token: &str,
+) -> Result> {
+ Ok(Json(SparsePasteInfo::get(conn, token).await?))
+}
+
+#[delete("/security/")]
+pub async fn delete_security(
+ conn: Connection,
+ token: &str,
+) -> Result> {
+ Ok(Json(SparsePasteInfo::delete(conn, token).await?))
+}
diff --git a/echo/src/scanners/discord.rs b/echo/src/scanners/discord.rs
new file mode 100644
index 00000000..4d27ee74
--- /dev/null
+++ b/echo/src/scanners/discord.rs
@@ -0,0 +1,44 @@
+use std::sync::Arc;
+
+use base64::{prelude::BASE64_STANDARD_NO_PAD, Engine as _};
+use once_cell::sync::Lazy;
+use regex::{Match, Regex};
+
+use super::Scanner;
+
+const NAME: Lazy> = Lazy::new(|| Arc::new(String::from("Discord")));
+
+pub struct DiscordScanner;
+
+impl Scanner for DiscordScanner {
+ fn service(&self) -> Arc {
+ Arc::clone(&NAME)
+ }
+
+ fn pattern(&self) -> &'static Regex {
+ static PATTERN: Lazy = Lazy::new(|| {
+ Regex::new(r"[a-zA-Z0-9_-]{23,28}\.[a-zA-Z0-9_-]{6,7}\.[a-zA-Z0-9_-]{27,}").unwrap()
+ });
+
+ &PATTERN
+ }
+
+ fn confirm(&self, item: &Match) -> bool {
+ let mut parts = item.as_str().split('.');
+
+ let user_id = match parts.next() {
+ None => return false,
+ Some(value) => value,
+ };
+
+ // Discord tokens have 3 parts total
+ if parts.count() != 2 {
+ return false;
+ }
+
+ match BASE64_STANDARD_NO_PAD.decode(user_id) {
+ Ok(_) => true,
+ Err(_) => false,
+ }
+ }
+}
diff --git a/echo/src/scanners/generic.rs b/echo/src/scanners/generic.rs
new file mode 100644
index 00000000..6cf9b3c0
--- /dev/null
+++ b/echo/src/scanners/generic.rs
@@ -0,0 +1,41 @@
+use std::sync::Arc;
+
+use regex::Regex;
+
+use crate::config::ScannerConfig;
+
+use super::Scanner;
+
+pub struct GenericScanner {
+ name: Arc,
+ pattern: Regex,
+ nullify: bool,
+}
+
+impl GenericScanner {
+ pub fn new(config: &ScannerConfig) -> Self {
+ let name = Arc::clone(&config.name);
+ let pattern = Regex::new(&config.pattern).expect("invalid scanner pattern");
+ let nullify = config.invalidate;
+
+ GenericScanner {
+ name,
+ pattern,
+ nullify,
+ }
+ }
+}
+
+impl Scanner for GenericScanner {
+ fn pattern(&self) -> &Regex {
+ &self.pattern
+ }
+
+ fn service(&self) -> Arc {
+ Arc::clone(&self.name)
+ }
+
+ fn nullify(&self) -> bool {
+ self.nullify
+ }
+}
diff --git a/echo/src/scanners/mod.rs b/echo/src/scanners/mod.rs
new file mode 100644
index 00000000..c9235485
--- /dev/null
+++ b/echo/src/scanners/mod.rs
@@ -0,0 +1,132 @@
+use std::{
+ sync::{Arc, OnceLock},
+ time::Duration,
+};
+
+use discord::DiscordScanner;
+use generic::GenericScanner;
+use regex::{Match, Regex};
+use reporter::SecretReporter;
+use rocket::{
+ fairing::{self, Fairing, Info, Kind},
+ Build, Rocket,
+};
+use tokio::time;
+
+use crate::{config::Config, models::pastes::Position};
+
+mod discord;
+mod generic;
+mod reporter;
+
+pub struct ScanResult<'r> {
+ pub head: Position,
+ pub tail: Position,
+
+ pub content: &'r str,
+ pub invalidated: bool,
+ pub service: Arc,
+}
+
+static REPORTER: OnceLock = OnceLock::new();
+static SCANNERS: OnceLock>> = OnceLock::new();
+
+pub async fn scan_file<'r>(content: &'r str, invalidate_secrets: bool) -> Vec> {
+ let mut results = Vec::new();
+
+ for scanner in SCANNERS.get().unwrap() {
+ for finding in scanner.execute(content) {
+ let do_invalidate = scanner.nullify() && invalidate_secrets;
+
+ let result = ScanResult {
+ service: scanner.service(),
+ content: finding.as_str(),
+ invalidated: do_invalidate,
+ head: find_position(content, finding.start()),
+ tail: find_position(content, finding.end()),
+ };
+
+ results.push(result);
+
+ if do_invalidate {
+ REPORTER.get().unwrap().add(finding.as_str()).await;
+ }
+ }
+ }
+
+ results
+}
+
+fn find_position(content: &str, position: usize) -> Position {
+ let haystack = &content[0..position];
+ let (idx, line) = haystack.split('\n').enumerate().last().unwrap();
+
+ Position::new(idx as i32, line.len() as i32)
+}
+
+trait Scanner: Send + Sync {
+ fn pattern(&self) -> &Regex;
+ fn service(&self) -> Arc;
+
+ /// Whether to invalidate found secrets
+ fn nullify(&self) -> bool {
+ true
+ }
+
+ /// Whether a found item might be valid
+ fn confirm(&self, _item: &Match) -> bool {
+ true
+ }
+
+ fn execute<'r>(&self, haystack: &'r str) -> Vec> {
+ self.pattern()
+ .find_iter(haystack)
+ .filter(|x| self.confirm(x))
+ .collect()
+ }
+}
+
+pub struct InitScanners;
+
+#[rocket::async_trait]
+impl Fairing for InitScanners {
+ fn info(&self) -> Info {
+ Info {
+ name: "Scanner Initialization",
+ kind: Kind::Ignite,
+ }
+ }
+
+ async fn on_ignite(&self, rocket: Rocket) -> fairing::Result {
+ let config = rocket.state::().unwrap();
+ let mut active: Vec> = Vec::new();
+
+ active.push(Box::new(DiscordScanner));
+
+ for value in &config.extra_scanners {
+ active.push(Box::new(GenericScanner::new(value)));
+ }
+
+ if let Err(_) = SCANNERS.set(active) {
+ panic!("failed to set up scanners")
+ }
+
+ let reporter = SecretReporter::new(&config.github_token);
+
+ if let Err(_) = REPORTER.set(reporter) {
+ panic!("failed to set up reporter")
+ }
+
+ tokio::spawn(async move {
+ let reporter = REPORTER.get().unwrap();
+ let mut interval = time::interval(Duration::from_secs(10));
+
+ loop {
+ reporter.run().await;
+ interval.tick().await;
+ }
+ });
+
+ Ok(rocket)
+ }
+}
diff --git a/echo/src/scanners/reporter.rs b/echo/src/scanners/reporter.rs
new file mode 100644
index 00000000..3c43a999
--- /dev/null
+++ b/echo/src/scanners/reporter.rs
@@ -0,0 +1,121 @@
+use std::collections::{HashMap, VecDeque};
+
+use reqwest::header::HeaderMap;
+use serde::Serialize;
+use tokio::sync::Mutex;
+
+const DESCRIPTION: &str =
+ "Mystb.in secret scanning is invalidating these secrets. Use secret pastes to disable this.";
+
+pub struct SecretReporter {
+ client: reqwest::Client,
+ queued: Mutex>,
+ github_token: String,
+}
+
+impl SecretReporter {
+ pub fn new(github_token: &str) -> Self {
+ let version = env!("CARGO_PKG_VERSION");
+ let user_agent = format!("Echo/{} (+https://mystb.in)", version);
+
+ let client = reqwest::Client::builder()
+ .https_only(true)
+ .user_agent(user_agent)
+ .build()
+ .unwrap();
+
+ let queued = Mutex::new(VecDeque::new());
+ let github_token = format!("Bearer {github_token}");
+
+ SecretReporter {
+ client,
+ queued,
+ github_token,
+ }
+ }
+
+ pub async fn add(&self, item: &str) {
+ let mut queue = self.queued.lock().await;
+ queue.push_back(item.to_owned());
+ }
+
+ pub async fn run(&self) {
+ let queue = self.queued.lock().await;
+
+ if queue.is_empty() {
+ return;
+ }
+
+ let copy = queue.clone();
+ let mut data = CreateGist::new();
+
+ for (idx, secret) in copy.iter().enumerate() {
+ data.add_file(idx.to_string() + ".txt", secret);
+ }
+
+ drop(queue); // Allow acquiring elsewhere
+
+ if let Err(error) = self.create_gist(data).await {
+ eprintln!("Failed to create gist: {}", error.0);
+ }
+ }
+
+ async fn create_gist<'r>(&self, data: CreateGist<'r>) -> Result<(), GistError> {
+ let mut headers = HeaderMap::new();
+
+ headers.append("Authorization", self.github_token.parse().unwrap());
+ headers.append("X-GitHub-Api-Version", "2022-11-28".parse().unwrap());
+ headers.append("Accept", "application/vnd.github+json".parse().unwrap());
+
+ self.client
+ .post("https://api.github.com/gists")
+ .headers(headers)
+ .json(&data)
+ .send()
+ .await?
+ .error_for_status()?;
+
+ let mut queue = self.queued.lock().await;
+ queue.drain(0..data.len());
+
+ Ok(())
+ }
+}
+
+struct GistError(String);
+
+impl From for GistError {
+ fn from(value: reqwest::Error) -> Self {
+ GistError(value.to_string())
+ }
+}
+
+#[derive(Serialize)]
+struct CreateGist<'r> {
+ public: bool,
+ description: &'r str,
+ files: HashMap>,
+}
+
+impl<'r> CreateGist<'r> {
+ fn new() -> Self {
+ CreateGist {
+ public: true,
+ files: HashMap::new(),
+ description: DESCRIPTION,
+ }
+ }
+
+ fn len(&self) -> usize {
+ self.files.len()
+ }
+
+ fn add_file(&mut self, filename: String, content: &'r str) {
+ self.files.insert(filename, CreateGistFile { content });
+ }
+}
+
+#[derive(Serialize)]
+struct CreateGistFile<'r> {
+ content: &'r str,
+}
diff --git a/echo/src/utils.rs b/echo/src/utils.rs
new file mode 100644
index 00000000..d7afa371
--- /dev/null
+++ b/echo/src/utils.rs
@@ -0,0 +1,47 @@
+use once_cell::sync::Lazy;
+use rand::{distributions::Alphanumeric, Rng};
+
+use regex::Regex;
+use rocket::{
+ http::Status,
+ request::{FromRequest, Outcome, Request},
+};
+
+pub fn generate_id(size: usize) -> String {
+ let random = rand::thread_rng();
+ String::from_utf8(random.sample_iter(Alphanumeric).take(size).collect()).expect("id generator")
+}
+
+pub struct PasswordHeader<'r> {
+ value: &'r str,
+}
+
+impl<'r> PasswordHeader<'r> {
+ pub fn get(self) -> &'r str {
+ self.value
+ }
+}
+
+#[rocket::async_trait]
+impl<'r> FromRequest<'r> for PasswordHeader<'r> {
+ type Error = &'static str;
+
+ async fn from_request(request: &'r Request<'_>) -> Outcome {
+ let result = request.headers().get_one("Authorization");
+
+ let value = match result {
+ Some(value) => value,
+ None => return Outcome::Error((Status::Unauthorized, "Missing Authorization header.")),
+ };
+
+ static PATTERN: Lazy = Lazy::new(|| Regex::new(r"(?i:password) .+").unwrap());
+
+ if !PATTERN.is_match(value) {
+ return Outcome::Error((Status::Unauthorized, "Invalid Authorization header."));
+ }
+
+ Outcome::Success(PasswordHeader {
+ value: value.split_once(" ").unwrap().1,
+ })
+ }
+}
diff --git a/launcher.py b/launcher.py
deleted file mode 100644
index 05fc09d4..00000000
--- a/launcher.py
+++ /dev/null
@@ -1,58 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-import asyncio
-import logging
-
-import aiohttp
-import starlette_plus
-import uvicorn
-
-import core
-import core.config
-
-
-starlette_plus.setup_logging(level=logging.INFO)
-logger: logging.Logger = logging.getLogger(__name__)
-
-
-async def main() -> None:
- async with aiohttp.ClientSession() as session, core.Database(
- dsn=core.CONFIG["DATABASE"]["dsn"], session=session, github_config=core.CONFIG.get("GITHUB")
- ) as database:
- app: core.Application = core.Application(database=database)
-
- host: str = core.CONFIG["SERVER"]["host"]
- port: int = core.CONFIG["SERVER"]["port"]
-
- config: uvicorn.Config = uvicorn.Config(
- app=app,
- host=host,
- port=port,
- access_log=False,
- forwarded_allow_ips="*",
- )
- server: uvicorn.Server = uvicorn.Server(config)
-
- await server.serve()
-
-
-try:
- asyncio.run(main())
-except KeyboardInterrupt:
- logger.info("Closing the MystBin application due to KeyboardInterrupt.")
diff --git a/migration.sql b/migration.sql
deleted file mode 100644
index 899c8504..00000000
--- a/migration.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-BEGIN; -- start transaction
-
-SAVEPOINT pastes;
-ALTER TABLE pastes DROP COLUMN IF EXISTS author_id CASCADE; -- no longer storing users
-ALTER TABLE pastes DROP COLUMN IF EXISTS last_edited CASCADE; -- no longer allowing edits
-ALTER TABLE pastes ALTER COLUMN password SET DEFAULT NULL; -- nullable password by default
-ALTER TABLE pastes DROP COLUMN IF EXISTS origin_ip CASCADE; -- no longer needed
-ALTER TABLE pastes ADD COLUMN IF NOT EXISTS safety TEXT UNIQUE; -- this is how we handle paste deletion.
-UPDATE pastes SET safety = gen_random_uuid(); -- Populate with junk data.
-ALTER TABLE pastes ALTER COLUMN safety SET NOT NULL; -- add not null constraint
-CREATE UNIQUE INDEX IF NOT EXISTS pastes_safety_idx ON pastes (safety); -- -- Index by safety keys for faster lookup to delete.
-
-SAVEPOINT files;
-ALTER TABLE files ALTER COLUMN filename SET NOT NULL; -- always require filename
-ALTER TABLE files DROP COLUMN IF EXISTS attachment; -- we don't have these anymore
-ALTER TABLE files ADD COLUMN IF NOT EXISTS annotation TEXT;
-ALTER TABLE files RENAME COLUMN index TO file_index; -- bad column name
-ALTER TABLE files ADD COLUMN IF NOT EXISTS warning_positions INTEGER[]; -- New line warning positions
-
-SAVEPOINT drops;
-DROP TABLE IF EXISTS bans CASCADE; -- no longer needed
-DROP TABLE IF EXISTS logs CASCADE; -- no longer needed
-DROP TABLE IF EXISTS bookmarks CASCADE; -- no longer needed
-DROP TABLE IF EXISTS users CASCADE; -- no longer needed
-
-COMMIT;
diff --git a/pyproject.toml b/pyproject.toml
deleted file mode 100644
index ee4903a2..00000000
--- a/pyproject.toml
+++ /dev/null
@@ -1,64 +0,0 @@
-[tool.ruff]
-line-length = 120
-indent-width = 4
-exclude = ["venv", ".venv"]
-
-[tool.ruff.lint]
-select = [
- "C4",
- "E",
- "F",
- "G",
- "I",
- "PTH",
- "RUF",
- "SIM",
- "TCH",
- "UP",
- "W",
- "PERF",
- "ANN",
-]
-ignore = [
- "F402",
- "F403",
- "F405",
- "PERF203",
- "RUF001",
- "RUF009",
- "SIM105",
- "UP034",
- "UP038",
- "ANN101",
- "ANN102",
- "ANN401",
- "UP031",
- "PTH123",
- "E203",
- "E501",
-]
-
-[tool.ruff.lint.isort]
-split-on-trailing-comma = true
-combine-as-imports = true
-lines-after-imports = 2
-
-[tool.ruff.lint.flake8-annotations]
-allow-star-arg-any = true
-
-[tool.ruff.lint.flake8-quotes]
-inline-quotes = "double"
-
-[tool.ruff.format]
-quote-style = "double"
-indent-style = "space"
-skip-magic-trailing-comma = false
-line-ending = "auto"
-
-[tool.pyright]
-exclude = ["venv", ".venv"]
-useLibraryCodeForTypes = true
-typeCheckingMode = "strict"
-reportImportCycles = false
-reportPrivateUsage = false
-pythonVersion = "3.11"
diff --git a/redis.conf b/redis.conf
deleted file mode 100644
index df87817e..00000000
--- a/redis.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-port 6379
-tcp-backlog 511
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 14b58403..00000000
--- a/requirements.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-starlette_plus @ git+https://github.com/PythonistaGuild/StarlettePlus.git@f21169a
-uvicorn==0.29.0
-asyncpg==0.29.0
-asyncpg-stubs==0.29.1
-bleach==6.1.0
-python-multipart==0.0.9
-aiohttp==3.10.5
-pyyaml==6.0.1
diff --git a/schema.sql b/schema.sql
deleted file mode 100644
index 3ca07764..00000000
--- a/schema.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-CREATE EXTENSION IF NOT EXISTS pgcrypto;
-
-CREATE TABLE IF NOT EXISTS pastes (
- id TEXT PRIMARY KEY,
- created_at TIMESTAMP NOT NULL DEFAULT (NOW() AT TIME ZONE 'UTC'),
- expires TIMESTAMP WITH TIME ZONE,
- password TEXT DEFAULT NULL,
- views INTEGER DEFAULT 0,
- safety TEXT UNIQUE
-);
-
-CREATE UNIQUE INDEX IF NOT EXISTS pastes_safety_idx ON pastes (safety);
--- Index by safety keys for faster lookup to delete.
-
-CREATE TABLE IF NOT EXISTS files (
- parent_id TEXT REFERENCES pastes(id) ON DELETE CASCADE,
- content TEXT NOT NULL,
- filename TEXT NOT NULL,
- loc INTEGER NOT NULL,
- charcount INTEGER GENERATED ALWAYS AS (LENGTH(content)) STORED,
- file_index SERIAL NOT NULL,
- annotation TEXT,
- warning_positions INTEGER[],
- PRIMARY KEY (parent_id, file_index)
-);
diff --git a/types_/config.py b/types_/config.py
deleted file mode 100644
index 8be48270..00000000
--- a/types_/config.py
+++ /dev/null
@@ -1,66 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from typing import NotRequired, TypedDict
-
-import starlette_plus
-
-
-class Server(TypedDict):
- host: str
- port: int
- domain: str
- session_secret: str
- maintenance: bool
-
-
-class Database(TypedDict):
- dsn: str
-
-
-class Redis(TypedDict):
- limiter: str
- sessions: str
-
-
-class Limits(TypedDict):
- paste_get: starlette_plus.RateLimitData
- paste_get_day: starlette_plus.RateLimitData
- paste_post: starlette_plus.RateLimitData
- paste_post_day: starlette_plus.RateLimitData
- global_limit: starlette_plus.RateLimitData
-
-
-class Pastes(TypedDict):
- char_limit: int
- file_limit: int
- name_limit: int
-
-
-class Github(TypedDict):
- token: str
- timeout: float
-
-
-class Config(TypedDict):
- SERVER: Server
- DATABASE: Database
- REDIS: NotRequired[Redis]
- LIMITS: Limits
- PASTES: Pastes
- GITHUB: NotRequired[Github]
diff --git a/types_/github.py b/types_/github.py
deleted file mode 100644
index 8d3311a7..00000000
--- a/types_/github.py
+++ /dev/null
@@ -1,29 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from typing import TypedDict
-
-
-class GistContent(TypedDict):
- content: str
-
-
-class PostGist(TypedDict):
- description: str
- files: dict[str, GistContent]
- public: bool
diff --git a/types_/scanner.py b/types_/scanner.py
deleted file mode 100644
index 3b63909d..00000000
--- a/types_/scanner.py
+++ /dev/null
@@ -1,30 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from __future__ import annotations
-
-from typing import TYPE_CHECKING, TypedDict
-
-
-if TYPE_CHECKING:
- from core.scanners import Services
-
-
-class ScannerSecret(TypedDict):
- service: Services
- tokens: list[tuple[int, str]]
diff --git a/views/__init__.py b/views/__init__.py
deleted file mode 100644
index 5196a58d..00000000
--- a/views/__init__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from .api import APIView as APIView
-from .docs import DocsView as DocsView
-from .htmx import HTMXView as HTMXView
diff --git a/views/api.py b/views/api.py
deleted file mode 100644
index ba0d583b..00000000
--- a/views/api.py
+++ /dev/null
@@ -1,360 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from __future__ import annotations
-
-import datetime
-import json
-from typing import TYPE_CHECKING, Any
-
-import asyncpg
-import starlette_plus
-
-from core import CONFIG
-from core.utils import validate_paste
-
-
-if TYPE_CHECKING:
- from core import Application
-
-
-class APIView(starlette_plus.View, prefix="api"):
- def __init__(self, app: Application) -> None:
- self.app: Application = app
-
- @starlette_plus.route("/paste/{id}", methods=["GET"])
- @starlette_plus.route("/pastes/{id}", methods=["GET"], include_in_schema=False)
- @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get"])
- @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get_day"])
- async def paste_get(self, request: starlette_plus.Request) -> starlette_plus.Response:
- """Fetch a paste.
-
- ---
- summary: Fetch a paste.
- description:
- Fetches a paste with all relevant meta-data and files.\n\n
-
- Fetching pastes does not include the `password` or `safety` fields. You only receive the `safety` field
- directly after creating a paste.
-
- parameters:
- - in: path
- name: id
- schema:
- type: string
- required: true
- description: The paste ID.
-
- - in: header
- name: Authorization
- schema:
- type: string
- format: basic
- required: false
- description: The password for the paste; if one is required.
-
- responses:
- 200:
- description: The paste meta-data and files.
- content:
- application/json:
- schema:
- type: object
- properties:
- id:
- type: string
- example: abc123
- created_at:
- type: string
- example: 2024-01-01T00:00:00.000000+00:00
- expires:
- type: string
- views:
- type: integer
- example: 3
- has_password:
- type: boolean
- example: false
- files:
- type: array
- items:
- type: object
- properties:
- parent_id:
- type: string
- content:
- type: string
- filename:
- type: string
- loc:
- type: integer
- charcount:
- type: integer
- annotation:
- type: string
-
- 404:
- description: The paste does not exist or has been previously deleted.
- content:
- application/json:
- schema:
- type: object
- properties:
- error:
- type: string
-
- 401:
- description: You are not authorized to view this paste or you provided an incorrect password.
- content:
- application/json:
- schema:
- type: object
- properties:
- error:
- type: string
- example: Unauthorized.
-
- 429:
- description: You are requesting too fast.
- content:
- application/json:
- schema:
- type: object
- properties:
- error:
- type: string
- example: You are requesting too fast.
- """
- password: str | None = request.headers.get("authorization", None)
- identifier: str = request.path_params["id"]
-
- paste = await self.app.database.fetch_paste(identifier, password=password)
- if not paste:
- return starlette_plus.JSONResponse(
- {"error": f'A paste with the id "{identifier}" could not be found or has expired.'}, status_code=404
- )
-
- if paste.has_password and not paste.password_ok:
- return starlette_plus.JSONResponse({"error": "Unauthorized"}, status_code=401)
-
- to_return: dict[str, Any] = paste.serialize(exclude=["safety", "password", "password_ok"])
- return starlette_plus.JSONResponse(to_return)
-
- @starlette_plus.route("/paste", methods=["POST"])
- @starlette_plus.route("/pastes", methods=["POST"], include_in_schema=False)
- @starlette_plus.limit(**CONFIG["LIMITS"]["paste_post"])
- @starlette_plus.limit(**CONFIG["LIMITS"]["paste_post_day"])
- async def paste_post(self, request: starlette_plus.Request) -> starlette_plus.Response:
- """Create a paste.
-
- ---
- summary: Create a paste.
- description:
- Creates a paste with or without multiple files for view on the web or via the API.
- You can use this endpoint to POST valid `JSON` data or `plain-text` content.\n\n\n
-
- When using `plain-text`, only one file will be created, without a password or expiry.\n\n\n
-
- Max Character per file is `300_000`.\n\n
-
- Max file limit is `5`.\n\n
-
- If the paste is regarded as public, and contains Discord authorization tokens,
- then these will be invalidated upon paste creation.\n\n
-
- requestBody:
- description: The paste data. `password` and `expires` are optional.
- content:
- application/json:
- schema:
- type: object
- properties:
- files:
- type: array
- items:
- type: object
- properties:
- filename:
- type: string
- required: false
- content:
- type: string
- required: true
- example:
- - filename: thing.py
- content: print(\"Hello World!\")
- - content: Some text or code...
- password:
- required: false
- type: string
- example: null
- expires:
- required: false
- type: string
- example: null
- text/plain:
- schema:
- type: string
-
- responses:
- 200:
- description: The paste meta-data.
- content:
- application/json:
- schema:
- type: object
- properties:
- id:
- type: string
- example: abc123
- created_at:
- type: string
- example: 2024-01-01T00:00:00.000000+00:00
- expires:
- type: string
- example: 2024-01-01T00:00:00.000000+00:00
- safety:
- type: string
- 400:
- description: The paste data was invalid.
- content:
- application/json:
- schema:
- type: object
- properties:
- error:
- type: string
- example: The reason the paste was invalid.
- 429:
- description: You are requesting too fast.
- content:
- application/json:
- schema:
- type: object
- properties:
- error:
- type: string
- example: You are requesting too fast.
- """
- content_type: str | None = request.headers.get("content-type", None)
- body: dict[str, Any] | str
- data: dict[str, Any]
-
- if content_type == "application/json":
- try:
- body = await request.json()
- except json.JSONDecodeError:
- return starlette_plus.JSONResponse({"error": "Invalid JSON provided."}, status_code=400)
- else:
- body = (await request.body()).decode(encoding="UTF-8")
-
- data = {"files": [{"content": body, "filename": None}]} if isinstance(body, str) else body
-
- if resp := validate_paste(data):
- return resp
-
- expiry_str: str | None = data.get("expires", None)
-
- try:
- expiry: datetime.datetime | None = datetime.datetime.fromisoformat(expiry_str) if expiry_str else None
- except Exception as e:
- return starlette_plus.JSONResponse({"error": f'Unable to parse "expiry" parameter: {e}'}, status_code=400)
-
- data["expires"] = expiry
- data["password"] = data.get("password")
-
- try:
- paste = await self.app.database.create_paste(data=data)
- except asyncpg.CharacterNotInRepertoireError:
- message: str = "File(s)/Filename(s) contain invalid characters or byte sequences."
- return starlette_plus.JSONResponse({"error": message}, status_code=400)
-
- to_return: dict[str, Any] = paste.serialize(exclude=["password", "password_ok"])
- to_return.pop("files", None)
-
- return starlette_plus.JSONResponse(to_return, status_code=200)
-
- @starlette_plus.route("/security/info/{token}")
- async def security_info(self, request: starlette_plus.Request) -> starlette_plus.Response:
- token: str | None = request.path_params.get("token", None)
- if not token:
- return starlette_plus.JSONResponse({"error": "Unauthorized."}, status_code=401)
-
- paste = await self.app.database.fetch_paste_security(token=token)
- if not paste:
- return starlette_plus.JSONResponse(
- {"error": "A paste was not found with the provided token, or has expired or been deleted."},
- status_code=404,
- )
-
- delete: str = f"{request.url.scheme}://{request.url.hostname}/api/security/delete/{token}"
- info: str = f"{request.url.scheme}://{request.url.hostname}/api/security/info/{token}"
- data: dict[str, str] = {
- "token": paste.safety,
- "delete": delete,
- "info": info,
- "extra": "Visiting the delete URL will remove the paste instantly.",
- }
-
- return starlette_plus.JSONResponse(data, status_code=200)
-
- @starlette_plus.route("/security/delete/{token}", methods=["GET"])
- async def security_delete(self, request: starlette_plus.Request) -> starlette_plus.Response:
- """Delete a paste.
-
- ---
- summary: Delete a paste.
- description:
- Deletes a paste with the associated safety token.\n\n
-
- This action is not reversible.
-
- parameters:
- - in: path
- name: token
- schema:
- type: string
- required: true
- description: The safety token received when creating the paste.
-
-
- responses:
- 200:
- description: The paste was successfully deleted.
- content:
- text/plain:
- schema:
- type: string
-
- 401:
- description: You are not authorized to delete this paste.
- content:
- application/json:
- schema:
- type: object
- properties:
- error:
- type: string
- example: Unauthorized.
- """
- token: str | None = request.path_params.get("token", None)
- if not token:
- return starlette_plus.JSONResponse({"error": "Unauthorized."}, status_code=401)
-
- await self.app.database.delete_paste_security(token=token)
- return starlette_plus.Response("Ok", status_code=200)
diff --git a/views/docs.py b/views/docs.py
deleted file mode 100644
index af72aedb..00000000
--- a/views/docs.py
+++ /dev/null
@@ -1,48 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from __future__ import annotations
-
-from typing import TYPE_CHECKING
-
-import starlette_plus
-
-
-if TYPE_CHECKING:
- from core import Application
-
-
-class DocsView(starlette_plus.View, prefix="api"):
- def __init__(self, app: Application) -> None:
- self.app: Application = app
-
- @starlette_plus.route("/documentation")
- async def documentation(self, request: starlette_plus.Request) -> starlette_plus.Response:
- headers = {"Access-Control-Allow-Origin": "*"}
- return starlette_plus.FileResponse("web/docs.html", headers=headers)
-
- @starlette_plus.route("/docs")
- async def documentation_redirect(self, request: starlette_plus.Request) -> starlette_plus.Response:
- return starlette_plus.RedirectResponse("/api/documentation")
-
- @starlette_plus.route("/schema")
- async def openapi_schema(self, request: starlette_plus.Request) -> starlette_plus.Response:
- if not self.app.schemas:
- return starlette_plus.Response(status_code=503)
-
- return self.app.schemas.OpenAPIResponse(request=request)
diff --git a/views/htmx.py b/views/htmx.py
deleted file mode 100644
index 7094ad9d..00000000
--- a/views/htmx.py
+++ /dev/null
@@ -1,360 +0,0 @@
-"""MystBin. Share code easily.
-
-Copyright (C) 2020-Current PythonistaGuild
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-"""
-
-from __future__ import annotations
-
-import asyncio
-import datetime
-import json
-from typing import TYPE_CHECKING, Any, cast
-from urllib.parse import unquote, urlsplit
-
-import asyncpg
-import bleach
-import starlette_plus
-
-from core import CONFIG
-from core.utils import natural_time, validate_paste
-
-
-if TYPE_CHECKING:
- from starlette.datastructures import FormData
-
- from core import Application
-
-
-with open("web/paste.html") as fp:
- PASTE_HTML: str = fp.read()
-
-
-class HTMXView(starlette_plus.View, prefix="htmx"):
- def __init__(self, app: Application) -> None:
- self.app: Application = app
-
- def highlight_code(self, *, files: list[dict[str, Any]]) -> str:
- html: str = ""
-
- for index, file in enumerate(files):
- filename = bleach.clean(file["filename"], attributes=[], tags=[])
- filename = "_".join(filename.splitlines())
-
- raw_url: str = f'/raw/{file["parent_id"]}'
- annotation: str = file["annotation"] or ""
- positions: list[int] = file.get("warning_positions", [])
- original: str = file["content"]
-
- parts: list[str] = annotation.split(":")
- annotation = parts.pop(0)
-
- extra: str = (
- f"""{parts[0]}"""
- if parts
- else ""
- )
- annotations: str = (
- f'❌ {annotation}{": " + extra if extra else ""}'
- if annotation
- else ""
- )
-
- position: int = 0
- next_pos: int | None = positions.pop(0) if positions else None
-
- numbers: list[str] = []
- for n, line in enumerate(original.splitlines(), 1):
- length: int = len(line)
-
- if next_pos is not None and position <= next_pos <= position + length:
- numbers.append(
- f"""