feat: variables
This commit is contained in:
parent
91823079c4
commit
95c73b8702
|
|
@ -60,6 +60,7 @@ export class IntegrationsController {
|
|||
identifier: p.providerIdentifier,
|
||||
inBetweenSteps: p.inBetweenSteps,
|
||||
refreshNeeded: p.refreshNeeded,
|
||||
display: p.profile,
|
||||
type: p.type,
|
||||
time: JSON.parse(p.postingTimes),
|
||||
changeProfilePicture: !!findIntegration?.changeProfilePicture,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
|
|||
</head>
|
||||
<body className={clsx(chakra.className, 'text-primary dark')}>
|
||||
<VariableContextComponent
|
||||
storageProvider={process.env.NEXT_PUBLIC_STORAGE_PROVIDER! as 'local' | 'cloudflare'}
|
||||
backendUrl={process.env.NEXT_PUBLIC_BACKEND_URL!}
|
||||
plontoKey={process.env.NEXT_PUBLIC_POLOTNO!}
|
||||
billingEnabled={!!process.env.STRIPE_PUBLISHABLE_KEY}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ export interface Integrations {
|
|||
id: string;
|
||||
disabled?: boolean;
|
||||
inBetweenSteps: boolean;
|
||||
display: string;
|
||||
identifier: string;
|
||||
type: string;
|
||||
picture: string;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export const GeneralPreviewComponent: FC<{maximumCharacters?: number}> = (props)
|
|||
</svg>
|
||||
</div>
|
||||
<div className="text-[15px] font-[400] text-customColor27 ml-[4px]">
|
||||
@username
|
||||
{integration?.display || '@username'}
|
||||
</div>
|
||||
</div>
|
||||
<pre className={clsx('text-wrap', chakra.className)} dangerouslySetInnerHTML={{__html: value.text}} />
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { FileInput, ProgressBar } from '@uppy/react';
|
|||
// Uppy styles
|
||||
import '@uppy/core/dist/style.min.css';
|
||||
import '@uppy/dashboard/dist/style.min.css';
|
||||
import { useVariables } from '@gitroom/react/helpers/variable.context';
|
||||
|
||||
export function MultipartFileUploader({
|
||||
onUploadSuccess,
|
||||
|
|
@ -58,7 +59,7 @@ export function MultipartFileUploaderAfter({
|
|||
onUploadSuccess: (result: UploadResult) => void;
|
||||
allowedFileTypes: string;
|
||||
}) {
|
||||
const storageProvider = process.env.NEXT_PUBLIC_STORAGE_PROVIDER || "local";
|
||||
const {storageProvider, backendUrl} = useVariables();
|
||||
const fetch = useFetch();
|
||||
|
||||
const uppy = useMemo(() => {
|
||||
|
|
@ -71,7 +72,7 @@ export function MultipartFileUploaderAfter({
|
|||
},
|
||||
});
|
||||
|
||||
const { plugin, options } = getUppyUploadPlugin(storageProvider, fetch)
|
||||
const { plugin, options } = getUppyUploadPlugin(storageProvider, fetch, backendUrl)
|
||||
uppy2.use(plugin, options)
|
||||
// Set additional metadata when a file is added
|
||||
uppy2.on('file-added', (file) => {
|
||||
|
|
|
|||
|
|
@ -115,11 +115,11 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
|
|||
|
||||
const {
|
||||
data: {
|
||||
user: { avatar_url, display_name, open_id },
|
||||
user: { avatar_url, display_name, open_id, username },
|
||||
},
|
||||
} = await (
|
||||
await fetch(
|
||||
'https://open.tiktokapis.com/v2/user/info/?fields=open_id,avatar_url,display_name',
|
||||
'https://open.tiktokapis.com/v2/user/info/?fields=open_id,avatar_url,display_name,union_id',
|
||||
{
|
||||
method: 'GET',
|
||||
headers: {
|
||||
|
|
@ -129,6 +129,8 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
|
|||
)
|
||||
).json();
|
||||
|
||||
console.log(username);
|
||||
|
||||
return {
|
||||
id: open_id.replace(/-/g, ''),
|
||||
name: display_name,
|
||||
|
|
@ -136,7 +138,7 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
|
|||
refreshToken: refresh_token,
|
||||
expiresIn: dayjs().add(23, 'hours').unix() - dayjs().unix(),
|
||||
picture: avatar_url,
|
||||
username: display_name.toLowerCase(),
|
||||
username: display_name,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ const fetchUploadApiEndpoint = async (
|
|||
};
|
||||
|
||||
// Define the factory to return appropriate Uppy configuration
|
||||
export const getUppyUploadPlugin = (provider: string, fetch: any) => {
|
||||
export const getUppyUploadPlugin = (provider: string, fetch: any, backendUrl: string) => {
|
||||
switch (provider) {
|
||||
case 'cloudflare':
|
||||
return {
|
||||
|
|
@ -56,7 +56,7 @@ export const getUppyUploadPlugin = (provider: string, fetch: any) => {
|
|||
return {
|
||||
plugin: XHRUpload,
|
||||
options: {
|
||||
endpoint: `${process.env.NEXT_PUBLIC_BACKEND_URL}/media/upload-server`,
|
||||
endpoint: `${backendUrl}/media/upload-server`,
|
||||
withCredentials: true,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ interface VariableContextInterface {
|
|||
isGeneral: boolean;
|
||||
frontEndUrl: string;
|
||||
plontoKey: string;
|
||||
storageProvider: 'local' | 'cloudflare',
|
||||
backendUrl: string;
|
||||
discordUrl: string;
|
||||
uploadDirectory: string;
|
||||
|
|
@ -15,6 +16,7 @@ const VariableContext = createContext({
|
|||
billingEnabled: false,
|
||||
isGeneral: true,
|
||||
frontEndUrl: '',
|
||||
storageProvider: 'local',
|
||||
plontoKey: '',
|
||||
backendUrl: '',
|
||||
discordUrl: '',
|
||||
|
|
|
|||
Loading…
Reference in New Issue