Skip to content

Commit 960290f

Browse files
authored
Merge pull request #17 from tlsnotary/twitter-plugin-fix
handleGetPlugin Fix
2 parents ac724de + 0d57a6b commit 960290f

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

web/components/Steps/index.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,24 @@ export default function Steps(): ReactElement {
7575

7676
async function handleGetPlugins() {
7777
try {
78-
const plugins = await client.getPlugins('**', '**', {
79-
hash: '6931d2ad63340d3a1fb1a5c1e3f4454c5a518164d6de5ad272e744832355ee02',
80-
});
81-
if (plugins.length > 0) {
82-
setPluginID(plugins[0].hash);
78+
const plugins = await client.getPlugins('**', '**');
79+
80+
const targetPlugin = plugins.find(plugin =>
81+
plugin.title === "Twitter Profile" &&
82+
Array.isArray(plugin.headers) &&
83+
plugin.headers.includes('https://api.x.com/1.1/account/settings.json')
84+
);
85+
86+
if (targetPlugin) {
87+
setPluginID(targetPlugin.hash);
8388
setStep(2);
8489
}
8590
} catch (error) {
86-
console.log(error);
91+
console.error(error);
8792
}
8893
}
8994

95+
9096
async function handlePluginInstall() {
9197
try {
9298
const plugin = await client.installPlugin(
@@ -110,6 +116,7 @@ export default function Steps(): ReactElement {
110116
async function handleRunPlugin() {
111117
try {
112118
setLoading(true);
119+
console.log(pluginID)
113120
const pluginData = await client.runPlugin(pluginID);
114121
setLoading(false);
115122
setPluginData(pluginData);

0 commit comments

Comments
 (0)