Browse Source

init

master
jgart 6 months ago
parent
commit
b53ffa5305
  1. 28
      app.py
  2. 573
      static/styles/base.css
  3. 48
      templates/result.html
  4. 49
      templates/upload.html

28
app.py

@ -0,0 +1,28 @@
from flask import Flask, render_template, request
app = Flask(__name__)
def check_if_crlf_in_file(file_name) -> bool:
""" Check if any line in the file contains a CRLF character"""
with open(file_name, "rb") as read_obj:
for line in read_obj:
if b"\r\n" in line:
return True
@app.route("/")
def upload_file():
return render_template("upload.html")
@app.route("/uploader", methods=["GET", "POST"])
def check_file():
if request.method == "POST":
f = request.files["file"]
# check_if_crlf_in_file(f)
return render_template("result.html")
if __name__ == "__main__":
app.run(debug=True)

573
static/styles/base.css

@ -0,0 +1,573 @@
* {
box-sizing: border-box; }
html {
line-height: 1.15;
-webkit-text-size-adjust: 100%; }
body {
margin: 0; }
main {
display: block; }
h1 {
font-size: 2em;
margin: 0.67em 0; }
hr {
box-sizing: content-box;
height: 0;
overflow: visible; }
pre {
font-family: monospace, monospace;
font-size: 1em; }
a {
font-weight: bold;
background-color: transparent;
text-decoration: none;
}
abbr[title] {
border-bottom: none;
text-decoration: underline;
text-decoration: underline dotted; }
b,
strong {
font-weight: bolder; }
code,
kbd,
samp {
font-family: monospace, monospace;
font-size: 1em; }
small {
font-size: 80%; }
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline; }
sub {
bottom: -0.25em; }
sup {
top: -0.5em; }
img {
border-style: none; }
button,
input,
optgroup,
select,
textarea {
font-family: inherit;
font-size: 100%;
line-height: 1.15;
margin: 0; }
button,
input {
overflow: visible; }
button,
select {
text-transform: none; }
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button; }
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0; }
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText; }
fieldset {
padding: 0.35em 0.75em 0.625em; }
legend {
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal; }
progress {
vertical-align: baseline; }
textarea {
overflow: auto; }
[type="checkbox"],
[type="radio"] {
box-sizing: border-box;
padding: 0; }
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto; }
[type="search"] {
-webkit-appearance: textfield;
outline-offset: -2px; }
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none; }
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit; }
details {
display: block; }
summary {
display: list-item; }
template {
display: none; }
[hidden] {
display: none; }
@media (prefers-color-scheme: dark) {
html {
background: #212529;
color: #fff; } }
body {
font-family: Helvetica Neue, Menlo, sans-serif;
padding-bottom: 1rem; }
main, .main {
max-width: 1140px;
margin: 0 auto; }
table.grid {
width: 100%;
border-collapse: collapse;
margin: 0 -1rem; }
table.grid td {
vertical-align: top;
padding: 0 1rem;
width: 8.3333333333%; }
table.grid td[colspan="1"] {
width: 8.3333333333%; }
table.grid td[colspan="2"] {
width: 16.6666666667%; }
table.grid td[colspan="3"] {
width: 25%; }
table.grid td[colspan="4"] {
width: 33.3333333333%; }
table.grid td[colspan="5"] {
width: 41.6666666667%; }
table.grid td[colspan="6"] {
width: 50%; }
table.grid td[colspan="7"] {
width: 58.3333333333%; }
table.grid td[colspan="8"] {
width: 66.6666666667%; }
table.grid td[colspan="9"] {
width: 75%; }
table.grid td[colspan="10"] {
width: 83.3333333333%; }
table.grid td[colspan="11"] {
width: 91.6666666667%; }
table.grid td[colspan="12"] {
width: 100%; }
@supports (display: flex) {
table.grid {
display: flex; }
table.grid tbody {
display: flex;
flex-grow: 1;
flex-direction: column; }
table.grid tr {
display: flex; }
table.grid td {
display: block; } }
.dl, article dl {
text-align: left;
margin-left: 0; }
.dt, article dt {
font-weight: normal;
padding: 0; }
.blockquote, article blockquote {
margin-left: -1rem;
margin-left: calc(-4px - 1rem);
padding-left: 1rem;
border-left: solid 4px #ced4da; }
@media (prefers-color-scheme: dark) {
.blockquote, article blockquote {
border-left: solid 4px #6c757d; } }
.figure, article figure {
margin: 0; }
.figure img, article figure img {
display: block;
max-width: 80%;
margin: 0 auto; }
.figure figcaption, article figure figcaption {
display: block;
text-align: center;
margin: 0 auto;
font-size: 0.9rem;
max-width: 70%; }
.aside, article aside {
float: right;
max-width: 40%;
padding-left: 1rem;
margin-left: 1rem;
border-left: solid 4px #ced4da; }
@media (prefers-color-scheme: dark) {
.aside, article aside {
border-left: solid 4px #6c757d; } }
.pre, article pre {
background: #e9ecef;
margin: 0 -1rem;
/* padding: 1rem; } */
padding: 1rem; }
@media (prefers-color-scheme: dark) {
.pre, article pre {
background: #131618; } }
.table, article table {
width: 100%;
border-collapse: collapse; }
.table th, article table th {
text-align: left;
border-bottom: solid 1px #131618; }
@media (prefers-color-scheme: dark) {
.table th, article table th {
border-bottom: solid 1px #fff; } }
a, .link, .tabs h1 a, .tabs h2 a, .tabs h3 a, .tabs h4 a, .tabs h5 a {
color: #336699; }
/* color: #007bff; } */
a:hover, .link:hover, .tabs h1 a:hover, .tabs h2 a:hover, .tabs h3 a:hover, .tabs h4 a:hover, .tabs h5 a:hover {
text-decoration: none; }
a:active, .link:active, .tabs h1 a:active, .tabs h2 a:active, .tabs h3 a:active, .tabs h4 a:active, .tabs h5 a:active {
color: #0062cc; }
a:visited, .link:visited, .tabs h1 a:visited, .tabs h2 a:visited, .tabs h3 a:visited, .tabs h4 a:visited, .tabs h5 a:visited {
color: #004a99; }
@media (prefers-color-scheme: dark) {
a, .link, .tabs h1 a, .tabs h2 a, .tabs h3 a, .tabs h4 a, .tabs h5 a {
color: #3395ff; }
a:active, .link:active, .tabs h1 a:active, .tabs h2 a:active, .tabs h3 a:active, .tabs h4 a:active, .tabs h5 a:active {
color: #006fe6; }
a:visited, .link:visited, .tabs h1 a:visited, .tabs h2 a:visited, .tabs h3 a:visited, .tabs h4 a:visited, .tabs h5 a:visited {
color: #006fe6; } }
h1 small {
font-size: 1.2rem; }
del {
color: inherit; }
hr {
border: #ced4da solid 1px; }
@media (prefers-color-scheme: dark) {
hr {
border: #6c757d solid 1px; } }
.align-center {
text-align: center; }
.align-left {
text-align: left; }
.align-right {
text-align: right; }
.block {
display: block !important; }
.inline {
display: inline !important; }
.float-left {
float: left; }
.float-right {
float: right; }
.text-info {
color: #17a2b8; }
.text-success {
color: #28a745; }
.text-danger {
color: #dc3545; }
.text-muted, form .help, input[disabled] + label {
color: #343a40; }
@media (prefers-color-scheme: dark) {
.text-muted, form .help, input[disabled] + label {
color: #adb5bd; } }
.alert {
padding: 0.5rem;
border: 1px solid transparent;
margin-bottom: 1rem; }
.alert-danger {
background: #f8d7da;
color: #842029;
border-color: #f5c6cb; }
.btn, button {
display: inline-block;
padding: .1rem .75rem;
background: #e9ecef;
border: #343a40 1px solid;
font-size: 0.9rem;
font-weight: 400;
line-height: 1.5;
cursor: pointer;
color: #131618;
border-radius: 1px; /* rounded button */
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out; }
.btn:hover, button:hover {
text-decoration: none;
background: #f8f9fa;
color: #131618; }
@media (prefers-color-scheme: dark) {
.btn, button {
background: #212529;
color: #fff;
border: #495057 1px solid; }
.btn:hover, button:hover {
background: #131618;
color: #fff; } }
.btn-primary {
border: #001933 1px solid;
background: #007bff;
color: #fff; }
.btn-primary:hover {
background: #0069d9;
color: #fff; }
@media (prefers-color-scheme: dark) {
.btn-primary {
background: #0062cc;
color: #fff;
border: #001933 1px solid; }
.btn-primary:hover {
background: #0069d9;
color: #fff; } }
a.btn {
text-decoration: none;
color: #131618; }
@media (prefers-color-scheme: dark) {
a.btn {
color: #fff; } }
a.btn-primary {
color: #fff; }
@media (prefers-color-scheme: dark) {
a.btn-primary {
color: #fff; } }
.btn.block, button.block {
margin-bottom: 0.5rem; }
.form-field, .form-checkbox {
margin-top: 1rem; }
label {
display: block; }
.genenetwork-button
{
font-size: 12px;
background-color: #336699;
color: #fff;
}
.input-genenetwork {
display: block;
width: 100%;
/* border: 1px solid #336699; */
border: 0px;
padding: .375rem;
font-size: 1rem;
line-height: 1.5;
/* background-color: #336699; */
background-clip: padding-box;
border-color: #ffffff;
/* transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out; */
border-radius: 4px; } /* rounded buttons for form like genenetwork.org */
input, textarea, select {
display: block;
width: 100%;
border: 1px solid #888;
padding: .375rem;
font-size: 1rem;
line-height: 1.5;
background-color: #ffffff
background-clip: padding-box;
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
border-radius: 4px; } /* rounded buttons for form like genenetwork.org */
input:focus, textarea:focus, select:focus {
outline: 0;
border-color: #80bdff;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); }
@media (prefers-color-scheme: dark) {
input, textarea, select {
/* background: #131618; */
background: #336699;
color: #fff;
border-color: #6c757d; }
input:active, input:focus, textarea:active, textarea:focus, select:active, select:focus {
background: #212529;
color: #fff; }
input[disabled], input[readonly], textarea[disabled], textarea[readonly], select[disabled], select[readonly] {
background: #212529;
color: #ced4da; } }
.has-error input, .has-error textarea, .has-error select {
border-color: #dc3545; }
.has-error .error {
color: #dc3545; }
tr:first-child td .form-field:first-child {
margin-top: 0; }
button {
display: block; }
button.block {
width: 100%; }
.form-checkbox input[type="checkbox"],
.form-checkbox input[type="radio"] {
float: left;
width: 1em;
height: 1em;
margin-top: 0.1rem;
margin-right: 0.25rem;
vertical-align: top; }
.form-checkbox label {
display: inline-block; }
.form-checkbox.inline {
display: inline-block !important;
margin-right: 1rem; }
fieldset {
border: none;
padding: 0;
margin-top: 1rem; }
.inset, .infobox {
background: #f8f9fa;
padding: 1rem; }
@media (prefers-color-scheme: dark) {
.inset, .infobox {
background: #131618; } }
.infobox header {
margin-bottom: 1rem; }
.infobox :not(header) {
margin: 0; }
nav, .nav {
max-width: 1140px;
padding: 4px;
background-color: #336699; /* gn blue */
margin: 1rem auto; }
nav ul, .nav ul {
display: inline;
margin: 0 -0.5rem;
padding-left: 1rem; }
nav li, .nav li {
display: inline;
margin: 0 0.5rem; }
nav a, nav a:visited, .nav a, .nav a:visited {
color: #ffffff; }
/* color: #131618; } */
@media (prefers-color-scheme: dark) {
nav a, nav a:visited, .nav a, .nav a:visited {
color: #fff; } }
nav .active a, nav .active a:visited, .nav .active a, .nav .active a:visited {
color: #007bff; }
@media (prefers-color-scheme: dark) {
nav .active a, nav .active a:visited, .nav .active a, .nav .active a:visited {
color: #3395ff; } }
nav .brand a, .nav .brand a {
text-decoration: none; }
nav .right, .nav .right {
float: right; }
.tabs:not(.tabs-aside) {
border-bottom: solid 3px #ced4da; }
@media (prefers-color-scheme: dark) {
.tabs:not(.tabs-aside) {
border-bottom: solid 3px #131618; } }
.tabs nav {
margin: 0 auto;
position: relative; }
.tabs h1, .tabs h2, .tabs h3, .tabs h4, .tabs h5 {
display: inline;
margin-right: 1rem;
font-weight: normal; }
.tabs ul {
display: inline;
margin: 0 -0.5rem;
padding-left: 0;
position: absolute;
bottom: 0; }
.tabs li {
display: inline;
margin: 0; }
.tabs li a {
padding: 0 1rem; }
.tabs li.active, .tabs li:hover {
background: #ced4da; }
@media (prefers-color-scheme: dark) {
.tabs li.active, .tabs li:hover {
background: #131618; } }
.tabs li.active a, .tabs li:hover a {
color: #131618; }
@media (prefers-color-scheme: dark) {
.tabs li.active a, .tabs li:hover a {
color: #fff; } }
.tabs a {
text-decoration: none; }
.tabs aside {
background: #ced4da;
padding: 0.2rem 0; }
@media (prefers-color-scheme: dark) {
.tabs aside {
background: #131618; } }
.tabs aside p {
margin: 0 auto;
max-width: 1140px; }
header + main {
margin-top: 1rem; }

48
templates/result.html

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload File</title>
<link rel="stylesheet" href="/static/styles/base.css"/>
</head>
<style>
h1 {
text-align: center;
font-size: 32px;
}
p {
text-align: center;
font-size: 32px;
}
div {text-align: center;}
.diff-file > pre {
margin: 0;
}
.diff-file > pre:first-child {
margin: 0 1rem 1rem;
}
.diff-file a {
text-decoration: none;
}
</style>
<nav>
<ul>
<li style="width: 200px;margin:0 auto;"><a class="nav a" href="http://genenetwork.org/" target="_blank">GeneNetwork</a></li>
</ul>
</nav>
<body>
<p>File contains no CRLF characters.</p>
<p>Thank you for your submission!</p>
</body>
</main>

49
templates/upload.html

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload File</title>
<link rel="stylesheet" href="/static/styles/base.css"/>
<style>
h1 {text-align: center;}
p {text-align: center;}
div {text-align: center;}
.diff-file > pre {
margin: 0;
}
.diff-file > pre:first-child {
margin: 0 1rem 1rem;
}
.diff-file a {
text-decoration: none;
}
</style>
<nav>
<ul>
<li style="width: 200px;margin:0 auto;"><a class="nav a" href="http://genenetwork.org/" target="_blank">GeneNetwork</a></li>
</ul>
</nav>
&nbsp;
&nbsp;
&nbsp;
<main>
<body>
<!--<div class="input-genenetwork">-->
<div class="form-field">
<form action = "http://localhost:5000/uploader" method = "POST"
enctype = "multipart/form-data">
<input type="file" name="file" />
<input type="submit" class="genenetwork-button"/>
</form>
</div>
</body>
</main>
Loading…
Cancel
Save