Skip to content

Commit baac780

Browse files
authored
Merge pull request #312 from pawelmalak/feature
Version 2.2.2
2 parents 750891c + c2e8183 commit baac780

File tree

24 files changed

+221
-192
lines changed

24 files changed

+221
-192
lines changed

.dev/build_latest.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docker build -t pawelmalak/flame -t "pawelmalak/flame:$1" -f .docker/Dockerfile "$2" \
2+
&& docker push pawelmalak/flame && docker push "pawelmalak/flame:$1"

.dev/build_multiarch.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
docker buildx build \
2+
--platform linux/arm/v7,linux/arm64,linux/amd64 \
3+
-f .docker/Dockerfile.multiarch \
4+
-t pawelmalak/flame:multiarch \
5+
-t "pawelmalak/flame:multiarch$1" \
6+
--push "$2"

.docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ EXPOSE 5005
2727
ENV NODE_ENV=production
2828
ENV PASSWORD=flame_password
2929

30-
CMD ["node", "server.js"]
30+
CMD ["sh", "-c", "chown -R node /app/data && node server.js"]

.docker/Dockerfile.multiarch

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ EXPOSE 5005
2828
ENV NODE_ENV=production
2929
ENV PASSWORD=flame_password
3030

31-
CMD ["node", "server.js"]
31+
CMD ["sh", "-c", "chown -R node /app/data && node server.js"]

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PORT=5005
22
NODE_ENV=development
3-
VERSION=2.2.1
3+
VERSION=2.2.2
44
PASSWORD=flame_password
55
SECRET=e02eb43d69953658c6d07311d6313f2d4467672cb881f96b29368ba1f3f4da4b

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
node_modules
22
data
33
public
4-
!client/public
5-
build.sh
4+
!client/public

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
### v2.2.2 (2022-03-21)
2+
- Added option to get user location directly from the app ([#287](https://github.com/pawelmalak/flame/issues/287))
3+
- Fixed bug with local search not working when using prefix ([#289](https://github.com/pawelmalak/flame/issues/289))
4+
- Fixed bug with app description not updating when using custom icon ([#310](https://github.com/pawelmalak/flame/issues/310))
5+
- Changed permissions to some files and directories created by Flame
6+
- Changed some of the settings tabs
7+
18
### v2.2.1 (2022-01-08)
29
- Local search will now include app descriptions ([#266](https://github.com/pawelmalak/flame/issues/266))
310
- Fixed bug with unsupported characters in local search [#279](https://github.com/pawelmalak/flame/issues/279))

client/.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
REACT_APP_VERSION=2.2.1
1+
REACT_APP_VERSION=2.2.2

client/src/components/Apps/AppForm/AppForm.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ export const AppForm = ({ modalHandler }: Props): JSX.Element => {
6464
if (customIcon) {
6565
data.append('icon', customIcon);
6666
}
67+
6768
data.append('name', formData.name);
69+
data.append('description', formData.description);
6870
data.append('url', formData.url);
6971
data.append('isPublic', `${formData.isPublic ? 1 : 0}`);
7072

client/src/components/Apps/AppTable/AppTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const AppTable = (props: Props): JSX.Element => {
9494
) : (
9595
<p>
9696
Custom order is disabled. You can change it in the{' '}
97-
<Link to="/settings/interface">settings</Link>
97+
<Link to="/settings/general">settings</Link>
9898
</p>
9999
)}
100100
</Message>

client/src/components/Bookmarks/Table/CategoryTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const CategoryTable = ({ openFormForUpdating }: Props): JSX.Element => {
102102
) : (
103103
<p>
104104
Custom order is disabled. You can change it in the{' '}
105-
<Link to="/settings/interface">settings</Link>
105+
<Link to="/settings/general">settings</Link>
106106
</p>
107107
)}
108108
</Message>

client/src/components/SearchBar/SearchBar.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ export const SearchBar = (props: Props): JSX.Element => {
6969
);
7070

7171
if (isLocal) {
72-
// no additional encoding required for local search
73-
setLocalSearch(inputRef.current.value);
72+
setLocalSearch(search);
7473
}
7574

7675
if (e.code === 'Enter' || e.code === 'NumpadEnter') {

client/src/components/Settings/SearchSettings/SearchSettings.tsx client/src/components/Settings/GeneralSettings/GeneralSettings.tsx

+106-35
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useState, useEffect, FormEvent, ChangeEvent, Fragment } from 'react';
33
import { useDispatch, useSelector } from 'react-redux';
44

55
// Typescript
6-
import { Query, SearchForm } from '../../../interfaces';
6+
import { Query, GeneralForm } from '../../../interfaces';
77

88
// Components
99
import { CustomQueries } from './CustomQueries/CustomQueries';
@@ -12,7 +12,7 @@ import { CustomQueries } from './CustomQueries/CustomQueries';
1212
import { Button, SettingsHeadline, InputGroup } from '../../UI';
1313

1414
// Utils
15-
import { inputHandler, searchSettingsTemplate } from '../../../utility';
15+
import { inputHandler, generalSettingsTemplate } from '../../../utility';
1616

1717
// Data
1818
import { queries } from '../../../utility/searchQueries.json';
@@ -22,16 +22,20 @@ import { State } from '../../../store/reducers';
2222
import { bindActionCreators } from 'redux';
2323
import { actionCreators } from '../../../store';
2424

25-
export const SearchSettings = (): JSX.Element => {
26-
const { loading, customQueries, config } = useSelector(
27-
(state: State) => state.config
28-
);
25+
export const GeneralSettings = (): JSX.Element => {
26+
const {
27+
config: { loading, customQueries, config },
28+
bookmarks: { categories },
29+
} = useSelector((state: State) => state);
2930

3031
const dispatch = useDispatch();
31-
const { updateConfig } = bindActionCreators(actionCreators, dispatch);
32+
const { updateConfig, sortApps, sortCategories, sortBookmarks } =
33+
bindActionCreators(actionCreators, dispatch);
3234

3335
// Initial state
34-
const [formData, setFormData] = useState<SearchForm>(searchSettingsTemplate);
36+
const [formData, setFormData] = useState<GeneralForm>(
37+
generalSettingsTemplate
38+
);
3539

3640
// Get config
3741
useEffect(() => {
@@ -46,14 +50,24 @@ export const SearchSettings = (): JSX.Element => {
4650

4751
// Save settings
4852
await updateConfig(formData);
53+
54+
// Sort entities with new settings
55+
if (formData.useOrdering !== config.useOrdering) {
56+
sortApps();
57+
sortCategories();
58+
59+
for (let { id } of categories) {
60+
sortBookmarks(id);
61+
}
62+
}
4963
};
5064

5165
// Input handler
5266
const inputChangeHandler = (
5367
e: ChangeEvent<HTMLInputElement | HTMLSelectElement>,
5468
options?: { isNumber?: boolean; isBool?: boolean }
5569
) => {
56-
inputHandler<SearchForm>({
70+
inputHandler<GeneralForm>({
5771
e,
5872
options,
5973
setStateHandler: setFormData,
@@ -63,66 +77,123 @@ export const SearchSettings = (): JSX.Element => {
6377

6478
return (
6579
<Fragment>
66-
{/* GENERAL SETTINGS */}
6780
<form
6881
onSubmit={(e) => formSubmitHandler(e)}
6982
style={{ marginBottom: '30px' }}
7083
>
84+
{/* === GENERAL OPTIONS === */}
7185
<SettingsHeadline text="General" />
86+
{/* SORT TYPE */}
7287
<InputGroup>
73-
<label htmlFor="defaultSearchProvider">Default search provider</label>
88+
<label htmlFor="useOrdering">Sorting type</label>
7489
<select
75-
id="defaultSearchProvider"
76-
name="defaultSearchProvider"
77-
value={formData.defaultSearchProvider}
90+
id="useOrdering"
91+
name="useOrdering"
92+
value={formData.useOrdering}
7893
onChange={(e) => inputChangeHandler(e)}
7994
>
80-
{[...queries, ...customQueries].map((query: Query, idx) => {
81-
const isCustom = idx >= queries.length;
95+
<option value="createdAt">By creation date</option>
96+
<option value="name">Alphabetical order</option>
97+
<option value="orderId">Custom order</option>
98+
</select>
99+
</InputGroup>
82100

83-
return (
84-
<option key={idx} value={query.prefix}>
85-
{isCustom && '+'} {query.name}
86-
</option>
87-
);
88-
})}
101+
{/* === APPS OPTIONS === */}
102+
<SettingsHeadline text="Apps" />
103+
{/* PIN APPS */}
104+
<InputGroup>
105+
<label htmlFor="pinAppsByDefault">
106+
Pin new applications by default
107+
</label>
108+
<select
109+
id="pinAppsByDefault"
110+
name="pinAppsByDefault"
111+
value={formData.pinAppsByDefault ? 1 : 0}
112+
onChange={(e) => inputChangeHandler(e, { isBool: true })}
113+
>
114+
<option value={1}>True</option>
115+
<option value={0}>False</option>
89116
</select>
90117
</InputGroup>
91118

119+
{/* APPS OPPENING */}
92120
<InputGroup>
93-
<label htmlFor="searchSameTab">
94-
Open search results in the same tab
121+
<label htmlFor="appsSameTab">Open applications in the same tab</label>
122+
<select
123+
id="appsSameTab"
124+
name="appsSameTab"
125+
value={formData.appsSameTab ? 1 : 0}
126+
onChange={(e) => inputChangeHandler(e, { isBool: true })}
127+
>
128+
<option value={1}>True</option>
129+
<option value={0}>False</option>
130+
</select>
131+
</InputGroup>
132+
133+
{/* === BOOKMARKS OPTIONS === */}
134+
<SettingsHeadline text="Bookmarks" />
135+
{/* PIN CATEGORIES */}
136+
<InputGroup>
137+
<label htmlFor="pinCategoriesByDefault">
138+
Pin new categories by default
95139
</label>
96140
<select
97-
id="searchSameTab"
98-
name="searchSameTab"
99-
value={formData.searchSameTab ? 1 : 0}
141+
id="pinCategoriesByDefault"
142+
name="pinCategoriesByDefault"
143+
value={formData.pinCategoriesByDefault ? 1 : 0}
100144
onChange={(e) => inputChangeHandler(e, { isBool: true })}
101145
>
102146
<option value={1}>True</option>
103147
<option value={0}>False</option>
104148
</select>
105149
</InputGroup>
106150

151+
{/* BOOKMARKS OPPENING */}
107152
<InputGroup>
108-
<label htmlFor="hideSearch">Hide search bar</label>
153+
<label htmlFor="bookmarksSameTab">
154+
Open bookmarks in the same tab
155+
</label>
109156
<select
110-
id="hideSearch"
111-
name="hideSearch"
112-
value={formData.hideSearch ? 1 : 0}
157+
id="bookmarksSameTab"
158+
name="bookmarksSameTab"
159+
value={formData.bookmarksSameTab ? 1 : 0}
113160
onChange={(e) => inputChangeHandler(e, { isBool: true })}
114161
>
115162
<option value={1}>True</option>
116163
<option value={0}>False</option>
117164
</select>
118165
</InputGroup>
119166

167+
{/* SEARCH SETTINGS */}
168+
<SettingsHeadline text="Search" />
120169
<InputGroup>
121-
<label htmlFor="disableAutofocus">Disable search bar autofocus</label>
170+
<label htmlFor="defaultSearchProvider">Default search provider</label>
122171
<select
123-
id="disableAutofocus"
124-
name="disableAutofocus"
125-
value={formData.disableAutofocus ? 1 : 0}
172+
id="defaultSearchProvider"
173+
name="defaultSearchProvider"
174+
value={formData.defaultSearchProvider}
175+
onChange={(e) => inputChangeHandler(e)}
176+
>
177+
{[...queries, ...customQueries].map((query: Query, idx) => {
178+
const isCustom = idx >= queries.length;
179+
180+
return (
181+
<option key={idx} value={query.prefix}>
182+
{isCustom && '+'} {query.name}
183+
</option>
184+
);
185+
})}
186+
</select>
187+
</InputGroup>
188+
189+
<InputGroup>
190+
<label htmlFor="searchSameTab">
191+
Open search results in the same tab
192+
</label>
193+
<select
194+
id="searchSameTab"
195+
name="searchSameTab"
196+
value={formData.searchSameTab ? 1 : 0}
126197
onChange={(e) => inputChangeHandler(e, { isBool: true })}
127198
>
128199
<option value={1}>True</option>

client/src/components/Settings/Settings.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { WeatherSettings } from './WeatherSettings/WeatherSettings';
1616
import { UISettings } from './UISettings/UISettings';
1717
import { AppDetails } from './AppDetails/AppDetails';
1818
import { StyleSettings } from './StyleSettings/StyleSettings';
19-
import { SearchSettings } from './SearchSettings/SearchSettings';
19+
import { GeneralSettings } from './GeneralSettings/GeneralSettings';
2020
import { DockerSettings } from './DockerSettings/DockerSettings';
2121
import { ProtectedRoute } from '../Routing/ProtectedRoute';
2222

@@ -59,8 +59,8 @@ export const Settings = (): JSX.Element => {
5959
component={WeatherSettings}
6060
/>
6161
<ProtectedRoute
62-
path="/settings/search"
63-
component={SearchSettings}
62+
path="/settings/general"
63+
component={GeneralSettings}
6464
/>
6565
<ProtectedRoute path="/settings/interface" component={UISettings} />
6666
<ProtectedRoute

0 commit comments

Comments
 (0)