Skip to content

Commit

Permalink
fix: gh plugins (#205)
Browse files Browse the repository at this point in the history
* fix: gh plugins

* fix: credential loader
  • Loading branch information
simonas-notcat authored Oct 17, 2023
1 parent ee2569e commit 44982b3
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
7 changes: 4 additions & 3 deletions packages/agent-explore/src/pages/settings/Plugins.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react'
import { Button, Input, List, Space, Switch, App, Drawer, Typography } from 'antd'
import { Button, Input, List, Space, Switch, App, Drawer, Typography, Popover } from 'antd'
import { DeleteOutlined, MenuOutlined, PlusOutlined} from '@ant-design/icons'
import { usePlugins } from '@veramo-community/agent-explorer-plugin'
import { PageContainer } from '@ant-design/pro-components'
Expand Down Expand Up @@ -46,7 +46,8 @@ const SortableItem = ({ item }: { item: IAgentExplorerPlugin}) => {
actions={actions}
><List.Item.Meta
title={item.name}
description={item.description}
description={<Popover content={`${item.config?.url}${item.config?.commitId ? ` @ ${item.config?.commitId}` : ''}`}>{item.description}</Popover>}

/>
</List.Item>
);
Expand Down Expand Up @@ -136,7 +137,7 @@ export const Plugins = () => {
]}
><List.Item.Meta
title={item.name}
description={item.description}
description={<Popover content={`${item.config?.url}${item.config?.commitId && ` @ ${item.config?.commitId}`}`}>{item.description}</Popover>}
/>
</List.Item>}
/>
Expand Down
21 changes: 14 additions & 7 deletions packages/agent-explore/src/plugins/community.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { IAgentExplorerPlugin } from "@veramo-community/agent-explorer-plugin";
export const communityPlugins: IAgentExplorerPlugin[] = [
{
"config": {
"url": "https://cdn.jsdelivr.net/gh/veramolabs/agent-explorer-plugin-brainshare@b748d7d5ff45014a1dc6171d5f58a26eb678fa76/dist/plugin.js",
"url": "github://veramolabs/agent-explorer-plugin-brainshare",
"commitId": "0b028375c2379c8f4039f2f99a303d082b80a099",
"enabled": true
},
"name": "Brain share",
Expand All @@ -14,7 +15,8 @@ export const communityPlugins: IAgentExplorerPlugin[] = [
},
{
"config": {
"url": "https://cdn.jsdelivr.net/gh/veramolabs/agent-explorer-plugin-gitcoin-passport@3f6770aa1b5a85f157611e90043419869b12ab45/dist/plugin.js",
"url": "github://veramolabs/agent-explorer-plugin-gitcoin-passport",
"commitId": "3f6770aa1b5a85f157611e90043419869b12ab45",
"enabled": true
},
"name": "Gitcoin passport",
Expand All @@ -25,7 +27,8 @@ export const communityPlugins: IAgentExplorerPlugin[] = [
},
{
"config": {
"url": "https://cdn.jsdelivr.net/gh/veramolabs/agent-explorer-plugin-kudos@c327b6ae48d5706ec5ac413c756a7e39142e98a1/dist/plugin.js",
"url": "github://veramolabs/agent-explorer-plugin-kudos",
"commitId": "c327b6ae48d5706ec5ac413c756a7e39142e98a1",
"enabled": true
},
"name": "Kudos",
Expand All @@ -36,7 +39,8 @@ export const communityPlugins: IAgentExplorerPlugin[] = [
},
{
"config": {
"url": "https://cdn.jsdelivr.net/gh/veramolabs/agent-explorer-plugin-graph-view@29730b692843e73453a35b96fdd5a3bb733f01b4/dist/plugin.js",
"url": "github://veramolabs/agent-explorer-plugin-graph-view",
"commitId": "29730b692843e73453a35b96fdd5a3bb733f01b4",
"enabled": true
},
"name": "Graph View",
Expand All @@ -47,7 +51,8 @@ export const communityPlugins: IAgentExplorerPlugin[] = [
},
{
"config": {
"url": "https://cdn.jsdelivr.net/gh/veramolabs/agent-explorer-plugin-social-feed@7612fc916087802f0ebf1f7589879fa14d3b717c/dist/plugin.js",
"url": "github://veramolabs/agent-explorer-plugin-social-feed",
"commitId": "7612fc916087802f0ebf1f7589879fa14d3b717c",
"enabled": true
},
"name": "Social Feed",
Expand All @@ -58,7 +63,8 @@ export const communityPlugins: IAgentExplorerPlugin[] = [
},
{
"config": {
"url": "https://cdn.jsdelivr.net/gh/veramolabs/agent-explorer-plugin-developer-tools@439ed9160c383447b9844ed71b25ddf238d0d3ff/dist/plugin.js",
"url": "github://veramolabs/agent-explorer-plugin-developer-tools",
"commitId": "439ed9160c383447b9844ed71b25ddf238d0d3ff",
"enabled": true
},
"name": "Developer Tools",
Expand All @@ -69,7 +75,8 @@ export const communityPlugins: IAgentExplorerPlugin[] = [
},
{
"config": {
"url": "https://cdn.jsdelivr.net/gh/simonas-notcat/agent-explorer-plugin-codyfight@326b878ecbc2000d1d3cdd9827a51eed569408bf/dist/plugin.js",
"url": "github://simonas-notcat/agent-explorer-plugin-codyfight",
"commitId": "326b878ecbc2000d1d3cdd9827a51eed569408bf",
"enabled": true
},
"name": "Codyfight",
Expand Down
8 changes: 6 additions & 2 deletions packages/plugin/src/PluginProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,17 @@ const PluginProvider = (props: PluginProviderProps) => {
}
} else {
try {
const module = await import(/* webpackIgnore: true */ config.url)
let url = config.url
if (config.url.startsWith('github://')) {
url = `https://cdn.jsdelivr.net/gh/${config.url.replace('github://', '')}@${config.commitId}/dist/plugin.js`
}
const module = await import(/* webpackIgnore: true */ url)
const plugin = module.default.init() as IAgentExplorerPlugin
plugin.config = config
result.push(plugin)
//FIXME
if (plugin.hasCss && config.enabled) {
const cssUrl = config.url.replace('plugin.js', 'plugin.css')
const cssUrl = url.replace('plugin.js', 'plugin.css')
try {
const cssResponse = await fetch(cssUrl)
if (cssResponse.ok) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ export const VerifiableCredentialComponent = (
boxShadow: '0px 0px 2px ' + token.colorBorder,
borderLeft: '2px solid ' + color,
backgroundColor: token.colorBgElevated,
overflow: 'hidden'
}}>

{credential && <div className="" >
{credential && <div>


<Row align="top"
Expand Down
1 change: 1 addition & 0 deletions packages/plugin/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Components } from 'react-markdown'
import { PluggableList } from 'unified'
export type IAgentExplorerPluginConfig = {
url: string;
commitId?: string;
enabled: boolean;
}

Expand Down
3 changes: 2 additions & 1 deletion update-community-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const pluginList = plugins.map(plugin => {
console.log(`Size: ${size}`)
return {
config: {
url: `https://cdn.jsdelivr.net/gh/${plugin.repo}@${commitId}/dist/plugin.js`,
url: `github://${plugin.repo}`,
commitId,
enabled: true,
},
name: plugin.name,
Expand Down

0 comments on commit 44982b3

Please sign in to comment.