Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from objective-see:master #18

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
passive mode + block
  • Loading branch information
objective-see committed Aug 27, 2024
commit 982f55b2e4b64fdf53343e1e14f01003a17eebff
10 changes: 5 additions & 5 deletions LuLu/App/Base.lproj/AlertWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<constraints>
<constraint firstAttribute="height" constant="26" id="TlQ-zK-g5h"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="truncatingTail" truncatesLastVisibleLine="YES" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Process Name" id="JEi-1U-vkU">
<textFieldCell key="cell" lineBreakMode="truncatingMiddle" truncatesLastVisibleLine="YES" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Process Name" id="JEi-1U-vkU">
<font key="font" size="23" name="Menlo-Bold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -412,7 +412,7 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField focusRingType="none" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hbn-rf-Xhf">
<textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hbn-rf-Xhf">
<rect key="frame" x="385" y="17" width="73" height="21"/>
<constraints>
<constraint firstAttribute="width" constant="73" id="19K-rE-psF"/>
Expand All @@ -425,8 +425,8 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qWw-SE-uh0">
<rect key="frame" x="495" y="16" width="167" height="17"/>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qWw-SE-uh0">
<rect key="frame" x="556" y="16" width="93" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="Dg0-Hg-VkC"/>
<constraint firstAttribute="width" constant="163" id="hG3-8J-VRs"/>
Expand All @@ -439,9 +439,9 @@
</textField>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="hbn-rf-Xhf" secondAttribute="bottom" constant="17" id="3x9-Uk-UM8"/>
<constraint firstItem="FV9-wU-TBa" firstAttribute="leading" secondItem="xge-2z-T9l" secondAttribute="leading" constant="232" id="5Wi-47-a3c"/>
<constraint firstItem="aSA-bY-aUV" firstAttribute="leading" secondItem="xge-2z-T9l" secondAttribute="leading" constant="41" id="7Pm-xl-fsH"/>
<constraint firstAttribute="bottom" secondItem="hbn-rf-Xhf" secondAttribute="bottom" constant="10" id="AeJ-bW-6WE"/>
<constraint firstItem="Xf4-RL-C1a" firstAttribute="leading" secondItem="xge-2z-T9l" secondAttribute="leading" constant="232" id="UE6-1O-GTy"/>
<constraint firstAttribute="trailing" secondItem="qWw-SE-uh0" secondAttribute="trailing" constant="7" id="h2T-oE-ztQ"/>
<constraint firstItem="hbn-rf-Xhf" firstAttribute="leading" secondItem="Xf4-RL-C1a" secondAttribute="trailing" constant="3" id="hCi-Oy-lMk"/>
Expand Down
65 changes: 49 additions & 16 deletions LuLu/App/Base.lproj/Preferences.xib
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<connections>
<outlet property="blockList" destination="UL1-ci-HRm" id="bvz-Cl-NA0"/>
<outlet property="modesView" destination="K6i-xr-27e" id="DOb-L3-eeR"/>
<outlet property="passiveModeAction" destination="CBy-MH-fsc" id="EwM-q6-3ff"/>
<outlet property="rulesView" destination="378-bj-fYw" id="10Z-g6-I1q"/>
<outlet property="selectBlockListButton" destination="zXj-H3-PHp" id="fsL-1k-LRx"/>
<outlet property="toolbar" destination="V8g-Ya-LK4" id="SH2-6E-QST"/>
Expand All @@ -25,7 +26,7 @@
<window title="LuLu's Settings" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<rect key="contentRect" x="196" y="240" width="600" height="453"/>
<rect key="screenRect" x="0.0" y="0.0" width="1512" height="944"/>
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
<view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="600" height="453"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down Expand Up @@ -279,17 +280,8 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="tFB-E4-zbp">
<rect key="frame" x="72" y="225" width="510" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Silently run without alerts, applying existing rules.
New connections will be automatically allowed." id="E0T-Ug-P8f">
<font key="font" size="12" name="Menlo-Regular"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button tag="7" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Bog-hz-gcd">
<rect key="frame" x="39" y="186" width="29" height="18"/>
<rect key="frame" x="39" y="176" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="Aaw-XT-TEt">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -300,7 +292,7 @@
</connections>
</button>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Kjh-jc-STu">
<rect key="frame" x="72" y="184" width="510" height="19"/>
<rect key="frame" x="72" y="174" width="510" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Block Mode" id="4EN-j2-enV">
<font key="font" size="13" name="Menlo-Bold"/>
Expand All @@ -309,16 +301,57 @@
</textFieldCell>
</textField>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="xaO-g8-rdS">
<rect key="frame" x="72" y="155" width="510" height="30"/>
<rect key="frame" x="72" y="145" width="510" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="All traffic (routed thru LuLu) will be blocked." id="SG5-YM-BoV">
<font key="font" size="12" name="Menlo-Regular"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="tFB-E4-zbp">
<rect key="frame" x="72" y="248" width="387" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Silently run without alerts, applying existing rules." id="E0T-Ug-P8f">
<font key="font" size="12" name="Menlo-Regular"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="cBQ-pR-ew9">
<rect key="frame" x="73" y="225" width="301" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="New connections should be automatically: " id="gYL-Qw-lFZ">
<font key="font" size="12" name="Menlo-Regular"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton springLoaded="YES" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="CBy-MH-fsc">
<rect key="frame" x="370" y="218" width="114" height="25"/>
<popUpButtonCell key="cell" type="push" title="Allowed" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="CqC-4v-5d3" id="ssl-E3-3tL">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="Ned-2Z-nv8">
<items>
<menuItem title="Allowed" state="on" id="CqC-4v-5d3">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Blocked" id="mCn-AV-g9h">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<constraints>
<constraint firstAttribute="width" constant="161" id="oYr-vD-9fC"/>
</constraints>
<connections>
<action selector="togglePreference:" target="-2" id="4on-EY-CRn"/>
</connections>
</popUpButton>
<button tag="8" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HeI-XQ-T5H">
<rect key="frame" x="39" y="123" width="29" height="18"/>
<rect key="frame" x="39" y="115" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="r4E-e7-bG0">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -329,7 +362,7 @@
</connections>
</button>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jD1-tF-SsA">
<rect key="frame" x="72" y="121" width="160" height="19"/>
<rect key="frame" x="72" y="113" width="160" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="No Icon Mode" id="iOJ-Bc-hxG">
<font key="font" size="13" name="Menlo-Bold"/>
Expand All @@ -338,7 +371,7 @@
</textFieldCell>
</textField>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="xXU-nn-zh9">
<rect key="frame" x="72" y="93" width="510" height="30"/>
<rect key="frame" x="72" y="85" width="510" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Run without showing an icon in the status menu bar." id="bYB-s1-S3f">
<font key="font" size="12" name="Menlo-Regular"/>
Expand Down
21 changes: 12 additions & 9 deletions LuLu/App/PrefsWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,34 @@
@property(nonatomic, retain)NSDictionary* preferences;

