Revision: 29237
          http://sourceforge.net/p/bibdesk/svn/29237
Author:   hofman
Date:     2025-04-29 09:38:46 +0000 (Tue, 29 Apr 2025)
Log Message:
-----------
Add an option to use https for SRU search

Modified Paths:
--------------
    trunk/bibdesk/BDSKSRUGroupServer.m
    trunk/bibdesk/BDSKServerInfo.h
    trunk/bibdesk/BDSKServerInfo.m
    trunk/bibdesk/Base.lproj/BDSKSearchGroupSheet.xib
    trunk/bibdesk/de.lproj/BDSKSearchGroupSheet.strings
    trunk/bibdesk/en.lproj/BDSKSearchGroupSheet.strings
    trunk/bibdesk/fr.lproj/BDSKSearchGroupSheet.strings

Modified: trunk/bibdesk/BDSKSRUGroupServer.m
===================================================================
--- trunk/bibdesk/BDSKSRUGroupServer.m  2025-04-28 19:34:02 UTC (rev 29236)
+++ trunk/bibdesk/BDSKSRUGroupServer.m  2025-04-29 09:38:46 UTC (rev 29237)
@@ -113,7 +113,7 @@
     NSInteger port = [[[self serverInfo] port] integerValue];
     NSString *database = [[[self serverInfo] database] 
stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet 
URLPathAllowedCharacterSet]];
     NSURLComponents *components = [[NSURLComponents alloc] init];
-    [components setScheme:@"http"];
+    [components setScheme:[[self serverInfo] isSecure] ? @"https" : @"http"];
     [components setPercentEncodedHost:host];
     if (port > 0)
         [components setPort:[NSNumber numberWithInteger:port]];

Modified: trunk/bibdesk/BDSKServerInfo.h
===================================================================
--- trunk/bibdesk/BDSKServerInfo.h      2025-04-28 19:34:02 UTC (rev 29236)
+++ trunk/bibdesk/BDSKServerInfo.h      2025-04-29 09:38:46 UTC (rev 29237)
@@ -80,6 +80,7 @@
 @property (nonatomic, nullable, readonly) NSString *resultEncoding;
 @property (nonatomic, nullable, readonly) NSString *queryConfig;
 @property (nonatomic, readonly) BOOL removeDiacritics;
+@property (nonatomic, readonly, getter=isSecure) BOOL secure;
 @property (nonatomic, readonly, getter=isLite) BOOL lite;
 @property (nonatomic, nullable, readonly) NSDictionary *options;
 
@@ -112,6 +113,7 @@
 @property (nonatomic, nullable, copy) NSString *recordSyntax;
 @property (nonatomic, nullable, copy) NSString *resultEncoding;
 @property (nonatomic) BOOL removeDiacritics;
+@property (nonatomic, getter=isSecure) BOOL secure;
 @property (nonatomic, getter=isLite) BOOL lite;
 
 @end

Modified: trunk/bibdesk/BDSKServerInfo.m
===================================================================
--- trunk/bibdesk/BDSKServerInfo.m      2025-04-28 19:34:02 UTC (rev 29236)
+++ trunk/bibdesk/BDSKServerInfo.m      2025-04-29 09:38:46 UTC (rev 29237)
@@ -56,6 +56,7 @@
 #define QUERYCONFIG_KEY      @"queryConfig"
 #define REMOVEDIACRITICS_KEY @"removeDiacritics"
 #define LITE_KEY             @"lite"
+#define SECURE_KEY           @"secure"
 
 #define DEFAULT_NAME     NSLocalizedString(@"New Server", @"")
 #define DEFAULT_DATABASE @"database"
@@ -81,7 +82,7 @@
 @implementation BDSKServerInfo
 
 @synthesize type, name, database;
-@dynamic dictionaryValue, host, port, username, recordSyntax, resultEncoding, 
queryConfig, removeDiacritics, lite, options, entrez, zoom, ISI, DBLP, SRU, 
serverType, URLValue;
+@dynamic dictionaryValue, host, port, username, recordSyntax, resultEncoding, 
queryConfig, removeDiacritics, secure, lite, options, entrez, zoom, ISI, DBLP, 
SRU, serverType, URLValue;
 
 + (BOOL)accessInstanceVariablesDirectly { return NO; }
 
@@ -244,6 +245,8 @@
 
 - (BOOL)removeDiacritics { return [[options objectForKey:REMOVEDIACRITICS_KEY] 
boolValue]; }
 
