From 7ed822200c5e15bbe30377c15d0b34baea1974ea Mon Sep 17 00:00:00 2001 From: terwer Date: Mon, 11 Mar 2024 16:30:35 +0800 Subject: [PATCH] feat: default to use proxy preview at telegra.ph --- src/adaptors/api/telegraph/telegraphApiAdaptor.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/adaptors/api/telegraph/telegraphApiAdaptor.ts b/src/adaptors/api/telegraph/telegraphApiAdaptor.ts index 4ed2ce3e..42ce02e0 100644 --- a/src/adaptors/api/telegraph/telegraphApiAdaptor.ts +++ b/src/adaptors/api/telegraph/telegraphApiAdaptor.ts @@ -132,6 +132,11 @@ class TelegraphApiAdaptor extends BaseBlogApi { const postMeta = JsonUtil.safeParse(postid, {}) const purl = this.cfg.previewUrl ?? "" const postUrl = purl.replace("[postid]", postMeta?.path ?? "") + const useProxyPreview = true + if (useProxyPreview && !StrUtil.isEmptyString(this.cfg.corsAnywhereUrl)) { + const proxyHome = StrUtil.pathJoin(this.cfg.corsAnywhereUrl, this.cfg.home ?? "") + return StrUtil.pathJoin(`${proxyHome}`, postUrl) + } return postUrl }