├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── codeql-analysis.yml │ ├── devskim-analysis.yml │ ├── greetings.yml │ └── shiftleft-analysis.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── SECURITY.md ├── roblox ├── DataStore3Library.lua └── examples │ ├── addNewUser.lua │ ├── autoSave.lua │ ├── createSqlTable │ └── saveOnLeave.lua └── server ├── .dockerignore ├── CreateUser.py ├── Dockerfile ├── SqliteStorage └── apiKeys.db ├── config.json ├── ipRange.json ├── main.py ├── requirements.txt ├── sqlExecuter.py ├── static ├── Data0.png ├── Data1.png ├── Data2.png ├── Data3.png ├── Data4.png ├── DataStoreLogo.png ├── css │ ├── dashboard.css │ └── style.css └── js │ └── script.js └── templates ├── apikey.html ├── databases.html ├── index.html ├── integrations.html └── login.html /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ main ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ main ] 20 | schedule: 21 | - cron: '45 6 * * 5' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'javascript', 'python' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 37 | # Learn more: 38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v2 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v1 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v1 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v1 72 | -------------------------------------------------------------------------------- /.github/workflows/devskim-analysis.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | name: DevSkim 7 | 8 | on: 9 | push: 10 | branches: [ main ] 11 | pull_request: 12 | branches: [ main ] 13 | schedule: 14 | - cron: '28 9 * * 4' 15 | 16 | jobs: 17 | lint: 18 | name: DevSkim 19 | runs-on: ubuntu-20.04 20 | permissions: 21 | actions: read 22 | contents: read 23 | security-events: write 24 | steps: 25 | - name: Checkout code 26 | uses: actions/checkout@v2 27 | 28 | - name: Run DevSkim scanner 29 | uses: microsoft/DevSkim-Action@v1 30 | 31 | - name: Upload DevSkim scan results to GitHub Security tab 32 | uses: github/codeql-action/upload-sarif@v1 33 | with: 34 | sarif_file: devskim-results.sarif 35 | -------------------------------------------------------------------------------- /.github/workflows/greetings.yml: -------------------------------------------------------------------------------- 1 | name: Greetings 2 | 3 | on: [pull_request, issues] 4 | 5 | jobs: 6 | greeting: 7 | runs-on: ubuntu-latest 8 | permissions: 9 | issues: write 10 | pull-requests: write 11 | steps: 12 | - uses: actions/first-interaction@v1 13 | with: 14 | repo-token: ${{ secrets.GITHUB_TOKEN }} 15 | issue-message: 'Hi, Thankyou for contributing to DataStore3 your input helps us and you stay secure while using DataStore3' 16 | pr-message: 'Please Make sure to read the Code of conduct to keep you and everyone safe.' 17 | -------------------------------------------------------------------------------- /.github/workflows/shiftleft-analysis.yml: -------------------------------------------------------------------------------- 1 | # This workflow integrates Scan with GitHub's code scanning feature 2 | # Scan is a free open-source security tool for modern DevOps teams from ShiftLeft 3 | # Visit https://slscan.io/en/latest/integrations/code-scan for help 4 | name: SL Scan 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | # The branches below must be a subset of the branches above 11 | branches: [ main ] 12 | schedule: 13 | - cron: '40 6 * * 4' 14 | 15 | jobs: 16 | Scan-Build: 17 | # Scan runs on ubuntu, mac and windows 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v2 21 | # Instructions 22 | # 1. Setup JDK, Node.js, Python etc depending on your project type 23 | # 2. Compile or build the project before invoking scan 24 | # Example: mvn compile, or npm install or pip install goes here 25 | # 3. Invoke Scan with the github token. Leave the workspace empty to use relative url 26 | 27 | - name: Perform Scan 28 | uses: ShiftLeftSecurity/scan-action@master 29 | env: 30 | WORKSPACE: "" 31 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 32 | SCAN_AUTO_BUILD: true 33 | with: 34 | output: reports 35 | # Scan auto-detects the languages in your project. To override uncomment the below variable and set the type 36 | # type: credscan,java 37 | # type: python 38 | 39 | - name: Upload report 40 | uses: github/codeql-action/upload-sarif@v1 41 | with: 42 | sarif_file: reports 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # ConfigFiles 7 | config.json 8 | 9 | # C extensions 10 | *.so 11 | 12 | # Distribution / packaging 13 | .Python 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | wheels/ 26 | pip-wheel-metadata/ 27 | share/python-wheels/ 28 | *.egg-info/ 29 | .installed.cfg 30 | *.egg 31 | MANIFEST 32 | 33 | # PyInstaller 34 | # Usually these files are written by a python script from a template 35 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 36 | *.manifest 37 | *.spec 38 | 39 | # Installer logs 40 | pip-log.txt 41 | pip-delete-this-directory.txt 42 | 43 | # Unit test / coverage reports 44 | htmlcov/ 45 | .tox/ 46 | .nox/ 47 | .coverage 48 | .coverage.* 49 | .cache 50 | nosetests.xml 51 | coverage.xml 52 | *.cover 53 | *.py,cover 54 | .hypothesis/ 55 | .pytest_cache/ 56 | 57 | # Translations 58 | *.mo 59 | *.pot 60 | 61 | # Django stuff: 62 | *.log 63 | local_settings.py 64 | db.sqlite3 65 | db.sqlite3-journal 66 | 67 | # Flask stuff: 68 | instance/ 69 | .webassets-cache 70 | 71 | # Scrapy stuff: 72 | .scrapy 73 | 74 | # Sphinx documentation 75 | docs/_build/ 76 | 77 | # PyBuilder 78 | target/ 79 | 80 | # Jupyter Notebook 81 | .ipynb_checkpoints 82 | 83 | # IPython 84 | profile_default/ 85 | ipython_config.py 86 | 87 | # pyenv 88 | .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 98 | __pypackages__/ 99 | 100 | # Celery stuff 101 | celerybeat-schedule 102 | celerybeat.pid 103 | 104 | # SageMath parsed files 105 | *.sage.py 106 | 107 | # Environments 108 | .env 109 | .venv 110 | env/ 111 | venv/ 112 | ENV/ 113 | env.bak/ 114 | venv.bak/ 115 | 116 | # Spyder project settings 117 | .spyderproject 118 | .spyproject 119 | 120 | # Rope project settings 121 | .ropeproject 122 | 123 | # mkdocs documentation 124 | /site 125 | 126 | # mypy 127 | .mypy_cache/ 128 | .dmypy.json 129 | dmypy.json 130 | 131 | # Pyre type checker 132 | .pyre/ 133 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | mail@techonaut.tech. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to DataStore3 👋 2 | This is an overview of how to set up and use DataStore3 in your Roblox experiences 3 | 4 | ## What is it? 🤔 5 | DataStore3 is a service that allows you to store user data such as Leaderstats, Inventories and more and tie them all to a userId, This is a modular system allowing you to access the same databases from multiple experiences. 6 | 7 | ## How does it work? ⚙️ 8 | DataStore3 allows you to start up an API service giving you the ability to remotely send SQL code to be executed on the server, There are multiple security features such as `API keys`, `Usernames`, `Ip range filters` and `request limiters` 9 | ### Frontend 10 | There is a clean, minimalistic web interface packed with features to make your experience better. `Create`, `Rename`, `Import`, `Export` Databases and `Create` and `Delete` API keys 11 | ### Backend 12 | A Roblox library file filled with functions and features pre-coded into a modular script allows you to just `require`(Import) the library in any code, giving you the ability to access simple to use functions to access your database. 13 | 14 | ## How to get started? 🎬 15 | Follow the installation guide that can be found **[here](https://github.com/NotReeceHarris/DataStore3/wiki/Installation)**. If you have any issues or questions feel free to leave a comment or question **[here](https://github.com/NotReeceHarris/DataStore3/discussions/2)** 16 | 17 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 1.0.0 | :white_check_mark: | 11 | 12 | ## Reporting a Vulnerability 13 | 14 | Use this section to tell people how to report a vulnerability. 15 | 16 | Tell them where to go, how often they can expect to get an update on a 17 | reported vulnerability, what to expect if the vulnerability is accepted or 18 | declined, etc. 19 | -------------------------------------------------------------------------------- /roblox/DataStore3Library.lua: -------------------------------------------------------------------------------- 1 | -- $$$$$$$\ $$\ $$$$$$\ $$\ $$$$$$\ 2 | -- $$ __$$\ $$ | $$ __$$\ $$ | $$ ___$$\ 3 | -- $$ | $$ | $$$$$$\ $$$$$$\ $$$$$$\ $$ / \__|$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ \_/ $$ | 4 | -- $$ | $$ | \____$$\\_$$ _| \____$$\ \$$$$$$\ \_$$ _| $$ __$$\ $$ __$$\ $$ __$$\ $$$$$ / 5 | -- $$ | $$ | $$$$$$$ | $$ | $$$$$$$ | \____$$\ $$ | $$ / $$ |$$ | \__|$$$$$$$$ | \___$$\ 6 | -- $$ | $$ |$$ __$$ | $$ |$$\ $$ __$$ |$$\ $$ | $$ |$$\ $$ | $$ |$$ | $$ ____| $$\ $$ | 7 | -- $$$$$$$ |\$$$$$$$ | \$$$$ |\$$$$$$$ |\$$$$$$ | \$$$$ |\$$$$$$ |$$ | \$$$$$$$\ \$$$$$$ | 8 | -- \_______/ \_______| \____/ \_______| \______/ \____/ \______/ \__| \_______| \______/ 9 | 10 | -- Create by Reece Harris (https://github.com/NotReeceHarris) & Deven Briers (https://github.com/NotDevenBriers) 11 | -- This service is a SQL datastore for roblox, allowing multiple users to create multiple databases. 12 | -- $Apache2 License. 13 | -- https://github.com/NotReeceHarris/DataStore3 14 | 15 | -- DO NOT MODIFY THIS FILE UNLESS YOU KNOW WHAT YOUR DOING! 16 | 17 | local username = script.Username.Value -- Get Presaved server details 18 | local apiKey = script.Apikey.Value -- Get Presaved server details 19 | local hostname = script.Hostname.Value -- Get Presaved server details 20 | 21 | local HttpService = game:GetService("HttpService") -- Create a HttpService 22 | 23 | local DataStore3 = {}; -- Create a modula variable 24 | 25 | -------- Local Script functions 26 | 27 | local function encode(dataFields) 28 | 29 | local data = "" -- Create encoded data save point 30 | for k, v in pairs(dataFields) do -- Encode the data into json 31 | data = data .. ("&%s=%s"):format( 32 | HttpService:UrlEncode(k), 33 | HttpService:UrlEncode(v) 34 | ) 35 | end 36 | return data 37 | end 38 | 39 | 40 | -------- Modula Functions 41 | 42 | ---------------------------------------------------------------------------------------------------------------- Test connection 43 | 44 | DataStore3.testConnection = function() 45 | local url = "http://"..hostname.."/api/test/" -- Craft a url from hostname 46 | 47 | ----------------- Encodes the data into a json form format 48 | 49 | local dataFields = { -- Create a DataField Containing Server details and payload 50 | ["key"] = apiKey; 51 | ["username"] = username; 52 | } 53 | 54 | local data = encode(dataFields) -- Encode dataFields 55 | 56 | ----------------- Sends a post request to the database 57 | 58 | local response = HttpService:PostAsync(url, data, Enum.HttpContentType.ApplicationUrlEncoded, false) -- Send a PostAsync request to the server 59 | local data = HttpService:JSONDecode(response) -- Receive the data from the server 60 | 61 | ----------------- Print SQL error Code 62 | 63 | if data.ReturnCode == 0 then -- If Return code is 0 (Meaning an error) 64 | print("Connection Failed -"..data.ErrorCode) -- Print the sql error 65 | elseif data.ReturnCode == 1 then 66 | print("Connection success") 67 | end 68 | 69 | return data -- Return server response 70 | end 71 | 72 | ---------------------------------------------------------------------------------------------------------------- Create table 73 | 74 | DataStore3.CreateTable = function(tableName, primaryKey, dataType) 75 | local url = "http://"..hostname.."/api/payload/post/" -- Craft a url from hostname 76 | 77 | ----------------- Encodes the data into a json form format 78 | 79 | local dataFields = { -- Create a DataField Containing Server details and payload 80 | ["key"] = apiKey; 81 | ["username"] = username; 82 | ["payload"] = "CREATE TABLE "..tableName.."("..primaryKey.." "..dataType..", PRIMARY KEY("..primaryKey.."));"; 83 | } 84 | 85 | local data = encode(dataFields) -- Encode dataFields 86 | 87 | ----------------- Sends a post request to the database 88 | 89 | local response = HttpService:PostAsync(url, data, Enum.HttpContentType.ApplicationUrlEncoded, false) -- Send a PostAsync request to the server 90 | local data = HttpService:JSONDecode(response) -- Receive the data from the server 91 | 92 | ----------------- Print SQL error Code 93 | 94 | if data.ReturnCode == 0 then -- If Return code is 0 (Meaning an error) 95 | print("!! SQL ERROR !! -"..data.ErrorCode) -- Print the sql error 96 | end 97 | 98 | return data -- Return server response 99 | end 100 | 101 | ---------------------------------------------------------------------------------------------------------------- Delete table 102 | 103 | DataStore3.DeleteTable = function(tableName) 104 | local url = "http://"..hostname.."/api/payload/post/" -- Craft a url from hostname 105 | 106 | ----------------- Encodes the data into a json form format 107 | 108 | local dataFields = { -- Create a DataField Containing Server details and payload 109 | ["key"] = apiKey; 110 | ["username"] = username; 111 | ["payload"] = "DROP TABLE "..tableName..";"; 112 | } 113 | 114 | local data = encode(dataFields) -- Encode dataFields 115 | 116 | ----------------- Sends a post request to the database 117 | 118 | local response = HttpService:PostAsync(url, data, Enum.HttpContentType.ApplicationUrlEncoded, false) -- Send a PostAsync request to the server 119 | local data = HttpService:JSONDecode(response) -- Receive the data from the server 120 | 121 | ----------------- Print SQL error Code 122 | 123 | if data.ReturnCode == 0 then -- If Return code is 0 (Meaning an error) 124 | print("!! SQL ERROR !! -"..data.ErrorCode) -- Print the sql error 125 | end 126 | 127 | 128 | return data -- Return server response 129 | end 130 | 131 | ---------------------------------------------------------------------------------------------------------------- Delete a column to table 132 | 133 | 134 | DataStore3.DeleteColumn = function(TableName, ColumnName) 135 | local url = "http://"..hostname.."/api/payload/get/" -- Craft a url from hostname 136 | 137 | ----------------- Gets all columns in table 138 | 139 | local dataFields = { -- Create a DataField Containing Server details and payload 140 | ["key"] = apiKey; 141 | ["username"] = username; 142 | ["payload"] = "pragma table_info("..TableName..")"; 143 | } 144 | 145 | local data = encode(dataFields) -- Encode dataFields 146 | 147 | ----------------- Sends a post request to the database 148 | 149 | local response = HttpService:PostAsync(url, data, Enum.HttpContentType.ApplicationUrlEncoded, false) -- Send a PostAsync request to the server 150 | local columns = HttpService:JSONDecode(response) -- Receive the data from the server 151 | 152 | print(columns) 153 | 154 | local columnNames = "" 155 | local RawColumnNames = "" 156 | local primarykey = nil 157 | 158 | for i,v in pairs(columns.Response) do -- Loop through all columns 159 | if v[2] ~= ColumnName then 160 | local addition = "" 161 | if v[4] == 1 then 162 | addition = "NOT NULL" 163 | end 164 | if v[6] == 1 then 165 | primarykey = v[2] 166 | end 167 | RawColumnNames = RawColumnNames..v[2].."," 168 | columnNames = columnNames..v[2].." "..v[3].." "..addition.."," 169 | end 170 | end 171 | 172 | if primarykey ~= nil then 173 | columnNames = columnNames:sub(1, -2) 174 | columnNames = columnNames..",PRIMARY KEY("..primarykey..")," 175 | end 176 | 177 | RawColumnNames = RawColumnNames:sub(1, -2) 178 | columnNames = columnNames:sub(1, -2) 179 | 180 | local url = "http://"..hostname.."/api/payload/post/" -- Craft a url from hostname 181 | 182 | ----------------- Gets all columns in table 183 | 184 | local dataFields = { -- Create a DataField Containing Server details and payload 185 | ["key"] = apiKey; 186 | ["username"] = username; 187 | ["payload"] = "BEGIN TRANSACTION; CREATE TEMPORARY TABLE "..TableName.."_backup("..columnNames.."); INSERT INTO "..TableName.."_backup SELECT "..RawColumnNames.." FROM "..TableName.."; DROP TABLE "..TableName.."; CREATE TABLE "..TableName.."("..columnNames.."); INSERT INTO "..TableName.." SELECT "..RawColumnNames.." FROM "..TableName.."_backup; DROP TABLE "..TableName.."_backup;"; 188 | 189 | } 190 | 191 | local data = encode(dataFields) -- Encode dataFields 192 | 193 | ----------------- Sends a post request to the database 194 | 195 | local response = HttpService:PostAsync(url, data, Enum.HttpContentType.ApplicationUrlEncoded, false) -- Send a PostAsync request to the server 196 | local data = HttpService:JSONDecode(response) -- Receive the data from the server 197 | 198 | ----------------- Print SQL error Code 199 | 200 | if data.ReturnCode == 0 then -- If Return code is 0 (Meaning an error) 201 | print("!! SQL ERROR !! -"..data.ErrorCode) -- Print the sql error 202 | end 203 | 204 | 205 | return data -- Return server response 206 | 207 | 208 | 209 | end 210 | 211 | 212 | ---------------------------------------------------------------------------------------------------------------- Add a column to table 213 | 214 | 215 | DataStore3.CreateColumn = function(TableName, ColumnName, DataType) 216 | local url = "http://"..hostname.."/api/payload/post/" -- Craft a url from hostname 217 | 218 | ----------------- Encodes the data into a json form format 219 | 220 | local dataFields = { -- Create a DataField Containing Server details and payload 221 | ["key"] = apiKey; 222 | ["username"] = username; 223 | ["payload"] = "ALTER TABLE "..TableName.." ADD "..ColumnName.." "..DataType..";"; 224 | } 225 | 226 | local data = encode(dataFields) -- Encode dataFields 227 | 228 | ----------------- Sends a post request to the database 229 | 230 | local response = HttpService:PostAsync(url, data, Enum.HttpContentType.ApplicationUrlEncoded, false) -- Send a PostAsync request to the server 231 | local data = HttpService:JSONDecode(response) -- Receive the data from the server 232 | 233 | ----------------- Print SQL error Code 234 | 235 | if data.ReturnCode == 0 then -- If Return code is 0 (Meaning an error) 236 | print("!! SQL ERROR !! -"..data.ErrorCode) -- Print the sql error 237 | end 238 | 239 | 240 | return data -- Return server response 241 | 242 | 243 | 244 | end 245 | 246 | ---------------------------------------------------------------------------------------------------------------- Raw Payload Post Request 247 | 248 | DataStore3.PostPayload = function(payload) 249 | local url = "http://"..hostname.."/api/payload/post/" -- Craft a url from hostname 250 | 251 | ----------------- Encodes the data into a json form format 252 | 253 | local dataFields = { -- Create a DataField Containing Server details and payload 254 | ["key"] = apiKey; 255 | ["username"] = username; 256 | ["payload"] = payload; 257 | } 258 | 259 | local data = encode(dataFields) -- Encode dataFields 260 | 261 | ----------------- Sends a post request to the database 262 | 263 | local response = HttpService:PostAsync(url, data, Enum.HttpContentType.ApplicationUrlEncoded, false) -- Send a PostAsync request to the server 264 | local data = HttpService:JSONDecode(response) -- Receive the data from the server 265 | 266 | ----------------- Print SQL error Code 267 | 268 | if data.ReturnCode == 0 then -- If Return code is 0 (Meaning an error) 269 | print("!! SQL ERROR !! -"..data.ErrorCode) -- Print the sql error 270 | end 271 | 272 | 273 | return data -- Return server response 274 | end 275 | 276 | ---------------------------------------------------------------------------------------------------------------- Raw Get Request 277 | 278 | DataStore3.GetPayload = function(payload) 279 | local url = "http://"..hostname.."/api/payload/get/" -- Craft a url from hostname 280 | 281 | ----------------- Encodes the data into a json form format 282 | 283 | local dataFields = { -- Create a DataField Containing Server details and payload 284 | ["key"] = apiKey; 285 | ["username"] = username; 286 | ["payload"] = payload; 287 | } 288 | 289 | local data = encode(dataFields) -- Encode dataFields 290 | 291 | ----------------- Sends a post request to the database 292 | 293 | local response = HttpService:PostAsync(url, data, Enum.HttpContentType.ApplicationUrlEncoded, false) -- Send a PostAsync request to the server (This is a get function but we need to post to the server in this instance) 294 | local data = HttpService:JSONDecode(response) -- Receive the data from the server 295 | 296 | ----------------- Print SQL error Code 297 | 298 | if data.ReturnCode == 0 then -- If Return code is 0 (Meaning an error) 299 | print("!! SQL ERROR !! -"..data.ErrorCode) -- Print the sql error 300 | end 301 | 302 | 303 | return data -- Return server response 304 | end 305 | 306 | 307 | return DataStore3; 308 | -------------------------------------------------------------------------------- /roblox/examples/addNewUser.lua: -------------------------------------------------------------------------------- 1 | -- $$$$$$$\ $$\ $$$$$$\ $$\ $$$$$$\ 2 | -- $$ __$$\ $$ | $$ __$$\ $$ | $$ ___$$\ 3 | -- $$ | $$ | $$$$$$\ $$$$$$\ $$$$$$\ $$ / \__|$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ \_/ $$ | 4 | -- $$ | $$ | \____$$\\_$$ _| \____$$\ \$$$$$$\ \_$$ _| $$ __$$\ $$ __$$\ $$ __$$\ $$$$$ / 5 | -- $$ | $$ | $$$$$$$ | $$ | $$$$$$$ | \____$$\ $$ | $$ / $$ |$$ | \__|$$$$$$$$ | \___$$\ 6 | -- $$ | $$ |$$ __$$ | $$ |$$\ $$ __$$ |$$\ $$ | $$ |$$\ $$ | $$ |$$ | $$ ____| $$\ $$ | 7 | -- $$$$$$$ |\$$$$$$$ | \$$$$ |\$$$$$$$ |\$$$$$$ | \$$$$ |\$$$$$$ |$$ | \$$$$$$$\ \$$$$$$ | 8 | -- \_______/ \_______| \____/ \_______| \______/ \____/ \______/ \__| \_______| \______/ 9 | 10 | -- Create by Reece Harris (https://github.com/NotReeceHarris) & Deven Briers (https://github.com/NotDevenBriers) 11 | -- This service is a SQL datastore for roblox, allowing multiple users to create multiple databases. 12 | -- $Apache2 License. 13 | -- https://github.com/NotReeceHarris/DataStore3 14 | 15 | -- This file is an example, any values such as gold, wood and gems can be changed do what ever you want your are not restricted by value amounts ever so you can stop up too 5 Gb of data (Not per person) 16 | 17 | local DataStore3 = require(game:GetService("ServerScriptService").DataStore3Libary); --Imports the DataStore3 libary 18 | 19 | 20 | local Players = game:GetService("Players") 21 | 22 | Players.PlayerAdded:Connect(function(player) -- Player Join function 23 | local userid = player.UserId -- Get UserId of joined player 24 | local payload = "SELECT * FROM userData WHERE userId ='"..userid.."'" -- Select all from userdata table where userId = players userid (SQL CODE) 25 | local response = DataStore3.GetPayload(payload) -- Send the post request to the server 26 | 27 | if response.Response == nil then -- If the responce is nil (Meaning the player isnt already in the data base) 28 | local payload = "INSERT INTO userData VALUES ('"..userid.."', '0', '0', '0')" -- Add the player to the database making the first value the userId (SQL CODE) 29 | local response = DataStore3.PostPayload(payload) -- Send the post request to the server 30 | else -- If the user is in the databse 31 | local payload = "SELECT * FROM userData WHERE userId = '"..player.UserId.."'" -- Select all data from the userdata table where userId = players userid (SQL CODE) 32 | local response = DataStore3.GetPayload(payload) -- Send the get request to the server 33 | 34 | -- When getting a responce there are to parts the the table 'response.Response[a][b]' A & B a is the selector for example if a was equal to 1 you would 35 | -- get the response code (1 is success and 0 is error) if a was equal to 2 you would get the SQL response for this example (userId, Gold, Wood, Gems) 36 | 37 | player.leaderstats.Gold.Value = response.Response[1][2] -- Make the leaderstat of the player equal to the usersData (Gold, 2nd column in row) 38 | player.leaderstats.Gems.Value = response.Response[1][4] -- Make the leaderstat of the player equal to the usersData (Gems, 4nd column in row) 39 | player.Inventory.Wood.Value = response.Response[1][3] -- Make the leaderstat of the player equal to the usersData (Wood, 3nd column in row) 40 | end 41 | end) 42 | -------------------------------------------------------------------------------- /roblox/examples/autoSave.lua: -------------------------------------------------------------------------------- 1 | -- $$$$$$$\ $$\ $$$$$$\ $$\ $$$$$$\ 2 | -- $$ __$$\ $$ | $$ __$$\ $$ | $$ ___$$\ 3 | -- $$ | $$ | $$$$$$\ $$$$$$\ $$$$$$\ $$ / \__|$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ \_/ $$ | 4 | -- $$ | $$ | \____$$\\_$$ _| \____$$\ \$$$$$$\ \_$$ _| $$ __$$\ $$ __$$\ $$ __$$\ $$$$$ / 5 | -- $$ | $$ | $$$$$$$ | $$ | $$$$$$$ | \____$$\ $$ | $$ / $$ |$$ | \__|$$$$$$$$ | \___$$\ 6 | -- $$ | $$ |$$ __$$ | $$ |$$\ $$ __$$ |$$\ $$ | $$ |$$\ $$ | $$ |$$ | $$ ____| $$\ $$ | 7 | -- $$$$$$$ |\$$$$$$$ | \$$$$ |\$$$$$$$ |\$$$$$$ | \$$$$ |\$$$$$$ |$$ | \$$$$$$$\ \$$$$$$ | 8 | -- \_______/ \_______| \____/ \_______| \______/ \____/ \______/ \__| \_______| \______/ 9 | 10 | -- Create by Reece Harris (https://github.com/NotReeceHarris) & Deven Briers (https://github.com/NotDevenBriers) 11 | -- This service is a SQL datastore for roblox, allowing multiple users to create multiple databases. 12 | -- $Apache2 License. 13 | -- https://github.com/NotReeceHarris/DataStore3 14 | 15 | -- In this script the users data for gold, gems and wood are auto saved every 30 seconds 16 | -- all data is saved by userid so this data can also be accessed via another game 17 | 18 | local DataStore3 = require(game:GetService("ServerScriptService").DataStore3Libary); --Imports the DataStore3 libary 19 | 20 | local Players = game:GetService("Players") 21 | 22 | while true do -- Infinate Loop 23 | for i,v in pairs(game.Players:GetChildren()) do -- Get all active players in game 24 | local gold = v.leaderstats.Gold.Value -- Get players Gold Value 25 | local gems = v.leaderstats.Gems.Value -- Get players Gems Value 26 | local wood = v.Inventory.Wood.Value -- Get players Wood Value 27 | local payload = "UPDATE userData SET gold ='"..gold.."', wood ='"..wood.."', gems='"..gems.."' WHERE userId = '"..v.UserId.."';" -- Update table called userData and set gold, wood and gems where usersId = players user id 28 | local response = DataStore3.PostPayload(payload) -- Send the Post request to the server 29 | end 30 | print("Saved Successfully") -- Print to server 'Saved Successfully' only developers will see this as players cant access the server console 31 | wait(30) -- Wait 30 seconds to loop again 32 | end 33 | -------------------------------------------------------------------------------- /roblox/examples/createSqlTable: -------------------------------------------------------------------------------- 1 | -- $$$$$$$\ $$\ $$$$$$\ $$\ $$$$$$\ 2 | -- $$ __$$\ $$ | $$ __$$\ $$ | $$ ___$$\ 3 | -- $$ | $$ | $$$$$$\ $$$$$$\ $$$$$$\ $$ / \__|$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ \_/ $$ | 4 | -- $$ | $$ | \____$$\\_$$ _| \____$$\ \$$$$$$\ \_$$ _| $$ __$$\ $$ __$$\ $$ __$$\ $$$$$ / 5 | -- $$ | $$ | $$$$$$$ | $$ | $$$$$$$ | \____$$\ $$ | $$ / $$ |$$ | \__|$$$$$$$$ | \___$$\ 6 | -- $$ | $$ |$$ __$$ | $$ |$$\ $$ __$$ |$$\ $$ | $$ |$$\ $$ | $$ |$$ | $$ ____| $$\ $$ | 7 | -- $$$$$$$ |\$$$$$$$ | \$$$$ |\$$$$$$$ |\$$$$$$ | \$$$$ |\$$$$$$ |$$ | \$$$$$$$\ \$$$$$$ | 8 | -- \_______/ \_______| \____/ \_______| \______/ \____/ \______/ \__| \_______| \______/ 9 | 10 | -- Create by Reece Harris (https://github.com/NotReeceHarris) & Deven Briers (https://github.com/NotDevenBriers) 11 | -- This service is a SQL datastore for roblox, allowing multiple users to create multiple databases. 12 | -- $Apache2 License. 13 | -- https://github.com/NotReeceHarris/DataStore3 14 | 15 | -- This file is an example, any values such as gold, wood and gems can be changed do what ever you want your are not restricted by value amounts ever so you can stop up too 5 Gb of data (Not per person) 16 | 17 | local DataStore3 = require(game:GetService("ServerScriptService").DataStore3Libary); --Imports the DataStore3 libary 18 | 19 | local payload = [[ 20 | CREATE TABLE userData( 21 | userId VARCHAR NOT NULL, 22 | gold INT(10), 23 | wood INT(10), 24 | gems INT(10), 25 | 26 | PRIMARY KEY(userId) 27 | ) 28 | ]] 29 | 30 | DataStore3.GetPayload(payload) 31 | -------------------------------------------------------------------------------- /roblox/examples/saveOnLeave.lua: -------------------------------------------------------------------------------- 1 | -- $$$$$$$\ $$\ $$$$$$\ $$\ $$$$$$\ 2 | -- $$ __$$\ $$ | $$ __$$\ $$ | $$ ___$$\ 3 | -- $$ | $$ | $$$$$$\ $$$$$$\ $$$$$$\ $$ / \__|$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ \_/ $$ | 4 | -- $$ | $$ | \____$$\\_$$ _| \____$$\ \$$$$$$\ \_$$ _| $$ __$$\ $$ __$$\ $$ __$$\ $$$$$ / 5 | -- $$ | $$ | $$$$$$$ | $$ | $$$$$$$ | \____$$\ $$ | $$ / $$ |$$ | \__|$$$$$$$$ | \___$$\ 6 | -- $$ | $$ |$$ __$$ | $$ |$$\ $$ __$$ |$$\ $$ | $$ |$$\ $$ | $$ |$$ | $$ ____| $$\ $$ | 7 | -- $$$$$$$ |\$$$$$$$ | \$$$$ |\$$$$$$$ |\$$$$$$ | \$$$$ |\$$$$$$ |$$ | \$$$$$$$\ \$$$$$$ | 8 | -- \_______/ \_______| \____/ \_______| \______/ \____/ \______/ \__| \_______| \______/ 9 | 10 | -- Create by Reece Harris (https://github.com/NotReeceHarris) & Deven Briers (https://github.com/NotDevenBriers) 11 | -- This service is a SQL datastore for roblox, allowing multiple users to create multiple databases. 12 | -- $Apache2 License. 13 | -- https://github.com/NotReeceHarris/DataStore3 14 | 15 | -- This file is an example, any values such as gold, wood and gems can be changed do what ever you want your are not restricted by value amounts ever so you can stop up too 5 Gb of data (Not per person) 16 | 17 | local DataStore3 = require(game:GetService("ServerScriptService").DataStore3Libary); --Imports the DataStore3 libary 18 | 19 | 20 | local Players = game:GetService("Players") 21 | 22 | Players.PlayerRemoving:Connect(function(player) -- Player Leave function 23 | local gold = player.leaderstats.Gold.Value -- Get players leaderstat values (Gold) 24 | local gems = player.leaderstats.Gems.Value -- Get players leaderstat values (Gold) 25 | local wood = player.Inventory.Wood.Value -- Get players leaderstat values (Gold) 26 | local payload = "UPDATE userData SET gold ='"..gold.."', wood ='"..wood.."', gems='"..gems.."' WHERE userId = '"..player.UserId.."';" -- Update userData table and set Gold, Wood, Gems where usersId = Players userId 27 | local response = DataStore3.PostPayload(payload) -- Send the Post request to the server 28 | end) 29 | -------------------------------------------------------------------------------- /server/.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | .git 3 | .gitignore 4 | -------------------------------------------------------------------------------- /server/CreateUser.py: -------------------------------------------------------------------------------- 1 | ''' 2 | $$$$$$$\ $$\ $$$$$$\ $$\ $$$$$$\ 3 | $$ __$$\ $$ | $$ __$$\ $$ | $$ ___$$\ 4 | $$ | $$ | $$$$$$\ $$$$$$\ $$$$$$\ $$ / \__|$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ \_/ $$ | 5 | $$ | $$ | \____$$\\_$$ _| \____$$\ \$$$$$$\ \_$$ _| $$ __$$\ $$ __$$\ $$ __$$\ $$$$$ / 6 | $$ | $$ | $$$$$$$ | $$ | $$$$$$$ | \____$$\ $$ | $$ / $$ |$$ | \__|$$$$$$$$ | \___$$\ 7 | $$ | $$ |$$ __$$ | $$ |$$\ $$ __$$ |$$\ $$ | $$ |$$\ $$ | $$ |$$ | $$ ____| $$\ $$ | 8 | $$$$$$$ |\$$$$$$$ | \$$$$ |\$$$$$$$ |\$$$$$$ | \$$$$ |\$$$$$$ |$$ | \$$$$$$$\ \$$$$$$ | 9 | \_______/ \_______| \____/ \_______| \______/ \____/ \______/ \__| \_______| \______/ 10 | Create by Reece Harris (https://github.com/NotReeceHarris) & Deven Briers (https://github.com/NotDevenBriers) 11 | This service is a SQL datastore for roblox, allowing multiple users to create multiple databases. 12 | - Apache2 License. 13 | https://github.com/NotReeceHarris/DataStore3 14 | ''' 15 | 16 | import random 17 | import string 18 | import sqlite3 19 | import hashlib 20 | import os 21 | 22 | while True: 23 | 24 | username = input("Enter Username: ") 25 | password = "" 26 | 27 | while True: 28 | x = input("Do you want to generate a password [Y/n]: ").lower() 29 | if x in ["y", "n"]: 30 | if x == "y": 31 | password = ''.join(random.choice(string.ascii_letters) for i in range(10)) 32 | if x == "n": 33 | while True: 34 | password = input("Enter password: ") 35 | if len(password) <= 10: 36 | print("Password is to simple, make sure to make it longer then 10 characters!") 37 | else: 38 | break 39 | break 40 | else: 41 | print("Incorrect input!") 42 | 43 | try: 44 | conn = sqlite3.connect('SqliteStorage/userCreds.db') 45 | c = conn.cursor() 46 | c.execute(""" 47 | CREATE TABLE members ( 48 | _id varchar(40) NOT NULL UNIQUE, 49 | _username varchar(32) NOT NULL, 50 | _password varchar(64) NOT NULL, 51 | PRIMARY KEY(_id) 52 | ) 53 | """) 54 | conn.commit() 55 | except: 56 | pass 57 | 58 | c.execute(f'SELECT * FROM members WHERE _id = "{hashlib.sha1(username.encode("ascii")).hexdigest()}"') 59 | data = c.fetchall() 60 | if data != []: 61 | print("Username Taken!") 62 | else: 63 | break 64 | 65 | c.execute(f'INSERT INTO members VALUES ("{hashlib.sha1(username.encode("ascii")).hexdigest()}" ,"{username}" ,"{hashlib.sha256(password.encode("ascii")).hexdigest()}")') 66 | 67 | conn.commit() 68 | conn.close() 69 | 70 | if not os.path.exists(f"SqliteStorage/{username}"): 71 | os.makedirs(f"SqliteStorage/{username}") 72 | 73 | print(f""" 74 | Username: {username} 75 | Password: {password} 76 | """) 77 | 78 | input("Press Enter to continue..") 79 | -------------------------------------------------------------------------------- /server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.9 2 | 3 | COPY requirements.txt / 4 | RUN sudo python -m pip install -r /requirements.txt 5 | 6 | COPY . /server 7 | WORKDIR /server 8 | 9 | CMD [ "sudo", "python", "./server.py" ] 10 | -------------------------------------------------------------------------------- /server/SqliteStorage/apiKeys.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NotReeceHarris/DataStore3/c44b4014ddb29d34903370afae2af94e94909e4f/server/SqliteStorage/apiKeys.db -------------------------------------------------------------------------------- /server/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ipfilter": false, 3 | "port": 80, 4 | "debug": false 5 | } 6 | -------------------------------------------------------------------------------- /server/ipRange.json: -------------------------------------------------------------------------------- 1 | [ 2 | "103.140.28", 3 | "128.116", 4 | "128.116", 5 | "128.116.100", 6 | "128.116.101", 7 | "128.116.102", 8 | "128.116.1", 9 | "128.116.105", 10 | "128.116.11", 11 | "128.116.112", 12 | "128.116.113", 13 | "128.116.114", 14 | "128.116.116", 15 | "128.116.117", 16 | "128.116.118", 17 | "128.116.119", 18 | "128.116.120", 19 | "128.116.121", 20 | "128.116.122", 21 | "128.116.123", 22 | "128.116.124", 23 | "128.116.125", 24 | "128.116.126", 25 | "128.116.127", 26 | "128.116.13", 27 | "128.116.14", 28 | "128.116.15", 29 | "128.116.16", 30 | "128.116.17", 31 | "128.116.18", 32 | "128.116.2", 33 | "128.116.21", 34 | "128.116.22", 35 | "128.116.23", 36 | "128.116.24", 37 | "128.116.25", 38 | "128.116.27", 39 | "128.116.28", 40 | "128.116.29", 41 | "128.116.30", 42 | "128.116.3", 43 | "128.116.31", 44 | "128.116.32", 45 | "128.116.33", 46 | "128.116.34", 47 | "128.116.35", 48 | "128.116.36", 49 | "128.116.37", 50 | "128.116.38", 51 | "128.116.4", 52 | "128.116.50", 53 | "128.116.5", 54 | "128.116.51", 55 | "128.116.52", 56 | "128.116.53", 57 | "128.116.54", 58 | "128.116.55", 59 | "128.116.56", 60 | "128.116.57", 61 | "128.116.58", 62 | "128.116.59", 63 | "128.116.60", 64 | "128.116.6", 65 | "128.116.61", 66 | "128.116.62", 67 | "128.116.63", 68 | "128.116.64", 69 | "128.116.65", 70 | "128.116.66", 71 | "128.116.67", 72 | "128.116.69", 73 | "128.116.70", 74 | "128.116.71", 75 | "128.116.72", 76 | "128.116.73", 77 | "128.116.74", 78 | "128.116.75", 79 | "128.116.76", 80 | "128.116.77", 81 | "128.116.78", 82 | "128.116.79", 83 | "128.116.80", 84 | "128.116.8", 85 | "128.116.81", 86 | "128.116.82", 87 | "128.116.83", 88 | "128.116.97", 89 | "128.116.99", 90 | "141.193.3", 91 | "205.201.62", 92 | "209.206.40", 93 | "209.206.40", 94 | "209.206.41", 95 | "209.206.42", 96 | "209.206.43", 97 | "209.206.44", 98 | "209.206.45", 99 | "209.206.46", 100 | "209.206.47", 101 | "2620:135:6000::", 102 | "2620:135:6004::", 103 | "2620:135:6005::", 104 | "2620:135:6006::", 105 | "2620:135:6007::", 106 | "2620:135:6008::", 107 | "2620:135:6041::", 108 | "2620:135:6042::", 109 | "2620:135:6043::", 110 | "2620:135:6044::" 111 | ] -------------------------------------------------------------------------------- /server/main.py: -------------------------------------------------------------------------------- 1 | ''' 2 | $$$$$$$\ $$\ $$$$$$\ $$\ $$$$$$\ 3 | $$ __$$\ $$ | $$ __$$\ $$ | $$ ___$$\ 4 | $$ | $$ | $$$$$$\ $$$$$$\ $$$$$$\ $$ / \__|$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ \_/ $$ | 5 | $$ | $$ | \____$$\\_$$ _| \____$$\ \$$$$$$\ \_$$ _| $$ __$$\ $$ __$$\ $$ __$$\ $$$$$ / 6 | $$ | $$ | $$$$$$$ | $$ | $$$$$$$ | \____$$\ $$ | $$ / $$ |$$ | \__|$$$$$$$$ | \___$$\ 7 | $$ | $$ |$$ __$$ | $$ |$$\ $$ __$$ |$$\ $$ | $$ |$$\ $$ | $$ |$$ | $$ ____| $$\ $$ | 8 | $$$$$$$ |\$$$$$$$ | \$$$$ |\$$$$$$$ |\$$$$$$ | \$$$$ |\$$$$$$ |$$ | \$$$$$$$\ \$$$$$$ | 9 | \_______/ \_______| \____/ \_______| \______/ \____/ \______/ \__| \_______| \______/ 10 | 11 | Create by Reece Harris (https://github.com/NotReeceHarris) & Deven Briers (https://github.com/NotDevenBriers) 12 | This service is a SQL datastore for roblox, allowing multiple users to create multiple databases. 13 | - Apache2 License. 14 | https://github.com/NotReeceHarris/DataStore3 15 | 16 | 17 | 18 | This code is open source, all backend SQL executions will stay up to date 19 | ''' 20 | 21 | from flask import Flask, redirect, url_for, render_template, request, session, flash, send_file, jsonify 22 | from flask_assets import Environment, Bundle 23 | import sqlite3 24 | import hashlib 25 | import json 26 | import datetime 27 | import random 28 | import string 29 | import os 30 | from os import listdir 31 | from waitress import serve 32 | 33 | app = Flask(__name__) 34 | assets = Environment(app) 35 | app.permanent_session_lifetime = datetime.timedelta(days=365) 36 | app.secret_key = "abc123#"#''.join(random.choice(string.ascii_letters) for i in range(100)).encode('ascii') 37 | 38 | from sqlExecuter import SqlExecutionApi 39 | app.register_blueprint(SqlExecutionApi) 40 | 41 | 42 | @app.route('/') 43 | def index(): 44 | if session != []: 45 | if "logedin" in session: 46 | path = f"SqliteStorage/{session['username']}" 47 | dbdata = {"databases": []} 48 | for filename in listdir(path): 49 | conn = sqlite3.connect(f'SqliteStorage/{session["username"]}/{filename}') 50 | c = conn.cursor() 51 | c.execute("SELECT name FROM sqlite_master WHERE type='table';") 52 | tables = c.fetchall() 53 | x = { 54 | "id": filename[:40], 55 | "name": filename[40:-3].upper(), 56 | "tables": tables, 57 | "tablelen": len(tables), 58 | "size": round(int(os.path.getsize(f"SqliteStorage/{ session['username']}/{filename}")) / 1048576, 2), 59 | "sizeb": os.path.getsize(f"SqliteStorage/{ session['username']}/{filename}") 60 | } 61 | dbdata["databases"].append(x) 62 | return render_template('index.html', databases=dbdata) 63 | else: 64 | return redirect(url_for("login")) 65 | else: 66 | return redirect(url_for("login")) 67 | 68 | @app.route('/dbs') 69 | def databases(): 70 | if session != []: 71 | if "logedin" in session: 72 | path = f"SqliteStorage/{session['username']}" 73 | dbdata = {"databases": []} 74 | for filename in listdir(path): 75 | conn = sqlite3.connect(f'SqliteStorage/{session["username"]}/{filename}') 76 | c = conn.cursor() 77 | c.execute("SELECT name FROM sqlite_master WHERE type='table';") 78 | tables = c.fetchall() 79 | x = { 80 | "id": filename[:40], 81 | "name": filename[40:-3].upper(), 82 | "tables": tables, 83 | "tablelen": len(tables), 84 | "size": round(int(os.path.getsize(f"SqliteStorage/{ session['username']}/{filename}")) / 1048576, 2) 85 | } 86 | dbdata["databases"].append(x) 87 | return render_template('databases.html', databases=dbdata) 88 | else: 89 | return redirect(url_for("Four0Four")) 90 | else: 91 | return redirect(url_for("Four0Four")) 92 | 93 | @app.route('/apikey') 94 | def apikey(): 95 | if session != []: 96 | if "logedin" in session: 97 | path = f"SqliteStorage/{session['username']}" 98 | dbdata = {"databases": []} 99 | for filename in listdir(path): 100 | conn = sqlite3.connect(f'SqliteStorage/{session["username"]}/{filename}') 101 | c = conn.cursor() 102 | c.execute("SELECT name FROM sqlite_master WHERE type='table';") 103 | tables = c.fetchall() 104 | conn.close() 105 | conn = sqlite3.connect(f'SqliteStorage/apiKeys.db') 106 | c = conn.cursor() 107 | c.execute(f"SELECT * FROM Keys WHERE _id='{filename[:40]}'") 108 | keys = c.fetchall() 109 | x = { 110 | "id": filename[:40], 111 | "name": filename[40:-3].upper(), 112 | "tables": tables, 113 | "tablelen": len(tables), 114 | "keys": len(keys), 115 | "key": keys 116 | } 117 | dbdata["databases"].append(x) 118 | return render_template('apikey.html', databases=dbdata) 119 | else: 120 | return redirect(url_for("Four0Four")) 121 | else: 122 | return redirect(url_for("Four0Four")) 123 | 124 | @app.route('/login', defaults={'_other': ""}) 125 | @app.route('/login/') 126 | def login(_other): 127 | if session != []: 128 | if "logedin" in session: 129 | return redirect(url_for("index")) 130 | else: 131 | return render_template('login.html', other=_other) 132 | else: 133 | return render_template('login.html', other=_other) 134 | 135 | @app.errorhandler(404) 136 | def page_not_found(e): 137 | return redirect(url_for("Four0Four")) 138 | 139 | @app.route('/404') 140 | def Four0Four(): 141 | return "Page Not Found" 142 | 143 | #------------------------------------------------------------------------------------------- POST REQUESTS 144 | 145 | 146 | @app.route('/newDataBase', defaults={'name': None}, methods=["POST"]) 147 | @app.route('/newDataBase/', methods=["POST"]) 148 | def newDataBase(name): 149 | if session != []: 150 | if "logedin" in session: 151 | if request.form['dbname'] != "": 152 | from datetime import date 153 | id = hashlib.sha1(f"{date.today()}{random.random()}".encode("ascii")).hexdigest() 154 | open(f"SqliteStorage/{session['username']}/{id}{request.form['dbname'].lower()}.db", "w") 155 | flash("Successfull Created Database") 156 | return redirect(url_for("databases")) 157 | else: 158 | flash("Failed Created Database") 159 | return redirect(url_for("databases")) 160 | else: 161 | return redirect(url_for("Four0Four")) 162 | else: 163 | return redirect(url_for("Four0Four")) 164 | 165 | @app.route('/DelKey', defaults={'keyid': None}) 166 | @app.route('/DelKey/') 167 | def DelKey(keyid): 168 | if session != []: 169 | if "logedin" in session: 170 | if keyid != None: 171 | 172 | conn = sqlite3.connect(f'SqliteStorage/apiKeys.db') 173 | c = conn.cursor() 174 | c.execute(f"DELETE from keys WHERE _key = '{keyid}'") 175 | conn.commit() 176 | conn.close() 177 | 178 | flash('Success') 179 | return redirect(url_for("apikey")) 180 | 181 | else: 182 | return redirect(url_for("Four0Four")) 183 | else: 184 | return redirect(url_for("Four0Four")) 185 | else: 186 | return redirect(url_for("Four0Four")) 187 | 188 | @app.route('/GenKey', defaults={'dbid': None}) 189 | @app.route('/GenKey/') 190 | def GenKey(dbid): 191 | if session != []: 192 | if "logedin" in session: 193 | if dbid != None: 194 | 195 | conn = sqlite3.connect(f'SqliteStorage/apiKeys.db') 196 | c = conn.cursor() 197 | c.execute(f"SELECT * FROM Keys WHERE _id='{dbid}'") 198 | keys = c.fetchall() 199 | 200 | if len(keys) >= 4: 201 | conn.close() 202 | flash("To many active Api Keys") 203 | return redirect(url_for("apikey")) 204 | else: 205 | key = hashlib.sha1(str(random.randint(100000,999999)).encode("ascii")).hexdigest() 206 | c.execute('INSERT INTO Keys VALUES (:id ,:key)', 207 | {'id':dbid, 'key':key}) 208 | conn.commit() 209 | conn.close() 210 | flash("Success") 211 | return redirect(url_for("apikey")) 212 | else: 213 | return redirect(url_for("Four0Four")) 214 | else: 215 | return redirect(url_for("Four0Four")) 216 | else: 217 | return redirect(url_for("Four0Four")) 218 | 219 | @app.route('/loginPost', methods=["POST"]) 220 | def loginPost(): 221 | conn = sqlite3.connect('SqliteStorage/userCreds.db') 222 | c = conn.cursor() 223 | c.execute(f'SELECT * FROM members WHERE _username="{request.form["username"]}"') 224 | response = c.fetchone() 225 | 226 | if response != [] or request.form["password"] != None: 227 | if response[2] == hashlib.sha256(request.form["password"].encode('ascii')).hexdigest(): 228 | session["logedin"] = True 229 | session["username"] = request.form["username"] 230 | return redirect(url_for("index")) 231 | else: 232 | flash("Username / Password incorrect") 233 | return redirect(url_for("login")) 234 | else: 235 | flash("Username / Password incorrect") 236 | return redirect(url_for("login")) 237 | 238 | @app.route('/Signout') 239 | def Signout(): 240 | if session != []: 241 | if "logedin" in session: 242 | session.clear() 243 | return redirect(url_for("login")) 244 | else: 245 | return redirect(url_for("login")) 246 | else: 247 | return redirect(url_for("login")) 248 | 249 | @app.route('/deleteDb', defaults={'name': None, "id": None}) 250 | @app.route('/deleteDb//') 251 | def deleteDb(name, id): 252 | if session != []: 253 | if "logedin" in session: 254 | if name != "" and id != "": 255 | conn = sqlite3.connect(f'SqliteStorage/apiKeys.db') 256 | c = conn.cursor() 257 | c.execute(f"DELETE FROM keys WHERE _id = '{id}';") 258 | conn.commit() 259 | conn.close() 260 | os.remove(f'SqliteStorage/{session["username"]}/{id}{name.lower()}.db') 261 | return redirect(url_for("databases")) 262 | else: 263 | return redirect(url_for("databases")) 264 | else: 265 | return redirect(url_for("Four0Four")) 266 | else: 267 | return redirect(url_for("Four0Four")) 268 | 269 | 270 | @app.route('/renameDb', methods=["POST"]) 271 | def renameDb(): 272 | oldname = request.form["oldname"] 273 | newname = request.form["newname"] 274 | username = session["username"] 275 | print(f"- {newname}| {newname == ''}") 276 | dbid = request.form["id"] 277 | if session != []: 278 | if "logedin" in session: 279 | if oldname != "" and id != "" and newname != "": 280 | if True: 281 | os.rename(f'SqliteStorage/{username}/{dbid}{oldname.lower()}.db', f'SqliteStorage/{username}/{dbid}{newname}.db') 282 | flash("Successfull Rename") 283 | return redirect(url_for("databases")) 284 | else: 285 | flash("Rename failed") 286 | return redirect(url_for("databases")) 287 | else: 288 | return redirect(url_for("Four0Four")) 289 | else: 290 | return redirect(url_for("Four0Four")) 291 | 292 | @app.route('/exportGet', defaults={'name': None, "id": None}) 293 | @app.route('/exportGet//') 294 | def exportGet(name, id): 295 | if session != []: 296 | if "logedin" in session: 297 | if name != "" and id != "": 298 | return send_file(f'SqliteStorage/{session["username"]}/{id}{name.lower()}.db', as_attachment=True) 299 | else: 300 | return redirect(url_for("databases")) 301 | else: 302 | return redirect(url_for("Four0Four")) 303 | else: 304 | return redirect(url_for("Four0Four")) 305 | 306 | @app.route('/import', methods=["POST"]) 307 | def importPost(): 308 | if session != []: 309 | if "logedin" in session: 310 | if request.form['filename'] != "": 311 | f = request.files['file'] 312 | id = hashlib.sha1(f"{f.read()}{random.random()}".encode("ascii")).hexdigest() 313 | name = f"{id}{request.form['filename'].lower()}.db" 314 | f.save(f"SqliteStorage/{session['username']}/{name}") 315 | flash("Successfull Import") 316 | return redirect(url_for("databases")) 317 | else: 318 | flash("Import failed (Please add a name)") 319 | return redirect(url_for("databases")) 320 | else: 321 | return redirect(url_for("Four0Four")) 322 | else: 323 | return redirect(url_for("Four0Four")) 324 | 325 | 326 | if __name__ == "__main__": 327 | import socket 328 | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 329 | s.connect(("8.8.8.8", 80)) 330 | hostname = s.getsockname()[0] 331 | s.close() 332 | port = json.load(open("config.json"))["port"] 333 | debug = json.load(open("config.json"))["debug"] 334 | if debug: 335 | app.run(host=hostname, port=port, debug=True) 336 | else: 337 | print(f""" 338 | DataStore3 339 | Host: {hostname} 340 | Port: {port} 341 | Url : http://{hostname}:{port} 342 | """) 343 | serve(app, host=hostname, port=port) 344 | -------------------------------------------------------------------------------- /server/requirements.txt: -------------------------------------------------------------------------------- 1 | flask==2.0.1 2 | flask_assets==2.0 3 | waitress==2.1.1 4 | -------------------------------------------------------------------------------- /server/sqlExecuter.py: -------------------------------------------------------------------------------- 1 | ''' 2 | $$$$$$$\ $$\ $$$$$$\ $$\ $$$$$$\ 3 | $$ __$$\ $$ | $$ __$$\ $$ | $$ ___$$\ 4 | $$ | $$ | $$$$$$\ $$$$$$\ $$$$$$\ $$ / \__|$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ \_/ $$ | 5 | $$ | $$ | \____$$\\_$$ _| \____$$\ \$$$$$$\ \_$$ _| $$ __$$\ $$ __$$\ $$ __$$\ $$$$$ / 6 | $$ | $$ | $$$$$$$ | $$ | $$$$$$$ | \____$$\ $$ | $$ / $$ |$$ | \__|$$$$$$$$ | \___$$\ 7 | $$ | $$ |$$ __$$ | $$ |$$\ $$ __$$ |$$\ $$ | $$ |$$\ $$ | $$ |$$ | $$ ____| $$\ $$ | 8 | $$$$$$$ |\$$$$$$$ | \$$$$ |\$$$$$$$ |\$$$$$$ | \$$$$ |\$$$$$$ |$$ | \$$$$$$$\ \$$$$$$ | 9 | \_______/ \_______| \____/ \_______| \______/ \____/ \______/ \__| \_______| \______/ 10 | 11 | Create by Reece Harris (https://github.com/NotReeceHarris) & Deven Briers (https://github.com/NotDevenBriers) 12 | This service is a SQL datastore for roblox, allowing multiple users to create multiple databases. 13 | - Apache2 License. 14 | https://github.com/NotReeceHarris/DataStore3 15 | 16 | 17 | 18 | This code is open source, all backend SQL executions will stay up to date 19 | ''' 20 | 21 | from flask import request, session, jsonify, Blueprint 22 | import sqlite3 23 | import json 24 | import os 25 | import time 26 | 27 | SqlExecutionApi = Blueprint('SqlExecutionApi', __name__) 28 | def Ipfilter(ip): 29 | if ":" in ip: 30 | if json.load(open("config.json"))["ipfilter"]: 31 | return ip in json.load(open("ipRange.json")) 32 | else: 33 | return True 34 | else: 35 | if json.load(open("config.json"))["ipfilter"]: 36 | return '.'.join([str(elem) for elem in ip.split(".")[:-1]]) in json.load(open("ipRange.json")) 37 | else: 38 | return True 39 | 40 | @SqlExecutionApi.route('/api/test/', methods=["POST"]) 41 | def apiConnectionTest(): 42 | 43 | if not Ipfilter(request.remote_addr): 44 | return jsonify({"ReturnCode": 0, "ErrorCode":"You are not roblox"}), 200 45 | 46 | Key = request.form["key"] 47 | Username = request.form["username"] 48 | 49 | conn = sqlite3.connect(f'SqliteStorage/apiKeys.db', timeout=10) 50 | c = conn.cursor() 51 | c.execute(f"SELECT * FROM Keys WHERE _key='{Key}'") 52 | apikey = c.fetchall() 53 | conn.close() 54 | dbfile = "" 55 | if apikey == []: 56 | return jsonify({"ReturnCode": 0, "ErrorCode":"Invalid Api Key"}), 200 57 | else: 58 | path = f"SqliteStorage\\{Username}" 59 | for root, dirs, files in os.walk(path): 60 | for filename in files: 61 | if filename.startswith(apikey[0]) and filename.endswith(".db"): 62 | dbfile = filename 63 | if dbfile == None: 64 | return jsonify({"ReturnCode": 0, "ErrorCode":"Username incorrect"}), 200 65 | return jsonify({"ReturnCode": 1}), 200 66 | 67 | 68 | @SqlExecutionApi.route('/api/payload/post/', methods=["POST"]) 69 | def apiPayloadPost(): 70 | 71 | if not Ipfilter(request.remote_addr): 72 | return jsonify({"ReturnCode": 0, "ErrorCode":"You are not roblox"}), 200 73 | 74 | Key = request.form["key"] 75 | Username = request.form["username"] 76 | Payload = request.form["payload"] 77 | conn = sqlite3.connect(f'SqliteStorage/apiKeys.db', timeout=10) 78 | c = conn.cursor() 79 | c.execute(f"SELECT * FROM Keys WHERE _key='{Key}'") 80 | apikey = c.fetchall() 81 | conn.close() 82 | dbfile = "" 83 | if apikey == []: 84 | return jsonify({"ReturnCode": 0, "ErrorCode":"Invalid Api Key"}), 200 85 | else: 86 | if Key == None or Payload == None: 87 | return jsonify({"ReturnCode": 0, "ErrorCode":"Missing Attributes"}), 200 88 | else: 89 | path = f"SqliteStorage\\{Username}" 90 | for root, dirs, files in os.walk(path): 91 | for filename in files: 92 | if filename.startswith(apikey[0]) and filename.endswith(".db"): 93 | dbfile = filename 94 | if dbfile == None: 95 | return jsonify({"ReturnCode": 0, "ErrorCode":"Username incorrect"}), 200 96 | conn = sqlite3.connect(f'SqliteStorage/{Username}/{dbfile}', timeout=10) 97 | c = conn.cursor() 98 | c.execute("SELECT name FROM sqlite_master WHERE type='table';") 99 | response = c.fetchall() 100 | try: 101 | SplitPayload = Payload.split(";") 102 | for x in SplitPayload: 103 | response = c.execute(x) 104 | conn.commit() 105 | conn.close() 106 | return jsonify({"ReturnCode": 1}), 200 107 | except (sqlite3.OperationalError, sqlite3.Warning) as a: 108 | return jsonify({"ReturnCode": 0, "ErrorCode": str(a)}), 200 109 | 110 | 111 | @SqlExecutionApi.route('/api/payload/get/', methods=["POST"]) 112 | def apiPayloadGet(): 113 | if not Ipfilter(request.remote_addr): 114 | return jsonify({"ReturnCode": 0, "ErrorCode":"You are not roblox"}), 200 115 | 116 | Key = request.form["key"] 117 | Username = request.form["username"] 118 | Payload = request.form["payload"] 119 | 120 | conn = sqlite3.connect(f'SqliteStorage/apiKeys.db', timeout=10) 121 | c = conn.cursor() 122 | c.execute(f"SELECT * FROM Keys WHERE _key='{Key}'") 123 | 124 | apikey = c.fetchall() 125 | conn.close() 126 | 127 | dbfile = "" 128 | 129 | if apikey == []: 130 | return jsonify({"ReturnCode": 0, "ErrorCode":"Invalid Api Key"}), 200 131 | else: 132 | 133 | if Key == None or Payload == None: 134 | return jsonify({"ReturnCode": 0, "ErrorCode":"Missing Attributes"}), 200 135 | else: 136 | path = f"SqliteStorage\\{Username}" 137 | for root, dirs, files in os.walk(path): 138 | for filename in files: 139 | if filename.startswith(apikey[0]) and filename.endswith(".db"): 140 | dbfile = filename 141 | if dbfile == None: 142 | return jsonify({"ReturnCode": 0, "ErrorCode":"Username incorrect"}), 200 143 | 144 | conn = sqlite3.connect(f'SqliteStorage/{Username}/{dbfile}', timeout=10) 145 | c = conn.cursor() 146 | c.execute("SELECT name FROM sqlite_master WHERE type='table';") 147 | response = c.fetchall() 148 | try: 149 | c.execute(Payload) 150 | response = c.fetchall() 151 | 152 | if response == []: 153 | response = None 154 | 155 | return jsonify({"ReturnCode": 1, "Response":response}), 200 156 | except sqlite3.OperationalError as a: 157 | return jsonify({"ReturnCode": 0, "ErrorCode": str(a)}), 200 158 | -------------------------------------------------------------------------------- /server/static/Data0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NotReeceHarris/DataStore3/c44b4014ddb29d34903370afae2af94e94909e4f/server/static/Data0.png -------------------------------------------------------------------------------- /server/static/Data1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NotReeceHarris/DataStore3/c44b4014ddb29d34903370afae2af94e94909e4f/server/static/Data1.png -------------------------------------------------------------------------------- /server/static/Data2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NotReeceHarris/DataStore3/c44b4014ddb29d34903370afae2af94e94909e4f/server/static/Data2.png -------------------------------------------------------------------------------- /server/static/Data3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NotReeceHarris/DataStore3/c44b4014ddb29d34903370afae2af94e94909e4f/server/static/Data3.png -------------------------------------------------------------------------------- /server/static/Data4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NotReeceHarris/DataStore3/c44b4014ddb29d34903370afae2af94e94909e4f/server/static/Data4.png -------------------------------------------------------------------------------- /server/static/DataStoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NotReeceHarris/DataStore3/c44b4014ddb29d34903370afae2af94e94909e4f/server/static/DataStoreLogo.png -------------------------------------------------------------------------------- /server/static/css/dashboard.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: .875rem; 3 | } 4 | 5 | .feather { 6 | width: 16px; 7 | height: 16px; 8 | vertical-align: text-bottom; 9 | } 10 | 11 | /* 12 | * Sidebar 13 | */ 14 | 15 | .sidebar { 16 | position: fixed; 17 | top: 0; 18 | /* rtl:raw: 19 | right: 0; 20 | */ 21 | bottom: 0; 22 | /* rtl:remove */ 23 | left: 0; 24 | z-index: 100; /* Behind the navbar */ 25 | padding: 48px 0 0; /* Height of navbar */ 26 | box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1); 27 | } 28 | 29 | @media (max-width: 767.98px) { 30 | .sidebar { 31 | top: 5rem; 32 | } 33 | } 34 | 35 | .sidebar-sticky { 36 | position: relative; 37 | top: 0; 38 | height: calc(100vh - 48px); 39 | padding-top: .5rem; 40 | overflow-x: hidden; 41 | overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */ 42 | } 43 | 44 | .sidebar .nav-link { 45 | font-weight: 500; 46 | color: #333; 47 | } 48 | 49 | .sidebar .nav-link .feather { 50 | margin-right: 4px; 51 | color: #727272; 52 | } 53 | 54 | .sidebar .nav-link.active { 55 | color: #2470dc; 56 | } 57 | 58 | .sidebar .nav-link:hover .feather, 59 | .sidebar .nav-link.active .feather { 60 | color: inherit; 61 | } 62 | 63 | .sidebar-heading { 64 | font-size: .75rem; 65 | text-transform: uppercase; 66 | } 67 | 68 | /* 69 | * Navbar 70 | */ 71 | 72 | .navbar-brand { 73 | padding-top: .75rem; 74 | padding-bottom: .75rem; 75 | font-size: 1rem; 76 | background-color: rgba(0, 0, 0, .25); 77 | box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25); 78 | } 79 | 80 | .navbar .navbar-toggler { 81 | top: .25rem; 82 | right: 1rem; 83 | } 84 | 85 | .navbar .form-control { 86 | padding: .75rem 1rem; 87 | border-width: 0; 88 | border-radius: 0; 89 | } 90 | 91 | .form-control-dark { 92 | color: #fff; 93 | background-color: rgba(255, 255, 255, .1); 94 | border-color: rgba(255, 255, 255, .1); 95 | } 96 | 97 | .form-control-dark:focus { 98 | border-color: transparent; 99 | box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); 100 | } 101 | -------------------------------------------------------------------------------- /server/static/js/script.js: -------------------------------------------------------------------------------- 1 | var x = 'Create by Reece Harris (https://github.com/NotReeceHarris) & Deven Briers (https://github.com/NotDevenBriers)\nThis service is a SQL datastore for roblox, allowing multiple users to create multiple databases.\n- Apache2 License.\nhttps://github.com/NotReeceHarris/DataStore3'; 2 | 3 | console.log(x) -------------------------------------------------------------------------------- /server/templates/apikey.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Dashboard - ApiKeys 24 | 25 | 26 | 27 | 28 | 29 | 43 | 44 | 45 | 46 | 47 | 61 |
62 |
63 | 120 |
121 |
122 |

