first commit
This commit is contained in:
commit
72b0a766d0
175
.gitignore
vendored
Normal file
175
.gitignore
vendored
Normal file
@ -0,0 +1,175 @@
|
||||
# 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
|
||||
|
||||
# UV
|
||||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
#uv.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/latest/usage/project/#working-with-version-control
|
||||
.pdm.toml
|
||||
.pdm-python
|
||||
.pdm-build/
|
||||
|
||||
# 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/
|
||||
|
||||
# Ruff stuff:
|
||||
.ruff_cache/
|
||||
|
||||
# PyPI configuration file
|
||||
.pypirc
|
||||
coglog.sqlite
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
FROM python:alpine3.21
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt ./
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "app:app"]
|
2
README.md
Normal file
2
README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# Cogsee
|
||||
Cogsee requires a **coglog instance**. If you do not have one, please set one up.
|
18
app.py
Normal file
18
app.py
Normal file
@ -0,0 +1,18 @@
|
||||
from flask import Flask, render_template, request
|
||||
import sqlite3
|
||||
|
||||
db = sqlite3.connect("file:coglog.sqlite?mode=ro", check_same_thread=False, uri=True)
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return render_template("index.html")
|
||||
|
||||
@app.route("/query", methods=["GET", "POST"])
|
||||
def query():
|
||||
cs = db.cursor()
|
||||
try:
|
||||
cs.execute(request.form.get("query"))
|
||||
except sqlite3.OperationalError:
|
||||
return "lol retard got filtered by SQL"
|
||||
return render_template("query.html", result=cs.fetchall(), query=request.form.get("query"))
|
15
compose.yml
Normal file
15
compose.yml
Normal file
@ -0,0 +1,15 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
ports:
|
||||
- "48878:5000"
|
||||
volumes:
|
||||
- ./wastetape.db:/app/wastetape.db
|
||||
- /mnt/storage/wastetape:/app/static
|
||||
- ./tmp:/app/tmp
|
||||
environment:
|
||||
- FLASK_ENV=production
|
||||
restart: always
|
13
license.txt
Normal file
13
license.txt
Normal file
@ -0,0 +1,13 @@
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
BIN
requirements.txt
Normal file
BIN
requirements.txt
Normal file
Binary file not shown.
6
static/bootstrap.css
vendored
Normal file
6
static/bootstrap.css
vendored
Normal file
File diff suppressed because one or more lines are too long
14
templates/components/search.html
Normal file
14
templates/components/search.html
Normal file
@ -0,0 +1,14 @@
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Search
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="/query" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="queryInput" class="form-label">Query</label>
|
||||
<input type="text" class="form-control" id="queryInput" name="query" value="{{query}}">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
29
templates/index.html
Normal file
29
templates/index.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Cogsee</title>
|
||||
<link href="/static/bootstrap.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container pt-4" style="max-width: 700px;">
|
||||
<h2>Cogsee</h2>
|
||||
<p>Coglog database viewer</p>
|
||||
{% include 'components/search.html' %}
|
||||
<hr>
|
||||
<h3>Example queries:</h3>
|
||||
<ul>
|
||||
<li><code>SELECT * FROM messages WHERE uid = 420;</code> -- Select messasges where the user ID is 420</li>
|
||||
<li><code>SELECT * FROM messages WHERE id = 420;</code> -- Select messasges where the database index is 420</li>
|
||||
<li><code>SELECT * FROM messages WHERE gid = 420;</code> -- Select messasges where the guild ID is 420</li>
|
||||
<li><code>SELECT * FROM messages WHERE cid = 420;</code> -- Select messasges where the channel ID is 420</li>
|
||||
<li><code>SELECT * FROM messages WHERE content = "xyz";</code> -- Select messasges where the content is XYZ</li>
|
||||
<li><code>SELECT * FROM messages WHERE content = "xyz";</code> -- Select messasges where the content is XYZ</li>
|
||||
<li><code>SELECT * FROM messages WHERE content LIKE 'l%';</code> -- Select messasges where the content starts with l</li>
|
||||
<li><code>SELECT * FROM messages WHERE content LIKE '%lol%';</code> -- Select messasges where the content contains lol</li>
|
||||
</ul>
|
||||
<p>(The database is opened in read-only mode so you can't write/delete stuff)</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
21
templates/query.html
Normal file
21
templates/query.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Cogsee</title>
|
||||
<link href="/static/bootstrap.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container pt-4" style="max-width: 700px;">
|
||||
<h2>Cogsee</h2>
|
||||
<p>Coglog database viewer</p>
|
||||
{% include 'components/search.html' %}
|
||||
<hr>
|
||||
{% for message in result %}
|
||||
<span class="badge text-bg-secondary">{{ message[6] }} ({{ message[1] }})</span> {{ message[5] }}<br>
|
||||
<span style="font-size: 8px; margin:0; display: inline-block; vertical-align: top;">(written in {{ message[3] }} / {{ message[4] }}; message id {{ message[2] }} / {{ message[0] }})</span><br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user