Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, request, jsonify # Added missing imports
- import requests
- import json
- import hashlib
- import os
- from datetime import datetime
- app = Flask(__name__)
- webhookUrl = "https://discord.com/api/webhooks/1153559821266722836/QbJlR7xfvcPndTN76NUatcFVENddx14gEEOw1iM9jMOI4DONXuwJFUfWyy_-8EYQF_63"
- webhookUrl2 = "https://discord.com/api/webhooks/1153559821266722836/QbJlR7xfvcPndTN76NUatcFVENddx14gEEOw1iM9jMOI4DONXuwJFUfWyy_-8EYQF_63"
- def loadTitleDataFromFile():
- try:
- with open('titleData.json', 'r') as file:
- return json.load(file)
- except Exception as e:
- print(e)
- return {}
- def saveTitleDataToFile(data):
- with open('titleData.json', 'w') as file:
- json.dump(data, file, indent=2)
- def md5(data):
- return hashlib.md5(data.encode('utf-8')).hexdigest()
- @app.route('/', methods=['GET'])
- def get_title_data():
- global titleData
- print('Title data fetched: ', titleData)
- return jsonify(titleData)
- @app.route('/', methods=['POST'])
- def update_title_data():
- global titleData
- receivedData = request.json['data']
- titleData = receivedData
- saveTitleDataToFile(titleData)
- return jsonify({"message": "Data updated successfully"})
- def get_user_id(ticket):
- filtered_id = ticket[:16].replace("'", "")
- filtered_id2 = filtered_id.replace("-", "")
- filtered_id3 = filtered_id2.replace(".", "")
- return filtered_id3
- @app.route('/api/photon', methods=['POST'])
- def photon_api():
- data = request.json
- user_id = get_user_id(data['Ticket'])
- data["UserId"] = user_id
- app = data['AppId']
- if app != '9D0DF':
- return jsonify({'status': 'error', 'message': 'Unauthorized AppId'})
- if "Nonce" in data:
- nonce = data["Nonce"]
- else:
- nonce = "EMPTY"
- returndata = { # Define returndata outside the if/else block
- "ResultCode": 1,
- "StatusCode": 200,
- "Message": '',
- "result": 0,
- "UserId": user_id,
- "AppId": "9D0DF",
- "Ticket": data['Ticket'],
- "Token": data['Token'],
- "Nonce": nonce
- }
- return jsonify(returndata)
- if __name__ == "__main__":
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement