CryptoPassphrase  Check-in [8545f203d8]

Overview
Comment:iOS: Add initial support for upload via browser

This only starts the HTTP server on 127.0.0.1 for now and does nothing
else yet.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8545f203d887dabfe2bfa66dce2d371b89a6a0d07f68d97404d713b5e7eca3ca
User & Date: js on 2018-01-11 22:49:18
Other Links: manifest | tags
Context
2018-01-11
22:53
Update copyright check-in: 6e2e7e9f37 user: js tags: trunk
22:49
iOS: Add initial support for upload via browser check-in: 8545f203d8 user: js tags: trunk
2017-11-26
21:51
iOS: Finish support for key files check-in: d49bbec74c user: js tags: trunk
Changes

Modified iOS/Base.lproj/Main.storyboard from [6479de6e84] to [71a7f22c0c].

1
2

3
4
5
6
7
8

9
10
11
12
13
14
15
1

2
3
4
5
6
7

8
9
10
11
12
13
14
15

-
+





-
+







<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BN3-Y7-zvx">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BN3-Y7-zvx">
    <device id="retina4_7" orientation="portrait">
        <adaptation id="fullscreen"/>
    </device>
    <dependencies>
        <deployment identifier="iOS"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
        <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <scenes>
        <!--Navigation Controller-->
        <scene sceneID="edE-sY-0Cv">
            <objects>
323
324
325
326
327
328
329
330








331
332
333
334
335
336
337
323
324
325
326
327
328
329

330
331
332
333
334
335
336
337
338
339
340
341
342
343
344







-
+
+
+
+
+
+
+
+







                        </prototypes>
                        <connections>
                            <outlet property="dataSource" destination="4bs-rP-TxE" id="ETv-7q-fl3"/>
                            <outlet property="delegate" destination="4bs-rP-TxE" id="Tnz-0X-Y4f"/>
                        </connections>
                    </tableView>
                    <toolbarItems/>
                    <navigationItem key="navigationItem" id="bWa-Dd-f4f"/>
                    <navigationItem key="navigationItem" id="bWa-Dd-f4f">
                        <nil key="title"/>
                        <barButtonItem key="rightBarButtonItem" title="Upload" id="85s-WF-868">
                            <connections>
                                <action selector="upload:" destination="4bs-rP-TxE" id="DnV-UG-h0y"/>
                            </connections>
                        </barButtonItem>
                    </navigationItem>
                    <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
                </tableViewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="hBM-t2-PD9" userLabel="First Responder" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="2935" y="-1234"/>
        </scene>
        <!--Show Details Controller-->

Added iOS/HTTPServerDelegate.h version [aba6c4de13].

Added iOS/HTTPServerDelegate.m version [93f5647bae].

Modified iOS/Info.plist from [cc5f97ce78] to [586d47c6dd].

11
12
13
14
15
16
17
18

19
20

21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
11
12
13
14
15
16
17

18
19

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39


40
41







-
+

-
+

+
+
















-
-


	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.1</string>
	<string>1.2</string>
	<key>CFBundleVersion</key>
	<string>3</string>
	<string>1</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>UIFileSharingEnabled</key>
	<true/>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIMainStoryboardFile</key>
	<string>Main</string>
	<key>UIRequiredDeviceCapabilities</key>
	<array>
		<string>armv7</string>
	</array>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
	</array>
	<key>UIFileSharingEnabled</key>
	<true/>
</dict>
</plist>

Modified iOS/SelectKeyFileController.h from [3a78e95089] to [93a4b132d1].

17
18
19
20
21
22
23

24
25

26
27
28
29
30



31
32
33


34
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41







+


+





+
+
+



+
+

 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import <UIKit/UIKit.h>
#import <ObjFW/ObjFW.h>

#import "AddSiteController.h"
#import "HTTPServerDelegate.h"

@interface SelectKeyFileController: UITableViewController <UITableViewDelegate,
    UITableViewDataSource>
{
	NSArray<NSString *> *_keyFiles;
	OFHTTPServer *_HTTPServer;
	HTTPServerDelegate *_HTTPServerDelegate;
	OFThread *_HTTPServerThread;
}

@property (retain) AddSiteController *addSiteController;

- (IBAction)upload:(id)sender;
@end

Modified iOS/SelectKeyFileController.m from [325d611e26] to [c879d4f70c].

16
17
18
19
20
21
22



23
24
25
26
27
28
29
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32







+
+
+







 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import <ObjFW_Bridge/ObjFW_Bridge.h>

#import "HTTPServerDelegate.h"
#import "SelectKeyFileController.h"

@implementation SelectKeyFileController
- (void)viewDidLoad
{
	NSString *documentDirectory;
	NSArray<NSString *> *keyFiles;
46
47
48
49
50
51
52











53
54
55
56
57








58
59
60
61
62
63
64
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86







+
+
+
+
+
+
+
+
+
+
+





+
+
+
+
+
+
+
+







		NSLog(@"Could not get key files: %@", error);
		[self.navigationController popViewControllerAnimated: YES];
		return;
	}

	_keyFiles = [[keyFiles sortedArrayUsingSelector:
	    @selector(compare:)] retain];

	_HTTPServer = [[OFHTTPServer alloc] init];
	@autoreleasepool {
		_HTTPServer.host = @"127.0.0.1".OFObject;
	}

	_HTTPServerDelegate = [[HTTPServerDelegate alloc] init];
	_HTTPServer.delegate = _HTTPServerDelegate;

	_HTTPServerThread = [[OFThread alloc] init];
	[_HTTPServerThread start];
}

- (void)dealloc
{
	[_keyFiles release];

	[_HTTPServerThread.runLoop stop];
	[_HTTPServerThread join];
	[_HTTPServerThread release];

	[_HTTPServer release];

	[_HTTPServerDelegate release];

	[super dealloc];
}

-  (NSInteger)tableView: (UITableView *)tableView
  numberOfRowsInSection: (NSInteger)section
{
88
89
90
91
92
93
94



































95
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

	self.addSiteController.keyFile =
	    (indexPath.row > 0 ? _keyFiles[indexPath.row - 1] : nil);
	self.addSiteController.keyFileLabel.text =
	    (indexPath.row > 0 ? _keyFiles[indexPath.row - 1] : @"None");

	[self.navigationController popViewControllerAnimated: YES];
}

- (void)upload: (id)sender
{
	[_HTTPServerThread.runLoop addTimer: [OFTimer
	    scheduledTimerWithTimeInterval: 0
				   repeats: false
				     block: ^ (OFTimer *timer) {
		NSString *message;
		UIAlertController *alert;

		_HTTPServer.port = 0;
		[_HTTPServer start];

		message = [NSString stringWithFormat:
		    @"Navigate to http://%@:%u/ with your browser.\n\n"
		    @"Press OK when done.",
		    _HTTPServer.host.NSObject, _HTTPServer.port];
		alert = [UIAlertController
		    alertControllerWithTitle: @"Server Running"
				     message: message
			      preferredStyle: UIAlertControllerStyleAlert];
		[alert addAction:
		    [UIAlertAction actionWithTitle: @"OK"
					     style: UIAlertActionStyleDefault
					   handler: nil]];

		dispatch_sync(dispatch_get_main_queue(), ^ {
			[self presentViewController: alert
					   animated: YES
					 completion: ^ {
				[_HTTPServer stop];
			}];
		});
	}]];
}
@end

Modified iOS/scrypt-pwgen.xcodeproj/project.pbxproj from [215e12d1d4] to [a326a4411d].

15
16
17
18
19
20
21

22
23
24
25
26
27
28
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29







+







		4B2E52EC1DA942840040D091 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B2E52EB1DA942840040D091 /* Assets.xcassets */; };
		4B2E52EF1DA942840040D091 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B2E52ED1DA942840040D091 /* LaunchScreen.storyboard */; };
		4B82D1151DAAAFCE00F32B2F /* AboutController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B82D1141DAAAFCE00F32B2F /* AboutController.m */; };
		4B9525251F96BB900095F259 /* ObjFW.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B9525231F96BB820095F259 /* ObjFW.framework */; };
		4B9525261F96BB900095F259 /* ObjFW_Bridge.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B9525241F96BB820095F259 /* ObjFW_Bridge.framework */; };
		4B9525291F994CD30095F259 /* ObjFW.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4B9525231F96BB820095F259 /* ObjFW.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
		4B95252A1F9953350095F259 /* ObjFW_Bridge.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4B9525241F96BB820095F259 /* ObjFW_Bridge.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
		4B9EB1152008167200EB66F2 /* HTTPServerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B9EB1142008167200EB66F2 /* HTTPServerDelegate.m */; settings = {COMPILER_FLAGS = "-fconstant-string-class=OFConstantString -fno-constant-cfstrings"; }; };
		4BA115D21DA9432D007ED4EA /* LegacyPasswordGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA115CE1DA9432D007ED4EA /* LegacyPasswordGenerator.m */; settings = {COMPILER_FLAGS = "-fconstant-string-class=OFConstantString -fno-constant-cfstrings"; }; };
		4BA115D31DA9432D007ED4EA /* NewPasswordGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA115D01DA9432D007ED4EA /* NewPasswordGenerator.m */; settings = {COMPILER_FLAGS = "-fconstant-string-class=OFConstantString -fno-constant-cfstrings"; }; };
		4BA115D61DA94390007ED4EA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BA115D51DA94390007ED4EA /* UIKit.framework */; };
		4BB3CDFD1DA9764300FEE5ED /* AddSiteController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BB3CDFC1DA9764300FEE5ED /* AddSiteController.m */; };
		4BC29DD51FCB5FAE00A1E786 /* SelectKeyFileController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC29DD41FCB5FAE00A1E786 /* SelectKeyFileController.m */; };
		4BF4ADEA1DA9A3DB0073B995 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BF4ADE91DA9A3DB0073B995 /* Foundation.framework */; };
		4BF4ADED1DA9A6B00073B995 /* SiteStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF4ADEC1DA9A6B00073B995 /* SiteStorage.m */; settings = {COMPILER_FLAGS = "-fconstant-string-class=OFConstantString -fno-constant-cfstrings"; }; };
