Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Classes/AccountPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ -(void)accountSetupController:(AccountSetupController *)c didFinishSetupWithOAut
[syncInstruction.managedObjectContext deleteObject:syncInstruction];
}
[PutIOAPIKeychainManager setKeychainItemPassword:token];
[[PutIOAPI api] setOAuthAccessToken:token];

// Reset username/email, we need to retrieve those from put.io
NSUserDefaults *d = [NSUserDefaults standardUserDefaults];
Expand Down
2 changes: 1 addition & 1 deletion Classes/PutIOAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@property (readonly) NSString *oAuthClientID;
@property (readonly) NSString *oAuthClientSecret;
@property (readonly) NSString *oAuthRedirectURI;
@property (readonly) NSString *oAuthAccessToken;
@property (strong) NSString *oAuthAccessToken;
@property (readonly) BOOL isAuthenticated;

- (instancetype)initWithBaseURL:(NSURL*)baseURL oAuthAccessToken:(NSString*)oAuthAccessToken oAuthClientID:(NSString*)clientID oAuthRedirectURI:(NSString*)redirectURI;
Expand Down
2 changes: 0 additions & 2 deletions Classes/PutIOAPI.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#define kDefaultClientID @"197"
#define kDefaultRedirectURI @"https://matthiasschwab.de/putiosync/callback.html"

static NSString *oAuthAccessToken;

@interface PutIOAPI()
{
NSOperationQueue *queue;
Expand Down
12 changes: 6 additions & 6 deletions Classes/PutIOAPIRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ -(NSString *)queryString

-(void)main
{
if(!self.api.isAuthenticated){
[self failWithInternalError:PutIOAPIInternalErrorNotAuthorized userMessage:nil];
return;
}

NSString *requestURLString = [self.api.baseURL absoluteString];
requestURLString = [requestURLString stringByAppendingPathComponent:self.endpoint];
NSMutableDictionary *parameters;
Expand All @@ -49,7 +44,12 @@ -(void)main
}else{
parameters = [self.parameters mutableCopy];
}
parameters[@"oauth_token"] = self.api.oAuthAccessToken;

// only add the oauth token if we are logged in
if (self.api.oAuthAccessToken) {
parameters[@"oauth_token"] = self.api.oAuthAccessToken;
}

NSString *parameterString = [parameters URLQueryString];
if(self.method == PutIOAPIMethodGET){
requestURLString = [requestURLString stringByAppendingFormat:@"?%@", parameterString];
Expand Down
6 changes: 1 addition & 5 deletions Classes/PutIOSync-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<<<<<<< HEAD
<string>330</string>
=======
<string>326</string>
>>>>>>> release/0.8.2_beta
<string>366</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down