Browse Source

Changed the way multi upload works to where plugins can take control and added themes for multi uploads. Fixed issue in the http plugin where if the plugin is unable to talk to the page to determine it's encoding, it will assume that it's a plist format. Now the http plugin checks if it's JSON on every request.

master
GRMrGecko 8 years ago
parent
commit
1b9549f175
  1. 2
      Classes/CocoaShare/MGMAddons.h
  2. 2
      Classes/CocoaShare/MGMAddons.m
  3. 2
      Classes/CocoaShare/MGMAutoUpdateField.h
  4. 2
      Classes/CocoaShare/MGMAutoUpdateField.m
  5. 13
      Classes/CocoaShare/MGMController.h
  6. 113
      Classes/CocoaShare/MGMController.m
  7. 2
      Classes/CocoaShare/MGMLocalized.h
  8. 2
      Classes/CocoaShare/MGMLocalized.m
  9. 2
      Classes/CocoaShare/MGMMenuItem.h
  10. 2
      Classes/CocoaShare/MGMMenuItem.m
  11. 13
      Classes/CocoaShare/MGMPathSubscriber.h
  12. 16
      Classes/CocoaShare/MGMPlugInProtocol.h
  13. 2
      Classes/CocoaShare/Preferences/MGMAccountPane.h
  14. 2
      Classes/CocoaShare/Preferences/MGMAccountPane.m
  15. 2
      Classes/CocoaShare/Preferences/MGMAutoUploadPane.h
  16. 2
      Classes/CocoaShare/Preferences/MGMAutoUploadPane.m
  17. 2
      Classes/CocoaShare/Preferences/MGMEventsPane.h
  18. 2
      Classes/CocoaShare/Preferences/MGMEventsPane.m
  19. 4
      Classes/CocoaShare/Preferences/MGMGeneralPane.h
  20. 13
      Classes/CocoaShare/Preferences/MGMGeneralPane.m
  21. 4
      Classes/HTTP/MGMHTTPPlugIn.h
  22. 5
      Classes/HTTP/MGMHTTPPlugIn.m
  23. 4
      CocoaShare.xcodeproj/project.pbxproj
  24. 2
      Resources/CocoaShare/Info.plist
  25. 1
      Resources/CocoaShare/Multi Upload Themes/Black Background/file.html
  26. 1
      Resources/CocoaShare/Multi Upload Themes/Black Background/footer.html
  27. 6
      Resources/CocoaShare/Multi Upload Themes/Black Background/header.html
  28. 1
      Resources/CocoaShare/Multi Upload Themes/Black Background/image.html
  29. 1
      Resources/CocoaShare/Multi Upload Themes/White Background/file.html
  30. 1
      Resources/CocoaShare/Multi Upload Themes/White Background/footer.html
  31. 6
      Resources/CocoaShare/Multi Upload Themes/White Background/header.html
  32. 1
      Resources/CocoaShare/Multi Upload Themes/White Background/image.html
  33. 1094
      Resources/CocoaShare/Preferences/English.lproj/GeneralPane.xib
  34. 2
      index.php

2
Classes/CocoaShare/MGMAddons.h

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/22/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import <Cocoa/Cocoa.h>

2
Classes/CocoaShare/MGMAddons.m

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/22/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import "MGMAddons.h"

2
Classes/CocoaShare/MGMAutoUpdateField.h

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/17/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import <Cocoa/Cocoa.h>

2
Classes/CocoaShare/MGMAutoUpdateField.m

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/17/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import "MGMAutoUpdateField.h"

