using handlebars templating engine, refactored server code and storage code

This commit is contained in:
Abhinav Adduri 2017-06-07 16:16:38 -07:00
parent 1ad71904bc
commit f9c2eb1ae4
7 changed files with 331 additions and 149 deletions

47
views/download.handlebars Normal file
View file

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<title>Download your file</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="/bundle.js"></script>
<link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css">
<link rel="stylesheet" type="text/css" href="/main.css" />
</head>
<body>
<div class="main-window">
<div id="download">
{{#if filename}}
<div class="title">
Your friend is sending you a file:
</div>
<span> {{{filename}}} ({{{filesize}}})
<div class="share-window">
<button id="download-btn" onclick="download()">Download File</button>
<img id="expired-img" src="/resources/link_expired.png"/>
</div>
<div class="send-new" id="send-file">
Send your own files
</div>
{{else}}
<div class="title">
This link has expired or never existed in the first place.
</div>
<div class="share-window">
<img src="/resources/link_expired.png"/>
</div>
<div class="send-new" id="send-file">
Send your own files
</div>
{{/if}}
</div>
</div>
<!-- <ul id="downloaded_files">
</ul> -->
</body>
</html>

84
views/index.handlebars Normal file
View file

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html>
<head>
<title>Firefox Fileshare</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="./bundle.js"></script>
<link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css">
<link rel="stylesheet" type="text/css" href="./main.css" />
</head>
<body>
<div class="main-window">
<div id="page-one">
<div class="title">
Share your files quickly, privately and securely.
</div>
<div class="upload-window">
<div id="upload-img"><img src="/resources/upload.svg"/></div>
<div>
DRAG &amp; DROP
</div>
<div class="upload">
<div id="browse-text">
your file/folder here or
</div>
<div id="browse">
<form method="post" action="upload" enctype="multipart/form-data">
<label for="file-upload" class="file-upload">browse</label>
<input id="file-upload" type="file" onchange="onChange(event)" name="fileUploaded" />
</form>
</div>
</div>
</div>
</div>
<div id="file-list">
<table id="uploaded-files">
<tr>
<th width=30%>File</th>
<th width=45%>Copy URL</th>
<th width=18%>Expires in</th>
<th width=7%>Delete</th>
</tr>
<div data-role="popup" id="popupArrow" data-arrow="true">
</table>
</div>
<div id="upload-progress">
<div class="title" id="upload-filename">
Uploading
</div>
<div class="upload-window">
<div id="upload-img"><img src="/resources/upload.svg"/></div>
<div class="upload">
<!-- progress bar here -->
</div>
</div>
</div>
<div id="share-link">
<div class="title">
Copy the link below to share your file!
</div>
<div class="share-window">
<img src="/resources/share.png"/>
<div id="share-window-r">
<div id="copy">
<input id="link" type="url" value="" readonly/>
<button id="copy-btn">Copy</button>
</div>
<div>
This link expires after one download
</div>
</div>
</div>
<div class="send-new">
Send another file
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1 @@
{{{body}}}