From 4cf86b35d5287a6a737185d400523c29cffe6751 Mon Sep 17 00:00:00 2001 From: Yamozha Date: Fri, 5 Feb 2021 00:57:59 +0200 Subject: [PATCH] removed --- .../__pycache__/databasefornow.cpython-36.pyc | Bin 393 -> 0 bytes Server/currency.txt | 1 - Server/databasefornow.py | 7 ---- Server/websocketServer.py | 39 ------------------ Website/css/home.css | 35 ---------------- Website/index.html | 18 -------- Website/scripts/Cookies.js | 1 - Website/scripts/getCurrentCoins.js | 37 ----------------- 8 files changed, 138 deletions(-) delete mode 100644 Server/__pycache__/databasefornow.cpython-36.pyc delete mode 100644 Server/currency.txt delete mode 100644 Server/databasefornow.py delete mode 100644 Server/websocketServer.py delete mode 100644 Website/css/home.css delete mode 100644 Website/index.html delete mode 100644 Website/scripts/Cookies.js delete mode 100644 Website/scripts/getCurrentCoins.js diff --git a/Server/__pycache__/databasefornow.cpython-36.pyc b/Server/__pycache__/databasefornow.cpython-36.pyc deleted file mode 100644 index 88fdde9712271042c6fd8b651d0aecc4f2b00033..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 393 zcmYjN%TB{E5L`Qbgou6shy&MLa9XYiAzBF`q+B8n_=Ib_G)fy+c3KovZit_NAK+`? zoGX99iFE{swPrN(?2gtx9t@)AkNw+s0Qf}wRe9`@U rj^DnA1SG;^`>4`5u>N({o9#`z#Xs@`O?a|2YQ4~>{zshe#RU2dwfbEv diff --git a/Server/currency.txt b/Server/currency.txt deleted file mode 100644 index 8ae1164a..00000000 --- a/Server/currency.txt +++ /dev/null @@ -1 +0,0 @@ -6969 diff --git a/Server/databasefornow.py b/Server/databasefornow.py deleted file mode 100644 index 910686fe..00000000 --- a/Server/databasefornow.py +++ /dev/null @@ -1,7 +0,0 @@ -userNames = {"1":"boyan", "2":"nikola"} -usersCoins = {"1":"200", "2":"100"} - -def checkBalance(ID): - userName = userNames[f"{ID}"] - userCoins = usersCoins[f"{ID}"] - return userName, userCoins diff --git a/Server/websocketServer.py b/Server/websocketServer.py deleted file mode 100644 index d40f6b35..00000000 --- a/Server/websocketServer.py +++ /dev/null @@ -1,39 +0,0 @@ -import asyncio -import websockets -import logging -from ratelimit import limits -import time -from databasefornow import * - -logger = logging.getLogger('websockets') -logger.setLevel(logging.INFO) -logger.addHandler(logging.StreamHandler()) - -print("Ready") - -# calls in number of requests -# period in seconds -@limits(calls=20, period=5) -async def serveStuff(websocket, path): - requestText = await websocket.recv() - print(requestText) - if requestText == "STATUSONCOIN": - file = open("currency.txt","r") - currencyStatus = file.readline() - file.close() - await websocket.send(currencyStatus) - - # bad way to send balance to given user - FIX!!! - elif requestText == "STATUSONUSER": - name, balance = checkBalance("1") - print(name) - await websocket.send(f"Your balance is: {balance}") - await websocket.send(f"Welcome, {name}!") - else: - await websocket.send("We don't accept DoS") - - -start_server = websockets.serve(serveStuff, "localhost", 8765) - -asyncio.get_event_loop().run_until_complete(start_server) -asyncio.get_event_loop().run_forever() diff --git a/Website/css/home.css b/Website/css/home.css deleted file mode 100644 index 82b65800..00000000 --- a/Website/css/home.css +++ /dev/null @@ -1,35 +0,0 @@ -@import url(https://fonts.googleapis.com/css?family=Roboto:300); - -:root { - --base-grid: 8px; - --colour-white: #fff; - --colour-black: #1a1a1a; -} -@viewport { - width: device-width ; - zoom: 1.0 ; -} - -*, -:after, -:before { - box-sizing: border-box; -} - -html { - margin: 0; - padding: 0; - background-position: 100%; -} - -body { - position: absolute; - left: 50%; - margin-right: -50%; - transform: translate(-50%, -50%); - top: 50%; - font-size: 1.2em; - font-family: 'Roboto', sans-serif; - line-height: 1.4; - -} diff --git a/Website/index.html b/Website/index.html deleted file mode 100644 index 72940815..00000000 --- a/Website/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - Currency site - - -

This is where you'll see the thing

- -
-

Your balance is:

-

- - - diff --git a/Website/scripts/Cookies.js b/Website/scripts/Cookies.js deleted file mode 100644 index 1983dbd1..00000000 --- a/Website/scripts/Cookies.js +++ /dev/null @@ -1 +0,0 @@ -document.cookie = "id=1"; diff --git a/Website/scripts/getCurrentCoins.js b/Website/scripts/getCurrentCoins.js deleted file mode 100644 index d8fe0728..00000000 --- a/Website/scripts/getCurrentCoins.js +++ /dev/null @@ -1,37 +0,0 @@ -socketAdress="ws://localhost:8765" -// Lacking protocol for ids lmao -document.cookie = "id=2"; - -function currencyTicker(){ - var ws = new WebSocket(socketAdress); - - ws.onopen = function(){ - console.log("Connection is Established"); - ws.send("STATUSONCOIN"); - }; - - ws.onmessage = function(evt) { - var received_msg = evt.data; - w = document.getElementById("odometer").innerHTML = received_msg; - - }; -} - -function userBalance(){ - var ws = new WebSocket(socketAdress); - ws.onopen = function(){ - ws.send("STATUSONUSER"); - }; - - ws.onmessage = function(evt){ - var balanceStatus = evt.data; - // this doesnt work, fix pls - w = document.getElementById("balance").innerHTML = balanceStatus; - ws.onmessage = function(evt){ - w = document.getElementById("username").innerHTML = evt.data; - } - } - -} -var t=setInterval(currencyTicker,5000); -var y=setInterval(userBalance,5000);