From 8966af81553cebed10aa1f5f633575e90b524002 Mon Sep 17 00:00:00 2001 From: Alexandre Racine Date: Fri, 16 Jun 2023 22:01:10 +0200 Subject: [PATCH] untracked files on develop: 8aa7bc2 Unread feed filter & oauth refactoring --- README.md | 62 ++++++++++++++++++++++++++++++++++++++++++++ icons/inoreader.png | Bin 0 -> 5035 bytes 2 files changed, 62 insertions(+) create mode 100644 README.md create mode 100644 icons/inoreader.png diff --git a/README.md b/README.md new file mode 100644 index 0000000..202acd3 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +# Inopy + +Inopy is a Python application that retrieves unread articles from the [Inoreader](https://www.inoreader.com) API and sends a notification if there are any. + +## Table of Contents + +- [Overview](#overview) +- [Installation](#installation) +- [Usage](#usage) +- [License](#license) + +## Overview + +It uses OAuth authentication for accessing the [API](https://www.inoreader.com/developers) and stores the authentication data in a JSON configuration file located at `/HOME/USER/.config/inopy/config.json`. The program is divided into multiple modules and functions for making API requests, parsing response data, refreshing tokens, and sending notifications. + +The code is organized into the following modules: + +- `ino.py`: The main module that retrieves unread articles, handles token refreshing, and sends notifications. +- `config.py`: Contains configuration settings used by other modules. +- `oauth.py`: Implements the OAuth authentication flow using Flask. +- `refresh.py`: Contains a `refresh` function for refreshing OAuth access and refresh tokens and updating the configuration file. +- `notif.py`: Provides a function for sending notifications using D-Bus (only tested with Cinnamon desktop environment). + +## Installation + +To use Inopy, you need to follow these steps: + +1. Install the required dependencies by running the following command: + +```bash +pip install requests pydbus flask waitress +``` + +2. Clone or download this repository. + +3. Run the `ino.py` module the first time and set up the configuration file by providing the necessary OAuth, API endpoint and notifications details. + +4. Run the `ino.py` module to retrieve unread articles and receive notifications. + +## Usage + +The first time `ino.py` module is run, it will check if `config.json` exists in `/HOME/USER/.config/inopy/`. If not it will prompt user for configuration details and create the `config.json` file. The file should contain the OAuth endpoint, client ID, client secret, callback URL, scope, CSRF value and home URL. + +It should also contain the Inoreader API endpoints, notification labels, production status, browser path, host and port. + +Once the configuration is set up, you can adapt some of the default values. Typically, check and if necessary adapt the `prod` section of the file. It defines whether the program is run in production or development mode. + +To set a cron in Linux triggering the program for a notification, create a bash script containing the following code + +```bash +#!/bin/bash +export DISPLAY=:0.0 +export XAUTHORITY=/home/user/.Xauthority # adapt with your username +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus + +python path_to_your_ino.py # adapt with the path to your program directory +``` +and define the cron job pointing to the bash script created. + +## License + +Inopy is released under the GNU General Public License version 3 or later. You can redistribute it and/or modify it under the terms of the license. For more details, please refer to the [GNU General Public License](https://www.gnu.org/licenses/). \ No newline at end of file diff --git a/icons/inoreader.png b/icons/inoreader.png new file mode 100644 index 0000000000000000000000000000000000000000..dd5328681b1407bee53c6aa869a5cbad8e4ae54a GIT binary patch literal 5035 zcmV;c6IASpP)000f2dQ@0+Qek%> zaB^>EX>4U6ba`-PAZ2)IW&i+q+TEF3b{x48ME|i0F9Gkza_~IIJMi*-1J$G`jyRl= z{bRF5R(Ew33doF%h=k1k*FTT>2S3r~Xkscgx123MvBl;)Z>oKM+WqTnynpXce0{~| zpU#{2FFdCL$MAeC{dIlkeEM<2+cVtw`MjyGZ+v|XocGUp_nL`m z`+1XFEgz>kUIWdyDc2vr@qJparC&%XRSFLTaRh@7qOv0`3cxMmv4oc?kZ332C@ zw{!#i_Ijn?e!veN(_?Q_i_$kz6mK#F9!brPR_&uc5}8YObZ$+G=mU1voIZ z+)AshwcfqyJg75P=laf>;YS#8q>)D%b+pkZ@R@O@nP-`Gw%M0oVL=lsud?cDt8ZsE zOtIrmJMXgVZo40_cEX7#oqWovr=9+uwO3aE@cJ8BbFZxVn<-sa-m}J8Q_9;APIQu# zGcx9*BjZIG0MK4Jv(?4ul{w|iHnCjtOfo4qW;tby6vpj*I_^DpKQi~1@@7)~OL_C( zWzHyd|BcKUQuoKa{UU2iIyY~|o+?yKZJ_#Q>ArU3$B8*?>Zj_n{oSMaPY3uP9jJA3 za`p=2?7YS(ZjF$79owC?+Bs3RQ_C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