Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Version 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftCreatR committed Apr 3, 2021
1 parent a200287 commit dfeeb74
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 45 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/ShellCheck.yml

This file was deleted.

15 changes: 14 additions & 1 deletion .github/workflows/TestRun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,25 @@ on:
workflow_dispatch:

jobs:
ShellCheck:
runs-on: ubuntu-latest

steps:
- name: Git checkout
uses: actions/[email protected]

- name: Run Shellcheck
uses: azohra/[email protected]
with:
path: "warp-up.sh"

TestRun:
needs: ShellCheck
runs-on: ubuntu-latest

steps:
- name: Git checkout
uses: actions/[email protected]

- name: Run
run: bash warp-up.sh --id 12345678-1234-5678-1234-567812345678 --iterations 5 --interval 0 --travis -- || exit 1
run: bash warp-up.sh --id 12345678-1234-5678-1234-567812345678 --iterations 3 --interval 0 --ci -- || exit 1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Warp-Up
#### Automatically generated referrer bonuses for Cloudflare WARP.

[![Shellcheck](https://img.shields.io/github/workflow/status/SoftCreatR/warp-up/Shellcheck?label=Build&style=flat-square)](https://github.com/SoftCreatR/warp-up/actions?query=workflow%3ATestRun) [![Shellcheck](https://img.shields.io/github/workflow/status/SoftCreatR/warp-up/Shellcheck?label=Shellcheck&style=flat-square)](https://github.com/SoftCreatR/warp-up/actions?query=workflow%3AShellcheck)
[![Build](https://img.shields.io/github/workflow/status/SoftCreatR/warp-up/TestRun?style=flat-square)](https://github.com/SoftCreatR/imei/actions/workflows/TestRun.yml)

[![Commits](https://img.shields.io/github/last-commit/SoftCreatR/warp-up?style=flat-square)](https://github.com/SoftCreatR/warp-up/commits/main) [![GitHub release](https://img.shields.io/github/release/SoftCreatR/warp-up?style=flat-square)](https://github.com/SoftCreatR/warp-up/releases) [![GitHub license](https://img.shields.io/github/license/SoftCreatR/warp-up?style=flat-square&color=lightgray)](https://github.com/SoftCreatR/warp-up/blob/main/LICENSE) ![Installs](https://img.shields.io/badge/dynamic/json?style=flat-square&color=blue&label=Installs&query=value&url=https%3A%2F%2Fapi.countapi.xyz%2Fget%2Fsoftcreatr%2Fwarpup) [![GitHub file size in bytes](https://img.shields.io/github/size/SoftCreatR/warp-up/warp-up.sh?style=flat-square)](https://github.com/SoftCreatR/warp-up/blob/main/warp-up.sh)

Expand Down
46 changes: 26 additions & 20 deletions warp-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# for Cloudflare WARP. #
# #
# Author : Sascha Greuel <[email protected]> #
# Date : 2020-09-20 21:37 #
# Date : 2021-04-03 19:07 #
# License : MIT #
# Version : 2.0.2 #
# Version : 2.1.0 #
# #
# Usage : bash warp-up.sh #
##############################################################
Expand Down Expand Up @@ -56,8 +56,8 @@ while [ "$#" -gt 0 ]; do
--disclaimer)
DISCLAIMER_AGREE="yes"
;;
--travis)
TRAVIS_BUILD="yes"
--ci)
CI_BUILD="yes"
;;
*) ;;
esac
Expand Down Expand Up @@ -159,18 +159,18 @@ json_encode() {

if [ -f "$0" ]; then
WARP_UP_VER=$(grep -oP 'Version\s+:\s+\K([\d\.]+)' "$0")
WARP_UP_LATEST_VER=$(curl -sL "https://1-2.dev/warp-up?uc" | grep -oP 'Version\s+:\s+\K([\d\.]+)')
WARP_UP_LATEST_VER=$(curl -sL "https://dist.1-2.dev/warp-up?uc" | grep -oP 'Version\s+:\s+\K([\d\.]+)')
fi

##################
# Base functions #
##################

warpUp() {
sleep $INTERVAL
sleep "$INTERVAL"

# Travis should never make API calls
if [ -n "$TRAVIS_BUILD" ]; then
# CI should never make API calls
if [ -n "$CI_BUILD" ]; then
if [ "$((1 + RANDOM % (1 + 10 - 1)))" -lt 5 ]; then
SUCCESS=$((SUCCESS + 1))
else
Expand All @@ -180,6 +180,12 @@ warpUp() {
return
fi

TMP_DIR="/tmp"

if [ -n "$TMPDIR" ]; then
TMP_DIR="$TMPDIR"
fi

API_URL="https://api.cloudflareclient.com/v0a$((100 + RANDOM % (1 + 999 - 100)))/reg"
INSTALL_ID=$(rnd 22)
BODY="$(
Expand All @@ -198,8 +204,8 @@ warpUp() {
API_RESPONSE=$(
curl \
--compressed \
--cookie "/tmp/cfwarp.txt" \
--cookie-jar "/tmp/cfwarp.txt" \
--cookie "$TMP_DIR/cfwarp.txt" \
--cookie-jar "$TMP_DIR/cfwarp.txt" \
--header "Content-Type: application/json" \
--header "Host: api.cloudflareclient.com" \
--header "Connection: Keep-Alive" \
Expand All @@ -218,15 +224,15 @@ warpUp() {
else
FAILURE=$((FAILURE + 1))

if [[ $API_RESPONSE == *"Access denied"* ]]; then
if [[ "$API_RESPONSE" == *"Access denied"* ]]; then
echo -ne "\ec"
echo ""
echo -e "${CRED}Unable to establish an API connection. Aborting.${CEND}"
echo ""
echo ""

exit 1
elif [[ $API_RESPONSE == "Internal Server Error" ]]; then
elif [[ "$API_RESPONSE" == "Internal Server Error" ]]; then
echo "$(date): Failure: Internal Server Error. If this problem persists, restart Warp-Up with an increased request interval."
else
echo "$(date): Failure."
Expand All @@ -239,7 +245,7 @@ warpUp() {
# Run #
#######

if [ -z "$TRAVIS_BUILD" ] && [ -z "$DISCLAIMER_AGREE" ]; then
if [ -z "$CI_BUILD" ] && [ -z "$DISCLAIMER_AGREE" ]; then
echo -ne "\ec"

echo " DISCLAIMER"
Expand Down Expand Up @@ -267,7 +273,7 @@ if [ -z "$TRAVIS_BUILD" ] && [ -z "$DISCLAIMER_AGREE" ]; then
while true; do
read -rep " Do you agree? (y/n): " yn </dev/tty

case $yn in
case "$yn" in
[Yy]*)
break
;;
Expand Down Expand Up @@ -296,7 +302,7 @@ echo " $WELCOME_TXT"
echo " $(str_repeat "$WELCOME_LEN" "#")"
echo ""

if [ -z "$TRAVIS_BUILD" ] && [ -n "$WARP_UP_VER" ] && [ "$(version "$WARP_UP_VER")" -lt "$(version "$WARP_UP_LATEST_VER")" ]; then
if [ -z "$CI_BUILD" ] && [ -n "$WARP_UP_VER" ] && [ "$(version "$WARP_UP_VER")" -lt "$(version "$WARP_UP_LATEST_VER")" ]; then
echo -e " ${CYELLOW}A newer Warp Up version ($WARP_UP_LATEST_VER) is available!${CEND}"
echo ""
fi
Expand All @@ -305,7 +311,7 @@ if [ -z "$REFERRER" ] || [[ ! "$REFERRER" =~ ^\{?[A-F0-9a-f]{8}-[A-F0-9a-f]{4}-[
while true; do
read -rep " Warp ID : " REFERRER </dev/tty

if [[ $REFERRER =~ ^\{?[A-F0-9a-f]{8}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{12}\}?$ ]]; then
if [[ "$REFERRER" =~ ^\{?[A-F0-9a-f]{8}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{12}\}?$ ]]; then
if [[ -x "$0" ]]; then
exec bash "$0" --id "$REFERRER" --iterations "$ITERATIONS" --interval "$INTERVAL" --disclaimer "$DISCLAIMER_AGREE" && exit
else
Expand Down Expand Up @@ -347,7 +353,7 @@ echo " Interval : $INTERVAL"

echo ""
echo " Log File : $LOG_FILE"
echo " Travis : ${TRAVIS_BUILD:-"no"}"
echo " CI Build : ${CI_BUILD:-"no"}"
echo ""

echo " ##################"
Expand All @@ -356,10 +362,10 @@ echo " ##################"
echo ""

# Begin new log entry
HASH=$(date '+%s%N' | shasum | head -c 40)
HASH=$(date '+%s%N' | sha1sum | head -c 40)
START=$(date)

cat <<FOE >>$LOG_FILE
cat <<FOE >> "$LOG_FILE"
<<<<<<<<${HASH}<<<<
Warp-Up Version : ${WARP_UP_VER}
Warp ID : ${REFERRER}
Expand Down Expand Up @@ -388,7 +394,7 @@ else
done
fi

cat <<FOE >>$LOG_FILE
cat <<FOE >> "$LOG_FILE"
<<<<
FOE
Expand Down

0 comments on commit dfeeb74

Please sign in to comment.