From d33cee63bd4f7acb9510e7858644eec35502bf65 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Fri, 2 Jun 2023 21:45:11 -0700 Subject: [PATCH] refactor: :recycle: ssr views Correct og:type for users, format docs, deprecate _info_card_ --- packages/backend/src/server/web/index.ts | 18 ------- .../backend/src/server/web/views/channel.pug | 2 +- .../backend/src/server/web/views/clip.pug | 2 +- .../src/server/web/views/gallery-post.pug | 2 +- .../src/server/web/views/info-card.pug | 50 ------------------- .../backend/src/server/web/views/note.pug | 4 +- .../backend/src/server/web/views/page.pug | 2 +- .../backend/src/server/web/views/user.pug | 11 ++-- 8 files changed, 12 insertions(+), 79 deletions(-) delete mode 100644 packages/backend/src/server/web/views/info-card.pug diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index f1e0ed692..0d4034f55 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -590,24 +590,6 @@ router.get("/channels/:channel", async (ctx, next) => { }); //#endregion -router.get("/_info_card_", async (ctx) => { - const meta = await fetchMeta(true); - if (meta.privateMode) { - ctx.status = 403; - return; - } - - ctx.remove("X-Frame-Options"); - - await ctx.render("info-card", { - version: config.version, - host: config.host, - meta: meta, - originalUsersCount: await Users.countBy({ host: IsNull() }), - originalNotesCount: await Notes.countBy({ userHost: IsNull() }), - }); -}); - router.get("/bios", async (ctx) => { await ctx.render("bios", { version: config.version, diff --git a/packages/backend/src/server/web/views/channel.pug b/packages/backend/src/server/web/views/channel.pug index c4594b766..2427144fb 100644 --- a/packages/backend/src/server/web/views/channel.pug +++ b/packages/backend/src/server/web/views/channel.pug @@ -13,7 +13,7 @@ block desc block og unless privateMode - meta(property='og:type' content='article') + meta(property='og:type' content='article') meta(property='og:title' content= title) meta(property='og:description' content= channel.description) meta(property='og:url' content= url) diff --git a/packages/backend/src/server/web/views/clip.pug b/packages/backend/src/server/web/views/clip.pug index 4c29d64d1..79d629380 100644 --- a/packages/backend/src/server/web/views/clip.pug +++ b/packages/backend/src/server/web/views/clip.pug @@ -14,7 +14,7 @@ block desc block og unless privateMode - meta(property='og:type' content='article') + meta(property='og:type' content='article') meta(property='og:title' content= title) meta(property='og:description' content= clip.description) meta(property='og:url' content= url) diff --git a/packages/backend/src/server/web/views/gallery-post.pug b/packages/backend/src/server/web/views/gallery-post.pug index 86bbb4769..561a19b25 100644 --- a/packages/backend/src/server/web/views/gallery-post.pug +++ b/packages/backend/src/server/web/views/gallery-post.pug @@ -14,7 +14,7 @@ block desc block og unless privateMode - meta(property='og:type' content='article') + meta(property='og:type' content='article') meta(property='og:title' content= title) meta(property='og:description' content= post.description) meta(property='og:url' content= url) diff --git a/packages/backend/src/server/web/views/info-card.pug b/packages/backend/src/server/web/views/info-card.pug deleted file mode 100644 index be52d0c39..000000000 --- a/packages/backend/src/server/web/views/info-card.pug +++ /dev/null @@ -1,50 +0,0 @@ -doctype html - -html - - head - meta(charset='utf-8') - meta(name='application-name' content='Calckey') - title= meta.name || host - style. - html, body { - margin: 0; - padding: 0; - min-height: 100vh; - background: #fff; - } - - #a { - display: block; - } - - #banner { - background-size: cover; - background-position: center center; - } - - #title { - display: inline-block; - margin: 24px; - padding: 0.5em 0.8em; - color: #fff; - background: rgba(0, 0, 0, 0.5); - font-weight: bold; - font-size: 1.3em; - } - - #content { - overflow: auto; - color: #353c3e; - } - - #description { - margin: 24px; - } - - body - a#a(href=`https://${host}` target="_blank") - header#banner(style=`background-image: url(${meta.bannerUrl})`) - div#title= meta.name || host - div#content - div#description= meta.description diff --git a/packages/backend/src/server/web/views/note.pug b/packages/backend/src/server/web/views/note.pug index ff2a77165..dae0a82d5 100644 --- a/packages/backend/src/server/web/views/note.pug +++ b/packages/backend/src/server/web/views/note.pug @@ -18,7 +18,7 @@ block desc block og unless privateMode - meta(property='og:type' content='article') + meta(property='og:type' content='article') meta(property='og:title' content= title) meta(property='og:description' content= summary) meta(property='og:url' content= url) @@ -27,7 +27,7 @@ block og meta(property='og:image:width' content=note.files[0].properties.width) meta(property='og:image:height' content=note.files[0].properties.height) meta(property='og:image:type' content=note.files[0].type) - meta(property='twitter:card' content="summary_large_image") + meta(property='twitter:card' content="summary_large_image") if isVideo meta(property='og:video:type' content=note.files[0].type) meta(property='og:video' content=note.files[0].url) diff --git a/packages/backend/src/server/web/views/page.pug b/packages/backend/src/server/web/views/page.pug index eacaaab98..bfc7ebf79 100644 --- a/packages/backend/src/server/web/views/page.pug +++ b/packages/backend/src/server/web/views/page.pug @@ -14,7 +14,7 @@ block desc block og unless privateMode - meta(property='og:type' content='article') + meta(property='og:type' content='article') meta(property='og:title' content= title) meta(property='og:description' content= page.summary) meta(property='og:url' content= url) diff --git a/packages/backend/src/server/web/views/user.pug b/packages/backend/src/server/web/views/user.pug index 1cc429156..f5820f55f 100644 --- a/packages/backend/src/server/web/views/user.pug +++ b/packages/backend/src/server/web/views/user.pug @@ -13,11 +13,12 @@ block desc block og unless privateMode - meta(property='og:type' content='blog') - meta(property='og:title' content= title) - meta(property='og:description' content= profile.description) - meta(property='og:url' content= url) - meta(property='og:image' content= avatarUrl) + meta(property='og:type' content='profile') + meta(property='og:title' content= title) + meta(property='og:description' content= profile.description) + meta(property='og:url' content= url) + meta(property='og:image' content= avatarUrl) + meta(property='profile:username' content= user.username) block meta unless privateMode