//toolbar
@property (weak) IBOutlet NSToolbar *toolbar;
@property (weak) IBOutlet NSToolbar* toolbar;

//rules prefs view
@property (weak) IBOutlet NSView *rulesView;
@property (weak) IBOutlet NSView* rulesView;

//block list
@property (weak) IBOutlet NSTextField *blockList;
@property (weak) IBOutlet NSTextField* blockList;

//select block list button
@property (weak) IBOutlet NSButton *selectBlockListButton;
@property (weak) IBOutlet NSButton* selectBlockListButton;

//modes view
@property (strong) IBOutlet NSView *modesView;
@property (strong) IBOutlet NSView* modesView;

//passive mode action ...allow/block
@property (weak) IBOutlet NSPopUpButton* passiveModeAction;

//update view
@property (weak) IBOutlet NSView *updateView;
@property (weak) IBOutlet NSView* updateView;

//update button
@property (weak) IBOutlet NSButton *updateButton;
@property (weak) IBOutlet NSButton* updateButton;

//update indicator (spinner)
@property (weak) IBOutlet NSProgressIndicator *updateIndicator;
@property (weak) IBOutlet NSProgressIndicator* updateIndicator;

//update label
@property (weak) IBOutlet NSTextField *updateLabel;
@property (weak) IBOutlet NSTextField* updateLabel;

