Commit 53c53077 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Compile HTTP server support for ATV

parent 7cb6d91d
......@@ -37,7 +37,7 @@ CHECKOUT OPTIONS:
:commit: 180f009b3b22d813ca40e4c88074e0ef228c357b
:git: git://github.com/fkuehne/box-ios-sdk-v2.git
CocoaHTTPServer:
:commit: 4369b6542391b444f779d174ec9cc0360be07554
:commit: 570343ea4207c832e08e8d368b5e6faf35307031
:git: git://github.com/fkuehne/CocoaHTTPServer.git
InAppSettingsKit:
:commit: 415ea6bb
......
......@@ -21,11 +21,14 @@
#import "HTTPFileResponse.h"
#import "MultipartMessageHeaderField.h"
#import "HTTPDynamicFileResponse.h"
#import "VLCThumbnailsCache.h"
#import "NSString+SupportedMedia.h"
#import "UIDevice+VLC.h"
#import "VLCHTTPUploaderController.h"
#if TARGET_OS_IOS
#import "VLCThumbnailsCache.h"
#endif
@interface VLCHTTPConnection()
{
MultipartFormDataParser *_parser;
......@@ -96,6 +99,7 @@
if ([method isEqualToString:@"POST"] && [path isEqualToString:@"/upload.json"])
return [[HTTPDataResponse alloc] initWithData:[@"\"OK\"" dataUsingEncoding:NSUTF8StringEncoding]];
#if TARGET_OS_IOS
if ([path hasPrefix:@"/download/"]) {
NSString *filePath = [[path stringByReplacingOccurrencesOfString:@"/download/" withString:@""]stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
HTTPFileResponse *fileResponse = [[HTTPFileResponse alloc] initWithFilePath:filePath forConnection:self];
......@@ -335,6 +339,7 @@
}
}
UIDevice *currentDevice = [UIDevice currentDevice];
NSString *deviceModel = [currentDevice model];
NSDictionary *replacementDict;
......@@ -363,6 +368,27 @@
replacementDictionary:replacementDict];
fileResponse.contentType = @"text/html";
}
#else
#warning FIXME
UIDevice *currentDevice = [UIDevice currentDevice];
NSString *deviceModel = [currentDevice model];
NSString *filePath = [self filePathForURI:path];
NSString *documentRoot = [config documentRoot];
NSString *relativePath = [filePath substringFromIndex:[documentRoot length]];
NSDictionary *replacementDict = @{@"WEBINTF_TITLE" : NSLocalizedString(@"WEBINTF_TITLE", nil),
@"WEBINTF_DROPFILES" : NSLocalizedString(@"WEBINTF_DROPFILES", nil),
@"WEBINTF_DROPFILES_LONG" : [NSString stringWithFormat:NSLocalizedString(@"WEBINTF_DROPFILES_LONG", nil), deviceModel],
@"WEBINTF_DOWNLOADFILES" : NSLocalizedString(@"WEBINTF_DOWNLOADFILES", nil),
@"WEBINTF_DOWNLOADFILES_LONG" : [NSString stringWithFormat: NSLocalizedString(@"WEBINTF_DOWNLOADFILES_LONG", nil), deviceModel]};
HTTPDynamicFileResponse *fileResponse;
if ([relativePath isEqualToString:@"/index.html"]) {
fileResponse = [[HTTPDynamicFileResponse alloc] initWithFilePath:[self filePathForURI:path]
forConnection:self
separator:@"%%"
replacementDictionary:replacementDict];
fileResponse.contentType = @"text/html";
#endif
return fileResponse;
} else if ([relativePath isEqualToString:@"/style.css"]) {
......@@ -454,6 +480,7 @@
- (void)notifyUserAboutEndOfFreeStorage:(NSString *)filename
{
#if TARGET_OS_IOS
VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
message:[NSString stringWithFormat:
NSLocalizedString(@"DISK_FULL_FORMAT", nil),
......@@ -463,6 +490,18 @@
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil];
[alert show];
#else
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"DISK_FULL", nil)
message:[NSString stringWithFormat:
NSLocalizedString(@"DISK_FULL_FORMAT", nil),
filename,
[[UIDevice currentDevice] model]]
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
style:UIAlertActionStyleCancel
handler:nil]];
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertController animated:YES completion:nil];
#endif
}
- (void)processContent:(NSData*)data WithHeader:(MultipartMessageHeader*) header
......
......@@ -16,13 +16,16 @@
#import "VLCHTTPUploaderController.h"
#import "VLCHTTPConnection.h"
#import "VLCActivityManager.h"
#import "VLCMediaFileDiscoverer.h"
#import "HTTPServer.h"
#import "Reachability.h"
#import <ifaddrs.h>
#import <arpa/inet.h>
#if TARGET_OS_IOS
#import "VLCMediaFileDiscoverer.h"
#endif
@interface VLCHTTPUploaderController()
@property(nonatomic, strong) HTTPServer *httpServer;
......@@ -252,7 +255,9 @@
VLCActivityManager *activityManager = [VLCActivityManager defaultManager];
[activityManager networkActivityStopped];
[activityManager activateIdleTimer];
#if TARGET_OS_IOS
[[VLCMediaFileDiscoverer sharedInstance] performSelectorOnMainThread:@selector(updateMediaList) withObject:nil waitUntilDone:NO];
#endif
}
- (void)cleanCache
......
......@@ -45,7 +45,9 @@
kVLCSettingNetworkCaching : kVLCSettingNetworkCachingDefaultValue,
kVLCSettingEqualizerProfile : kVLCSettingEqualizerProfileDefaultValue,
kVLCSettingPlaybackForwardSkipLength : kVLCSettingPlaybackForwardSkipLengthDefaultValue,
kVLCSettingPlaybackBackwardSkipLength : kVLCSettingPlaybackBackwardSkipLengthDefaultValue};
kVLCSettingPlaybackBackwardSkipLength : kVLCSettingPlaybackBackwardSkipLengthDefaultValue,
kVLCSettingFTPTextEncoding : kVLCSettingFTPTextEncodingDefaultValue,
kVLCSettingWiFiSharingIPv6 : kVLCSettingWiFiSharingIPv6DefaultValue};
[defaults registerDefaults:appDefaults];
}
......
......@@ -57,3 +57,13 @@
#define kVLCSettingPlaybackBackwardSkipLengthDefaultValue @(60)
#define kVLCSettingFTPTextEncoding @"ftp-text-encoding"
#define kVLCSettingFTPTextEncodingDefaultValue @(5) // ISO Latin 1
#define kVLCSettingSaveHTTPUploadServerStatus @"isHTTPServerOn"
#define kVLCSettingWiFiSharingIPv6 @"wifi-sharing-ipv6"
#define kVLCSettingWiFiSharingIPv6DefaultValue @(NO)
#if TARGET_IPHONE_SIMULATOR
#define WifiInterfaceName @"en1"
#else
#define WifiInterfaceName @"en0"
#endif
......@@ -104,6 +104,9 @@
7D3E528B1BD7B5E100309D15 /* VLCCloudServicesTVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D3E52891BD7B5E100309D15 /* VLCCloudServicesTVViewController.m */; };
7D3E528C1BD7B5E100309D15 /* VLCCloudServicesTVViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D3E528A1BD7B5E100309D15 /* VLCCloudServicesTVViewController.xib */; };
7D3EB014174A353E002062C2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D3EB013174A353E002062C2 /* SystemConfiguration.framework */; };
7D405ED01BEA11C1006ED886 /* VLCHTTPConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D30F3BD183AB24C00FFC021 /* VLCHTTPConnection.m */; };
7D405ED31BEA11CD006ED886 /* VLCHTTPUploaderController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D30F3C1183AB24C00FFC021 /* VLCHTTPUploaderController.m */; };
7D405ED41BEA150C006ED886 /* VLCActivityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D18F0A11B34522000651A30 /* VLCActivityManager.m */; };
7D4408591BDA8DCA0080FB42 /* VLCBoxController.m in Sources */ = {isa = PBXBuildFile; fileRef = 41CD69591A29D72600E60BCE /* VLCBoxController.m */; };
7D44085A1BDA8DCE0080FB42 /* VLCBoxTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 41CD695B1A29D72600E60BCE /* VLCBoxTableViewController.m */; };
7D4625881A5614A1001A80B4 /* VLCEqualizerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4625871A5614A1001A80B4 /* VLCEqualizerView.m */; };
......@@ -2584,6 +2587,7 @@
DDEAECF11BDFE9E800756C83 /* VLCServerListTVTableViewController.m in Sources */,
7DEC8BDE1BD67899006E1093 /* VLCFullscreenMovieTVViewController.m in Sources */,
DD3EFF501BDEBCE500B68579 /* VLCPlexParser.m in Sources */,
7D405ED31BEA11CD006ED886 /* VLCHTTPUploaderController.m in Sources */,
7DF90B4B1BE7A8110059C0E3 /* IASKSpecifier.m in Sources */,
7D44085A1BDA8DCE0080FB42 /* VLCBoxTableViewController.m in Sources */,
7D0EDE0A1BE7752C00363AA1 /* VLCNetworkServerBrowserFTP.m in Sources */,
......@@ -2601,6 +2605,7 @@
7D0C35331BD97C100058CD19 /* VLCOneDriveController.m in Sources */,
7D0EDE061BE774BF00363AA1 /* WhiteRaccoon.m in Sources */,
7D60696B1BD93AC800AB765C /* VLCDropboxTableViewController.m in Sources */,
7D405ED01BEA11C1006ED886 /* VLCHTTPConnection.m in Sources */,
DD3EFF3C1BDEBCE500B68579 /* VLCNetworkServerBrowserVLCMedia.m in Sources */,
7D1334801BE132F10012E919 /* VLCNetworkServerBrowserUPnP.m in Sources */,
DDEAECC71BDEC79D00756C83 /* VLCLocalNetworkServiceBrowserSAP.m in Sources */,
......@@ -2615,6 +2620,7 @@
7D5278E41BD7E37300D0CA0E /* VLCCloudStorageController.m in Sources */,
DD490B171BE6BA580010F335 /* VLCIRTVTapGestureRecognizer.m in Sources */,
7D3E528B1BD7B5E100309D15 /* VLCCloudServicesTVViewController.m in Sources */,
7D405ED41BEA150C006ED886 /* VLCActivityManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
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