mirror of
https://github.com/snachodog/tok-to-insta-follower-bridge.git
synced 2025-09-13 15:33:33 -06:00
🐛 fixed a bug that results were not returned in case of error
This commit is contained in:
@@ -2,12 +2,20 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
||||
import { BskyClient } from "~lib/bskyClient";
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||
const { session, subjectDid } = req.body
|
||||
const { session, subjectDid } = req.body
|
||||
const client = BskyClient.createAgentFromSession(session)
|
||||
|
||||
res.send({
|
||||
result: await client.block(subjectDid)
|
||||
})
|
||||
try {
|
||||
res.send({
|
||||
result: await client.block(subjectDid)
|
||||
})
|
||||
} catch (e) {
|
||||
res.send({
|
||||
error: {
|
||||
message: e.message,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default handler
|
||||
|
@@ -2,12 +2,20 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
||||
import { BskyClient } from "~lib/bskyClient";
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||
const { session, subjectDid } = req.body
|
||||
const { session, subjectDid } = req.body
|
||||
const client = BskyClient.createAgentFromSession(session)
|
||||
|
||||
res.send({
|
||||
result: await client.follow(subjectDid)
|
||||
})
|
||||
try {
|
||||
res.send({
|
||||
result: await client.follow(subjectDid)
|
||||
})
|
||||
} catch (e) {
|
||||
res.send({
|
||||
error: {
|
||||
message: e.message,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default handler
|
||||
|
@@ -4,14 +4,22 @@ import { BskyClient } from "../../lib/bskyClient";
|
||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||
const { identifier, password } = req.body
|
||||
|
||||
const agent = await BskyClient.createAgent({
|
||||
identifier,
|
||||
password,
|
||||
})
|
||||
try {
|
||||
const agent = await BskyClient.createAgent({
|
||||
identifier,
|
||||
password,
|
||||
})
|
||||
|
||||
res.send({
|
||||
session: agent.session,
|
||||
})
|
||||
res.send({
|
||||
session: agent.session,
|
||||
})
|
||||
} catch (e) {
|
||||
res.send({
|
||||
error: {
|
||||
message: e.message,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default handler
|
||||
|
@@ -2,15 +2,23 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
||||
import { BskyClient } from "~lib/bskyClient";
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||
const { session, term, limit } = req.body
|
||||
const { session, term, limit } = req.body
|
||||
const client = BskyClient.createAgentFromSession(session)
|
||||
|
||||
res.send({
|
||||
actors: await client.searchUser({
|
||||
term,
|
||||
limit,
|
||||
try {
|
||||
res.send({
|
||||
actors: await client.searchUser({
|
||||
term,
|
||||
limit,
|
||||
})
|
||||
})
|
||||
})
|
||||
} catch (e) {
|
||||
res.send({
|
||||
error: {
|
||||
message: e.message,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default handler
|
||||
|
@@ -2,12 +2,20 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
||||
import { BskyClient } from "~lib/bskyClient";
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||
const { session, blockUri } = req.body
|
||||
const { session, blockUri } = req.body
|
||||
const client = BskyClient.createAgentFromSession(session)
|
||||
|
||||
res.send({
|
||||
result: await client.unblock(blockUri)
|
||||
})
|
||||
try {
|
||||
res.send({
|
||||
result: await client.unblock(blockUri)
|
||||
})
|
||||
} catch (e) {
|
||||
res.send({
|
||||
error: {
|
||||
message: e.message,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default handler
|
||||
|
@@ -2,12 +2,20 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
||||
import { BskyClient } from "~lib/bskyClient";
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||
const { session, followUri } = req.body
|
||||
const { session, followUri } = req.body
|
||||
const client = BskyClient.createAgentFromSession(session)
|
||||
|
||||
res.send({
|
||||
result: await client.unfollow(followUri)
|
||||
})
|
||||
try {
|
||||
res.send({
|
||||
result: await client.unfollow(followUri)
|
||||
})
|
||||
} catch (e) {
|
||||
res.send({
|
||||
error: {
|
||||
message: e.message,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default handler
|
||||
|
Reference in New Issue
Block a user