Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
e99719a
feat(homepage): show installed services from a server-side services.json
ramazansancar Nov 28, 2026
f0f2492
feat(docker): add a multi-arch image with the homepage and Kiwix
ramazansancar Nov 28, 2026
608b68e
feat(admin): add the Go admin panel with first-run setup, login and d…
ramazansancar Nov 28, 2026
c1285e5
refactor(scripts): download content with curl instead of wget
ramazansancar Nov 28, 2026
fee24eb
fix(admin): keep curl progress on one line and drop wget from the image
ramazansancar Nov 28, 2026
5675af7
fix(admin): accept logins whatever address the box is reached by
ramazansancar Nov 28, 2026
85d9cb7
feat(admin): confirm deletes with the password in an in-page dialog
ramazansancar Nov 28, 2026
3be35a2
feat(admin): keep sessions on the box and end them on password change
ramazansancar Nov 28, 2026
818ac66
fix(homepage): open Kiwix books and search in the Kiwix viewer
ramazansancar Nov 28, 2026
b040140
feat(reader): add the HAS reader, dark theme and all sources in search
ramazansancar Nov 28, 2026
d0f0460
fix(ui): fit the reader bar and admin panel on phone screens
ramazansancar Nov 28, 2026
5b85e05
feat(reader): show the Kiwix library under the HAS bar
ramazansancar Nov 28, 2026
c1aa739
feat(ui): add a system, dark and light theme choice
ramazansancar Nov 28, 2026
a96d61a
ci(docker): test the image on every platform before publishing
ramazansancar Nov 28, 2026
f65b298
ci(docker): run the tests on every branch, publish only from main and…
ramazansancar Nov 28, 2026
9e72659
fix(services): detect the newer IIAB Maps install path
ramazansancar Nov 28, 2026
2c29c67
fix(docker): restart only the admin panel when it stops
ramazansancar Nov 29, 2026
c1b88a3
ci(docker): run the 386 test on ubuntu-24.04 and fix false failures
ramazansancar Nov 29, 2026
5a43eab
test(docker): check reset-password by exit code and message
ramazansancar Nov 29, 2026
099c08f
test(docker): wait for the setup code and stop piping into grep -q
ramazansancar Nov 29, 2026
584b10f
test(docker): cover far more of the image in test.sh
ramazansancar Nov 29, 2026
d4f12aa
ci(docker): name test reports after the platform, OS and Docker version
ramazansancar Nov 29, 2026
a6b2c6a
feat(admin): group content by language and verify selected items
ramazansancar Nov 29, 2026
f20d64e
feat(home): add a Turkish/English choice to the homepage
ramazansancar Nov 29, 2026
c1c817b
fix(docker): write disk.json at start and every six hours
ramazansancar Nov 29, 2026
4022771
feat(reader): list the sources when the Kiwix library cannot draw
ramazansancar Nov 29, 2026
6f9244a
test(e2e): add Playwright browser tests across devices and browser ge…
ramazansancar Nov 29, 2026
8504c92
ci: use version tags instead of commit SHAs for actions
ramazansancar Nov 29, 2026
cecb10e
docs(docker): explain what to do when phones cannot reach the box
ramazansancar Nov 29, 2026
9c669a4
fix(admin): show the item note under its name on phones
ramazansancar Nov 29, 2026
177e81c
refactor(ui): keep all page texts and the theme code in one shared file
ramazansancar Nov 29, 2026
1607b8c
feat(a11y): make the pages usable with screen readers and the keyboard
ramazansancar Nov 29, 2026
c2b7800
style: add EditorConfig and Prettier settings, format the test code
ramazansancar Nov 29, 2026
6c3623b
perf(docker): compress pages and scripts with gzip
ramazansancar Nov 29, 2026
aadee0b
feat(scripts): write the real ZIM sizes from the Kiwix catalog to siz…
ramazansancar Nov 29, 2026
0bda207
test(admin): accept a space after the key in the error code check
ramazansancar Nov 29, 2026
c1142be
feat: show exact ZIM sizes and flag new versions
ramazansancar Nov 29, 2026
e3bfb0e
fix(admin): replace the approximate sizes in the notes with exact ones
ramazansancar Nov 29, 2026
ec538e4
fix(admin): drop the approximate sizes from the content notes
ramazansancar Nov 29, 2026
e1848bc
feat(home): show the map's real size measured on the device
ramazansancar Nov 29, 2026
b62e8bc
feat: show sizes for content that is not installed, also offline
ramazansancar Nov 29, 2026
a4b4e9e
build(docker): refresh sizes at build time and download kiwix-tools n…
ramazansancar Nov 29, 2026
97bb9ed
perf(docker): cache the Kiwix catalog, use every core, cache has.js i…
ramazansancar Nov 29, 2026
0139c03
ci: run the browser tests in the Docker workflow and reuse the image
ramazansancar Nov 29, 2026
7d5b67b
perf(docker): send precompressed pages with gzip_static
ramazansancar Nov 29, 2026
7a58325
docs: add CONTRIBUTING with adding content, services, code style and …
ramazansancar Nov 29, 2026
06ef8b0
style: format the Docker workflow and the Prettier settings with Pret…
ramazansancar Nov 29, 2026
4834773
refactor(home): drop the unused search flag from the content list
ramazansancar Nov 29, 2026
f08a3f9
feat(admin): delete the selection with the password, clear ticks afte…
ramazansancar Nov 29, 2026
4cd2103
feat(admin): ask for your own password on a terminal in reset-password
ramazansancar Nov 29, 2026
54ddc69
perf(web): stop layout shifts while loading, fix the favicon 404, add…
ramazansancar Nov 29, 2026
b6b3972
feat(home): English for the emergency page
ramazansancar Nov 29, 2026
58061da
fix(reader): keep the last source when switching quickly
ramazansancar Nov 29, 2026
cdbeeb9
feat(admin): show download progress on the rows and notices when a jo…
ramazansancar Nov 29, 2026
b3c1821
perf(docker): drop util-linux-misc and cap nginx at 4 workers
ramazansancar Nov 29, 2026
c696e82
ci: build the amd64 image once up front and split the browser tests i…
ramazansancar Nov 29, 2026
a265edf
fix(admin): keep the job notice hidden until a job starts or ends
ramazansancar Nov 29, 2026
861f214
fix(reader): search all sources one language at a time, with a langua…
ramazansancar Nov 29, 2026
8904991
refactor(home): rename the reader page from oku.html to reader.html
ramazansancar Nov 29, 2026
903f36f
fix(reader): do not let a late page load undo a new source choice
ramazansancar Nov 29, 2026
a07eb7d
docs: add bilingual documentation under docs/ (tr-TR, en-US)
ramazansancar Nov 29, 2026
7509269
fix(reader): keep "All sources" and a pending page change from being …
ramazansancar Nov 29, 2026
e6fa245
fix(admin): go back to the login form when the session ends
ramazansancar Nov 29, 2026
3ca5f2f
test: check that what should not happen does not happen
ramazansancar Nov 29, 2026
37bb2f1
chore(config): The term "approximately" has been removed from the con…
ramazansancar Nov 30, 2026
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
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Docker derleme bağlamına girmesin: indirilen içerik (library/) GB'larca olabilir.
# Keep out of the Docker build context: downloaded content (library/) can be many GB.
.git
.github
library
assets
saglik
*.md
*.zip
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Kod biçimi / code style: https://editorconfig.org
# Ayrıntı / details: CONTRIBUTING.md "Kod biçimi / Code style"
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.go]
indent_style = tab

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
*.css text eol=lf
*.js text eol=lf
*.json text eol=lf
*.md text eol=lf
*.md text eol=lf
Dockerfile text eol=lf
*.go text eol=lf
go.mod text eol=lf
369 changes: 369 additions & 0 deletions .github/workflows/docker.yml

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@
__MACOSX/
*.zip
Claude outputs/

