Commit d4ab3eae authored by Carola Nitz's avatar Carola Nitz

Wifi:added Wifi-Download from iOS Devices

parent ea17df6a
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WiFi Upload</title>
<title>WiFi Upload/Download</title>
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="jquery.ui.widget.js"></script>
......@@ -25,7 +25,7 @@
<ul></ul>
</div>
<div class="message">
<div class="messageUpload">
<h1>Drop files</h1>
<p>
Drop files in the window to add them to your iOS device. <br>
......@@ -33,6 +33,18 @@
</p>
</div>
<hr>
<div class="messageDownload">
<h1>Dowload files</h1>
<p>
Just click the file you want to download from your iOS device.
</p>
</div>
<ul class="downloads">
%%FILES%%
</ul>
<div id="footer">
<p>VLC for iOS is free, open-source software published by <a href="http://www.videolan.org" target="_blank">VideoLAN</a>. <br />Modification and redistribution is subject to both the <a href="http://opensource.org/licenses/GPL-2.0" target="_blank">GPLv2 (or later)</a> and the <a href="http://opensource.org/licenses/MPL-2.0" target="_blank">MPLv2</a> as well as further rights reserved by the VideoLAN association.<br />You can find the sources to this application <a href="http://git.videolan.org/?p=vlc-ports/ios.git;a=summary" target="_blank">online</a> and more information about licensing in the About dialog included within the app.<br />VLC media player and VideoLAN are trademarks of the VideoLAN Association.</p>
</div>
......
......@@ -147,34 +147,70 @@ div.main.drop {
cursor: pointer;
}
.message {
.messageUpload {
margin: 100px 0px;
}
.message h1 {
.messageUpload h1 {
font-size: 30px;
font-weight: bold;
text-align: center;
text-shadow: 1px 1px 2px black;
line-height: 60px;
}
.message p {
.messageUpload p {
text-align: center;
text-shadow: 1px 1px 2px black;
}
.messageDownload {
margin: 50px 0px;
}
.messageDownload h1 {
font-size: 30px;
font-weight: bold;
text-align: center;
text-shadow: 1px 1px 2px black;
line-height: 60px;
}
.messageDownload p {
text-align: center;
text-shadow: 1px 1px 2px black;
}
.files {
text-align: left;
margin-left: 20px;
text-shadow: 1px 1px 2px black;
line-height: 30px;
}
.uploads li {
height: 80px;
padding: 0 20px;
position: relative;
}
.uploads li:nth-child(2n) {
.uploads li:nth-child(2n),
.downloads li:nth-child(2n) {
background-color: rgba(0,0,0,0.2);
}
.uploads .filename {
.uploads .filename,
.downloads li {
font-size: 20px;
line-height: 50px;
text-align: left;
}
.downloads a {
line-height: 25px;
height: 18px;
color: white;
}
.downloads li {
height: 40px;
padding: 0 20px;
position: relative;
}
.uploads .progress {
height: 20px;
border: 0px solid white;
......
......@@ -20,6 +20,7 @@
#import "HTTPFileResponse.h"
#import "MultipartMessageHeaderField.h"
#import "VLCHTTPUploaderController.h"
#import "HTTPDynamicFileResponse.h"
@interface VLCHTTPConnection()
{
......@@ -95,7 +96,30 @@
// let download the uploaded files
return [[HTTPFileResponse alloc] initWithFilePath: [[config documentRoot] stringByAppendingString:path] forConnection:self];
}
if ([path hasPrefix:@"/download/"]) {
NSString *filePath = [[path stringByReplacingOccurrencesOfString:@"/download/" withString:@""]stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
return [[HTTPFileResponse alloc] initWithFilePath:filePath forConnection:self];
}
NSString *filePath = [self filePathForURI:path];
NSString *documentRoot = [config documentRoot];
NSString *relativePath = [filePath substringFromIndex:[documentRoot length]];
if ([relativePath isEqualToString:@"/index.html"])
{
NSArray *allFiles = [MLFile allFiles];
NSString *fileList = @"";
for (MLFile *file in allFiles) {
NSString *fileHTML = [NSString stringWithFormat:@"<li><a href=\"download/%@\" download>%@</a></li>",[file.url stringByReplacingOccurrencesOfString:@"file://"withString:@""], file.title];
fileList = [fileList stringByAppendingString:fileHTML];
}
NSMutableDictionary *replacementDict = [NSMutableDictionary new];
[replacementDict setObject:fileList forKey:@"FILES"];
return [[HTTPDynamicFileResponse alloc] initWithFilePath:[self filePathForURI:path]
forConnection:self
separator:@"%%"
replacementDictionary:replacementDict];
}
return [super httpResponseForMethod:method URI:path];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment