Skip to content

Commit 4fcb4f8

Browse files
committed
fix URL input
1 parent a4c3b80 commit 4fcb4f8

7 files changed

Lines changed: 2486 additions & 870 deletions

File tree

package.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"@conet.project/seguro-worker-lib": "0.13.8",
2929
"@emotion/react": "^11.11.1",
3030
"@emotion/styled": "^11.11.0",
31-
"@mui/icons-material": "^5.14.11",
32-
"@mui/material": "^5.14.11",
31+
"@mui/icons-material": "^5.14.12",
32+
"@mui/material": "^5.14.12",
3333
"@react-icons/all-files": "^4.1.0",
3434
"@tippyjs/react": "^4.2.6",
3535
"buffer": "^6.0.3",
@@ -45,42 +45,42 @@
4545
"web-vitals": "^3.5.0"
4646
},
4747
"devDependencies": {
48-
"@reduxjs/toolkit": "^1.9.5",
49-
"@storybook/addon-actions": "^7.0.8",
50-
"@storybook/addon-essentials": "^7.0.8",
51-
"@storybook/addon-links": "^7.0.8",
52-
"@storybook/node-logger": "^7.0.8",
53-
"@storybook/preset-create-react-app": "^7.0.8",
54-
"@storybook/react": "^7.0.8",
55-
"@testing-library/jest-dom": "^5.16.5",
48+
"@reduxjs/toolkit": "^1.9.7",
49+
"@storybook/addon-actions": "^7.4.6",
50+
"@storybook/addon-essentials": "^7.4.6",
51+
"@storybook/addon-links": "^7.4.6",
52+
"@storybook/node-logger": "^7.4.6",
53+
"@storybook/preset-create-react-app": "^7.4.6",
54+
"@storybook/react": "^7.4.6",
55+
"@testing-library/jest-dom": "^6.1.3",
5656
"@testing-library/react": "^14.0.0",
57-
"@testing-library/user-event": "^14.4.3",
58-
"@types/jest": "^29.5.1",
59-
"@types/node": "^18.16.3",
60-
"@types/react": "^18.2.5",
61-
"@types/react-document-meta": "^3.0.2",
62-
"@types/react-dom": "^18.2.3",
57+
"@testing-library/user-event": "^14.5.1",
58+
"@types/jest": "^29.5.5",
59+
"@types/node": "^20.8.2",
60+
"@types/react": "^18.2.25",
61+
"@types/react-document-meta": "^3.0.3",
62+
"@types/react-dom": "^18.2.10",
6363
"@types/react-router-dom": "^5.3.3",
64-
"@types/styled-components": "^5.1.26",
65-
"@types/uuid": "^9.0.1",
66-
"babel-loader": "^9.1.2",
67-
"concurrently": "^8.0.1",
64+
"@types/styled-components": "^5.1.28",
65+
"@types/uuid": "^9.0.4",
66+
"babel-loader": "^9.1.3",
67+
"concurrently": "^8.2.1",
6868
"cors": "^2.8.5",
69-
"electron": "^24.2.0",
69+
"electron":"^26.2.4",
7070
"eslint-plugin-react-hooks": "^4.6.0",
7171
"express": "^4.18.2",
72-
"modern-normalize": "^1.1.0",
72+
"modern-normalize": "^2.0.0",
7373
"react": "^18.2.0",
7474
"react-document-meta": "^3.0.0-beta.2",
7575
"react-dom": "^18.2.0",
76-
"react-icons": "^4.8.0",
76+
"react-icons": "^4.11.0",
7777
"react-intl": "^6.4.2",
78-
"react-redux": "^8.0.5",
78+
"react-redux": "^8.1.3",
7979
"react-scripts": "^5.0.1",
80-
"styled-components": "^5.3.10",
81-
"typescript": "^5.0.4",
80+
"styled-components": "^6.0.8",
81+
"typescript": "^5.2.2",
8282
"wait-on": "^7.0.1",
83-
"caniuse-lite": "^1.0.30001482"
83+
"caniuse-lite": "^1.0.30001543"
8484
},
8585
"browserslist": {
8686
"production": [

src/components/App/Apps/Browse/SearchInput.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ type SearchInputProps = {
1717
onChanged: (updateText: string) => void
1818
} & HTMLAttributes<ReactNode>
1919

20+
const top100Films = [
21+
{ label: 'The Shawshank Redemption', year: 1994 }
22+
]
2023
const SearchInput = ({defaultTodo, onUpdate, onChanged}: SearchInputProps) => {
2124
const [searchText, setSearchText] = useState(defaultTodo.searchText)
2225
const intl = useIntl()
@@ -38,18 +41,21 @@ const SearchInput = ({defaultTodo, onUpdate, onChanged}: SearchInputProps) => {
3841
</IconButton>
3942
</Grid>
4043
<Grid item xs>
44+
4145
<FormControl size="small" fullWidth variant="outlined">
4246
<OutlinedInput sx={{ borderRadius: '20px',fontSize:'small' }}
4347
fullWidth={true}
4448
//placeholder={ defaultTodo.keyID }
4549
placeholder={ intl.formatMessage({id:'platform.app.browser.search.placeholder'})}
46-
startAdornment={
47-
<InputAdornment position="start">
48-
<IconButton>
49-
<SearchIcon/>
50-
</IconButton>
51-
</InputAdornment>
50+
51+
startAdornment= {
52+
<InputAdornment position="start">
53+
<IconButton>
54+
<SearchIcon/>
55+
</IconButton>
56+
</InputAdornment>
5257
}
58+
5359
value={
5460
searchText
5561
}

src/components/App/Apps/Browse/searchPage.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ const InjetDom = () => {
6060
)
6161
}
6262

63-
63+
const urlRegExp = /^(?!.*?_.*?)(?!(?:[\d\w]+?\.)?\-[\w\d\.\-]*?)(?![\w\d]+?\-\.(?:[\d\w\.\-]+?))(?=[\w\d])(?=[\w\d\.\-]*?\.+[\w\d\.\-]*?)(?![\w\d\.\-]{254})(?!(?:\.?[\w\d\-\.]*?[\w\d\-]{64,}\.)+?)[\w\d\.\-]+?(?<![\w\d\-\.]*?\.[\d]+?)(?<=[\w\d\-]{2,})(?<![\w\d\-]{25})$/
64+
const localIpAddress = /^(?:127\.|0?10\.|172\.0?1[6-9]\.|172\.0?2[0-9]\.|172\.0?3[01]\.|192\.168\.|169\.254\.|::1|[fF][cCdD][0-9a-fA-F]{2}:|[fF][eE][89aAbB][0-9a-fA-F]:)/
65+
const ipV6Check = /^(?=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$)(?:(?:25[0-5]|[12][0-4][0-9]|1[5-9][0-9]|[1-9]?[0-9])\.?){4}$|(?=^(?:[0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}$)(?![^:]*::.+::[^:]*$)(?:(?=.*::.*)|(?=\w+:\w+:\w+:\w+:\w+:\w+:\w+:\w+))(?:(?:^|:)(?:[0-9a-f]{4}|[1-9a-f][0-9a-f]{0,3})){0,8}(?:::(?:[0-9a-f]{1,4}(?:$|:)){0,6})?$/
6466

6567
const SearchPage = (todo: Todo, index: number, currentTab: number, setCurrentTodo: React.Dispatch<React.SetStateAction<Todo>>) => {
6668
const [currectUrl, setCurrectUrl] = useState('')
@@ -69,8 +71,18 @@ const SearchPage = (todo: Todo, index: number, currentTab: number, setCurrentTod
6971
const onUpdate = ( text: string ) => {
7072

7173
// Search input
72-
if (!/^http/.test(text)) {
73-
text = `https://search.brave.com/search?q=${text}&source=${isTouchDevice ? 'mobile': 'desktop'}`
74+
const spaceSplit = text.split(/ /)
75+
const dotSplit = text.split(/\./)
76+
if (spaceSplit.length < 2 || dotSplit.length > 1) {
77+
logger(`urlRegExp.test(text) = [${urlRegExp.test(text)}]`)
78+
logger(`!localIpAddress.test(text) = [${!localIpAddress.test(text)}]`)
79+
logger(`!ipV6Check.test(text) = [${!ipV6Check.test(text)}]`)
80+
if (urlRegExp.test(text) || !localIpAddress.test(text) || !ipV6Check.test(text)) {
81+
82+
if (!/^https?\:\/\//.test(text)) {
83+
text = `https://${text}`
84+
}
85+
}
7486
}
7587

7688
let remote = new URL(text)

src/components/App/Apps/Browse/showTodoList.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ function a11yProps(index: number) {
1414
key: `simple-tab-${index}`
1515
}
1616
}
17-
1817
const ShowSearchTextInput = () => {
1918
const todoContext = useContext(ToDoContext)
2019
const [currectTodo, setCurrentTodo] = useState<Todo>(todoContext.todos[0])

src/components/UI/Dropdowns/ProfileDropdown/ProfileDropdown.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,16 @@ const ProfileDropdown = ({closeDropdown}: ProfileDropdownProps) => {
223223
balance: currentProfile().tokens.conet.balance,
224224
icon: <LogoIcon size={30} color='grey'/>
225225
},
226-
{
227-
primary: 'CoNETCash',
228-
balance: workerService.data?.CoNETCash ? workerService.data.CoNETCash.Total : 0,
229-
icon: <CNTCashLogoIcon size={30}/>,
230-
},
231-
{
232-
primary: 'USDC',
233-
balance: currentProfile().tokens.usdc.balance,
234-
icon: <USDCLogoIcon size={30} color='grey'/>,
235-
}
226+
// {
227+
// primary: 'CoNETCash',
228+
// balance: workerService.data?.CoNETCash ? workerService.data.CoNETCash.Total : 0,
229+
// icon: <CNTCashLogoIcon size={30}/>,
230+
// },
231+
// {
232+
// primary: 'USDC',
233+
// balance: currentProfile().tokens.usdc.balance,
234+
// icon: <USDCLogoIcon size={30} color='grey'/>,
235+
// }
236236
]
237237
return ret
238238
}

src/components/UI/Icons/Icons.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
} from 'react-icons/fi'
4040

4141
import {
42-
GoPrimitiveDot
42+
GoPasskeyFill
4343
} from 'react-icons/go'
4444

4545
import {
@@ -189,7 +189,7 @@ export const PasscodeDot = ({size, color, isPlaceholder}: IconProps & { isPlaceh
189189

190190
return (
191191
<StyledThemeIcon isPlaceholder={isPlaceholder}>
192-
<GoPrimitiveDot size={getSize(size)} color={color || undefined}/>
192+
<GoPasskeyFill size={getSize(size)} color={color || undefined}/>
193193
</StyledThemeIcon>
194194
)
195195
}

0 commit comments

Comments
 (0)