Skip to content

Commit

Permalink
Add social media blocking server
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Sep 29, 2023
1 parent 4065b91 commit e67ded5
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 1 deletion.
5 changes: 5 additions & 0 deletions gui/locales/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,11 @@ msgctxt "vpn-settings-view"
msgid "Malware"
msgstr ""

#. Label for settings that enables block of social media.
msgctxt "vpn-settings-view"
msgid "Social media"
msgstr ""

msgctxt "vpn-settings-view"
msgid "The app’s built-in kill switch is always on. This setting will additionally block the internet if clicking Disconnect or Quit."
msgstr ""
Expand Down
2 changes: 2 additions & 0 deletions gui/src/main/daemon-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ export class DaemonRpc {
defaultOptions.setBlockMalware(dns.defaultOptions.blockMalware);
defaultOptions.setBlockAdultContent(dns.defaultOptions.blockAdultContent);
defaultOptions.setBlockGambling(dns.defaultOptions.blockGambling);
defaultOptions.setBlockSocialMedia(dns.defaultOptions.blockSocialMedia);
dnsOptions.setDefaultOptions(defaultOptions);

const customOptions = new grpcTypes.CustomDnsOptions();
Expand Down Expand Up @@ -1272,6 +1273,7 @@ function convertFromTunnelOptions(tunnelOptions: grpcTypes.TunnelOptions.AsObjec
blockMalware: tunnelOptions.dnsOptions?.defaultOptions?.blockMalware ?? false,
blockAdultContent: tunnelOptions.dnsOptions?.defaultOptions?.blockAdultContent ?? false,
blockGambling: tunnelOptions.dnsOptions?.defaultOptions?.blockGambling ?? false,
blockSocialMedia: tunnelOptions.dnsOptions?.defaultOptions?.blockSocialMedia ?? false,
},
customOptions: {
addresses: tunnelOptions.dnsOptions?.customOptions?.addressesList ?? [],
Expand Down
1 change: 1 addition & 0 deletions gui/src/main/default-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function getDefaultSettings(): ISettings {
blockMalware: false,
blockAdultContent: false,
blockGambling: false,
blockSocialMedia: false,
},
customOptions: {
addresses: [],
Expand Down
3 changes: 2 additions & 1 deletion gui/src/renderer/components/CustomDnsSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export default function CustomDnsSettings() {
!dns.defaultOptions.blockTrackers &&
!dns.defaultOptions.blockMalware &&
!dns.defaultOptions.blockAdultContent &&
!dns.defaultOptions.blockGambling),
!dns.defaultOptions.blockGambling &&
!dns.defaultOptions.blockSocialMedia),
[dns],
);

Expand Down
26 changes: 26 additions & 0 deletions gui/src/renderer/components/VpnSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ function DnsBlockers() {
<BlockMalware />
<BlockGambling />
<BlockAdultContent />
<BlockSocialMedia />
</Cell.ExpandableSection>
);
}
Expand Down Expand Up @@ -420,6 +421,31 @@ function BlockAdultContent() {
/>
</AriaInput>
</StyledSectionItem>
</AriaInputGroup>
);
}

function BlockSocialMedia() {
const [dns, setBlockSocialMedia] = useDns('blockSocialMedia');

return (
<AriaInputGroup>
<StyledSectionItem disabled={dns.state === 'custom'}>
<AriaLabel>
<Cell.InputLabel>
{
// TRANSLATORS: Label for settings that enables block of social media.
messages.pgettext('vpn-settings-view', 'Social media')
}
</Cell.InputLabel>
</AriaLabel>
<AriaInput>
<Cell.Switch
isOn={dns.state === 'default' && dns.defaultOptions.blockSocialMedia}
onChange={setBlockSocialMedia}
/>
</AriaInput>
</StyledSectionItem>
{dns.state === 'custom' && <CustomDnsEnabledFooter />}
</AriaInputGroup>
);
Expand Down
1 change: 1 addition & 0 deletions gui/src/renderer/redux/settings/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const initialState: ISettingsReduxState = {
blockMalware: false,
blockAdultContent: false,
blockGambling: false,
blockSocialMedia: false,
},
customOptions: {
addresses: [],
Expand Down
1 change: 1 addition & 0 deletions gui/src/shared/daemon-rpc-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ export interface IDnsOptions {
blockMalware: boolean;
blockAdultContent: boolean;
blockGambling: boolean;
blockSocialMedia: boolean;
};
}

Expand Down

0 comments on commit e67ded5

Please sign in to comment.