Skip to content

Commit

Permalink
change bonjour
Browse files Browse the repository at this point in the history
  • Loading branch information
chamspan committed Apr 14, 2015
1 parent 871a2b7 commit 4a99068
Showing 7 changed files with 61 additions and 5 deletions.
14 changes: 10 additions & 4 deletions iLcatraz.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
410844B51AADF62300919A62 /* NSString+EString.m in Sources */ = {isa = PBXBuildFile; fileRef = 410844B41AADF62300919A62 /* NSString+EString.m */; };
4162747C19FC0ACC0040A86D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4162747B19FC0ACC0040A86D /* Cocoa.framework */; };
4162748619FC0ACC0040A86D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4162748419FC0ACC0040A86D /* InfoPlist.strings */; };
4162748819FC0ACC0040A86D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4162748719FC0ACC0040A86D /* main.m */; };
@@ -67,6 +68,8 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
410844B31AADF62300919A62 /* NSString+EString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+EString.h"; sourceTree = "<group>"; };
410844B41AADF62300919A62 /* NSString+EString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+EString.m"; sourceTree = "<group>"; };
4162747819FC0ACC0040A86D /* iLcatraz.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iLcatraz.app; sourceTree = BUILT_PRODUCTS_DIR; };
4162747B19FC0ACC0040A86D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
4162747E19FC0ACC0040A86D /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
@@ -239,6 +242,8 @@
4162748219FC0ACC0040A86D /* Supporting Files */,
41C8B42719FD2DEE00C9BD27 /* FileResponse.h */,
41C8B42819FD2DEE00C9BD27 /* FileResponse.m */,
410844B31AADF62300919A62 /* NSString+EString.h */,
410844B41AADF62300919A62 /* NSString+EString.m */,
);
path = iLcatraz;
sourceTree = "<group>";
@@ -530,6 +535,7 @@
41C8B3E319FC0BAA00C9BD27 /* HTTPRedirectResponse.m in Sources */,
41C8B3DE19FC0BAA00C9BD27 /* MultipartMessageHeaderField.m in Sources */,
41C8B40119FC0C0700C9BD27 /* DDTTYLogger.m in Sources */,
410844B51AADF62300919A62 /* NSString+EString.m in Sources */,
4162748819FC0ACC0040A86D /* main.m in Sources */,
41C8B40D19FC0D4C00C9BD27 /* HTTPConnectionIL.m in Sources */,
41C8B3FD19FC0C0700C9BD27 /* DDAbstractDatabaseLogger.m in Sources */,
@@ -638,7 +644,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.10;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
@@ -671,7 +677,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.10;
SDKROOT = macosx;
};
name = Release;
@@ -685,7 +691,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iLcatraz/iLcatraz-Prefix.pch";
INFOPLIST_FILE = "iLcatraz/iLcatraz-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -700,7 +706,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iLcatraz/iLcatraz-Prefix.pch";
INFOPLIST_FILE = "iLcatraz/iLcatraz-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
2 changes: 2 additions & 0 deletions iLcatraz/FileResponse.m
Original file line number Diff line number Diff line change
@@ -7,11 +7,13 @@
//

#import "FileResponse.h"
#import "NSString+EString.h"

@implementation FileResponse
- (id)initWithFilePath:(NSString *)aFilePath andLocation:(NSString*)location forConnection:(HTTPConnection *)aConnection{
self=[super initWithFilePath:aFilePath forConnection:aConnection];
if (self!=NULL){
location = [location urlencode];
headers = [NSDictionary dictionaryWithObjectsAndKeys:location,@"X-iTunes-Location",nil];
};
return self;
2 changes: 2 additions & 0 deletions iLcatraz/HTTPConnectionIL.m
Original file line number Diff line number Diff line change
@@ -125,6 +125,8 @@ + (NSString*) sanitizePID:(NSString*) pid{
/*
/media/playlists/ID/tracks/ID
*/
NSString *trackPath=[service pathForTrackWithID:tid ofPlaysitWithID:pid];
trackLocation=[service locationForTrackPath:trackPath];
ret=[service jsonTrackWithID:tid ofPlaysitWithID:pid];
}else{
/*
13 changes: 13 additions & 0 deletions iLcatraz/NSString+EString.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// NSString+EString.h
// iLcatraz
//
// Created by Macmini on 09.03.15.
// Copyright (c) 2015 dsa. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString (EString)
- (NSString *)urlencode;
@end
31 changes: 31 additions & 0 deletions iLcatraz/NSString+EString.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// NSString+EString.m
// iLcatraz
//
// Created by Macmini on 09.03.15.
// Copyright (c) 2015 dsa. All rights reserved.
//

#import "NSString+EString.h"

@implementation NSString (EString)
- (NSString *)urlencode {
NSMutableString *output = [NSMutableString string];
const unsigned char *source = (const unsigned char *)[self UTF8String];
unsigned long sourceLen = strlen((const char *)source);
for (int i = 0; i < sourceLen; ++i) {
const unsigned char thisChar = source[i];
if (thisChar == ' '){
[output appendString:@"+"];
} else if (thisChar == '.' || thisChar == '-' || thisChar == '_' || thisChar == '~' ||
(thisChar >= 'a' && thisChar <= 'z') ||
(thisChar >= 'A' && thisChar <= 'Z') ||
(thisChar >= '0' && thisChar <= '9')) {
[output appendFormat:@"%c", thisChar];
} else {
[output appendFormat:@"%%%02X", thisChar];
}
}
return output;
}
@end
2 changes: 2 additions & 0 deletions iLcatraz/RESTResponse.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "RESTResponse.h"
#import "HTTPLogging.h"
#import "NSString+EString.h"

#if ! __has_feature(objc_arc)
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
@@ -48,6 +49,7 @@ - (id)initWithJSON:(NSString *)json status:(NSUInteger)aStatus andLocation:(NSSt

offset = 0;
jsonData = [json dataUsingEncoding:NSUTF8StringEncoding];
location = [location urlencode];
headers = [NSDictionary dictionaryWithObjectsAndKeys: @"application/json; charset=utf-8",@"Content-Type",location,@"X-iTunes-Location",nil];
status=aStatus;
}
2 changes: 1 addition & 1 deletion iLcatraz/me_dsa_iLcatrazAppDelegate.m
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ - (void)startHTTPServer{
[httpServer setConnectionClass:[HTTPConnectionIL class]];


[httpServer setType:@"_http._tcp."];
[httpServer setType:@"_ilcatraz._tcp."];

BOOL randomPort=[[NSUserDefaults standardUserDefaults] boolForKey:@"randomPort"];
if (!randomPort){

0 comments on commit 4a99068

Please sign in to comment.