imperialwool commited on
Commit
7bf2558
1 Parent(s): 22e8e9a

is elon musk

Dockerfile CHANGED
@@ -4,10 +4,14 @@ COPY . /app
4
 
5
  WORKDIR /app
6
 
7
- RUN apt update
8
 
9
- RUN apt install ffmpeg python3 python3-pip -y
 
 
 
 
10
 
11
  RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
12
 
13
- CMD ["python3", "app.py"]
 
4
 
5
  WORKDIR /app
6
 
7
+ RUN apt update && apt install ffmpeg software-properties-common -y
8
 
9
+ RUN add-apt-repository ppa:deadsnakes/ppa
10
+
11
+ RUN apt update && apt install python3.11 python3.11-pip
12
+
13
+ RUN sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1
14
 
15
  RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
16
 
17
+ CMD ["python", "app.py"]
requirements.txt CHANGED
@@ -1,7 +1,9 @@
 
1
  flask
2
- flask_limiter
3
- requests
4
  ffmpeg
5
- wget
6
  yt_dlp
7
- urllib3
 
 
 
 
1
+ wget
2
  flask
 
 
3
  ffmpeg
4
+ psutil
5
  yt_dlp
6
+ urllib3
7
+ requests
8
+ py-cpuinfo
9
+ flask_limiter
routes/helpers.py CHANGED
@@ -58,7 +58,15 @@ def thisIsHook(d):
58
  if d['total_bytes'] > 52428800:
59
  print("\nFILE IS BIG, ABORT!!!\n")
60
  raise Exception(f"Too long file (recieved {d['total_bytes']/1048576}MB, max is 50MB)")
61
-
 
 
 
 
 
 
 
 
62
  # Recognizing things
63
  def req(access_token, meth, path, params, **kwargs):
64
  full_url = "https://api.wit.ai" + path
 
58
  if d['total_bytes'] > 52428800:
59
  print("\nFILE IS BIG, ABORT!!!\n")
60
  raise Exception(f"Too long file (recieved {d['total_bytes']/1048576}MB, max is 50MB)")
61
+
62
+ # Get variable from request
63
+ def getFromRequest(request, thing):
64
+ try:
65
+ if request.method == 'POST': thing = request.form['thing']
66
+ else: thing = thing.args['thing']
67
+ return thing
68
+ except: return None
69
+
70
  # Recognizing things
71
  def req(access_token, meth, path, params, **kwargs):
72
  full_url = "https://api.wit.ai" + path
routes/siteRoutes/__init__.py CHANGED
@@ -1 +1,2 @@
1
- from .sigGen import *
 
 
1
+ from .sigGen import *
2
+ from .systemInfo import *
routes/siteRoutes/sigGen.py CHANGED
@@ -4,17 +4,18 @@ import hashlib
4
  from .. import helpers
5
 
6
  def signatureGen(request):
7
- endtime = round(time.time())+604800
8
 
9
- ip = hashlib.md5(request.remote_addr.encode()).hexdigest()
10
- text = f"--START SIGNATURE-- {ip}{endtime} --END SIGNATURE--"
11
- salt = "f u n a p i - s a l t".split(' ')
12
- random.shuffle(salt)
13
- salt = ''.join(salt)
 
14
 
15
- creatorKey = hashlib.md5(f"IP={ip};DATE={time.strftime('%Y-%m-%d')}".encode()).hexdigest()
16
 
17
- key = hashlib.blake2b(text.encode(), key=ip.encode(), salt=salt.encode()).hexdigest().upper()
18
 
19
  config = helpers.configFile()
20
  db = helpers.EazySQLite3(config['signatures-db'])
@@ -24,5 +25,5 @@ def signatureGen(request):
24
  if query['status']:
25
  return {"status": "ok", "result": key, "endtime": endtime}
26
  else:
27
- return {"status": "error", "details": {"error_code": -1, "error_details": "You already got signature"}}
28
 
 
4
  from .. import helpers
5
 
6
  def signatureGen(request):
7
+ endtime = round(time.time())+3600
8
 
9
+ uK = helpers.getFromRequest(request, "key")
10
+ if uK == None: return {"status": "error", "details": {"error_code": -1, "error_details": "No key to generate signature"}}
11
+
12
+ userKey = hashlib.md5(uK.encode()).hexdigest()
13
+ text = f"--START SIGNATURE-- {userKey}{endtime} --END SIGNATURE--"
14
+ salt = hashlib.md5("funapi-salt".encode())
15
 
16
+ creatorKey = hashlib.md5(f"USERKEY={userKey};DATE={time.strftime('%Y-%m-%d')}".encode()).hexdigest()
17
 
18
+ key = hashlib.blake2b(text.encode(), key=userKey.encode(), salt=salt.encode()).hexdigest().upper()
19
 
20
  config = helpers.configFile()
21
  db = helpers.EazySQLite3(config['signatures-db'])
 
25
  if query['status']:
26
  return {"status": "ok", "result": key, "endtime": endtime}
27
  else:
28
+ return {"status": "error", "details": {"error_code": -1, "error_details": "This key already got signature"}}
29
 
routes/siteRoutes/systemInfo.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import psutil
2
+ import cpuinfo
3
+
4
+ def cpu ():
5
+ v = cpuinfo.get_cpu_info()
6
+ cpu_info = {
7
+ 'cpu_brand': v['brand_raw'],
8
+ 'cpu_freq': {
9
+ 'current': float(psutil.cpu_freq()[0]),
10
+ 'min': float(psutil.cpu_freq()[1]),
11
+ 'max': float(psutil.cpu_freq()[2]),
12
+ },
13
+ 'cpu_count': {
14
+ 'all': int(psutil.cpu_count(logical=True)),
15
+ 'exclude_virtual': int(psutil.cpu_count(logical=False))
16
+ },
17
+ 'cpu_load': psutil.cpu_percent()
18
+ }
19
+ return cpu_info
20
+ def mem ():
21
+ mem_info = {
22
+ 'mem_total' : int(psutil.virtual_memory()[0]/1024/1024),
23
+ 'mem_used' : int(psutil.virtual_memory()[3]/1024/1024)
24
+ }
25
+ return mem_info
26
+
27
+ def systemInfo():
28
+ return {"CPU_INFO": cpu(), "MEM_INFO": mem(), "API_VERSION": "1.0 build43"}