13
Classes/CocoaShare/MGMController.h

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import <Cocoa/Cocoa.h>
@ -67,6 +67,10 @@ extern NSString * const MGMFFilter;
id<MGMPlugInProtocol> currentPlugIn;
int currentPlugInIndex;
NSMutableArray *MUThemes;
int currentMUThemeIndex;
NSLock *uploadLock;
NSMutableArray *multiUploadLinks;
NSMutableArray *uploads;
@ -85,6 +89,12 @@ extern NSString * const MGMFFilter;
- (id<MGMPlugInProtocol>)currentPlugIn;
- (int)currentPlugInIndex;
- (void)loadMUThemes;
- (NSArray *)MUThemes;
- (void)setCurrentMUTheme:(NSString *)theMUTheme;
- (int)currentMUThemeIndex;
- (NSString *)currentMUTheme;
- (void)setFrontProcess:(ProcessSerialNumber *)theProcess;
- (void)becomeFront:(NSWindow *)theWindow;
- (void)resignFront;
@ -126,4 +136,5 @@ extern NSString * const MGMFFilter;
- (void)processNextUpload;
- (void)upload:(NSString *)thePath receivedError:(NSError *)theError;
- (void)uploadFinished:(NSString *)thePath url:(NSURL *)theURL;
- (void)multiUploadPageCreated:(NSURL *)theURL;
@end

113
Classes/CocoaShare/MGMController.m

