Wikisource Reader Docs

Welcome to Wikisource Reader app documentation!

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 Wikisoruce 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:

  1. WSIndex which is an API built in Django
  2. Wikisource Reader App which is an Android Application Built in Kotlin

WSIndex

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.

Source Code : https://codeberg.org/ph4ni/wsindex

Hosted on toolforge at: https://wsindex.toolforge.org/books/

Built With:

The following core technologies were used to build this application:

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:

Running project Locally:

To run wsindex locally, create a fork of the following repository https://codeberg.org/ph4ni/wsindex to your codeberg account then follow these steps:

  1. Clone the Repository

    Replace YOUR_USERNAME with your actual Codeberg username.

    git clone ssh://git@codeberg.org/YOUR_USERNAME/wsindex.git
    cd wsindex  
  2. Initialize and Activate Virtual Environment

    # Initialize virtual environment:  
    virtualenv venv  
    # For Linux/macOS:  
    source venv/bin/activate  
    # For Windows:  
    .\venv\Scripts\activate  
  3. Install Dependencies
    pip install -r requirements.txt
  4. 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',
        } 
    } 
  5. Apply Database Migrations

    python manage.py migrate
  6. Import Books from Wikidata

    python manage.py updatecatalog
  7. Run Local Server

    python manage.py runserver
  8. Navigate to the following address to view imported books.

    http://127.0.0.1:8000/books/
  9. Incase 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 : https://github.com/cis-india/Wikisource-Reader

Available on: Google Play Store

Built With:

The following core technologies and frameworks were used to build the mobile application:

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:

Running project Locally:

To build and run the app locally, follow these steps:

  1. Clone the Repository

    git clone https://github.com/cis-india/Wikisource-Reader.git
    cd Wikisource-Reader  
  2. 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.

  3. 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 devece via WIFI instead of using USB. Once you enable developer mode on your android phone, You will find both pair via usb or WIFI.

  4. Pointing to Local API (Optional)

    If you are running WSIndex locally and want the app to connect to it, update the baseApiUrl in the api/BookApi to your local IP:

    // If you are running on Emulator
    private val baseApiUrl = "http://10.0.2.2:8000/books"
    // Use IP address of your host machine(PC), when you want to run in 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:

  1. Create the Network Security Directory

    In your project explorer, navigate to app/src/main/res. If an xml folder does not exist, right-click res, select New > Directory, and name it xml.

  2. Create the Config File

    Right-click on the res/xml folder and select New > XML Resource File. Name it network_security_config.xml and replace its contents with the following:

    <?xml version="1.0" encoding="utf-8"?> 
        <network-security-config> 
            <domain-config cleartextTrafficPermitted="true"> 
                <domain includeSubdomains="true">192.168.100.2</domain> // Host IP
                <domain includeSubdomains="true">10.0.2.2</domain> 
                <domain includeSubdomains="true" >127.0.0.1</domain> 
            </domain-config> 
        </network-security-config>
  3. 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.xml and add the android:networkSecurityConfig attribute inside the <application> tag:

    <application android:name=".WikisourceApplication" android:networkSecurityConfig="@xml/network_security_config" 
        ... > <!-- Activities and Services --> 
    </application>