My Api Keys 123 |

124 |
125 |
126 |
127 |
128 |
129 | {% with messages = get_flashed_messages() %}{% if messages %}{% for message in messages %} 130 | 132 | {% endfor %}{% endif %}{% endwith %}{% block body %}{% endblock %} 133 |
134 | 135 | 136 | 137 | 139 | 141 | 143 | 145 | 147 | 149 | 150 | 151 | 152 | {% for x in databases["databases"]%} 153 | 154 | 156 | 158 | 160 | 162 | 168 | 174 | 175 | 176 | 253 | 254 | {% endfor %} 255 | 256 |
# 138 | Database ID 140 | DataBase Name 142 | Active Keys 144 | GenKey 146 | SeeKeys 148 |
{{loop.index}} 155 | {{x["id"]}} 157 | {{x["name"]}} 159 | {{x["keys"]}} 161 | 163 | 164 | 165 | 166 | 167 | 169 | 170 | 171 | 172 | 173 |
257 |
258 |
259 |
260 |
261 | 263 | 265 | 267 | 269 | 271 | 272 | 273 | -------------------------------------------------------------------------------- /server/templates/databases.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Dashboard - DataBases 24 | 25 | 26 | 27 | 28 | 29 | 43 | 44 | 45 | 46 | 47 | 61 |
62 |
63 | 120 |
121 |
122 |

