CryptoPassphrase  Diff

Differences From Artifact [325d611e26]:

To Artifact [c879d4f70c]:


16
17
18
19
20
21
22



23
24
25
26
27
28
29
 * 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 "SelectKeyFileController.h"

@implementation SelectKeyFileController
- (void)viewDidLoad
{
	NSString *documentDirectory;
	NSArray<NSString *> *keyFiles;







>
>
>







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
		NSLog(@"Could not get key files: %@", error);
		[self.navigationController popViewControllerAnimated: YES];
		return;
	}

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











}

- (void)dealloc
{
	[_keyFiles release];









	[super dealloc];
}

-  (NSInteger)tableView: (UITableView *)tableView
  numberOfRowsInSection: (NSInteger)section
{







>
>
>
>
>
>
>
>
>
>
>





>
>
>
>
>
>
>
>







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
	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];
}



































@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

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