π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: youtube fixes
Nevo David2a71abb277f6
diff --git a/apps/frontend/src/app/global.scss b/apps/frontend/src/app/global.scssindex 3355f2e39..1b7000c5a 100644--- a/apps/frontend/src/app/global.scss+++ b/apps/frontend/src/app/global.scss@@ -497,6 +497,29 @@ div div .set-font-family {padding-right: 5px;}+/* MediumTags (YouTube / Medium providers) β let the field grow and wrap+ instead of overflowing the fixed-height row once there are many tags. */+.medium-tags .react-tags {+ height: auto;+ min-height: 42px;+ flex-wrap: wrap;+ align-items: flex-start;+ padding-top: 6px;+ padding-bottom: 6px;+ padding-right: 16px;+}++.medium-tags .react-tags__list {+ display: flex;+ flex-wrap: wrap;+ align-items: center;+ gap: 6px;+}++.medium-tags .react-tags__tag {+ margin: 0;+}+.hideCopilot .copilotKitPopup {display: none !important;}diff --git a/apps/frontend/src/components/new-launch/providers/medium/medium.tags.tsx b/apps/frontend/src/components/new-launch/providers/medium/medium.tags.tsxindex 06b2adf47..216ccfb5a 100644--- a/apps/frontend/src/components/new-launch/providers/medium/medium.tags.tsx+++ b/apps/frontend/src/components/new-launch/providers/medium/medium.tags.tsx@@ -66,7 +66,7 @@ export const MediumTags: FC<{].filter((f) => f.label);}, [suggestions, tagValue]);return (- <div>+ <div className="medium-tags"><div className={`text-[14px] mb-[6px]`}>{label}</div><ReactTagsplaceholderText={t('add_a_tag', 'Add a tag')}diff --git a/libraries/nestjs-libraries/src/dtos/posts/providers-settings/youtube.settings.dto.ts b/libraries/nestjs-libraries/src/dtos/posts/providers-settings/youtube.settings.dto.tsindex f1c171718..60f1bfa14 100644--- a/libraries/nestjs-libraries/src/dtos/posts/providers-settings/youtube.settings.dto.ts+++ b/libraries/nestjs-libraries/src/dtos/posts/providers-settings/youtube.settings.dto.ts@@ -1,9 +1,60 @@import {- IsArray, IsDefined, IsIn, IsOptional, IsString, MaxLength, MinLength, ValidateNested+ IsArray,+ IsDefined,+ IsIn,+ IsOptional,+ IsString,+ MaxLength,+ MinLength,+ registerDecorator,+ ValidateNested,+ ValidationArguments,+ ValidationOptions,+ ValidatorConstraint,+ ValidatorConstraintInterface,} from 'class-validator';import { MediaDto } from '@gitroom/nestjs-libraries/dtos/media/media.dto';import { Type } from 'class-transformer';+// YouTube caps the combined length of all tags at 500 characters.+// Tags containing whitespace are wrapped in quotes by YouTube, which adds+// two extra characters per tag toward that limit.+export const YOUTUBE_TAGS_MAX_LENGTH = 500;++export function getYoutubeTagsLength(tags: YoutubeTagsSettings[]): number {+ return (tags ?? []).reduce((total, tag) => {+ const label = tag?.label ?? '';+ return total + label.length + (/\s/.test(label) ? 2 : 0);+ }, 0);+}++@ValidatorConstraint({ name: 'IsYoutubeTagsLength', async: false })+export class IsYoutubeTagsLengthConstraint+ implements ValidatorConstraintInterface+{+ validate(value: unknown, _args: ValidationArguments): boolean {+ if (!Array.isArray(value)) {+ return true;+ }+ return getYoutubeTagsLength(value) <= YOUTUBE_TAGS_MAX_LENGTH;+ }++ defaultMessage(_args: ValidationArguments): string {+ return `The maximum allowed is ${YOUTUBE_TAGS_MAX_LENGTH} characters in total for all tags.`;+ }+}++export function IsYoutubeTagsLength(validationOptions?: ValidationOptions) {+ return function (object: object, propertyName: string) {+ registerDecorator({+ target: object.constructor,+ propertyName,+ options: validationOptions,+ validator: IsYoutubeTagsLengthConstraint,+ });+ };+}+export class YoutubeTagsSettings {@IsString()value: string;@@ -34,7 +85,8 @@ export class YoutubeSettingsDto {@IsArray()@IsOptional()- @ValidateNested()+ @ValidateNested({ each: true })+ @IsYoutubeTagsLength()@Type(() => YoutubeTagsSettings)tags: YoutubeTagsSettings[];}diff --git a/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts b/libraries/nestjs-libraries/src/integrations/social/youtube.provider.tsindex 7674a23e7..d73fb2283 100644--- a/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts+++ b/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts@@ -91,6 +91,14 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider {value: string;}| undefined {+ if (body.includes('invalidTags')) {+ return {+ type: 'bad-body',+ value:+ 'The maximum allowed is 500 characters in total.',+ };+ }+if (body.includes('invalidTitle')) {return {type: 'bad-body',@@ -99,6 +107,105 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider {};}+ if (body.includes('invalidDescription')) {+ return {+ type: 'bad-body',+ value:+ 'Your video description is invalid, it may contain disallowed characters such as < or >.',+ };+ }++ if (body.includes('invalidCategoryId')) {+ return {+ type: 'bad-body',+ value: 'The selected video category is invalid.',+ };+ }++ if (body.includes('invalidPublishAt')) {+ return {+ type: 'bad-body',+ value: 'The scheduled publishing time is invalid.',+ };+ }++ if (body.includes('invalidRecordingDetails')) {+ return {+ type: 'bad-body',+ value: 'The recording details for the video are invalid.',+ };+ }++ if (body.includes('invalidVideoGameRating')) {+ return {+ type: 'bad-body',+ value: 'The video game rating is invalid.',+ };+ }++ if (body.includes('invalidFilename')) {+ return {+ type: 'bad-body',+ value: 'The video file name is invalid.',+ };+ }++ if (body.includes('defaultLanguageNotSet')) {+ return {+ type: 'bad-body',+ value:+ 'We could not set the localized video details because no default language is set.',+ };+ }++ if (body.includes('invalidVideoMetadata')) {+ return {+ type: 'bad-body',+ value:+ 'Some of the video details are invalid, please review the title, description and tags.',+ };+ }++ if (body.includes('mediaBodyRequired')) {+ return {+ type: 'bad-body',+ value:+ 'The video file is missing or could not be read, please re-upload the video.',+ };+ }++ if (body.includes('imageFormatUnsupported')) {+ return {+ type: 'bad-body',+ value:+ 'We have uploaded your video but the thumbnail format is not supported, please use JPEG or PNG.',+ };+ }++ if (body.includes('imageTooTall')) {+ return {+ type: 'bad-body',+ value:+ 'We have uploaded your video but the thumbnail image is too tall.',+ };+ }++ if (body.includes('imageTooWide')) {+ return {+ type: 'bad-body',+ value:+ 'We have uploaded your video but the thumbnail image is too wide.',+ };+ }++ if (body.includes('rateLimitExceeded')) {+ return {+ type: 'bad-body',+ value:+ 'You are sending requests too quickly, please wait a little while and try again.',+ };+ }+if (body.includes('failedPrecondition')) {return {type: 'bad-body',