My DataBases 123 |

124 |
125 |
126 | 129 | 130 | 153 | 156 | 157 | 181 |
182 |
183 |
184 | {% with messages = get_flashed_messages() %}{% if messages %}{% for message in messages %} 185 | 187 | {% endfor %}{% endif %}{% endwith %}{% block body %}{% endblock %} 188 |
189 | 190 | 191 | 192 | 194 | 196 | 198 | 200 | 202 | 204 | 206 | 207 | 208 | 209 | {% for x in databases["databases"]%} 210 | 211 | 213 | 215 | 217 | 219 | 221 | 227 | 233 | 234 | 235 | 266 | 267 | 310 | 311 | 345 | {% endfor %} 346 | 347 |
# 193 | Database ID 195 | Name 197 | Tables 199 | Size 201 | Config 203 | Export 205 |
{{loop.index}} 212 | {{x["id"]}} 214 | {{x["name"]}} 216 | {{x["tablelen"]}} 218 | {{x["size"]}} MB 220 | 222 | 223 | 224 | 225 | 226 | 228 | 229 | 230 | 231 | 232 |
348 |
349 |
350 |
351 |
352 | 354 | 356 | 358 | 360 | 362 | 365 | 366 | 367 | -------------------------------------------------------------------------------- /server/templates/index.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Dashboard - Home 24 | 25 | 26 | 27 | 28 | 29 | 30 | 44 | 45 | 46 | 47 | 48 | 62 |
63 |
64 | 121 |
122 |
123 |

