diff --git a/app/resources/svg/google-drive.svg b/app/resources/svg/google-drive.svg new file mode 100644 index 00000000..cd8dd52a --- /dev/null +++ b/app/resources/svg/google-drive.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/resources/svg/onedrive.svg b/app/resources/svg/onedrive.svg new file mode 100644 index 00000000..e179dfa7 --- /dev/null +++ b/app/resources/svg/onedrive.svg @@ -0,0 +1 @@ + diff --git a/app/scripts/hbs-helpers/index.js b/app/scripts/hbs-helpers/index.js index a7b23692..0a916cfa 100644 --- a/app/scripts/hbs-helpers/index.js +++ b/app/scripts/hbs-helpers/index.js @@ -4,3 +4,4 @@ import 'hbs-helpers/ifeq'; import 'hbs-helpers/ifneq'; import 'hbs-helpers/ifemptyoreq'; import 'hbs-helpers/res'; +import 'hbs-helpers/svg'; diff --git a/app/scripts/hbs-helpers/svg.js b/app/scripts/hbs-helpers/svg.js new file mode 100644 index 00000000..27b9b8b6 --- /dev/null +++ b/app/scripts/hbs-helpers/svg.js @@ -0,0 +1,9 @@ +import Handlebars from 'hbs'; + +Handlebars.registerHelper('svg', (name, cls) => { + const icon = require(`svg/${name}.svg`).default; + if (cls) { + return `'; + iconSvg = 'google-drive'; _baseUrl = 'https://www.googleapis.com/drive/v3'; _baseUrlUpload = 'https://www.googleapis.com/upload/drive/v3'; diff --git a/app/scripts/storage/impl/storage-onedrive.js b/app/scripts/storage/impl/storage-onedrive.js index 71f3f73d..a6be08e9 100644 --- a/app/scripts/storage/impl/storage-onedrive.js +++ b/app/scripts/storage/impl/storage-onedrive.js @@ -10,18 +10,7 @@ class StorageOneDrive extends StorageBase { name = 'onedrive'; enabled = true; uipos = 40; - iconSvg = - '' + - ''; + iconSvg = 'onedrive'; _baseUrl = 'https://graph.microsoft.com/v1.0/me'; diff --git a/app/templates/open.hbs b/app/templates/open.hbs index 66e2601e..c5427121 100644 --- a/app/templates/open.hbs +++ b/app/templates/open.hbs @@ -39,7 +39,7 @@
{{#if prv.icon}}{{/if}} - {{#if prv.iconSvg}}
{{{prv.iconSvg}}}
{{/if}} + {{#if prv.iconSvg}}
{{{svg prv.iconSvg}}}
{{/if}}
{{res prv.name}}
{{/each}} @@ -89,7 +89,7 @@
{{#if file.icon}}{{/if}} - {{#if file.iconSvg}}
{{{file.iconSvg}}}
{{/if}} + {{#if file.iconSvg}}
{{{svg file.iconSvg}}}
{{/if}} {{file.name}} {{#if ../canRemoveLatest}}{{/if}}
diff --git a/app/templates/settings/settings-file.hbs b/app/templates/settings/settings-file.hbs index cd9604ec..01765a18 100644 --- a/app/templates/settings/settings-file.hbs +++ b/app/templates/settings/settings-file.hbs @@ -33,7 +33,7 @@ {{#unless prv.own}}
{{#if prv.icon}}{{/if}} - {{#if prv.iconSvg}}{{{prv.iconSvg}}}{{/if}} + {{#if prv.iconSvg}}{{{svg prv.iconSvg}}}{{/if}} {{res prv.name}}
{{/unless}} diff --git a/build/webpack.config.js b/build/webpack.config.js index a742313b..8200d60b 100644 --- a/build/webpack.config.js +++ b/build/webpack.config.js @@ -72,7 +72,8 @@ function config(options) { templates: path.join(rootDir, 'app/templates'), 'public-key.pem': path.join(rootDir, 'app/resources/public-key.pem'), 'public-key-new.pem': path.join(rootDir, 'app/resources/public-key-new.pem'), - 'demo.kdbx': path.join(rootDir, 'app/resources/Demo.kdbx') + 'demo.kdbx': path.join(rootDir, 'app/resources/Demo.kdbx'), + svg: path.join(rootDir, 'app/resources/svg') } }, module: { @@ -136,7 +137,8 @@ function config(options) { }, { test: /\.woff2$/, loader: 'base64-inline-loader' }, { test: /\.pem$/, loader: 'raw-loader' }, - { test: /\.kdbx$/, loader: 'base64-loader' } + { test: /\.kdbx$/, loader: 'base64-loader' }, + { test: /\.svg$/, loader: 'raw-loader' } ] }, optimization: {