Commit Graph

40 Commits

Author SHA1 Message Date
14fbe89f8c Update initial news post update
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-13 19:28:06 -07:00
c66906b78f Add docker-compose.yml, Dockerfile, and requirements.txt
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-13 19:06:45 -07:00
9548ad6e2a Update poetry.lock
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-13 18:32:10 -07:00
08e180dd65 Tweaking HTML some more
* Add some margin space around the prev/next links
* Increase prev/next link font size
* Add prev/next text without link when we're on the first/last page
* Add useful placeholder text to the "board" search

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-13 18:23:22 -07:00
4439e14b6b Add "pagination"
Items per page are just handled by hard offset instead of pages. That's
all we really need

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-06 00:17:45 -07:00
3f5bb7959a Add cache, thumbs, and *.db to .gitignore
bans.db is removed

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-02 20:43:05 -07:00
34429238e3 http: move CSS to its own static file
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-02 20:33:17 -07:00
d79899ea87 http: Add static file support
Static files are configured using a handful of config values. Static
files can be handled remotely or locally for prod or dev environments,
respectively.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-02 20:16:47 -07:00
d3e3d99b12 http: Remove reassuring message from news.html - we are NOT happy to have you here
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-02 18:48:34 -07:00
af3e14a7aa Add DB_SQLITE3_PATH config option
Rather than being hardcoded

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-02 18:40:45 -07:00
af3a8b9a1e http: Reformat
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-02 18:38:26 -07:00
f0cc2dd1bd http: Add the HTTP_ROOT config option and a function that uses it
HTTP_ROOT is the server's root directory to serve from, in case your
domain uses something else.

This is also added to the HTML templates.

Also added a news.html template for any sitewide news.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-02 18:31:36 -07:00
d3f6e6f69e http: Add chanbans.config, python-dotenv dependency
* chanbans.config handles all configuration now
* python-dotenv dependency is added for basic environment-level
  configuration

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-02 17:49:07 -07:00
b6d8346fef http: Update table colors in the templates to look more like 4chan
Also added a couple more small messages.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-08-02 17:45:14 -07:00
c5e7080663 http: Add base HTTP server implementation.
* Add HTTP server base implementation with some basic pages
* Add Jinja2 dependency
* Things are mostly working, except for static resources. Those will
  have to come next.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-31 18:04:53 -07:00
5f34b353bb Add search_db function
This takes a number of arguments that can help narrow down a search
query. It's not safe against % injection so be careful :^)

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-31 00:12:01 -07:00
cf4fd799b4 Add op column to database
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-31 00:10:15 -07:00
3db45d63d2 Add filesystem hashtable for saved thumbnails
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-30 22:10:44 -07:00
8213fa8508 Fix md5 dedup check, add debug message when a post is being added to the database
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-29 21:14:34 -07:00
b190d5033d Add log level command line argument
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-29 21:07:59 -07:00
918271926a Add duplicate checks for the "pull" command
This checks the received JSON against following columns:
* now
* time
* md5
* com
* sub
* board
and will add them to the database if they don't exist.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-29 21:02:18 -07:00
e956dc460d Update SQL style in pull.py
SQL keywords are now lowercase, matching the rest of the program.

Previously: INSERT INTO ...
Now: insert into ...

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-29 20:35:18 -07:00
84c886693f Update database row factory to produce a dict of columns
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-25 16:42:24 -07:00
e51dd85d54 Add hashbang, script description, and useful error message to convert_db script
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-25 16:10:09 -07:00
532393c2c7 Add db.commit() call to convert_bans.py script
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-25 16:01:35 -07:00
47bb480b74 Add status message to convert_db.py
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-25 15:56:37 -07:00
7b6be3f2a0 Fix convert_db script
Database conversion was not taking the "trip" field into account. Also,
remove debug message that I accidentally had left in there.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-25 15:50:00 -07:00
e85e3a03a0 Update database format
The old database format would keep the post data in a JSON string.
Now, post data is broken out into individual columns for searching more
easily.

Additionally, a convert script has been provided.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-07-25 15:45:50 -07:00
9353bc3ac9 Move httpx to aiohttp, add logging instead of printing
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-06-21 00:52:59 -07:00
8d79599a1f Add arg parsing and subcommands
* pull - will download thumbnails and update the database
* serve - (in the future) will run an HTTP frontend server to display
  the pulled data

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-06-21 00:07:38 -07:00
54a0488e3c Split up logic into common files
All functions were previously in __main__.py but now they've been split
out to separate modules for better reuse.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-06-20 23:22:56 -07:00
99624c17a5 Add pylint and bs4-types
* pylint for helping to clean up simple issues
* bs4-types for beautifulsoup4 mypy types

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-06-20 23:21:58 -07:00
ac8812fc30 Update required python version 3.10 -> 3.9
This is how it was in the Pipenv file, and I messed that up

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-06-20 21:37:06 -07:00
f7aed83fe6 Add AGPL v3.0 license text
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-06-20 21:25:53 -07:00
70416f0751 Move from pipenv -> poetry
I like poetry's tooling better than pipenv. Simple as

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-06-20 21:22:13 -07:00
8027c67bf2 Remove file that accidentally got created and added to the repo
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-02-20 11:22:15 -08:00
02324c78ab Fix minor errors in the new thumbnail stuff was stopping stuff from being inserted
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-02-19 01:09:46 -08:00
26a17f7bbc Add thumbnail downloading
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-02-19 01:03:16 -08:00
478fc187dc Set Python version to 3.9 instead of 3.10
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-02-19 00:24:07 -08:00
803fd6a75b Initial commit
* Bans are logged into the bans.db file
* Cache is created in the bans/ directory

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-02-19 00:21:11 -08:00