- MakeTextSearchable: Urdu letter variants, Urdu full stop, Urdu diacritics, zwj/marks - SearchLikePatterns: phrase or per-word LIKE patterns (escaped), normalised like stored text - poem, similar-poem and comment search use LIKE (Linux SQL Server image has no full-text) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| deploy | ||
| DiwanRazor | ||
| docs | ||
| reader | ||
| RMuseum | ||
| .dockerignore | ||
| .env.example | ||
| .gitattributes | ||
| .gitignore | ||
| DiwanService.sln | ||
| docker-compose.yml | ||
| Dockerfile | ||
| LICENSE | ||
| README.md | ||
| run-local.sh | ||
دیوان · Diwan site
Diwan is a standalone project built on a fork of GanjoorService (GPL-3.0), the software behind ganjoor.net, adapted to serve classical Urdu poetry and prose from diwan-data.
Changes from upstream
- Renamed Ganjoor → Diwan throughout: projects (
DiwanRazor,DiwanService.sln), files, folders, classes, settings (Diwan:section), API routes (/api/diwan/...) and database tables (Diwan*). Real external addresses (ganjoor.net, github.com/ganjoor) are unchanged. Because table names changed, Diwan needs a fresh database; it can't reuse a Ganjoor one. - Removed Ganjoor/Persian-specific features: music (Spotify, Golha, Beeptunes, music index, song suggestions; DB models kept for a future Urdu version), Ganjoor's visit analytics, Turkish/Kurdish page options, abjad, Persian dictionary links. Random verse now picks from Diwan's own data.
- Tajik removed: the TajikGanjoor site, Tajik API endpoints, services, export and transliteration are gone. Migration
DiwanRemoveTajikdrops their tables. - Branding: "گنجور" becomes "دیوان" throughout the site. Upstream is credited in the footer.
- Urdu basics: pages are
lang="ur-PK". The home page, footer and century groups (Hijri centuries, e.g. "تیرہویں صدی ہجری") are in Urdu. Deeper pages, such as admin and account pages, are still Persian. - Fonts: Noto Nastaliq Urdu by default, with a نستعلیق / نسخ switch (Noto Naskh Arabic) at the bottom left. The choice is remembered per browser.
- Footer: links to Diwan-only services (Hafez divination, music index, etc.) are removed. Links to the Wikisource source, the data and the code are added.
- Linux/Docker:
Dockerfile+docker-compose.yml(SQL Server 2022, API, site, Caddy for HTTPS). - Config fixes so env vars work: the four places that read
appsettings.jsondirectly now also read environment variables. The JWT issuer followsRSecurityBackend:ApplicationNameinstead of the hard-coded "Diwan".deploy/entrypoint.shcopies the settings that RSecurityBackend reads only fromappsettings.json(connection string, secret, app name, admin email) into the file at container start. - Links:
ganjoor.netlinks to the site's own pages are now relative. Links to Diwan's other services (blog, audio, etc.) are left as they are. - Locale:
ur-PK. - Search without full-text: the SQL Server Linux image has no full-text search, so poem, similar-poem and comment search use
LIKEpatterns (LanguageUtils.SearchLikePatterns). The normaliser handles Urdu letter variants (Arabic ي/ك/ه → ی/ک/ہ, ۂ/ۓ), the Urdu full stop and Urdu diacritics. After changing normalisation rules, rebuild stored search text withPOST /api/diwan/regenplaintext/0(admin).
Static reader (no server)
reader/index.html is a single-file reader: poets, intros, books and poems, with Nastaliq/Naskh switching. It reads the diwan-data static API directly in the browser, so it needs no API, database or build step.
# against the public CDN: just open reader/index.html in a browser, or host it anywhere (e.g. GitHub Pages)
# against a local diwan-data checkout:
mkdir -p www && ln -s "$PWD/reader/index.html" www/ && ln -s /path/to/diwan-data www/data
python3 -m http.server 5300 -d www # open http://localhost:5300/?data=data/
Deploy (Ubuntu/Debian x86-64, e.g. Vultr)
# 1. Docker
curl -fsSL https://get.docker.com | sh
# 2. Code + config
git clone https://github.com/anas-rashid/diwan.git && cd diwan
cp .env.example .env && nano .env # domains, passwords, admin email
# 3. DNS: point SITE_DOMAIN and API_DOMAIN (A records) at the server, then:
docker compose up -d --build # first build takes a few minutes
docker compose logs -f api # wait for "Application started"
SQL Server needs about 2 GB of RAM. Use a plan with at least 4 GB in total.
Load the data
- Open
https://SITE_DOMAIN/loginand sign in withADMIN_EMAILand the passwordTest!123. The first login creates the admin account with that fixed password (RSecurityBackend's default; upstream's guide is wrong about this). Change it right away in the user panel. - On the import page that opens (or Admin → مالی و سایت → درونریزی دادهٔ عمومی), choose Internet URL and enter:
https://cdn.jsdelivr.net/gh/anas-rashid/diwan-data@main/ - The import runs in the background (about 11k poems). Century groups are rebuilt automatically when it finishes.
Re-running the import adds new poems and leaves existing ones untouched, so it can be repeated after diwan-data's daily sync.
Update
git pull && docker compose up -d --build
Run locally (macOS/Linux)
./run-local.sh import # SQL Server container + API + site, then imports diwan-data (~1 h, background)
./run-local.sh # later runs: rebuild + start
./run-local.sh stop
Site: http://localhost:5200 · API: http://localhost:5100/swagger · admin admin@diwan.local / Test!123. On Apple Silicon, start Docker via colima start --vm-type vz --vz-rosetta --memory 6 first (SQL Server is x86-64 only).
Build locally (macOS/Linux)
cd RMuseum # its global.json pins SDK 10.0.302; newer SDKs fail on some upstream Razor views
dotnet build RMuseum.csproj -p:EnableWindowsTargeting=true
dotnet build ../DiwanRazor/DiwanRazor.csproj -p:EnableWindowsTargeting=true
Running it needs SQL Server, so use the Docker setup above. SQL Server's image is x86-64 only.
License
GPL-3.0, same as upstream (see LICENSE). Data: see diwan-data.