thewellermangroup's picture
Update app.py
e7832dd
raw
history blame
1.73 kB
import flask
import flask_cors
import os
def checkPassword(passwordInput, password):
if (str(passwordInput) == str(password)):
return True
else:
return False
# sets up the app
app = flask.Flask(__name__)
flask_cors.CORS(app)
# creates a API endpoint for the password input
@app.route('/api/thewellermangroup/passwordinput/<passwordIn>', methods=['GET'])
def password(passwordIn):
PASSWORD = "1234"
securePassword = "$"+PASSWORD
access = checkPassword(passwordIn, securePassword)
data = {}
# Example data (could be fetched or processed dynamically)
if access:
data = {
'PASSWORD': securePassword,
'PASSWORDINPUT': passwordIn,
'ACCESS': access,
}
f = open('/FUNCTIONS/FUNCTIONS_BACKEND.txt', 'r', encoding='utf-8')
FUNCTIONS_BACKEND = eval('{'+f.read()+'}')
f.close()
f = open('/LINKS/LINKS.txt', 'r', encoding='utf-8')
LINKS = eval('{'+f.read()+'}')
f.close()
f = open('/RIGHT_CLICK/RIGHT_CLICK.txt', 'r', encoding='utf-8')
RIGHT_CLICK = f.read()
f.close()
data.update({'LINKS': LINKS})
data.update({'CODE': {}})
data['CODE'].update({'FUNCTIONS': FUNCTIONS_BACKEND})
data['CODE'].update({'RIGHT_CLICK': RIGHT_CLICK})
else:
data = {
'PASSWORD': 'Access Denied',
'PASSWORDINPUT': passwordIn,
'ACCESS': access,
'RIGHTCLICK': 'Access Denied',
'FUNCTIONS': 'Access Denied',
'LINKS': 'Access Denied'
}
return flask.jsonify(data)
if __name__ == "__main__":
app.run(debug=True,host="0.0.0.0",port=5000)