diff --git a/build b/build index edc975e..7ee598c 100755 --- a/build +++ b/build @@ -14,7 +14,7 @@ cd "$(dirname "$(realpath "$0")")" COMPONENTS=( backfiller buscribe - buscribe-api + buscribe_api chat_archiver cutter downloader diff --git a/buscribe-web/script.js b/buscribe-web/script.js index 92d3058..54e1922 100644 --- a/buscribe-web/script.js +++ b/buscribe-web/script.js @@ -27,7 +27,7 @@ function query(text, start_time, end_time) { const channel = document.getElementById("channel_select").value; - fetch(`/buscribe-api/${channel}/json?${query_string}`) + fetch(`/buscribe_api/${channel}/json?${query_string}`) .then(response => response.json()) .then(fillResults) diff --git a/buscribe-api/Dockerfile b/buscribe_api/Dockerfile similarity index 73% rename from buscribe-api/Dockerfile rename to buscribe_api/Dockerfile index ecf629f..3716213 100644 --- a/buscribe-api/Dockerfile +++ b/buscribe_api/Dockerfile @@ -12,8 +12,8 @@ RUN pip install /tmp/common && rm -r /tmp/common # Install actual application RUN apk add postgresql-dev postgresql-libs -COPY buscribe-api /tmp/buscribe-api -RUN pip install /tmp/buscribe-api && cp -r /tmp/buscribe-api/templates /templates \ - && rm -r /tmp/buscribe-api +COPY buscribe_api /tmp/buscribe_api +RUN pip install /tmp/buscribe_api && cp -r /tmp/buscribe_api/templates /templates \ + && rm -r /tmp/buscribe_api -ENTRYPOINT ["python3", "-m", "buscribeapi", "--base-dir", "/mnt"] +ENTRYPOINT ["python3", "-m", "buscribeapi"] diff --git a/buscribe-api/buscribeapi/__init__.py b/buscribe_api/buscribeapi/__init__.py similarity index 100% rename from buscribe-api/buscribeapi/__init__.py rename to buscribe_api/buscribeapi/__init__.py diff --git a/buscribe-api/buscribeapi/__main__.py b/buscribe_api/buscribeapi/__main__.py similarity index 100% rename from buscribe-api/buscribeapi/__main__.py rename to buscribe_api/buscribeapi/__main__.py diff --git a/buscribe-api/buscribeapi/buscribeapi.py b/buscribe_api/buscribeapi/buscribeapi.py similarity index 98% rename from buscribe-api/buscribeapi/buscribeapi.py rename to buscribe_api/buscribeapi/buscribeapi.py index f7dc1d6..f2f7ff1 100644 --- a/buscribe-api/buscribeapi/buscribeapi.py +++ b/buscribe_api/buscribeapi/buscribeapi.py @@ -7,8 +7,9 @@ from flask import request, jsonify app = flask.Flask('buscribe') -@app.route('/buscribe-api/json') -def get_json(): +# WARNING: Channel is currently ignored. Multi-channel support will come later. +@app.route('/buscribe_api//json') +def get_json(channel): """Searches the line database for *query*, with optional start_time and end_time boundaries. Search is done using PostgreSQL websearch_to_tsquery() diff --git a/buscribe-api/buscribeapi/main.py b/buscribe_api/buscribeapi/main.py similarity index 97% rename from buscribe-api/buscribeapi/main.py rename to buscribe_api/buscribeapi/main.py index 37b6db6..55b720b 100644 --- a/buscribe-api/buscribeapi/main.py +++ b/buscribe_api/buscribeapi/main.py @@ -59,7 +59,7 @@ def main(database="", host='0.0.0.0', port=8010, bustime_start=None): logging.error("Invalid --bustime-start!") exit(1) - app.db_manager = DBManager(dsn=database) + app.db_manager = DBManager(dsn=database, register_types=False) stopping = gevent.event.Event() diff --git a/buscribe-api/setup.py b/buscribe_api/setup.py similarity index 100% rename from buscribe-api/setup.py rename to buscribe_api/setup.py diff --git a/buscribe-api/templates/busub.jinja b/buscribe_api/templates/busub.jinja similarity index 100% rename from buscribe-api/templates/busub.jinja rename to buscribe_api/templates/busub.jinja diff --git a/buscribe-api/templates/busubs.jinja b/buscribe_api/templates/busubs.jinja similarity index 100% rename from buscribe-api/templates/busubs.jinja rename to buscribe_api/templates/busubs.jinja