diff --git a/server.py b/server.py index 1e3caae..438eeff 100644 --- a/server.py +++ b/server.py @@ -4,6 +4,7 @@ import json import socket import os import urllib +import re # non standards, in requirements.txt from flask import Flask, request, Markup, render_template, redirect, url_for @@ -52,7 +53,7 @@ class Anonymous_Github: def file_render(file, terms): def removeTerms(content, terms): for term in terms: - content = content.replace(term, "XXX") + content = re.compile(term, re.IGNORECASE).sub("XXX", content) return content if file.size > 1000000: @@ -98,7 +99,6 @@ class Anonymous_Github: break return render_template('repo.html', - name=data['name'], terms=data["terms"], current_repository=id, current_file=current_file, @@ -126,7 +126,6 @@ class Anonymous_Github: id = request.args.get('id', str(uuid.uuid4())) repo = request.form['githubRepository'] terms = request.form['terms'] - repo_name = request.form['name'] config_path = self.config_dir + "/" + str(id) if not os.path.exists(config_path): @@ -134,7 +133,6 @@ class Anonymous_Github: with open(config_path + "/config.json", 'w') as outfile: json.dump({ "id": id, - "name": repo_name, "repository": repo, "terms": terms.splitlines() }, outfile) diff --git a/templates/index.html b/templates/index.html index 992d35d..4bb3c72 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,7 +4,7 @@ - + GitHub Anonymous @@ -13,23 +13,18 @@
-

GihHub Anonymous

-

Anonymous a GitHub repository

+

GitHub Anonymous

+

Anonymize a GitHub repository

-
- - - The anonymous name of the repository. -
- The github url to the repository that you want to anonymous. +
- + + One term per line (case insensitive). - One term per line.
@@ -38,13 +33,13 @@
- The id of the Anonymous GitHub repository. +
- The github url to the repository that you want to anonymous. +
diff --git a/templates/repo.html b/templates/repo.html index b789709..47bb02b 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -18,7 +18,7 @@
{% set current_path = [] %} {% do current_path.append('/repository/' + current_repository) %} - {{ name }} + Root {% for item in path %} {% do current_path.append(item) %} {{ item }}