feat: farcaster
This commit is contained in:
parent
7a45fc35dc
commit
1505143112
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
|
|
@ -14,6 +14,7 @@ import { useVariables } from '@gitroom/react/helpers/variable.context';
|
|||
import { useToaster } from '@gitroom/react/toaster/toaster';
|
||||
import { object, string } from 'yup';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { web3List } from '@gitroom/frontend/components/launches/web3/web3.list';
|
||||
|
||||
const resolver = classValidatorResolver(ApiKeyDto);
|
||||
|
||||
|
|
@ -307,6 +308,7 @@ export const AddProviderComponent: FC<{
|
|||
name: string;
|
||||
toolTip?: string;
|
||||
isExternal: boolean;
|
||||
isWeb3: boolean;
|
||||
customFields?: Array<{
|
||||
key: string;
|
||||
label: string;
|
||||
|
|
@ -327,6 +329,7 @@ export const AddProviderComponent: FC<{
|
|||
(
|
||||
identifier: string,
|
||||
isExternal: boolean,
|
||||
isWeb3: boolean,
|
||||
customFields?: Array<{
|
||||
key: string;
|
||||
label: string;
|
||||
|
|
@ -336,6 +339,32 @@ export const AddProviderComponent: FC<{
|
|||
}>
|
||||
) =>
|
||||
async () => {
|
||||
const openWeb3 = async () => {
|
||||
const { component: Web3Providers } = web3List.find(
|
||||
(item) => item.identifier === identifier
|
||||
)!;
|
||||
|
||||
const { url } = await (
|
||||
await fetch(`/integrations/social/${identifier}`)
|
||||
).json();
|
||||
|
||||
modal.openModal({
|
||||
title: '',
|
||||
withCloseButton: false,
|
||||
classNames: {
|
||||
modal: 'bg-transparent text-textColor',
|
||||
},
|
||||
children: (
|
||||
<Web3Providers
|
||||
onComplete={(code, newState) => {
|
||||
window.location.href = `/integrations/social/${identifier}?code=${code}&state=${newState}`;
|
||||
}}
|
||||
nonce={url}
|
||||
/>
|
||||
),
|
||||
});
|
||||
return;
|
||||
};
|
||||
const gotoIntegration = async (externalUrl?: string) => {
|
||||
const { url, err } = await (
|
||||
await fetch(
|
||||
|
|
@ -352,6 +381,11 @@ export const AddProviderComponent: FC<{
|
|||
window.location.href = url;
|
||||
};
|
||||
|
||||
if (isWeb3) {
|
||||
openWeb3();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isExternal) {
|
||||
modal.closeAll();
|
||||
|
||||
|
|
@ -443,6 +477,7 @@ export const AddProviderComponent: FC<{
|
|||
onClick={getSocialLink(
|
||||
item.identifier,
|
||||
item.isExternal,
|
||||
item.isWeb3,
|
||||
item.customFields
|
||||
)}
|
||||
{...(!!item.toolTip
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import SlackProvider from '@gitroom/frontend/components/launches/providers/slack
|
|||
import MastodonProvider from '@gitroom/frontend/components/launches/providers/mastodon/mastodon.provider';
|
||||
import BlueskyProvider from '@gitroom/frontend/components/launches/providers/bluesky/bluesky.provider';
|
||||
import LemmyProvider from '@gitroom/frontend/components/launches/providers/lemmy/lemmy.provider';
|
||||
import WarpcastProvider from '@gitroom/frontend/components/launches/providers/warpcast/warpcast.provider';
|
||||
|
||||
export const Providers = [
|
||||
{identifier: 'devto', component: DevtoProvider},
|
||||
|
|
@ -40,6 +41,7 @@ export const Providers = [
|
|||
{identifier: 'mastodon', component: MastodonProvider},
|
||||
{identifier: 'bluesky', component: BlueskyProvider},
|
||||
{identifier: 'lemmy', component: LemmyProvider},
|
||||
{identifier: 'wrapcast', component: WarpcastProvider},
|
||||
];
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,152 @@
|
|||
import { FC, FormEvent, useCallback, useState } from 'react';
|
||||
import { useCustomProviderFunction } from '@gitroom/frontend/components/launches/helpers/use.custom.provider.function';
|
||||
import { Input } from '@gitroom/react/form/input';
|
||||
import { useDebouncedCallback } from 'use-debounce';
|
||||
import { useWatch } from 'react-hook-form';
|
||||
import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values';
|
||||
|
||||
export const Subreddit: FC<{
|
||||
onChange: (event: {
|
||||
target: {
|
||||
name: string;
|
||||
value: {
|
||||
id: string;
|
||||
subreddit: string;
|
||||
title: string;
|
||||
name: string;
|
||||
url: string;
|
||||
body: string;
|
||||
media: any[];
|
||||
};
|
||||
};
|
||||
}) => void;
|
||||
name: string;
|
||||
}> = (props) => {
|
||||
const { onChange, name } = props;
|
||||
|
||||
const state = useSettings();
|
||||
const split = name.split('.');
|
||||
const [loading, setLoading] = useState(false);
|
||||
// @ts-ignore
|
||||
const errors = state?.formState?.errors?.[split?.[0]]?.[split?.[1]]?.value;
|
||||
|
||||
const [results, setResults] = useState([]);
|
||||
const func = useCustomProviderFunction();
|
||||
const value = useWatch({ name });
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
|
||||
const setResult = (result: { id: string; name: string }) => async () => {
|
||||
setLoading(true);
|
||||
setSearchValue('');
|
||||
|
||||
onChange({
|
||||
target: {
|
||||
name,
|
||||
value: {
|
||||
id: String(result.id),
|
||||
subreddit: result.name,
|
||||
title: '',
|
||||
name: '',
|
||||
url: '',
|
||||
body: '',
|
||||
media: [],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const setTitle = useCallback(
|
||||
(e: any) => {
|
||||
onChange({
|
||||
target: {
|
||||
name,
|
||||
value: {
|
||||
...value,
|
||||
title: e.target.value,
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
[value]
|
||||
);
|
||||
|
||||
const setURL = useCallback(
|
||||
(e: any) => {
|
||||
onChange({
|
||||
target: {
|
||||
name,
|
||||
value: {
|
||||
...value,
|
||||
url: e.target.value,
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
[value]
|
||||
);
|
||||
|
||||
const search = useDebouncedCallback(
|
||||
useCallback(async (e: FormEvent<HTMLInputElement>) => {
|
||||
// @ts-ignore
|
||||
setResults([]);
|
||||
// @ts-ignore
|
||||
if (!e.target.value) {
|
||||
return;
|
||||
}
|
||||
// @ts-ignore
|
||||
const results = await func.get('subreddits', { word: e.target.value });
|
||||
// @ts-ignore
|
||||
setResults(results);
|
||||
}, []),
|
||||
500
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="bg-primary p-[20px]">
|
||||
{value?.subreddit ? (
|
||||
<>
|
||||
<Input
|
||||
error={errors?.subreddit?.message}
|
||||
disableForm={true}
|
||||
value={value.subreddit}
|
||||
readOnly={true}
|
||||
label="Channel"
|
||||
name="subreddit"
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<div className="relative">
|
||||
<Input
|
||||
placeholder="Channel"
|
||||
name="search"
|
||||
label="Search Channel"
|
||||
readOnly={loading}
|
||||
value={searchValue}
|
||||
error={errors?.message}
|
||||
disableForm={true}
|
||||
onInput={async (e) => {
|
||||
// @ts-ignore
|
||||
setSearchValue(e.target.value);
|
||||
await search(e);
|
||||
}}
|
||||
/>
|
||||
{!!results.length && !loading && (
|
||||
<div className="z-[400] w-full absolute bg-input -mt-[20px] outline-none border-fifth border cursor-pointer">
|
||||
{results.map((r: { id: string; name: string }) => (
|
||||
<div
|
||||
onClick={setResult(r)}
|
||||
key={r.id}
|
||||
className="px-[16px] py-[5px] hover:bg-secondary"
|
||||
>
|
||||
{r.name}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider';
|
||||
import { FC, useCallback } from 'react';
|
||||
import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values';
|
||||
import { useFieldArray } from 'react-hook-form';
|
||||
import { deleteDialog } from '@gitroom/react/helpers/delete.dialog';
|
||||
import { Button } from '@gitroom/react/form/button';
|
||||
import { Subreddit } from './subreddit';
|
||||
|
||||
const WrapcastProvider: FC = () => {
|
||||
const { register, control } = useSettings();
|
||||
const { fields, append, remove } = useFieldArray({
|
||||
control, // control props comes from useForm (optional: if you are using FormContext)
|
||||
name: 'subreddit', // unique name for your Field Array
|
||||
});
|
||||
|
||||
const addField = useCallback(() => {
|
||||
append({});
|
||||
}, [fields, append]);
|
||||
|
||||
const deleteField = useCallback(
|
||||
(index: number) => async () => {
|
||||
if (
|
||||
!(await deleteDialog('Are you sure you want to delete this Subreddit?'))
|
||||
)
|
||||
return;
|
||||
remove(index);
|
||||
},
|
||||
[fields, remove]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col gap-[20px] mb-[20px]">
|
||||
{fields.map((field, index) => (
|
||||
<div key={field.id} className="flex flex-col relative">
|
||||
<div
|
||||
onClick={deleteField(index)}
|
||||
className="absolute -left-[10px] justify-center items-center flex -top-[10px] w-[20px] h-[20px] bg-red-600 rounded-full text-textColor"
|
||||
>
|
||||
x
|
||||
</div>
|
||||
<Subreddit {...register(`subreddit.${index}.value`)} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<Button onClick={addField}>Add Channel</Button>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default withProvider(
|
||||
WrapcastProvider,
|
||||
undefined,
|
||||
undefined,
|
||||
async (list) => {
|
||||
if (
|
||||
list.some((item) => item.some((field) => field.path.indexOf('mp4') > -1))
|
||||
) {
|
||||
return 'Warpcast can only accept images';
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
3000
|
||||
);
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
'use client';
|
||||
import '@neynar/react/dist/style.css';
|
||||
import React, { FC, useMemo, useState, useCallback, useEffect } from 'react';
|
||||
import { Web3ProviderInterface } from '@gitroom/frontend/components/launches/web3/web3.provider.interface';
|
||||
import { useVariables } from '@gitroom/react/helpers/variable.context';
|
||||
import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.title.component';
|
||||
import { useModals } from '@mantine/modals';
|
||||
import { LoadingComponent } from '@gitroom/frontend/components/layout/loading';
|
||||
import { NeynarAuthButton, NeynarContextProvider, Theme, useNeynarContext } from '@neynar/react';
|
||||
import { INeynarAuthenticatedUser } from '@neynar/react/dist/types/common';
|
||||
|
||||
export const WrapcasterProvider: FC<Web3ProviderInterface> = (props) => {
|
||||
const [id, state] = props.nonce.split('||');
|
||||
const modal = useModals();
|
||||
const [hide, setHide] = useState(false);
|
||||
|
||||
const auth = useCallback((params: { user: INeynarAuthenticatedUser }) => {
|
||||
setHide(true);
|
||||
return props.onComplete(Buffer.from(JSON.stringify(params.user)).toString('base64'), state);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<NeynarContextProvider
|
||||
settings={{
|
||||
clientId: id || '',
|
||||
defaultTheme: Theme.Dark,
|
||||
// eventsCallbacks: {
|
||||
// onAuthSuccess: (params: { user: INeynarAuthenticatedUser }) => {
|
||||
// auth(params);
|
||||
// },
|
||||
// },
|
||||
}}
|
||||
>
|
||||
<div className="rounded-[4px] border border-customColor6 bg-sixth px-[16px] pb-[16px] relative w-full">
|
||||
<TopTitle title={`Add Wrapcast`} />
|
||||
<button
|
||||
className="outline-none absolute right-[20px] top-[20px] mantine-UnstyledButton-root mantine-ActionIcon-root hover:bg-tableBorder cursor-pointer mantine-Modal-close mantine-1dcetaa"
|
||||
type="button"
|
||||
onClick={() => modal.closeAll()}
|
||||
>
|
||||
<svg
|
||||
viewBox="0 0 15 15"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
>
|
||||
<path
|
||||
d="M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z"
|
||||
fill="currentColor"
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
<div className="justify-center items-center flex">
|
||||
{hide ? (
|
||||
<div className="justify-center items-center flex -mt-[90px]">
|
||||
<LoadingComponent width={100} height={100} />
|
||||
</div>
|
||||
) : (
|
||||
<div className="justify-center items-center flex py-[20px]">
|
||||
<Logged onSuccess={auth} />
|
||||
<NeynarAuthButton className="right-4 top-4" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</NeynarContextProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export const Logged: FC<{onSuccess: (params: {user: INeynarAuthenticatedUser}) => void}> = (props) => {
|
||||
const context = useNeynarContext();
|
||||
useEffect(() => {
|
||||
if (context.isAuthenticated && context.user) {
|
||||
props.onSuccess({ user: context.user });
|
||||
}
|
||||
}, [context.isAuthenticated]);
|
||||
return null;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import { FC } from 'react';
|
||||
import { Web3ProviderInterface } from '@gitroom/frontend/components/launches/web3/web3.provider.interface';
|
||||
import { WrapcasterProvider } from '@gitroom/frontend/components/launches/web3/providers/wrapcaster.provider';
|
||||
|
||||
export const web3List: {
|
||||
identifier: string;
|
||||
component: FC<Web3ProviderInterface>;
|
||||
}[] = [
|
||||
{
|
||||
identifier: 'wrapcast',
|
||||
component: WrapcasterProvider,
|
||||
},
|
||||
];
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
export interface Web3ProviderInterface {
|
||||
onComplete: (code: string, state: string) => void;
|
||||
nonce: string;
|
||||
}
|
||||
|
|
@ -41,11 +41,7 @@ export class IntegrationService {
|
|||
return this._integrationRepository.setTimes(orgId, integrationId, times);
|
||||
}
|
||||
|
||||
updateProviderSettings(
|
||||
org: string,
|
||||
id: string,
|
||||
additionalSettings: string
|
||||
) {
|
||||
updateProviderSettings(org: string, id: string, additionalSettings: string) {
|
||||
return this._integrationRepository.updateProviderSettings(
|
||||
org,
|
||||
id,
|
||||
|
|
@ -54,13 +50,15 @@ export class IntegrationService {
|
|||
}
|
||||
|
||||
async createOrUpdateIntegration(
|
||||
additionalSettings: {
|
||||
title: string;
|
||||
description: string;
|
||||
type: 'checkbox' | 'text' | 'textarea';
|
||||
value: any;
|
||||
regex?: string;
|
||||
}[] | undefined,
|
||||
additionalSettings:
|
||||
| {
|
||||
title: string;
|
||||
description: string;
|
||||
type: 'checkbox' | 'text' | 'textarea';
|
||||
value: any;
|
||||
regex?: string;
|
||||
}[]
|
||||
| undefined,
|
||||
oneTimeToken: boolean,
|
||||
org: string,
|
||||
name: string,
|
||||
|
|
@ -78,8 +76,11 @@ export class IntegrationService {
|
|||
customInstanceDetails?: string
|
||||
) {
|
||||
const uploadedPicture = picture
|
||||
? await this.storage.uploadSimple(picture)
|
||||
? picture?.indexOf('imagedelivery.net') > -1
|
||||
? picture
|
||||
: await this.storage.uploadSimple(picture)
|
||||
: undefined;
|
||||
|
||||
return this._integrationRepository.createOrUpdateIntegration(
|
||||
additionalSettings,
|
||||
oneTimeToken,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import { MastodonProvider } from '@gitroom/nestjs-libraries/integrations/social/
|
|||
import { BlueskyProvider } from '@gitroom/nestjs-libraries/integrations/social/bluesky.provider';
|
||||
import { LemmyProvider } from '@gitroom/nestjs-libraries/integrations/social/lemmy.provider';
|
||||
import { InstagramStandaloneProvider } from '@gitroom/nestjs-libraries/integrations/social/instagram.standalone.provider';
|
||||
// import { MastodonCustomProvider } from '@gitroom/nestjs-libraries/integrations/social/mastodon.custom.provider';
|
||||
import { FarcasterProvider } from '@gitroom/nestjs-libraries/integrations/social/farcaster.provider';
|
||||
|
||||
const socialIntegrationList: SocialProvider[] = [
|
||||
new XProvider(),
|
||||
|
|
@ -43,6 +43,7 @@ const socialIntegrationList: SocialProvider[] = [
|
|||
new MastodonProvider(),
|
||||
new BlueskyProvider(),
|
||||
new LemmyProvider(),
|
||||
new FarcasterProvider(),
|
||||
// new MastodonCustomProvider(),
|
||||
];
|
||||
|
||||
|
|
@ -62,6 +63,7 @@ export class IntegrationManager {
|
|||
identifier: p.identifier,
|
||||
toolTip: p.toolTip,
|
||||
isExternal: !!p.externalUrl,
|
||||
isWeb3: !!p.isWeb3,
|
||||
...(p.customFields ? { customFields: await p.customFields() } : {}),
|
||||
}))
|
||||
),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,135 @@
|
|||
import {
|
||||
AuthTokenDetails,
|
||||
PostDetails,
|
||||
PostResponse,
|
||||
SocialProvider,
|
||||
} from '@gitroom/nestjs-libraries/integrations/social/social.integrations.interface';
|
||||
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
|
||||
import dayjs from 'dayjs';
|
||||
import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
|
||||
import { NeynarAPIClient } from '@neynar/nodejs-sdk';
|
||||
import { Integration } from '@prisma/client';
|
||||
import { AuthService } from '@gitroom/helpers/auth/auth.service';
|
||||
import { groupBy } from 'lodash';
|
||||
|
||||
const client = new NeynarAPIClient({
|
||||
apiKey: process.env.NEYNAR_SECRET_KEY || '00000000-000-0000-000-000000000000',
|
||||
});
|
||||
|
||||
export class FarcasterProvider
|
||||
extends SocialAbstract
|
||||
implements SocialProvider
|
||||
{
|
||||
identifier = 'wrapcast';
|
||||
name = 'Wrapcast';
|
||||
isBetweenSteps = false;
|
||||
isWeb3 = true;
|
||||
scopes = [];
|
||||
|
||||
async refreshToken(refresh_token: string): Promise<AuthTokenDetails> {
|
||||
return {
|
||||
refreshToken: '',
|
||||
expiresIn: 0,
|
||||
accessToken: '',
|
||||
id: '',
|
||||
name: '',
|
||||
picture: '',
|
||||
username: '',
|
||||
};
|
||||
}
|
||||
|
||||
async generateAuthUrl() {
|
||||
const state = makeId(17);
|
||||
return {
|
||||
url: `${process.env.NEYNAR_CLIENT_ID}||${state}` || '',
|
||||
codeVerifier: makeId(10),
|
||||
state,
|
||||
};
|
||||
}
|
||||
|
||||
async authenticate(params: {
|
||||
code: string;
|
||||
codeVerifier: string;
|
||||
refresh?: string;
|
||||
}) {
|
||||
const data = JSON.parse(Buffer.from(params.code, 'base64').toString());
|
||||
return {
|
||||
id: String(data.fid),
|
||||
name: data.display_name,
|
||||
accessToken: data.signer_uuid,
|
||||
refreshToken: '',
|
||||
expiresIn: dayjs().add(200, 'year').unix() - dayjs().unix(),
|
||||
picture: data.pfp_url,
|
||||
username: data.username,
|
||||
};
|
||||
}
|
||||
|
||||
async post(
|
||||
id: string,
|
||||
accessToken: string,
|
||||
postDetails: PostDetails[]
|
||||
): Promise<PostResponse[]> {
|
||||
const ids = [];
|
||||
const subreddit =
|
||||
!postDetails?.[0]?.settings?.subreddit ||
|
||||
postDetails?.[0]?.settings?.subreddit.length === 0
|
||||
? [undefined]
|
||||
: postDetails?.[0]?.settings?.subreddit;
|
||||
|
||||
for (const channel of subreddit) {
|
||||
let idHash = '';
|
||||
for (const post of postDetails) {
|
||||
const data = await client.publishCast({
|
||||
embeds:
|
||||
post?.media?.map((media) => ({
|
||||
url: media.url,
|
||||
})) || [],
|
||||
signerUuid: accessToken,
|
||||
text: post.message,
|
||||
...(idHash ? { parent: idHash } : {}),
|
||||
...(channel?.value?.id ? { channelId: channel?.value?.id } : {}),
|
||||
});
|
||||
idHash = data.cast.hash;
|
||||
|
||||
ids.push({
|
||||
// @ts-ignore
|
||||
releaseURL: `https://warpcast.com/${data.cast.author.username}/${idHash}`,
|
||||
status: 'success',
|
||||
id: post.id,
|
||||
postId: data.cast.hash,
|
||||
// @ts-ignore
|
||||
author: data.cast.author.username,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const list = Object.values(groupBy(ids, (p) => p.id)).map((p) => ({
|
||||
id: p[0].id,
|
||||
postId: p.map((p) => String(p.postId)).join(','),
|
||||
releaseURL: p.map((p) => p.releaseURL).join(','),
|
||||
status: 'published',
|
||||
}));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
async subreddits(
|
||||
accessToken: string,
|
||||
data: any,
|
||||
id: string,
|
||||
integration: Integration
|
||||
) {
|
||||
const search = await client.searchChannels({
|
||||
q: data.word,
|
||||
limit: 10,
|
||||
});
|
||||
|
||||
return search.channels.map((p) => {
|
||||
return {
|
||||
title: p.name,
|
||||
name: p.name,
|
||||
id: p.id,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -110,6 +110,7 @@ export interface SocialProvider
|
|||
ISocialMediaIntegration {
|
||||
identifier: string;
|
||||
refreshWait?: boolean;
|
||||
isWeb3?: boolean;
|
||||
customFields?: () => Promise<
|
||||
{
|
||||
key: string;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class CloudflareStorage implements IUploadProvider {
|
|||
async uploadSimple(path: string) {
|
||||
const loadImage = await axios.get(path, { responseType: 'arraybuffer' });
|
||||
const contentType = loadImage?.headers?.['content-type'] || loadImage?.headers?.['Content-Type'];
|
||||
const extension = getExtension(contentType)!;
|
||||
const extension = getExtension(contentType || 'image/png')!;
|
||||
const id = makeId(10);
|
||||
|
||||
const params = {
|
||||
|
|
@ -39,6 +39,7 @@ class CloudflareStorage implements IUploadProvider {
|
|||
Key: `${id}.${extension}`,
|
||||
Body: loadImage.data,
|
||||
ContentType: contentType,
|
||||
ChecksumMode: 'DISABLED'
|
||||
};
|
||||
|
||||
const command = new PutObjectCommand({ ...params });
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -34,7 +34,7 @@
|
|||
"private": true,
|
||||
"dependencies": {
|
||||
"@atproto/api": "^0.13.11",
|
||||
"@aws-sdk/client-s3": "^3.410.0",
|
||||
"@aws-sdk/client-s3": "^3.731.1",
|
||||
"@aws-sdk/s3-request-presigner": "^3.410.0",
|
||||
"@casl/ability": "^6.5.0",
|
||||
"@copilotkit/react-core": "^1.4.7",
|
||||
|
|
@ -57,6 +57,8 @@
|
|||
"@nestjs/schedule": "^4.0.0",
|
||||
"@nestjs/swagger": "^7.3.0",
|
||||
"@nestjs/throttler": "^6.3.0",
|
||||
"@neynar/nodejs-sdk": "^2.8.1",
|
||||
"@neynar/react": "^0.9.7",
|
||||
"@nx/eslint": "19.7.2",
|
||||
"@nx/eslint-plugin": "19.7.2",
|
||||
"@nx/jest": "19.7.2",
|
||||
|
|
@ -167,6 +169,7 @@
|
|||
"use-debounce": "^10.0.0",
|
||||
"utf-8-validate": "^5.0.10",
|
||||
"uuid": "^10.0.0",
|
||||
"viem": "^2.22.9",
|
||||
"yargs": "^17.7.2",
|
||||
"yup": "^1.4.0",
|
||||
"zod": "^3.24.1"
|
||||
|
|
|
|||
Loading…
Reference in New Issue