File size: 2,085 Bytes
ccdb867 6d73892 6208c15 ccdb867 60e1f9f ccdb867 ae7980e 18ccce6 ccdb867 5fd1844 ed967ad b6e63ce 06aa6df 7f1d006 e7832dd ecb94a6 21b89ef ecb94a6 5fd1844 ecb94a6 ccdb867 e619beb ecb94a6 ccdb867 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
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('/FUNCTIONS/FUNCTIONS_FRONTEND.txt', 'r', encoding='utf-8')
FUNCTIONS_FRONTEND = 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({'DATA': {}})
data['DATA'].update({'LINKS': LINKS})
data['DATA'].update({'CODE': {}})
data['DATA']['CODE'].update({'FUNCTIONS': {'BACKEND': FUNCTIONS_BACKEND, 'FRONTEND': FUNCTIONS_FRONTEND}})
data['DATA']['CODE'].update({'RIGHT_CLICK': RIGHT_CLICK})
else:
data = {
'PASSWORD': 'Access Denied',
'PASSWORDINPUT': passwordIn,
'ACCESS': access,
'DATA': {
'CODE': {
'FUNCTIONS': 'Access Denied',
'RIGHT_CLICK': 'Access Denied'
},
'LINKS': 'Access Denied'
}
}
return flask.jsonify(data)
if __name__ == "__main__":
app.run(debug=True,host="0.0.0.0",port=5000) |