@ -3,12 +3,13 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import "MGMController.h"
#import "MGMPathSubscriber.h"
#import "MGMLoginItems.h"
#import "MGMAddons.h"
#import "MGMMenuItem.h"
#import "RegexKitLite.h"
#import <MGMUsers/MGMUsers.h>
@ -51,6 +52,9 @@ NSString * const MGMFFilter = @"filter";
NSString * const MGMPluginFolder = @"PlugIns";
NSString * const MGMCurrentPlugIn = @"MGMCurrentPlugIn";
NSString * const MGMMUThemesFolder = @"Multi Upload Themes";
NSString * const MGMCurrentMUTheme = @"MGMCurrentMUTheme";
NSString * const MGMKCType = @"application password";
NSString * const MGMKCName = @"CocoaShare";
@ -166,6 +170,7 @@ static MGMController *MGMSharedController;
uploadLock = [NSLock new];
uploads = [NSMutableArray new];
[self loadMUThemes];
[self loadPlugIns];
}
- (void)dealloc {
@ -276,6 +281,50 @@ static MGMController *MGMSharedController;
return currentPlugInIndex;
}
- (void)loadMUThemes {
NSFileManager *manager = [NSFileManager defaultManager];
[MUThemes release];
MUThemes = [NSMutableArray new];
NSArray *checkPaths = [NSArray arrayWithObjects:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:MGMMUThemesFolder], [[MGMUser applicationSupportPath] stringByAppendingPathComponent:MGMMUThemesFolder], nil];
for (int i=0; i<[checkPaths count]; i++) {
NSArray *MUThemesFolder = [manager contentsOfDirectoryAtPath:[checkPaths objectAtIndex:i]];
for (int p=0; p<[MUThemesFolder count]; p++) {
NSString *path = [[[checkPaths objectAtIndex:i] stringByAppendingPathComponent:[MUThemesFolder objectAtIndex:p]] stringByResolvingSymlinksInPath];
[MUThemes addObject:path];
}
}
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *currentMUThemePath = [defaults objectForKey:MGMCurrentMUTheme];
BOOL foundCurrentMUTheme = NO;
for (int i=0; i<[MUThemes count]; i++) {
if ([[MUThemes objectAtIndex:i] isEqual:currentMUThemePath]) {
currentMUThemeIndex = i;
foundCurrentMUTheme = YES;
break;
}
}
if (!foundCurrentMUTheme && [MUThemes count]>0)
[self setCurrentMUTheme:[MUThemes objectAtIndex:0]];
}
- (NSArray *)MUThemes {
return MUThemes;
}
- (void)setCurrentMUTheme:(NSString *)theMUTheme {
int MUThemeIndex = [MUThemes indexOfObject:theMUTheme];
if (MUThemeIndex>=0) {
currentMUThemeIndex = MUThemeIndex;
[[NSUserDefaults standardUserDefaults] setObject:theMUTheme forKey:MGMCurrentMUTheme];
}
}
- (int)currentMUThemeIndex {
return currentMUThemeIndex;
}
- (NSString *)currentMUTheme {
return [MUThemes objectAtIndex:currentMUThemeIndex];
}
- (void)setFrontProcess:(ProcessSerialNumber *)theProcess {
frontProcess = *theProcess;
/*CFStringRef name;
@ -710,11 +759,13 @@ static MGMController *MGMSharedController;
[self addPathToUploads:thePath isAutomatic:isAutomatic multiUpload:0];
}
//No multi uploads = 0
//First upload = 1
//Inbetween upload = 2
//Last upload = 3
//HTML = 4
/*
0 - Not a upload queue with multiple uploads.
1 - First upload in the queue.
2 - An upload in the queue.
3 - Last upload in the queue.
4 - The multi upload page.
*/
- (void)addPathToUploads:(NSString *)thePath isAutomatic:(BOOL)isAutomatic multiUpload:(int)multiUploadState {
[uploadLock lock];
if ([self uploadForPath:thePath]==nil) {
@ -742,7 +793,7 @@ static MGMController *MGMSharedController;
[alert runModal];
[uploads removeAllObjects];
return;
} else if (![currentPlugIn respondsToSelector:@selector(sendFileAtPath:withName:)]) {
} else if (![currentPlugIn respondsToSelector:@selector(sendFileAtPath:withName:)] && ![currentPlugIn respondsToSelector:@selector(sendFileAtPath:withName:multiUpload:)]) {
NSAlert *alert = [[NSAlert new] autorelease];
[alert setMessageText:[@"Upload Error" localized]];
[alert setInformativeText:[@"The current PlugIn doesn't support uploading." localized]];
@ -752,7 +803,8 @@ static MGMController *MGMSharedController;
}
NSFileManager *manager = [NSFileManager defaultManager];
NSDictionary *upload = [uploads objectAtIndex:0];
if ([[upload objectForKey:MGMUMultiUpload] intValue]==1) {
int multiUpload = [[upload objectForKey:MGMUMultiUpload] intValue];
if (multiUpload==1) {
[multiUploadLinks release];
multiUploadLinks = [NSMutableArray new];
}
@ -769,7 +821,11 @@ static MGMController *MGMSharedController;
NSString *name = [[upload objectForKey:MGMUPath] lastPathComponent];
if ((uploadNameType==0 && [[upload objectForKey:MGMUAutomatic] boolValue]) || uploadNameType==1)
name = [randomizedName stringByAppendingPathExtension:[name pathExtension]];
if ([currentPlugIn respondsToSelector:@selector(sendFileAtPath:withName:multiUpload:)]) {
[currentPlugIn sendFileAtPath:[upload objectForKey:MGMUPath] withName:name multiUpload:multiUpload];
} else {
[currentPlugIn sendFileAtPath:[upload objectForKey:MGMUPath] withName:name];
}
} else {
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
if ([osxMode isEqualTo:@"Dark"]) {
@ -799,39 +855,55 @@ static MGMController *MGMSharedController;
- (void)uploadFinished:(NSString *)thePath url:(NSURL *)theURL {
NSDictionary *upload = [self uploadForPath:thePath];
if (upload!=nil) {
int multiUpload = [[upload objectForKey:MGMUMultiUpload] intValue];
[self processEvent:([[upload objectForKey:MGMUAutomatic] boolValue] ? MGMEUploadedAutomatic : MGMEUploaded) path:[upload objectForKey:MGMUPath] url:theURL];
//No need to bother the clip board when there will end up being a multi upload url.
if (multiUpload==0 || multiUpload==4) {
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard declareTypes:[NSArray arrayWithObjects:MGMNSStringPboardType, MGMNSPasteboardTypeString, nil] owner:nil];
[pboard setString:[theURL absoluteString] forType:MGMNSStringPboardType];
[pboard setString:[theURL absoluteString] forType:MGMNSPasteboardTypeString];
}
[self addURLToHistory:theURL];
int multiUpload = [[upload objectForKey:MGMUMultiUpload] intValue];
if (multiUpload>=1 && multiUpload!=4) {
[multiUploadLinks addObject:theURL];
}
if (multiUpload==3) {
if ([currentPlugIn respondsToSelector:@selector(createMultiUploadPage)]) {
[currentPlugIn createMultiUploadPage];
} else {
NSString *randomizedName = [[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] MD5];
NSString *htmlPath = [NSString stringWithFormat:@"/tmp/%@.htm", randomizedName];
NSString *htmlPath = [NSString stringWithFormat:@"/tmp/CocoaShare_%@.htm", randomizedName];
NSString *imageHTML = [NSString stringWithContentsOfFile:[[self currentMUTheme] stringByAppendingPathComponent:@"image.html"] encoding:NSUTF8StringEncoding error:nil];
if (imageHTML==nil) {
[uploadLock lock];
[uploads removeObject:upload];
[self processNextUpload];
[uploadLock unlock];
return;
}
NSString *fileHTML = [NSString stringWithContentsOfFile:[[self currentMUTheme] stringByAppendingPathComponent:@"file.html"] encoding:NSUTF8StringEncoding error:nil];
[[NSFileManager defaultManager] createFileAtPath:htmlPath contents:nil attributes:nil];
NSFileHandle *multiUploadHtml = [NSFileHandle fileHandleForWritingAtPath:htmlPath];
[multiUploadHtml writeData:[@"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\">\n"
"<head><style>img {max-width: 100%;}</style><title>Multiple Upload Links</title></head><body>\n" dataUsingEncoding:NSUTF8StringEncoding]];
[multiUploadHtml writeData:[NSData dataWithContentsOfFile:[[self currentMUTheme] stringByAppendingPathComponent:@"header.html"]]];
NSArray *imageExtensions = [NSArray arrayWithObjects:@"jpg", @"jpeg", @"png", @"bmp", @"gif", nil];
for (int i=0; i<[multiUploadLinks count]; i++) {
NSURL *link = [multiUploadLinks objectAtIndex:i];
NSString *linkString = [link absoluteString];
NSArray *imageExtensions = [NSArray arrayWithObjects:@"jpg", @"jpeg", @"png", @"bmp", @"gif", nil];
if ([imageExtensions containsObject:[[link pathExtension] lowercaseString]]) {
[multiUploadHtml writeData:[[NSString stringWithFormat:@"<a href=\"%@\"><img src=\"%@\"></a><br />\n", linkString, linkString] dataUsingEncoding:NSUTF8StringEncoding]];
[multiUploadHtml writeData:[[imageHTML replace:@"{url}" with:linkString] dataUsingEncoding:NSUTF8StringEncoding]];
} else {
[multiUploadHtml writeData:[[NSString stringWithFormat:@"<a href=\"%@\">%@</a><br />\n", linkString, linkString] dataUsingEncoding:NSUTF8StringEncoding]];
[multiUploadHtml writeData:[[fileHTML replace:@"{url}" with:linkString] dataUsingEncoding:NSUTF8StringEncoding]];
}
}
[multiUploadHtml writeData:[@"</body></html>" dataUsingEncoding:NSUTF8StringEncoding]];
[multiUploadHtml writeData:[NSData dataWithContentsOfFile:[[self currentMUTheme] stringByAppendingPathComponent:@"footer.html"]]];
[multiUploadHtml closeFile];
[self addPathToUploads:htmlPath isAutomatic:YES multiUpload:4];
}
}
if (multiUpload==4) {
[[NSFileManager defaultManager] removeItemAtPath:[upload objectForKey:MGMUPath]];
}
@ -842,4 +914,11 @@ static MGMController *MGMSharedController;
[uploadLock unlock];
}
}
- (void)multiUploadPageCreated:(NSURL *)theURL {
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard declareTypes:[NSArray arrayWithObjects:MGMNSStringPboardType, MGMNSPasteboardTypeString, nil] owner:nil];
[pboard setString:[theURL absoluteString] forType:MGMNSStringPboardType];
[pboard setString:[theURL absoluteString] forType:MGMNSPasteboardTypeString];
[self addURLToHistory:theURL];
}
@end

2
Classes/CocoaShare/MGMLocalized.h

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 2/2/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import <Cocoa/Cocoa.h>

2
Classes/CocoaShare/MGMLocalized.m

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 2/2/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import "MGMLocalized.h"

2
Classes/CocoaShare/MGMMenuItem.h

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/16/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import <Cocoa/Cocoa.h>

2
Classes/CocoaShare/MGMMenuItem.m

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/16/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import "MGMMenuItem.h"

13
Classes/CocoaShare/MGMPathSubscriber.h

@ -3,7 +3,18 @@
// Conmote
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2013 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
//
// Permission to use, copy, modify, and/or distribute this software for any purpose
// with or without fee is hereby granted, provided that the above copyright notice
// and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
// OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
// ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
#import <Foundation/Foundation.h>

16
Classes/CocoaShare/MGMPlugInProtocol.h

@ -16,4 +16,20 @@
- (NSArray *)allowedExtensions;
- (void)setCurrentPlugIn:(BOOL)isCurrent;
- (void)sendFileAtPath:(NSString *)thePath withName:(NSString *)theName;
- (void)sendFileAtPath:(NSString *)thePath withName:(NSString *)theName multiUpload:(int)multiUploadState;
/*
This is to receive the state for multiple uploads. You can use ether this method or the one without the multi upload state.
0 - Not a upload queue with multiple uploads.
1 - First upload in the queue.
2 - An upload in the queue.
3 - Last upload in the queue.
4 - The multi upload page.
*/
- (void)createMultiUploadPage;
/*
If the plugin is responsible for creating the multi upload page, use this method to be called instead of having CocoaShare itself create a page.
If you have this method, you must ether:
1. Tell CocoaShare to upload the page to go through the usual file sending with [self addPathToUploads:filePath isAutomatic:YES multiUpload:4];
2. Call multiUploadPageCreated: with the URL of the multi upload page.
*/
@end

2
Classes/CocoaShare/Preferences/MGMAccountPane.h

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import <Cocoa/Cocoa.h>

2
Classes/CocoaShare/Preferences/MGMAccountPane.m

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import "MGMAccountPane.h"

2
Classes/CocoaShare/Preferences/MGMAutoUploadPane.h

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import <Cocoa/Cocoa.h>

2
Classes/CocoaShare/Preferences/MGMAutoUploadPane.m

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import "MGMAutoUploadPane.h"

2
Classes/CocoaShare/Preferences/MGMEventsPane.h

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import <Cocoa/Cocoa.h>

2
Classes/CocoaShare/Preferences/MGMEventsPane.m

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import "MGMEventsPane.h"

4
Classes/CocoaShare/Preferences/MGMGeneralPane.h

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import <Cocoa/Cocoa.h>
@ -17,6 +17,7 @@
IBOutlet NSTextField *historyCountField;
IBOutlet NSButton *growlErrors;
IBOutlet NSTextField *uploadLimit;
IBOutlet NSPopUpButton *MUThemesButton;
}
- (id)initWithPreferences:(MGMPreferences *)thePreferences;
+ (void)setUpToolbarItem:(NSToolbarItem *)theItem;
@ -29,4 +30,5 @@
- (IBAction)changeHistoryCount:(id)sender;
- (IBAction)changeGrowlErrors:(id)sender;
- (IBAction)changeUploadLimit:(id)sender;
- (IBAction)changeMUTheme:(id)sender;
@end

13
Classes/CocoaShare/Preferences/MGMGeneralPane.m

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/15/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import "MGMGeneralPane.h"
@ -22,6 +22,13 @@
[historyCountField setIntValue:[preferences integerForKey:MGMHistoryCount]];
[growlErrors setState:([preferences boolForKey:MGMGrowlErrors] ? NSOnState : NSOffState)];
[uploadLimit setIntValue:[preferences integerForKey:MGMUploadLimit]];
[MUThemesButton removeAllItems];
NSArray *MUThemes = [[MGMController sharedController] MUThemes];
for (int i=0; i<[MUThemes count]; i++) {
[MUThemesButton addItemWithTitle:[[MUThemes objectAtIndex:i] lastPathComponent]];
}
[MUThemesButton selectItemAtIndex:[[MGMController sharedController] currentMUThemeIndex]];
}
}
return self;
@ -82,4 +89,8 @@
- (IBAction)changeUploadLimit:(id)sender {
[preferences setInteger:[uploadLimit intValue] forKey:MGMUploadLimit];
}
- (IBAction)changeMUTheme:(id)sender {
MGMController *controller = [MGMController sharedController];
[controller setCurrentMUTheme:[[controller MUThemes] objectAtIndex:[MUThemesButton indexOfSelectedItem]]];
}
@end

