Skip to content

Commit 6c067be

Browse files
committed
Option to open links in the same tab. Api upload icon. Render image icon instead of MDI. Dockerfile client dependencies fix.
1 parent e3ed429 commit 6c067be

File tree

18 files changed

+214
-13
lines changed

18 files changed

+214
-13
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ COPY . .
1212

1313
RUN mkdir -p ./public ./data \
1414
&& cd ./client \
15+
&& npm install --production \
1516
&& npm run build \
1617
&& cd .. \
1718
&& mv ./client/build/* ./public \

Dockerfile.multiarch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ COPY . .
1313

1414
RUN mkdir -p ./public ./data \
1515
&& cd ./client \
16+
&& npm install --production \
1617
&& npm run build \
1718
&& cd .. \
1819
&& mv ./client/build/* ./public \

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ Follow instructions from wiki: [Installation without Docker](https://github.com/
9999
- Format: `www.domain.com`, `domain.com`, `sub.domain.com`, `local`, `ip`, `ip:port`
100100
- Redirect: `http://{dest}`
101101

102+
### Custom CSS
103+
> This is an experimental feature. Its behaviour might change in the future.
104+
>
105+
Follow instructions from wiki: [Custom CSS](https://github.com/pawelmalak/flame/wiki/Custom-CSS)
106+
102107
## Support
103108
If you want to support development of Flame and my upcoming self-hosted and open source projects you can use the following link:
104109

api.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
const path = require('path');
1+
const { join } = require('path');
22
const express = require('express');
33
const errorHandler = require('./middleware/errorHandler');
44

55
const api = express();
66

77
// Static files
8-
api.use(express.static(path.join(__dirname, 'public')));
8+
api.use(express.static(join(__dirname, 'public')));
9+
api.use('/uploads', express.static(join(__dirname, 'data/uploads')));
910
api.get(/^\/(?!api)/, (req, res) => {
10-
res.sendFile(path.join(__dirname, 'public/index.html'));
11+
res.sendFile(join(__dirname, 'public/index.html'));
1112
})
1213

14+
1315
// Body parser
1416
api.use(express.json());
1517

client/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
REACT_APP_VERSION=1.4.2
1+
REACT_APP_VERSION=1.4.3

client/src/components/Apps/AppCard/AppCard.module.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,12 @@
3939
.AppCard:hover {
4040
background-color: rgba(0,0,0,0.2);
4141
}
42+
}
43+
44+
.CustomIcon {
45+
width: 90%;
46+
height: 90%;
47+
margin-top: 2px;
48+
margin-left: 2px;
49+
object-fit: contain;
4250
}

client/src/components/Apps/AppCard/AppCard.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Icon from '../../UI/Icons/Icon/Icon';
33
import { iconParser, urlParser } from '../../../utility';
44

55
import { App } from '../../../interfaces';
6+
import { searchConfig } from '../../../utility';
67

78
interface ComponentProps {
89
app: App;
@@ -15,12 +16,19 @@ const AppCard = (props: ComponentProps): JSX.Element => {
1516
return (
1617
<a
1718
href={redirectUrl}
18-
target='_blank'
19+
target={searchConfig('openSameTab', false) ? '' : '_blank'}
1920
rel='noreferrer'
2021
className={classes.AppCard}
2122
>
2223
<div className={classes.AppCardIcon}>
23-
<Icon icon={iconParser(props.app.icon)} />
24+
{(/.(jpeg|jpg|png)$/).test(props.app.icon)
25+
? <img
26+
src={`/uploads/${props.app.icon}`}
27+
alt={`${props.app.name} icon`}
28+
className={classes.CustomIcon}
29+
/>
30+
: <Icon icon={iconParser(props.app.icon)} />
31+
}
2432
</div>
2533
<div className={classes.AppCardDetails}>
2634
<h5>{props.app.name}</h5>

client/src/components/Bookmarks/BookmarkCard/BookmarkCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Bookmark, Category } from '../../../interfaces';
22
import classes from './BookmarkCard.module.css';
33

44
import Icon from '../../UI/Icons/Icon/Icon';
5-
import { iconParser, urlParser } from '../../../utility';
5+
import { iconParser, urlParser, searchConfig } from '../../../utility';
66

77
interface ComponentProps {
88
category: Category;
@@ -19,7 +19,7 @@ const BookmarkCard = (props: ComponentProps): JSX.Element => {
1919
return (
2020
<a
2121
href={redirectUrl}
22-
target='_blank'
22+
target={searchConfig('openSameTab', false) ? '' : '_blank'}
2323
rel='noreferrer'
2424
key={`bookmark-${bookmark.id}`}>
2525
{bookmark.icon && (

client/src/components/Settings/OtherSettings/OtherSettings.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ const OtherSettings = (props: ComponentProps): JSX.Element => {
2929
pinAppsByDefault: 1,
3030
pinCategoriesByDefault: 1,
3131
hideHeader: 0,
32-
useOrdering: 'createdAt'
32+
useOrdering: 'createdAt',
33+
openSameTab: 0
3334
})
3435

3536
// Get config
@@ -39,7 +40,8 @@ const OtherSettings = (props: ComponentProps): JSX.Element => {
3940
pinAppsByDefault: searchConfig('pinAppsByDefault', 1),
4041
pinCategoriesByDefault: searchConfig('pinCategoriesByDefault', 1),
4142
hideHeader: searchConfig('hideHeader', 0),
42-
useOrdering: searchConfig('useOrdering', 'createdAt')
43+
useOrdering: searchConfig('useOrdering', 'createdAt'),
44+
openSameTab: searchConfig('openSameTab', 0)
4345
})
4446
}, [props.loading]);
4547

@@ -134,6 +136,18 @@ const OtherSettings = (props: ComponentProps): JSX.Element => {
134136
<option value='orderId'>Custom order</option>
135137
</select>
136138
</InputGroup>
139+
<InputGroup>
140+
<label htmlFor='openSameTab'>Open all links in the same tab</label>
141+
<select
142+
id='openSameTab'
143+
name='openSameTab'
144+
value={formData.openSameTab}
145+
onChange={(e) => inputChangeHandler(e, true)}
146+
>
147+
<option value={1}>True</option>
148+
<option value={0}>False</option>
149+
</select>
150+
</InputGroup>
137151
<Button>Save changes</Button>
138152
</form>
139153
)

client/src/interfaces/Forms.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ export interface SettingsForm {
1111
pinCategoriesByDefault: number;
1212
hideHeader: number;
1313
useOrdering: string;
14+
openSameTab: number;
1415
}

0 commit comments

Comments
 (0)