Unsupported Page Added
This commit is contained in:
parent
3195c2c689
commit
b267e81b4a
|
@ -27,6 +27,7 @@ def encode():
|
||||||
|
|
||||||
@app.route("/encoding", methods=['POST'])
|
@app.route("/encoding", methods=['POST'])
|
||||||
def encoding():
|
def encoding():
|
||||||
|
try:
|
||||||
file = request.files['origin']
|
file = request.files['origin']
|
||||||
b2c = [int(x) for x in request.form.getlist("b2c")]
|
b2c = [int(x) for x in request.form.getlist("b2c")]
|
||||||
# b2c = [int(request.form['b2c'])]
|
# b2c = [int(request.form['b2c'])]
|
||||||
|
@ -61,6 +62,8 @@ def encoding():
|
||||||
session['txt2'] = "encoded_" + file.filename
|
session['txt2'] = "encoded_" + file.filename
|
||||||
|
|
||||||
return redirect("/encode_result")
|
return redirect("/encode_result")
|
||||||
|
except:
|
||||||
|
return redirect("/unsupported")
|
||||||
|
|
||||||
@app.route('/encode_result')
|
@app.route('/encode_result')
|
||||||
def encode_result():
|
def encode_result():
|
||||||
|
@ -76,6 +79,7 @@ def decode():
|
||||||
|
|
||||||
@app.route("/decoding", methods=['POST'])
|
@app.route("/decoding", methods=['POST'])
|
||||||
def decoding():
|
def decoding():
|
||||||
|
try:
|
||||||
file = request.files['encoded_file']
|
file = request.files['encoded_file']
|
||||||
b2c = [int(x) for x in request.form.getlist("b2c")]
|
b2c = [int(x) for x in request.form.getlist("b2c")]
|
||||||
if file.filename != "":
|
if file.filename != "":
|
||||||
|
@ -96,6 +100,8 @@ def decoding():
|
||||||
session["txt"] = file.filename
|
session["txt"] = file.filename
|
||||||
|
|
||||||
return redirect("/decode_result")
|
return redirect("/decode_result")
|
||||||
|
except:
|
||||||
|
return redirect("/unsupported")
|
||||||
|
|
||||||
@app.route('/decode_result')
|
@app.route('/decode_result')
|
||||||
def decode_result():
|
def decode_result():
|
||||||
|
@ -104,6 +110,10 @@ def decode_result():
|
||||||
else:
|
else:
|
||||||
return redirect("/decode")
|
return redirect("/decode")
|
||||||
|
|
||||||
|
@app.route('/unsupported')
|
||||||
|
def unsupported():
|
||||||
|
return render_template('unsupported.html')
|
||||||
|
|
||||||
@app.route('/get_session')
|
@app.route('/get_session')
|
||||||
def get_session():
|
def get_session():
|
||||||
session_data = dict(session)
|
session_data = dict(session)
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
<title>Decode</title>
|
<title>Decode</title>
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
|
* {
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.drop-zone {
|
.drop-zone {
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
border: 2px dashed #cccccc;
|
border: 2px dashed #cccccc;
|
||||||
|
@ -55,6 +60,7 @@
|
||||||
color: white;
|
color: white;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
margin: 10px auto;
|
margin: 10px auto;
|
||||||
|
@ -63,6 +69,8 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<a style="text-decoration: none; color: white; display: inline-block; padding: 14px 16px; background-color: gray;" href="/">< Back</a>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<form action="/decoding" method="POST" enctype="multipart/form-data">
|
<form action="/decoding" method="POST" enctype="multipart/form-data">
|
||||||
<div class="drop-zone" id="dropZone">
|
<div class="drop-zone" id="dropZone">
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<title>RESULT</title>
|
<title>RESULT</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<a style="text-decoration: none; color: white; display: inline-block; padding: 14px 16px; background-color: gray;" href="/decode">< Back</a>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
@ -16,27 +17,27 @@
|
||||||
$.get('/get_session', function(response) {
|
$.get('/get_session', function(response) {
|
||||||
if(response.hasOwnProperty("image")){
|
if(response.hasOwnProperty("image")){
|
||||||
console.log(response)
|
console.log(response)
|
||||||
var html_content = `<section>
|
var html_content = `<section style="margin: 100px auto; width:50%; height:50%; text-align:center;">
|
||||||
<div>
|
<div style="width:100%; height:100%; text-align:center;">
|
||||||
<h1>Decoded</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Decoded</h1>
|
||||||
<img src="upload/` + response["image"] + `" alt="Image Not Found">
|
<img src="upload/` + response["image"] + `" alt="Image Not Found">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div style="width:100%; height:100%; text-align:center;">
|
||||||
<h1>Secret Text:</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Secret Text:</h1>
|
||||||
<p>` + response["payload"] + `</p>
|
<p style="color: red">` + response["payload"] + `</p>
|
||||||
</div>
|
</div>
|
||||||
</section>`
|
</section>`
|
||||||
$("body").append(html_content)
|
$("body").append(html_content)
|
||||||
}
|
}
|
||||||
else if(response.hasOwnProperty("wav")){
|
else if(response.hasOwnProperty("wav")){
|
||||||
var html_content = `<section>
|
var html_content = `<section style="margin: 100px auto; width:50%; height:50%; text-align:center;">
|
||||||
<h1>Decoded</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Decoded</h1>
|
||||||
<audio controls>
|
<audio controls>
|
||||||
<source src="upload/` + response["wav"] + `" type="audio/wav">
|
<source src="upload/` + response["wav"] + `" type="audio/wav">
|
||||||
Your browser does not support the audio element.
|
Your browser does not support the audio element.
|
||||||
</audio>
|
</audio>
|
||||||
<div>
|
<div>
|
||||||
<h1>Secret Text:</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Secret Text:</h1>
|
||||||
<p>` + response["payload"] + `</p>
|
<p>` + response["payload"] + `</p>
|
||||||
</div>
|
</div>
|
||||||
</section>`
|
</section>`
|
||||||
|
@ -46,13 +47,13 @@
|
||||||
fetch("upload/" + response["txt"])
|
fetch("upload/" + response["txt"])
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
var html_content = `<section>
|
var html_content = `<section style="margin: 100px auto; width:50%; height:50%; text-align:center;">
|
||||||
<div>
|
<div style="width:100%; height:100%; text-align:center;">
|
||||||
<h1>Decoded</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Decoded</h1>
|
||||||
<textarea>` + data + `</textarea>
|
<textarea style="height:75%; width:90%; padding: 5%">` + data + `</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div style="width:100%; height:100%; text-align:center;">
|
||||||
<h1>Secret Text:</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Secret Text:</h1>
|
||||||
<p>` + response["payload"] + `</p>
|
<p>` + response["payload"] + `</p>
|
||||||
</div>
|
</div>
|
||||||
</section>`
|
</section>`
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
<title>Encode</title>
|
<title>Encode</title>
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
|
*{
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.drop-zone {
|
.drop-zone {
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
border: 2px dashed #cccccc;
|
border: 2px dashed #cccccc;
|
||||||
|
@ -65,6 +70,8 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<a style="text-decoration: none; color: white; display: inline-block; padding: 14px 16px; background-color: gray;" href="/">< Back</a>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<form action="/encoding" method="POST" enctype = "multipart/form-data">
|
<form action="/encoding" method="POST" enctype = "multipart/form-data">
|
||||||
<div class="drop-zone" id="dropZone">
|
<div class="drop-zone" id="dropZone">
|
||||||
|
|
|
@ -6,8 +6,20 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
<title>RESULT</title>
|
<title>RESULT</title>
|
||||||
|
<style>
|
||||||
|
*{
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<a style="text-decoration: none; color: white; display: inline-block; padding: 14px 16px; background-color: gray;" href="/encode">< Back</a>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
@ -16,13 +28,13 @@
|
||||||
$.get('/get_session', function(response) {
|
$.get('/get_session', function(response) {
|
||||||
if(response.hasOwnProperty("image")){
|
if(response.hasOwnProperty("image")){
|
||||||
console.log(response)
|
console.log(response)
|
||||||
var html_content = `<section style="display: flex; justify-content: flex-start;">
|
var html_content = `<section style="margin: 100px auto; width:50%; height:50%; display: flex; justify-content: space-between;">
|
||||||
<div>
|
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
|
||||||
<h1>Original</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Original</h1>
|
||||||
<img src="upload/` + response["image"] + `" alt="Image Not Found">
|
<img src="upload/` + response["image"] + `" alt="Image Not Found">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
|
||||||
<h1>Encoded</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Encoded</h1>
|
||||||
<img src="upload/` + response["image2"] + `" alt="Image Not Found">
|
<img src="upload/` + response["image2"] + `" alt="Image Not Found">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -30,16 +42,16 @@
|
||||||
$("body").append(html_content)
|
$("body").append(html_content)
|
||||||
}
|
}
|
||||||
else if(response.hasOwnProperty("wav")){
|
else if(response.hasOwnProperty("wav")){
|
||||||
var html_content = `<section style="display: flex; justify-content: flex-start;">
|
var html_content = `<section style="margin: 100px auto; width:50%; height:50%; display: flex; justify-content: space-between;">
|
||||||
<div>
|
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
|
||||||
<h1>Original</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Original</h1>
|
||||||
<audio controls>
|
<audio controls>
|
||||||
<source src="upload/` + response["wav"] + `" type="audio/wav">
|
<source src="upload/` + response["wav"] + `" type="audio/wav">
|
||||||
Your browser does not support the audio element.
|
Your browser does not support the audio element.
|
||||||
</audio>
|
</audio>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
|
||||||
<h1>Encoded</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Encoded</h1>
|
||||||
<audio controls>
|
<audio controls>
|
||||||
<source src="upload/` + response["wav2"] + `" type="audio/wav">
|
<source src="upload/` + response["wav2"] + `" type="audio/wav">
|
||||||
Your browser does not support the audio element.
|
Your browser does not support the audio element.
|
||||||
|
@ -56,14 +68,14 @@
|
||||||
fetch("upload/" + response["txt2"])
|
fetch("upload/" + response["txt2"])
|
||||||
.then(res2 => res2.text())
|
.then(res2 => res2.text())
|
||||||
.then(data2 => {
|
.then(data2 => {
|
||||||
var html_content = `<section style="display: flex; justify-content: flex-start;">
|
var html_content = `<section style="margin: 100px auto; width:50%; height:50%; display: flex; justify-content: space-between;">
|
||||||
<div>
|
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
|
||||||
<h1>Original</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Original</h1>
|
||||||
<textarea>` + data + `</textarea>
|
<textarea style="height:77%; width:100%">` + data + `</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
|
||||||
<h1>Encoded</h1>
|
<h1 style="height:15%; width:90%; padding: 5%">Encoded</h1>
|
||||||
<textarea>` + data2 + `</textarea>
|
<textarea style="height:77%; width:100%">` + data2 + `</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</section>`
|
</section>`
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>File Unsupported</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
text-align: center;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 30px;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #333;
|
||||||
|
font-size: 28px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
color: #777;
|
||||||
|
font-size: 18px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: red;
|
||||||
|
margin: 0px auto;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 60px;
|
||||||
|
color: white;
|
||||||
|
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon::before {
|
||||||
|
content: "X";
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1>File Unsupported</h1>
|
||||||
|
<p>We're sorry, but the file format you uploaded is not supported.</p>
|
||||||
|
<div class="icon"></div>
|
||||||
|
<a style="text-decoration: none; color: black; display: inline-block; margin: 20px 0px 0px; padding: 14px 16px;" href="#" onclick="history.back()">< Back</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in New Issue