mirror of
https://github.com/snachodog/tok-to-insta-follower-bridge.git
synced 2025-04-17 17:22:23 -06:00
Merge pull request #54 from mozzius/samuel/async-resumesession
await resumeSession call
This commit is contained in:
commit
7572736da7
@ -3,7 +3,7 @@ import { BskyClient } from "~lib/bskyClient";
|
|||||||
|
|
||||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||||
const { session, subjectDid } = req.body;
|
const { session, subjectDid } = req.body;
|
||||||
const client = BskyClient.createAgentFromSession(session);
|
const client = await BskyClient.createAgentFromSession(session);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
res.send({
|
res.send({
|
||||||
|
@ -3,7 +3,7 @@ import { BskyClient } from "~lib/bskyClient";
|
|||||||
|
|
||||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||||
const { session, subjectDid } = req.body;
|
const { session, subjectDid } = req.body;
|
||||||
const client = BskyClient.createAgentFromSession(session);
|
const client = await BskyClient.createAgentFromSession(session);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
res.send({
|
res.send({
|
||||||
|
@ -3,7 +3,7 @@ import { BskyClient } from "~lib/bskyClient";
|
|||||||
|
|
||||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||||
const { session, term, limit } = req.body;
|
const { session, term, limit } = req.body;
|
||||||
const client = BskyClient.createAgentFromSession(session);
|
const client = await BskyClient.createAgentFromSession(session);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
res.send({
|
res.send({
|
||||||
|
@ -3,7 +3,7 @@ import { BskyClient } from "~lib/bskyClient";
|
|||||||
|
|
||||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||||
const { session, blockUri } = req.body;
|
const { session, blockUri } = req.body;
|
||||||
const client = BskyClient.createAgentFromSession(session);
|
const client = await BskyClient.createAgentFromSession(session);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
res.send({
|
res.send({
|
||||||
|
@ -3,7 +3,7 @@ import { BskyClient } from "~lib/bskyClient";
|
|||||||
|
|
||||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||||
const { session, followUri } = req.body;
|
const { session, followUri } = req.body;
|
||||||
const client = BskyClient.createAgentFromSession(session);
|
const client = await BskyClient.createAgentFromSession(session);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
res.send({
|
res.send({
|
||||||
|
@ -27,12 +27,14 @@ export class BskyClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createAgentFromSession(session: AtpSessionData): BskyClient {
|
public static async createAgentFromSession(
|
||||||
|
session: AtpSessionData,
|
||||||
|
): Promise<BskyClient> {
|
||||||
if (clientCache.has(session.did)) {
|
if (clientCache.has(session.did)) {
|
||||||
return clientCache.get(session.did);
|
return clientCache.get(session.did);
|
||||||
}
|
}
|
||||||
const client = new BskyClient();
|
const client = new BskyClient();
|
||||||
client.agent.resumeSession(session);
|
await client.agent.resumeSession(session);
|
||||||
client.me = {
|
client.me = {
|
||||||
did: session.did,
|
did: session.did,
|
||||||
handle: session.handle,
|
handle: session.handle,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user