diff --git a/src/plugins/widgets/ipInfo/IpInfo.tsx b/src/plugins/widgets/ipInfo/IpInfo.tsx index 13a6f514..f8abd913 100644 --- a/src/plugins/widgets/ipInfo/IpInfo.tsx +++ b/src/plugins/widgets/ipInfo/IpInfo.tsx @@ -18,7 +18,8 @@ const IpInfo: React.FC = ({ return null; } - const info = [cache.ip]; + const ip = data.maskIP ? cache.ip.split('.').map((s, i) => i > 0 && i < 3 ? s.replace(/[\d]+/, '*') : s).join('.') : cache.ip; + const info = [ip]; if (data.displayCity) info.push(cache.city); if (data.displayCountry) info.push(cache.country); diff --git a/src/plugins/widgets/ipInfo/IpInfoSettings.tsx b/src/plugins/widgets/ipInfo/IpInfoSettings.tsx index ac63b224..199b0909 100644 --- a/src/plugins/widgets/ipInfo/IpInfoSettings.tsx +++ b/src/plugins/widgets/ipInfo/IpInfoSettings.tsx @@ -22,6 +22,17 @@ const IpInfoSettings: React.FC = ({ data = defaultData, setData }) => ( /> Display Country + + ); diff --git a/src/plugins/widgets/ipInfo/types.ts b/src/plugins/widgets/ipInfo/types.ts index e8c062ac..180d3dda 100644 --- a/src/plugins/widgets/ipInfo/types.ts +++ b/src/plugins/widgets/ipInfo/types.ts @@ -3,6 +3,7 @@ import { API } from "../../types"; type Data = { displayCity: boolean; displayCountry: boolean; + maskIP: boolean; }; export type IpData = { @@ -18,4 +19,5 @@ export type Props = API; export const defaultData: Data = { displayCity: true, displayCountry: true, + maskIP: false, };