Skip to content

Commit 976d7b2

Browse files
authored
Merge pull request #1597 from Neverous/hide-parts
Add support for disabling few website features
2 parents 1db106a + 743ad99 commit 976d7b2

5 files changed

Lines changed: 17 additions & 3 deletions

File tree

website/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,8 @@ After adding your LOCALE.json file(s) in `./public/locales/`, build the website
4242
```bash
4343
PUBLIC_URL='https://my-domain.com' REACT_APP_BACKEND_URL='http://api.my-domain.com' REACT_APP_FALLBACK_LANGUAGE=en yarn build
4444
```
45+
46+
## Additional options
47+
48+
- `YOPASS_DISABLE_FEATURES_CARDS=1` - Allows disabling Features cards
49+
- `YOPASS_DISABLE_ONE_CLICK_LINK=1` - Allows disabling "One-click link" support

website/src/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ const App = () => {
1818
});
1919
}
2020

21+
const features = process.env.YOPASS_DISABLE_FEATURES_CARDS !== '1';
2122
return (
2223
<StyledEngineProvider injectFirst>
2324
<ThemeProvider theme={theme}>
2425
<HashRouter>
2526
<Header />
2627
<Container maxWidth={'lg'}>
2728
<Routing />
28-
<Features />
29+
{features && <Features />}
2930
<Attribution />
3031
</Container>
3132
</HashRouter>

website/src/Routing.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ import DisplaySecret from './displaySecret/DisplaySecret';
55
import Upload from './createSecret/Upload';
66

77
export const Routing = () => {
8+
const oneClickLink = process.env.YOPASS_DISABLE_ONE_CLICK_LINK !== '1';
89
return (
910
<Routes>
1011
<Route path="/" element={<CreateSecret />} />
1112
<Route path="/upload" element={<Upload />} />
12-
<Route path="/:format/:key/:password" element={<DisplaySecret />} />
13+
{oneClickLink && (
14+
<Route path="/:format/:key/:password" element={<DisplaySecret />} />
15+
)}
1316
<Route path="/:format/:key" element={<DisplaySecret />} />
1417
</Routes>
1518
);

website/src/displaySecret/Result.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const Result = ({ uuid, password, prefix, customPassword }: ResultProps) => {
2626
`${window.location.protocol}//${window.location.host}`) + `/#/${prefix}`;
2727
const short = `${base}/${uuid}`;
2828
const full = `${short}/${password}`;
29+
const oneClickLink = process.env.YOPASS_DISABLE_ONE_CLICK_LINK !== '1';
2930
const { t } = useTranslation();
3031

3132
return (
@@ -39,7 +40,7 @@ const Result = ({ uuid, password, prefix, customPassword }: ResultProps) => {
3940
<TableContainer>
4041
<Table>
4142
<TableBody>
42-
{!customPassword && (
43+
{oneClickLink && !customPassword && (
4344
<Row label={t('result.rowLabelOneClick')} value={full} />
4445
)}
4546
<Row label={t('result.rowLabelShortLink')} value={short} />

website/vite.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export default defineConfig(() => {
2828
REACT_APP_FALLBACK_LANGUAGE: process.env.REACT_APP_FALLBACK_LANGUAGE,
2929
START_SERVER_AND_TEST_INSECURE:
3030
process.env.START_SERVER_AND_TEST_INSECURE,
31+
YOPASS_DISABLE_FEATURES_CARDS:
32+
process.env.YOPASS_DISABLE_FEATURES_CARDS,
33+
YOPASS_DISABLE_ONE_CLICK_LINK:
34+
process.env.YOPASS_DISABLE_ONE_CLICK_LINK,
3135
},
3236
},
3337
server: {

0 commit comments

Comments
 (0)