Expose the package downloading to js. Todo: cancel support, status callbacks.
This commit is contained in:
@@ -40,7 +40,9 @@ static JSBridge *SharedInstance;
|
||||
methods = [[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"launchMod", NSStringFromSelector(@selector(launchMod:)),
|
||||
@"log", NSStringFromSelector(@selector(log:)),
|
||||
@"installCncPackagesFromWeb", NSStringFromSelector(@selector(installCncPackagesFromWeb)),
|
||||
@"fileExistsInMod", NSStringFromSelector(@selector(fileExists:inMod:)),
|
||||
@"downloadFileToCache",NSStringFromSelector(@selector(downloadFile:intoCacheWithName:id:)),
|
||||
nil] retain];
|
||||
}
|
||||
return self;
|
||||
@@ -87,6 +89,13 @@ static JSBridge *SharedInstance;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)downloadFile:(NSString *)url intoCacheWithName:(NSString *)name id:(NSString *)did
|
||||
{
|
||||
NSLog(@"downloadFile:%@ intoCacheWithName:%@ id:%@",url,name,did);
|
||||
// Disallow traversing directories; take only the last component
|
||||
[controller downloadUrl:url intoCache:[name lastPathComponent] withId:did];
|
||||
}
|
||||
|
||||
- (void)log:(NSString *)message
|
||||
{
|
||||
NSLog(@"js: %@",message);
|
||||
|
||||
Reference in New Issue
Block a user