68k-news icon indicating copy to clipboard operation
68k-news copied to clipboard

Added cache database and User-Agent HTTP header

Open asivery opened this issue 3 years ago • 2 comments

This should improve the page loading speed and prevent rate limiting on the news servers. I also encountered 403 Forbidden errors caused by the missing User-Agent HTTP header - this should fix them. The database functionality can be turned off using the USE_CACHE define in article.php. If the database ever becomes corrupted, it will be deleted and recreated. If that fails, the script will just ignore it and load the page without caching it. The cached articles will automatically get deleted after a period of 24 hours.

asivery avatar Apr 12 '21 14:04 asivery

Thanks for this! What would I need to do server-side to get this code going?

ActionRetro avatar Apr 12 '21 20:04 ActionRetro

You only need to install the sqlite3 extension for php. For me (Ubuntu 20.04) I had to install php7.4-sqlite3. Other than that, the database should create itself automatically (The program should have write permissions to the database file defined in cache_database.php). You might need to also prevent users from accessing cache_database.php and the database itself.

asivery avatar Apr 12 '21 22:04 asivery