From 6a03b35b1daa77e0bad6c95fefe606e22d864f29 Mon Sep 17 00:00:00 2001 From: brenopolanski Date: Mon, 23 Mar 2020 17:21:36 -0300 Subject: [PATCH 01/14] wip: add method to fetch plugins from the list --- config/index.js | 1 + src/renderer/services/plugin-manager.js | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/config/index.js b/config/index.js index 70e47f540b..14f72b8f96 100644 --- a/config/index.js +++ b/config/index.js @@ -117,6 +117,7 @@ exports.PLUGINS = { adapters: ['npm'], blacklistUrl: 'https://raw.githubusercontent.com/ark-ecosystem-desktop-plugins/config/master/blacklist.json', whitelistUrl: 'https://raw.githubusercontent.com/ark-ecosystem-desktop-plugins/config/master/whitelist.json', + pluginsUrl: 'https://raw.githubusercontent.com/ark-ecosystem-desktop-plugins/config/master/plugins.json', categories: [ 'gaming', 'theme', diff --git a/src/renderer/services/plugin-manager.js b/src/renderer/services/plugin-manager.js index 73fc8b7eaa..2cf8f55242 100644 --- a/src/renderer/services/plugin-manager.js +++ b/src/renderer/services/plugin-manager.js @@ -377,6 +377,16 @@ export class PluginManager { } } + async fetchPluginsList () { + try { + const { body } = await got(`${PLUGINS.pluginsUrl}?ts=${(new Date()).getTime()}`, { json: true }) + this.app.$store.dispatch('plugin/setWhitelisted', { scope: 'global', plugins: body.plugins }) + this.app.$store.dispatch('plugin/setBlacklisted', { scope: 'global', plugins: body.blacklist }) + } catch (error) { + console.error(`Could not fetch plugins from the list '${PLUGINS.pluginsUrl}: ${error.message}`) + } + } + async fetchPlugin (pluginPath, isUpdate = false) { validatePluginPath(pluginPath) From cbdb9d6eee1f4b35b92b8280452eb38c986f45be Mon Sep 17 00:00:00 2001 From: brenopolanski Date: Tue, 24 Mar 2020 00:47:40 -0300 Subject: [PATCH 02/14] feat: add icons --- src/renderer/assets/svg/ark-checkmark.svg | 23 +++++++++++++++++++++ src/renderer/assets/svg/ark-grant.svg | 25 +++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/renderer/assets/svg/ark-checkmark.svg create mode 100644 src/renderer/assets/svg/ark-grant.svg diff --git a/src/renderer/assets/svg/ark-checkmark.svg b/src/renderer/assets/svg/ark-checkmark.svg new file mode 100644 index 0000000000..af7966e73b --- /dev/null +++ b/src/renderer/assets/svg/ark-checkmark.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + diff --git a/src/renderer/assets/svg/ark-grant.svg b/src/renderer/assets/svg/ark-grant.svg new file mode 100644 index 0000000000..15691da21e --- /dev/null +++ b/src/renderer/assets/svg/ark-grant.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + From 2155e19eaadfafdef29c2f25b46b0f803b85bf0e Mon Sep 17 00:00:00 2001 From: brenopolanski Date: Tue, 24 Mar 2020 00:51:22 -0300 Subject: [PATCH 03/14] fix: update url of plugins --- config/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/index.js b/config/index.js index 14f72b8f96..814e192487 100644 --- a/config/index.js +++ b/config/index.js @@ -115,9 +115,8 @@ exports.MARKET = { exports.PLUGINS = { adapters: ['npm'], - blacklistUrl: 'https://raw.githubusercontent.com/ark-ecosystem-desktop-plugins/config/master/blacklist.json', - whitelistUrl: 'https://raw.githubusercontent.com/ark-ecosystem-desktop-plugins/config/master/whitelist.json', - pluginsUrl: 'https://raw.githubusercontent.com/ark-ecosystem-desktop-plugins/config/master/plugins.json', + // pluginsUrl: 'https://raw.githubusercontent.com/ark-ecosystem-desktop-plugins/config/master/plugins.json', + pluginsUrl: 'https://raw.githubusercontent.com/ark-ecosystem-desktop-plugins/config/chore/single-config-file/plugins.json', categories: [ 'gaming', 'theme', From 42b745c3fb355226252edc2c8ac18a7ff761ede7 Mon Sep 17 00:00:00 2001 From: brenopolanski Date: Tue, 24 Mar 2020 01:12:02 -0300 Subject: [PATCH 04/14] feat: set value for isGrant --- src/renderer/App.vue | 2 +- src/renderer/services/plugin-manager.js | 26 +++++++------------------ src/renderer/store/modules/plugin.js | 8 ++++++++ 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/renderer/App.vue b/src/renderer/App.vue index ce9fdcb050..37ed7a2ca0 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -332,7 +332,7 @@ export default { ipcRenderer.send('splashscreen:app-ready') - await Promise.all([this.$plugins.fetchPluginsFromAdapter(), this.$plugins.fetchBlacklist(), this.$plugins.fetchWhitelist()]) + await Promise.all([this.$plugins.fetchPluginsFromAdapter(), this.$plugins.fetchPluginsList()]) }, __watchProfile () { diff --git a/src/renderer/services/plugin-manager.js b/src/renderer/services/plugin-manager.js index 2cf8f55242..c3eddb8758 100644 --- a/src/renderer/services/plugin-manager.js +++ b/src/renderer/services/plugin-manager.js @@ -237,6 +237,8 @@ export class PluginManager { configs = await Promise.all(configs.map(async config => { const plugin = await PluginConfiguration.sanitize(config) + plugin.isGrant = this.app.$store.getters['plugin/isGrant'](plugin.id) + try { plugin.logo = await this.fetchLogo(plugin.logo) } catch (error) { @@ -298,6 +300,8 @@ export class PluginManager { plugin.source = `https://github.com/${owner}/${repository}/archive/${branch}.zip` + plugin.isGrant = this.app.$store.getters['plugin/isGrant'](plugin.id) + try { plugin.logo = await this.fetchLogo(plugin.logo) } catch (error) { @@ -319,7 +323,7 @@ export class PluginManager { if (force || dayjs().isAfter(dayjs(this.app.$store.getters['plugin/lastFetched']).add( PLUGINS.updateInterval.value, PLUGINS.updateInterval.unit ))) { - requests.push(this.fetchPluginsFromAdapter(), this.fetchBlacklist(), this.fetchWhitelist()) + requests.push(this.fetchPluginsFromAdapter(), this.fetchPluginsList()) } await Promise.all(requests) @@ -359,24 +363,6 @@ export class PluginManager { } } - async fetchBlacklist () { - try { - const { body } = await got(`${PLUGINS.blacklistUrl}?ts=${(new Date()).getTime()}`, { json: true }) - this.app.$store.dispatch('plugin/setBlacklisted', { scope: 'global', plugins: body.plugins }) - } catch (error) { - console.error(`Could not fetch blacklist from '${PLUGINS.blacklistUrl}: ${error.message}`) - } - } - - async fetchWhitelist () { - try { - const { body } = await got(`${PLUGINS.whitelistUrl}?ts=${(new Date()).getTime()}`, { json: true }) - this.app.$store.dispatch('plugin/setWhitelisted', { scope: 'global', plugins: body.plugins }) - } catch (error) { - console.error(`Could not fetch whitelist from '${PLUGINS.whitelistUrl}: ${error.message}`) - } - } - async fetchPluginsList () { try { const { body } = await got(`${PLUGINS.pluginsUrl}?ts=${(new Date()).getTime()}`, { json: true }) @@ -397,6 +383,8 @@ export class PluginManager { throw new errors.PluginAlreadyLoadedError(pluginConfig.id) } + pluginConfig.isGrant = this.app.$store.getters['plugin/isGrant'](pluginConfig.id) + try { pluginConfig.logo = fs.readFileSync(`${pluginPath}/logo.png`).toString('base64') } catch (error) { diff --git a/src/renderer/store/modules/plugin.js b/src/renderer/store/modules/plugin.js index c197682a80..8a1fef4820 100644 --- a/src/renderer/store/modules/plugin.js +++ b/src/renderer/store/modules/plugin.js @@ -164,6 +164,14 @@ export default { return false }, + isGrant: (_, getters) => pluginId => { + if (Object.prototype.hasOwnProperty.call(getters.whitelisted.global, pluginId) && Object.prototype.hasOwnProperty.call(getters.whitelisted.global[pluginId], 'isGrant')) { + return getters.whitelisted.global[pluginId].isGrant + } + + return false + }, + isInstalledSupported: (_, getters) => pluginId => { const plugin = getters.installedById(pluginId) From 2e1ee22b40c61309cd056a00fdd69c3cfbc39885 Mon Sep 17 00:00:00 2001 From: brenopolanski Date: Tue, 24 Mar 2020 01:19:22 -0300 Subject: [PATCH 05/14] feat: add grant icon component --- .../PluginManager/PluginManagerCheckmark.vue | 7 ++-- .../PluginManager/PluginManagerGrant.vue | 40 +++++++++++++++++++ .../PluginManager/PluginManagerGrid.vue | 21 +++++----- 3 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 src/renderer/components/PluginManager/PluginManagerGrant.vue diff --git a/src/renderer/components/PluginManager/PluginManagerCheckmark.vue b/src/renderer/components/PluginManager/PluginManagerCheckmark.vue index aae6bf6906..828e681ae1 100644 --- a/src/renderer/components/PluginManager/PluginManagerCheckmark.vue +++ b/src/renderer/components/PluginManager/PluginManagerCheckmark.vue @@ -7,8 +7,8 @@ class="PluginManagerCheckmark" > @@ -34,6 +34,7 @@ export default { diff --git a/src/renderer/components/PluginManager/PluginManagerGrant.vue b/src/renderer/components/PluginManager/PluginManagerGrant.vue new file mode 100644 index 0000000000..7a18a14c7a --- /dev/null +++ b/src/renderer/components/PluginManager/PluginManagerGrant.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/src/renderer/components/PluginManager/PluginManagerGrid.vue b/src/renderer/components/PluginManager/PluginManagerGrid.vue index 4e3f065e5e..b25af0d33a 100644 --- a/src/renderer/components/PluginManager/PluginManagerGrid.vue +++ b/src/renderer/components/PluginManager/PluginManagerGrid.vue @@ -29,16 +29,17 @@
- - {{ plugin.title }} - - +
+ + {{ plugin.title }} + + + +
- - {{ plugin.author }} v{{ plugin.version }} {{ formatter_bytes(plugin.size) }} @@ -57,6 +58,7 @@