4
Classes/HTTP/MGMHTTPPlugIn.h

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/18/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import <Cocoa/Cocoa.h>
@ -16,8 +16,6 @@
IBOutlet NSButton *loginButton;
BOOL userLoggingIn;
int loginTries;
BOOL isJSON;
}
- (void)releaseView;

5
Classes/HTTP/MGMHTTPPlugIn.m

@ -3,7 +3,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 1/18/11.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
#import "MGMHTTPPlugIn.h"
@ -107,7 +107,7 @@ const BOOL MGMHTTPResponseInvisible = YES;
[self unlockLogin];
}
- (void)checkDidFinish:(MGMURLBasicHandler *)theHandler {
isJSON = [[[theHandler response] MIMEType] isEqual:@"application/json"];
BOOL isJSON = [[[theHandler response] MIMEType] isEqual:@"application/json"];
NSString *error = nil;
NSDictionary *response = nil;
if (isJSON) {
@ -214,6 +214,7 @@ const BOOL MGMHTTPResponseInvisible = YES;
[[MGMController sharedController] upload:[theHandler object] receivedError:theError];
}
- (void)uploadDidFinish:(MGMURLBasicHandler *)theHandler {
BOOL isJSON = [[[theHandler response] MIMEType] isEqual:@"application/json"];
NSString *error = nil;
NSDictionary *response = nil;
if (isJSON) {

4
CocoaShare.xcodeproj/project.pbxproj

@ -46,6 +46,7 @@
2A2F97A212F05C720069B37E /* FTP.bundle in PlugIns */ = {isa = PBXBuildFile; fileRef = 2A0C8C9412EF844F00A75AB7 /* FTP.bundle */; };
2A2F995412F094F10069B37E /* SFTP.bundle in PlugIns */ = {isa = PBXBuildFile; fileRef = 2A2F994512F094710069B37E /* SFTP.bundle */; };
2A2F996E12F095DA0069B37E /* MGMSFTPPlugIn.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A2F996D12F095DA0069B37E /* MGMSFTPPlugIn.m */; };
2A3954E71C3194A700DE02CC /* Multi Upload Themes in Resources */ = {isa = PBXBuildFile; fileRef = 2A3954E61C3194A700DE02CC /* Multi Upload Themes */; };
2A48832E12E52E84001618B5 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A48832D12E52E84001618B5 /* RegexKitLite.m */; };
2A48833512E52EAA001618B5 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A48833412E52EAA001618B5 /* libicucore.dylib */; };
2A48835612E53232001618B5 /* MGMAutoUpdateField.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A48835512E53232001618B5 /* MGMAutoUpdateField.m */; };
@ -269,6 +270,7 @@
2A2F996912F0957E0069B37E /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/SFTPAccountPane.xib; sourceTree = "<group>"; };
2A2F996C12F095DA0069B37E /* MGMSFTPPlugIn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMSFTPPlugIn.h; sourceTree = "<group>"; };
2A2F996D12F095DA0069B37E /* MGMSFTPPlugIn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMSFTPPlugIn.m; sourceTree = "<group>"; wrapsLines = 1; };
2A3954E61C3194A700DE02CC /* Multi Upload Themes */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "Multi Upload Themes"; sourceTree = "<group>"; };
2A48832C12E52E84001618B5 /* RegexKitLite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegexKitLite.h; sourceTree = "<group>"; };
2A48832D12E52E84001618B5 /* RegexKitLite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RegexKitLite.m; sourceTree = "<group>"; };
2A48833412E52EAA001618B5 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; };
@ -821,6 +823,7 @@
2AEF118512F52A7D00F495BE /* CocoaShareIcon.png */,
2A52DDC612E3AC26000FC8CD /* menuicon.png */,
2A52DDC712E3AC26000FC8CD /* menuicondrag.png */,
2A3954E61C3194A700DE02CC /* Multi Upload Themes */,
2A52DF5712E3D041000FC8CD /* menuiconselected.png */,
2A52DDC812E3AC26000FC8CD /* menuiconupload.png */,
2A4FA61012F9F8DE009F5B3A /* Localizable.strings */,
@ -1105,6 +1108,7 @@
2AEAB4EF12E2B2F600552BAA /* GeneralPane.xib in Resources */,
2AEAB4F112E2B2FB00552BAA /* AccountPane.xib in Resources */,
2AEAB4F312E2B2FF00552BAA /* AutoUploadPane.xib in Resources */,
2A3954E71C3194A700DE02CC /* Multi Upload Themes in Resources */,
2AEAB4F512E2B30500552BAA /* EventsPane.xib in Resources */,
2AEAB53712E2B68300552BAA /* dsa_pub.pem in Resources */,
2A52DDC512E3AC17000FC8CD /* CocoaShare.icns in Resources */,

