mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-21 05:43:59 -07:00
Pass authtoken in from user, and add a wrapper for web UI on Mac.
This commit is contained in:
parent
e58047eaa0
commit
5b54612d91
68 changed files with 7537 additions and 1 deletions
51
ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.m
Normal file
51
ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.m
Normal file
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// clipboard.m
|
||||
// MacGap
|
||||
//
|
||||
// Created by David Zorychta on 2013-07-22.
|
||||
// Copyright (c) 2013 Twitter. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Clipboard.h"
|
||||
|
||||
@implementation Clipboard
|
||||
|
||||
- (void) copy:(NSString*)text {
|
||||
[[NSPasteboard generalPasteboard] clearContents];
|
||||
[[NSPasteboard generalPasteboard] setString:text forType:NSStringPboardType];
|
||||
}
|
||||
|
||||
- (NSString *) paste {
|
||||
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
||||
NSArray *classArray = [NSArray arrayWithObject:[NSString class]];
|
||||
NSDictionary *options = [NSDictionary dictionary];
|
||||
BOOL ok = [pasteboard canReadObjectForClasses:classArray options:options];
|
||||
if (ok) {
|
||||
NSArray *objectsToPaste = [pasteboard readObjectsForClasses:classArray options:options];
|
||||
return (NSString *) [objectsToPaste objectAtIndex:0];
|
||||
}
|
||||
return @"";
|
||||
}
|
||||
|
||||
+ (NSString*) webScriptNameForSelector:(SEL)selector
|
||||
{
|
||||
id result = nil;
|
||||
|
||||
if (selector == @selector(copy:)) {
|
||||
result = @"copy";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue