started refactoring index and download page

This commit is contained in:
Jfriedli 2021-03-18 11:35:04 +01:00
parent 7f253f7186
commit 81780062ae
3 changed files with 134 additions and 111 deletions

View File

@ -1,39 +1,45 @@
<!doctype html>
<html lang="en">
<head>
<title>MAT2</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{ url_for('static', filename='raleway.woff2') }}" as="font" type="font/woff2" rel="preload">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}">
{% assets 'css' %}
<link rel="stylesheet" href="{{ ASSET_URL }}">
{% endassets %}
</head>
<head>
<title>MAT2</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{ url_for('static', filename='raleway.woff2') }}" as="font" type="font/woff2" rel="preload">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}">
{% assets 'css' %}
<link rel="stylesheet" href="{{ ASSET_URL }}">
{% endassets %}
</head>
<body class="flex flex-col h-screen justify-between">
<header class="h-20 w-full bg-blue-100 my-0 flex justify-center">
<a href='.' class="mt-8">
<img class='max-h-28' src="{{ url_for('static', filename='logo.png') }}" alt="mat2 logo"/>
<img class='max-h-28' src="{{ url_for('static', filename='logo.png') }}" alt="mat2 logo" />
</a>
</header>
<div class="container h-10 mt-8">
<div>
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
<div>
<p>
{{ message }}
</p>
</div>
{% endfor %}
{% endif %}
{% endwith %}
</div>
</div>
<section class="container mb-auto mx-auto mt-8">
<section class="mb-auto mt-8 pt-8">
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
<div class="text-white px-6 py-4 border-0 rounded relative mb-4 bg-red-500">
<span class="text-xl inline-block mr-5 align-middle">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</span>
<span class="inline-block align-middle mr-8">
{{ message }}
</span>
</div>
{% endfor %}
{% endif %}
{% endwith %}
{% block content %}{% endblock %}
</section>
@ -42,4 +48,4 @@
<a href='https://0xacab.org/jvoisin/mat2-web'>source</a> -
</footer>
</body>
</body>

View File