+- (BOOL)isSecure { return [[options objectForKey:SECURE_KEY] boolValue]; }
+
 - (BOOL)isLite { return [[options objectForKey:LITE_KEY] boolValue]; }
 
 - (NSDictionary *)options {
@@ -369,8 +372,10 @@
     } else if ([self isSRU]) {
         NSMutableArray *query = [NSMutableArray arrayWithObject:@"type=sru"];
         [options enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString 
*value, BOOL *stop){
-            if ([key isEqualToString:USERNAME_KEY] == NO)
+            if ([key isEqualToString:SECURE_KEY] == NO)
                 [query addObject:[NSString stringWithFormat:@"%@=%@", key, 
[value stringByAddingPercentEscapesForQueryTerm]]];
+            else if ([self isSecure])
+                [components setPercentEncodedQuery:@"secure=1"];
         }];
         [components setPercentEncodedQuery:[query 
componentsJoinedByString:@"&"]];
     } else if ([self isISI] && [self isLite]) {
@@ -385,7 +390,7 @@
 
 @implementation BDSKMutableServerInfo
 
-@dynamic type, name, database, host, port, password, username, recordSyntax, 
resultEncoding, removeDiacritics, lite, options;
+@dynamic type, name, database, host, port, password, username, recordSyntax, 
resultEncoding, removeDiacritics, secure, lite, options;
 
 static NSSet *keysAffectedByType = nil;
 static NSSet *typeSet = nil;
@@ -392,7 +397,7 @@
 
 + (void)initialize {
     BDSKINITIALIZE;
-    keysAffectedByType = [[NSSet alloc] initWithObjects:@"serverType", 
HOST_KEY, PORT_KEY, PASSWORD_KEY, USERNAME_KEY, RECORDSYNTAX_KEY, 
RESULTENCODING_KEY, REMOVEDIACRITICS_KEY, LITE_KEY, nil];
+    keysAffectedByType = [[NSSet alloc] initWithObjects:@"serverType", 
HOST_KEY, PORT_KEY, PASSWORD_KEY, USERNAME_KEY, RECORDSYNTAX_KEY, 
RESULTENCODING_KEY, REMOVEDIACRITICS_KEY, SECURE_KEY, LITE_KEY, nil];
     typeSet = [[NSSet alloc] initWithObjects:TYPE_KEY, nil];
 }
 
@@ -511,6 +516,11 @@
     [self setOptionValue:(flag ? @"YES" : nil) forKey:REMOVEDIACRITICS_KEY];
 }
 
