@panomc/theme-core 1.0.0-dev.60 → 1.0.0-dev.62
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/assets/css/pano-fallback-legacy.css +12381 -0
- package/assets/css/pano-fallback.css +3222 -0
- package/bin/__tests__/check/fixtures/plugin-contracts/market/controllers.json +4 -0
- package/bin/__tests__/check/fixtures/plugin-contracts/market/views.json +67 -0
- package/bin/__tests__/check/fixtures/routes.json +5 -0
- package/bin/__tests__/check/helpers.js +55 -0
- package/bin/__tests__/check/overrides.test.js +287 -0
- package/bin/__tests__/check/theme.test.js +332 -0
- package/bin/__tests__/cli/accept-and-list.test.js +159 -0
- package/bin/__tests__/cli/config-edit.test.js +213 -0
- package/bin/__tests__/cli/contracts-pull.test.js +187 -0
- package/bin/__tests__/cli/core-meta.test.js +305 -0
- package/bin/__tests__/cli/eject-view.test.js +356 -0
- package/bin/__tests__/cli/helpers.js +258 -0
- package/bin/__tests__/scaffold/scaffold.test.js +84 -0
- package/bin/bundle-internal-libs.js +14 -2
- package/bin/check.js +1150 -213
- package/bin/contracts.js +1643 -0
- package/bin/generate-contract.js +378 -0
- package/bin/generate-licenses.js +14 -2
- package/bin/generate-runtime-shims.js +27 -9
- package/bin/new.js +101 -2
- package/bin/package-zip.js +16 -2
- package/bin/sync.js +360 -7
- package/bin/theme-core.js +65 -107
- package/lang/en-US.json +1 -0
- package/lang/ru.json +1 -0
- package/lang/tr.json +1 -0
- package/package.json +8 -9
- package/skin-contract.json +864 -19
- package/src/kit/__tests__/hooks-server-fetch.test.js +56 -0
- package/src/kit/__tests__/route-map.test.js +154 -0
- package/src/kit/__tests__/theme-meta.test.js +249 -0
- package/src/kit/hooks-client.js +3 -0
- package/src/kit/hooks-server.js +79 -21
- package/src/kit/route-map.js +300 -0
- package/src/kit/specifiers.js +3 -62
- package/src/kit/svelte-config.js +3 -0
- package/src/kit/theme-meta.js +405 -0
- package/src/kit/vite-config.js +156 -12
- package/src/lib/NotificationManager.js +18 -0
- package/src/lib/PluginAPI.js +313 -9
- package/src/lib/Store.js +18 -5
- package/src/lib/__tests__/avatarVersion.test.js +25 -0
- package/src/lib/__tests__/check.test.js +201 -0
- package/src/lib/__tests__/controllerHost.test.js +363 -0
- package/src/lib/__tests__/cx03.test.js +245 -0
- package/src/lib/__tests__/engineBoot.test.js +151 -0
- package/src/lib/__tests__/engineParts.helper.js +284 -0
- package/src/lib/__tests__/engineParts.test.js +179 -0
- package/src/lib/__tests__/engineSidebars.helper.js +353 -0
- package/src/lib/__tests__/engineSidebars.test.js +273 -0
- package/src/lib/__tests__/engineStyles.test.js +227 -0
- package/src/lib/__tests__/engineWiring.test.js +1000 -0
- package/src/lib/__tests__/fallbackStyles.test.js +1254 -0
- package/src/lib/__tests__/fixtures/Probe.svelte +5 -0
- package/src/lib/__tests__/fixtures/engine-parts.ssr.json +29 -0
- package/src/lib/__tests__/fixtures/engine-sidebars.ssr.json +16 -0
- package/src/lib/__tests__/home.test.js +563 -0
- package/src/lib/__tests__/injectedScope.test.js +490 -0
- package/src/lib/__tests__/languageConcurrency.test.js +55 -0
- package/src/lib/__tests__/languageLayers.test.js +286 -0
- package/src/lib/__tests__/pageHead.test.js +167 -0
- package/src/lib/__tests__/pageMeta.util.test.js +216 -0
- package/src/lib/__tests__/pageTitle.util.test.js +96 -0
- package/src/lib/__tests__/pluginApiViews.test.js +529 -0
- package/src/lib/__tests__/plugins.test.js +53 -0
- package/src/lib/__tests__/profileNav.util.test.js +145 -0
- package/src/lib/__tests__/registryReady.test.js +26 -0
- package/src/lib/__tests__/returnTo.util.test.js +294 -0
- package/src/lib/__tests__/routeConfig.test.js +361 -0
- package/src/lib/__tests__/sidebarSpec.util.test.js +152 -0
- package/src/lib/__tests__/skinContract.test.js +558 -0
- package/src/lib/__tests__/svelteSsr.helper.js +68 -0
- package/src/lib/__tests__/tc03.test.js +427 -0
- package/src/lib/__tests__/tc11.test.js +184 -0
- package/src/lib/__tests__/translationLayers.test.js +161 -0
- package/src/lib/avatarVersion.js +39 -0
- package/src/lib/components/Breadcrumb.svelte +9 -40
- package/src/lib/components/Date.svelte +1 -1
- package/src/lib/components/DefaultToast.svelte +13 -3
- package/src/lib/components/FallbackLinks.svelte +28 -0
- package/src/lib/components/FallbackScope.svelte +24 -0
- package/src/lib/components/Footer.svelte +8 -8
- package/src/lib/components/Header.svelte +3 -3
- package/src/lib/components/Hook.svelte +12 -1
- package/src/lib/components/LoginFormBody.svelte +5 -5
- package/src/lib/components/Main.svelte +22 -47
- package/src/lib/components/Navbar.svelte +30 -29
- package/src/lib/components/NoContent.svelte +2 -2
- package/src/lib/components/NotificationContainer.svelte +31 -82
- package/src/lib/components/OnlineAdmins.svelte +3 -2
- package/src/lib/components/PageActions.svelte +1 -1
- package/src/lib/components/PageHead.svelte +50 -0
- package/src/lib/components/PageTitle.svelte +2 -2
- package/src/lib/components/Pagination.svelte +6 -6
- package/src/lib/components/PlayerHead.svelte +4 -4
- package/src/lib/components/PluginBlock.svelte +132 -0
- package/src/lib/components/PluginSlot.svelte +40 -0
- package/src/lib/components/Post.svelte +13 -230
- package/src/lib/components/Posts.svelte +7 -14
- package/src/lib/components/RegisterForm.svelte +12 -11
- package/src/lib/components/Sidebar.svelte +9 -7
- package/src/lib/components/TicketRow.svelte +8 -48
- package/src/lib/components/TicketStatus.svelte +10 -16
- package/src/lib/components/Tickets.svelte +8 -30
- package/src/lib/components/Toast.svelte +16 -14
- package/src/lib/components/ToastContainer.svelte +16 -9
- package/src/lib/components/ViewComponent.svelte +13 -1
- package/src/lib/components/modals/CloseTicketConfirmModal.svelte +15 -46
- package/src/lib/components/modals/ConfirmRemoveAllNotificationsModal.svelte +17 -39
- package/src/lib/components/modals/LogoutSessionConfirmModal.svelte +12 -30
- package/src/lib/components/sidebars/HomeSidebar.svelte +33 -284
- package/src/lib/components/sidebars/PlayerDetailSidebar.svelte +14 -63
- package/src/lib/components/sidebars/PluginSidebar.svelte +21 -0
- package/src/lib/components/sidebars/ProfileNavCard.svelte +24 -0
- package/src/lib/components/sidebars/ProfileSidebar.svelte +44 -84
- package/src/lib/components/sidebars/SupportSidebar.svelte +19 -22
- package/src/lib/components/sidebars/TicketCreateAndDetailSidebar.svelte +23 -35
- package/src/lib/components/sidebars/profileNav.util.js +105 -0
- package/src/lib/components/sidebars/sidebarSpec.util.js +92 -0
- package/src/lib/controllerHost.js +261 -0
- package/src/lib/fallbackStyles.js +317 -0
- package/src/lib/home.js +202 -0
- package/src/lib/language.util.js +70 -37
- package/src/lib/layouts/AppLayout.svelte +16 -8
- package/src/lib/layouts/AuthLayout.svelte +6 -4
- package/src/lib/layouts/MainLayout.svelte +17 -12
- package/src/lib/layouts/ProfileLayout.svelte +6 -4
- package/src/lib/layouts/ThemeSettingsLayout.svelte +6 -4
- package/src/lib/layouts/TicketsLayout.svelte +6 -5
- package/src/lib/pageMeta.util.js +212 -0
- package/src/lib/pageShape.js +33 -0
- package/src/lib/pageTitle.util.js +32 -0
- package/src/lib/pages/ActivateEmailPage.svelte +2 -7
- package/src/lib/pages/ConfirmNewEmailPage.svelte +2 -7
- package/src/lib/pages/ErrorPage.svelte +5 -2
- package/src/lib/pages/HomePage.svelte +31 -8
- package/src/lib/pages/LoginPage.svelte +38 -41
- package/src/lib/pages/NotificationsPage.svelte +2 -7
- package/src/lib/pages/PlayerDetailPage.svelte +2 -7
- package/src/lib/pages/PostDetailPage.svelte +2 -7
- package/src/lib/pages/PreviewPostPage.svelte +2 -7
- package/src/lib/pages/RegisterPage.svelte +10 -13
- package/src/lib/pages/RenewPasswordPage.svelte +2 -7
- package/src/lib/pages/ResetPasswordPage.svelte +2 -7
- package/src/lib/pages/RulesPage.svelte +3 -8
- package/src/lib/pages/SupportPage.svelte +2 -7
- package/src/lib/pages/ThemeSettingsPage.svelte +2 -7
- package/src/lib/pages/profile/ProfilePage.svelte +2 -7
- package/src/lib/pages/profile/SettingsPage.svelte +2 -7
- package/src/lib/pages/profile/TicketsPage.svelte +2 -7
- package/src/lib/pages/ticket/CreateTicketPage.svelte +2 -7
- package/src/lib/pages/ticket/TicketDetailPage.svelte +2 -7
- package/src/lib/plugins.js +61 -0
- package/src/lib/returnTo.util.js +116 -0
- package/src/lib/services/auth.js +11 -11
- package/src/lib/services/posts.js +21 -10
- package/src/lib/services/profile.js +5 -5
- package/src/lib/services/theme-setting.js +1 -1
- package/src/lib/services/tickets.js +36 -15
- package/src/lib/siteRealtime.js +55 -8
- package/src/lib/themePageLoad.js +38 -0
- package/src/lib/translationLayers.js +144 -0
- package/src/lib/ui-logics/layout-logics/AppLayoutLogics.js +160 -6
- package/src/lib/ui-logics/layout-logics/AuthLayoutLogics.js +3 -2
- package/src/lib/ui-logics/layout-logics/ProfileLayoutLogics.js +3 -2
- package/src/lib/ui-logics/layout-logics/TicketsLayoutLogics.js +3 -2
- package/src/lib/ui-logics/page-logics/ActiveEmailPageLogics.js +4 -4
- package/src/lib/ui-logics/page-logics/ConfirmNewEmailPageLogics.js +4 -4
- package/src/lib/ui-logics/page-logics/CreateTicketPageLogics.js +5 -5
- package/src/lib/ui-logics/page-logics/HomePageLogics.js +5 -3
- package/src/lib/ui-logics/page-logics/NotificationsPageLogics.js +40 -16
- package/src/lib/ui-logics/page-logics/PlayerDetailPageLogics.js +3 -3
- package/src/lib/ui-logics/page-logics/PostDetailPageLogics.js +3 -3
- package/src/lib/ui-logics/page-logics/PreviewPostPageLogics.js +1 -1
- package/src/lib/ui-logics/page-logics/RenewPasswordPageLogics.js +4 -4
- package/src/lib/ui-logics/page-logics/ResetPasswordPageLogics.js +6 -6
- package/src/lib/ui-logics/page-logics/SettingsPageLogics.js +8 -8
- package/src/lib/ui-logics/page-logics/TicketDetailPageLogics.js +3 -3
- package/src/lib/ui-logics/page-logics/TicketsPageLogics.js +5 -3
- package/src/lib/views/ActivateEmailView.samples.js +22 -0
- package/src/lib/views/ActivateEmailView.svelte +4 -4
- package/src/lib/views/AppLayoutView.samples.js +17 -0
- package/src/lib/views/AppLayoutView.svelte +1 -1
- package/src/lib/views/AuthLayoutView.samples.js +4 -0
- package/src/lib/views/AuthLayoutView.svelte +1 -1
- package/src/lib/views/Breadcrumb.samples.js +15 -0
- package/src/lib/views/CloseTicketConfirmModal.samples.js +12 -0
- package/src/lib/views/ConfirmNewEmailView.samples.js +22 -0
- package/src/lib/views/ConfirmNewEmailView.svelte +4 -4
- package/src/lib/views/ConfirmRemoveAllNotificationsModal.samples.js +9 -0
- package/src/lib/views/CreateTicketView.samples.js +21 -0
- package/src/lib/views/CreateTicketView.svelte +5 -5
- package/src/lib/views/Date.samples.js +9 -0
- package/src/lib/views/DefaultToast.samples.js +7 -0
- package/src/lib/views/ErrorView.samples.js +8 -0
- package/src/lib/views/ErrorView.svelte +4 -2
- package/src/lib/views/Footer.samples.js +8 -0
- package/src/lib/views/Header.samples.js +8 -0
- package/src/lib/views/HomeSidebar.samples.js +59 -0
- package/src/lib/views/HomeView.samples.js +34 -0
- package/src/lib/views/HomeView.svelte +14 -6
- package/src/lib/views/LoginFormBody.samples.js +8 -0
- package/src/lib/views/LoginView.samples.js +50 -0
- package/src/lib/views/LoginView.svelte +24 -22
- package/src/lib/views/LogoutSessionConfirmModal.samples.js +8 -0
- package/src/lib/views/Main.samples.js +23 -0
- package/src/lib/views/MainLayoutView.svelte +3 -4
- package/src/lib/views/Navbar.samples.js +8 -0
- package/src/lib/views/NoContent.samples.js +7 -0
- package/src/lib/views/NotificationContainer.samples.js +25 -0
- package/src/lib/views/NotificationsView.samples.js +36 -0
- package/src/lib/views/NotificationsView.svelte +21 -12
- package/src/lib/views/PageActions.samples.js +7 -0
- package/src/lib/views/PageTitle.samples.js +8 -0
- package/src/lib/views/Pagination.samples.js +7 -0
- package/src/lib/views/PlayerDetailSidebar.samples.js +35 -0
- package/src/lib/views/PlayerDetailView.samples.js +8 -0
- package/src/lib/views/PlayerDetailView.svelte +3 -3
- package/src/lib/views/PlayerHead.samples.js +8 -0
- package/src/lib/views/Post.samples.js +10 -0
- package/src/lib/views/PostDetailView.samples.js +28 -0
- package/src/lib/views/PostDetailView.svelte +24 -16
- package/src/lib/views/Posts.samples.js +9 -0
- package/src/lib/views/PreviewPostView.samples.js +20 -0
- package/src/lib/views/PreviewPostView.svelte +10 -10
- package/src/lib/views/ProfileLayoutView.samples.js +4 -0
- package/src/lib/views/ProfileSidebar.samples.js +33 -0
- package/src/lib/views/ProfileView.samples.js +29 -0
- package/src/lib/views/ProfileView.svelte +2 -2
- package/src/lib/views/RegisterForm.samples.js +7 -0
- package/src/lib/views/RegisterView.samples.js +28 -0
- package/src/lib/views/RegisterView.svelte +5 -3
- package/src/lib/views/RenewPasswordView.samples.js +24 -0
- package/src/lib/views/RenewPasswordView.svelte +6 -6
- package/src/lib/views/ResetPasswordView.samples.js +24 -0
- package/src/lib/views/ResetPasswordView.svelte +3 -3
- package/src/lib/views/RulesView.samples.js +14 -0
- package/src/lib/views/RulesView.svelte +3 -3
- package/src/lib/views/SettingsView.svelte +48 -17
- package/src/lib/views/Sidebar.samples.js +7 -0
- package/src/lib/views/SupportSidebar.samples.js +24 -0
- package/src/lib/views/SupportView.samples.js +16 -0
- package/src/lib/views/SupportView.svelte +8 -6
- package/src/lib/views/ThemeSettingsLayoutView.samples.js +9 -0
- package/src/lib/views/ThemeSettingsLayoutView.svelte +1 -1
- package/src/lib/views/ThemeSettingsView.svelte +89 -89
- package/src/lib/views/TicketCreateAndDetailSidebar.samples.js +33 -0
- package/src/lib/views/TicketDetailView.samples.js +34 -0
- package/src/lib/views/TicketDetailView.svelte +17 -15
- package/src/lib/views/TicketRow.samples.js +10 -0
- package/src/lib/views/TicketStatus.samples.js +8 -0
- package/src/lib/views/Tickets.samples.js +9 -0
- package/src/lib/views/TicketsLayoutView.samples.js +4 -0
- package/src/lib/views/TicketsView.samples.js +23 -0
- package/src/lib/views/TicketsView.svelte +11 -9
- package/src/lib/views/Toast.samples.js +9 -0
- package/src/lib/views/ToastContainer.samples.js +8 -0
- package/src/lib/views/parts/Breadcrumb.svelte +53 -0
- package/src/lib/views/parts/CloseTicketConfirmModal.svelte +63 -0
- package/src/lib/views/parts/ConfirmRemoveAllNotificationsModal.svelte +55 -0
- package/src/lib/views/parts/DefaultToast.svelte +22 -0
- package/src/lib/views/parts/HomeSidebar.svelte +334 -0
- package/src/lib/views/parts/LogoutSessionConfirmModal.svelte +46 -0
- package/src/lib/views/parts/Main.svelte +71 -0
- package/src/lib/views/parts/NotificationContainer.svelte +109 -0
- package/src/lib/views/parts/PlayerDetailSidebar.svelte +81 -0
- package/src/lib/views/parts/Post.svelte +255 -0
- package/src/lib/views/parts/Posts.svelte +25 -0
- package/src/lib/views/parts/ProfileSidebar.svelte +115 -0
- package/src/lib/views/parts/Sidebar.svelte +19 -0
- package/src/lib/views/parts/SupportSidebar.svelte +34 -0
- package/src/lib/views/parts/TicketCreateAndDetailSidebar.svelte +51 -0
- package/src/lib/views/parts/TicketRow.svelte +63 -0
- package/src/lib/views/parts/TicketStatus.svelte +24 -0
- package/src/lib/views/parts/Tickets.svelte +45 -0
- package/src/lib/views/parts/Toast.svelte +27 -0
- package/src/lib/views/parts/ToastContainer.svelte +17 -0
- package/src/lib/views/parts/engine-views.generated.js +63 -0
- package/src/lib/views/parts/publicHref.js +18 -0
- package/src/lib/views/parts/ticketStatuses.js +7 -0
- package/src/plugin-engine/__tests__/engine.test.js +161 -0
- package/src/plugin-engine/engine.js +80 -12
- package/src/registry/__tests__/registry.test.js +510 -0
- package/src/registry/__tests__/view.test.js +52 -0
- package/src/registry/index.js +700 -51
- package/src/registry/routes.js +62 -0
- package/src/registry/view.js +69 -0
- package/src/routes/RootLayout.svelte +24 -1
- package/src/routes/catalogue/List.svelte +163 -0
- package/src/routes/catalogue/Stage.svelte +355 -0
- package/src/routes/catalogue/__tests__/browserSafe.test.js +13 -0
- package/src/routes/catalogue/__tests__/catalogue.test.js +539 -0
- package/src/routes/catalogue/catalogue.js +129 -0
- package/src/routes/catalogue/deps.js +147 -0
- package/src/routes/catalogue/engineSamples.js +63 -0
- package/src/routes/catalogue/fixtures.js +77 -0
- package/src/routes/catalogue/list.js +37 -0
- package/src/routes/catalogue/model.js +286 -0
- package/src/routes/catalogue/stage.js +69 -0
- package/src/routes/catalogue/views-json.js +24 -0
- package/src/routes/plugin-ui/Layout.svelte +29 -4
- package/src/routes/plugin-ui/Page.svelte +86 -31
- package/src/routes/plugin-ui/load.js +173 -0
- package/src/routes/plugins-client-file.js +8 -3
- package/src/routes/plugins-ui-file.js +60 -0
- package/src/routes/root-layout-load.js +59 -2
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { onDestroy, onMount, setContext } from "svelte";
|
|
2
2
|
import { get, writable } from "svelte/store";
|
|
3
3
|
import { setPanoContext } from "@panomc/sdk/internal";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getDefault,
|
|
6
|
+
getOverride,
|
|
7
|
+
getThemeConfig,
|
|
8
|
+
getThemeProvides,
|
|
9
|
+
hasView,
|
|
10
|
+
resolveView,
|
|
11
|
+
route,
|
|
12
|
+
setThemeMeta,
|
|
13
|
+
} from "$pano/registry/index.js";
|
|
14
|
+
import { setRouteConfig } from "$pano/registry/routes.js";
|
|
5
15
|
import { _ } from "svelte-i18n";
|
|
6
16
|
import copy from "copy-to-clipboard";
|
|
7
17
|
|
|
8
18
|
import { browser } from "$app/environment";
|
|
9
|
-
import { goto } from "$app/navigation";
|
|
19
|
+
import { goto, invalidate, invalidateAll } from "$app/navigation";
|
|
10
20
|
import { navigating, page } from "$app/stores";
|
|
11
21
|
import { base } from "$app/paths";
|
|
12
22
|
import { error, redirect } from "@sveltejs/kit";
|
|
@@ -22,7 +32,8 @@ import tooltip from "$pano/lib/tooltip.util";
|
|
|
22
32
|
|
|
23
33
|
import { addListener } from "$pano/lib/NotificationManager";
|
|
24
34
|
import { initializePlugins, preparePlugins } from "$pano/lib/PluginManager";
|
|
25
|
-
import { executeLifecycle, executeViewLoad } from "$pano/lib/PluginAPI";
|
|
35
|
+
import { executeLifecycle, executeViewLoad, panoApi } from "$pano/lib/PluginAPI";
|
|
36
|
+
import { bindControllerSession, themeHostFactory } from "$pano/lib/controllerHost";
|
|
26
37
|
import { hasPermission } from "$pano/lib/auth.util";
|
|
27
38
|
import { trackPostView } from "$pano/lib/services/posts";
|
|
28
39
|
|
|
@@ -32,13 +43,113 @@ import NoContent from "$pano/lib/components/NoContent.svelte";
|
|
|
32
43
|
import PageActions from "$pano/lib/components/PageActions.svelte";
|
|
33
44
|
import PageTitle from "$pano/lib/components/PageTitle.svelte";
|
|
34
45
|
import PlayerHead from "$pano/lib/components/PlayerHead.svelte";
|
|
46
|
+
import Toast from "$pano/lib/components/Toast.svelte";
|
|
47
|
+
import Sidebar from "$pano/lib/components/Sidebar.svelte";
|
|
48
|
+
import ViewComponent from "$pano/lib/components/ViewComponent.svelte";
|
|
49
|
+
import Hook from "$pano/lib/components/Hook.svelte";
|
|
50
|
+
import PluginBlock from "$pano/lib/components/PluginBlock.svelte";
|
|
51
|
+
import PluginSlot from "$pano/lib/components/PluginSlot.svelte";
|
|
52
|
+
import FallbackScope from "$pano/lib/components/FallbackScope.svelte";
|
|
53
|
+
import { buildStyleTable, createViewWrapper } from "$pano/lib/fallbackStyles.js";
|
|
35
54
|
|
|
36
55
|
const initLanguage = languageStuff.init;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* `virtual:pano-theme-meta` (doc 01 section 4): the view references, claims and home pages the build found in the
|
|
59
|
+
* theme's own files. A theme without the virtual module (or one that fails to load) gets an empty meta.
|
|
60
|
+
*/
|
|
61
|
+
async function readThemeMeta() {
|
|
62
|
+
try {
|
|
63
|
+
const module = await import("virtual:pano-theme-meta");
|
|
64
|
+
|
|
65
|
+
return module?.default ?? module ?? null;
|
|
66
|
+
} catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** The theme-side setup of the open front-end, done once per module instance (server process / browser page). */
|
|
72
|
+
let themeSetup = null;
|
|
73
|
+
|
|
74
|
+
function setupTheme() {
|
|
75
|
+
themeSetup ??= (async () => {
|
|
76
|
+
const themeConfig = getThemeConfig();
|
|
77
|
+
|
|
78
|
+
// the generated hooks.js does this too; a hand-written one may not
|
|
79
|
+
setRouteConfig(themeConfig);
|
|
80
|
+
setThemeMeta(await readThemeMeta());
|
|
81
|
+
panoApi.controllers.setHostFactory(themeHostFactory);
|
|
82
|
+
panoApi.controllers.setThemePins(themeConfig.controllers);
|
|
83
|
+
})();
|
|
84
|
+
|
|
85
|
+
return themeSetup;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The styles of every installed plugin, as plain data. `pano-plugin.json` is read on the server only, so the server
|
|
90
|
+
* load hands this to the browser (doc 03 section 4.4: `styles` metadata). Cached per plugin and UI hash; in
|
|
91
|
+
* development mode a rebuilt plugin is read again.
|
|
92
|
+
*/
|
|
93
|
+
const styleEntries = new Map();
|
|
94
|
+
|
|
95
|
+
/** The fallback-style wrapper of the latest load (it holds that load's plugin style table). */
|
|
96
|
+
let viewWrapper = null;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* `views.wrap` is the fallback-style hook of doc 03 section 4.4: a default plugin view gets the scoped fallback
|
|
100
|
+
* sheet in a theme without Bootstrap; in every other theme it is the identity.
|
|
101
|
+
* @param {string} name `<ns>:<View>`
|
|
102
|
+
* @param {Function} component
|
|
103
|
+
* @param {"default" | "override"} source
|
|
104
|
+
*/
|
|
105
|
+
const wrapView = (name, component, source) => {
|
|
106
|
+
const wrap = viewWrapper?.wrap;
|
|
107
|
+
|
|
108
|
+
return typeof wrap === "function" ? wrap(name, component, source) : component;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* `views.wrapInjected` is the same hook for what an injection's `component` resolved to (a nav item, a sidebar
|
|
113
|
+
* widget, a hook): a named view keeps its plugin's scope, a legacy component gets the `legacy` scope. In a theme with
|
|
114
|
+
* Bootstrap it is the component itself.
|
|
115
|
+
* @param {any} module the resolved module (or component) of the injected item
|
|
116
|
+
*/
|
|
117
|
+
const wrapInjectedView = (module) => {
|
|
118
|
+
const wrap = viewWrapper?.wrapInjected;
|
|
119
|
+
|
|
120
|
+
return typeof wrap === "function" ? wrap(module) : (module?.default ?? module);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
async function readStyleTable(siteInfo) {
|
|
124
|
+
const { readPluginPackage } = await import("@panomc/sdk/core/js/pluginFolder.util.js");
|
|
125
|
+
const found = [];
|
|
126
|
+
|
|
127
|
+
for (const [id, info] of Object.entries(siteInfo?.plugins ?? {})) {
|
|
128
|
+
if (!id || id.includes("/") || id.includes("\\") || id.startsWith(".")) continue;
|
|
129
|
+
|
|
130
|
+
const uiHash = info?.version && typeof info.version === "object" ? info.version.uiHash : info?.uiHash;
|
|
131
|
+
const cacheKey = `${id}:${uiHash ?? ""}`;
|
|
132
|
+
const cacheable = Boolean(uiHash) && !siteInfo.developmentMode;
|
|
133
|
+
let entry = cacheable ? styleEntries.get(cacheKey) : undefined;
|
|
134
|
+
|
|
135
|
+
if (entry === undefined) {
|
|
136
|
+
const pkg = readPluginPackage(`plugins/${id}`);
|
|
137
|
+
|
|
138
|
+
entry = { id, namespace: pkg?.namespace, styles: pkg?.styles, views: pkg?.views };
|
|
139
|
+
if (cacheable) styleEntries.set(cacheKey, entry);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
found.push(entry);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return buildStyleTable(found);
|
|
146
|
+
}
|
|
147
|
+
|
|
37
148
|
const POST_VIEW_ENGAGEMENT_DELAY_MS = 8000;
|
|
38
149
|
|
|
39
150
|
async function sendVisitorVisitRequest({ event, csrfToken, isDemo }) {
|
|
40
151
|
if (isDemo) return;
|
|
41
|
-
ApiUtil.post({ path: "/
|
|
152
|
+
ApiUtil.post({ path: "/visitor-visit", request: event, csrfToken });
|
|
42
153
|
}
|
|
43
154
|
|
|
44
155
|
function extractPostUrlFromPath(pathname) {
|
|
@@ -86,7 +197,7 @@ export async function processServerLoad(event) {
|
|
|
86
197
|
} = event;
|
|
87
198
|
|
|
88
199
|
let siteInfo = await ApiUtil.get({
|
|
89
|
-
path: "/
|
|
200
|
+
path: "/site-info",
|
|
90
201
|
request: event,
|
|
91
202
|
csrfToken
|
|
92
203
|
});
|
|
@@ -94,11 +205,13 @@ export async function processServerLoad(event) {
|
|
|
94
205
|
await preparePlugins(siteInfo);
|
|
95
206
|
|
|
96
207
|
const avatarVersionDate = `v=${Date.now()}`;
|
|
208
|
+
const pluginStyles = await readStyleTable(siteInfo);
|
|
97
209
|
|
|
98
210
|
return {
|
|
99
211
|
user,
|
|
100
212
|
csrfToken,
|
|
101
213
|
siteInfo,
|
|
214
|
+
pluginStyles,
|
|
102
215
|
apiUrlEnv,
|
|
103
216
|
panoWebsiteUrlEnv,
|
|
104
217
|
avatarVersionDate,
|
|
@@ -111,6 +224,7 @@ export async function processLoad(event) {
|
|
|
111
224
|
user,
|
|
112
225
|
csrfToken,
|
|
113
226
|
siteInfo,
|
|
227
|
+
pluginStyles = {},
|
|
114
228
|
apiUrlEnv,
|
|
115
229
|
panoWebsiteUrlEnv,
|
|
116
230
|
avatarVersionDate,
|
|
@@ -118,6 +232,7 @@ export async function processLoad(event) {
|
|
|
118
232
|
parent,
|
|
119
233
|
} = event;
|
|
120
234
|
await parent();
|
|
235
|
+
await setupTheme();
|
|
121
236
|
avatarVersion.set(avatarVersionDate);
|
|
122
237
|
|
|
123
238
|
if (apiUrlEnv) {
|
|
@@ -148,12 +263,21 @@ export async function processLoad(event) {
|
|
|
148
263
|
resolveView("PlayerHead", async () => PlayerHead),
|
|
149
264
|
]);
|
|
150
265
|
|
|
266
|
+
viewWrapper = createViewWrapper({
|
|
267
|
+
FallbackScope,
|
|
268
|
+
getTable: () => pluginStyles,
|
|
269
|
+
getProvides: getThemeProvides,
|
|
270
|
+
dev: Boolean(siteInfo?.developmentMode),
|
|
271
|
+
});
|
|
272
|
+
|
|
151
273
|
setPanoContext({
|
|
152
274
|
page,
|
|
153
275
|
base,
|
|
154
276
|
navigating,
|
|
155
277
|
browser,
|
|
156
278
|
goto,
|
|
279
|
+
invalidate,
|
|
280
|
+
invalidateAll,
|
|
157
281
|
error,
|
|
158
282
|
redirect,
|
|
159
283
|
components: {
|
|
@@ -163,6 +287,23 @@ export async function processLoad(event) {
|
|
|
163
287
|
PageActions: ResolvedPageActions,
|
|
164
288
|
PageTitle: ResolvedPageTitle,
|
|
165
289
|
PlayerHead: ResolvedPlayerHead,
|
|
290
|
+
Toast,
|
|
291
|
+
Sidebar,
|
|
292
|
+
ViewComponent,
|
|
293
|
+
Hook,
|
|
294
|
+
PluginBlock,
|
|
295
|
+
PluginSlot,
|
|
296
|
+
},
|
|
297
|
+
// read by the view proxies of plugin builds (`@panomc/sdk/views`), at render time
|
|
298
|
+
views: {
|
|
299
|
+
getOverride,
|
|
300
|
+
getDefault,
|
|
301
|
+
has: hasView,
|
|
302
|
+
wrap: wrapView,
|
|
303
|
+
wrapInjected: wrapInjectedView,
|
|
304
|
+
},
|
|
305
|
+
routes: {
|
|
306
|
+
resolve: route,
|
|
166
307
|
},
|
|
167
308
|
utils: {
|
|
168
309
|
api: {
|
|
@@ -195,6 +336,7 @@ export async function processLoad(event) {
|
|
|
195
336
|
|
|
196
337
|
const output = {
|
|
197
338
|
session: { user, csrfToken, siteInfo },
|
|
339
|
+
pluginStyles,
|
|
198
340
|
_pageTitleStore: writable(null),
|
|
199
341
|
_breadcrumbsStore: writable(null)
|
|
200
342
|
};
|
|
@@ -206,13 +348,15 @@ export async function processLoad(event) {
|
|
|
206
348
|
// After navbar lifecycle, the two view loads operate on independent viewIds,
|
|
207
349
|
// theme:app:load writes to output but doesn't depend on view results,
|
|
208
350
|
// and initLanguage is fully independent. Run them all in parallel.
|
|
209
|
-
await Promise.all([
|
|
351
|
+
const [, , , language] = await Promise.all([
|
|
210
352
|
executeViewLoad("navbar-right", event),
|
|
211
353
|
executeViewLoad("navbar-profile-dropdown", event),
|
|
212
354
|
executeLifecycle("theme:app:load", output, event),
|
|
213
355
|
initLanguage(siteInfo.locale, event)
|
|
214
356
|
]);
|
|
215
357
|
|
|
358
|
+
output.language = language;
|
|
359
|
+
|
|
216
360
|
if (browser && !get(initialized)) {
|
|
217
361
|
initNotificationListeners();
|
|
218
362
|
}
|
|
@@ -221,6 +365,11 @@ export async function processLoad(event) {
|
|
|
221
365
|
}
|
|
222
366
|
|
|
223
367
|
export function init(data) {
|
|
368
|
+
// SSR: language stores are module-level; re-apply this request's language right before render.
|
|
369
|
+
if (!browser) {
|
|
370
|
+
languageStuff.activateLanguage(data.language);
|
|
371
|
+
}
|
|
372
|
+
|
|
224
373
|
const session = writable(data.session);
|
|
225
374
|
const sidebar = writable(null);
|
|
226
375
|
const sidebarProps = writable({});
|
|
@@ -292,6 +441,11 @@ export function init(data) {
|
|
|
292
441
|
setContext("breadcrumbs", data._breadcrumbsStore);
|
|
293
442
|
setContext("themeSettings", data.session.siteInfo.themeSettings);
|
|
294
443
|
|
|
444
|
+
// browser only: controllers read the session through the host (doc 02 section 1); the server host reads the request
|
|
445
|
+
if (browser) {
|
|
446
|
+
onDestroy(bindControllerSession(session));
|
|
447
|
+
}
|
|
448
|
+
|
|
295
449
|
const onVisibilityChange = () => {
|
|
296
450
|
schedulePostViewTracking(activePostUrl);
|
|
297
451
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { requireNotLogin } from "$pano/lib/Store";
|
|
2
2
|
|
|
3
|
-
export async function processLoad(
|
|
3
|
+
export async function processLoad(event) {
|
|
4
|
+
const { parent } = event;
|
|
4
5
|
const parentData = await parent();
|
|
5
6
|
const { session } = parentData;
|
|
6
7
|
|
|
7
|
-
requireNotLogin(session);
|
|
8
|
+
requireNotLogin(session, event);
|
|
8
9
|
|
|
9
10
|
return parentData;
|
|
10
11
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { requireLogin } from "$pano/lib/Store";
|
|
2
2
|
|
|
3
|
-
export async function processLoad(
|
|
3
|
+
export async function processLoad(event) {
|
|
4
|
+
const { parent } = event;
|
|
4
5
|
const parentData = await parent();
|
|
5
6
|
const { session } = parentData;
|
|
6
7
|
|
|
7
|
-
requireLogin(session);
|
|
8
|
+
requireLogin(session, event);
|
|
8
9
|
|
|
9
10
|
return parentData;
|
|
10
11
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { requireLogin } from "$pano/lib/Store.js";
|
|
2
2
|
|
|
3
|
-
export async function processLoad(
|
|
3
|
+
export async function processLoad(event) {
|
|
4
|
+
const { parent } = event;
|
|
4
5
|
const parentData = await parent();
|
|
5
6
|
const { session } = parentData;
|
|
6
7
|
|
|
7
|
-
requireLogin(session);
|
|
8
|
+
requireLogin(session, event);
|
|
8
9
|
|
|
9
10
|
return parentData;
|
|
10
11
|
}
|
|
@@ -27,13 +27,13 @@ export async function verifyEmail(error, successMessage, loading, data) {
|
|
|
27
27
|
.then((body) => {
|
|
28
28
|
loading.set(false);
|
|
29
29
|
|
|
30
|
-
if (body.
|
|
30
|
+
if (!body.error) {
|
|
31
31
|
successMessage.set("VALIDATION_SUCCESSFUL");
|
|
32
32
|
} else {
|
|
33
|
-
if (body.error === "PLUGIN_DENIED_LOGIN" && body.reason) {
|
|
34
|
-
error.set(body.reason);
|
|
33
|
+
if (body.error.code === "PLUGIN_DENIED_LOGIN" && body.error.details?.reason) {
|
|
34
|
+
error.set(body.error.details.reason);
|
|
35
35
|
} else {
|
|
36
|
-
error.set(body.error);
|
|
36
|
+
error.set(body.error.code);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
})
|
|
@@ -25,13 +25,13 @@ export async function verifyEmail(error, successMessage, loading, data) {
|
|
|
25
25
|
await sendVerifyNewEmail(data.token)
|
|
26
26
|
.then((body) => {
|
|
27
27
|
loading.set(false);
|
|
28
|
-
if (body.
|
|
28
|
+
if (!body.error) {
|
|
29
29
|
successMessage.set("VALIDATION_SUCCESSFUL");
|
|
30
30
|
} else {
|
|
31
|
-
if (body.error === "PLUGIN_DENIED_LOGIN" && body.reason) {
|
|
32
|
-
error.set(body.reason);
|
|
31
|
+
if (body.error.code === "PLUGIN_DENIED_LOGIN" && body.error.details?.reason) {
|
|
32
|
+
error.set(body.error.details.reason);
|
|
33
33
|
} else {
|
|
34
|
-
error.set(body.error);
|
|
34
|
+
error.set(body.error.code);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
})
|
|
@@ -30,7 +30,7 @@ export async function processLoad(event) {
|
|
|
30
30
|
|
|
31
31
|
let data = {
|
|
32
32
|
categories: [],
|
|
33
|
-
categoryPage:
|
|
33
|
+
categoryPage: 1
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
await getTicketCategories({
|
|
@@ -38,11 +38,11 @@ export async function processLoad(event) {
|
|
|
38
38
|
request: event
|
|
39
39
|
}).then((body) => {
|
|
40
40
|
if (body.error) {
|
|
41
|
-
if (body.error === "NOT_EXISTS") {
|
|
42
|
-
throw throwError(404, body.error);
|
|
41
|
+
if (body.error.code === "NOT_EXISTS") {
|
|
42
|
+
throw throwError(404, body.error.code);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
throw throwError(500, body.error);
|
|
45
|
+
throw throwError(500, body.error.code);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
data = body;
|
|
@@ -68,7 +68,7 @@ export async function submit(error, loading, title, message, categoryId) {
|
|
|
68
68
|
loading.set(false);
|
|
69
69
|
|
|
70
70
|
if (body.error) {
|
|
71
|
-
error.set(body.error);
|
|
71
|
+
error.set(body.error.code);
|
|
72
72
|
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -29,11 +29,13 @@ export async function processLoad(event) {
|
|
|
29
29
|
const [data, , homeTopHookProps] = await Promise.all(parallelTasks);
|
|
30
30
|
|
|
31
31
|
if (data.error) {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const code = data.error.code;
|
|
33
|
+
|
|
34
|
+
if (code === "PAGE_NOT_FOUND" || code === "NOT_EXISTS" || code === "CATEGORY_NOT_EXISTS" || code === "BAD_REQUEST") {
|
|
35
|
+
throw error(404, code);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
throw error(500,
|
|
38
|
+
throw error(500, code);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
data.page = page;
|
|
@@ -75,13 +75,26 @@ function setNotifications(notifications, newNotifications) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* The `count` the view compares the loaded list with ("Show more" shows while the list is shorter than it). The
|
|
80
|
+
* cursor decides: `page.nextCursor` null means the list is complete, so the count is the loaded length; a cursor
|
|
81
|
+
* means more is there, so the count is at least one above it, whatever `totalItems` says.
|
|
82
|
+
* @param {{ totalItems?: string | number, nextCursor?: string | null } | undefined} page
|
|
83
|
+
* @param {number} loaded
|
|
84
|
+
*/
|
|
85
|
+
export function countByCursor(page, loaded) {
|
|
86
|
+
if (page?.nextCursor == null) return loaded;
|
|
87
|
+
|
|
88
|
+
return Math.max(parseInt(String(page.totalItems ?? 0)) || 0, loaded + 1);
|
|
89
|
+
}
|
|
90
|
+
|
|
78
91
|
async function loadData({ request }) {
|
|
79
92
|
return new Promise((resolve, reject) => {
|
|
80
93
|
ApiUtil.get({
|
|
81
|
-
path: "/
|
|
94
|
+
path: "/notifications",
|
|
82
95
|
request
|
|
83
96
|
}).then((body) => {
|
|
84
|
-
if (body.
|
|
97
|
+
if (!body.error) {
|
|
85
98
|
resolve(body);
|
|
86
99
|
} else {
|
|
87
100
|
reject(body);
|
|
@@ -99,7 +112,7 @@ export async function processLoad(event) {
|
|
|
99
112
|
|
|
100
113
|
const { session } = parentData;
|
|
101
114
|
|
|
102
|
-
requireLogin(session);
|
|
115
|
+
requireLogin(session, event);
|
|
103
116
|
|
|
104
117
|
// if (event.stuff.NETWORK_ERROR) {
|
|
105
118
|
// output.props.data.NETWORK_ERROR = true;
|
|
@@ -107,14 +120,14 @@ export async function processLoad(event) {
|
|
|
107
120
|
// return output;
|
|
108
121
|
// }
|
|
109
122
|
|
|
110
|
-
const [{ notifications,
|
|
123
|
+
const [{ items: notifications, page }] = await Promise.all([
|
|
111
124
|
loadData({ request: event }),
|
|
112
125
|
loadSidebar(event)
|
|
113
126
|
]);
|
|
114
127
|
|
|
115
128
|
return {
|
|
116
129
|
notifications,
|
|
117
|
-
notificationCount:
|
|
130
|
+
notificationCount: countByCursor(page, notifications.length),
|
|
118
131
|
sidebar: ProfileSidebar,
|
|
119
132
|
sidebarProps: { showDeleteAll: true },
|
|
120
133
|
pageTitle: "pages.notifications.page-title"
|
|
@@ -126,40 +139,50 @@ function getNotifications(notifications, notificationProcessID, count, id) {
|
|
|
126
139
|
if (get(notificationProcessID) !== id) {
|
|
127
140
|
return;
|
|
128
141
|
}
|
|
129
|
-
if (data.
|
|
130
|
-
setNotifications(notifications, data.
|
|
142
|
+
if (!data.error) {
|
|
143
|
+
setNotifications(notifications, data.items);
|
|
131
144
|
|
|
132
|
-
|
|
133
|
-
|
|
145
|
+
// a refresh reads the first page only: it speaks for "more" while no further page is loaded
|
|
146
|
+
if (get(notifications).length <= data.items.length) count.set(countByCursor(data.page, get(notifications).length));
|
|
147
|
+
else count.set(Math.max(parseInt(data.page.totalItems) || 0, get(count)));
|
|
148
|
+
scheduleMarkReadVisualEffects(notifications, data.items, null);
|
|
134
149
|
}
|
|
135
150
|
});
|
|
136
151
|
}
|
|
137
152
|
|
|
153
|
+
// the count store that belongs to a list store, so `loadMore(notifications, loadMoreLoading)` keeps its signature
|
|
154
|
+
const countOf = new WeakMap();
|
|
155
|
+
|
|
138
156
|
export function loadMore(notifications, loadMoreLoading) {
|
|
139
157
|
loadMoreLoading.set(true);
|
|
140
158
|
|
|
141
|
-
ApiUtil.get({
|
|
142
|
-
path: `/
|
|
159
|
+
return ApiUtil.get({
|
|
160
|
+
path: `/notifications/${
|
|
143
161
|
get(notifications)[get(notifications).length - 1].id
|
|
144
162
|
}/more`
|
|
145
163
|
}).then((body) => {
|
|
146
|
-
if (body.
|
|
147
|
-
body.
|
|
164
|
+
if (!body.error) {
|
|
165
|
+
(body.items ?? []).forEach((notification) => {
|
|
148
166
|
notifications.update((value) =>
|
|
149
167
|
value.insert(value.length, notification)
|
|
150
168
|
);
|
|
151
169
|
});
|
|
152
170
|
|
|
153
|
-
|
|
171
|
+
// "Show more" is offered while `page.nextCursor` is not null (see countByCursor)
|
|
172
|
+
const count = countOf.get(notifications);
|
|
173
|
+
|
|
174
|
+
if (count) count.set(countByCursor({ ...body.page, totalItems: body.page?.totalItems ?? get(count) }, get(notifications).length));
|
|
154
175
|
}
|
|
176
|
+
|
|
177
|
+
loadMoreLoading.set(false);
|
|
155
178
|
});
|
|
156
179
|
}
|
|
157
180
|
|
|
158
181
|
export function onDeleteNotificationClick(notifications, count, id) {
|
|
159
182
|
ApiUtil.delete({
|
|
160
|
-
path: `/
|
|
183
|
+
path: `/notifications/${id}`
|
|
161
184
|
}).then((body) => {
|
|
162
|
-
if (body.
|
|
185
|
+
if (!body.error) {
|
|
163
186
|
|
|
164
187
|
get(notifications).forEach((notification) => {
|
|
165
188
|
if (notification.id === id) {
|
|
@@ -212,6 +235,7 @@ export function onDeleteAllClick(notificationProcessID, interval) {
|
|
|
212
235
|
export function init(data) {
|
|
213
236
|
const notifications = writable(data.notifications || []);
|
|
214
237
|
const count = writable(data.notificationCount || 0);
|
|
238
|
+
countOf.set(notifications, count);
|
|
215
239
|
const notificationProcessID = writable(0);
|
|
216
240
|
const checkTime = writable(0);
|
|
217
241
|
const interval = writable();
|
|
@@ -22,11 +22,11 @@ export async function processLoad(event) {
|
|
|
22
22
|
]);
|
|
23
23
|
|
|
24
24
|
if (profileBody.error) {
|
|
25
|
-
if (profileBody.error === "NOT_EXISTS") {
|
|
26
|
-
throw error(404, profileBody.error);
|
|
25
|
+
if (profileBody.error.code === "NOT_EXISTS") {
|
|
26
|
+
throw error(404, profileBody.error.code);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
throw error(500, profileBody.error);
|
|
29
|
+
throw error(500, profileBody.error.code);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
data = profileBody;
|
|
@@ -32,11 +32,11 @@ export async function processLoad(event) {
|
|
|
32
32
|
await getPostDetail({ url: event.params.url, request: event }).then(
|
|
33
33
|
(body) => {
|
|
34
34
|
if (body.error) {
|
|
35
|
-
if (body.error === "POST_NOT_FOUND") {
|
|
36
|
-
throw error(404, body.error);
|
|
35
|
+
if (body.error.code === "POST_NOT_FOUND") {
|
|
36
|
+
throw error(404, body.error.code);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
throw error(500, body.error);
|
|
39
|
+
throw error(500, body.error.code);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
data = body;
|
|
@@ -25,16 +25,16 @@ export async function onSubmit(error, message, loading, newPassword, newPassword
|
|
|
25
25
|
.then((body) => {
|
|
26
26
|
loading.set(false);
|
|
27
27
|
|
|
28
|
-
if (body.
|
|
28
|
+
if (!body.error) {
|
|
29
29
|
message.set("RENEW_PASSWORD_SUCCESSFUL");
|
|
30
30
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
if (body.error === "PLUGIN_DENIED_LOGIN" && body.reason) {
|
|
35
|
-
error.set(body.reason);
|
|
34
|
+
if (body.error.code === "PLUGIN_DENIED_LOGIN" && body.error.details?.reason) {
|
|
35
|
+
error.set(body.error.details.reason);
|
|
36
36
|
} else {
|
|
37
|
-
error.set(body.error);
|
|
37
|
+
error.set(body.error.code);
|
|
38
38
|
}
|
|
39
39
|
})
|
|
40
40
|
.catch(() => {
|
|
@@ -11,7 +11,7 @@ export async function processLoad(event) {
|
|
|
11
11
|
|
|
12
12
|
const { session } = parentData;
|
|
13
13
|
|
|
14
|
-
requireNotLogin(session);
|
|
14
|
+
requireNotLogin(session, event);
|
|
15
15
|
|
|
16
16
|
await executeLifecycle("theme:reset-password:load", {}, event);
|
|
17
17
|
await executeViewLoad("reset-password-content", event);
|
|
@@ -28,22 +28,22 @@ export async function onSubmit(error, message, loading, usernameOrEmail) {
|
|
|
28
28
|
.then((body) => {
|
|
29
29
|
loading.set(false);
|
|
30
30
|
|
|
31
|
-
if (body.
|
|
31
|
+
if (!body.error) {
|
|
32
32
|
message.set("RESET_PASSWORD_SUCCESSFUL");
|
|
33
33
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if (body.error === "NOT_EXISTS") {
|
|
37
|
+
if (body.error.code === "NOT_EXISTS") {
|
|
38
38
|
message.set("RESET_PASSWORD_SUCCESSFUL");
|
|
39
39
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
if (body.error === "PLUGIN_DENIED_LOGIN" && body.reason) {
|
|
44
|
-
error.set(body.reason);
|
|
43
|
+
if (body.error.code === "PLUGIN_DENIED_LOGIN" && body.error.details?.reason) {
|
|
44
|
+
error.set(body.error.details.reason);
|
|
45
45
|
} else {
|
|
46
|
-
error.set(body.error);
|
|
46
|
+
error.set(body.error.code);
|
|
47
47
|
}
|
|
48
48
|
})
|
|
49
49
|
.catch(() => {
|