Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6ad315c
build(deps): bump redis from 5.6.1 to 5.7.0
dependabot[bot] Jul 31, 2025
f8de3af
build(deps): bump redis from 5.6.1 to 5.7.0 (#151)
Jeyso215 Jul 31, 2025
4b6efef
build(deps): bump redis from 5.7.0 to 5.8.0
dependabot[bot] Aug 5, 2025
7118683
build(deps): bump redis from 5.7.0 to 5.8.0 (#152)
Jeyso215 Aug 5, 2025
7e219ad
build(deps): bump redis from 5.8.0 to 5.8.1
dependabot[bot] Aug 13, 2025
91a6bc3
build(deps): bump redis from 5.8.0 to 5.8.1 (#154)
Jeyso215 Aug 13, 2025
75cbc47
docs: [user-agent update] Edge 44.18363.8131, Windows 10/11
Jeyso215 Aug 13, 2025
57b915f
docs: Workflow does not contain permissions fix
Jeyso215 Aug 13, 2025
1f3168a
build(deps): bump redis from 5.8.1 to 5.8.2
dependabot[bot] Aug 20, 2025
7a8d44c
build(deps): bump redis from 5.8.1 to 5.8.2 (#155)
Jeyso215 Aug 20, 2025
1d52ff4
docs: Overly permissive regular expression range fixed https://github…
Jeyso215 Aug 20, 2025
c62a8b7
docs: Server-side URL redirect fix
Jeyso215 Aug 21, 2025
404a461
docs: Incomplete regular expression for hostnames fixed
Jeyso215 Aug 21, 2025
e96c9ee
docs: release 0.1.4
Jeyso215 Aug 21, 2025
f6975b9
docs: release 0.1.4
Jeyso215 Aug 21, 2025
83a87a7
docs: hotfix
Jeyso215 Aug 21, 2025
541b6fc
Update Dockerfile
Jeyso215 Aug 21, 2025
36683fe
Update README.md
Jeyso215 Aug 21, 2025
857ee32
docs: dependabot.yml hotfixes
Jeyso215 Aug 21, 2025
a3d2b7c
build(deps): bump actions/checkout from 4 to 5
dependabot[bot] Aug 21, 2025
84e97d5
build(deps): bump actions/checkout from 4 to 5 (#156)
Jeyso215 Aug 21, 2025
7718502
[fix] image routes
tiekoetter Aug 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 4 additions & 34 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,19 @@
version: 2
updates:
# Schedule for checking updates
schedule:
interval: daily

# CSS dependencies
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
labels:
- "css"
allowed-updates:
- match:
update-type: "all"

# JavaScript dependencies
- package-ecosystem: "npm"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "javascript"
allowed-updates:
- match:
update-type: "all"

# Other dependencies

# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
labels:
- "other"
allowed-updates:
- match:
update-type: "all"

# Docker dependencies
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
labels:
- "docker"
allowed-updates:
- match:
update-type: "all"
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI

permissions:
contents: read
pull-requests: write

on:
push:
branches: [ main ]
Expand All @@ -16,7 +19,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v4
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#https://hub.docker.com/_/node/
#https://github.com/GoogleContainerTools/distroless/blob/main/README.md
FROM node:24.4-alpine3.21 AS build
FROM node:24.6-alpine3.21 AS build
WORKDIR /wikiless
COPY . /wikiless
RUN npm install --omit=optional
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

**Wikiless** is a free, open-source alternative Wikipedia front-end focused on privacy. The project aims to provide users with a more private and anonymous browsing experience by minimizing data collection and tracking.

## Key Features
### Features
- **Privacy-Focused:** Designed to enhance user privacy by limiting data tracking.
- **Open Source:** Available for anyone to contribute and improve.
- **Alternative Front-End:** Provides a different interface to access Wikipedia content.
- **Censorship-Resistant:** Provides another way to access Wikipedia in multiple blocked countries.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ We release patches for security vulnerabilities in the following versions:

| Version | Supported |
| ------- | ------------------ |
| 0.1.3 | :white_check_mark: |
| 0.1.4 | :white_check_mark: |

## Reporting a Vulnerability

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: "3.9"

services:
wikiless:
build:
Expand Down
104 changes: 52 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"express": "^5.1.0",
"got": "^14.4.7",
"node-html-parser": "^7.0.1",
"redis": "^5.6.1"
"redis": "^5.8.2"
},
"devDependencies": {
"jest": "^30.0.5",
Expand Down
34 changes: 29 additions & 5 deletions src/routes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = (app, utils) => {
const config = require('../wikiless.config')
const path = require('path')
const crypto = require('crypto');

app.all(/.*/, (req, res, next) => {
let themeOverride = req.query.theme
Expand Down Expand Up @@ -84,11 +85,20 @@ module.exports = (app, utils) => {
return next()
})

function md5HashParts(fileName) {
const normalized = fileName.replace(/ /g, '_');
const h = crypto.createHash('md5').update(normalized, 'utf8').digest('hex');
return [h[0], h.slice(0,2)];
}


app.get('/wiki/:page/:sub_page', (req, res, next) => {
const pageName = req.params.page;
if (pageName && pageName.startsWith('File:')) {
const encodedFileName = encodeURIComponent(pageName.split(':')[1])
const mediaPath = `/media/wikipedia/commons/thumb/${encodedFileName}`
const rawName = pageName.split(':')[1];
const encodedFileName = encodeURIComponent(rawName);
const [h1, h2] = md5HashParts(rawName);
const mediaPath = `/media/wikipedia/commons/${h1}/${h2}/${encodedFileName}`;
return res.redirect(mediaPath)
}
return handleWikiPage(req, res, '/wiki/')
Expand All @@ -97,8 +107,10 @@ module.exports = (app, utils) => {
app.get('/wiki/:page', (req, res, next) => {
const pageName = req.params.page;
if (pageName && pageName.startsWith('File:')) {
const encodedFileName = encodeURIComponent(pageName.split(':')[1])
const mediaPath = `/media/wikipedia/commons/thumb/${encodedFileName}`
const rawName = pageName.split(':')[1];
const encodedFileName = encodeURIComponent(rawName);
const [h1, h2] = md5HashParts(rawName);
const mediaPath = `/media/wikipedia/commons/${h1}/${h2}/${encodedFileName}`;
return res.redirect(mediaPath)
}
return handleWikiPage(req, res, '/wiki/')
Expand Down Expand Up @@ -158,6 +170,18 @@ module.exports = (app, utils) => {
return res.send(preferencesPage(req, res))
})

// Helper to validate safe redirect paths
function isSafeRedirectPath(path) {
// Must start with a single slash, not double slash, not contain backslash, not contain protocol
return (
typeof path === 'string' &&
path.startsWith('/') &&
!path.startsWith('//') &&
!path.includes('\\') &&
!/^\/(http|https):/.test(path)
);
}

app.post('/preferences', (req, res, next) => {
const theme = req.body.theme
const default_lang = req.body.default_lang
Expand All @@ -166,7 +190,7 @@ module.exports = (app, utils) => {
res.cookie('theme', theme, { maxAge: 365 * 24 * 60 * 60 * 1000, httpOnly: true })
res.cookie('default_lang', default_lang, { maxAge: 365 * 24 * 60 * 60 * 1000, httpOnly: true })

if(back === 'undefined' || !back.startsWith('/')) {
if (!isSafeRedirectPath(back)) {
back = '/'
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ module.exports = function(redis) {
data.html = data.html.replace(wikimedia_regex, '/media')

// replace wiki links
const wiki_href_regx = /(href=\"(https:|http:|)\/\/([A-z.-]+\.)?(wikipedia.org|wikimedia.org|wikidata.org|mediawiki.org))/gm
const wiki_href_regx = /(href=\"(https:|http:|)\/\/([A-Za-z.-]+\.)?(wikipedia\.org|wikimedia\.org|wikidata\.org|mediawiki\.org))/gm
data.html = data.html.replace(wiki_href_regx, 'href="')

try {
Expand Down
2 changes: 1 addition & 1 deletion static/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ <h1>About</h1>
<hr>
<a href="/" rel="noreferrer" target="_blank">Go Back</a>
<h4>Wikiless version</h4>
<p>0.1.3</p>
<p>0.1.4</p>
</body>
</html>
Loading