From da9425fccead29025d1e989c84c631d317f20e40 Mon Sep 17 00:00:00 2001 From: Maciej Szeptuch Date: Wed, 15 Feb 2023 01:08:33 +0100 Subject: [PATCH 1/3] Add support for disabling few website features - Toggle for Features cards - Toggle for "One-click link" --- website/README.md | 5 +++++ website/src/App.tsx | 3 ++- website/src/Routing.tsx | 3 ++- website/src/displaySecret/Result.tsx | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/website/README.md b/website/README.md index 6460a523b..1e9734aa3 100644 --- a/website/README.md +++ b/website/README.md @@ -42,3 +42,8 @@ After adding your LOCALE.json file(s) in `./public/locales/`, build the website ```bash PUBLIC_URL='https://my-domain.com' REACT_APP_BACKEND_URL='http://api.my-domain.com' REACT_APP_FALLBACK_LANGUAGE=en yarn build ``` + +## Additional options + +- `REACT_APP_DISABLE_FEATURES_CARDS=1` - Allows disabling Features cards +- `REACT_APP_DISABLE_ONE_CLICK_LINK=1` - Allows disabling "One-click link" support diff --git a/website/src/App.tsx b/website/src/App.tsx index 663490a0c..29a98a842 100644 --- a/website/src/App.tsx +++ b/website/src/App.tsx @@ -18,6 +18,7 @@ const App = () => { }); } + const features = process.env.REACT_APP_DISABLE_FEATURES_CARDS !== '1'; return ( @@ -25,7 +26,7 @@ const App = () => {
- + {features && } diff --git a/website/src/Routing.tsx b/website/src/Routing.tsx index 2275217c9..25d5360de 100644 --- a/website/src/Routing.tsx +++ b/website/src/Routing.tsx @@ -5,11 +5,12 @@ import DisplaySecret from './displaySecret/DisplaySecret'; import Upload from './createSecret/Upload'; export const Routing = () => { + const oneClickLink = process.env.REACT_APP_DISABLE_ONE_CLICK_LINK !== '1'; return ( } /> } /> - } /> + {oneClickLink && } />} } /> ); diff --git a/website/src/displaySecret/Result.tsx b/website/src/displaySecret/Result.tsx index 62e8d4791..93c470596 100644 --- a/website/src/displaySecret/Result.tsx +++ b/website/src/displaySecret/Result.tsx @@ -26,6 +26,7 @@ const Result = ({ uuid, password, prefix, customPassword }: ResultProps) => { `${window.location.protocol}//${window.location.host}`) + `/#/${prefix}`; const short = `${base}/${uuid}`; const full = `${short}/${password}`; + const oneClickLink = process.env.REACT_APP_DISABLE_ONE_CLICK_LINK !== '1'; const { t } = useTranslation(); return ( @@ -39,7 +40,7 @@ const Result = ({ uuid, password, prefix, customPassword }: ResultProps) => { - {!customPassword && ( + {oneClickLink && !customPassword && ( )} From 9b197850553b0f80ea0e42e5233a3aa6545f5c08 Mon Sep 17 00:00:00 2001 From: Maciej Szeptuch Date: Fri, 11 Oct 2024 22:06:40 +0200 Subject: [PATCH 2/3] rename env variables --- website/README.md | 4 ++-- website/src/App.tsx | 2 +- website/src/Routing.tsx | 2 +- website/src/displaySecret/Result.tsx | 2 +- website/vite.config.ts | 2 ++ 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/website/README.md b/website/README.md index 1e9734aa3..fd9e26d61 100644 --- a/website/README.md +++ b/website/README.md @@ -45,5 +45,5 @@ PUBLIC_URL='https://my-domain.com' REACT_APP_BACKEND_URL='http://api.my-domain.c ## Additional options -- `REACT_APP_DISABLE_FEATURES_CARDS=1` - Allows disabling Features cards -- `REACT_APP_DISABLE_ONE_CLICK_LINK=1` - Allows disabling "One-click link" support +- `YOPASS_DISABLE_FEATURES_CARDS=1` - Allows disabling Features cards +- `YOPASS_DISABLE_ONE_CLICK_LINK=1` - Allows disabling "One-click link" support diff --git a/website/src/App.tsx b/website/src/App.tsx index 29a98a842..c434182e5 100644 --- a/website/src/App.tsx +++ b/website/src/App.tsx @@ -18,7 +18,7 @@ const App = () => { }); } - const features = process.env.REACT_APP_DISABLE_FEATURES_CARDS !== '1'; + const features = process.env.YOPASS_DISABLE_FEATURES_CARDS !== '1'; return ( diff --git a/website/src/Routing.tsx b/website/src/Routing.tsx index 25d5360de..f53bdee48 100644 --- a/website/src/Routing.tsx +++ b/website/src/Routing.tsx @@ -5,7 +5,7 @@ import DisplaySecret from './displaySecret/DisplaySecret'; import Upload from './createSecret/Upload'; export const Routing = () => { - const oneClickLink = process.env.REACT_APP_DISABLE_ONE_CLICK_LINK !== '1'; + const oneClickLink = process.env.YOPASS_DISABLE_ONE_CLICK_LINK !== '1'; return ( } /> diff --git a/website/src/displaySecret/Result.tsx b/website/src/displaySecret/Result.tsx index 93c470596..fcc0fd59f 100644 --- a/website/src/displaySecret/Result.tsx +++ b/website/src/displaySecret/Result.tsx @@ -26,7 +26,7 @@ const Result = ({ uuid, password, prefix, customPassword }: ResultProps) => { `${window.location.protocol}//${window.location.host}`) + `/#/${prefix}`; const short = `${base}/${uuid}`; const full = `${short}/${password}`; - const oneClickLink = process.env.REACT_APP_DISABLE_ONE_CLICK_LINK !== '1'; + const oneClickLink = process.env.YOPASS_DISABLE_ONE_CLICK_LINK !== '1'; const { t } = useTranslation(); return ( diff --git a/website/vite.config.ts b/website/vite.config.ts index 297b5efb4..35407798e 100644 --- a/website/vite.config.ts +++ b/website/vite.config.ts @@ -28,6 +28,8 @@ export default defineConfig(() => { REACT_APP_FALLBACK_LANGUAGE: process.env.REACT_APP_FALLBACK_LANGUAGE, START_SERVER_AND_TEST_INSECURE: process.env.START_SERVER_AND_TEST_INSECURE, + YOPASS_DISABLE_FEATURES_CARDS: process.env.YOPASS_DISABLE_FEATURES_CARDS, + YOPASS_DISABLE_ONE_CLICK_LINK: process.env.YOPASS_DISABLE_ONE_CLICK_LINK, }, }, server: { From f046df7899e7373dc73f202471364d1e275b7277 Mon Sep 17 00:00:00 2001 From: Maciej Szeptuch Date: Sun, 13 Oct 2024 10:46:52 +0200 Subject: [PATCH 3/3] fix code style --- website/src/Routing.tsx | 4 +++- website/vite.config.ts | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/website/src/Routing.tsx b/website/src/Routing.tsx index f53bdee48..0c408aa9a 100644 --- a/website/src/Routing.tsx +++ b/website/src/Routing.tsx @@ -10,7 +10,9 @@ export const Routing = () => { } /> } /> - {oneClickLink && } />} + {oneClickLink && ( + } /> + )} } /> ); diff --git a/website/vite.config.ts b/website/vite.config.ts index 35407798e..441be4d84 100644 --- a/website/vite.config.ts +++ b/website/vite.config.ts @@ -28,8 +28,10 @@ export default defineConfig(() => { REACT_APP_FALLBACK_LANGUAGE: process.env.REACT_APP_FALLBACK_LANGUAGE, START_SERVER_AND_TEST_INSECURE: process.env.START_SERVER_AND_TEST_INSECURE, - YOPASS_DISABLE_FEATURES_CARDS: process.env.YOPASS_DISABLE_FEATURES_CARDS, - YOPASS_DISABLE_ONE_CLICK_LINK: process.env.YOPASS_DISABLE_ONE_CLICK_LINK, + YOPASS_DISABLE_FEATURES_CARDS: + process.env.YOPASS_DISABLE_FEATURES_CARDS, + YOPASS_DISABLE_ONE_CLICK_LINK: + process.env.YOPASS_DISABLE_ONE_CLICK_LINK, }, }, server: {