Skip to content

Commit

Permalink
unRARing possibly broke. Uses HTTPS. Support native m4v. Sliding view…
Browse files Browse the repository at this point in the history
… does all items. Transfers that failed are not shown. Accounts popover fixed positions
  • Loading branch information
orta committed Jul 1, 2012
1 parent 4f1f174 commit 1c206c2
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 82 deletions.
1 change: 0 additions & 1 deletion Puttio/FileController/BaseFileController.m
Expand Up @@ -43,7 +43,6 @@ - (void)secondaryButtonAction:(id)sender {}
-(NSString *)descriptiveTextForFile { return @"NO TEXT SET"; } -(NSString *)descriptiveTextForFile { return @"NO TEXT SET"; }


- (void)getInfoWithBlock:(void(^)(id infoObject))onComplete { - (void)getInfoWithBlock:(void(^)(id infoObject))onComplete {
NSLog(@"info!");
// [[PutIOClient sharedClient] getInfoForFile:_file :^(id userInfoObject) { // [[PutIOClient sharedClient] getInfoForFile:_file :^(id userInfoObject) {
// NSLog(@"asdafsfAF"); // NSLog(@"asdafsfAF");
// if (![userInfoObject isMemberOfClass:[NSError class]]) { // if (![userInfoObject isMemberOfClass:[NSError class]]) {
Expand Down
4 changes: 2 additions & 2 deletions Puttio/FileController/ComicFileController.mm
Expand Up @@ -69,7 +69,7 @@ - (NSString *)primaryButtonText {
- (void)primaryButtonAction:(id)sender { - (void)primaryButtonAction:(id)sender {
[self markFileAsViewed]; [self markFileAsViewed];


NSString *requestURL = [NSString stringWithFormat:@"http://put.io/v2/files/%@/download", _file.id]; NSString *requestURL = [NSString stringWithFormat:@"https://put.io/v2/files/%@/download", _file.id];


[self downloadFileAtPath:requestURL WithCompletionBlock:^(AFHTTPRequestOperation *operation, id responseObject) { [self downloadFileAtPath:requestURL WithCompletionBlock:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:_file.id]; NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:_file.id];
Expand Down Expand Up @@ -103,7 +103,7 @@ - (NSString *)secondaryButtonText {
} }


- (void)secondaryButtonAction:(id)sender { - (void)secondaryButtonAction:(id)sender {
NSString *requestURL = [NSString stringWithFormat:@"http://put.io/v2/files/%@/download", _file.id]; NSString *requestURL = [NSString stringWithFormat:@"https://put.io/v2/files/%@/download", _file.id];


[self downloadFileAtPath:requestURL WithCompletionBlock:^(AFHTTPRequestOperation *operation, id responseObject) { [self downloadFileAtPath:requestURL WithCompletionBlock:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:_file.name]; NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:_file.name];
Expand Down
2 changes: 1 addition & 1 deletion Puttio/FileController/UnknownFileController.m
Expand Up @@ -30,7 +30,7 @@ - (void)setFile:(File *)aFile {
[self.infoController showProgress]; [self.infoController showProgress];
[self.infoController disableButtons]; [self.infoController disableButtons];


NSString *requestURL = [NSString stringWithFormat:@"http://put.io/v2/files/%@/download", _file.id]; NSString *requestURL = [NSString stringWithFormat:@"https://put.io/v2/files/%@/download", _file.id];
[self downloadFileAtPath:requestURL WithCompletionBlock:^(AFHTTPRequestOperation *operation, id responseObject) { [self downloadFileAtPath:requestURL WithCompletionBlock:^(AFHTTPRequestOperation *operation, id responseObject) {
downloadedFilepath = [NSTemporaryDirectory() stringByAppendingPathComponent:_file.name]; downloadedFilepath = [NSTemporaryDirectory() stringByAppendingPathComponent:_file.name];
[operation.responseData writeToFile:downloadedFilepath atomically:YES]; [operation.responseData writeToFile:downloadedFilepath atomically:YES];
Expand Down
8 changes: 4 additions & 4 deletions Puttio/FileController/VideoFileController.m
Expand Up @@ -62,9 +62,9 @@ - (NSString *)primaryButtonText {


- (void)primaryButtonAction:(id)sender { - (void)primaryButtonAction:(id)sender {
if (_isMP4) { if (_isMP4) {
[MoviePlayer streamMovieAtPath:[NSString stringWithFormat:@"http://put.io/v2/files/%@/stream", _file.id]]; [MoviePlayer streamMovieAtPath:[NSString stringWithFormat:@"https://put.io/v2/files/%@/stream", _file.id]];
}else{ }else{
[MoviePlayer streamMovieAtPath:[NSString stringWithFormat:@"http://put.io/v2/files/%@/mp4/stream", _file.id]]; [MoviePlayer streamMovieAtPath:[NSString stringWithFormat:@"https://put.io/v2/files/%@/mp4/stream", _file.id]];
} }


[self markFileAsViewed]; [self markFileAsViewed];
Expand All @@ -90,9 +90,9 @@ - (void)secondaryButtonAction:(id)sender {
- (void)downloadFile { - (void)downloadFile {
NSString *requestURL; NSString *requestURL;
if (_isMP4) { if (_isMP4) {
requestURL = [NSString stringWithFormat:@"http://put.io/v2/files/%@/download", _file.id]; requestURL = [NSString stringWithFormat:@"https://put.io/v2/files/%@/download", _file.id];
}else{ }else{
requestURL = [NSString stringWithFormat:@"http://put.io/v2/files/%@/mp4/download", _file.id]; requestURL = [NSString stringWithFormat:@"https://put.io/v2/files/%@/mp4/download", _file.id];
} }


[self downloadFileAtPath:requestURL WithCompletionBlock:^(AFHTTPRequestOperation *operation, id responseObject) { [self downloadFileAtPath:requestURL WithCompletionBlock:^(AFHTTPRequestOperation *operation, id responseObject) {
Expand Down
7 changes: 7 additions & 0 deletions Puttio/Models/Transfer.h
Expand Up @@ -10,10 +10,17 @@


@interface Transfer : NSObject @interface Transfer : NSObject


typedef enum {
TransferStatusOK,
TransferStatusERROR
} TransferStatus;


@property (strong) NSNumber* estimatedTime; @property (strong) NSNumber* estimatedTime;
@property (strong) NSString* name; @property (strong) NSString* name;
@property (strong) NSString* createdAt; @property (strong) NSString* createdAt;
@property (strong) NSNumber* percentDone; @property (strong) NSNumber* percentDone;
@property (strong) NSNumber* downloadSpeed; @property (strong) NSNumber* downloadSpeed;
@property (strong) NSString* displayName; @property (strong) NSString* displayName;
@property (assign) TransferStatus status;
@end @end
2 changes: 1 addition & 1 deletion Puttio/Networking/PutIONetworkConstants.m
Expand Up @@ -15,4 +15,4 @@


NSString *const PTFormatOauthTokenURL = @"https://api.put.io/v2/oauth2/access_token?client_id=%@&client_secret=%@&grant_type=%@&redirect_uri=%@&code=%@"; NSString *const PTFormatOauthTokenURL = @"https://api.put.io/v2/oauth2/access_token?client_id=%@&client_secret=%@&grant_type=%@&redirect_uri=%@&code=%@";
NSString *const PTFormatOauthLoginURL = @"https://api.put.io/v2/oauth2/authenticate?client_id=%@&response_type=code&redirect_uri=%@"; NSString *const PTFormatOauthLoginURL = @"https://api.put.io/v2/oauth2/authenticate?client_id=%@&response_type=code&redirect_uri=%@";
NSString *const PTFormatOauthURL = @"https://api.put.io/v2/oauth2/authenticate?client_id=%@&response_type=code&redirect_uri=%@"; NSString *const PTFormatOauthURL = @"https://api.put.io/v2/oauth2/authenticate?client_id=%@&response_type=code&redirect_uri=%@";
4 changes: 2 additions & 2 deletions Puttio/Networking/PutIOOAuthHelper.m
Expand Up @@ -11,7 +11,7 @@
#import "AFNetworking.h" #import "AFNetworking.h"
#import "PutIONetworkConstants.h" #import "PutIONetworkConstants.h"


// http://put.io/v2/docs/#authentication // https://put.io/v2/docs/#authentication


// The order of this is // The order of this is


Expand Down Expand Up @@ -42,7 +42,7 @@ - (void)loginWithUsername:(NSString *)username andPassword:(NSString *)password


- (void)getAccessTokenFromOauthCode:(NSString *)code { - (void)getAccessTokenFromOauthCode:(NSString *)code {
// https://api.put.io/v2/oauth2/access_token?client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&grant_type=authorization_code&redirect_uri=YOUR_REGISTERED_REDIRECT_URI&code=CODE // https://api.put.io/v2/oauth2/access_token?client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&grant_type=authorization_code&redirect_uri=YOUR_REGISTERED_REDIRECT_URI&code=CODE

//
NSString *address = [NSString stringWithFormat:PTFormatOauthTokenURL, @"10", APP_SECRET, @"authorization_code", PTCallbackOriginal, code]; NSString *address = [NSString stringWithFormat:PTFormatOauthTokenURL, @"10", APP_SECRET, @"authorization_code", PTCallbackOriginal, code];


NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:address]]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:address]];
Expand Down
9 changes: 7 additions & 2 deletions Puttio/Networking/V2PutIOAPIClient.m
Expand Up @@ -6,7 +6,7 @@
// Copyright (c) 2012 ortatherox.com. All rights reserved. // Copyright (c) 2012 ortatherox.com. All rights reserved.
// //


// http://put.io/v2/docs/ // https://put.io/v2/docs/


#import "V2PutIOAPIClient.h" #import "V2PutIOAPIClient.h"
#import "PutIONetworkConstants.h" #import "PutIONetworkConstants.h"
Expand All @@ -28,7 +28,7 @@ @implementation V2PutIOAPIClient
@synthesize apiToken, actionBlocks; @synthesize apiToken, actionBlocks;


+ (id)setup { + (id)setup {
V2PutIOAPIClient *api = [[V2PutIOAPIClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://api.put.io/"]]; V2PutIOAPIClient *api = [[V2PutIOAPIClient alloc] initWithBaseURL:[NSURL URLWithString:@"https://api.put.io/"]];


if (api) { if (api) {
[[NSNotificationCenter defaultCenter] addObserver:api [[NSNotificationCenter defaultCenter] addObserver:api
Expand Down Expand Up @@ -155,6 +155,11 @@ - (void)getTransfers :(void(^)(id userInfoObject))onComplete {
transfer.estimatedTime = transferDict[@"estimated_time"]; transfer.estimatedTime = transferDict[@"estimated_time"];
transfer.createdAt = transferDict[@"created_at"]; transfer.createdAt = transferDict[@"created_at"];
transfer.displayName = [File createDisplayNameFromName:transfer.name]; transfer.displayName = [File createDisplayNameFromName:transfer.name];
if (transferDict[@"error_message"] != [NSNull null]) {
transfer.status = TransferStatusERROR;
}else {
transfer.status = TransferStatusOK;
}
[returnedTransfers addObject:transfer]; [returnedTransfers addObject:transfer];
} }
} }
Expand Down
2 changes: 1 addition & 1 deletion Puttio/Utils/V1PutIOAPIClient.m
Expand Up @@ -10,7 +10,7 @@
#import "AFJSONRequestOperation.h" #import "AFJSONRequestOperation.h"
#import "NSDictionary+JSON.h" #import "NSDictionary+JSON.h"


// http://put.io/v2/docs/ // https://put.io/v2/docs/
NSString* API_V1_ADDRESS = @"http://api.put.io/v1/"; NSString* API_V1_ADDRESS = @"http://api.put.io/v1/";


@interface V1PutIOAPIClient () @interface V1PutIOAPIClient ()
Expand Down
2 changes: 1 addition & 1 deletion Puttio/ViewControllers/AccountViewController.m
Expand Up @@ -39,7 +39,7 @@ - (void)viewWillAppear:(BOOL)animated {


// Space Left on Put.io // Space Left on Put.io
NSString *deviceUsedString = [[NSUserDefaults standardUserDefaults] objectForKey:ORDiskQuotaAvailableDefault]; NSString *deviceUsedString = [[NSUserDefaults standardUserDefaults] objectForKey:ORDiskQuotaAvailableDefault];
self.accountSpaceLabel.text = [NSString stringWithFormat:@"You are using %@ on the site", [UIDevice humanStringFromBytes:[deviceUsedString doubleValue]]]; self.accountSpaceLabel.text = [NSString stringWithFormat:@"You have %@ left on the site", [UIDevice humanStringFromBytes:[deviceUsedString doubleValue]]];
self.accountSpaceLeftProgress.progress = [[NSUserDefaults standardUserDefaults] doubleForKey:ORCurrentSpaceUsedPercentageDefault]; self.accountSpaceLeftProgress.progress = [[NSUserDefaults standardUserDefaults] doubleForKey:ORCurrentSpaceUsedPercentageDefault];
self.accountSpaceLeftProgress.isLandscape = YES; self.accountSpaceLeftProgress.isLandscape = YES;


Expand Down
9 changes: 5 additions & 4 deletions Puttio/ViewControllers/StatusViewController.m
Expand Up @@ -81,15 +81,14 @@ - (void)viewWillAppear:(BOOL)animated {
} }


- (void)didTapProgressView:(UITapGestureRecognizer*)gesture { - (void)didTapProgressView:(UITapGestureRecognizer*)gesture {

NSLog(@"ASDASD");
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];


UIViewController *accountVC = [storyboard instantiateViewControllerWithIdentifier:@"accountView"]; UIViewController *accountVC = [storyboard instantiateViewControllerWithIdentifier:@"accountView"];


popoverController = [[WEPopoverController alloc] initWithContentViewController:accountVC]; popoverController = [[WEPopoverController alloc] initWithContentViewController:accountVC];

UINavigationController *rootController = (UINavigationController*)[UIApplication sharedApplication].keyWindow.rootViewController;
[popoverController presentPopoverFromRect:gesture.view.superview.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
[popoverController presentPopoverFromRect:[rootController.view convertRect:gesture.view.frame fromView:gesture.view.superview] inView:rootController.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
} }


- (void)startTimer { - (void)startTimer {
Expand Down Expand Up @@ -125,6 +124,8 @@ - (NSArray *)onlyRecentTransfers: (NSArray*)inTransfers {
NSDate *threeDaysAgo = [calendar dateByAddingComponents:minusDaysComponents toDate:today options:0]; NSDate *threeDaysAgo = [calendar dateByAddingComponents:minusDaysComponents toDate:today options:0];


for (Transfer *transfer in inTransfers) { for (Transfer *transfer in inTransfers) {
if (transfer.status == TransferStatusERROR) continue;

if (transfer.percentDone.intValue != 100) { if (transfer.percentDone.intValue != 100) {
[newTransfers addObject:transfer]; [newTransfers addObject:transfer];
}else{ }else{
Expand Down
3 changes: 1 addition & 2 deletions Puttio/Views/ORSlidingTableView.m
Expand Up @@ -55,7 +55,7 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
} }


// loop through all the cells subtracting the height // loop through all the cells subtracting the height
for (cellIndex = 0; cellIndex < cellCount - 1; cellIndex++) { for (cellIndex = 0; cellIndex < cellCount; cellIndex++) {
fingerY -= cellHeight; fingerY -= cellHeight;
if (fingerY < 0) break; if (fingerY < 0) break;
} }
Expand All @@ -78,5 +78,4 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self.slidingDelegate slidingTableDidEndTouch:self]; [self.slidingDelegate slidingTableDidEndTouch:self];
} }



@end @end
4 changes: 2 additions & 2 deletions Puttio/en.lproj/MainStoryboard.storyboard
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2541" systemVersion="12A248" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" initialViewController="VQ5-Rz-QCj"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2809" systemVersion="11E53" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" initialViewController="VQ5-Rz-QCj">
<dependencies> <dependencies>
<deployment version="1280" identifier="iOS"/> <deployment version="1280" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1875"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1884"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--Navigation Controller--> <!--Navigation Controller-->
Expand Down
4 changes: 2 additions & 2 deletions vendor/UnRAR/unrarsrc-3.9.10/os.hpp
Expand Up @@ -166,8 +166,8 @@
#else #else
#endif #endif


#include <pwd.h> //#include <pwd.h>
#include <grp.h> //#include <grp.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
Expand Down
114 changes: 57 additions & 57 deletions vendor/UnRAR/unrarsrc-3.9.10/uowners.cpp
Expand Up @@ -8,35 +8,35 @@ void ExtractUnixOwner(Archive &Arc,char *FileName)
ErrHandler.SetErrorCode(CRC_ERROR); ErrHandler.SetErrorCode(CRC_ERROR);
return; return;
} }

//
struct passwd *pw; // struct passwd *pw;
if ((pw=getpwnam(Arc.UOHead.OwnerName))==NULL) // if ((pw=getpwnam(Arc.UOHead.OwnerName))==NULL)
{ // {
Log(Arc.FileName,St(MErrGetOwnerID),Arc.UOHead.OwnerName); // Log(Arc.FileName,St(MErrGetOwnerID),Arc.UOHead.OwnerName);
ErrHandler.SetErrorCode(WARNING); // ErrHandler.SetErrorCode(WARNING);
return; // return;
} // }
uid_t OwnerID=pw->pw_uid; // uid_t OwnerID=pw->pw_uid;

//
struct group *gr; // struct group *gr;
if ((gr=getgrnam(Arc.UOHead.GroupName))==NULL) // if ((gr=getgrnam(Arc.UOHead.GroupName))==NULL)
{ // {
Log(Arc.FileName,St(MErrGetGroupID),Arc.UOHead.GroupName); // Log(Arc.FileName,St(MErrGetGroupID),Arc.UOHead.GroupName);
ErrHandler.SetErrorCode(CRC_ERROR); // ErrHandler.SetErrorCode(CRC_ERROR);
return; // return;
} // }
uint Attr=GetFileAttr(FileName,NULL); // uint Attr=GetFileAttr(FileName,NULL);
gid_t GroupID=gr->gr_gid; // gid_t GroupID=gr->gr_gid;
#if defined(SAVE_LINKS) && !defined(_APPLE) //#if defined(SAVE_LINKS) && !defined(_APPLE)
if (lchown(FileName,OwnerID,GroupID)!=0) // if (lchown(FileName,OwnerID,GroupID)!=0)
#else //#else
if (chown(FileName,OwnerID,GroupID)!=0) // if (chown(FileName,OwnerID,GroupID)!=0)
#endif //#endif
{ // {
Log(Arc.FileName,St(MSetOwnersError),FileName); // Log(Arc.FileName,St(MSetOwnersError),FileName);
ErrHandler.SetErrorCode(CREATE_ERROR); // ErrHandler.SetErrorCode(CREATE_ERROR);
} // }
SetFileAttr(FileName,NULL,Attr); // SetFileAttr(FileName,NULL,Attr);
} }




Expand All @@ -49,32 +49,32 @@ void ExtractUnixOwnerNew(Archive &Arc,char *FileName)
strncpy(GroupName,(char *)&Arc.SubHead.SubData[OwnerSize],GroupSize); strncpy(GroupName,(char *)&Arc.SubHead.SubData[OwnerSize],GroupSize);
GroupName[GroupSize]=0; GroupName[GroupSize]=0;


struct passwd *pw; // struct passwd *pw;
if ((pw=getpwnam(OwnerName))==NULL) // if ((pw=getpwnam(OwnerName))==NULL)
{ // {
Log(Arc.FileName,St(MErrGetOwnerID),OwnerName); // Log(Arc.FileName,St(MErrGetOwnerID),OwnerName);
ErrHandler.SetErrorCode(WARNING); // ErrHandler.SetErrorCode(WARNING);
return; // return;
} // }
uid_t OwnerID=pw->pw_uid; // uid_t OwnerID=pw->pw_uid;

//
struct group *gr; // struct group *gr;
if ((gr=getgrnam(GroupName))==NULL) // if ((gr=getgrnam(GroupName))==NULL)
{ // {
Log(Arc.FileName,St(MErrGetGroupID),GroupName); // Log(Arc.FileName,St(MErrGetGroupID),GroupName);
ErrHandler.SetErrorCode(CRC_ERROR); // ErrHandler.SetErrorCode(CRC_ERROR);
return; // return;
} // }
uint Attr=GetFileAttr(FileName,NULL); // uint Attr=GetFileAttr(FileName,NULL);
gid_t GroupID=gr->gr_gid; // gid_t GroupID=gr->gr_gid;
#if defined(SAVE_LINKS) && !defined(_APPLE) //#if defined(SAVE_LINKS) && !defined(_APPLE)
if (lchown(FileName,OwnerID,GroupID)!=0) // if (lchown(FileName,OwnerID,GroupID)!=0)
#else //#else
if (chown(FileName,OwnerID,GroupID)!=0) // if (chown(FileName,OwnerID,GroupID)!=0)
#endif //#endif
{ // {
Log(Arc.FileName,St(MSetOwnersError),FileName); // Log(Arc.FileName,St(MSetOwnersError),FileName);
ErrHandler.SetErrorCode(CREATE_ERROR); // ErrHandler.SetErrorCode(CREATE_ERROR);
} // }
SetFileAttr(FileName,NULL,Attr); // SetFileAttr(FileName,NULL,Attr);
} }

0 comments on commit 1c206c2

Please sign in to comment.