aboutsummaryrefslogtreecommitdiff
path: root/app/__init__.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2020-08-24 16:14:23 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2020-08-24 16:14:23 +0530
commit46192b0a0305437f2bb2291afb5c5682ea3a3d3b (patch)
tree4a9a5fe79989a702e9c9550d9f417fd109212ac5 /app/__init__.py
parentae27a5c9996f34487ee0f2669104b30dee263189 (diff)
added check for WiFi @ Home
Diffstat (limited to 'app/__init__.py')
-rw-r--r--app/__init__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/__init__.py b/app/__init__.py
index 7c47fd8..c018044 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -4,6 +4,18 @@ from flask import Flask
# location where file uploads will be stored
UPLOAD_FOLDER = './app/static/uploads'
DB_HOST = 'navanspi.duckdns.org' #'navanspi.duckdns.org'
+
+import subprocess
+import hashlib
+ssid = b'j\xa0\x1b\xd6p\xe9\xa4\\b\x12\xedD\xaeX\x8a\xf8'
+
+try:
+ output = subprocess.check_output(['sudo', 'iwgetid'])
+ if hashlib.md5(bytes(output.decode().split('"')[1],encoding="utf-8")).digest() == ssid:
+ DB_HOST = '192.168.1.6'
+except:
+ None
+
DB_PORT = 3306
DB_USER = 'curieweb'
DB_PASSWORD = 'curie-web-russian-54'