@ -1,69 +1,86 @@
{% extends "base.html" %}
{% block content %}
<div class="shadowed-box u-text-center u-center-block">
<h2 class="uk-text-center">Metadata removed</h2>
{% if not meta_after %}
<p class="uk-text-center">
Successfully removed the metadata
</p>
{% endif %}
<div class="uk-flex uk-flex-center">
<div>
<a class="uk-flex-1" href='{{ download_uri }}'>
<button class="uk-button uk-button-primary">
⇩ download cleaned file
</button>
</a>
<div class="grid grid-rows-1 w-50">
<div class="flex justify-center">
<div class="rounded overflow-hidden shadow-lg p-4">
{% if not meta_after %}
<div class="px-6 py-4 grid grid-rows-1">
<h1 class="font-bold text-xl mb-2">Metadata removed</h1>
</div>
</div>
<p>
{% if meta_after %}
<div class="uk-alert uk-alert-warning" uk-alert>
<p>
<b>Could not</b> remove all the metadata
</p>
</div>
<h3>
Remaining Metadata
</h3>
<dl class="uk-description-list uk-description-list-divider">
{% for key, value in meta_after.items() %}
<dt>
{{ key }}
</dt>
<dd>
{{ value }}
</dd>
{% endfor %}
</dl>
{% endif %}
</p>
{% if meta %}
<h3>
Removed Metadata
</h3>
<dl class="uk-description-list uk-description-list-divider">
{% for key, value in meta.items() %}
<dt>
{{ key }}
</dt>
<dd>
{{ value }}
</dd>
{% endfor %}
</dl>
{% else %}
<div class="uk-alert uk-alert-success">
<p>
Not a single metadata was found, odds are that your file was already clean!
<p class="text-gray-700 text-base text-center">
Successfully removed the metadata
<svg class="max-h-40 fill-current text-green-600" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
fill="currentColor">
<path fill-rule="evenodd"
d="M2.166 4.999A11.954 11.954 0 0010 1.944 11.954 11.954 0 0017.834 5c.11.65.166 1.32.166 2.001 0 5.225-3.34 9.67-8 11.317C5.34 16.67 2 12.225 2 7c0-.682.057-1.35.166-2.001zm11.541 3.708a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
clip-rule="evenodd" />
</svg>
</p>
{% endif %}
{% if meta_after %}
<div class="px-6 py-4 grid grid-rows-1">
<h1 class="font-bold text-xl mb-2">Metadata partially removed</h1>
</div>
<p class="text-gray-700 text-base text-center">
Could not remove all the metadata
<svg class="max-h-40 fill-current text-yellow-600" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd"
d="M10 1.944A11.954 11.954 0 012.166 5C2.056 5.649 2 6.319 2 7c0 5.225 3.34 9.67 8 11.317C14.66 16.67 18 12.225 18 7c0-.682-.057-1.35-.166-2.001A11.954 11.954 0 0110 1.944zM11 14a1 1 0 11-2 0 1 1 0 012 0zm0-7a1 1 0 10-2 0v3a1 1 0 102 0V7z"
clip-rule="evenodd" />
</svg>
</p>
{% endif %}
<a class="uk-flex-1" href='{{ download_uri }}'>
<button
class="w-full bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded flex justify-center"
>
<svg class="w-4 h-4 mr-2 text-white" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path style="fill: white" d="M13 8V2H7v6H2l8 8 8-8h-5zM0 18h20v2H0v-2z" />
</svg>
<span>Download Cleaned File</span>
</button>
</a>
</div>
{% endif %}
</div>
{% endblock %}
{% if meta_after %}
<div class="mx-auto w-full">
<div class="bg-white shadow-md rounded my-6">
<table class="text-left w-full border-collapse">
<div class="px-6 py-4 grid grid-rows-1">
<h1 class="font-bold text-xl mb-2">Remaining Metadata</h1>
</div>
<thead>
<tr>
<th
class="py-4 px-6 bg-grey-lightest font-bold uppercase text-sm text-grey-dark border-b border-grey-light">
Key
</th>
<th
class="py-4 px-6 bg-grey-lightest font-bold uppercase text-sm text-grey-dark border-b border-grey-light">
Value
</th>
</tr>
</thead>
<tbody>
{% for key, value in meta_after.items() %}
<tr class="hover:bg-grey-lighter">
<td class="py-4 px-6 border-b border-grey-light">
{{ key }}
</td>
<td class="py-4 px-6 border-b border-grey-light">
{{ value }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -1,26 +1,26 @@
{% extends "base.html" %}
{% block content %}
<div class="flex justify-center">
<div class="max-w-lg rounded overflow-hidden shadow-lg pb-4">
<div class="px-6 py-4">
<div class="font-bold text-xl mb-2">Remove Metadata</div>
<p class="text-gray-700 text-base">
<div class="flex justify-center">
<div class="w-50 rounded overflow-hidden shadow-lg pb-4">
<div class="px-6 py-4">
<div class="font-bold text-xl mb-2">Remove Metadata</div>
<p class="text-gray-700 text-base">
The file you see is just the tip of the iceberg. Remove the hidden metadata.
</p>
</div>
<div class="px-6 pt-4 pb-2 grid grid-rows-1">
<form method="post" enctype="multipart/form-data" class="grid grid-rows-1">
<input type="file" name="file" id="upload_file" accept="{{ mimetypes | join(', ') }}">
<button class="mt-4 bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" type="submit" value="Upload">Remove Metadata</button>
</form>
</div>
</div>
</div>
<div class="px-6 pt-4 pb-2 grid grid-rows-1">
<form method="post" enctype="multipart/form-data" class="grid grid-rows-1">
<input type="file" name="file" id="upload_file" accept="{{ mimetypes | join(', ') }}">
<button class="mt-4 bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" type="submit"
value="Upload">Remove Metadata</button>
</form>
</div>
</div>
<button
class="p-0 w-10 h-10 absolute sm:bottom-8 md:bottom-16 sm:right-8 md:right-16 bg-blue-300 hover:bg-blue-400 rounded-full active:shadow-lg mouse shadow transition ease-in duration-200 focus:outline-none"
>
<a href="/info" role="link" class="w-6 h-6 text-white inline-block font-bold">
?
</a>
</button>
{% endblock %}
</div>
<button
class="p-0 w-10 h-10 absolute sm:bottom-8 md:bottom-16 sm:right-8 md:right-16 bg-blue-300 hover:bg-blue-400 rounded-full active:shadow-lg mouse shadow transition ease-in duration-200 focus:outline-none">
<a href="/info" role="link" class="w-6 h-6 text-white inline-block font-bold">
?
</a>
</button>
{% endblock %}