# Docker ile indirilen içerik / content downloaded with Docker
library/

# Tarayıcı testleri / browser tests
e2e/node_modules/
e2e/test-results/
e2e/playwright-report/
e2e/.env
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Yalnız JavaScript/JSON/YAML biçimlenir; HTML sayfaları elle düzenlenir (satır içi betik ve stil).
# Only JavaScript/JSON/YAML are formatted; the HTML pages are kept by hand (inline scripts and styles).
*.html
*.md
library/
**/node_modules/
e2e/test-results/
e2e/playwright-report/
**/package-lock.json
# Betikle üretilir / generated by a script (scripts/catalog-sizes.sh)
config/sizes.json
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 120,
"overrides": [{ "files": "e2e/**/*.js", "options": { "singleQuote": true } }]
}
186 changes: 186 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# Katkı / Contributing

- [English](#english): [adding content](#adding-content-zim), [adding a service](#adding-a-service), [code style](#code-style), [tests](#tests)
- [Türkçe](#türkçe): [içerik ekleme](#zim-içerik-ekleme), [servis ekleme](#servis-ekleme), [kod biçimi](#kod-biçimi), [testler](#testler)

## English

Before starting, write "I'm taking this" under the issue so two people do not work on the same thing. Keep pull
requests small and about one topic.

### Adding content (ZIM)

1. **Find the name.** Look the file up in the Kiwix catalog (<https://download.kiwix.org/zim/> or
<https://library.kiwix.org>). The *prefix* is the file name without the date: `wikibooks_tr_all_maxi_2026-09.zim`
→ `wikibooks_tr_all_maxi`. The *folder* is the directory under `download.kiwix.org/zim/` (`wikibooks`, `other`,
`zimit`, `stack_exchange`, ...).
2. **`config/content.conf`:** add one line, `<folder> <prefix> # Turkish note / English note`.
`scripts/download-content.sh` downloads the newest version of every line, on the Pi and in Docker alike. The
note after `#` is shown in the admin panel; the panel groups by the language code in the prefix (`_tr_`, `_en_`,
`_mul_`). A line that starts with `#` is skipped: put large or optional content there.
The default list should only contain content that allows commercial use; NC-licensed content goes in as a
commented-out line.
3. **Homepage, `www/home/index.html`:** add an item to the right category in `CATS`:

```js
{ name:{tr:"Vikikitap", en:"Wikibooks (Turkish)"}, desc:{tr:"Açık ders kitapları.", en:"Open textbooks."},
lang:"TR", size:"~27 MB", zim:"wikibooks_tr_all" },
```

`zim` is matched as a prefix (an installed `wikibooks_tr_all_maxi_2026-09.zim` matches `wikibooks_tr_all`).
`name` and `desc` take `{tr, en}`, or a plain string when the name is the same in both. `size` is only a fallback:
the exact size comes from `sizes.json` (next step), the size of an installed file from the disk.
4. **Sizes, `config/sizes.json`:** regenerate the starter list so a box that has never been online shows the new size:

```sh
SIZES_OUT=config/sizes.json scripts/catalog-sizes.sh # needs internet, fetches the 4.4 MB Kiwix catalog
```

The Docker build does this by itself; online, the box refreshes it at install, after downloads and (in Docker)
every 6 hours. The file is
generated, so Prettier skips it. Regenerate it now and then even without new content: sizes change with every
Kiwix release.
5. **Texts:** labels for buttons and messages live in `www/home/has.js` (`TEXT[section][tr|en]`; a key missing in
another language falls back to Turkish). The panel's error codes must exist in both languages; `go test` checks it.
6. **Check:** build the image, run `docker/test.sh` (see [tests](#tests)), open `/admin` and see the new line in the
content list.

Vital information (first aid, the emergency page) must match its source word for word; give the source in the commit.

### Adding a service

Map, Kolibri and the panel are modules: one file per service in `scripts/services.d/<name>.sh`.
`scripts/services.sh` runs them (at install, on every container start) and writes `services.json`, which the homepage
and the panel read.

```sh
# shellcheck shell=bash disable=SC2034 # sourced by services.sh
label_tr="Harita"; label_en="Map"; url="/maps"
check(){ [ -f /library/www/maps/index.html ]; } # 0 when installed
size(){ du -sbL /library/www/maps | cut -f1; } # optional: bytes on disk when installed
typical=178257920 # optional: approximate bytes when not installed (give the source)
```

`check` and `size` run on every start: keep them fast and offline. On the homepage, a `CATS` item with
`url:"/maps", service:"maps"` turns on when the service is installed; a top menu link uses
`data-service="maps"` (several names: the first installed one wins). Example: `scripts/services.d/maps.sh`.

### Code style

- **All files:** `.editorconfig` (UTF-8, LF, final newline, two-space indent; tabs in Go).
- **Comments and messages:** every comment has a Turkish and an English line; text the user sees exists in both
languages.
- **JavaScript, JSON, YAML:** Prettier 3.10.0 with `.prettierrc.json` (120 columns, single quotes under `e2e/`):
`npx prettier@3.10.0 --check .`
- **HTML pages** (`www/home/`, `admin/web/`) are kept by hand (inline script and style, `.prettierignore`). They must
not load anything from outside (scripts, styles, fonts): there is no internet in a disaster, and `docker/test.sh`
checks it. They must keep working in the oldest browsers the tests cover (Chrome 102, Firefox 99, Safari 15.4).
- **Shell:** bash with `set -euo pipefail` (or `-uo` where the script handles errors itself), clean under
ShellCheck 0.10.0 `--severity=warning`. Under `pipefail` do not write `cmd | grep -q`: grep exiting early kills
the left side with SIGPIPE and the check fails at random; capture the output first. Anything downloaded is pinned
to a version and a SHA-256.
- **Go** (`admin/`): standard library only, `gofmt`, `go vet ./...`, `go test ./...` (the Docker build runs both).
- **Commits:** a short English subject, preferably in the Conventional Commits form (`feat:`, `fix:`, `docs:`,
`perf:`, `ci:`, ...); the body says why, in English and then Turkish. Measured changes carry the numbers.

### Tests

```sh
docker build -f docker/Dockerfile -t has-disk:test .
docker/test.sh has-disk:test # homepage, Kiwix, panel, persistence, security
docker/test.sh has-disk:test --download # also downloads a real ZIM through the panel (~15 MB, internet)
docker/test.sh has-disk:test --platform linux/arm/v7 # another architecture, through QEMU
```

Browser tests: [e2e/README.md](e2e/README.md). On every push `.github/workflows/docker.yml` builds the image for five
architectures, runs `docker/test.sh` on each and the browser tests on seven browser versions.

## Türkçe

İşe başlamadan issue'nun altına "bunu ben alıyorum" yaz, iki kişi aynı işi yapmasın. PR'lar küçük ve tek konulu
olsun.

### ZIM içerik ekleme

1. **Adı bul.** Dosyayı Kiwix kataloğunda bul (<https://download.kiwix.org/zim/> ya da <https://library.kiwix.org>).
*Ön ek*, dosya adının tarihsiz kısmıdır: `wikibooks_tr_all_maxi_2026-09.zim` → `wikibooks_tr_all_maxi`.
*Klasör*, `download.kiwix.org/zim/` altındaki dizindir (`wikibooks`, `other`, `zimit`, `stack_exchange`, ...).
2. **`config/content.conf`:** bir satır ekle: `<klasör> <ön ek> # Türkçe not / English note`.
`scripts/download-content.sh` her satırın en yeni sürümünü indirir; Pi'de de Docker'da da aynı. `#` sonrasındaki
not yönetim panelinde görünür; panel ön ekteki dil koduna göre gruplar (`_tr_`, `_en_`, `_mul_`). `#` ile başlayan
satır atlanır: büyük ya da isteğe bağlı içerik böyle girer.
Varsayılan listede yalnız ticari kullanıma açık lisanslı içerik olsun; NC lisanslı içerik yorum satırı olarak
girer.
3. **Ana sayfa, `www/home/index.html`:** `CATS` içinde doğru kategoriye bir öğe ekle:

```js
{ name:{tr:"Vikikitap", en:"Wikibooks (Turkish)"}, desc:{tr:"Açık ders kitapları.", en:"Open textbooks."},
lang:"TR", size:"~27 MB", zim:"wikibooks_tr_all" },
```

`zim` ön ek olarak eşlenir (kurulu `wikibooks_tr_all_maxi_2026-09.zim`, `wikibooks_tr_all` ile eşleşir).
`name` ve `desc` `{tr, en}` alır; ad iki dilde aynıysa düz metin de olur. `size` yalnız yedektir: kesin boyut
`sizes.json`'dan (sonraki adım), kurulu dosyanın boyutu diskten gelir.
4. **Boyutlar, `config/sizes.json`:** hiç internet görmemiş kutuda da yeni boyut görünsün diye başlangıç listesini
yeniden üret:

```sh
SIZES_OUT=config/sizes.json scripts/catalog-sizes.sh # internet ister, 4,4 MB'lık Kiwix kataloğunu indirir
```

Docker derlemesi bunu kendisi yapar; internet varsa kutu kurulumda, indirmeden sonra ve (Docker'da) 6 saatte
bir tazeler. Dosya betikle
üretildiği için Prettier ona dokunmaz. Yeni içerik olmasa da ara sıra yeniden üret: boyutlar her Kiwix sürümüyle
değişir.
5. **Metinler:** düğme ve mesaj metinleri `www/home/has.js`'de (`TEXT[bölüm][tr|en]`; başka dilde eksik anahtar
Türkçeden gelir). Panelin hata kodları iki dilde de olmalı; `go test` buna bakar.
6. **Dene:** imajı derle, `docker/test.sh`'yi çalıştır ([testler](#testler)), `/admin`'i aç ve yeni satırı içerik
listesinde gör.

Hayati bilgi (ilk yardım, acil sayfası) kaynağıyla birebir olmalı; kaynağı commit'te ver.

### Servis ekleme

Harita, Kolibri ve panel birer modül: her servis için `scripts/services.d/<ad>.sh` dosyası. `scripts/services.sh`
bunları çalıştırır (kurulumda, her konteyner açılışında) ve ana sayfayla panelin okuduğu `services.json`'u yazar.

```sh
# shellcheck shell=bash disable=SC2034 # services.sh içine alınır
label_tr="Harita"; label_en="Map"; url="/maps"
check(){ [ -f /library/www/maps/index.html ]; } # kuruluysa 0
size(){ du -sbL /library/www/maps | cut -f1; } # isteğe bağlı: kuruluysa diskteki bayt
typical=178257920 # isteğe bağlı: kurulu değilken yaklaşık bayt (kaynağını yaz)
```

`check` ve `size` her açılışta çalışır: hızlı ve internetsiz olsun. Ana sayfada `url:"/maps", service:"maps"` olan
`CATS` öğesi servis kurulunca açılır; üst menü bağlantısı `data-service="maps"` kullanır (birden çok ad: ilk kurulu
olan). Örnek: `scripts/services.d/maps.sh`.

### Kod biçimi

- **Tüm dosyalar:** `.editorconfig` (UTF-8, LF, dosya sonu satırı, iki boşluk girinti; Go'da sekme).
- **Yorumlar ve mesajlar:** her yorumun bir Türkçe, bir İngilizce satırı var; kullanıcının gördüğü metin iki dilde.
- **JavaScript, JSON, YAML:** Prettier 3.10.0, `.prettierrc.json` ile (120 sütun, `e2e/` altında tek tırnak):
`npx prettier@3.10.0 --check .`
- **HTML sayfaları** (`www/home/`, `admin/web/`) elle düzenlenir (satır içi betik ve stil, `.prettierignore`).
Dışarıdan hiçbir şey (betik, stil, yazı tipi) yüklememeli: afette internet yok, `docker/test.sh` buna bakar.
Testlerin kapsadığı en eski tarayıcılarda (Chrome 102, Firefox 99, Safari 15.4) çalışmaya devam etmeli.
- **Kabuk:** bash, `set -euo pipefail` (betik hatayı kendisi ele alıyorsa `-uo`), ShellCheck 0.10.0
`--severity=warning` temiz. `pipefail` altında `komut | grep -q` yazma: grep erken çıkınca soldaki komut SIGPIPE
alır, kontrol rastgele düşer; çıktıyı önce değişkene al. İndirilen her şey sürüme ve SHA-256'ya sabit.
- **Go** (`admin/`): yalnız standart kitaplık, `gofmt`, `go vet ./...`, `go test ./...` (Docker derlemesi ikisini de
çalıştırır).
- **Commit:** kısa İngilizce başlık, tercihen Conventional Commits biçiminde (`feat:`, `fix:`, `docs:`, `perf:`,
`ci:`, ...); gövde nedenini önce İngilizce, sonra Türkçe anlatır. Ölçülen değişiklikte sayılar yazılır.

### Testler

```sh
docker build -f docker/Dockerfile -t has-disk:test .
docker/test.sh has-disk:test # ana sayfa, Kiwix, panel, kalıcılık, güvenlik
docker/test.sh has-disk:test --download # panelden gerçek bir ZIM de indirir (~15 MB, internet)
docker/test.sh has-disk:test --platform linux/arm/v7 # başka mimari, QEMU ile
```

Tarayıcı testleri: [e2e/README.md](e2e/README.md). Her push'ta `.github/workflows/docker.yml` imajı beş mimari için
derler, her birinde `docker/test.sh`'yi, yedi tarayıcı sürümünde tarayıcı testlerini çalıştırır.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ config/iiab-overrides.yml Internet-in-a-Box settings
config/content.conf list of content to download
www/home/index.html homepage
www/home/acil.html emergency page (Turkish, sourced from AFAD and EPA)
CONTRIBUTING.md adding content or a service, code style, tests
docs/ detailed guides (Turkish and English): install, admin panel, API, security
```

### Troubleshooting
Expand Down Expand Up @@ -290,6 +292,8 @@ config/iiab-overrides.yml Internet-in-a-Box ayarları
config/content.conf indirilecek içerik listesi
www/home/index.html ana sayfa
www/home/acil.html acil durum sayfası (AFAD ve EPA kaynaklı)
CONTRIBUTING.md içerik/servis ekleme, kod biçimi, testler
docs/ ayrıntılı belgeler (Türkçe ve İngilizce): kurulum, panel, API, güvenlik
```

### Sorun giderme
Expand Down
Loading