erudit 3.0.0-dev.22 → 3.0.0-dev.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/app.vue +25 -185
- package/app/assets/icons/array-check.svg +3 -0
- package/app/assets/icons/array-lines.svg +3 -0
- package/app/assets/icons/array-star.svg +3 -0
- package/app/assets/icons/arrow/from-circle.svg +3 -0
- package/app/assets/icons/arrow/left.svg +3 -0
- package/app/assets/icons/arrow/outward-box.svg +3 -0
- package/app/assets/icons/arrow/outward.svg +3 -0
- package/app/assets/icons/arrow/to-circle.svg +3 -0
- package/app/assets/icons/arrow/up-to-right.svg +3 -0
- package/app/assets/icons/aside-open.svg +2 -2
- package/app/assets/icons/asterisk.svg +2 -2
- package/app/assets/icons/bell.svg +3 -0
- package/app/assets/icons/book-outline.svg +3 -0
- package/app/assets/icons/book-question.svg +2 -2
- package/app/assets/icons/book.svg +2 -2
- package/app/assets/icons/box.svg +3 -0
- package/app/assets/icons/bug.svg +2 -2
- package/app/assets/icons/chevron-right.svg +3 -0
- package/app/assets/icons/cog.svg +3 -0
- package/app/assets/icons/construction.svg +2 -2
- package/app/assets/icons/diamond.svg +2 -2
- package/app/assets/icons/draw.svg +2 -2
- package/app/assets/icons/erudit.svg +3 -0
- package/app/assets/icons/file-lines.svg +2 -2
- package/app/assets/icons/files.svg +3 -0
- package/app/assets/icons/flame.svg +3 -0
- package/app/assets/icons/folder-open.svg +2 -2
- package/app/assets/icons/folder.svg +2 -2
- package/app/assets/icons/globe.svg +2 -2
- package/app/assets/icons/graduation.svg +2 -2
- package/app/assets/icons/handshake.svg +3 -0
- package/app/assets/icons/house.svg +2 -2
- package/app/assets/icons/lines.svg +3 -0
- package/app/assets/icons/moon.svg +2 -2
- package/app/assets/icons/plus-circle.svg +2 -2
- package/app/assets/icons/plus.svg +2 -2
- package/app/assets/icons/puzzle.svg +2 -2
- package/app/assets/icons/question-circle.svg +3 -0
- package/app/assets/icons/rocket.svg +3 -0
- package/app/assets/icons/search/check.svg +3 -0
- package/app/assets/icons/search/dead.svg +3 -0
- package/app/assets/icons/search/glass.svg +3 -0
- package/app/assets/icons/search/wtf.svg +3 -0
- package/app/assets/icons/sun-moon.svg +2 -2
- package/app/assets/icons/sun.svg +2 -2
- package/app/assets/icons/translate.svg +3 -0
- package/app/assets/icons/user.svg +2 -2
- package/app/assets/icons/users.svg +2 -2
- package/app/assets/icons/warning.svg +3 -0
- package/app/components/EruditLink.ts +9 -0
- package/app/components/FancyBold.vue +17 -0
- package/app/components/FancyCard.vue +58 -0
- package/app/components/FancyCardTag.vue +16 -0
- package/app/components/Prose.vue +51 -0
- package/app/components/ScrollHolder.vue +20 -0
- package/app/components/SmartMedia.vue +112 -0
- package/app/components/ads/Ads.vue +39 -33
- package/app/components/ads/AdsBannerAside.vue +46 -61
- package/app/components/ads/AdsBannerBottom.vue +17 -22
- package/app/components/ads/AdsReplacer.vue +28 -73
- package/app/components/ads/provider/Custom.vue +19 -0
- package/app/components/ads/{AdsProviderYandex.vue → provider/Yandex.vue} +84 -91
- package/app/components/aside/AsideListItem.vue +66 -91
- package/app/components/aside/AsideMajor.vue +8 -56
- package/app/components/aside/AsideMinor.vue +76 -97
- package/app/components/aside/AsideSwitch.vue +67 -0
- package/app/components/aside/major/PaneHolder.vue +106 -0
- package/app/components/aside/major/PaneSwitcher.vue +73 -0
- package/app/components/aside/major/PaneSwitcherButton.vue +38 -0
- package/app/components/aside/major/PaneTemplate.vue +5 -0
- package/app/components/aside/major/SiteInfo.vue +68 -85
- package/app/components/aside/major/contentNav/PaneBookNav.vue +116 -0
- package/app/components/aside/major/contentNav/PaneGlobalNav.vue +24 -0
- package/app/components/aside/major/contentNav/items/ContentNavBook.vue +21 -0
- package/app/components/aside/major/contentNav/items/ContentNavFolder.vue +92 -0
- package/app/components/aside/major/contentNav/items/ContentNavItem.vue +33 -0
- package/app/components/aside/major/contentNav/items/ContentNavPage.vue +18 -0
- package/app/components/aside/major/contentNav/items/ContentNavSeparator.vue +62 -0
- package/app/components/aside/major/contentNav/items/ContentNavTopic.vue +18 -0
- package/app/components/aside/major/contentNav/items/Flags.vue +52 -0
- package/app/components/aside/major/contentNav/items/ItemTemplate.vue +27 -0
- package/app/components/aside/major/languages/PaneLanguages.vue +55 -0
- package/app/components/aside/major/pages/PanePages.vue +60 -0
- package/app/components/aside/major/search/PaneSearch.vue +145 -0
- package/app/components/aside/major/search/SearchInput.vue +104 -0
- package/app/components/aside/major/search/SearchResult.vue +103 -0
- package/app/components/aside/major/search/SearchStatus.vue +48 -0
- package/app/components/aside/major/search/search.worker.ts +164 -0
- package/app/components/aside/major/settings/BuildTime.vue +25 -0
- package/app/components/aside/major/settings/EngineVersion.vue +13 -0
- package/app/components/aside/major/settings/PaneSettings.vue +17 -0
- package/app/components/aside/major/settings/ThemeSwitcher.vue +53 -0
- package/app/components/aside/major/settings/repository/Repository.vue +33 -0
- package/app/components/aside/major/settings/repository/SecondaryGitHub.vue +71 -0
- package/app/components/aside/minor/AsideMinorPane.vue +1 -11
- package/app/components/aside/minor/AsideMinorPlainHeader.vue +21 -0
- package/app/components/aside/minor/content/AsideMinorContentContributions.vue +53 -0
- package/app/components/aside/minor/content/AsideMinorContentPage.vue +37 -0
- package/app/components/aside/minor/content/AsideMinorContentTopic.vue +66 -0
- package/app/components/aside/minor/content/ButtonPaneContributions.vue +116 -0
- package/app/components/aside/minor/content/ButtonPaneImprove.vue +121 -0
- package/app/components/aside/minor/content/Contribution.vue +34 -0
- package/app/components/aside/minor/content/Toc.vue +165 -0
- package/app/components/aside/minor/content/TocItem.vue +77 -0
- package/app/components/aside/minor/content/TopicPartButton.vue +35 -0
- package/app/components/aside/minor/contributor/AsideMinorContributor.vue +31 -68
- package/app/components/aside/minor/contributor/ItemBook.vue +39 -0
- package/app/components/aside/minor/contributor/ItemContent.vue +17 -0
- package/app/components/aside/minor/news/AsideMinorNews.vue +135 -0
- package/app/components/aside/minor/news/NewsItem.vue +69 -0
- package/app/components/aside/minor/news/RenderNewsElement.vue +42 -0
- package/app/components/aside/minor/news/elements/Mix.vue +11 -0
- package/app/components/aside/minor/news/elements/P.vue +14 -0
- package/app/components/aside/minor/news/elements/Ref.vue +58 -0
- package/app/components/aside/minor/news/elements/Text.vue +18 -0
- package/app/components/indexPage/IndexPagePersons.vue +117 -0
- package/app/components/main/MainAction.vue +20 -0
- package/app/components/main/MainBreadcrumbs.vue +28 -0
- package/app/components/main/MainContentChild.vue +48 -0
- package/app/components/main/MainContentChildren.vue +14 -0
- package/app/components/main/MainDecoration.vue +15 -0
- package/app/components/main/MainDescription.vue +6 -17
- package/app/components/main/MainFlag.vue +133 -0
- package/app/components/main/MainFlags.vue +17 -0
- package/app/components/main/MainGlow.vue +12 -0
- package/app/components/main/MainQuickLink.vue +76 -0
- package/app/components/main/MainQuickLinks.vue +42 -0
- package/app/components/main/MainQuote.vue +160 -0
- package/app/components/main/MainQuoteLoader.vue +86 -0
- package/app/components/main/MainSection.vue +39 -42
- package/app/components/main/MainSectionPreamble.vue +5 -0
- package/app/components/main/MainSubTitle.vue +12 -0
- package/app/components/main/MainTitle.vue +26 -69
- package/app/components/main/MainTopicPartPage.vue +88 -0
- package/app/components/main/MainTopicPartSwitch.vue +71 -0
- package/app/components/main/connections/Deps.vue +34 -0
- package/app/components/main/connections/Externals.vue +46 -0
- package/app/components/main/connections/MainConnections.vue +41 -0
- package/app/components/main/connections/MainConnectionsButton.vue +80 -0
- package/app/components/main/connections/ScrollPane.vue +11 -0
- package/app/components/main/contentStats/Item.vue +35 -0
- package/app/components/main/contentStats/ItemElement.vue +19 -0
- package/app/components/main/contentStats/ItemMaterials.vue +11 -0
- package/app/components/main/contentStats/MainContentStats.vue +50 -0
- package/app/components/preview/Preview.vue +173 -186
- package/app/components/preview/PreviewError.vue +10 -0
- package/app/components/preview/PreviewLoading.vue +5 -14
- package/app/components/preview/PreviewScreen.vue +65 -141
- package/app/components/preview/PreviewScreenButton.vue +39 -0
- package/app/components/preview/screen/ContentPage.vue +50 -0
- package/app/components/preview/screen/DirectLink.vue +23 -0
- package/app/components/preview/screen/Unique.vue +54 -0
- package/app/components/site/SiteAside.vue +70 -0
- package/app/components/site/SiteAsideOverlay.vue +21 -0
- package/app/components/site/SiteMain.vue +16 -0
- package/app/components/transition/Fade.vue +30 -19
- package/app/components/transition/Slide.vue +47 -0
- package/app/components/tree/TreeContainer.vue +5 -11
- package/app/components/tree/TreeItem.vue +40 -93
- package/app/composables/ads.ts +17 -0
- package/app/composables/analytics.ts +102 -0
- package/app/composables/appElements.ts +40 -0
- package/app/composables/aside.ts +28 -0
- package/app/composables/asideMajorPane.ts +135 -0
- package/app/composables/asideMinor.ts +109 -0
- package/app/composables/contentNav.ts +7 -0
- package/app/composables/favicon.ts +104 -4
- package/app/composables/file.ts +3 -0
- package/app/composables/formatText.ts +78 -81
- package/app/composables/loading.ts +2 -0
- package/app/composables/mainContent.ts +31 -0
- package/app/composables/og.ts +169 -0
- package/app/composables/phrases.ts +126 -77
- package/app/composables/preview.ts +53 -0
- package/app/composables/route.ts +4 -0
- package/app/composables/theme.ts +71 -29
- package/app/composables/url.ts +22 -43
- package/app/formatters/ru.ts +14 -0
- package/app/pages/article/[...articleId].vue +10 -1
- package/app/pages/book/[...bookId].vue +52 -38
- package/app/pages/contributor/[contributorId].vue +127 -203
- package/app/pages/contributors.vue +80 -164
- package/app/pages/group/[...groupId].vue +53 -48
- package/app/pages/index.vue +114 -26
- package/app/pages/page/[...pageId].vue +60 -0
- package/app/pages/practice/[...practiceId].vue +12 -0
- package/app/pages/sponsors.vue +66 -76
- package/app/pages/summary/[...summaryId].vue +10 -1
- package/app/plugins/appSetup/client/htmlBranding.ts +6 -0
- package/app/plugins/appSetup/client/welcome.ts +35 -0
- package/app/plugins/appSetup/config.ts +6 -0
- package/app/plugins/appSetup/global.ts +3 -0
- package/app/plugins/appSetup/index.ts +28 -0
- package/app/plugins/prerender.server.ts +16 -11
- package/app/router.options.ts +5 -0
- package/app/scripts/theme.js +33 -0
- package/app/styles/main.css +173 -0
- package/bin/erudit.mjs +2 -2
- package/modules/erudit/globals/content.ts +4 -0
- package/modules/erudit/globals/contributor.ts +1 -0
- package/modules/erudit/globals/eruditConfig.ts +10 -0
- package/modules/erudit/globals/problem.ts +1 -0
- package/modules/erudit/globals/prose.ts +1 -0
- package/modules/erudit/globals/public.ts +18 -0
- package/modules/erudit/index.ts +60 -0
- package/{module → modules/erudit}/logger.ts +2 -2
- package/modules/erudit/setup/aliases.ts +17 -0
- package/modules/erudit/setup/baseUrl.ts +19 -0
- package/modules/erudit/setup/elements/appTemplate.ts +45 -0
- package/modules/erudit/setup/elements/globalTemplate.ts +82 -0
- package/modules/erudit/setup/elements/globalTypes.ts +273 -0
- package/modules/erudit/setup/elements/setup.ts +167 -0
- package/modules/erudit/setup/elements/shared.ts +10 -0
- package/modules/erudit/setup/elements/tagsTable.ts +28 -0
- package/modules/erudit/setup/fullRestart.ts +71 -0
- package/modules/erudit/setup/globals.ts +196 -0
- package/modules/erudit/setup/nuxtConfig.ts +48 -0
- package/modules/erudit/setup/projectConfig.ts +114 -0
- package/modules/erudit/setup/publicAssets.ts +52 -0
- package/modules/erudit/setup/runtimeConfig.ts +58 -0
- package/modules/erudit/watcher.ts +27 -0
- package/nuxt.config.ts +66 -102
- package/package.json +36 -18
- package/proxy/prose.app.ts +1 -0
- package/proxy/prose.ts +1 -0
- package/public/favicons/default.svg +1 -0
- package/{app/public → public}/logotype.svg +1 -1
- package/public/og.png +0 -0
- package/server/api/aside/major/frontNav/book/[...shortId].ts +10 -0
- package/server/api/aside/major/frontNav/global.ts +5 -0
- package/server/api/aside/major/pages.ts +6 -0
- package/server/api/contributor/list.ts +36 -35
- package/server/api/contributor/page/[contributorId].ts +58 -4
- package/server/api/indexPage.ts +81 -0
- package/server/api/language/functions.ts +6 -7
- package/server/api/language/phrase/[phraseKey].ts +32 -0
- package/server/api/main/content/[...contentTypePath].ts +153 -0
- package/server/api/news/batch/[batchIndex].ts +5 -0
- package/server/api/pageSponsors.ts +56 -0
- package/server/api/prerender/content.ts +82 -0
- package/server/api/prerender/files.ts +10 -0
- package/server/api/prerender/frontNav.ts +13 -0
- package/server/api/prerender/language.ts +3 -5
- package/server/api/prerender/news.ts +8 -0
- package/server/api/prerender/quotes.ts +15 -0
- package/server/api/preview/contentPage/[...contentTypePath].ts +63 -0
- package/server/api/preview/contentUnique/[...contentTypePathUnique].ts +81 -0
- package/server/api/problemScript/[...problemScriptPath].ts +92 -0
- package/server/api/quote/data/[quoteId].ts +87 -0
- package/server/api/quote/ids.ts +3 -0
- package/server/erudit/build.ts +135 -0
- package/server/erudit/cameos/build.ts +111 -0
- package/server/erudit/config.ts +11 -0
- package/server/erudit/content/global/build.ts +271 -0
- package/server/erudit/content/global/singleton.ts +5 -0
- package/server/erudit/content/nav/build.ts +431 -0
- package/server/erudit/content/nav/front.ts +130 -0
- package/server/erudit/content/nav/repository/books.ts +40 -0
- package/server/erudit/content/nav/repository/get.ts +33 -0
- package/server/erudit/content/nav/repository/hasChildren.ts +5 -0
- package/server/erudit/content/nav/repository/hasNav.ts +3 -0
- package/server/erudit/content/nav/repository/hasParent.ts +5 -0
- package/server/erudit/content/nav/repository/id.ts +9 -0
- package/server/erudit/content/nav/repository/index.ts +9 -0
- package/server/erudit/content/nav/repository/order.ts +14 -0
- package/server/erudit/content/nav/repository/previousNext.ts +35 -0
- package/server/erudit/content/nav/repository/walk.ts +127 -0
- package/server/erudit/content/nav/setup.ts +13 -0
- package/server/erudit/content/nav/types.ts +24 -0
- package/server/erudit/content/repository/breadcrumbs.ts +24 -0
- package/server/erudit/content/repository/children.ts +47 -0
- package/server/erudit/content/repository/connections.ts +35 -0
- package/server/erudit/content/repository/contentLink.ts +16 -0
- package/server/erudit/content/repository/decoration.ts +23 -0
- package/server/erudit/content/repository/deps.ts +84 -0
- package/server/erudit/content/repository/description.ts +11 -0
- package/server/erudit/content/repository/elementSnippets.ts +64 -0
- package/server/erudit/content/repository/externals.ts +25 -0
- package/server/erudit/content/repository/flags.ts +33 -0
- package/server/erudit/content/repository/seo.ts +12 -0
- package/server/erudit/content/repository/stats.ts +97 -0
- package/server/erudit/content/repository/title.ts +27 -0
- package/server/erudit/content/repository/topicParts.ts +39 -0
- package/server/erudit/content/repository/unique.ts +76 -0
- package/server/erudit/content/resolve/book.ts +32 -0
- package/server/erudit/content/resolve/group.ts +39 -0
- package/server/erudit/content/resolve/index.ts +139 -0
- package/server/erudit/content/resolve/page.ts +87 -0
- package/server/erudit/content/resolve/topic.ts +113 -0
- package/server/erudit/content/resolve/utils/contentError.ts +10 -0
- package/server/erudit/content/resolve/utils/insertContentItem.ts +122 -0
- package/server/erudit/content/resolve/utils/insertContentResolved.ts +93 -0
- package/server/erudit/content/search.ts +135 -0
- package/server/erudit/contributors/build.ts +111 -0
- package/server/erudit/contributors/global.ts +3 -0
- package/server/erudit/contributors/repository/avatarUrl.ts +10 -0
- package/server/erudit/contributors/repository/contributions.ts +178 -0
- package/server/erudit/contributors/repository/count.ts +3 -0
- package/server/erudit/contributors/search.ts +34 -0
- package/server/erudit/db/repository/pushFile.ts +23 -0
- package/server/erudit/db/repository/pushProblemScript.ts +19 -0
- package/server/erudit/db/repository/pushProseLink.ts +40 -0
- package/server/erudit/db/schema/cameos.ts +7 -0
- package/server/erudit/db/schema/content.ts +18 -0
- package/server/erudit/db/schema/contentContributions.ts +15 -0
- package/server/erudit/db/schema/contentDeps.ts +21 -0
- package/server/erudit/db/schema/contentElementStats.ts +20 -0
- package/server/erudit/db/schema/contentProseLinks.ts +23 -0
- package/server/erudit/db/schema/contentSnippets.ts +32 -0
- package/server/erudit/db/schema/contentToc.ts +16 -0
- package/server/erudit/db/schema/contentUniques.ts +25 -0
- package/server/erudit/db/schema/contributors.ts +12 -0
- package/server/erudit/db/schema/files.ts +11 -0
- package/server/erudit/db/schema/groups.ts +6 -0
- package/server/erudit/db/schema/index.ts +17 -0
- package/server/erudit/db/schema/news.ts +7 -0
- package/server/erudit/db/schema/pages.ts +7 -0
- package/server/erudit/db/schema/problemScripts.ts +14 -0
- package/server/erudit/db/schema/sponsors.ts +9 -0
- package/server/erudit/db/schema/topics.ts +9 -0
- package/server/erudit/db/setup.ts +62 -0
- package/server/erudit/db/types.ts +10 -0
- package/server/erudit/global.ts +33 -0
- package/server/erudit/importer.ts +97 -0
- package/server/erudit/index.ts +90 -0
- package/server/erudit/language/list/en.ts +209 -0
- package/server/erudit/language/list/ru.ts +214 -0
- package/server/erudit/language/list.ts +6 -0
- package/server/erudit/language/setup.ts +36 -0
- package/server/erudit/language/types.ts +16 -0
- package/server/erudit/logger.ts +77 -0
- package/server/erudit/news/build.ts +77 -0
- package/server/erudit/news/repository/batch.ts +61 -0
- package/server/erudit/prose/repository/finalize.ts +68 -0
- package/server/erudit/prose/repository/get.ts +54 -0
- package/server/erudit/prose/repository/resolve.ts +17 -0
- package/server/erudit/prose/storage/callout.ts +14 -0
- package/server/erudit/prose/storage/image.ts +20 -0
- package/server/erudit/prose/storage/link.ts +226 -0
- package/server/erudit/prose/storage/problemScript.ts +21 -0
- package/server/erudit/prose/storage/video.ts +14 -0
- package/server/erudit/prose/transform/bundleProblemScript.ts +6 -0
- package/server/erudit/prose/transform/extensions.ts +15 -0
- package/server/erudit/quote/repository/ids.ts +31 -0
- package/server/erudit/repository.ts +96 -0
- package/server/erudit/sponsors/build.ts +114 -0
- package/server/erudit/sponsors/repository/avatarUrl.ts +10 -0
- package/server/erudit/sponsors/repository/count.ts +4 -0
- package/server/erudit/staticFile.ts +28 -0
- package/server/plugins/augmentCss.ts +17 -0
- package/server/plugins/lang.ts +7 -0
- package/server/plugins/metaViewport.ts +15 -0
- package/server/plugins/theme.ts +13 -0
- package/server/routes/file/[...path].ts +18 -0
- package/server/routes/robots.txt.ts +1 -1
- package/server/routes/search.json.gz.ts +72 -0
- package/server/routes/sitemap.xml.ts +61 -90
- package/shared/search/encoders.ts +20 -0
- package/shared/types/asideMajorPages.ts +4 -0
- package/shared/types/breadcrumbs.ts +9 -0
- package/shared/types/contentChildren.ts +10 -0
- package/shared/types/contentConnections.ts +27 -0
- package/shared/types/contentStats.ts +6 -0
- package/shared/types/elementSnippet.ts +8 -0
- package/shared/types/frontContentNav.ts +38 -0
- package/shared/types/indexPage.ts +20 -0
- package/shared/types/language.ts +189 -84
- package/shared/types/mainContent.ts +69 -0
- package/shared/types/news.ts +13 -0
- package/shared/types/preview.ts +28 -0
- package/shared/types/runtimeConfig.ts +64 -0
- package/shared/types/search.ts +79 -0
- package/shared/utils/contentTypePath.ts +63 -0
- package/shared/utils/icons.ts +11 -0
- package/shared/utils/pages.ts +24 -0
- package/shared/utils/slasher.ts +64 -0
- package/shared/utils/stringColor.ts +13 -9
- package/shared/utils/toStringEqual.ts +21 -0
- package/shared/utils/zip.ts +64 -0
- package/test/shared/utils/slasher.test.ts +75 -0
- package/test/shared/utils/zip.test.ts +8 -0
- package/tsconfig.json +17 -8
- package/app/assets/icons/alert.svg +0 -3
- package/app/assets/icons/angle-right.svg +0 -3
- package/app/assets/icons/arrow-in-text.svg +0 -3
- package/app/assets/icons/arrow-left.svg +0 -3
- package/app/assets/icons/arrow-up-to-right.svg +0 -3
- package/app/assets/icons/cameo-add.svg +0 -3
- package/app/assets/icons/chip.svg +0 -3
- package/app/assets/icons/circle-help.svg +0 -3
- package/app/assets/icons/cross.svg +0 -3
- package/app/assets/icons/ellipsis-vertical.svg +0 -3
- package/app/assets/icons/file-check.svg +0 -3
- package/app/assets/icons/file-star.svg +0 -3
- package/app/assets/icons/link-external.svg +0 -3
- package/app/assets/icons/link.svg +0 -3
- package/app/assets/icons/outline/book.svg +0 -3
- package/app/assets/icons/outline/file-lines.svg +0 -3
- package/app/assets/icons/pirate.svg +0 -3
- package/app/assets/icons/search.svg +0 -3
- package/app/assets/icons/shuffle.svg +0 -3
- package/app/assets/icons/star.svg +0 -3
- package/app/components/Avatar.vue +0 -118
- package/app/components/EruditLink.vue +0 -17
- package/app/components/Loading.vue +0 -23
- package/app/components/SiteAside.vue +0 -393
- package/app/components/SiteMain.vue +0 -32
- package/app/components/ads/AdsProviderCustom.vue +0 -35
- package/app/components/aside/major/PaneContentScroll.vue +0 -23
- package/app/components/aside/major/PaneSwitch.vue +0 -54
- package/app/components/aside/major/PaneSwitchButton.vue +0 -63
- package/app/components/aside/major/panes/Language.vue +0 -79
- package/app/components/aside/major/panes/Pages.vue +0 -50
- package/app/components/aside/major/panes/Search.vue +0 -11
- package/app/components/aside/major/panes/nav/Nav.vue +0 -92
- package/app/components/aside/major/panes/nav/NavBook.vue +0 -95
- package/app/components/aside/major/panes/nav/NavBookLoading.vue +0 -24
- package/app/components/aside/major/panes/nav/NavGlobal.vue +0 -16
- package/app/components/aside/major/panes/nav/fnav/FNav.vue +0 -105
- package/app/components/aside/major/panes/nav/fnav/FNavBook.vue +0 -32
- package/app/components/aside/major/panes/nav/fnav/FNavFlags.vue +0 -40
- package/app/components/aside/major/panes/nav/fnav/FNavFolder.vue +0 -60
- package/app/components/aside/major/panes/nav/fnav/FNavItem.vue +0 -34
- package/app/components/aside/major/panes/nav/fnav/FNavSeparator.vue +0 -80
- package/app/components/aside/major/panes/nav/fnav/FNavTopic.vue +0 -24
- package/app/components/aside/major/panes/other/ItemContent.vue +0 -29
- package/app/components/aside/major/panes/other/ItemGenerator.vue +0 -13
- package/app/components/aside/major/panes/other/ItemTheme.vue +0 -54
- package/app/components/aside/major/panes/other/Other.vue +0 -16
- package/app/components/aside/minor/AsideMinorContribute.vue +0 -175
- package/app/components/aside/minor/AsideMinorNews.vue +0 -11
- package/app/components/aside/minor/AsideMinorTopLink.vue +0 -66
- package/app/components/aside/minor/content/AsideMinorContent.vue +0 -89
- package/app/components/aside/minor/contributor/BookContribution.vue +0 -64
- package/app/components/aside/minor/topic/AsideMinorTopic.vue +0 -31
- package/app/components/aside/minor/topic/TopicContributors.vue +0 -183
- package/app/components/aside/minor/topic/TopicNav.vue +0 -49
- package/app/components/aside/minor/topic/TopicToc.vue +0 -212
- package/app/components/aside/minor/topic/TopicTocItem.vue +0 -19
- package/app/components/aside/utils/AsideOverlayPane.vue +0 -40
- package/app/components/bitran/BitranContent.vue +0 -90
- package/app/components/bitran/RenderWrapper.vue +0 -10
- package/app/components/contributor/ContributorListItem.vue +0 -43
- package/app/components/main/MainActionButton.vue +0 -51
- package/app/components/main/MainBitranContent.vue +0 -55
- package/app/components/main/MainBreadcrumb.vue +0 -63
- package/app/components/main/cameo/MainCameo.vue +0 -135
- package/app/components/main/cameo/MainCameoData.vue +0 -232
- package/app/components/main/content/ContentBreadcrumb.vue +0 -28
- package/app/components/main/content/ContentDecoration.vue +0 -29
- package/app/components/main/content/ContentPopover.vue +0 -188
- package/app/components/main/content/ContentPopovers.vue +0 -111
- package/app/components/main/content/ContentReferences.vue +0 -70
- package/app/components/main/content/reference/ReferenceGroup.vue +0 -38
- package/app/components/main/content/reference/ReferenceItem.vue +0 -70
- package/app/components/main/content/reference/ReferenceSource.vue +0 -120
- package/app/components/main/topic/MainTopic.vue +0 -76
- package/app/components/main/topic/TopicPartSwitch.vue +0 -119
- package/app/components/preview/PreviewDisplay.vue +0 -139
- package/app/components/preview/PreviewFooterAction.vue +0 -73
- package/app/components/preview/display/Alert.vue +0 -50
- package/app/components/preview/display/Custom.vue +0 -18
- package/app/components/preview/display/GenericLink.vue +0 -48
- package/app/components/preview/display/PageLink.vue +0 -22
- package/app/components/preview/display/Unique.vue +0 -46
- package/app/components/sponsor/SponsorTier1.vue +0 -89
- package/app/components/sponsor/SponsorTier2.vue +0 -109
- package/app/composables/adsAllowed.ts +0 -11
- package/app/composables/asset.ts +0 -12
- package/app/composables/bitran.ts +0 -108
- package/app/composables/bitranLocation.ts +0 -7
- package/app/composables/contentData.ts +0 -38
- package/app/composables/contentPage.ts +0 -168
- package/app/composables/contentRoute.ts +0 -45
- package/app/composables/darkMagic.ts +0 -24
- package/app/composables/externalApi.ts +0 -69
- package/app/composables/head.ts +0 -24
- package/app/composables/majorPane.ts +0 -62
- package/app/pages/_test/preview.vue +0 -110
- package/app/pages/practice/[...practice].vue +0 -3
- package/app/plugins/analytics.ts +0 -95
- package/app/public/favicon/article.svg +0 -10
- package/app/public/favicon/default.svg +0 -10
- package/app/public/favicon/practice.svg +0 -10
- package/app/public/favicon/summary.svg +0 -10
- package/app/public/og-default.png +0 -0
- package/app/scripts/_immediate.js +0 -9
- package/app/scripts/aside/index.ts +0 -59
- package/app/scripts/aside/major/nav.ts +0 -26
- package/app/scripts/aside/minor/state.ts +0 -37
- package/app/scripts/flag.ts +0 -28
- package/app/scripts/og.ts +0 -28
- package/app/scripts/preview/build.ts +0 -76
- package/app/scripts/preview/data/alert.ts +0 -19
- package/app/scripts/preview/data/custom.ts +0 -8
- package/app/scripts/preview/data/genericLink.ts +0 -24
- package/app/scripts/preview/data/pageLink.ts +0 -24
- package/app/scripts/preview/data/unique.ts +0 -69
- package/app/scripts/preview/data.ts +0 -24
- package/app/scripts/preview/display.ts +0 -37
- package/app/scripts/preview/footer.ts +0 -9
- package/app/scripts/preview/request.ts +0 -51
- package/app/scripts/preview/state.ts +0 -63
- package/app/styles/_immediate.css +0 -7
- package/app/styles/_util.scss +0 -43
- package/app/styles/_utils.scss +0 -44
- package/app/styles/app.scss +0 -91
- package/app/styles/def/_bp.scss +0 -27
- package/app/styles/def/_size.scss +0 -7
- package/app/styles/def/_z.scss +0 -5
- package/app/styles/normalize.scss +0 -49
- package/app/styles/partials/_darkMagic.scss +0 -5
- package/app/styles/partials/_fnav.scss +0 -15
- package/app/styles/partials/_preview.scss +0 -5
- package/const.ts +0 -3
- package/globalPath.ts +0 -21
- package/globals/bitran.ts +0 -1
- package/globals/cameo.ts +0 -5
- package/globals/content.ts +0 -27
- package/globals/contributor.ts +0 -5
- package/globals/erudit.ts +0 -5
- package/globals/register.ts +0 -23
- package/globals/sponsor.ts +0 -17
- package/languages/en.ts +0 -108
- package/languages/ru.ts +0 -112
- package/module/bitran.ts +0 -66
- package/module/config.ts +0 -35
- package/module/imports.ts +0 -74
- package/module/index.ts +0 -47
- package/module/paths.ts +0 -22
- package/module/restart.ts +0 -61
- package/server/api/aside/major/nav/bookIds.ts +0 -5
- package/server/api/aside/major/nav/bookNav/[...bookId].ts +0 -17
- package/server/api/aside/major/nav/global.ts +0 -7
- package/server/api/aside/minor/book/[...bookId].ts +0 -18
- package/server/api/aside/minor/contributor/[contributorId].ts +0 -18
- package/server/api/aside/minor/group/[...groupId].ts +0 -18
- package/server/api/aside/minor/news.ts +0 -7
- package/server/api/aside/minor/topic.ts +0 -36
- package/server/api/bitran/content/[...location].ts +0 -13
- package/server/api/bitran/toc/[...location].ts +0 -9
- package/server/api/cameo/data/[cameoId].ts +0 -42
- package/server/api/cameo/ids.ts +0 -5
- package/server/api/content/data.ts +0 -75
- package/server/api/contributor/count.ts +0 -6
- package/server/api/fake/content.ts +0 -11
- package/server/api/fake/shared/languages.ts +0 -12
- package/server/api/language/phrase/[phraseId].ts +0 -19
- package/server/api/language/phraseIds.ts +0 -8
- package/server/api/prerender/assets/cameo.ts +0 -14
- package/server/api/prerender/assets/contributor.ts +0 -12
- package/server/api/prerender/assets/sponsor.ts +0 -13
- package/server/api/prerender/cameos.ts +0 -12
- package/server/api/preview/page/[...parts].ts +0 -78
- package/server/api/preview/unique/[...location].ts +0 -48
- package/server/api/problem/generator/[...path].ts +0 -26
- package/server/api/sponsor/cameo/data/[sponsorId].ts +0 -51
- package/server/api/sponsor/cameo/ids.ts +0 -5
- package/server/api/sponsor/count.ts +0 -5
- package/server/api/sponsor/list.ts +0 -36
- package/server/plugin/bitran/content.ts +0 -252
- package/server/plugin/bitran/elements/include.ts +0 -229
- package/server/plugin/bitran/location.ts +0 -43
- package/server/plugin/bitran/toc.ts +0 -94
- package/server/plugin/bitran/transpiler.ts +0 -18
- package/server/plugin/build/close.ts +0 -12
- package/server/plugin/build/jobs/content/builderArgs.ts +0 -8
- package/server/plugin/build/jobs/content/generic.ts +0 -191
- package/server/plugin/build/jobs/content/parse.ts +0 -113
- package/server/plugin/build/jobs/content/path.ts +0 -6
- package/server/plugin/build/jobs/content/type/book.ts +0 -9
- package/server/plugin/build/jobs/content/type/group.ts +0 -37
- package/server/plugin/build/jobs/content/type/topic.ts +0 -36
- package/server/plugin/build/jobs/contributors.ts +0 -69
- package/server/plugin/build/jobs/language.ts +0 -36
- package/server/plugin/build/jobs/nav.ts +0 -345
- package/server/plugin/build/process.ts +0 -34
- package/server/plugin/build/rebuild.ts +0 -68
- package/server/plugin/build/setup.ts +0 -19
- package/server/plugin/content/context.ts +0 -119
- package/server/plugin/db/entities/Book.ts +0 -7
- package/server/plugin/db/entities/Content.ts +0 -45
- package/server/plugin/db/entities/Contribution.ts +0 -10
- package/server/plugin/db/entities/Contributor.ts +0 -25
- package/server/plugin/db/entities/File.ts +0 -10
- package/server/plugin/db/entities/Group.ts +0 -14
- package/server/plugin/db/entities/Hash.ts +0 -15
- package/server/plugin/db/entities/Topic.ts +0 -20
- package/server/plugin/db/entities/Unique.ts +0 -21
- package/server/plugin/db/reset.ts +0 -12
- package/server/plugin/db/setup.ts +0 -49
- package/server/plugin/global.ts +0 -18
- package/server/plugin/importer.ts +0 -16
- package/server/plugin/index.ts +0 -9
- package/server/plugin/logger.ts +0 -23
- package/server/plugin/nav/node.ts +0 -27
- package/server/plugin/nav/utils.ts +0 -179
- package/server/plugin/repository/asideMinor.ts +0 -51
- package/server/plugin/repository/book.ts +0 -39
- package/server/plugin/repository/cameo.ts +0 -16
- package/server/plugin/repository/content.ts +0 -240
- package/server/plugin/repository/contentId.ts +0 -40
- package/server/plugin/repository/contributor.ts +0 -129
- package/server/plugin/repository/file.ts +0 -10
- package/server/plugin/repository/frontNav.ts +0 -145
- package/server/plugin/repository/topic.ts +0 -35
- package/server/plugin/sponsor/build.ts +0 -82
- package/server/plugin/sponsor/index.ts +0 -5
- package/server/plugin/sponsor/repository.ts +0 -56
- package/server/routes/asset/[...assetPath].ts +0 -34
- package/server/tsconfig.json +0 -9
- package/shared/aside/minor.ts +0 -55
- package/shared/asset.ts +0 -17
- package/shared/bitran/content.ts +0 -9
- package/shared/bitran/contentId.ts +0 -56
- package/shared/bitran/toc.ts +0 -8
- package/shared/breadcrumb.ts +0 -7
- package/shared/content/bookId.ts +0 -12
- package/shared/content/context.ts +0 -9
- package/shared/content/data/base.ts +0 -32
- package/shared/content/data/index.ts +0 -5
- package/shared/content/data/type/book.ts +0 -5
- package/shared/content/data/type/group.ts +0 -6
- package/shared/content/data/type/topic.ts +0 -11
- package/shared/content/previousNext.ts +0 -9
- package/shared/contributor.ts +0 -34
- package/shared/frontNav.ts +0 -41
- package/shared/icons.ts +0 -38
- package/shared/image.ts +0 -5
- package/shared/link.ts +0 -28
- package/shared/popover.ts +0 -8
- package/shared/utils/objectsEqual.ts +0 -4
- package/test/contentId.test.ts +0 -91
- package/test/utils/url.test.ts +0 -99
- package/utils/contentPath.ts +0 -67
- package/utils/ext.ts +0 -41
- package/utils/stress.ts +0 -9
- package/utils/url.ts +0 -23
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import type { ContentType } from '@erudit-js/cog/schema';
|
|
2
|
-
import { Like } from 'typeorm';
|
|
3
|
-
|
|
4
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
5
|
-
import { DbContent } from '@server/db/entities/Content';
|
|
6
|
-
import { DbContribution } from '@server/db/entities/Contribution';
|
|
7
|
-
import { getContentContext } from '@server/content/context';
|
|
8
|
-
import { DbContributor } from '@server/db/entities/Contributor';
|
|
9
|
-
import { getIdsUp, getPreviousNextNav } from '@server/nav/utils';
|
|
10
|
-
import {
|
|
11
|
-
getShortContentId,
|
|
12
|
-
resolveClientContentId,
|
|
13
|
-
} from '@server/repository/contentId';
|
|
14
|
-
import { getTopicPart } from './topic';
|
|
15
|
-
import type { NavNode } from '../nav/node';
|
|
16
|
-
|
|
17
|
-
import { createContentLink, createTopicPartLink } from '@erudit/shared/link';
|
|
18
|
-
import type { PreviousNextItem } from '@erudit/shared/content/previousNext';
|
|
19
|
-
import type { ContentContributor } from '@erudit/shared/contributor';
|
|
20
|
-
import type { ContentGenericData } from '@shared/content/data/base';
|
|
21
|
-
|
|
22
|
-
export async function getContentGenericData(
|
|
23
|
-
contentId: string,
|
|
24
|
-
): Promise<ContentGenericData> {
|
|
25
|
-
const dbContent = await ERUDIT_SERVER.DB.manager.findOne(DbContent, {
|
|
26
|
-
where: { contentId },
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
if (!dbContent) {
|
|
30
|
-
throw createError({
|
|
31
|
-
statusCode: 404,
|
|
32
|
-
message: `Content item "${contentId}" not found!`,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const previousNext = await getPreviousNext(contentId);
|
|
37
|
-
const decoration = await getContentDecoration(contentId);
|
|
38
|
-
const flags = await getContentFlags(contentId);
|
|
39
|
-
|
|
40
|
-
const contentPage: ContentGenericData = {
|
|
41
|
-
contentId,
|
|
42
|
-
type: dbContent.type,
|
|
43
|
-
title: dbContent.title || undefined,
|
|
44
|
-
description: dbContent.description || undefined,
|
|
45
|
-
flags,
|
|
46
|
-
previousNext,
|
|
47
|
-
decoration,
|
|
48
|
-
context: await getContentContext(contentId),
|
|
49
|
-
seo: dbContent.seo,
|
|
50
|
-
ogImage: dbContent.ogImage,
|
|
51
|
-
dependencies: dbContent.dependencies
|
|
52
|
-
? await getContentDependencies(contentId, dbContent.dependencies)
|
|
53
|
-
: undefined,
|
|
54
|
-
references: dbContent.references,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return contentPage;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export async function getPreviousNext(contentId: string) {
|
|
61
|
-
const { previousNav, nextNav } = await getPreviousNextNav(contentId);
|
|
62
|
-
|
|
63
|
-
async function getItemData(navNode: NavNode): Promise<PreviousNextItem> {
|
|
64
|
-
const title = await getContentTitle(navNode.fullId);
|
|
65
|
-
|
|
66
|
-
const link = await (async () => {
|
|
67
|
-
if (navNode.type === 'topic')
|
|
68
|
-
return createTopicPartLink(
|
|
69
|
-
await getTopicPart(navNode.fullId),
|
|
70
|
-
navNode.shortId,
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
return createContentLink(navNode.type, navNode.shortId);
|
|
74
|
-
})();
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
title,
|
|
78
|
-
link,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
previous: previousNav ? await getItemData(previousNav) : undefined,
|
|
84
|
-
next: nextNav ? await getItemData(nextNav) : undefined,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export async function getContentDecoration(contentId: string) {
|
|
89
|
-
const idsUp = await getIdsUp(contentId);
|
|
90
|
-
|
|
91
|
-
for (const id of idsUp) {
|
|
92
|
-
const decoration = (
|
|
93
|
-
await ERUDIT_SERVER.DB.manager.findOne(DbContent, {
|
|
94
|
-
select: ['decoration'],
|
|
95
|
-
where: { contentId: id },
|
|
96
|
-
})
|
|
97
|
-
)?.decoration;
|
|
98
|
-
|
|
99
|
-
if (decoration) return decoration;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export async function getContentFlags(contentId: string) {
|
|
106
|
-
const idsUp = await getIdsUp(contentId);
|
|
107
|
-
const flags: any = {};
|
|
108
|
-
|
|
109
|
-
for (const id of idsUp.reverse()) {
|
|
110
|
-
const dbFlags = (
|
|
111
|
-
await ERUDIT_SERVER.DB.manager.findOne(DbContent, {
|
|
112
|
-
select: ['flags'],
|
|
113
|
-
where: { contentId: id },
|
|
114
|
-
})
|
|
115
|
-
)?.flags;
|
|
116
|
-
|
|
117
|
-
if (dbFlags)
|
|
118
|
-
for (const [flagName, flagValue] of Object.entries(dbFlags))
|
|
119
|
-
flags[flagName] = flagValue;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
for (const [flagName, flagValue] of Object.entries(flags))
|
|
123
|
-
if (flagValue === false) delete flags[flagName];
|
|
124
|
-
|
|
125
|
-
return flags;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export async function getContentDependencies(
|
|
129
|
-
contentId: string,
|
|
130
|
-
strDependencies: string[],
|
|
131
|
-
) {
|
|
132
|
-
const dependencyIds: string[] = [];
|
|
133
|
-
for (const rawDependency of strDependencies) {
|
|
134
|
-
dependencyIds.push(
|
|
135
|
-
resolveClientContentId(rawDependency, contentId, 'full'),
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const dependencies: Record<string, string> = {};
|
|
140
|
-
|
|
141
|
-
for (const dependencyId of dependencyIds)
|
|
142
|
-
dependencies[await getContentLink(dependencyId)] =
|
|
143
|
-
await getContentTitle(dependencyId);
|
|
144
|
-
|
|
145
|
-
return dependencies;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export async function getContentTitle(contentId: string) {
|
|
149
|
-
const dbContent = await ERUDIT_SERVER.DB.manager.findOne(DbContent, {
|
|
150
|
-
select: ['title'],
|
|
151
|
-
where: { contentId },
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
return dbContent?.title || contentId.split('/').pop()!;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export async function getContentLink(contentId: string) {
|
|
158
|
-
const dbContent = await ERUDIT_SERVER.DB.manager.findOne(DbContent, {
|
|
159
|
-
select: ['type'],
|
|
160
|
-
where: { contentId },
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
if (!dbContent) {
|
|
164
|
-
throw createError({
|
|
165
|
-
statusCode: 404,
|
|
166
|
-
statusText: `Missing "${contentId}" content item!`,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const shortContentId = getShortContentId(contentId);
|
|
171
|
-
|
|
172
|
-
if (dbContent.type !== 'topic') {
|
|
173
|
-
return createContentLink(dbContent.type, shortContentId);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const topicPart = await getTopicPart(contentId);
|
|
177
|
-
|
|
178
|
-
return createTopicPartLink(topicPart, shortContentId);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export async function getContentContributors(contentId: string) {
|
|
182
|
-
const contributorIds = await (async () => {
|
|
183
|
-
const idHash: Record<string, true> = {};
|
|
184
|
-
|
|
185
|
-
(
|
|
186
|
-
await ERUDIT_SERVER.DB.manager.find(DbContribution, {
|
|
187
|
-
select: ['contributorId'],
|
|
188
|
-
where: { contentId },
|
|
189
|
-
})
|
|
190
|
-
).forEach(
|
|
191
|
-
(contribution) => (idHash[contribution.contributorId] = true),
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
const type: ContentType = (await ERUDIT_SERVER.DB.manager.findOne(
|
|
195
|
-
DbContent,
|
|
196
|
-
{
|
|
197
|
-
select: ['type'],
|
|
198
|
-
where: { contentId },
|
|
199
|
-
},
|
|
200
|
-
))!.type;
|
|
201
|
-
|
|
202
|
-
if (type === 'book' || type === 'group') {
|
|
203
|
-
// Collecting contributors for all sub-content items
|
|
204
|
-
(
|
|
205
|
-
await ERUDIT_SERVER.DB.manager.find(DbContribution, {
|
|
206
|
-
select: ['contributorId'],
|
|
207
|
-
where: { contentId: Like(`${contentId}/%`) },
|
|
208
|
-
})
|
|
209
|
-
).forEach(
|
|
210
|
-
(contribution) => (idHash[contribution.contributorId] = true),
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return Object.keys(idHash);
|
|
215
|
-
})();
|
|
216
|
-
|
|
217
|
-
const contentContributors: ContentContributor[] = [];
|
|
218
|
-
|
|
219
|
-
for (const contributorId of contributorIds) {
|
|
220
|
-
const dbContributor = (await ERUDIT_SERVER.DB.manager.findOne(
|
|
221
|
-
DbContributor,
|
|
222
|
-
{
|
|
223
|
-
select: ['contributorId', 'displayName', 'avatar'],
|
|
224
|
-
where: { contributorId },
|
|
225
|
-
},
|
|
226
|
-
))!;
|
|
227
|
-
|
|
228
|
-
const contentContributor: ContentContributor = { contributorId };
|
|
229
|
-
|
|
230
|
-
if (dbContributor.displayName)
|
|
231
|
-
contentContributor.displayName = dbContributor.displayName;
|
|
232
|
-
|
|
233
|
-
if (dbContributor.avatar)
|
|
234
|
-
contentContributor.avatar = dbContributor.avatar;
|
|
235
|
-
|
|
236
|
-
contentContributors.push(contentContributor);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
return contentContributors.length ? contentContributors : undefined;
|
|
240
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { getNavBookIds, getNavNode } from '@server/nav/utils';
|
|
2
|
-
import { toAbsoluteContentPath } from '@shared/bitran/contentId';
|
|
3
|
-
|
|
4
|
-
export function getFullContentId(mixedContentId: string): string {
|
|
5
|
-
const navNode = getNavNode(mixedContentId);
|
|
6
|
-
return navNode.fullId;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function getShortContentId(mixedContentId: string): string {
|
|
10
|
-
const navNode = getNavNode(mixedContentId);
|
|
11
|
-
return navNode.shortId;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function serverAbsolutizeContentPath(
|
|
15
|
-
relativePath: string,
|
|
16
|
-
contextPath: string,
|
|
17
|
-
) {
|
|
18
|
-
const absolutePath = toAbsoluteContentPath(
|
|
19
|
-
relativePath,
|
|
20
|
-
contextPath,
|
|
21
|
-
getNavBookIds('full'),
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
return absolutePath;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function resolveClientContentId(
|
|
28
|
-
clientContentId: string,
|
|
29
|
-
contextContentId: string,
|
|
30
|
-
mode: 'full' | 'short',
|
|
31
|
-
): string {
|
|
32
|
-
const absoluteContentId = serverAbsolutizeContentPath(
|
|
33
|
-
clientContentId,
|
|
34
|
-
contextContentId,
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return mode === 'full'
|
|
38
|
-
? getFullContentId(absoluteContentId)
|
|
39
|
-
: getShortContentId(absoluteContentId);
|
|
40
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { DbContributor } from '@server/db/entities/Contributor';
|
|
2
|
-
import { DbContribution } from '@server/db/entities/Contribution';
|
|
3
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
4
|
-
import { getNavBookOf, getNavNode } from '@server/nav/utils';
|
|
5
|
-
import { getBookTitleFor } from '@server/repository/book';
|
|
6
|
-
import { getContentLink, getContentTitle } from '@server/repository/content';
|
|
7
|
-
|
|
8
|
-
import type { Contribution, PageContributor } from '@shared/contributor';
|
|
9
|
-
|
|
10
|
-
export async function contributorExists(contributorId: string) {
|
|
11
|
-
return await ERUDIT_SERVER.DB.manager.exists(DbContributor, {
|
|
12
|
-
where: { contributorId },
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function getContributorPageData(
|
|
17
|
-
contributorId: string,
|
|
18
|
-
): Promise<PageContributor> {
|
|
19
|
-
if (!(await contributorExists(contributorId))) {
|
|
20
|
-
throw createError({
|
|
21
|
-
statusCode: 404,
|
|
22
|
-
message: `Contributor ${contributorId} not found!`,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const dbContributor = (await ERUDIT_SERVER.DB.manager.findOne(
|
|
27
|
-
DbContributor,
|
|
28
|
-
{
|
|
29
|
-
select: [
|
|
30
|
-
'displayName',
|
|
31
|
-
'slogan',
|
|
32
|
-
'links',
|
|
33
|
-
'avatar',
|
|
34
|
-
'isEditor',
|
|
35
|
-
'description',
|
|
36
|
-
],
|
|
37
|
-
where: { contributorId },
|
|
38
|
-
},
|
|
39
|
-
))!;
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
contributorId,
|
|
43
|
-
displayName: dbContributor.displayName,
|
|
44
|
-
slogan: dbContributor.slogan,
|
|
45
|
-
links: dbContributor.links,
|
|
46
|
-
avatar: dbContributor.avatar,
|
|
47
|
-
isEditor: dbContributor.isEditor,
|
|
48
|
-
hasDescription: !!dbContributor.description,
|
|
49
|
-
contributions: await getContributions(contributorId),
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export async function getContributions(
|
|
54
|
-
contributorId: string,
|
|
55
|
-
): Promise<Contribution[]> {
|
|
56
|
-
const dbContributions = await ERUDIT_SERVER.DB.manager.find(
|
|
57
|
-
DbContribution,
|
|
58
|
-
{
|
|
59
|
-
select: ['contentId'],
|
|
60
|
-
where: { contributorId },
|
|
61
|
-
},
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const contributions: Contribution[] = [];
|
|
65
|
-
const existingBookTitles = new Set<string>();
|
|
66
|
-
|
|
67
|
-
for (const dbContribution of dbContributions) {
|
|
68
|
-
const contentId = dbContribution.contentId;
|
|
69
|
-
const contentNavNode = getNavNode(contentId);
|
|
70
|
-
|
|
71
|
-
const bookData = await (async () => {
|
|
72
|
-
const bookNavNode = getNavBookOf(contentId);
|
|
73
|
-
|
|
74
|
-
if (!bookNavNode) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const bookId = bookNavNode.fullId;
|
|
79
|
-
|
|
80
|
-
if (!bookId) {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (bookId === contentId) {
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
let bookTitle = await getBookTitleFor(bookId);
|
|
89
|
-
|
|
90
|
-
let cursor = bookNavNode;
|
|
91
|
-
while (cursor) {
|
|
92
|
-
if (cursor.type === 'group') {
|
|
93
|
-
const groupTitle = await getContentTitle(cursor.fullId);
|
|
94
|
-
const newBookTitle = groupTitle + ' / ' + bookTitle;
|
|
95
|
-
|
|
96
|
-
if (bookTitle && existingBookTitles.has(bookTitle)) {
|
|
97
|
-
bookTitle = newBookTitle;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
cursor = cursor.parent as any;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (bookTitle) {
|
|
105
|
-
existingBookTitles.add(bookTitle);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
bookId,
|
|
110
|
-
bookTitle,
|
|
111
|
-
};
|
|
112
|
-
})();
|
|
113
|
-
|
|
114
|
-
const contentTitle = await getContentTitle(contentId);
|
|
115
|
-
const contentLink = await getContentLink(contentId);
|
|
116
|
-
|
|
117
|
-
const contribution: Contribution = {
|
|
118
|
-
bookId: bookData?.bookId,
|
|
119
|
-
bookTitle: bookData?.bookTitle,
|
|
120
|
-
contentType: contentNavNode.type,
|
|
121
|
-
contentTitle,
|
|
122
|
-
contentLink,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
contributions.push(contribution);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return contributions;
|
|
129
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
2
|
-
import { DbFile } from '@server/db/entities/File';
|
|
3
|
-
|
|
4
|
-
export async function getFileFullPath(path: string) {
|
|
5
|
-
const dbFile = await ERUDIT_SERVER.DB.manager.findOne(DbFile, {
|
|
6
|
-
where: { path },
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
return dbFile?.fullPath;
|
|
10
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
FrontNav,
|
|
3
|
-
FrontNavBase,
|
|
4
|
-
FrontNavBook,
|
|
5
|
-
FrontNavFolder,
|
|
6
|
-
FrontNavItem,
|
|
7
|
-
FrontNavSeparator,
|
|
8
|
-
FrontNavTopic,
|
|
9
|
-
} from '@erudit/shared/frontNav';
|
|
10
|
-
|
|
11
|
-
import type { NavNode, RootNavNode } from '@server/nav/node';
|
|
12
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
13
|
-
import { DbContent } from '@server/db/entities/Content';
|
|
14
|
-
import { DbGroup } from '@server/db/entities/Group';
|
|
15
|
-
|
|
16
|
-
import { getTopicPart } from './topic';
|
|
17
|
-
|
|
18
|
-
export async function createGlobalFrontNav(
|
|
19
|
-
from: RootNavNode | NavNode | undefined,
|
|
20
|
-
): Promise<FrontNav | []> {
|
|
21
|
-
if (!from || !from.children) return [];
|
|
22
|
-
|
|
23
|
-
return await Promise.all(
|
|
24
|
-
from.children.map((node) =>
|
|
25
|
-
toFrontNavItem({ node, level: 0, includeBookNav: true }),
|
|
26
|
-
),
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export async function createBookFrontNav(from: NavNode): Promise<FrontNavBook> {
|
|
31
|
-
return await toFrontNavBook({ node: from, level: 0, includeBookNav: true });
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
type ToFuncArg = {
|
|
35
|
-
node: NavNode;
|
|
36
|
-
level: number;
|
|
37
|
-
includeBookNav?: boolean;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
async function toFrontNavItem(arg: ToFuncArg): Promise<FrontNavItem> {
|
|
41
|
-
switch (arg.node.type) {
|
|
42
|
-
case 'book':
|
|
43
|
-
return await toFrontNavBook(arg);
|
|
44
|
-
case 'topic':
|
|
45
|
-
return await toFrontNavTopic(arg);
|
|
46
|
-
case 'group':
|
|
47
|
-
const dbGroup = await ERUDIT_SERVER.DB.manager.findOne(DbGroup, {
|
|
48
|
-
select: ['type'],
|
|
49
|
-
where: { contentId: arg.node.fullId },
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (!dbGroup)
|
|
53
|
-
throw new Error(
|
|
54
|
-
`Missing group content item "${arg.node.fullId}" when creating front nav!`,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
if (dbGroup.type === 'folder') return await toFrontNavFolder(arg);
|
|
58
|
-
else return await toFrontNavSeparator(arg);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async function toFrontNavBook({
|
|
63
|
-
node,
|
|
64
|
-
level,
|
|
65
|
-
includeBookNav,
|
|
66
|
-
}: ToFuncArg): Promise<FrontNavBook> {
|
|
67
|
-
return {
|
|
68
|
-
type: 'book',
|
|
69
|
-
children: await toFrontNavChildren({
|
|
70
|
-
node,
|
|
71
|
-
level: 0,
|
|
72
|
-
includeBookNav,
|
|
73
|
-
}),
|
|
74
|
-
...(await toFrontNavBase({ node, level })),
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async function toFrontNavSeparator({
|
|
79
|
-
node,
|
|
80
|
-
level,
|
|
81
|
-
includeBookNav,
|
|
82
|
-
}: ToFuncArg): Promise<FrontNavSeparator> {
|
|
83
|
-
return {
|
|
84
|
-
type: 'separator',
|
|
85
|
-
children: await toFrontNavChildren({ node, level, includeBookNav }),
|
|
86
|
-
...(await toFrontNavBase({ node, level })),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
async function toFrontNavFolder({
|
|
91
|
-
node,
|
|
92
|
-
level,
|
|
93
|
-
includeBookNav,
|
|
94
|
-
}: ToFuncArg): Promise<FrontNavFolder> {
|
|
95
|
-
return {
|
|
96
|
-
type: 'folder',
|
|
97
|
-
children: await toFrontNavChildren({
|
|
98
|
-
node,
|
|
99
|
-
level: level + 1,
|
|
100
|
-
includeBookNav,
|
|
101
|
-
}),
|
|
102
|
-
...(await toFrontNavBase({ node, level })),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async function toFrontNavTopic({
|
|
107
|
-
node,
|
|
108
|
-
level,
|
|
109
|
-
}: ToFuncArg): Promise<FrontNavTopic> {
|
|
110
|
-
const topicPart = await getTopicPart(node.fullId);
|
|
111
|
-
return {
|
|
112
|
-
type: 'topic',
|
|
113
|
-
part: topicPart,
|
|
114
|
-
...(await toFrontNavBase({ node, level })),
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
async function toFrontNavBase({
|
|
119
|
-
node,
|
|
120
|
-
level,
|
|
121
|
-
}: ToFuncArg): Promise<Omit<FrontNavBase, 'type'>> {
|
|
122
|
-
const dbContent = await ERUDIT_SERVER.DB.manager.findOne(DbContent, {
|
|
123
|
-
select: ['title', 'navTitle', 'flags'],
|
|
124
|
-
where: { contentId: node.fullId },
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
id: node.shortId,
|
|
129
|
-
fullId: node.fullId,
|
|
130
|
-
level,
|
|
131
|
-
flags: dbContent?.flags,
|
|
132
|
-
label: dbContent?.navTitle || dbContent?.title || node.idPart,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
async function toFrontNavChildren({ node, includeBookNav, level }: ToFuncArg) {
|
|
137
|
-
if (node.type === 'book' && !includeBookNav) return undefined;
|
|
138
|
-
if (!node.children) return undefined;
|
|
139
|
-
|
|
140
|
-
return Promise.all(
|
|
141
|
-
node.children!.map((child) =>
|
|
142
|
-
toFrontNavItem({ node: child, level, includeBookNav }),
|
|
143
|
-
),
|
|
144
|
-
);
|
|
145
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { TopicPart } from '@erudit-js/cog/schema';
|
|
2
|
-
|
|
3
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
4
|
-
import { DbTopic } from '@server/db/entities/Topic';
|
|
5
|
-
import { getShortContentId } from '@server/repository/contentId';
|
|
6
|
-
|
|
7
|
-
import type { TopicPartLinks } from '@shared/content/data/type/topic';
|
|
8
|
-
import { createTopicPartLink } from '@shared/link';
|
|
9
|
-
|
|
10
|
-
export async function getTopicParts(contentId: string) {
|
|
11
|
-
const dbTopic = await ERUDIT_SERVER.DB.manager.findOne(DbTopic, {
|
|
12
|
-
select: ['parts'],
|
|
13
|
-
where: { contentId },
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
if (!dbTopic) throw new Error(`Missing topic "${contentId}".`);
|
|
17
|
-
|
|
18
|
-
return dbTopic.parts;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function getTopicPart(contentId: string): Promise<TopicPart> {
|
|
22
|
-
const topicParts = await getTopicParts(contentId);
|
|
23
|
-
return topicParts.shift()!;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export async function getTopicPartsLinks(topicId: string) {
|
|
27
|
-
const existingTopicParts = await getTopicParts(topicId);
|
|
28
|
-
const shortTopicId = await getShortContentId(topicId);
|
|
29
|
-
const links: TopicPartLinks = {};
|
|
30
|
-
|
|
31
|
-
for (const topicPart of existingTopicParts)
|
|
32
|
-
links[topicPart] = createTopicPartLink(topicPart, shortTopicId);
|
|
33
|
-
|
|
34
|
-
return links;
|
|
35
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { glob } from 'glob';
|
|
3
|
-
import type { Sponsor, SponsorConfig } from '@erudit-js/cog/schema';
|
|
4
|
-
|
|
5
|
-
import { PROJECT_DIR } from '#erudit/globalPaths';
|
|
6
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
7
|
-
import { debug, logger } from '@server/logger';
|
|
8
|
-
|
|
9
|
-
import { getSponsorCount, readSponsorConfig } from './repository';
|
|
10
|
-
|
|
11
|
-
export async function buildSponsors() {
|
|
12
|
-
if (!ERUDIT_SERVER.CONFIG.sponsors) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
debug.start('Building sponsors...');
|
|
17
|
-
|
|
18
|
-
const sponsorIds = await searchSponsorIds();
|
|
19
|
-
|
|
20
|
-
if (sponsorIds.length === 0) {
|
|
21
|
-
logger.warn('No sponsors found!');
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
ERUDIT_SERVER.SPONSORS = {
|
|
26
|
-
tier1Ids: [],
|
|
27
|
-
tier2Ids: [],
|
|
28
|
-
avatars: {},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
for (const sponsorId of sponsorIds) {
|
|
32
|
-
const sponsorAvatar = await searchSponsorAvatar(sponsorId);
|
|
33
|
-
|
|
34
|
-
let config: SponsorConfig<Sponsor>;
|
|
35
|
-
try {
|
|
36
|
-
config = await readSponsorConfig(sponsorId);
|
|
37
|
-
} catch (error) {
|
|
38
|
-
logger.error(
|
|
39
|
-
`Failed to read sponsor config for: ${sponsorId}! ${error}`,
|
|
40
|
-
);
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (config.tier === 'tier1') {
|
|
45
|
-
ERUDIT_SERVER.SPONSORS.tier1Ids.push(sponsorId);
|
|
46
|
-
} else if (config.tier === 'tier2') {
|
|
47
|
-
ERUDIT_SERVER.SPONSORS.tier2Ids.push(sponsorId);
|
|
48
|
-
} else {
|
|
49
|
-
logger.warn(
|
|
50
|
-
`Sponsor ${sponsorId} has an unknown tier: ${config.tier}!`,
|
|
51
|
-
);
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
ERUDIT_SERVER.SPONSORS.avatars[sponsorId] = sponsorAvatar;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
logger.success(
|
|
59
|
-
`Sponsors built successfully!`,
|
|
60
|
-
chalk.dim(`(${getSponsorCount()})`),
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async function searchSponsorIds() {
|
|
65
|
-
const dirs = await glob(PROJECT_DIR + '/sponsors/*/sponsor.{ts,js}', {
|
|
66
|
-
posix: true,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return dirs.map((dir) => dir.split('/').slice(-2, -1)[0]!);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export async function searchSponsorAvatar(
|
|
73
|
-
sponsorId: string,
|
|
74
|
-
): Promise<string | undefined> {
|
|
75
|
-
const pattern = `sponsors/${sponsorId}/avatar.*`;
|
|
76
|
-
const avatars = await glob(pattern, {
|
|
77
|
-
cwd: PROJECT_DIR,
|
|
78
|
-
posix: true,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
return avatars.pop();
|
|
82
|
-
}
|