Skip to content

Commit

Permalink
Local-first server approach
Browse files Browse the repository at this point in the history
  • Loading branch information
cassiancc committed Jan 24, 2025
1 parent d5fd379 commit 018789c
Show file tree
Hide file tree
Showing 8 changed files with 2,111 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
src/game/cache
__pycache__/
.vscode
*.zim

# Logs
logs
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ Overall, take a look through `package.json` and see if any of the scripts there

---


### Local-first Mode

Due to networking issues at TechOlympics 2024, a focus of the 2025 rework was offline functionality. It's still in its early stages, but the server will now first attempt to connect to a Wikipedia instance running locally on port 3000 before falling back to Wikipedia. Added to the existing cache system, the priority now works as follows:

1. Use a cached page when possible.
2. Use a local page when possible
3. Use a Wikipedia page when possible.
4. Show an error.

To use this offline functionality, run `cd local`, `npm install`, and finally `node server`. Note that you'll need a [dump of Wikipedia](https://library.kiwix.org/#lang=eng&category=wikipedia) downloaded to the `local` folder as `wiki.zim`.

Known issues (Local Server)
- Redirects will fail.
- Design issues.

### About Wiki Races:

Wiki Races is a competition where players start on
Expand Down Expand Up @@ -125,14 +141,14 @@ You will need to do that yourself if you are setitng this up.
- encode urls properly
- Reorder directory structure so pages are not jumbled together.
- set up nojs and IE support
- 2024 redesign

---

<details>
<summary>Completed tasks</summary>

## Completed:
- 2024 redesign
- set up Docker
- Cache all loaded files -> Store as JSON or as Files?
- Get Wikipedia content and parse it
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ services:
- MONGODB_URL="mongodb://mongodb:27017/"
stdin_open: true # TODO: should these be enabled for production
tty: true
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- "./src/game/game_static:/wiki-races/src/game/game_static:ro" # game static is read only
- "./src/game/cache:/wiki-races/src/game/cache" # cache can read and write
Expand Down
Loading

0 comments on commit 018789c

Please sign in to comment.