From 03c2607f1fe5888c05a985ece466705f9fa8301b Mon Sep 17 00:00:00 2001 From: Artur Gunca Date: Fri, 26 Apr 2024 13:49:17 +0300 Subject: [PATCH] all links from API --- public/editor-client/src/config.ts | 5 +++++ public/editor-client/src/defaultTemplates/index.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/public/editor-client/src/config.ts b/public/editor-client/src/config.ts index b509d77e2..e0c9a9b8a 100644 --- a/public/editor-client/src/config.ts +++ b/public/editor-client/src/config.ts @@ -75,6 +75,7 @@ interface API { fileUrl: string; templates: DefaultTemplates; openAIUrl?: string; + templatesImageUrl: string; imagePatterns: ImagePatterns; } export interface Config { @@ -142,6 +143,10 @@ const apiReader = parseStrict({ throwOnNullish("Invalid API: templates") ), openAIUrl: optional(pipe(mPipe(Obj.readKey("openAIUrl"), Str.read))), + templatesImageUrl: pipe( + mPipe(Obj.readKey("templatesImageUrl"), Str.read), + throwOnNullish("Invalid API: Image templates") + ), imagePatterns: pipe( mPipe( Obj.readKey("media"), diff --git a/public/editor-client/src/defaultTemplates/index.ts b/public/editor-client/src/defaultTemplates/index.ts index da9650c0b..a257467d1 100644 --- a/public/editor-client/src/defaultTemplates/index.ts +++ b/public/editor-client/src/defaultTemplates/index.ts @@ -296,7 +296,7 @@ const defaultPages = ( config: Config ): PagesDefaultTemplate> => { const { templatesUrl } = config.api.templates; - const imageUrl = "https://cloud-1de12d.b-cdn.net/media/iW=1024&iH=1024/"; + const { templatesImageUrl } = config.api; return { async getMeta(res, rej) { @@ -304,7 +304,7 @@ const defaultPages = ( const { blocks, categories } = await getDefaultPages(templatesUrl); res({ - blocks: convertPages(blocks, imageUrl), + blocks: convertPages(blocks, templatesImageUrl), categories: convertToCategories(categories) }); } catch (e) {