From 433b881ac7eebcb99fe8b6de23d301df19ecb127 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Fri, 27 Oct 2017 10:09:56 +0200 Subject: [PATCH] display more file type --- server.py | 28 ++++++++++++++++++++++------ static/css/style.css | 22 +++++++++++++++++++++- templates/repo.html | 5 +++++ 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/server.py b/server.py index 8f10927..13435cb 100644 --- a/server.py +++ b/server.py @@ -97,10 +97,24 @@ class Anonymous_Github: self.github.render_markdown(file.decoded_content), repository_configuration)) if ".jpg" in file.name or ".png" in file.name or ".png" in file.name or ".gif" in file.name: return Markup("%s" % (file.url, file.name)) - if ".html" in file.name: - return remove_terms(Markup("
%s
") % Markup.escape(file.decoded_content), repository_configuration) - if ".txt" in file.name or ".log" in file.name or ".xml" in file.name or ".json" in file.name or ".java" in file.name or ".py" in file.name: - return remove_terms(Markup("
" + file.decoded_content + "
"), repository_configuration) + if ".txt" in file.name \ + or ".rtf" in file.name \ + or ".log" in file.name \ + or ".csv" in file.name \ + or ".xml" in file.name \ + or ".json" in file.name \ + or ".css" in file.name \ + or ".html" in file.name \ + or ".js" in file.name \ + or ".tex" in file.name \ + or ".java" in file.name \ + or ".php" in file.name \ + or ".c" in file.name \ + or ".h" in file.name \ + or ".lua" in file.name \ + or ".py" in file.name: + return remove_terms(Markup("
%s
") % Markup.escape(file.decoded_content), + repository_configuration) return Markup("%s has an unknown extension, we are unable to anonymize it (known extensions md/txt/json/java/...)" % (file.name)) @application.route('/' + application.killurl, methods=['POST']) @@ -181,10 +195,12 @@ class Anonymous_Github: content_type = 'image/gif' if ".txt" in file_name \ or ".log" in file_name \ - or ".java" in file_name \ - or ".py" in file_name \ + or ".csv" in file_name \ or ".xml" in file_name \ or ".json" in file_name \ + or ".java" in file_name \ + or ".py" in file_name \ + or ".lua" in file_name \ or ".js" in file_name: content_type = 'text/plain; charset=utf-8' if ".xml" in file_name: diff --git a/static/css/style.css b/static/css/style.css index 3f07412..56854bc 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -3,8 +3,12 @@ margin: auto; } +.hljs { + background: #FFFFFF; +} + .files { - border: 1px solid #dddddd; + border: 1px solid #DDDDDD; border-bottom: initial; margin: 15px; border-radius: 5px; @@ -38,4 +42,20 @@ content: '/'; color: #dddddd; padding-left: 4px; +} + + +@media (max-width: 640px) { + .main { + width: 100%; + } + .container-fluid { + padding: 0; + } + .files { + margin: 0; + border-left: 0; + border-right: 0; + border-radius: 0; + } } \ No newline at end of file diff --git a/templates/repo.html b/templates/repo.html index e727b7b..a9d8f6e 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -10,6 +10,8 @@ + + @@ -42,5 +44,8 @@ + + + \ No newline at end of file