Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit f4ac59f

Browse files
committed
handle no-vmess case
1 parent 0a98f1e commit f4ac59f

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

V2RayX/ConfigWindow.xib

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<outlet property="networkButton" destination="tMD-b4-w2E" id="MLa-PK-H4t"/>
2323
<outlet property="portField" destination="vAX-58-HRK" id="l6R-dx-TNq"/>
2424
<outlet property="profileTable" destination="fje-9q-W5F" id="qQT-rE-cPV"/>
25+
<outlet property="transportSettingsButton" destination="L0C-0n-d5i" id="t5T-1t-ijY"/>
2526
<outlet property="versionField" destination="yx5-HK-GpF" id="Dpi-oq-T9A"/>
2627
<outlet property="vmessSecurityButton" destination="Dbo-ml-2p8" id="sSo-w3-Yom"/>
2728
<outlet property="window" destination="QvC-M9-y7g" id="DXu-va-1Ry"/>

V2RayX/ConfigWindowController.h

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
@property (weak) IBOutlet NSButton *globalTransportButton;
3030
@property (weak) IBOutlet NSPopUpButton *logLevelButton;
3131
@property (weak) IBOutlet NSMenu *importFromJsonMenu;
32+
@property (weak) IBOutlet NSButton *transportSettingsButton;
3233

3334
@property (weak) AppDelegate* appDelegate;
3435
@property (nonatomic) ServerProfile* selectedProfile;

V2RayX/ConfigWindowController.m

+11-4
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ -(void)tableViewSelectionDidChange:(NSNotification *)notification{
129129
}
130130

131131
- (IBAction)chooseNetwork:(NSPopUpButton *)sender {
132-
[self checkTLSforHttp2];
132+
if (_selectedServerIndex >= 0 && _selectedServerIndex < [_profiles count]) {
133+
[self checkTLSforHttp2];
134+
}
133135
}
134136

135137
- (BOOL)checkTLSforHttp2 {
@@ -140,9 +142,11 @@ - (BOOL)checkTLSforHttp2 {
140142
[httpTlsAlerm addButtonWithTitle:@"Close"];
141143
[httpTlsAlerm addButtonWithTitle:@"Help"];
142144
[httpTlsAlerm setMessageText:@"Both client and server must enable TLS to use HTTP/2 network! Enbale TLS in transport settings. Click \"Help\" if you need more information"];
143-
if ([httpTlsAlerm runModal] == NSAlertSecondButtonReturn) {
144-
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://www.v2ray.com/chapter_02/transport/h2.html#tips"]];
145-
}
145+
[httpTlsAlerm beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) {
146+
if (returnCode == NSAlertSecondButtonReturn) {
147+
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://www.v2ray.com/chapter_02/transport/h2.html#tips"]];
148+
}
149+
}];
146150
[_networkButton selectItemAtIndex:0];
147151
return NO; // does not pass checking
148152
}
@@ -269,6 +273,9 @@ - (IBAction)showAdvancedWindow:(NSButton *)sender {
269273

270274

271275
- (IBAction)showTransportSettings:(id)sender {
276+
if ([_profiles count] == 0) {
277+
return;
278+
}
272279
self.transportWindowController = [[TransportWindowController alloc] initWithWindowNibName:@"TransportWindow" parentController:self];
273280
[[self window] beginSheet:self.transportWindowController.window completionHandler:^(NSModalResponse returnCode) {
274281
if (returnCode == NSModalResponseOK) {

0 commit comments

Comments
 (0)