2
Resources/CocoaShare/Info.plist

@ -54,7 +54,7 @@
<key>MGMGRTimeZone</key>
<string>CST</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) 2011 Mr. Gecko&apos;s Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/</string>
<string>Copyright (c) 2015 Mr. Gecko&apos;s Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>

1
Resources/CocoaShare/Multi Upload Themes/Black Background/file.html

@ -0,0 +1 @@
<a href="{url}">{url}</a><br />

1
Resources/CocoaShare/Multi Upload Themes/Black Background/footer.html

@ -0,0 +1 @@
</body></html>

6
Resources/CocoaShare/Multi Upload Themes/Black Background/header.html

@ -0,0 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head><style>
body {margin:0;padding:0;background:#000;}
img {max-width:100%;}
</style><title>Multiple Upload Links</title></head><body>

1
Resources/CocoaShare/Multi Upload Themes/Black Background/image.html

@ -0,0 +1 @@
<a href="{url}"><img src="{url}"></a><br />

1
Resources/CocoaShare/Multi Upload Themes/White Background/file.html

@ -0,0 +1 @@
<a href="{url}">{url}</a><br />

1
Resources/CocoaShare/Multi Upload Themes/White Background/footer.html

@ -0,0 +1 @@
</body></html>

6
Resources/CocoaShare/Multi Upload Themes/White Background/header.html

@ -0,0 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head><style>
body {margin:0;padding:0;background:#fff;}
img {max-width:100%;}
</style><title>Multiple Upload Links</title></head><body>

1
Resources/CocoaShare/Multi Upload Themes/White Background/image.html

@ -0,0 +1 @@
<a href="{url}"><img src="{url}"></a><br />

1094
Resources/CocoaShare/Preferences/English.lproj/GeneralPane.xib
File diff suppressed because it is too large
View File

2
index.php

@ -4,7 +4,7 @@
// CocoaShare
//
// Created by Mr. Gecko on 4/14/10.
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// Copyright (c) 2015 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
//
class shortID {

Loading…
Cancel
Save