What is Wikisource Reader?
Wikisource Reader app is a free and open-source mobile application built for Android users to read public domain and copyright free pre-published contents in various languages of the world, which are hosted in the open and free digital library website of Wikisource. The digitized contents on Wikisource are transcribed and proofread by a vibrant community to make them freely and openly accessible and searchable for everyone to read. Wikisource Reader App is a step further to make these contents available for Android mobile users.
How to use the docs
The docs are organized into 2 sections:
Wikisource Reader App
Which is an Android Application built in Kotlin.
Explore Wikisource Reader AppWSIndex
Wikisource catalog API for proofread and validated books. Loosely based on https://github.com/garethbjohnson/gutendex
This is a simple API which gets data from Wikidata following the Books Data Model for Wikisource works.
Built With:
The following core technologies were used to build this application:
Python
Python 3.10 or above — the primary programming language.
Django
Django 5.1.3 — the high-level Python web framework.
Getting Started Locally:
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites:
You will need to ensure your system meets the following requirements:
Hardware Requirements
- RAM: 4GB or higher
- Storage: 20GB or more of free space
Supported Operating Systems
- Windows: 10+
- Linux: Kernel 3.8+
- macOS: X 10.7+
Software Environment
- Python: version 3.10 or above
- Environment: A tool to manage your Python environment, such as virtualenv or venv.
Running project Locally:
To run WSIndex locally, fork the WSIndex repository to your GitLab account, then follow these steps:
-
After forking the WSIndex repository to your GitLab account, open your fork on GitLab and copy its SSH clone URL.
Replace
YOUR_FORK_CLONE_URLin the command below with the SSH URL you copied.git clone YOUR_FORK_CLONE_URLcd wsindex -
Initialize and Activate Virtual Environment
# Initialize virtual environment virtualenv venv # Activate on Linux/macOS source venv/bin/activate # Activate on Windows .\venv\Scripts\activate -
Install Dependencies
pip install -r requirements.txt -
Replace the database settings in wsindex/settings.py with the following for a lightweight SQLite database:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } -
Apply Database Migrations
python manage.py migrate -
Import Books from Wikidata
python manage.py updatecatalog -
Run Local Server
python manage.py runserver -
Navigate to the following address to view imported books.
http://127.0.0.1:8000/books/ -
In case of a 404 or Not Found error, add 127.0.0.1:8000 to allowed hosts in wsindex/settings.py.
Wikisource Reader App
This is the mobile client for the Wikisource Reader, providing an optimized interface for reading validated public domain texts. It consumes data from the WSIndex API to display curated collections.
The app is built using modern Android standards with a focus on offline accessibility and ePUB rendering.
Source Code
Source Code: https://github.com/cis-india/Wikisource-Reader
Google Play Store
Available on: Google Play Store
Built With:
The following core technologies and frameworks were used to build the mobile application:
Kotlin
Kotlin 2.0.21 — the primary programming language for modern Android development.
Jetpack Compose
Jetpack Compose — the modern toolkit for building UI.
Room Database
Room Database — for local storage of book metadata and reading progress.
Readium
Readium — the engine used for ePUB parsing and rendering.
Getting Started Locally:
Follow these instructions to set up the development environment and run the application on an emulator or physical device.
Prerequisites:
You will need to ensure your development environment meets the following requirements:
Hardware Requirements
- RAM: 8GB or higher (16GB recommended for Android Studio)
- Storage: 10GB or more of free space for SDKs and build tools
Software Environment
- Android Studio: Ladybug (2024.2.1) or above
- JDK: Java Development Kit (JDK) 17
- Android SDK: API Level 34 (Target SDK)
Running project Locally:
To build and run the app locally, follow these steps:
-
Clone the Repository
git clone https://github.com/cis-india/Wikisource-Reader.gitcd Wikisource-Reader -
Open in Android Studio
Launch Android Studio, select File > Open, and navigate to the cloned project directory. Allow Gradle to sync and download necessary dependencies.
-
Run on Device or Emulator
Connect a physical device via USB (with debugging enabled) or start a Virtual Device (AVD). Press Shift + F10 or click the green Run button in the toolbar.
You can also pair your device via Wi-Fi instead of using USB. Once you enable developer mode on your Android phone, you will find options to pair via USB or Wi-Fi.
-
Pointing to Local API (Optional)
If you are running WSIndex locally and want the app to connect to it, update the
baseApiUrlin theapi/BookApito your local IP:// If you are running on an emulator private val baseApiUrl = "http://10.0.2.2:8000/books" // Use the IP address of your host machine (PC) // when running on a physical device. private val baseApiUrl = "http://192.168.100.2:8000/books"
Allowing HTTP Traffic for Local Development:
By default, Android prevents apps from connecting to servers via unencrypted HTTP. To connect the app to your local instance of WSIndex, follow these steps to configure network security:
-
Create the Network Security Directory
In your project explorer, navigate to
app/src/main/res. If anxmlfolder does not exist, right-click res, select New > Directory, and name itxml. -
Create the Config File
Right-click on the
res/xmlfolder and select New > XML Resource File. Name itnetwork_security_config.xmland replace its contents with the following:<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config cleartextTrafficPermitted="true"> <!-- Host IP --> <domain includeSubdomains="true">192.168.100.2</domain> <domain includeSubdomains="true">10.0.2.2</domain> <domain includeSubdomains="true">127.0.0.1</domain> </domain-config> </network-security-config> -
Link the Configuration in the Manifest
Android requires you to register this file in the application manifest to apply the security exceptions.
Open
app/src/main/AndroidManifest.xmland add theandroid:networkSecurityConfigattribute inside the<application>tag:<application android:name=".WikisourceApplication" android:networkSecurityConfig="@xml/network_security_config" ...> <!-- Activities and Services --> </application>