Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix: X premium to upload longer videos

Nevo David646caf5213c4
diff --git a/apps/frontend/src/components/launches/add.edit.model.tsx b/apps/frontend/src/components/launches/add.edit.model.tsx
index efe8ff1ae..32176cd02 100644
--- a/apps/frontend/src/components/launches/add.edit.model.tsx
+++ b/apps/frontend/src/components/launches/add.edit.model.tsx
@@ -413,7 +413,8 @@ export const AddEditModal: FC<{
if (key.checkValidity) {
const check = await key.checkValidity(
key?.value.map((p: any) => p.image || []),
- key.settings
+ key.settings,
+ JSON.parse(key?.integration?.additionalSettings || '[]')
);
if (typeof check === 'string') {
toaster.show(check, 'warning');
diff --git a/apps/frontend/src/components/launches/helpers/use.values.ts b/apps/frontend/src/components/launches/helpers/use.values.ts
index ec8ebf025..8f9d15e50 100644
--- a/apps/frontend/src/components/launches/helpers/use.values.ts
+++ b/apps/frontend/src/components/launches/helpers/use.values.ts
@@ -24,7 +24,8 @@ const finalInformation = {} as {
path: string;
}>
>,
- settings: any
+ settings: any,
+ additionalSettings: any,
) => Promise<string | true>;
maximumCharacters?: number;
};
@@ -45,7 +46,8 @@ export const useValues = (
path: string;
}>
>,
- settings: any
+ settings: any,
+ additionalSettings: any,
) => Promise<string | true>,
maximumCharacters?: number
) => {
diff --git a/apps/frontend/src/components/launches/providers/high.order.provider.tsx b/apps/frontend/src/components/launches/providers/high.order.provider.tsx
index 532ca44a6..83647bc20 100644
--- a/apps/frontend/src/components/launches/providers/high.order.provider.tsx
+++ b/apps/frontend/src/components/launches/providers/high.order.provider.tsx
@@ -96,7 +96,8 @@ export const withProvider = function <T extends object>(
path: string;
}>
>,
- settings: T
+ settings: T,
+ additionalSettings: any,
) => Promise<string | true>,
maximumCharacters?: number | ((settings: any) => number)
) {
diff --git a/apps/frontend/src/components/launches/providers/x/x.provider.tsx b/apps/frontend/src/components/launches/providers/x/x.provider.tsx
index 28515733d..9573fc3a8 100644
--- a/apps/frontend/src/components/launches/providers/x/x.provider.tsx
+++ b/apps/frontend/src/components/launches/providers/x/x.provider.tsx
@@ -61,7 +61,8 @@ export default withProvider(
SettingsComponent,
undefined,
XDto,
- async (posts) => {
+ async (posts, settings, additionalSettings: any) => {
+ const premium = additionalSettings?.find((p: any) => p?.title === 'Verified')?.value || false;
if (posts.some((p) => p.length > 4)) {
return 'There can be maximum 4 pictures in a post.';
}
@@ -74,7 +75,7 @@ export default withProvider(
}
for (const load of posts.flatMap((p) => p.flatMap((a) => a.path))) {
if (load.indexOf('mp4') > -1) {
- const isValid = await checkVideoDuration(load);
+ const isValid = await checkVideoDuration(load, premium);
if (!isValid) {
return 'Video duration must be less than or equal to 140 seconds.';
}
@@ -89,7 +90,7 @@ export default withProvider(
return 280;
}
);
-const checkVideoDuration = async (url: string): Promise<boolean> => {
+const checkVideoDuration = async (url: string, isPremium = false): Promise<boolean> => {
return new Promise((resolve, reject) => {
const video = document.createElement('video');
video.src = url;
@@ -97,7 +98,7 @@ const checkVideoDuration = async (url: string): Promise<boolean> => {
video.onloadedmetadata = () => {
// Check if the duration is less than or equal to 140 seconds
const duration = video.duration;
- if (duration <= 140) {
+ if ((!isPremium && duration <= 140) || isPremium) {
resolve(true); // Video duration is acceptable
} else {
resolve(false); // Video duration exceeds 140 seconds