mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-21 12:29:36 +02:00
Added support for setting icons via URL
This commit is contained in:
parent
d83e3056c6
commit
f5ed85427e
5 changed files with 46 additions and 14 deletions
|
@ -1,6 +1,7 @@
|
|||
import { queries } from './searchQueries.json';
|
||||
import { Query, SearchResult } from '../interfaces';
|
||||
import { store } from '../store/store';
|
||||
import { isUrlOrIp } from '.';
|
||||
|
||||
export const searchParser = (searchQuery: string): SearchResult => {
|
||||
const result: SearchResult = {
|
||||
|
@ -18,10 +19,7 @@ export const searchParser = (searchQuery: string): SearchResult => {
|
|||
const { customQueries, config } = store.getState().config;
|
||||
|
||||
// Check if url or ip was passed
|
||||
const urlRegex =
|
||||
/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?|^((http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i;
|
||||
|
||||
result.isURL = urlRegex.test(searchQuery);
|
||||
result.isURL = isUrlOrIp(searchQuery);
|
||||
|
||||
// Match prefix and query
|
||||
const splitQuery = searchQuery.match(/^\/([a-z]+)[ ](.+)$/i);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue