Skip to content

Commit

Permalink
Feature - Quick Action Integration (#27)
Browse files Browse the repository at this point in the history
* Refactored application config script in preparation for new feature

* Added quick action menu support

* Improved clarity for viewing config

* Update Windows bootstrap script to accept command args

* Minor adjustment to quick menu action

* Add colour to quick menu section

* Fixed app count display on macOS

* Fixed number count compatibility with macOS

* Switched nodepay image to latest

* Minor refactoring update to application config script and display output

* Update README.md
  • Loading branch information
XternA authored Aug 22, 2024
1 parent 1f5cdc6 commit 63b73c9
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 109 deletions.
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
# 💻 Income Generator 💵
**[ Multi-Platform | Docker Stack | Containerized | Passive Income | Auto Update ]**
**[ Multi-Platform | OS Native | Containerized Stack | Passive Income | Auto Update ]**

If you like this project, don't forget to leave a star. ⭐

>**NOTE:** *"This tool has always been developed for my personal use in mind, therefore the focus has always been Linux first as I run them on my home and cloud servers before making it available to the general public."*
<p align="center">
<img src="https://github.com/XternA/income-generator/assets/9136075/22881e8c-c3f8-4c61-a927-cccc18bd0c7e" alt="Income Generator" width=80% height=80%>
</p>

## Overview 📚
**Income Generator** is an all-in-one tool that allows generating passive income by leveraging popular passive income generative applications, everyday devices, and unused internet bandwidth.
**Income Generator** is an all-in-one tool that allows generating passive income by leveraging income generating applications and unused internet bandwidth with minimal system resource.

Designed for minimal setup and native cross-platform support, utilizing containerized runtime isolation from the host, with full orchestration allowing fast deployment across multiple hosts.

The result is a tool that fully orchestrates, manages, and deploys these applications into an isolated space from the host, simplifying the process, and allowing for fast deployment across stacks with application auto-update management.
📖 It's' strongly recommended to refer to the [**Wiki**](../../wiki) for in-depth details and instructions.

**Some of the key features you can expect:**
## Key Features ✨
- **Easy To Use** - All-in-one solution for managing the stack. Docker installation, start/stop/remove.
- **Multi-platform** - Deploy across different OS.
- **Global Access** - Access the tool anywhere, just type `igm`.
- **Auto update** - Ensures applications always running up-to-date.
- **On-the-fly-update** - Tool can be updated on the fly whilst preserving config settings.
- **Local Config** - Config file is auto-generated and stored locally, including credentials.
- **Resource Limit** - Easily apply resource limit based on system hardware.
- **Selective Apps** - Enable or disable the application of your choice to deploy.

📖 Refer to the [**Wiki**](../../wiki) is strongly recommended for more details and in-depth instructions.
- **Selective Apps** - Enable or disable the application of your choice to deploy and earn.
- **Quick Actions** - CLI commands for common operations without launching the tool.

## Getting Started 🚥
### Prerequisite 📦
**The tool configures and runs everything in a containerized virtualized environment isolated from the host.**

- A 64-bit machine, though it's possible to run on a 32-bit machine, but with certain performance limitations, specifically with lower memory availability.
- A 64-bit machine. It is possible to run on a 32-bit machine, but expect performance or compatibility limitations.
- A minimum of 4GB is recommended to ensure the most resource available and for future expansions.
- ARM architecture devices, such as Raspberry Pi, Apple Silicon, etc, require an emulation layer such as [**qemu-user-static (qus)**](https://github.com/dbhi/qus) to run x86 architecture applications on ARM. Installing docker via the tool will enable this automatically.
- For Windows, [**WSL2**](https://learn.microsoft.com/en-us/windows/wsl/install) and [**Winget**](https://learn.microsoft.com/en-us/windows/package-manager) will be required.
- ARM architecture devices, such as Raspberry Pi, Apple Silicon, etc, require an emulation layer such as [**qemu-user-static (qus)**](https://github.com/dbhi/qus) to run x86 architecture applications on ARM. Automatically configured seamlessly through the tool.
- On Windows, [**WSL2**](https://learn.microsoft.com/en-us/windows/wsl/install) and [**Winget**](https://learn.microsoft.com/en-us/windows/package-manager) is required.

### Quick Start Guide ⚙️
If the prerequisites are met based on the platform, you can simply follow the quick start guide, otherwise, refer to the [**Wiki**](../../wiki) for the full setup procedure.
Expand All @@ -48,7 +46,7 @@ Open the command line and get the bootstrap script.
curl -o %APPDATA%\IGM\igm.bat --create-dirs --ssl-no-revoke -L https://raw.githubusercontent.com/XternA/income-generator/main/start.bat
```
Register the bootstrap script by adding an entry to the environment variable path.
```
```sh
for /f "delims=" %i in ('powershell -Command "[Environment]::GetEnvironmentVariable('Path', 'User')"') do set USERPATH=%i && setx PATH %USERPATH%;%APPDATA%\IGM
```
For the registering to take effect, close and re-open a new command line process.
Expand All @@ -69,7 +67,7 @@ git clone --depth=1 https://github.com/XternA/income-generator.git ~/.income-gen
```
Register alias for global access. (Auto detects and adds to current shell choice e.g. `.bashrc`, `.zshrc` etc.)
```sh
echo "alias igm='(cd ~/.income-generator; sh start.sh)'" >> ~/."${SHELL##*/}"rc; source ~/."${SHELL##*/}"rc
echo "alias igm=\"sh -c 'cd ~/.income-generator; sh start.sh \\\"\\\$@\\\"' --\"" >> ~/."${SHELL##*/}rc"; source ~/."${SHELL##*/}rc"
```
Run the tool.
```sh
Expand All @@ -90,7 +88,7 @@ Each app has been grouped in the install option. Therefore, whether it be reside
| Application | Residential / Mobile IP | VPS / Hosting IP | Devices Per Account | Devices Per IP | Major Payout Type |
| --- | :---: | :---: | :---: | :---: | :---: |
| **[EARNAPP](https://bit.ly/4a4XJLF)** | :white_check_mark: | :x: |15|1 | PayPal, Wise |
| **[EARNAPP](https://bit.ly/4a4XJLF)** | :white_check_mark: | :x: |15|1 | PayPal |
| **[HONEYGAIN](https://bit.ly/3x6nX1S)** | :white_check_mark: | :x: |10|1 | PayPal, Crypto |
| **[PEER2PROFIT](https://bit.ly/3x7CquB)** | :white_check_mark: | :white_check_mark: |Unlimited|Unlimited| Crypto |
| **[TRAFFMONETIZER](https://bit.ly/3TKmJlU)** | :white_check_mark: | :white_check_mark: |Unlimited|Unlimited| Crypto |
Expand Down
2 changes: 1 addition & 1 deletion compose/compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ services:

nodepay:
container_name: nodepay
image: kellphy/nodepay:legacy
image: kellphy/nodepay
restart: always
environment:
- NP_COOKIE=${NODEPAY_COOKIE:-}
Expand Down
2 changes: 1 addition & 1 deletion scripts/app-selection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ while true; do
echo " ${RED}d${NC} = ${RED}disable all${NC}"
echo " ${BLUE}0${NC} = ${BLUE}exit${NC}"

printf "\nSelect to ${GREEN}enable${NC} | ${RED}disable${NC} application (1-%s): " "$(echo "$app_data" | wc -l)"
printf "\nSelect to ${GREEN}enable${NC} | ${RED}disable${NC} application (1-%s): " "$(echo "$app_data" | wc -l | xargs)"
read -r choice

case $choice in
Expand Down
28 changes: 15 additions & 13 deletions scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ NC='\033[0m'
display_banner() {
clear
printf $GREEN
echo "=========================================================="
echo "# ${NC}Dotenv Configuration Script${GREEN} #"
echo "=========================================================="
echo "# ${NC}Configure and update the configuration file setup${GREEN} #"
echo "# ${NC}stored within a config file called ${RED}.env${NC}.${GREEN} #"
echo "=========================================================="
echo "==========================================================="
echo "# ${NC}Application Credential Setup Manager${GREEN} #"
echo "==========================================================="
echo "# ${NC}Manage, update and configure application credentials.${GREEN} #"
echo "# ${NC}Credentials are stored locally in a ${RED}.env${NC} config file.${GREEN} #"
echo "==========================================================="
printf $NC
}

Expand Down Expand Up @@ -89,7 +89,7 @@ process_entries() {

jq -c '.[]' "$JSON_FILE" | while read -r config_entry; do
display_banner
entry_count=$(expr $entry_count + 1)
entry_count=$((entry_count + 1))
echo "\nConfiguring application ${RED}$entry_count${NC} of ${RED}$num_entries${NC}"

if [ $(echo "$config_entry" | jq -r '.is_enabled') = false ]; then
Expand All @@ -102,7 +102,7 @@ process_entries() {
description_ext=$(echo "$config_entry" | jq -r '.description_ext' | tr -d '\n')
registration=$(echo "$config_entry" | jq -r '.registration' | tr -d '\n')

echo "\n[ $app_name ]"
echo "\n[ ${GREEN}$app_name${NC} ]"
[ "$url" != null ] && echo "Go to $BLUE$url$NC to register an account. (CTRL + Click)"
[ "$description" != null ] && echo "Description: ${YELLOW}$description${NC}"
[ "$description_ext" != null ] && echo "${YELLOW}$description_ext${NC}"
Expand Down Expand Up @@ -143,25 +143,27 @@ process_entries() {

display_banner
if [ "$change_made" -eq 1 ]; then
echo "\nDone updating dotenv file '${RED}$ENV_FILE${NC}'."
echo "\nDone updating config file '${RED}$ENV_FILE${NC}'."
elif [ "$change_made" -eq 0 ] && [ ! -f "$ENV_FILE" ]; then
echo "\nDotenv file '${RED}$ENV_FILE${NC}' was created."
echo "\nDotenv file '${RED}$ENV_FILE${NC}' created."
else
echo "\nNo changes made to '${RED}$ENV_FILE${NC}'."
fi
}

# Main script
if [ -f "$ENV_FILE" ]; then
printf "\nDotenv file '${RED}$ENV_FILE${NC}' found. Configure it? (y/n): "; read -r input
echo "Credentials will be stored in '${RED}$ENV_FILE${NC}'"
printf "\nStart the application setup process? (y/n): "; read -r input
if [ "$input" = "y" ]; then
process_entries
else
echo "No changes made to '${RED}$ENV_FILE${NC}'."
echo "\nNo changes made to '${RED}$ENV_FILE${NC}'."
fi
else
echo "Dotenv file '${RED}$ENV_FILE${NC}' not found. Creating a new one...\n"
echo "Dotenv file '${RED}$ENV_FILE${NC}' not found. Creating new one...\n"
sleep 1.2
touch "$ENV_FILE"
process_entries
fi
printf "\nPress Enter to continue..."; read -r input < /dev/tty
36 changes: 14 additions & 22 deletions start.bat
Original file line number Diff line number Diff line change
@@ -1,49 +1,41 @@
@echo off
setlocal

set ARGS="%*"
set REPO="https://github.com/XternA/income-generator.git"
set TOOL_DIR="~/.income-generator"

winget --version >nul 2>&1
if %errorlevel% neq 0 (
echo No winget found on the system. Please install winget before proceeding.
exit /b 1
)

wsl --version >nul 2>&1
if %errorlevel% equ 0 (
wsl ! [ -d $HOME/.income-generator ] && call :GetTool
call :CheckAndRegisterAlias
wsl ${SHELL##*/} -ilc "igm"
) else (
if %errorlevel% neq 0 (
echo No Windows Subsystem for Linux found on the system. Ensure WSL is enabled before proceeding.
exit /b 1
)

call :CheckAndRegisterAlias
wsl ${SHELL##*/} -ilc "echo; [ ! -d %TOOL_DIR% ] && git clone --depth=1 %REPO% %TOOL_DIR%; sleep 3; igm %ARGS%"
exit /b 0


REM -- Sub-calls -------------
:CheckAndRegisterAlias
wsl -e sh -c "if [ -f $HOME/.aliases ]; then exit 0; else exit 1; fi"
wsl -e sh -c "[ -f $HOME/.aliases ]"
if %errorlevel% equ 0 (
wsl grep -q "igm='(cd ~/.income-generator; sh start.sh)'" "$HOME/.aliases" || call :RegisterToAliases
wsl grep -q "alias igm=" "$HOME/.aliases" || call :RegisterToAliases
) else (
wsl grep -q "igm='(cd ~/.income-generator; sh start.sh)'" "$HOME/.${SHELL##*/}rc" || call :RegisterToRC
wsl grep -q "alias igm=" "$HOME/.${SHELL##*/}rc" || call :RegisterToRC
)
exit /b 0

:RegisterToAliases
wsl -e sh -c "echo \"alias igm='(cd ~/.income-generator; sh start.sh)'\" >> $HOME/.aliases"
wsl -e sh -c "echo 'alias igm=\"sh -c '\''cd %TOOL_DIR%; sh start.sh \\\"\\$@\\\"'\'' --\"' >> $HOME/.aliases"
exit /b 0

:RegisterToRC
wsl -e sh -c "echo \"alias igm='(cd ~/.income-generator; sh start.sh)'\" >> $HOME/.${SHELL##*/}rc"
exit /b 0

:GetTool
echo:
echo No Income Generator found. Fetching...
echo:

wsl git clone --depth=1 https://github.com/XternA/income-generator.git $HOME/.income-generator

echo:
echo Launching...
timeout /t 2 /nobreak >nul 2>&1
wsl -e sh -c "echo 'alias igm=\"sh -c '\''cd %TOOL_DIR%; sh start.sh \\\"\\$@\\\"'\'' --\"' >> $HOME/.${SHELL##*/}rc"
exit /b 0
Loading

0 comments on commit 63b73c9

Please sign in to comment.