diff --git a/Software/src/lib/ayushsharma82-ElegantOTA/.github/workflows/ci.yml b/Software/src/lib/ayushsharma82-ElegantOTA/.github/workflows/ci.yml
index 1c1b43cb..85d66859 100644
--- a/Software/src/lib/ayushsharma82-ElegantOTA/.github/workflows/ci.yml
+++ b/Software/src/lib/ayushsharma82-ElegantOTA/.github/workflows/ci.yml
@@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v2
with:
- repository: adafruit/ci-arduino
+ repository: ayushsharma82/ci-arduino
path: ci
- name: pre-install
@@ -55,7 +55,6 @@ jobs:
sed -i 's/ELEGANTOTA_USE_ASYNC_WEBSERVER 0/ELEGANTOTA_USE_ASYNC_WEBSERVER 1/' ElegantOTA.h
- name: Test Async Demo
- continue-on-error: true
run: python3 ci/build_platform.py esp8266 esp32
Sync_CI:
diff --git a/Software/src/lib/ayushsharma82-ElegantOTA/README.md b/Software/src/lib/ayushsharma82-ElegantOTA/README.md
index fe447f4d..6e5a6058 100644
--- a/Software/src/lib/ayushsharma82-ElegantOTA/README.md
+++ b/Software/src/lib/ayushsharma82-ElegantOTA/README.md
@@ -1,5 +1,3 @@
-This is commit 9ab44bd from https://github.com/ayushsharma82/ElegantOTA
-

diff --git a/Software/src/lib/ayushsharma82-ElegantOTA/library.json b/Software/src/lib/ayushsharma82-ElegantOTA/library.json
index de4e8c14..b685a6dd 100644
--- a/Software/src/lib/ayushsharma82-ElegantOTA/library.json
+++ b/Software/src/lib/ayushsharma82-ElegantOTA/library.json
@@ -15,7 +15,7 @@
"maintainer": true
}
],
- "version": "3.1.0",
+ "version": "3.1.1",
"frameworks": "arduino",
"platforms": ["espressif8266", "espressif32", "raspberrypi"]
}
diff --git a/Software/src/lib/ayushsharma82-ElegantOTA/library.properties b/Software/src/lib/ayushsharma82-ElegantOTA/library.properties
index 61160ce3..5a4010ab 100644
--- a/Software/src/lib/ayushsharma82-ElegantOTA/library.properties
+++ b/Software/src/lib/ayushsharma82-ElegantOTA/library.properties
@@ -1,5 +1,5 @@
name=ElegantOTA
-version=3.1.0
+version=3.1.1
author=Ayush Sharma
category=Communication
maintainer=Ayush Sharma
diff --git a/Software/src/lib/ayushsharma82-ElegantOTA/platformio_upload.py b/Software/src/lib/ayushsharma82-ElegantOTA/platformio_upload.py
index b22e8d5d..946ae392 100644
--- a/Software/src/lib/ayushsharma82-ElegantOTA/platformio_upload.py
+++ b/Software/src/lib/ayushsharma82-ElegantOTA/platformio_upload.py
@@ -16,6 +16,7 @@ import requests
import hashlib
from urllib.parse import urlparse
import time
+from requests.auth import HTTPDigestAuth
Import("env")
try:
@@ -29,7 +30,9 @@ except ImportError:
def on_upload(source, target, env):
firmware_path = str(source[0])
- upload_url_compatibility = env.GetProjectOption('upload_url')
+
+ auth = None
+ upload_url_compatibility = env.GetProjectOption('custom_upload_url')
upload_url = upload_url_compatibility.replace("/update", "")
with open(firmware_path, 'rb') as firmware:
@@ -50,12 +53,37 @@ def on_upload(source, target, env):
'Referer': f'{upload_url}/update',
'Connection': 'keep-alive'
}
-
- start_response = requests.get(start_url, headers=start_headers)
- if start_response.status_code != 200:
- print("start-request faild " + str(start_response.status_code))
- return
+ checkAuthResponse = requests.get(f"{upload_url_compatibility}/update")
+
+ if checkAuthResponse.status_code == 401:
+ try:
+ username = env.GetProjectOption('custom_username')
+ password = env.GetProjectOption('custom_password')
+ except:
+ username = None
+ password = None
+ print("No authentication values specified.")
+ print('Please, add some Options in your .ini file like: \n\ncustom_username=username\ncustom_password=password\n')
+ if username is None or password is None:
+ print("Authentication required, but no credentials provided.")
+ return
+ print("Serverconfiguration: authentication needed.")
+ auth = HTTPDigestAuth(username, password)
+ doUpdateAuth = requests.get(start_url, headers=start_headers, auth=auth)
+
+ if doUpdateAuth.status_code != 200:
+ print("authentication faild " + str(doUpdateAuth.status_code))
+ return
+ print("Authentication successfull")
+ else:
+ auth = None
+ print("Serverconfiguration: autentication not needed.")
+ doUpdate = requests.get(start_url, headers=start_headers)
+
+ if doUpdate.status_code != 200:
+ print("start-request faild " + str(doUpdate.status_code))
+ return
firmware.seek(0)
encoder = MultipartEncoder(fields={
@@ -87,7 +115,7 @@ def on_upload(source, target, env):
}
- response = requests.post(f"{upload_url}/ota/upload", data=monitor, headers=post_headers)
+ response = requests.post(f"{upload_url}/ota/upload", data=monitor, headers=post_headers, auth=auth)
bar.close()
time.sleep(0.1)
@@ -100,4 +128,4 @@ def on_upload(source, target, env):
tqdm.write(message)
-env.Replace(UPLOADCMD=on_upload)
+env.Replace(UPLOADCMD=on_upload)
\ No newline at end of file
diff --git a/Software/src/lib/ayushsharma82-ElegantOTA/src/ElegantOTA.h b/Software/src/lib/ayushsharma82-ElegantOTA/src/ElegantOTA.h
index fca52519..eb961cbf 100644
--- a/Software/src/lib/ayushsharma82-ElegantOTA/src/ElegantOTA.h
+++ b/Software/src/lib/ayushsharma82-ElegantOTA/src/ElegantOTA.h
@@ -24,7 +24,7 @@ _____ _ _ ___ _____ _
#include "elop.h"
#ifndef ELEGANTOTA_USE_ASYNC_WEBSERVER
- #define ELEGANTOTA_USE_ASYNC_WEBSERVER 1
+ #define ELEGANTOTA_USE_ASYNC_WEBSERVER 0
#endif
#ifndef ELEGANTOTA_DEBUG
@@ -64,8 +64,8 @@ _____ _ _ ___ _____ _
#include "Update.h"
#include "StreamString.h"
#if ELEGANTOTA_USE_ASYNC_WEBSERVER == 1
- #include "../../me-no-dev-AsyncTCP/src/AsyncTCP.h"
- #include "../../me-no-dev-ESPAsyncWebServer/src/ESPAsyncWebServer.h"
+ #include "AsyncTCP.h"
+ #include "ESPAsyncWebServer.h"
#define ELEGANTOTA_WEBSERVER AsyncWebServer
#else
#include "WiFi.h"