From f736904c45fa7569d51c7a4f7d701f2d13fd969b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Verhelst?= Date: Mon, 3 Dec 2018 21:32:21 +0100 Subject: [PATCH 1/3] Don't forget href when doing links --- client/templates/index.html | 2 +- node.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/templates/index.html b/client/templates/index.html index 31c34a8..d31aadf 100644 --- a/client/templates/index.html +++ b/client/templates/index.html @@ -37,7 +37,7 @@

TORrents client

- + diff --git a/node.py b/node.py index 605c975..ef8331b 100644 --- a/node.py +++ b/node.py @@ -189,10 +189,11 @@ def forward_upstream(self, message, colour): # for the tracker if "FSID" in decoded_payload: return self.transmit_to_bridge(decoded_payload, colour) - # If we pass here, then we should just forward upstream - elif "type" in decoded_payload: - if decoded_payload["type"] == "teardown": - self.teardown(message["CID"]) + # If the message is a teardown message + elif "type" in decoded_payload and decoded_payload["type"] == "teardown": + self.teardown(message["CID"]) + + # If we pass here, then we should just forward upstream except (UnicodeDecodeError, json.decoder.JSONDecodeError) as e: # A decoding exception occurred, just forward upstream From a87cef7a6078881a2be2f9171fcb4a2cd329d306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Requena=20L=C3=B3pez?= Date: Mon, 3 Dec 2018 23:03:49 +0100 Subject: [PATCH 2/3] removed unused imports --- client.py | 3 ++- node.py | 2 -- tracker.py | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client.py b/client.py index 91bd825..3e6dc03 100644 --- a/client.py +++ b/client.py @@ -4,7 +4,6 @@ import json from flask import Flask, render_template, request, redirect from random import sample -import sys from common.hash import hash_payload from crypto.rsa import rsa_encrypt, rsa_decrypt @@ -15,10 +14,12 @@ from common.network_info import tracker, node_pool, public_keys, cid_size, get_url, domain_names from common.encoding import json_to_bytes, bytes_to_json + class SignatureNotMatching(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) + class Client(Flask): def __init__(self, name, filenames): diff --git a/node.py b/node.py index ef8331b..f62d14e 100644 --- a/node.py +++ b/node.py @@ -1,9 +1,7 @@ -import traceback import os import argparse import requests from flask import Flask, request, render_template -from midict import MIDict import json from common.encoding import bytes_to_json, json_to_bytes diff --git a/tracker.py b/tracker.py index c5eb27f..eca4023 100644 --- a/tracker.py +++ b/tracker.py @@ -1,7 +1,7 @@ import os import requests from random import choice -from flask import Flask, render_template, request, abort +from flask import Flask, render_template, request from common.network_info import cid_size, get_url, domain_names from common.encoding import json_to_bytes, bytes_to_json from crypto.random_bytes import generate_bytes @@ -136,5 +136,6 @@ def teardown(self, cid): for file in to_be_removed: del self.files[file] + tracker = Tracker() tracker.run(host='0.0.0.0', use_reloader=False) From bdc2d5ad15e612d52866962a1e58bddf5257f991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Requena=20L=C3=B3pez?= Date: Mon, 3 Dec 2018 23:06:05 +0100 Subject: [PATCH 3/3] onion disconnect not working - removing --- client/templates/index.html | 5 ----- 1 file changed, 5 deletions(-) diff --git a/client/templates/index.html b/client/templates/index.html index d31aadf..9208eb4 100644 --- a/client/templates/index.html +++ b/client/templates/index.html @@ -37,11 +37,6 @@

TORrents client

- - - {% else %}