manuelvargastapia / libgen_mobile_app

GNU General Public License v3.0
172 stars 12 forks source link

LibGen Mobile


Looking for maintainers!

Due to my limited amount of time, I haven't been able to keep this project updated. The app and the server still are running and I plan it to keep like that, but currently, I'm not able to build more features. At least not at the required pace. So, contact me or simply fork and code. I'll remain aware and try to help with anything. Thanks.

F-Droid GitHub

This is a non-offical mobile client for Library Genesis service. It's an independent side project. And it's Open Source, so feel free to collaborate.

The app is built with Flutter and it's available in FDroid.

Currently, we're working mainly in Android version.

Versión en español

Features

TODO

The following is a list of desired new features within the scope of the project. Notwithstanding, we're happy to hear new ideas and feeback.

We recommend to submit first an issue to discuss ideas, instead of directly send a PR.

Environment

Flutter and Dart

Environment config

We're managing the different stages of the app (basically, development and production) throught compile time variables (check this article for information). The only environmental variable in use right now is LIBGEN_MOBILE_API. This allow us to pass a development and production API URL directly from CLI commands.

Also note that this app is using multiple flavors, therefore it has to be specifically referenced when running the app. Otherwise, you'll get the a "Gradle build failed to produce an .apk file" error.

To run the app with compile time variable plus the correct flavor, use the following command:

flutter run --dart-define=LIBGEN_API_URL=<VALUE> --flavor local

Finally, in VSCode, it could be useful define a launch.json file to debug. Such file would look like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "emulator",
            "request": "launch",
            "type": "dart",
            "args": [
                "--dart-define=LIBGEN_API_URL=http://10.0.2.2:3000",
                "--flavor",
                "local"
            ]
        },
    ]
}

Those flags also work with flutter build apk and others similar commands.

IMPORTANT

To use a phisical device to run the app, you'll need to pass the internal IP of the machine that's running the server as the value of LIBGEN_API_URL. "http://10.0.2.2:3000" will only provide access to emulators, as those are part of the same network.

Libgen API

Library Genesis doesn't provide a public API to work with, so we decided to build a backend service to consume. It's currently hosted in Heroku.

Check the repo to run your own instance and pass the corresponding URLs to the app throught compile time variables. It's an ExpressJS project; you just need to clone (or fork) the repo, install dependencies and run npm start.

During development, a forked version of this unofficial Libgen library has been used to get the data. This is the repo of our modified version.

Dependencies

The followings are all the official and third-party packages in use right now.

Internationalization

Additionally, for generating the needed boilerplate we used the VSCode plugin Flutter Intl. This way, is recommended using this plugin to automatically generate new code for new locales. Unfortunately, the offical docs seems to be outdated.

API requests

State management

Downloads

For downloading, we're using a fork of _flutterdownloader package. Check pubspec.yaml for details.

Open download link in browser

Render HTML content

For rendering HTML, we're using a fork of _simple_htmlcss package. Check pubspec.yaml for details.

Local storage

Code generation

Others