56
57
58
59
60
61
62


63
64
65
66
67
68
69
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72







+
+







		4B2E52EB1DA942840040D091 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
		4B2E52EE1DA942840040D091 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
		4B2E52F01DA942840040D091 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
		4B82D1131DAAAFCE00F32B2F /* AboutController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutController.h; sourceTree = "<group>"; };
		4B82D1141DAAAFCE00F32B2F /* AboutController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AboutController.m; sourceTree = "<group>"; };
		4B9525231F96BB820095F259 /* ObjFW.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ObjFW.framework; path = ObjFW/Frameworks/ObjFW.framework; sourceTree = "<group>"; };
		4B9525241F96BB820095F259 /* ObjFW_Bridge.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ObjFW_Bridge.framework; path = ObjFW/Frameworks/ObjFW_Bridge.framework; sourceTree = "<group>"; };
		4B9EB1142008167200EB66F2 /* HTTPServerDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HTTPServerDelegate.m; sourceTree = "<group>"; };
		4B9EB1162008168400EB66F2 /* HTTPServerDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HTTPServerDelegate.h; sourceTree = "<group>"; };
		4BA115CD1DA9432D007ED4EA /* LegacyPasswordGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LegacyPasswordGenerator.h; path = ../LegacyPasswordGenerator.h; sourceTree = "<group>"; };
		4BA115CE1DA9432D007ED4EA /* LegacyPasswordGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LegacyPasswordGenerator.m; path = ../LegacyPasswordGenerator.m; sourceTree = "<group>"; };
		4BA115CF1DA9432D007ED4EA /* NewPasswordGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NewPasswordGenerator.h; path = ../NewPasswordGenerator.h; sourceTree = "<group>"; };
		4BA115D01DA9432D007ED4EA /* NewPasswordGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NewPasswordGenerator.m; path = ../NewPasswordGenerator.m; sourceTree = "<group>"; };
		4BA115D11DA9432D007ED4EA /* PasswordGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PasswordGenerator.h; path = ../PasswordGenerator.h; sourceTree = "<group>"; };
		4BA115D51DA94390007ED4EA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
		4BB3CDFB1DA9764300FEE5ED /* AddSiteController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddSiteController.h; sourceTree = "<group>"; };
114
115
116
117
118
119
120


121
122
123
124
125
126
127
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132







+
+







				4B2E52EB1DA942840040D091 /* Assets.xcassets */,
				4B82D1131DAAAFCE00F32B2F /* AboutController.h */,
				4B82D1141DAAAFCE00F32B2F /* AboutController.m */,
				4BB3CDFB1DA9764300FEE5ED /* AddSiteController.h */,
				4BB3CDFC1DA9764300FEE5ED /* AddSiteController.m */,
				4B2E52E21DA942840040D091 /* AppDelegate.h */,
				4B2E52E31DA942840040D091 /* AppDelegate.m */,
				4B9EB1162008168400EB66F2 /* HTTPServerDelegate.h */,
				4B9EB1142008167200EB66F2 /* HTTPServerDelegate.m */,
				4B2E52F01DA942840040D091 /* Info.plist */,
				4B2E52ED1DA942840040D091 /* LaunchScreen.storyboard */,
				4B2E52E81DA942840040D091 /* Main.storyboard */,
				4B2E52E51DA942840040D091 /* MainViewController.h */,
				4B2E52E61DA942840040D091 /* MainViewController.m */,
				4BC29DD61FCB5FC400A1E786 /* SelectKeyFileController.h */,
				4BC29DD41FCB5FAE00A1E786 /* SelectKeyFileController.m */,
230
231
232
233
234
235
236

237
238
239
240
241
242
243
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249







+







			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				4B82D1151DAAAFCE00F32B2F /* AboutController.m in Sources */,
				4BC29DD51FCB5FAE00A1E786 /* SelectKeyFileController.m in Sources */,
				4BB3CDFD1DA9764300FEE5ED /* AddSiteController.m in Sources */,
				4B2E52E41DA942840040D091 /* AppDelegate.m in Sources */,
				4B9EB1152008167200EB66F2 /* HTTPServerDelegate.m in Sources */,
				4BA115D21DA9432D007ED4EA /* LegacyPasswordGenerator.m in Sources */,
				4B2E52E71DA942840040D091 /* MainViewController.m in Sources */,
				4BA115D31DA9432D007ED4EA /* NewPasswordGenerator.m in Sources */,
				4B0719251DAA78D80065997A /* ShowDetailsController.m in Sources */,
				4BF4ADED1DA9A6B00073B995 /* SiteStorage.m in Sources */,
				4B2E52E11DA942840040D091 /* main.m in Sources */,
			);