Dashboard 124 |

125 |
126 | 127 | 128 | 129 | 130 |
131 |
132 |
133 | 134 | {% for x in databases["databases"] %} 135 |
136 |
137 |
138 | {% if x["size"] >= 0.15 %} 139 |
thumbnail
140 | {% elif x["size"] >= 0.10 %} 141 |
thumbnail
142 | {% elif x["size"] >= 0.05 %} 143 |
thumbnail
144 | {% elif x["size"] >= 0.01 %} 145 |
thumbnail
146 | {% else %} 147 |
thumbnail
148 | {% endif %} 149 |
150 |
151 |

{{x["name"]}}

152 |

153 | 154 | 155 |

156 |
157 |
158 |
159 | 160 | 173 | {% endfor %} 174 | 175 | 176 |
177 |
178 |
179 | 180 | 181 | 182 | 183 |
184 |
185 |
186 | 188 | 190 | 192 | 194 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /server/templates/integrations.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Dashboard - Intergration 23 | 24 | 25 | 26 | 27 | 28 | 29 | 43 | 44 | 45 | 46 | 47 | 61 |
62 |
63 | 120 |
121 |
122 |

Integration 123 |

124 |
125 |

126 |

127 |
128 |
129 |
130 | 132 | 134 | 136 | 138 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /server/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Login 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |
23 | 24 | 25 |
Ask a system admin to create you an account.
26 |
27 |
28 | 29 | 30 |
31 | 32 | {% with messages = get_flashed_messages() %}{% if messages %}{% for message in messages %} 33 | 34 | {% endfor %}{% endif %}{% endwith %}{% block body %}{% endblock %} 35 |
36 |
37 | 38 | 39 | 40 | 41 | --------------------------------------------------------------------------------