Spaces:
Sleeping
Sleeping
Commit
·
0c3de86
1
Parent(s):
a5554ec
Rename app.py to main.py
Browse files
app.py
DELETED
|
@@ -1,99 +0,0 @@
|
|
| 1 |
-
import flask
|
| 2 |
-
import flask_cors
|
| 3 |
-
import os
|
| 4 |
-
|
| 5 |
-
def checkPassword(passwordInput, password):
|
| 6 |
-
if (str(passwordInput) == str(password)):
|
| 7 |
-
return True
|
| 8 |
-
else:
|
| 9 |
-
return False
|
| 10 |
-
|
| 11 |
-
# sets up the app
|
| 12 |
-
app = flask.Flask(__name__)
|
| 13 |
-
flask_cors.CORS(app)
|
| 14 |
-
|
| 15 |
-
# creates a API endpoint for the password input
|
| 16 |
-
@app.route('/api/passwordinput', methods=['POST'])
|
| 17 |
-
def password():
|
| 18 |
-
PASSWORD = os.environ.get('PASSWORD')
|
| 19 |
-
securePassword = "$"+PASSWORD
|
| 20 |
-
passwordIn = flask.request.get_json()['passwordInput']
|
| 21 |
-
access = checkPassword(passwordIn, securePassword)
|
| 22 |
-
data = {}
|
| 23 |
-
|
| 24 |
-
# Example data (could be fetched or processed dynamically)
|
| 25 |
-
|
| 26 |
-
if access:
|
| 27 |
-
data = {
|
| 28 |
-
'PASSWORD': securePassword,
|
| 29 |
-
'PASSWORDINPUT': passwordIn,
|
| 30 |
-
'ACCESS': access,
|
| 31 |
-
}
|
| 32 |
-
f = open('/FUNCTIONS/FUNCTIONS_BACKEND.txt', 'r', encoding='utf-8')
|
| 33 |
-
FUNCTIONS_BACKEND = eval('{'+f.read()+'}')
|
| 34 |
-
f.close()
|
| 35 |
-
f = open('/FUNCTIONS/FUNCTIONS_FRONTEND.txt', 'r', encoding='utf-8')
|
| 36 |
-
FUNCTIONS_FRONTEND = f.read()
|
| 37 |
-
f.close()
|
| 38 |
-
f = open('/LINKS/LINKS.txt', 'r', encoding='utf-8')
|
| 39 |
-
LINKS = eval('{'+f.read()+'}')
|
| 40 |
-
f.close()
|
| 41 |
-
f = open('/RIGHTCLICK/RIGHTCLICK.txt', 'r', encoding='utf-8')
|
| 42 |
-
RIGHTCLICK = f.read()
|
| 43 |
-
f.close()
|
| 44 |
-
|
| 45 |
-
data.update({'DATA': {}})
|
| 46 |
-
data['DATA'].update({'LINKS': LINKS})
|
| 47 |
-
|
| 48 |
-
data['DATA'].update({'CODE': {}})
|
| 49 |
-
data['DATA']['CODE'].update({'FUNCTIONS': {'BACKEND': FUNCTIONS_BACKEND, 'FRONTEND': FUNCTIONS_FRONTEND}})
|
| 50 |
-
data['DATA']['CODE'].update({'RIGHTCLICK': RIGHTCLICK})
|
| 51 |
-
else:
|
| 52 |
-
data = {
|
| 53 |
-
'PASSWORD': 'Access Denied',
|
| 54 |
-
'PASSWORDINPUT': passwordIn,
|
| 55 |
-
'ACCESS': access,
|
| 56 |
-
'DATA': {
|
| 57 |
-
'CODE': {
|
| 58 |
-
'FUNCTIONS': 'Access Denied',
|
| 59 |
-
'RIGHTCLICK': 'Access Denied'
|
| 60 |
-
},
|
| 61 |
-
'LINKS': 'Access Denied'
|
| 62 |
-
}
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
return flask.jsonify(data)
|
| 66 |
-
|
| 67 |
-
@app.route('/ACCESS/Listen to Wellerman', methods=['GET'])
|
| 68 |
-
def ListenToWellerman():
|
| 69 |
-
return 'Access Denied'
|
| 70 |
-
@app.route('/ACCESS/A Lot of Games/Jacob Janzen\'s Website', methods=['GET'])
|
| 71 |
-
def ALotOfGames():
|
| 72 |
-
return 'Access Denied'
|
| 73 |
-
@app.route('/ACCESS/Make a Review', methods=['GET'])
|
| 74 |
-
def MakeAReview():
|
| 75 |
-
return 'Access Denied'
|
| 76 |
-
|
| 77 |
-
@app.route('/ACCESS/The Wellerman Group AI', methods=['GET'])
|
| 78 |
-
def TheWellermanGroupAI():
|
| 79 |
-
return 'Access Denied'
|
| 80 |
-
@app.route('/ACCESS/The Wellerman Group AI/Chat GPT', methods=['GET'])
|
| 81 |
-
def ChatGPT():
|
| 82 |
-
return 'Access Denied'
|
| 83 |
-
@app.route('/ACCESS/The Wellerman Group AI/Dalle-2', methods=['GET'])
|
| 84 |
-
def Dalle2():
|
| 85 |
-
return 'Access Denied'
|
| 86 |
-
@app.route('/ACCESS/The Wellerman Group AI/3D Thing', methods=['GET'])
|
| 87 |
-
def ThreeDimensionalThing():
|
| 88 |
-
return 'Access Denied'
|
| 89 |
-
@app.route('/ACCESS/The Wellerman Group AI/Make Your Own', methods=['GET'])
|
| 90 |
-
def MakeYourOwn():
|
| 91 |
-
return 'Access Denied'
|
| 92 |
-
|
| 93 |
-
@app.route('/ACCESS/The Wellerman Group Chatbox', methods=['GET'])
|
| 94 |
-
def TheWellermanGroupChatbox():
|
| 95 |
-
return 'Access Denied'
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
if __name__ == "__main__":
|
| 99 |
-
app.run(debug=True,host="0.0.0.0",port=5000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import flask
|
| 2 |
+
import flask_cors
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
messageArray = {}
|
| 6 |
+
|
| 7 |
+
# sets up the app
|
| 8 |
+
app = flask.Flask(__name__)
|
| 9 |
+
flask_cors.CORS(app)
|
| 10 |
+
|
| 11 |
+
# creates a API endpoint for the password input
|
| 12 |
+
@app.route('/messages', methods=['POST'])
|
| 13 |
+
def password():
|
| 14 |
+
nameIn = flask.request.get_json()['nameInput']
|
| 15 |
+
messageIn = flask.request.get_json()['messageInput']
|
| 16 |
+
|
| 17 |
+
n = len(messageArray)
|
| 18 |
+
|
| 19 |
+
messageArray.update({"message "+str(n): [nameIn, messageIn]})
|
| 20 |
+
|
| 21 |
+
data = {
|
| 22 |
+
'messages': messageArray
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
return flask.jsonify(data)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
if __name__ == "__main__":
|
| 31 |
+
app.run(debug=True,host="0.0.0.0",port=5000)
|