//update window controller
@property(nonatomic, retain)UpdateWindowController* updateWindowController;
Expand Down
24 changes: 22 additions & 2 deletions LuLu/App/PrefsWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ @implementation PrefsWindowController
//'update mode' button
#define BUTTON_NO_UPDATE_MODE 9

//'passive mode' actions
#define BUTTON_PASSIVE_MODE_ACTION_ALLOW 0
#define BUTTON_PASSIVE_MODE_ACTION_BLOCK 1

//init 'general' view
// add it, and make it selected
-(void)awakeFromNib
Expand Down Expand Up @@ -136,7 +140,10 @@ -(IBAction)toolbarButtonHandler:(id)sender
//set 'passive mode' button state
((NSButton*)[view viewWithTag:BUTTON_PASSIVE_MODE]).state = [self.preferences[PREF_PASSIVE_MODE] boolValue];

//set 'block mode' button
//set 'passive mode' action
[self.passiveModeAction selectItemAtIndex: [self.preferences[PREF_PASSIVE_MODE_ACTION] integerValue]];

//set 'block mode' button state
((NSButton*)[view viewWithTag:BUTTON_BLOCK_MODE]).state = [self.preferences[PREF_BLOCK_MODE] boolValue];

//set 'no icon' button state
Expand Down Expand Up @@ -174,7 +181,7 @@ -(IBAction)toolbarButtonHandler:(id)sender
}

//invoked when user toggles button
// update preferences for that button
// update preferences for that button/item
-(IBAction)togglePreference:(id)sender
{
//preferences
Expand Down Expand Up @@ -237,7 +244,13 @@ -(IBAction)togglePreference:(id)sender

//passive mode
case BUTTON_PASSIVE_MODE:

//grab state
updatedPreferences[PREF_PASSIVE_MODE] = state;

//also grab selected item of action
updatedPreferences[PREF_PASSIVE_MODE_ACTION] = [NSNumber numberWithInteger:self.passiveModeAction.indexOfSelectedItem];

break;

//block mode
Expand Down Expand Up @@ -268,6 +281,13 @@ -(IBAction)togglePreference:(id)sender
break;
}

//logic for 'passive mode' action
if(YES == [sender isEqualTo:self.passiveModeAction])
{
//grab selected index
updatedPreferences[PREF_PASSIVE_MODE_ACTION] = [NSNumber numberWithInteger:self.passiveModeAction.indexOfSelectedItem];
}

//send XPC msg to daemon to update prefs
// returns (all/latest) prefs, which is what we want
self.preferences = [xpcDaemonClient updatePreferences:updatedPreferences];
Expand Down
2 changes: 1 addition & 1 deletion LuLu/App/WelcomeWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ -(IBAction)buttonHandler:(id)sender {
if( (SHOW_CONFIGURE+1) == ((NSToolbarItem*)sender).tag)
{
//capture
self.preferences = @{PREF_ALLOW_APPLE:[NSNumber numberWithBool:self.allowApple.state], PREF_ALLOW_INSTALLED: [NSNumber numberWithBool:self.allowInstalled.state], PREF_ALLOW_DNS: [NSNumber numberWithBool:self.allowDNS.state], PREF_ALLOW_SIMULATOR:@NO, PREF_PASSIVE_MODE:@NO, PREF_BLOCK_MODE:@NO, PREF_NO_ICON_MODE:@NO, PREF_NO_UPDATE_MODE:@NO, PREF_INSTALL_TIMESTAMP:[NSDate date]};
self.preferences = @{PREF_ALLOW_APPLE:[NSNumber numberWithBool:self.allowApple.state], PREF_ALLOW_INSTALLED: [NSNumber numberWithBool:self.allowInstalled.state], PREF_ALLOW_DNS: [NSNumber numberWithBool:self.allowDNS.state], PREF_ALLOW_SIMULATOR:@NO, PREF_PASSIVE_MODE:@NO, PREF_PASSIVE_MODE_ACTION:@0, PREF_BLOCK_MODE:@NO, PREF_NO_ICON_MODE:@NO, PREF_NO_UPDATE_MODE:@NO, PREF_INSTALL_TIMESTAMP:[NSDate date]};
}

//set next view
Expand Down
Loading