+- (void)setSecure:(BOOL)flag;
+{
+    [self setOptionValue:(flag ? @"YES" : nil) forKey:SECURE_KEY];
+}
+
 - (void)setLite:(BOOL)flag;
 {
     [self setOptionValue:(flag ? @"YES" : nil) forKey:LITE_KEY];

Modified: trunk/bibdesk/Base.lproj/BDSKSearchGroupSheet.xib
===================================================================
--- trunk/bibdesk/Base.lproj/BDSKSearchGroupSheet.xib   2025-04-28 19:34:02 UTC 
(rev 29236)
+++ trunk/bibdesk/Base.lproj/BDSKSearchGroupSheet.xib   2025-04-29 09:38:46 UTC 
(rev 29237)
@@ -645,6 +645,30 @@
                                             <outlet property="nextKeyView" 
destination="194" id="6vp-QE-iyB"/>
                                         </connections>
                                     </comboBox>
+                                    <button toolTip="Use https" 
translatesAutoresizingMaskIntoConstraints="NO" id="nTD-tF-zzg">
+                                        <rect key="frame" x="96" y="67" 
width="58" height="16"/>
+                                        <buttonCell key="cell" type="check" 
title="Secure" bezelStyle="regularSquare" imagePosition="left" alignment="left" 
controlSize="small" state="on" inset="2" id="8yH-PP-g6U">
+                                            <behavior key="behavior" 
changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" 
metaFont="message" size="11"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <binding destination="-2" 
name="enabled2" keyPath="SRU" previousBinding="7lm-7C-ADf" id="Fuf-uY-G8r">
+                                                <dictionary key="options">
+                                                    <integer 
key="NSMultipleValuesPlaceholder" value="-1"/>
+                                                    <integer 
key="NSNoSelectionPlaceholder" value="-1"/>
+                                                    <integer 
key="NSNotApplicablePlaceholder" value="-1"/>
+                                                    <integer 
key="NSNullPlaceholder" value="-1"/>
+                                                </dictionary>
+                                            </binding>
+                                            <binding destination="-2" 
name="enabled" keyPath="editable" id="7lm-7C-ADf"/>
+                                            <binding destination="-2" 
name="hidden" keyPath="SRU" previousBinding="Fuf-uY-G8r" id="Mz7-eb-7dl">
+                                                <dictionary key="options">
+                                                    <string 
key="NSValueTransformerName">NSNegateBoolean</string>
+                                                </dictionary>
+                                            </binding>
+                                            <binding destination="569" 
name="value" keyPath="selection.secure" id="Woe-P1-njP"/>
+                                        </connections>
+                                    </button>
                                 </subviews>
                                 <constraints>
                                     <constraint firstItem="3BL-J9-tal" 
firstAttribute="top" secondItem="318" secondAttribute="bottom" constant="8" 
symbolic="YES" id="0bA-6h-hzI"/>
@@ -659,6 +683,7 @@
                                     <constraint firstItem="250" 
firstAttribute="firstBaseline" secondItem="296" secondAttribute="firstBaseline" 
id="2qw-YB-6Ae"/>
                                     <constraint firstItem="194" 
firstAttribute="leading" secondItem="3BL-J9-tal" secondAttribute="leading" 
id="3BB-IE-AFV"/>
                                     <constraint firstItem="250" 
firstAttribute="top" secondItem="316" secondAttribute="bottom" constant="8" 
symbolic="YES" id="3on-5G-TpL"/>
+                                    <constraint firstItem="nTD-tF-zzg" 
firstAttribute="leading" secondItem="3BL-J9-tal" secondAttribute="leading" 
id="3qP-Bm-ARu"/>
                                     <constraint firstAttribute="bottom" 
secondItem="260" secondAttribute="bottom" constant="8" id="3z6-1F-2WX"/>
                                     <constraint firstItem="201" 
firstAttribute="top" secondItem="194" secondAttribute="bottom" constant="8" 
symbolic="YES" id="4Zv-6g-ZoO"/>
                                     <constraint firstAttribute="trailing" 
relation="greaterThanOrEqual" secondItem="985" secondAttribute="trailing" 
constant="20" symbolic="YES" id="4l5-LZ-0F0"/>
@@ -669,6 +694,7 @@
                                     <constraint firstItem="275" 
firstAttribute="leading" relation="greaterThanOrEqual" secondItem="189" 
secondAttribute="leading" constant="32" id="8lq-5S-qhX"/>
                                     <constraint firstAttribute="trailing" 
relation="greaterThanOrEqual" secondItem="247" secondAttribute="trailing" 
constant="20" symbolic="YES" id="8xy-y2-7Ym"/>
                                     <constraint firstItem="258" 
firstAttribute="top" secondItem="250" secondAttribute="bottom" constant="8" 
symbolic="YES" id="9ip-xN-yVd"/>
+                                    <constraint firstAttribute="trailing" 
relation="greaterThanOrEqual" secondItem="nTD-tF-zzg" 
secondAttribute="trailing" constant="20" symbolic="YES" id="9xE-Gs-7Kh"/>
                                     <constraint firstItem="316" 
firstAttribute="leading" secondItem="189" secondAttribute="leading" 
constant="12" id="Aq1-KC-EzH"/>
                                     <constraint firstItem="201" 
firstAttribute="leading" secondItem="3BL-J9-tal" secondAttribute="leading" 
id="BId-hK-GcU"/>
                                     <constraint firstAttribute="trailing" 
secondItem="260" secondAttribute="trailing" constant="12" id="BVi-Ww-Jq8"/>
@@ -704,6 +730,7 @@
                                     <constraint firstItem="277" 
firstAttribute="top" secondItem="201" secondAttribute="bottom" constant="8" 
symbolic="YES" id="Ywb-yl-dZO"/>
                                     <constraint firstItem="258" 
firstAttribute="leading" secondItem="189" secondAttribute="leading" 
constant="12" id="akZ-6M-6Ke"/>
                                     <constraint firstAttribute="trailing" 
secondItem="258" secondAttribute="trailing" constant="12" id="bcf-zK-Eeb"/>
+                                    <constraint firstItem="nTD-tF-zzg" 
firstAttribute="firstBaseline" secondItem="195" secondAttribute="firstBaseline" 
id="dMp-mu-0lU"/>
                                     <constraint firstAttribute="trailing" 
relation="greaterThanOrEqual" secondItem="8U9-Rn-xYX" 
secondAttribute="trailing" constant="20" symbolic="YES" id="esF-2B-ds7"/>
                                     <constraint firstItem="8U9-Rn-xYX" 
firstAttribute="leading" secondItem="RmO-um-4HP" secondAttribute="trailing" 
constant="8" symbolic="YES" id="f2m-Sw-3hc"/>
                                     <constraint firstItem="318" 
firstAttribute="leading" secondItem="189" secondAttribute="leading" 
constant="20" symbolic="YES" id="fDF-1D-GZm"/>

Modified: trunk/bibdesk/de.lproj/BDSKSearchGroupSheet.strings
===================================================================
(Binary files differ)

Modified: trunk/bibdesk/en.lproj/BDSKSearchGroupSheet.strings
===================================================================
(Binary files differ)

Modified: trunk/bibdesk/fr.lproj/BDSKSearchGroupSheet.strings
===================================================================
(Binary files differ)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to