create-lupine 1.2.0 → 1.3.1
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/README.md +13 -7
- package/index.js +236 -109
- package/package.json +1 -1
- package/templates/common/.agents/skills/lupine-framework/SKILL.md +3 -3
- package/templates/common/.agents/skills/lupine-framework/references/backend-api.md +16 -1
- package/templates/common/.agents/skills/lupine-framework/references/icon-handling.md +1 -1
- package/templates/common/.agents/skills/lupine-framework/references/mobile-interactions.md +17 -88
- package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +47 -24
- package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +1 -0
- package/templates/common/.agents/skills/lupine-framework/references/reactivity-and-state.md +2 -2
- package/templates/common/.agents/skills/lupine-framework/references/styling-and-themes.md +3 -1
- package/templates/common/.env.development +2 -0
- package/templates/common/.env.mobile +4 -3
- package/templates/common/_env +10 -5
- package/templates/common/apps/server/README.md +10 -0
- package/templates/common/dev/cp-folder.js +9 -4
- package/templates/lupine-template-cv-starter/README.md +33 -1
- package/templates/lupine-template-cv-starter/app/package.json +20 -0
- package/templates/lupine-template-cv-starter/app/src/app.tsx +6 -0
- package/templates/lupine-template-cv-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-cv-starter/app/src/index.test.tsx +71 -0
- package/templates/lupine-template-cv-starter/app/src/index.web.tsx +28 -0
- package/templates/lupine-template-cv-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-cv-starter/lupine.json +8 -7
- package/templates/lupine-template-cv-starter/web/src/index.html +9 -2
- package/templates/lupine-template-cv-starter/web/src/index.tsx +9 -14
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.html +9 -2
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +4 -20
- package/templates/lupine-template-doc-starter/README.md +33 -1
- package/templates/lupine-template-doc-starter/app/package.json +20 -0
- package/templates/lupine-template-doc-starter/app/src/app.tsx +6 -0
- package/templates/lupine-template-doc-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-doc-starter/app/src/index.test.tsx +78 -0
- package/templates/lupine-template-doc-starter/app/src/index.web.tsx +28 -0
- package/templates/lupine-template-doc-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-doc-starter/lupine.json +8 -7
- package/templates/lupine-template-doc-starter/web/src/index.html +9 -2
- package/templates/lupine-template-doc-starter/web/src/index.tsx +9 -14
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.html +9 -2
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +4 -20
- package/templates/lupine-template-fullstack-note/README.md +83 -0
- package/templates/{lupine-template-cv-starter → lupine-template-fullstack-note}/api/package.json +2 -2
- package/templates/lupine-template-fullstack-note/api/resources/install.mysql.sql +32 -0
- package/templates/lupine-template-fullstack-note/api/resources/install.sqlite.sql +27 -0
- package/templates/lupine-template-fullstack-note/api/src/service/answer.ts +39 -0
- package/templates/lupine-template-fullstack-note/api/src/service/api.ts +52 -0
- package/templates/lupine-template-fullstack-note/api/src/service/db.ts +78 -0
- package/templates/lupine-template-fullstack-note/api/src/service/notes-api.ts +86 -0
- package/templates/lupine-template-fullstack-note/api/src/service/root-api.ts +19 -0
- package/templates/lupine-template-fullstack-note/api/src/service/user-api.ts +182 -0
- package/templates/lupine-template-fullstack-note/app/package.json +19 -0
- package/templates/lupine-template-fullstack-note/app/src/app.tsx +75 -0
- package/templates/lupine-template-fullstack-note/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-fullstack-note/app/src/index.test.tsx +373 -0
- package/templates/lupine-template-fullstack-note/app/src/index.web.tsx +20 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/components.tsx +65 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/details.tsx +38 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/discover.tsx +25 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/home.tsx +76 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/inbox.tsx +49 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/login.tsx +54 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/me.tsx +32 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/notes.tsx +128 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/settings.tsx +45 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/AppMenu.tsx +44 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/api.ts +159 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/data.ts +20 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/locales/ja.ts +80 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/locales/zh-CN.ts +80 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/texts.ts +14 -0
- package/templates/lupine-template-fullstack-note/app/tsconfig.json +17 -0
- package/templates/lupine-template-fullstack-note/lupine.json +25 -0
- package/templates/lupine-template-fullstack-note/web/assets/favicon.ico +0 -0
- package/templates/{lupine-template-doc-starter/api → lupine-template-fullstack-note/web}/package.json +2 -2
- package/templates/lupine-template-fullstack-note/web/src/index.html +23 -0
- package/templates/lupine-template-fullstack-note/web/src/index.tsx +15 -0
- package/templates/lupine-template-fullstack-starter/README.md +64 -14
- package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +2 -2
- package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +2 -2
- package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +2 -2
- package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +72 -47
- package/templates/lupine-template-fullstack-starter/app/package.json +20 -0
- package/templates/lupine-template-fullstack-starter/app/src/app.tsx +76 -0
- package/templates/lupine-template-fullstack-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-fullstack-starter/app/src/index.test.tsx +276 -0
- package/templates/lupine-template-fullstack-starter/app/src/index.web.tsx +28 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/about.tsx +27 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/contact.tsx +41 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/favorite.tsx +27 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/home.tsx +63 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/login.tsx +63 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/mine.tsx +44 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/profile.tsx +58 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/register.tsx +48 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/reset-password.tsx +41 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/settings.tsx +33 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/story.tsx +46 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/api.ts +127 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/parts.tsx +100 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/stories.ts +65 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/texts.ts +79 -0
- package/templates/lupine-template-fullstack-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-fullstack-starter/lupine.json +6 -7
- package/templates/lupine-template-fullstack-starter/web/src/admin/admin-patch.tsx +34 -0
- package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/home-search-component.tsx +18 -25
- package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-card.tsx +17 -8
- package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-list.tsx +1 -2
- package/templates/lupine-template-fullstack-starter/web/src/{admin_dev → admin}/index.html +1 -0
- package/templates/lupine-template-fullstack-starter/web/src/{admin_dev → admin}/index.tsx +13 -28
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-cfg.tsx +23 -19
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-item-edit.tsx +3 -4
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-item-list.tsx +2 -3
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-user.tsx +15 -20
- package/templates/lupine-template-fullstack-starter/web/src/index.html +8 -2
- package/templates/lupine-template-fullstack-starter/web/src/index.tsx +11 -150
- package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +7 -25
- package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +0 -3
- package/templates/lupine-template-fullstack-starter/web/src/styles/theme.ts +1 -2
- package/templates/lupine-template-responsive-starter/README.md +46 -2
- package/templates/lupine-template-responsive-starter/app/package.json +19 -0
- package/templates/lupine-template-responsive-starter/app/src/app.tsx +80 -0
- package/templates/lupine-template-responsive-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-responsive-starter/app/src/index.test.tsx +283 -0
- package/templates/lupine-template-responsive-starter/app/src/index.web.tsx +31 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/about.tsx +23 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/finance.tsx +48 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/mine.tsx +60 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/not-found.tsx +9 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/note-detail.tsx +43 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/note-edit.tsx +45 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/note-search.tsx +62 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/notes.tsx +71 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/settings.tsx +55 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/tools.tsx +112 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/icons.ts +7 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/layout.ts +18 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/locales/zh-CN.ts +89 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/menu.tsx +81 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/nav.ts +12 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/store.ts +72 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/texts.ts +11 -0
- package/templates/lupine-template-responsive-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-responsive-starter/lupine.json +7 -6
- package/templates/lupine-template-responsive-starter/web/src/index.html +9 -2
- package/templates/lupine-template-responsive-starter/web/src/index.tsx +9 -25
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.html +12 -6
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +12 -22
- package/templates/common/apps/server/src/app-loader.ts +0 -4
- package/templates/lupine-template-cv-starter/api/resources/config_default.json +0 -6
- package/templates/lupine-template-cv-starter/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-cv-starter/api/src/index.ts +0 -15
- package/templates/lupine-template-cv-starter/web/src/client-env-keys.ts +0 -5
- package/templates/lupine-template-cv-starter/web/src/styles/base-css.ts +0 -15
- package/templates/lupine-template-doc-starter/api/resources/config_default.json +0 -6
- package/templates/lupine-template-doc-starter/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-doc-starter/api/src/index.ts +0 -15
- package/templates/lupine-template-doc-starter/api/src/resources/config_default.json +0 -6
- package/templates/lupine-template-doc-starter/api/src/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-doc-starter/web/src/client-env-keys.ts +0 -5
- package/templates/lupine-template-doc-starter/web/src/styles/base-css.ts +0 -15
- package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-about.tsx +0 -16
- package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-patch.ts +0 -22
- package/templates/lupine-template-fullstack-starter/web/src/components/footer-menu.tsx +0 -52
- package/templates/lupine-template-fullstack-starter/web/src/components/footer.tsx +0 -15
- package/templates/lupine-template-fullstack-starter/web/src/components/header.tsx +0 -75
- package/templates/lupine-template-fullstack-starter/web/src/components/login-code-zh.tsx +0 -162
- package/templates/lupine-template-fullstack-starter/web/src/components/login-code.tsx +0 -165
- package/templates/lupine-template-fullstack-starter/web/src/components/login-zh.tsx +0 -118
- package/templates/lupine-template-fullstack-starter/web/src/components/login.tsx +0 -122
- package/templates/lupine-template-fullstack-starter/web/src/components/not-found-page.tsx +0 -12
- package/templates/lupine-template-fullstack-starter/web/src/components/register-zh.tsx +0 -161
- package/templates/lupine-template-fullstack-starter/web/src/components/register.tsx +0 -163
- package/templates/lupine-template-fullstack-starter/web/src/components/reset-password-zh.tsx +0 -166
- package/templates/lupine-template-fullstack-starter/web/src/components/reset-password.tsx +0 -177
- package/templates/lupine-template-fullstack-starter/web/src/components/user-info.tsx +0 -84
- package/templates/lupine-template-fullstack-starter/web/src/frames/admin-page-frame.tsx +0 -48
- package/templates/lupine-template-fullstack-starter/web/src/frames/frame1-page-frame.tsx +0 -61
- package/templates/lupine-template-fullstack-starter/web/src/frames/frame2-page-frame.tsx +0 -61
- package/templates/lupine-template-fullstack-starter/web/src/frames/top-frame.tsx +0 -23
- package/templates/lupine-template-fullstack-starter/web/src/frames/user-page-frame.tsx +0 -90
- package/templates/lupine-template-fullstack-starter/web/src/models/index.ts +0 -15
- package/templates/lupine-template-fullstack-starter/web/src/pages/contact.tsx +0 -105
- package/templates/lupine-template-fullstack-starter/web/src/pages/page1-page.tsx +0 -38
- package/templates/lupine-template-fullstack-starter/web/src/pages/page2-page.tsx +0 -38
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-favorite-page.tsx +0 -58
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-home-page.tsx +0 -27
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-mine-page.tsx +0 -54
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page-zh.tsx +0 -112
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page.tsx +0 -112
- package/templates/lupine-template-fullstack-starter/web/src/pages/user1-page.tsx +0 -57
- package/templates/lupine-template-fullstack-starter/web/src/services/shared-data.ts +0 -19
- package/templates/lupine-template-fullstack-starter/web/src/styles/app.css +0 -0
- package/templates/lupine-template-responsive-starter/api/package.json +0 -6
- package/templates/lupine-template-responsive-starter/api/resources/config_default.json +0 -6
- package/templates/lupine-template-responsive-starter/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-responsive-starter/api/src/service/root-api.ts +0 -18
- package/templates/lupine-template-responsive-starter/web/src/app-icons.ts +0 -76
- package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +0 -93
- package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +0 -87
- package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +0 -81
- package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +0 -211
- package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +0 -107
- package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +0 -110
- package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +0 -144
- package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +0 -188
- package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +0 -95
- package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +0 -169
- package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +0 -53
- package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +0 -32
- package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +0 -35
- package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +0 -444
- package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +0 -318
- package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +0 -35
- package/templates/lupine-template-responsive-starter/web/src/services/local-notes-service.ts +0 -87
- package/templates/lupine-template-responsive-starter/web/src/services/mine-service.ts +0 -45
- package/templates/lupine-template-responsive-starter/web/src/styles/app.css +0 -0
- package/templates/lupine-template-responsive-starter/web/src/styles/base-css.ts +0 -65
- package/templates/lupine-template-responsive-starter/web/src/styles/global.css +0 -2130
- package/templates/lupine-template-responsive-starter/web/src/styles/theme.ts +0 -17
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/01-experience/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/02-projects/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/03-skills/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/04-education/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/01-experience/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/02-projects/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/03-skills/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/04-education/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/01-experience/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/02-projects/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/03-skills/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/04-education/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/01-experience/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/02-projects/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/03-skills/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/04-education/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/list.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/install.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/started.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/list.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/install.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/started.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/list.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/install.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/started.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/list.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/install.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/started.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
- /package/templates/{lupine-template-responsive-starter → lupine-template-fullstack-note}/api/src/index.ts +0 -0
- /package/templates/lupine-template-fullstack-starter/{web/assets/images → app/assets}/sample.png +0 -0
- /package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-props.ts +0 -0
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import { createSignal, CssProps,
|
|
2
|
-
import {
|
|
1
|
+
import { createSignal, CssProps, onMount } from 'lupine.web';
|
|
2
|
+
import { adminFrameHelper } from 'lupine.api/admin';
|
|
3
|
+
import { AdminItemEditPage } from '../pages/admin-item-edit';
|
|
4
|
+
import { Toast } from 'lupine.native.components';
|
|
3
5
|
import { StoryListComponent } from './story-list';
|
|
4
6
|
import { StoryCardShortProps } from './story-props';
|
|
7
|
+
// the sample stories of the app
|
|
8
|
+
import { stories } from '../../../../app/src/shell/stories';
|
|
5
9
|
|
|
10
|
+
// A real site gets them from its API: fetchData('/api/stories')
|
|
6
11
|
export const getMusicList = async (management: boolean) => {
|
|
7
|
-
// const result = await getRenderPageProps().renderPageFunctions.fetchData('/api/music-list');
|
|
8
|
-
// console.log('====getMusicList', result);
|
|
9
|
-
// if (!result.json || result.json.status !== 'ok') {
|
|
10
|
-
// // NoticeMessage.sendMessage('Failed to get user info.', NotificationColor.Error);
|
|
11
|
-
// return null;
|
|
12
|
-
// }
|
|
13
12
|
return {
|
|
14
|
-
count:
|
|
13
|
+
count: stories.length,
|
|
15
14
|
management,
|
|
16
|
-
results:
|
|
17
|
-
(
|
|
15
|
+
results: stories.map(
|
|
16
|
+
(s) =>
|
|
18
17
|
({
|
|
19
|
-
id:
|
|
20
|
-
title:
|
|
21
|
-
cover_file:
|
|
22
|
-
author:
|
|
23
|
-
view_count:
|
|
24
|
-
download_count:
|
|
25
|
-
collect_count:
|
|
18
|
+
id: s.id,
|
|
19
|
+
title: s.title,
|
|
20
|
+
cover_file: s.cover,
|
|
21
|
+
author: s.author,
|
|
22
|
+
view_count: s.views,
|
|
23
|
+
download_count: 0,
|
|
24
|
+
collect_count: s.favorites,
|
|
26
25
|
start_time_seconds: new Date().getTime() / 1000,
|
|
27
26
|
} as StoryCardShortProps)
|
|
28
27
|
),
|
|
@@ -94,16 +93,10 @@ export const HomeSearchComponent = (props: SearchMusicProps) => {
|
|
|
94
93
|
);
|
|
95
94
|
};
|
|
96
95
|
const onAdd = () => {
|
|
97
|
-
|
|
98
|
-
};
|
|
99
|
-
const onDragRefresh = async (close: DragRefreshCloseProps) => {
|
|
100
|
-
NotificationMessage.sendMessage('Refreshing...', NotificationColor.Info);
|
|
101
|
-
await onSearch();
|
|
102
|
-
close();
|
|
96
|
+
adminFrameHelper.addPanel('New', <AdminItemEditPage id='new' />);
|
|
103
97
|
};
|
|
104
98
|
return (
|
|
105
99
|
<div css={css} class='search-music-box'>
|
|
106
|
-
<DragFresh container='.search-music-box' onDragRefresh={onDragRefresh} />
|
|
107
100
|
<div className='row-box search-box m-auto p-m w-100p'>
|
|
108
101
|
<input class='input-base txt-search flex-1' type='text' placeholder='Please input keywords' />
|
|
109
102
|
<button class='button-base btn-search' onClick={onSearch}>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CssProps, Icon } from 'lupine.web';
|
|
2
|
+
import { adminFrameHelper } from 'lupine.api/admin';
|
|
3
|
+
import { AdminItemEditPage } from '../pages/admin-item-edit';
|
|
4
|
+
import { ActionSheet, Toast } from 'lupine.native.components';
|
|
5
|
+
import * as icons from 'lupine.core/icons';
|
|
3
6
|
import { StoryCardShortProps } from './story-props';
|
|
4
7
|
|
|
5
8
|
export const StoryCard = (props: StoryCardShortProps) => {
|
|
@@ -56,12 +59,13 @@ export const StoryCard = (props: StoryCardShortProps) => {
|
|
|
56
59
|
};
|
|
57
60
|
|
|
58
61
|
const onEdit = () => {
|
|
59
|
-
|
|
62
|
+
adminFrameHelper.addPanel(`Edit ${props.id}`, <AdminItemEditPage id={String(props.id)} />);
|
|
60
63
|
};
|
|
61
64
|
const onDelete = async () => {
|
|
62
|
-
|
|
65
|
+
const index = await ActionSheet.select({ title: 'Are you sure you want to delete this record and related files?', options: ['Delete'], cancelText: 'Cancel' });
|
|
66
|
+
if (index === 0) {
|
|
63
67
|
props.onDeleted?.();
|
|
64
|
-
|
|
68
|
+
Toast.success('Delete successfully');
|
|
65
69
|
}
|
|
66
70
|
};
|
|
67
71
|
return (
|
|
@@ -76,12 +80,17 @@ export const StoryCard = (props: StoryCardShortProps) => {
|
|
|
76
80
|
</button>
|
|
77
81
|
</div>
|
|
78
82
|
)}
|
|
79
|
-
|
|
83
|
+
{/* the page of the story in the app */}
|
|
84
|
+
<a class='story-card-link' href={`/story/${props.id}`}>
|
|
80
85
|
<div class='story-card-img-box'>
|
|
81
86
|
<img class='story-card-img' src={props.cover_file} />
|
|
82
87
|
<div class='story-card-img-tips'>
|
|
83
|
-
<span class='view_count'>
|
|
84
|
-
|
|
88
|
+
<span class='view_count'>
|
|
89
|
+
<Icon name={icons.eye} /> {props.view_count}
|
|
90
|
+
</span>{' '}
|
|
91
|
+
<span class='collect_count'>
|
|
92
|
+
<Icon name={icons.heart} /> {props.collect_count}
|
|
93
|
+
</span>
|
|
85
94
|
</div>
|
|
86
95
|
</div>
|
|
87
96
|
<div class='story-card-row story-card-title'>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { createSignal, CssProps, For } from 'lupine.web';
|
|
2
|
-
import { adjustedMediaQueryRange, MediaQueryDirection, MediaQueryRange } from 'lupine.web.components';
|
|
1
|
+
import { createSignal, CssProps, For, adjustedMediaQueryRange, MediaQueryDirection, MediaQueryRange } from 'lupine.web';
|
|
3
2
|
import { StoryCardShortProps } from './story-props';
|
|
4
3
|
import { StoryCard } from './story-card';
|
|
5
4
|
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
<!--META-ENV-START-->
|
|
13
13
|
<!--META-ENV-END-->
|
|
14
14
|
<link rel="shortcut icon" href="/assets/favicon.ico?t={hash}" type="image/x-icon" />
|
|
15
|
+
<!-- the icons of the pages of lupine.api (ifc-icon): a font made with web/icons-font.config.js -->
|
|
15
16
|
<link rel="stylesheet" type="text/css" href="/assets/icons-font/style.css?t={hash}" />
|
|
16
17
|
<link rel="stylesheet" type="text/css" href="{SUBDIR}/index.css?t={hash}" />
|
|
17
18
|
<script defer src="{SUBDIR}/index.js?t={hash}"></script>
|
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
// css order is important
|
|
2
2
|
import '../styles/global.css';
|
|
3
|
-
import '../styles/app.css';
|
|
4
3
|
|
|
5
4
|
import { adminFrameHelper, devAdminPageRouter } from 'lupine.api/admin';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
bindRenderPageFunctions,
|
|
9
|
-
bindRouter,
|
|
10
|
-
bindTheme,
|
|
11
|
-
debugWatch,
|
|
12
|
-
isFrontEnd,
|
|
13
|
-
PageProps,
|
|
14
|
-
PageRouter,
|
|
15
|
-
setDefaultPageTitle,
|
|
16
|
-
webEnv,
|
|
17
|
-
} from 'lupine.web';
|
|
18
|
-
import { demoPageRouter, Redirect } from 'lupine.web.components';
|
|
5
|
+
import { bindAppGlobalStyle, bindRenderPageFunctions, bindRouter, bindTheme, PageProps, PageRouter, setDefaultPageTitle, Redirect } from 'lupine.web';
|
|
6
|
+
import { DemoPage } from 'lupine.web.components/demo';
|
|
19
7
|
import { themes } from '../styles/theme';
|
|
20
8
|
import { baseCss } from '../styles/base-css';
|
|
21
9
|
import { baseUrl, fetchData } from '../services/fetch-data';
|
|
22
10
|
import { patchAdminFrame } from './admin-patch';
|
|
23
|
-
import { setCookieUser } from '../services/shared-data';
|
|
24
|
-
import { ClientEnvKeys } from '../models/client-env-keys';
|
|
25
11
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
// The admin pages (/admin, in the browser only), an entry of its own (lupine.json). One page for both: an admin of the
|
|
13
|
+
// app (signed in in the app, or here) sees the pages of the site (Site: items, users, the website); the developer
|
|
14
|
+
// (DEV_ADMIN_USER / DEV_ADMIN_PASS of .env) sees the tools too: the database, logs, files, the server, releases,
|
|
15
|
+
// settings. /admin/demo: the examples of all the components.
|
|
29
16
|
|
|
30
17
|
export const checkDevAndAppAuth = async (props: PageProps) => {
|
|
31
18
|
adminFrameHelper.setIsDevAdmin(false);
|
|
@@ -34,31 +21,29 @@ export const checkDevAndAppAuth = async (props: PageProps) => {
|
|
|
34
21
|
return <div></div>;
|
|
35
22
|
}
|
|
36
23
|
|
|
37
|
-
// check dev admin
|
|
38
24
|
const data = await props.renderPageFunctions.fetchData('/api/admin/auth');
|
|
39
25
|
if (data && data.json && data.json.devLogin) {
|
|
40
26
|
adminFrameHelper.setIsDevAdmin(true);
|
|
41
27
|
return null;
|
|
42
28
|
}
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
// an admin of the app (the API checks it again for each request)
|
|
30
|
+
if (data && data.json && data.json.appLogin && data.json.user && data.json.user.admin === '1') {
|
|
45
31
|
return null;
|
|
46
32
|
}
|
|
47
|
-
if (props.url !== '/
|
|
48
|
-
return Redirect({ url: '/
|
|
33
|
+
if (props.url !== '/admin/login') {
|
|
34
|
+
return Redirect({ url: '/admin/login' });
|
|
49
35
|
}
|
|
50
36
|
return null;
|
|
51
37
|
};
|
|
52
38
|
bindTheme('light', themes);
|
|
53
39
|
bindAppGlobalStyle('comm-css', baseCss, false, true);
|
|
54
|
-
setDefaultPageTitle('
|
|
40
|
+
setDefaultPageTitle('Lupine Full-stack Starter - admin');
|
|
55
41
|
|
|
56
42
|
bindRenderPageFunctions({ fetchData, baseUrl });
|
|
57
43
|
|
|
58
44
|
patchAdminFrame();
|
|
59
45
|
const pageRouter = new PageRouter();
|
|
60
|
-
// devadmin and appadmin can access
|
|
61
46
|
devAdminPageRouter.setFilter(checkDevAndAppAuth);
|
|
62
|
-
pageRouter.use('/
|
|
63
|
-
pageRouter.use('/
|
|
47
|
+
pageRouter.use('/admin/demo', DemoPage);
|
|
48
|
+
pageRouter.use('/admin', devAdminPageRouter);
|
|
64
49
|
bindRouter(pageRouter);
|
package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-cfg.tsx
RENAMED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { uploadFile } from 'lupine.core';
|
|
2
|
+
import { Toast } from 'lupine.native.components';
|
|
3
|
+
import { getRenderPageProps, CssProps, MediaQueryMaxWidth } from 'lupine.web';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
/** the value of an input of the page */
|
|
6
|
+
const valueOf = (selector: string) => (document.querySelector(selector) as HTMLInputElement | null)?.value;
|
|
7
|
+
|
|
8
|
+
export const AdminCfgPage = async () => {
|
|
5
9
|
const css: CssProps = {
|
|
6
10
|
display: 'flex',
|
|
7
11
|
flexDirection: 'column',
|
|
@@ -34,35 +38,35 @@ export const AdminCfgPage = async (props: PageProps) => {
|
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
const uploadImgFile = async (sector: string, fname: string) => {
|
|
37
|
-
const file = (
|
|
41
|
+
const file = (document.querySelector(sector) as HTMLInputElement)!.files;
|
|
38
42
|
if (!file || file.length !== 1) {
|
|
39
43
|
return;
|
|
40
44
|
}
|
|
41
45
|
const ext = file[0].name.split('.').pop();
|
|
42
46
|
if (ext !== 'png' && ext !== 'jpg' && ext !== 'jpeg') {
|
|
43
|
-
|
|
47
|
+
Toast.error('Please select an image file');
|
|
44
48
|
return;
|
|
45
49
|
}
|
|
46
50
|
const result = await uploadFile(file[0], '/api/add-cfg-file?fn=' + fname + '.' + ext);
|
|
47
51
|
if (result !== true) {
|
|
48
|
-
|
|
52
|
+
Toast.error('Failed to upload file');
|
|
49
53
|
return;
|
|
50
54
|
}
|
|
51
55
|
};
|
|
52
56
|
|
|
53
57
|
const onSave = async () => {
|
|
54
|
-
const title =
|
|
55
|
-
const footer =
|
|
56
|
-
const section1 =
|
|
57
|
-
const section2 =
|
|
58
|
-
const section3 =
|
|
59
|
-
const section4 =
|
|
60
|
-
const ourValueTitle =
|
|
61
|
-
const ourValue =
|
|
62
|
-
const pageLimit =
|
|
63
|
-
const sitePaypal =
|
|
64
|
-
const siteEmail =
|
|
65
|
-
const siteUrl =
|
|
58
|
+
const title = valueOf('.f-title');
|
|
59
|
+
const footer = valueOf('.f-footer');
|
|
60
|
+
const section1 = valueOf('.f-section1');
|
|
61
|
+
const section2 = valueOf('.f-section2');
|
|
62
|
+
const section3 = valueOf('.f-section3');
|
|
63
|
+
const section4 = valueOf('.f-section4');
|
|
64
|
+
const ourValueTitle = valueOf('.f-value-t');
|
|
65
|
+
const ourValue = valueOf('.f-value');
|
|
66
|
+
const pageLimit = valueOf('.f-pageLimit');
|
|
67
|
+
const sitePaypal = valueOf('.f-sitePaypal');
|
|
68
|
+
const siteEmail = valueOf('.f-siteEmail');
|
|
69
|
+
const siteUrl = valueOf('.f-siteUrl');
|
|
66
70
|
|
|
67
71
|
await uploadImgFile('.img-logo', 'logo');
|
|
68
72
|
|
|
@@ -81,7 +85,7 @@ export const AdminCfgPage = async (props: PageProps) => {
|
|
|
81
85
|
siteUrl,
|
|
82
86
|
};
|
|
83
87
|
|
|
84
|
-
const siteLogo = (
|
|
88
|
+
const siteLogo = (document.querySelector('.img-logo') as HTMLInputElement)!.files;
|
|
85
89
|
if (siteLogo && siteLogo.length === 1) {
|
|
86
90
|
const filename = 'logo.' + siteLogo[0].name.split('.').pop();
|
|
87
91
|
data['siteLogo'] = filename;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { MediaQueryRange } from 'lupine.web
|
|
2
|
-
import { CssProps, PageProps } from 'lupine.web';
|
|
1
|
+
import { CssProps, MediaQueryRange } from 'lupine.web';
|
|
3
2
|
|
|
4
|
-
export const AdminItemEditPage = async (props:
|
|
3
|
+
export const AdminItemEditPage = async (props: { id: string }) => {
|
|
5
4
|
const css: CssProps = {
|
|
6
5
|
display: 'flex',
|
|
7
6
|
flexDirection: 'column',
|
|
@@ -15,7 +14,7 @@ export const AdminItemEditPage = async (props: PageProps) => {
|
|
|
15
14
|
};
|
|
16
15
|
return (
|
|
17
16
|
<div css={css}>
|
|
18
|
-
<div class='management-new-page-box'>Edit
|
|
17
|
+
<div class='management-new-page-box'>Edit: {props.id}</div>
|
|
19
18
|
</div>
|
|
20
19
|
);
|
|
21
20
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { CssProps,
|
|
1
|
+
import { CssProps, MediaQueryRange } from 'lupine.web';
|
|
2
2
|
import { HomeSearchComponent } from '../components/home-search-component';
|
|
3
|
-
import { MediaQueryRange } from 'lupine.web.components';
|
|
4
3
|
|
|
5
|
-
export const AdminItemListPage = async (
|
|
4
|
+
export const AdminItemListPage = async () => {
|
|
6
5
|
const css: CssProps = {
|
|
7
6
|
display: 'flex',
|
|
8
7
|
flexDirection: 'column',
|
package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-user.tsx
RENAMED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createSignal, CssProps, getRenderPageProps, onMount
|
|
1
|
+
import { ActionSheet, Toast } from 'lupine.native.components';
|
|
2
|
+
import { createSignal, CssProps, getRenderPageProps, onMount } from 'lupine.web';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/** the value of an input of the page */
|
|
5
|
+
const valueOf = (selector: string) => (document.querySelector(selector) as HTMLInputElement | null)?.value;
|
|
6
|
+
|
|
7
|
+
export const AdminUserPage = async () => {
|
|
5
8
|
const css: CssProps = {
|
|
6
9
|
display: 'flex',
|
|
7
10
|
flexDirection: 'column',
|
|
@@ -27,13 +30,9 @@ export const AdminUserPage = async (props: PageProps) => {
|
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
const onUpdate = async (user: any) => {
|
|
30
|
-
const usertype =
|
|
31
|
-
const pass =
|
|
32
|
-
const updateIndex = await
|
|
33
|
-
title: 'Do you want to update user: ' + user.username + '?',
|
|
34
|
-
options: ['OK'],
|
|
35
|
-
cancelButtonText: 'Cancel',
|
|
36
|
-
});
|
|
33
|
+
const usertype = valueOf(`.row-${user.id} .u-usertype`);
|
|
34
|
+
const pass = valueOf(`.row-${user.id} .u-pass`);
|
|
35
|
+
const updateIndex = await ActionSheet.select({ title: 'Do you want to update user: ' + user.username + '?', options: ['OK'], cancelText: 'Cancel' });
|
|
37
36
|
if (updateIndex !== 0) {
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
@@ -43,10 +42,10 @@ export const AdminUserPage = async (props: PageProps) => {
|
|
|
43
42
|
password: pass,
|
|
44
43
|
});
|
|
45
44
|
if (result.json.status !== 'ok') {
|
|
46
|
-
|
|
45
|
+
Toast.error(result.json.message);
|
|
47
46
|
return;
|
|
48
47
|
} else {
|
|
49
|
-
|
|
48
|
+
Toast.success(result.json.message);
|
|
50
49
|
}
|
|
51
50
|
setTimeout(() => {
|
|
52
51
|
document.location.reload();
|
|
@@ -55,11 +54,7 @@ export const AdminUserPage = async (props: PageProps) => {
|
|
|
55
54
|
|
|
56
55
|
const onBlock = async (user: any, block: string) => {
|
|
57
56
|
const blockText = block === '1' ? 'Block' : 'Allow';
|
|
58
|
-
const blockIndex = await
|
|
59
|
-
title: 'Do you want to ' + blockText + ' this user login?',
|
|
60
|
-
options: ['OK'],
|
|
61
|
-
cancelButtonText: 'Cancel',
|
|
62
|
-
});
|
|
57
|
+
const blockIndex = await ActionSheet.select({ title: 'Do you want to ' + blockText + ' this user login?', options: ['OK'], cancelText: 'Cancel' });
|
|
63
58
|
if (blockIndex !== 0) {
|
|
64
59
|
return;
|
|
65
60
|
}
|
|
@@ -68,10 +63,10 @@ export const AdminUserPage = async (props: PageProps) => {
|
|
|
68
63
|
{}
|
|
69
64
|
);
|
|
70
65
|
if (result.json.status !== 'ok') {
|
|
71
|
-
|
|
66
|
+
Toast.error(result.json.message);
|
|
72
67
|
return;
|
|
73
68
|
} else {
|
|
74
|
-
|
|
69
|
+
Toast.success(result.json.message);
|
|
75
70
|
}
|
|
76
71
|
setTimeout(() => {
|
|
77
72
|
document.location.reload();
|
|
@@ -136,7 +131,7 @@ export const AdminUserPage = async (props: PageProps) => {
|
|
|
136
131
|
onMount(async () => {
|
|
137
132
|
const response = await fetchUsers();
|
|
138
133
|
if (response.status !== 'ok') {
|
|
139
|
-
|
|
134
|
+
Toast.error(response.message);
|
|
140
135
|
return;
|
|
141
136
|
}
|
|
142
137
|
setUserList(<UserList users={response.results} />);
|
|
@@ -12,8 +12,14 @@
|
|
|
12
12
|
<!--META-ENV-START-->
|
|
13
13
|
<!--META-ENV-END-->
|
|
14
14
|
<link rel="shortcut icon" href="{SUBDIR}/assets/favicon.ico?t={hash}" type="image/x-icon" />
|
|
15
|
-
<
|
|
16
|
-
|
|
15
|
+
<style>
|
|
16
|
+
html,
|
|
17
|
+
body,
|
|
18
|
+
.lupine-root {
|
|
19
|
+
height: 100%;
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
17
23
|
<script defer src="{SUBDIR}/index.js?t={hash}"></script>
|
|
18
24
|
</head>
|
|
19
25
|
<body>
|
|
@@ -1,155 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
|
|
1
|
+
import { bindRouter, PageRouter, setDefaultPageTitle } from 'lupine.web';
|
|
2
|
+
import { AppPage } from '../../app/src/index.web';
|
|
3
|
+
// the primitives of the app in the page that the server renders
|
|
4
|
+
import 'lupine.native.core/web/server';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
PageRouter,
|
|
11
|
-
bindTheme,
|
|
12
|
-
setDefaultPageTitle,
|
|
13
|
-
bindAppGlobalStyle,
|
|
14
|
-
_LupineJs,
|
|
15
|
-
_lupineJs,
|
|
16
|
-
PageProps,
|
|
17
|
-
isFrontEnd,
|
|
18
|
-
} from 'lupine.web';
|
|
19
|
-
import { Redirect, demoPageRouter } from 'lupine.web.components';
|
|
20
|
-
import { baseUrl, fetchData } from './services/fetch-data';
|
|
21
|
-
import { themes } from './styles/theme';
|
|
22
|
-
import { NotFoundPage } from './components/not-found-page';
|
|
23
|
-
import { LoginPage } from './components/login';
|
|
24
|
-
import { RegisterPage } from './components/register';
|
|
25
|
-
import { AdminCfgPage } from './pages/admin-cfg';
|
|
26
|
-
import { baseCss } from './styles/base-css';
|
|
27
|
-
import { UserProfilePage } from './pages/user-profile-page';
|
|
28
|
-
import { ResetPasswordPage } from './components/reset-password';
|
|
29
|
-
import { AdminItemListPage } from './pages/admin-item-list';
|
|
30
|
-
import { AdminItemEditPage } from './pages/admin-item-edit';
|
|
31
|
-
import { UserHomePage } from './pages/user-home-page';
|
|
32
|
-
import { UserPageFrame } from './frames/user-page-frame';
|
|
33
|
-
import { AdminPageFrame } from './frames/admin-page-frame';
|
|
34
|
-
// import { devAdminPageRouter } from 'lupine.api/admin';
|
|
35
|
-
import { AdminUserPage } from './pages/admin-user';
|
|
36
|
-
import { User1Page } from './pages/user1-page';
|
|
37
|
-
import { Page1Page } from './pages/page1-page';
|
|
38
|
-
import { TopFrame } from './frames/top-frame';
|
|
39
|
-
import { Frame1PageFrame } from './frames/frame1-page-frame';
|
|
40
|
-
import { Page2Page } from './pages/page2-page';
|
|
41
|
-
import { Frame2PageFrame } from './frames/frame2-page-frame';
|
|
42
|
-
import { ContactPage } from './pages/contact';
|
|
43
|
-
import { UserMinePage } from './pages/user-mine-page';
|
|
44
|
-
import { UserFavoritePage } from './pages/user-favorite-page';
|
|
45
|
-
import { LoginCodePage } from './components/login-code';
|
|
46
|
-
import { ClientEnvKeys } from './models/client-env-keys';
|
|
6
|
+
// The page of the site is the app (app/), the web version of the same app that runs on iOS, Android, macOS and
|
|
7
|
+
// Windows, in the same bundle: the server renders the page of the address (search engines see the text). keep: the app
|
|
8
|
+
// is made once and stays; when the address changes (its own pages, the back button, a link of the site) it follows the
|
|
9
|
+
// address itself. Pages of the site itself go into pageRouter before it. The admin pages (/admin) are an entry of their
|
|
10
|
+
// own: web/src/admin (lupine.json).
|
|
47
11
|
|
|
48
|
-
|
|
49
|
-
debugWatch(webEnv(ClientEnvKeys.API_PORT, 0));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// console.log(document.title);
|
|
53
|
-
// addWebVersion('20250409');
|
|
54
|
-
bindTheme('light', themes);
|
|
55
|
-
bindAppGlobalStyle('comm-css', baseCss, false, true);
|
|
56
|
-
setDefaultPageTitle('Lupine.js Full-stack Starter');
|
|
57
|
-
|
|
58
|
-
bindRenderPageFunctions({ fetchData, baseUrl });
|
|
59
|
-
|
|
60
|
-
const fetchAuth = async (props: PageProps) => {
|
|
61
|
-
const data = await props.renderPageFunctions.fetchData('/api/user-info');
|
|
62
|
-
return data.json;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const checkAdminAuth = async (props: PageProps) => {
|
|
66
|
-
if (typeof document === 'undefined') {
|
|
67
|
-
return <div></div>;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const json = await fetchAuth(props);
|
|
71
|
-
console.log('======auth', json);
|
|
72
|
-
if (!json || !json.results || json.results.usertype !== 'admin') {
|
|
73
|
-
return Redirect({ url: '/' });
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const checkAuth = async (props: PageProps) => {
|
|
79
|
-
if (typeof document === 'undefined') {
|
|
80
|
-
return <div></div>;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const json = await fetchAuth(props);
|
|
84
|
-
console.log('======auth', json);
|
|
85
|
-
if (!json || !json.results) {
|
|
86
|
-
return Redirect({ url: '/login' });
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const adminPageRouter = new PageRouter();
|
|
92
|
-
adminPageRouter.setFramePage({
|
|
93
|
-
component: AdminPageFrame,
|
|
94
|
-
placeholderClassname: 'admin-page-placeholder',
|
|
95
|
-
});
|
|
96
|
-
// management
|
|
97
|
-
adminPageRouter.use('/music-edit/:id/', checkAdminAuth, AdminItemEditPage);
|
|
98
|
-
adminPageRouter.use('/user', checkAdminAuth, AdminUserPage);
|
|
99
|
-
adminPageRouter.use('/cfg', checkAdminAuth, AdminCfgPage);
|
|
100
|
-
adminPageRouter.use('*', checkAdminAuth, AdminItemListPage);
|
|
101
|
-
|
|
102
|
-
const userPageRouter = new PageRouter();
|
|
103
|
-
userPageRouter.setFramePage({
|
|
104
|
-
component: UserPageFrame,
|
|
105
|
-
placeholderClassname: 'user-page-placeholder',
|
|
106
|
-
});
|
|
107
|
-
// user, auth
|
|
108
|
-
userPageRouter.use('/mine', checkAuth, UserMinePage);
|
|
109
|
-
userPageRouter.use('/favorite', checkAuth, UserFavoritePage);
|
|
110
|
-
userPageRouter.use('/profile', checkAuth, UserProfilePage);
|
|
111
|
-
userPageRouter.use('/contact', checkAuth, ContactPage);
|
|
112
|
-
userPageRouter.use('/user1/:parameter1/?option1/', User1Page);
|
|
113
|
-
userPageRouter.use('/page1/:parameter1/fixed-section/:parameter2/?option1/', Page1Page);
|
|
114
|
-
userPageRouter.use('/page2/:parameter1/fixed-section/:parameter2/?option1/', Page2Page);
|
|
115
|
-
userPageRouter.use('/', UserHomePage);
|
|
116
|
-
|
|
117
|
-
const frame1PageRouter = new PageRouter();
|
|
118
|
-
frame1PageRouter.setFramePage({
|
|
119
|
-
component: Frame1PageFrame,
|
|
120
|
-
placeholderClassname: 'frame1-page-placeholder',
|
|
121
|
-
});
|
|
122
|
-
frame1PageRouter.use('/page1', Page1Page);
|
|
123
|
-
frame1PageRouter.use('/page2', Page2Page);
|
|
124
|
-
frame1PageRouter.use('*', Page1Page);
|
|
125
|
-
|
|
126
|
-
const frame2PageRouter = new PageRouter();
|
|
127
|
-
frame2PageRouter.setFramePage({
|
|
128
|
-
component: Frame2PageFrame,
|
|
129
|
-
placeholderClassname: 'frame2-page-placeholder',
|
|
130
|
-
});
|
|
131
|
-
frame2PageRouter.use('/page1', Page1Page);
|
|
132
|
-
frame2PageRouter.use('/page2', Page2Page);
|
|
133
|
-
frame2PageRouter.use('*', Page1Page);
|
|
12
|
+
setDefaultPageTitle('Lupine Full-stack Starter');
|
|
134
13
|
|
|
135
14
|
const pageRouter = new PageRouter();
|
|
136
|
-
pageRouter.
|
|
137
|
-
component: TopFrame,
|
|
138
|
-
placeholderClassname: 'top-frame-placeholder',
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
// pageRouter.use('/admin-dev', devAdminPageRouter);
|
|
142
|
-
pageRouter.use('/demo', demoPageRouter);
|
|
143
|
-
pageRouter.use('/admin', adminPageRouter);
|
|
144
|
-
pageRouter.use('/user', userPageRouter);
|
|
145
|
-
pageRouter.use('/frame1', frame1PageRouter);
|
|
146
|
-
pageRouter.use('/frame2', frame2PageRouter);
|
|
147
|
-
|
|
148
|
-
pageRouter.use('/login', LoginPage);
|
|
149
|
-
pageRouter.use('/login-code', LoginCodePage);
|
|
150
|
-
pageRouter.use('/register', RegisterPage);
|
|
151
|
-
pageRouter.use('/reset-pw', ResetPasswordPage);
|
|
152
|
-
|
|
153
|
-
pageRouter.use('/', userPageRouter);
|
|
154
|
-
pageRouter.use('*', NotFoundPage);
|
|
15
|
+
pageRouter.use('*', AppPage, { keep: true });
|
|
155
16
|
bindRouter(pageRouter);
|
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JsonObject } from 'lupine.web';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
return baseUrl + (urlWithoutHost || '');
|
|
9
|
-
};
|
|
3
|
+
// fetchData of the admin pages (bindRenderPageFunctions). The pages come from the server of the API, so the address is
|
|
4
|
+
// the same (WEB.API_BASE_URL of .env is for the native apps), and the session is the httpOnly cookie _token, which the
|
|
5
|
+
// browser sends by itself.
|
|
6
|
+
export const baseUrl = (urlWithoutHost?: string) => urlWithoutHost || '';
|
|
10
7
|
|
|
11
|
-
export const fetchData = async (
|
|
12
|
-
urlWithoutHost: string,
|
|
13
|
-
postData?: string | JsonObject,
|
|
14
|
-
returnRawResponse?: boolean,
|
|
15
|
-
returnHeaders?: boolean
|
|
16
|
-
) => {
|
|
8
|
+
export const fetchData = async (urlWithoutHost: string, postData?: string | JsonObject, returnRawResponse?: boolean, returnHeaders?: boolean) => {
|
|
17
9
|
const url = baseUrl(urlWithoutHost);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const keepData =
|
|
21
|
-
typeof postData === 'string' ||
|
|
22
|
-
postData instanceof File ||
|
|
23
|
-
postData instanceof FormData ||
|
|
24
|
-
postData instanceof Blob;
|
|
10
|
+
const keepData = typeof postData === 'string' || postData instanceof File || postData instanceof FormData || postData instanceof Blob;
|
|
25
11
|
const option = {
|
|
26
12
|
method: postData ? 'POST' : 'GET',
|
|
27
13
|
credentials: 'include' as RequestCredentials,
|
|
28
|
-
headers: new Headers({
|
|
29
|
-
_token: getCookie('_token') || '',
|
|
30
|
-
}),
|
|
31
14
|
body: postData ? (keepData ? postData : JSON.stringify(postData)) : undefined,
|
|
32
15
|
};
|
|
33
16
|
try {
|
|
@@ -35,7 +18,6 @@ export const fetchData = async (
|
|
|
35
18
|
if (returnRawResponse) {
|
|
36
19
|
return response;
|
|
37
20
|
}
|
|
38
|
-
// const json = await data.json();
|
|
39
21
|
const text = await response.text();
|
|
40
22
|
const headers: { [key: string]: string } = {};
|
|
41
23
|
if (returnHeaders) {
|