This repository was archived by the owner on Nov 7, 2018. It is now read-only.
File tree 2 files changed +6
-19
lines changed
2 files changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,12 @@ - (instancetype)initWithFrame:(CGRect)frame
66
66
self.frame = frame;
67
67
self.webServer = [[GCDWebServer alloc ] init ];
68
68
[self .webServer addGETHandlerForBasePath: @" /" directoryPath: @" /" indexFilename: nil cacheAge: 3600 allowRangeRequests: YES ];
69
- [self .webServer startWithPort: 8080 bonjourName: nil ];
69
+ NSDictionary *options = @{
70
+ GCDWebServerOption_Port: @(8080 ),
71
+ GCDWebServerOption_BindToLocalhost: @(YES ),
72
+ GCDWebServerOption_ServerName: @" Ionic"
73
+ };
74
+ [self .webServer startWithOptions: options error: nil ];
70
75
}
71
76
72
77
return self;
Original file line number Diff line number Diff line change @@ -1035,24 +1035,6 @@ - (GCDWebServerResponse*)_responseWithContentsOfDirectory:(NSString*)path {
1035
1035
NSMutableString * html = [NSMutableString string ];
1036
1036
[html appendString: @" <!DOCTYPE html>\n " ];
1037
1037
[html appendString: @" <html><head><meta charset=\" utf-8\" ></head><body>\n " ];
1038
- [html appendString: @" <ul>\n " ];
1039
- for (NSString * file in enumerator) {
1040
- if (![file hasPrefix: @" ." ]) {
1041
- NSString * type = [[enumerator fileAttributes ] objectForKey: NSFileType ];
1042
- #pragma clang diagnostic push
1043
- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
1044
- NSString * escapedFile = [file stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
1045
- #pragma clang diagnostic pop
1046
- GWS_DCHECK (escapedFile);
1047
- if ([type isEqualToString: NSFileTypeRegular ]) {
1048
- [html appendFormat: @" <li><a href=\" %@ \" >%@ </a></li>\n " , escapedFile, file];
1049
- } else if ([type isEqualToString: NSFileTypeDirectory ]) {
1050
- [html appendFormat: @" <li><a href=\" %@ /\" >%@ /</a></li>\n " , escapedFile, file];
1051
- }
1052
- }
1053
- [enumerator skipDescendents ];
1054
- }
1055
- [html appendString: @" </ul>\n " ];
1056
1038
[html appendString: @" </body></html>\n " ];
1057
1039
return [GCDWebServerDataResponse responseWithHTML: html];
1058
1040
}
You can’t perform that action at this time.
0 commit comments