mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-13 02:42:45 +00:00
display more file type
This commit is contained in:
28
server.py
28
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("<img src='%s' alt='%s'>" % (file.url, file.name))
|
||||
if ".html" in file.name:
|
||||
return remove_terms(Markup("<pre><code>%s</code></pre>") % 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("<pre>" + file.decoded_content + "</pre>"), 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("<pre><code>%s</code></pre>") % Markup.escape(file.decoded_content),
|
||||
repository_configuration)
|
||||
return Markup("<b>%s has an unknown extension, we are unable to anonymize it (known extensions md/txt/json/java/...)</b>" % (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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.8.0/github-markdown.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
@@ -42,5 +44,8 @@
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js" crossorigin="anonymous"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user