added check for WiFi @ Home
This commit is contained in:
parent
ae27a5c999
commit
46192b0a03
|
@ -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'
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import mysql.connector as con
|
||||
from app import app
|
||||
|
||||
mycon = con.connect(host="192.168.1.6",user="curieweb",password="curie-web-russian-54",port=3306,database="curie")
|
||||
mycon = con.connect(host=app.config['DB_HOST'],user="curieweb",password="curie-web-russian-54",port=3306,database="curie")
|
||||
mycursor = mycon.cursor()
|
||||
|
||||
sql_select_Query = "select * from curieweb where done=0 LIMIT 1"
|
||||
|
|
|
@ -133,7 +133,7 @@ def wtform():
|
|||
flash_errors(myform)
|
||||
return render_template('wtform.html', form=myform)
|
||||
|
||||
tfWorking = 0
|
||||
tfWorking = -1
|
||||
|
||||
if tfWorking == -1:
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue