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.

This commit is contained in:
GRMrGecko 2015-12-28 11:52:44 -06:00
parent 841027cd58
commit 1b9549f175
34 changed files with 947 additions and 482 deletions

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/22/11. // 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> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/22/11. // 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" #import "MGMAddons.h"

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/17/11. // 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> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/17/11. // 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" #import "MGMAutoUpdateField.h"

View File

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

View File

@ -3,12 +3,13 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/15/11. // 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 "MGMController.h"
#import "MGMPathSubscriber.h" #import "MGMPathSubscriber.h"
#import "MGMLoginItems.h" #import "MGMLoginItems.h"
#import "MGMAddons.h"
#import "MGMMenuItem.h" #import "MGMMenuItem.h"
#import "RegexKitLite.h" #import "RegexKitLite.h"
#import <MGMUsers/MGMUsers.h> #import <MGMUsers/MGMUsers.h>
@ -51,6 +52,9 @@ NSString * const MGMFFilter = @"filter";
NSString * const MGMPluginFolder = @"PlugIns"; NSString * const MGMPluginFolder = @"PlugIns";
NSString * const MGMCurrentPlugIn = @"MGMCurrentPlugIn"; NSString * const MGMCurrentPlugIn = @"MGMCurrentPlugIn";
NSString * const MGMMUThemesFolder = @"Multi Upload Themes";
NSString * const MGMCurrentMUTheme = @"MGMCurrentMUTheme";
NSString * const MGMKCType = @"application password"; NSString * const MGMKCType = @"application password";
NSString * const MGMKCName = @"CocoaShare"; NSString * const MGMKCName = @"CocoaShare";
@ -166,6 +170,7 @@ static MGMController *MGMSharedController;
uploadLock = [NSLock new]; uploadLock = [NSLock new];
uploads = [NSMutableArray new]; uploads = [NSMutableArray new];
[self loadMUThemes];
[self loadPlugIns]; [self loadPlugIns];
} }
- (void)dealloc { - (void)dealloc {
@ -276,6 +281,50 @@ static MGMController *MGMSharedController;
return currentPlugInIndex; 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 { - (void)setFrontProcess:(ProcessSerialNumber *)theProcess {
frontProcess = *theProcess; frontProcess = *theProcess;
/*CFStringRef name; /*CFStringRef name;
@ -710,11 +759,13 @@ static MGMController *MGMSharedController;
[self addPathToUploads:thePath isAutomatic:isAutomatic multiUpload:0]; [self addPathToUploads:thePath isAutomatic:isAutomatic multiUpload:0];
} }
//No multi uploads = 0 /*
//First upload = 1 0 - Not a upload queue with multiple uploads.
//Inbetween upload = 2 1 - First upload in the queue.
//Last upload = 3 2 - An upload in the queue.
//HTML = 4 3 - Last upload in the queue.
4 - The multi upload page.
*/
- (void)addPathToUploads:(NSString *)thePath isAutomatic:(BOOL)isAutomatic multiUpload:(int)multiUploadState { - (void)addPathToUploads:(NSString *)thePath isAutomatic:(BOOL)isAutomatic multiUpload:(int)multiUploadState {
[uploadLock lock]; [uploadLock lock];
if ([self uploadForPath:thePath]==nil) { if ([self uploadForPath:thePath]==nil) {
@ -742,7 +793,7 @@ static MGMController *MGMSharedController;
[alert runModal]; [alert runModal];
[uploads removeAllObjects]; [uploads removeAllObjects];
return; 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]; NSAlert *alert = [[NSAlert new] autorelease];
[alert setMessageText:[@"Upload Error" localized]]; [alert setMessageText:[@"Upload Error" localized]];
[alert setInformativeText:[@"The current PlugIn doesn't support uploading." localized]]; [alert setInformativeText:[@"The current PlugIn doesn't support uploading." localized]];
@ -752,7 +803,8 @@ static MGMController *MGMSharedController;
} }
NSFileManager *manager = [NSFileManager defaultManager]; NSFileManager *manager = [NSFileManager defaultManager];
NSDictionary *upload = [uploads objectAtIndex:0]; NSDictionary *upload = [uploads objectAtIndex:0];
if ([[upload objectForKey:MGMUMultiUpload] intValue]==1) { int multiUpload = [[upload objectForKey:MGMUMultiUpload] intValue];
if (multiUpload==1) {
[multiUploadLinks release]; [multiUploadLinks release];
multiUploadLinks = [NSMutableArray new]; multiUploadLinks = [NSMutableArray new];
} }
@ -769,7 +821,11 @@ static MGMController *MGMSharedController;
NSString *name = [[upload objectForKey:MGMUPath] lastPathComponent]; NSString *name = [[upload objectForKey:MGMUPath] lastPathComponent];
if ((uploadNameType==0 && [[upload objectForKey:MGMUAutomatic] boolValue]) || uploadNameType==1) if ((uploadNameType==0 && [[upload objectForKey:MGMUAutomatic] boolValue]) || uploadNameType==1)
name = [randomizedName stringByAppendingPathExtension:[name pathExtension]]; 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]; [currentPlugIn sendFileAtPath:[upload objectForKey:MGMUPath] withName:name];
}
} else { } else {
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"]; NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
if ([osxMode isEqualTo:@"Dark"]) { if ([osxMode isEqualTo:@"Dark"]) {
@ -799,39 +855,55 @@ static MGMController *MGMSharedController;
- (void)uploadFinished:(NSString *)thePath url:(NSURL *)theURL { - (void)uploadFinished:(NSString *)thePath url:(NSURL *)theURL {
NSDictionary *upload = [self uploadForPath:thePath]; NSDictionary *upload = [self uploadForPath:thePath];
if (upload!=nil) { if (upload!=nil) {
int multiUpload = [[upload objectForKey:MGMUMultiUpload] intValue];
[self processEvent:([[upload objectForKey:MGMUAutomatic] boolValue] ? MGMEUploadedAutomatic : MGMEUploaded) path:[upload objectForKey:MGMUPath] url:theURL]; [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]; NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard declareTypes:[NSArray arrayWithObjects:MGMNSStringPboardType, MGMNSPasteboardTypeString, nil] owner:nil]; [pboard declareTypes:[NSArray arrayWithObjects:MGMNSStringPboardType, MGMNSPasteboardTypeString, nil] owner:nil];
[pboard setString:[theURL absoluteString] forType:MGMNSStringPboardType]; [pboard setString:[theURL absoluteString] forType:MGMNSStringPboardType];
[pboard setString:[theURL absoluteString] forType:MGMNSPasteboardTypeString]; [pboard setString:[theURL absoluteString] forType:MGMNSPasteboardTypeString];
}
[self addURLToHistory:theURL]; [self addURLToHistory:theURL];
int multiUpload = [[upload objectForKey:MGMUMultiUpload] intValue];
if (multiUpload>=1 && multiUpload!=4) { if (multiUpload>=1 && multiUpload!=4) {
[multiUploadLinks addObject:theURL]; [multiUploadLinks addObject:theURL];
} }
if (multiUpload==3) { if (multiUpload==3) {
if ([currentPlugIn respondsToSelector:@selector(createMultiUploadPage)]) {
[currentPlugIn createMultiUploadPage];
} else {
NSString *randomizedName = [[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] MD5]; 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]; [[NSFileManager defaultManager] createFileAtPath:htmlPath contents:nil attributes:nil];
NSFileHandle *multiUploadHtml = [NSFileHandle fileHandleForWritingAtPath:htmlPath]; 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" [multiUploadHtml writeData:[NSData dataWithContentsOfFile:[[self currentMUTheme] stringByAppendingPathComponent:@"header.html"]]];
"<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\">\n" NSArray *imageExtensions = [NSArray arrayWithObjects:@"jpg", @"jpeg", @"png", @"bmp", @"gif", nil];
"<head><style>img {max-width: 100%;}</style><title>Multiple Upload Links</title></head><body>\n" dataUsingEncoding:NSUTF8StringEncoding]];
for (int i=0; i<[multiUploadLinks count]; i++) { for (int i=0; i<[multiUploadLinks count]; i++) {
NSURL *link = [multiUploadLinks objectAtIndex:i]; NSURL *link = [multiUploadLinks objectAtIndex:i];
NSString *linkString = [link absoluteString]; NSString *linkString = [link absoluteString];
NSArray *imageExtensions = [NSArray arrayWithObjects:@"jpg", @"jpeg", @"png", @"bmp", @"gif", nil];
if ([imageExtensions containsObject:[[link pathExtension] lowercaseString]]) { 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 { } 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]; [multiUploadHtml closeFile];
[self addPathToUploads:htmlPath isAutomatic:YES multiUpload:4]; [self addPathToUploads:htmlPath isAutomatic:YES multiUpload:4];
} }
}
if (multiUpload==4) { if (multiUpload==4) {
[[NSFileManager defaultManager] removeItemAtPath:[upload objectForKey:MGMUPath]]; [[NSFileManager defaultManager] removeItemAtPath:[upload objectForKey:MGMUPath]];
} }
@ -842,4 +914,11 @@ static MGMController *MGMSharedController;
[uploadLock unlock]; [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 @end

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 2/2/11. // 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> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 2/2/11. // 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" #import "MGMLocalized.h"

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/16/11. // 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> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/16/11. // 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" #import "MGMMenuItem.h"

View File

@ -3,7 +3,18 @@
// Conmote // Conmote
// //
// Created by Mr. Gecko on 1/15/11. // 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> #import <Foundation/Foundation.h>

View File

@ -16,4 +16,20 @@
- (NSArray *)allowedExtensions; - (NSArray *)allowedExtensions;
- (void)setCurrentPlugIn:(BOOL)isCurrent; - (void)setCurrentPlugIn:(BOOL)isCurrent;
- (void)sendFileAtPath:(NSString *)thePath withName:(NSString *)theName; - (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 @end

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/15/11. // 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> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/15/11. // 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" #import "MGMAccountPane.h"

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/15/11. // 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> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/15/11. // 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" #import "MGMAutoUploadPane.h"

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/15/11. // 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> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/15/11. // 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" #import "MGMEventsPane.h"

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/15/11. // 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> #import <Cocoa/Cocoa.h>
@ -17,6 +17,7 @@
IBOutlet NSTextField *historyCountField; IBOutlet NSTextField *historyCountField;
IBOutlet NSButton *growlErrors; IBOutlet NSButton *growlErrors;
IBOutlet NSTextField *uploadLimit; IBOutlet NSTextField *uploadLimit;
IBOutlet NSPopUpButton *MUThemesButton;
} }
- (id)initWithPreferences:(MGMPreferences *)thePreferences; - (id)initWithPreferences:(MGMPreferences *)thePreferences;
+ (void)setUpToolbarItem:(NSToolbarItem *)theItem; + (void)setUpToolbarItem:(NSToolbarItem *)theItem;
@ -29,4 +30,5 @@
- (IBAction)changeHistoryCount:(id)sender; - (IBAction)changeHistoryCount:(id)sender;
- (IBAction)changeGrowlErrors:(id)sender; - (IBAction)changeGrowlErrors:(id)sender;
- (IBAction)changeUploadLimit:(id)sender; - (IBAction)changeUploadLimit:(id)sender;
- (IBAction)changeMUTheme:(id)sender;
@end @end

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/15/11. // 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" #import "MGMGeneralPane.h"
@ -22,6 +22,13 @@
[historyCountField setIntValue:[preferences integerForKey:MGMHistoryCount]]; [historyCountField setIntValue:[preferences integerForKey:MGMHistoryCount]];
[growlErrors setState:([preferences boolForKey:MGMGrowlErrors] ? NSOnState : NSOffState)]; [growlErrors setState:([preferences boolForKey:MGMGrowlErrors] ? NSOnState : NSOffState)];
[uploadLimit setIntValue:[preferences integerForKey:MGMUploadLimit]]; [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; return self;
@ -82,4 +89,8 @@
- (IBAction)changeUploadLimit:(id)sender { - (IBAction)changeUploadLimit:(id)sender {
[preferences setInteger:[uploadLimit intValue] forKey:MGMUploadLimit]; [preferences setInteger:[uploadLimit intValue] forKey:MGMUploadLimit];
} }
- (IBAction)changeMUTheme:(id)sender {
MGMController *controller = [MGMController sharedController];
[controller setCurrentMUTheme:[[controller MUThemes] objectAtIndex:[MUThemesButton indexOfSelectedItem]]];
}
@end @end

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/18/11. // 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> #import <Cocoa/Cocoa.h>
@ -16,8 +16,6 @@
IBOutlet NSButton *loginButton; IBOutlet NSButton *loginButton;
BOOL userLoggingIn; BOOL userLoggingIn;
int loginTries; int loginTries;
BOOL isJSON;
} }
- (void)releaseView; - (void)releaseView;

View File

@ -3,7 +3,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 1/18/11. // 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" #import "MGMHTTPPlugIn.h"
@ -107,7 +107,7 @@ const BOOL MGMHTTPResponseInvisible = YES;
[self unlockLogin]; [self unlockLogin];
} }
- (void)checkDidFinish:(MGMURLBasicHandler *)theHandler { - (void)checkDidFinish:(MGMURLBasicHandler *)theHandler {
isJSON = [[[theHandler response] MIMEType] isEqual:@"application/json"]; BOOL isJSON = [[[theHandler response] MIMEType] isEqual:@"application/json"];
NSString *error = nil; NSString *error = nil;
NSDictionary *response = nil; NSDictionary *response = nil;
if (isJSON) { if (isJSON) {
@ -214,6 +214,7 @@ const BOOL MGMHTTPResponseInvisible = YES;
[[MGMController sharedController] upload:[theHandler object] receivedError:theError]; [[MGMController sharedController] upload:[theHandler object] receivedError:theError];
} }
- (void)uploadDidFinish:(MGMURLBasicHandler *)theHandler { - (void)uploadDidFinish:(MGMURLBasicHandler *)theHandler {
BOOL isJSON = [[[theHandler response] MIMEType] isEqual:@"application/json"];
NSString *error = nil; NSString *error = nil;
NSDictionary *response = nil; NSDictionary *response = nil;
if (isJSON) { if (isJSON) {

View File

@ -46,6 +46,7 @@
2A2F97A212F05C720069B37E /* FTP.bundle in PlugIns */ = {isa = PBXBuildFile; fileRef = 2A0C8C9412EF844F00A75AB7 /* FTP.bundle */; }; 2A2F97A212F05C720069B37E /* FTP.bundle in PlugIns */ = {isa = PBXBuildFile; fileRef = 2A0C8C9412EF844F00A75AB7 /* FTP.bundle */; };
2A2F995412F094F10069B37E /* SFTP.bundle in PlugIns */ = {isa = PBXBuildFile; fileRef = 2A2F994512F094710069B37E /* SFTP.bundle */; }; 2A2F995412F094F10069B37E /* SFTP.bundle in PlugIns */ = {isa = PBXBuildFile; fileRef = 2A2F994512F094710069B37E /* SFTP.bundle */; };
2A2F996E12F095DA0069B37E /* MGMSFTPPlugIn.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A2F996D12F095DA0069B37E /* MGMSFTPPlugIn.m */; }; 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 */; }; 2A48832E12E52E84001618B5 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A48832D12E52E84001618B5 /* RegexKitLite.m */; };
2A48833512E52EAA001618B5 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A48833412E52EAA001618B5 /* libicucore.dylib */; }; 2A48833512E52EAA001618B5 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A48833412E52EAA001618B5 /* libicucore.dylib */; };
2A48835612E53232001618B5 /* MGMAutoUpdateField.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A48835512E53232001618B5 /* MGMAutoUpdateField.m */; }; 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>"; }; 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>"; }; 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; }; 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>"; }; 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>"; }; 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; }; 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 */, 2AEF118512F52A7D00F495BE /* CocoaShareIcon.png */,
2A52DDC612E3AC26000FC8CD /* menuicon.png */, 2A52DDC612E3AC26000FC8CD /* menuicon.png */,
2A52DDC712E3AC26000FC8CD /* menuicondrag.png */, 2A52DDC712E3AC26000FC8CD /* menuicondrag.png */,
2A3954E61C3194A700DE02CC /* Multi Upload Themes */,
2A52DF5712E3D041000FC8CD /* menuiconselected.png */, 2A52DF5712E3D041000FC8CD /* menuiconselected.png */,
2A52DDC812E3AC26000FC8CD /* menuiconupload.png */, 2A52DDC812E3AC26000FC8CD /* menuiconupload.png */,
2A4FA61012F9F8DE009F5B3A /* Localizable.strings */, 2A4FA61012F9F8DE009F5B3A /* Localizable.strings */,
@ -1105,6 +1108,7 @@
2AEAB4EF12E2B2F600552BAA /* GeneralPane.xib in Resources */, 2AEAB4EF12E2B2F600552BAA /* GeneralPane.xib in Resources */,
2AEAB4F112E2B2FB00552BAA /* AccountPane.xib in Resources */, 2AEAB4F112E2B2FB00552BAA /* AccountPane.xib in Resources */,
2AEAB4F312E2B2FF00552BAA /* AutoUploadPane.xib in Resources */, 2AEAB4F312E2B2FF00552BAA /* AutoUploadPane.xib in Resources */,
2A3954E71C3194A700DE02CC /* Multi Upload Themes in Resources */,
2AEAB4F512E2B30500552BAA /* EventsPane.xib in Resources */, 2AEAB4F512E2B30500552BAA /* EventsPane.xib in Resources */,
2AEAB53712E2B68300552BAA /* dsa_pub.pem in Resources */, 2AEAB53712E2B68300552BAA /* dsa_pub.pem in Resources */,
2A52DDC512E3AC17000FC8CD /* CocoaShare.icns in Resources */, 2A52DDC512E3AC17000FC8CD /* CocoaShare.icns in Resources */,

View File

@ -54,7 +54,7 @@
<key>MGMGRTimeZone</key> <key>MGMGRTimeZone</key>
<string>CST</string> <string>CST</string>
<key>NSHumanReadableCopyright</key> <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> <key>NSMainNibFile</key>
<string>MainMenu</string> <string>MainMenu</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>

View File

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

View File

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

View File

@ -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>

View File

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

View File

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

View File

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

View File

@ -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>

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
// CocoaShare // CocoaShare
// //
// Created by Mr. Gecko on 4/14/10. // 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 { class shortID {