Some documentation added for KeePassHttp stuff

This commit is contained in:
michael starke
2013-12-18 11:41:20 +01:00
parent 9fbf42322f
commit 08f897437b
6 changed files with 48 additions and 16 deletions

View File

@@ -48,11 +48,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="StringCell" id="269">
<rect key="frame" x="1" y="1" width="105" height="17"/>
<rect key="frame" x="1" y="1" width="104.5" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="270">
<rect key="frame" x="1" y="0.0" width="103" height="17"/>
<rect key="frame" x="1" y="0.0" width="102.5" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="271">
<font key="font" metaFont="system"/>
@@ -86,7 +86,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="ImageCell" id="297">
<rect key="frame" x="109" y="1" width="144" height="17"/>
<rect key="frame" x="108.5" y="1" width="144" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="298">
@@ -136,11 +136,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="PasswordCell" id="428">
<rect key="frame" x="256" y="1" width="119" height="17"/>
<rect key="frame" x="255.5" y="1" width="118.5" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="429" customClass="NSSecureTextField">
<rect key="frame" x="1" y="0.0" width="117" height="17"/>
<rect key="frame" x="1" y="0.0" width="116.5" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="430">
<font key="font" metaFont="system"/>
@@ -174,7 +174,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="421">
<rect key="frame" x="378" y="1" width="113" height="17"/>
<rect key="frame" x="377" y="1" width="113" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="422">
@@ -212,7 +212,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="616">
<rect key="frame" x="494" y="1" width="198" height="17"/>
<rect key="frame" x="493" y="1" width="198" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="617">

View File

@@ -8,6 +8,10 @@
#import "HTTPConnection.h"
/**
* Default Connection to handle the KeepassHttp POST requests. The Connection doesn't do anything,
* besides using the MPRequestHandlerService to handle any request from KeePassHttp and send's back the replies
*/
@interface MPConnection : HTTPConnection
@end

View File

@@ -63,6 +63,7 @@ NSString *const MPRequestTypeKey = @"RequestType";
- (void)_parseRequest:(NSDictionary *)aRequest {
/* TODO: generate a response */
NSString *requestType = aRequest[MPRequestTypeKey];
if(!requestType) {
NSLog(@"Malformed Request. Missing request type");

View File

@@ -10,17 +10,30 @@
@class KPKEntry;
@class MPDocument;
/**
* Service to querey for entries
* Service for querying for resultis withing a request
* This shared instance handles creating of config entries,
* and abstracts all open documents for the KeePassHttp interface.
*/
@interface MPDocumentQueryService : NSObject
/**
* The MPDocument we currently use for our queries
*/
@property (readonly, weak) MPDocument *queryDocument;
@property (readonly, weak) KPKEntry *configEntry;
/**
* The Config entry we did find in our query document
*/
@property (nonatomic, readonly, weak) KPKEntry *configurationEntry;
/**
* Access the shared instance of the service
*
* @return shared MPDocumentQueryService instance
*/
+ (MPDocumentQueryService *)sharedService;
- (KPKEntry *)configurationEntry;
- (KPKEntry *)createConfigurationEntry;
@end

View File

@@ -18,7 +18,7 @@ static NSUUID *_rootUuid = nil;
@interface MPDocumentQueryService ()
@property (weak) MPDocument *queryDocument;
@property (weak) KPKEntry *configEntry;
@property (nonatomic, weak) KPKEntry *configurationEntry;
@end
@@ -46,8 +46,9 @@ static NSUUID *_rootUuid = nil;
}
- (KPKEntry *)configurationEntry {
if(nil != _configEntry) {
return _configEntry;
/* TODO: lazy getter or do something differen like init at first call? */
if(nil != _configurationEntry) {
return _configurationEntry;
}
/* no config entry there, start looking for it */
NSArray *documents = [[NSDocumentController sharedDocumentController] documents];
@@ -59,9 +60,9 @@ static NSUUID *_rootUuid = nil;
}
KPKEntry *configEntry = [document findEntry:_rootUuid];
if(nil != configEntry) {
_configEntry = configEntry;
_queryDocument = document;
return _configEntry;
self.configurationEntry = configEntry;
self.queryDocument = document;
return _configurationEntry;
}
}
return nil;

View File

@@ -8,10 +8,23 @@
#import <Foundation/Foundation.h>
/**
* Protocol for request handling of KeePassHttp request
*/
@protocol MPServerRequestHandling <NSObject>
@required
/**
* A unique identifier for the request handler
*
* @return NSString representing the identifier
*/
- (NSString *)identifier;
/**
* Formulate a response to the request passed in as Dictionary
*
* @param data An NSDictionary containing the parsed JSON reuest
*/
- (void)respondTo:(NSDictionary *)data;
@end