Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marius-wieschollek/passwords-webextension.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius David Wieschollek <passwords.public@mdns.eu>2021-11-28 21:30:28 +0300
committerMarius David Wieschollek <passwords.public@mdns.eu>2021-11-28 21:30:28 +0300
commit2fe313b2a838df1fca64c9d83ee77d9efa571101 (patch)
tree8d5bf3ab436dad8cb23e183a8a140aeb18fc2c4f
parent90d3b295d7a46f987bcb1ea2f06b87b55946b7c5 (diff)
Update handling of theming in passlink
Signed-off-by: Marius David Wieschollek <passwords.public@mdns.eu>
-rw-r--r--src/js/Controller/PassLink/Connect/Apply.js11
-rw-r--r--src/js/Helper/ThemeCssVarsHelper.js20
2 files changed, 19 insertions, 12 deletions
diff --git a/src/js/Controller/PassLink/Connect/Apply.js b/src/js/Controller/PassLink/Connect/Apply.js
index 8f8869f..5b041d4 100644
--- a/src/js/Controller/PassLink/Connect/Apply.js
+++ b/src/js/Controller/PassLink/Connect/Apply.js
@@ -74,10 +74,15 @@ export default class Analyze extends AbstractController {
* @return {Promise<String>}
*/
async _getServerName(login, action) {
- let theme = await action.getTheme();
- if(theme.hasOwnProperty('label')) {
- return `${theme.label} - ${login.login}`;
+ try {
+ let theme = await action.getTheme();
+ if(theme.hasOwnProperty('label')) {
+ return `${theme.label} - ${login.login}`;
+ }
+ } catch(e) {
+ ErrorManager.logError(e);
}
+
let host = new URL(action.getParameter('baseUrl')).host;
return `${login.login}@${host}`;
}
diff --git a/src/js/Helper/ThemeCssVarsHelper.js b/src/js/Helper/ThemeCssVarsHelper.js
index ac3b3ee..a50300a 100644
--- a/src/js/Helper/ThemeCssVarsHelper.js
+++ b/src/js/Helper/ThemeCssVarsHelper.js
@@ -11,25 +11,27 @@ class ThemeCssVarsHelper {
};
if(theme === null) return vars;
- if(theme.hasOwnProperty('color.primary')) {
- vars['--color-primary'] = theme['color.primary'];
+ if(theme.hasOwnProperty('colors')) {
+ if(theme.colors.hasOwnProperty('primary')) {
+ vars['--color-primary'] = theme.colors.primary;
+ }
+ if(theme.colors.hasOwnProperty('text')) {
+ vars['--color-text'] = theme.colors.text;
+ }
}
if(theme.hasOwnProperty('color.text')) {
vars['--color-text'] = theme['color.text'];
}
if(theme.hasOwnProperty('background')) {
- let gradient = 'linear-gradient(40deg, #0082c9 0%, #30b6ff 100%)';
-
- if(theme['color.primary'] !== '#0082c9') {
- gradient =
- `linear-gradient(40deg,${theme['color.primary']} 0%,${theme['color.text']} 320%)`;
+ if(vars['--color-primary'] !== '#0082c9') {
+ vars['--image-background'] = `linear-gradient(40deg,${vars['--color-primary']} 0%,${vars['--color-text']} 320%)`;
}
vars['--image-background'] =
- `url(${theme['background']}), ${gradient}`;
+ `url(${theme.background}), ${vars['--image-background']}`;
}
if(theme.hasOwnProperty('logo')) {
- vars['--image-logo'] = `url(${theme['logo']})`;
+ vars['--image-logo'] = `url(${theme.logo})`;
}
return vars;