This project scrapes and mirrors the GMod Wiki.
It also includes a number of enhancments over the original.
You may use the public site, or even host your own for super fast offline access!
- Custom Darkmode support (Thanks Be1zebub!)
- Alternatively, this mirror plays nicely with DarkReader!
- Self-hosting support with Docker
- Loading and in-browser performance enhancements over the original
- Significant performance improvements for CSS styling
- Reduced the total stylesheet size by 80+%
- Noticeable improvements to "Page-to-page" navigation speed
- Vastly improved navigation performance on Firefox
- Memory usage improvements
- Caches page content in browser cache rather than Javascript memory
- Fast searching
- Both basic and full-site searching are implemented
- Search results are not paginated
- All images are mirrored and optimized
- Image size reduced by > 40% with only a small loss in quality
- Hosted entirely on the cloud
- Very reliable, it should only go down if Cloudflare has a major outage
- Automatic content updates every three days
- All page content is pulled from the live site automatically
?format=json
support~pagelist
support (json format only)
Current limitations:
- No Editing (will not implement)
- No change history (probably won't implement)
- Copy button (on textareas) is temporary nonfunctional
- All images are mirrored into the
.webp
format, which has somewhat limited browser support - The main page script.js is self-hosted and modified (for performance), meaning any useful updates will need to be manually backported
A docker image is provided to support self-hosting use cases.
The image is about 160mb, making it reasonably portable and quick to download ๐
First, be sure you have Docker installed.
Run the wiki in the background:
docker run --name gmodwiki -p 127.0.0.1:4321:4321 --rm -d ghcr.io/cfc-servers/gmodwiki:latest
Then visit http://localhost:4321
in your browser.
Stopping the background container:
docker stop --time 1 gmodwiki
With docker compose
Download the docker-compose.yml
file from this repository and put it somewhere on your machine.
Then, simply docker compose up
(or docker-compose up
for older docker
engines).
You can easily configure the Host and Port when using docker compose.
First, create a .env
file in the same directory as the docker-compose.yml
, in the format of:
GMODWIKI_HOST=127.0.0.1
GMODWIKI_PORT=4321
Then you can change the Host or Port in that file, and then run docker compose up
again.
If you want to expose the wiki instance to the world (not recommended without a reverse proxy like Nginx, and especially not without Cloudflare):
- Set
GMODWIKI_HOST=0.0.0.0
- Forward your chosen port (
4321
by default) in your router/firewall - Visit your public IP in your browser:
http://<your IP>:<your port>
This mirror is made to run on Cloudflare. Deploying is really easy, simply clone the project and run:
npm i;
npm run build;
npm run pages:deploy;
Follow the auth/setup prompts from wrangler
.
Then:
- Visit your Cloudflare dashboard
- Select "Workers and Pages" from the sidebar
- Click on your
gmodwiki
instance - Verify that it deployed correctly and that you can visit the latest
.pages.dev
site listed on the page
If you have your own domain:
- Go to the "Custom Domains" tab and click "Set up a custom domain" to connect your own domain
Now, set up the special ?format=json
redirect rule:
- Click on "Websites" in the sidebar
- Find your website, click on it
- Expand the "Rules" section in the sidebar
- Go to "Redirect rules"
- "Create a new Rule"
- Name it "Json Format" or similar (doesn't matter)
- "Custom filter expression"
- "When incoming requests match...":
- Field: "URI Query String"
- Operator: "equals"
- Value:
format=json
- "Then":
- Type: "Dynamic"
- Expression:
concat("https://<YOUR DOMAIN>/content", http.request.uri.path, ".json")
- Status Code: 301
- Click "Deploy"
- Wait about 30 seconds, and then try visiting:
https://<YOUR DOMAIN>/Player_Animations?format=json
and verify that you're redirected to:https://<YOUR DOMAIN>/content/Player_Animations.json
Development should be fairly simple:
npm i;
npm run build;
npm run astrobuild;
npm run preview;
- The first
npm run build
will take awhile as it scrapes the main website - Once built:
- All downloaded page content will be cached into
./build/cache/
- All downloaded static content will be cached to
./public/
- You can remove either of these directories if you need to re-parse the remote content again
- All downloaded page content will be cached into
- By default,
npm run astrobuild
will build the site for self hosting, not cloud hosting. If you need to test the cloud environment, you can runexport BUILD_ENV=production
before running the build/preview commands