From 4143ae8198d17612ef59d335a367f80a42f65f36 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Jul 2021 11:55:26 +0200 Subject: [PATCH 1/2] Added support for Steam URLs. Changed default prefix setting options to be dynamically rendered --- .../Settings/OtherSettings/OtherSettings.tsx | 15 +++++---------- client/src/utility/searchParser.ts | 3 +-- client/src/utility/urlParser.ts | 12 ++++++++---- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/client/src/components/Settings/OtherSettings/OtherSettings.tsx b/client/src/components/Settings/OtherSettings/OtherSettings.tsx index ebfe642..7ab2770 100644 --- a/client/src/components/Settings/OtherSettings/OtherSettings.tsx +++ b/client/src/components/Settings/OtherSettings/OtherSettings.tsx @@ -5,7 +5,7 @@ import { connect } from 'react-redux'; import { createNotification, updateConfig, sortApps, sortCategories } from '../../../store/actions'; // Typescript -import { GlobalState, NewNotification, SettingsForm } from '../../../interfaces'; +import { GlobalState, NewNotification, Query, SettingsForm } from '../../../interfaces'; // UI import InputGroup from '../../UI/Forms/InputGroup/InputGroup'; @@ -16,6 +16,7 @@ import classes from './OtherSettings.module.css'; // Utils import { searchConfig } from '../../../utility'; +import { queries } from '../../../utility/searchQueries.json'; interface ComponentProps { createNotification: (notification: NewNotification) => void; @@ -180,6 +181,7 @@ const OtherSettings = (props: ComponentProps): JSX.Element => { + {/* MODULES OPTIONS */}

Modules

@@ -202,14 +204,7 @@ const OtherSettings = (props: ComponentProps): JSX.Element => { value={formData.defaultSearchProvider} onChange={(e) => inputChangeHandler(e)} > - - - - - - - - + {queries.map((query: Query) => ())} @@ -266,4 +261,4 @@ const actions = { sortCategories } -export default connect(mapStateToProps, actions)(OtherSettings); +export default connect(mapStateToProps, actions)(OtherSettings); \ No newline at end of file diff --git a/client/src/utility/searchParser.ts b/client/src/utility/searchParser.ts index 21c35f6..e8bb859 100644 --- a/client/src/utility/searchParser.ts +++ b/client/src/utility/searchParser.ts @@ -10,7 +10,6 @@ export const searchParser = (searchQuery: string): boolean => { const query = queries.find((q: Query) => q.prefix === prefix); - console.log("QUERY IS " + query); if (query) { const sameTab = searchConfig('searchSameTab', false); @@ -24,4 +23,4 @@ export const searchParser = (searchQuery: string): boolean => { } return false; -} +} \ No newline at end of file diff --git a/client/src/utility/urlParser.ts b/client/src/utility/urlParser.ts index c74224a..87edb63 100644 --- a/client/src/utility/urlParser.ts +++ b/client/src/utility/urlParser.ts @@ -2,8 +2,8 @@ export const urlParser = (url: string): string[] => { let parsedUrl: string; let displayUrl: string; - if (/https?:\/\//.test(url)) { - // Url starts with http[s]:// -> leave it as it is + if (/(https?|steam):\/\//.test(url)) { + // Url starts with http[s]:// or steam:// -> leave it as it is parsedUrl = url; } else { // No protocol -> apply http:// prefix @@ -11,10 +11,14 @@ export const urlParser = (url: string): string[] => { } // Create simplified url to display as text - displayUrl = url + if (/steam:\/\//.test(url)) { + displayUrl = 'Run Steam App'; + } else { + displayUrl = url .replace(/https?:\/\//, '') .replace('www.', '') .replace(/\/$/, ''); - + } + return [displayUrl, parsedUrl] } \ No newline at end of file From 88785aaa32fd3266907ad6ffc6eae3e4f28b9d57 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 17 Jul 2021 23:11:24 +0200 Subject: [PATCH 2/2] Fixed bug with custom css not persisting --- client/.env | 2 +- .../Settings/OtherSettings/OtherSettings.tsx | 22 +++++++++---------- controllers/config.js | 4 ++++ server.js | 2 ++ utils/findCss.js | 22 +++++++++++++++++++ 5 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 utils/findCss.js diff --git a/client/.env b/client/.env index 18588d5..036129f 100644 --- a/client/.env +++ b/client/.env @@ -1 +1 @@ -REACT_APP_VERSION=1.5.2 \ No newline at end of file +REACT_APP_VERSION=1.6.0 \ No newline at end of file diff --git a/client/src/components/Settings/OtherSettings/OtherSettings.tsx b/client/src/components/Settings/OtherSettings/OtherSettings.tsx index 7ab2770..199e9ff 100644 --- a/client/src/components/Settings/OtherSettings/OtherSettings.tsx +++ b/client/src/components/Settings/OtherSettings/OtherSettings.tsx @@ -145,6 +145,17 @@ const OtherSettings = (props: ComponentProps): JSX.Element => { + + + + - - - -