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
|
@@ -19,11 +19,30 @@ import {
|
|
|
19
19
|
DEV_ADMIN_USER_KEY_NAME,
|
|
20
20
|
DEV_ADMIN_PASS_KEY_NAME,
|
|
21
21
|
DEV_ADMIN_SESSION_INVALID_BEFORE_KEY_NAME,
|
|
22
|
+
loginGuard,
|
|
23
|
+
getClientIp,
|
|
22
24
|
} from 'lupine.api';
|
|
23
25
|
import { sendEmail, sendSiteEmail } from './send-email';
|
|
24
26
|
|
|
25
27
|
const PW_RETRY_MAX = 5;
|
|
26
28
|
const PW_RETRY_RESET_MINUTES = 15;
|
|
29
|
+
|
|
30
|
+
// A code by email (to sign in or set a new password) is good for CODE_MINUTES from when it was sent. The time is kept
|
|
31
|
+
// with it, as "code.time" in activation: lastvisitdate moves with every wrong try, so it can't tell the age of a code
|
|
32
|
+
const CODE_MINUTES = 30;
|
|
33
|
+
const codeIssuedAt = (stored: unknown): number => Number(String(stored || '').split('.')[1]) || 0;
|
|
34
|
+
const codeMatches = (stored: unknown, provided: unknown): boolean => {
|
|
35
|
+
const code = String(stored || '').split('.')[0];
|
|
36
|
+
const issued = codeIssuedAt(stored);
|
|
37
|
+
return (
|
|
38
|
+
code.length >= 6 &&
|
|
39
|
+
issued > 0 &&
|
|
40
|
+
Date.now() - issued <= CODE_MINUTES * 60 * 1000 &&
|
|
41
|
+
CryptoUtils.timingSafeEqual(code, String(provided || ''))
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
// a user's session: the cookie and the login time in the token (which the server checks) end after these days
|
|
45
|
+
const userSessionDays = () => getSessionExpireDays(ADMIN_SESSION_EXPIRE_DAYS_KEY_NAME, 90);
|
|
27
46
|
const logger = new Logger('user-api');
|
|
28
47
|
|
|
29
48
|
export type LoginJsonProps = {
|
|
@@ -39,6 +58,11 @@ export type LoginJsonProps = {
|
|
|
39
58
|
const ADMIN_SESSION_INVALID_BEFORE_KEY_NAME = 'ADMIN_SESSION_INVALID_BEFORE';
|
|
40
59
|
const ADMIN_SESSION_EXPIRE_DAYS_KEY_NAME = 'ADMIN_SESSION_EXPIRE_DAYS';
|
|
41
60
|
|
|
61
|
+
// The token of a sign-in is in the answer only for the apps (iOS, Android, macOS, Windows): they have no cookies and
|
|
62
|
+
// send it back in a Cookie header. A browser keeps it in its httpOnly cookie alone, where the scripts of a page can't
|
|
63
|
+
// read it. Browsers send Origin with every POST, the apps don't.
|
|
64
|
+
const tokenForApps = (req: ServerRequest, token: string) => (req.headers.origin ? undefined : token);
|
|
65
|
+
|
|
42
66
|
export const appAdminHookSetCookie: AppAdminHookSetCookieProps = async (
|
|
43
67
|
req: ServerRequest,
|
|
44
68
|
res: ServerResponse,
|
|
@@ -65,8 +89,7 @@ export const appAdminHookSetCookie: AppAdminHookSetCookieProps = async (
|
|
|
65
89
|
const response = {
|
|
66
90
|
status: 'ok',
|
|
67
91
|
message: langHelper.getLang('shared:login_success'),
|
|
68
|
-
appLogin:
|
|
69
|
-
result: tokenCookie,
|
|
92
|
+
appLogin: 1,
|
|
70
93
|
user: {
|
|
71
94
|
nickname: loginJson.u,
|
|
72
95
|
admin: loginJson.t === 'admin' ? '1' : '0',
|
|
@@ -118,7 +141,7 @@ export const appAdminHookCheckLogin: AppAdminHookCheckLoginProps = async (
|
|
|
118
141
|
const adminPass = process.env['ADMIN_PASS'] || '';
|
|
119
142
|
const pwCheck =
|
|
120
143
|
username && password && password.length <= 256 && adminUser && adminPass
|
|
121
|
-
? CryptoUtils.
|
|
144
|
+
? await CryptoUtils.verifyPasswordLayeredAsync(password, adminPass)
|
|
122
145
|
: { valid: false as const };
|
|
123
146
|
if (
|
|
124
147
|
adminUser &&
|
|
@@ -150,12 +173,12 @@ const computeUserSessionHash = (username: string, storedPassword: string): strin
|
|
|
150
173
|
return CryptoUtils.hash(`${username}:${storedPassword}`);
|
|
151
174
|
};
|
|
152
175
|
|
|
153
|
-
const verifyUserPassword = (plainPassword: string, storedPassword: string): boolean => {
|
|
176
|
+
const verifyUserPassword = async (plainPassword: string, storedPassword: string): Promise<boolean> => {
|
|
154
177
|
if (!plainPassword || plainPassword.length > 256 || !storedPassword) {
|
|
155
178
|
return false;
|
|
156
179
|
}
|
|
157
180
|
if (storedPassword.startsWith('scrypt$')) {
|
|
158
|
-
return CryptoUtils.
|
|
181
|
+
return await CryptoUtils.verifyPasswordAsync(plainPassword, storedPassword);
|
|
159
182
|
}
|
|
160
183
|
return CryptoUtils.timingSafeEqual(CryptoUtils.hash(plainPassword), storedPassword);
|
|
161
184
|
};
|
|
@@ -169,7 +192,8 @@ export const getUserFromCookie = async (
|
|
|
169
192
|
const cookies = req.locals.cookies();
|
|
170
193
|
const token = cookies.get('_token', '');
|
|
171
194
|
if (token) {
|
|
172
|
-
|
|
195
|
+
// encrypted with CRYPTO_KEY by the sign-in (decryptJson takes DEV_CRYPTO_KEY without a key)
|
|
196
|
+
const json = adminApiHelper.decryptJson(token, process.env['CRYPTO_KEY']) as LoginJsonProps;
|
|
173
197
|
if (!json || !json.u) {
|
|
174
198
|
if (sendResponseWhenError) {
|
|
175
199
|
const response = {
|
|
@@ -224,6 +248,14 @@ export const getUserFromCookie = async (
|
|
|
224
248
|
}
|
|
225
249
|
}
|
|
226
250
|
|
|
251
|
+
// a user's token carries its login time: an old (or copied) token ends like the cookie does
|
|
252
|
+
if (isSessionExpired(json.l, userSessionDays())) {
|
|
253
|
+
if (sendResponseWhenError) {
|
|
254
|
+
ApiHelper.sendJson(req, res, { status: 'error', message: langHelper.getLang('shared:not_logged_in') });
|
|
255
|
+
}
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
|
|
227
259
|
// verify whether the user is blocked
|
|
228
260
|
const db = apiCache.getDb();
|
|
229
261
|
const record = await db.selectObject('$__s_user', ['*'], {
|
|
@@ -384,7 +416,7 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
384
416
|
const response = {
|
|
385
417
|
status: 'ok',
|
|
386
418
|
message: langHelper.getLang('shared:login_success'),
|
|
387
|
-
result: token,
|
|
419
|
+
result: tokenForApps(req, token),
|
|
388
420
|
user: {
|
|
389
421
|
nickname: loginJson.u,
|
|
390
422
|
admin: loginJson.t === 'admin' ? '1' : '0',
|
|
@@ -404,19 +436,25 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
404
436
|
return true;
|
|
405
437
|
}
|
|
406
438
|
|
|
439
|
+
// ADMIN_USER of .env: failed tries are counted per client address (loginGuard), and the password is only checked
|
|
440
|
+
// (scrypt) for this user name
|
|
407
441
|
const adminUser = process.env['ADMIN_USER'] || '';
|
|
408
442
|
const adminPass = process.env['ADMIN_PASS'] || '';
|
|
443
|
+
const isAdminName = !!adminUser && !!adminPass && typeof data.u === 'string' && adminApiHelper.timingSafeEqual(data.u, adminUser);
|
|
444
|
+
if (isAdminName && (await loginGuard.isLocked(req))) return loginGuard.sendLocked(req, res);
|
|
409
445
|
const adminPwCheck =
|
|
410
|
-
typeof data.
|
|
411
|
-
|
|
412
|
-
data.p.length <= 256 &&
|
|
413
|
-
adminUser &&
|
|
414
|
-
adminPass
|
|
415
|
-
? CryptoUtils.verifyPasswordLayered(data.p, adminPass)
|
|
446
|
+
isAdminName && typeof data.p === 'string' && data.p.length <= 256
|
|
447
|
+
? await CryptoUtils.verifyPasswordLayeredAsync(data.p, adminPass)
|
|
416
448
|
: { valid: false as const };
|
|
417
|
-
if (
|
|
449
|
+
if (isAdminName && (!adminPwCheck.valid || !adminPwCheck.keyHex)) {
|
|
450
|
+
await loginGuard.fail(req);
|
|
451
|
+
ApiHelper.sendJson(req, res, { status: 'error', message: langHelper.getLang('shared:login_failed') });
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
if (isAdminName && adminPwCheck.keyHex) {
|
|
455
|
+
loginGuard.clear(req);
|
|
418
456
|
const loginJson: LoginJsonProps = {
|
|
419
|
-
ip: req
|
|
457
|
+
ip: getClientIp(req),
|
|
420
458
|
id: 0,
|
|
421
459
|
u: data.u as string,
|
|
422
460
|
t: 'admin',
|
|
@@ -429,7 +467,7 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
429
467
|
const response = {
|
|
430
468
|
status: 'ok',
|
|
431
469
|
message: langHelper.getLang('shared:login_success'),
|
|
432
|
-
result: tokenCookie,
|
|
470
|
+
result: tokenForApps(req, tokenCookie),
|
|
433
471
|
user: {
|
|
434
472
|
nickname: loginJson.u,
|
|
435
473
|
admin: loginJson.t === 'admin' ? '1' : '0',
|
|
@@ -516,9 +554,7 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
516
554
|
if (await checkRetryLockout()) {
|
|
517
555
|
return true;
|
|
518
556
|
}
|
|
519
|
-
|
|
520
|
-
const storedCode = String(result[0].activation || '');
|
|
521
|
-
if (storedCode.length < 6 || !CryptoUtils.timingSafeEqual(storedCode, providedCode)) {
|
|
557
|
+
if (!codeMatches(result[0].activation, data.c)) {
|
|
522
558
|
await recordUserRetry();
|
|
523
559
|
const response = {
|
|
524
560
|
status: 'error',
|
|
@@ -532,11 +568,7 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
532
568
|
if (await checkRetryLockout()) {
|
|
533
569
|
return true;
|
|
534
570
|
}
|
|
535
|
-
|
|
536
|
-
const storedCode = String(result[0].activation || '');
|
|
537
|
-
const codeIssuedAt = DateUtils.fromJSONString(result[0].lastvisitdate);
|
|
538
|
-
const isCodeExpired = !codeIssuedAt || Date.now() - codeIssuedAt.getTime() > 30 * 60 * 1000;
|
|
539
|
-
if (storedCode.length < 6 || isCodeExpired || !CryptoUtils.timingSafeEqual(storedCode, providedCode)) {
|
|
571
|
+
if (!codeMatches(result[0].activation, data.c)) {
|
|
540
572
|
await recordUserRetry();
|
|
541
573
|
const response = {
|
|
542
574
|
status: 'error',
|
|
@@ -553,7 +585,7 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
553
585
|
return true;
|
|
554
586
|
}
|
|
555
587
|
|
|
556
|
-
if (!loginOk && !verifyUserPassword(String(data.p || ''), String(result[0].password || ''))) {
|
|
588
|
+
if (!loginOk && !(await verifyUserPassword(String(data.p || ''), String(result[0].password || '')))) {
|
|
557
589
|
await recordUserRetry();
|
|
558
590
|
const response = {
|
|
559
591
|
status: 'error',
|
|
@@ -571,18 +603,19 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
571
603
|
lastvisitdate: DateUtils.toJSONString(new Date()),
|
|
572
604
|
};
|
|
573
605
|
if (!loginOk && typeof data.p === 'string' && activePasswordHash && !activePasswordHash.startsWith('scrypt$')) {
|
|
574
|
-
activePasswordHash = CryptoUtils.
|
|
606
|
+
activePasswordHash = await CryptoUtils.hashPasswordAsync(data.p);
|
|
575
607
|
updateLoginObj.password = activePasswordHash;
|
|
576
608
|
}
|
|
577
609
|
|
|
578
610
|
await db.updateObject('$__s_user', updateLoginObj, { username: data.u as string });
|
|
579
611
|
const nameAndPassHash = CryptoUtils.sha256(`${result[0].username}:${activePasswordHash}`);
|
|
580
612
|
const loginJson: LoginJsonProps = {
|
|
581
|
-
ip: req
|
|
613
|
+
ip: getClientIp(req),
|
|
582
614
|
id: result[0].id,
|
|
583
615
|
u: result[0].username,
|
|
584
616
|
t: result[0].usertype,
|
|
585
617
|
h: nameAndPassHash,
|
|
618
|
+
l: Date.now(),
|
|
586
619
|
};
|
|
587
620
|
|
|
588
621
|
const token = JSON.stringify(loginJson);
|
|
@@ -590,7 +623,7 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
590
623
|
const response = {
|
|
591
624
|
status: 'ok',
|
|
592
625
|
message: langHelper.getLang('shared:login_success'),
|
|
593
|
-
result: tokenCookie,
|
|
626
|
+
result: tokenForApps(req, tokenCookie),
|
|
594
627
|
user: {
|
|
595
628
|
nickname: loginJson.u,
|
|
596
629
|
admin: loginJson.t === 'admin' ? '1' : '0',
|
|
@@ -599,7 +632,7 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
599
632
|
},
|
|
600
633
|
};
|
|
601
634
|
req.locals.setCookie('_token', tokenCookie, {
|
|
602
|
-
expireDays:
|
|
635
|
+
expireDays: userSessionDays(),
|
|
603
636
|
path: '/',
|
|
604
637
|
httpOnly: true,
|
|
605
638
|
secure: isHttpsRequest(req),
|
|
@@ -697,7 +730,7 @@ export const userReg = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
697
730
|
nickname: data.preferredName as string,
|
|
698
731
|
username: data.u as string,
|
|
699
732
|
email: data.u as string,
|
|
700
|
-
password: CryptoUtils.
|
|
733
|
+
password: await CryptoUtils.hashPasswordAsync(data.p),
|
|
701
734
|
gender: data.sex as string,
|
|
702
735
|
usertype: 'user',
|
|
703
736
|
registerdate: lastvisitdate,
|
|
@@ -774,7 +807,7 @@ export const userResetCode = async (req: ServerRequest, res: ServerResponse) =>
|
|
|
774
807
|
}
|
|
775
808
|
|
|
776
809
|
const db = apiCache.getDb();
|
|
777
|
-
const result = await db.selectObject('$__s_user', ['id', 'activation'
|
|
810
|
+
const result = await db.selectObject('$__s_user', ['id', 'activation'], {
|
|
778
811
|
username: userEmail,
|
|
779
812
|
});
|
|
780
813
|
// the same answer whether the address is known or not: nobody learns who has an account here
|
|
@@ -784,15 +817,13 @@ export const userResetCode = async (req: ServerRequest, res: ServerResponse) =>
|
|
|
784
817
|
return true;
|
|
785
818
|
}
|
|
786
819
|
// one code a minute: the form can't be used to flood a mailbox
|
|
787
|
-
|
|
788
|
-
if (issued && Date.now() - issued.getTime() < 60 * 1000) {
|
|
820
|
+
if (Date.now() - codeIssuedAt(result[0].activation) < 60 * 1000) {
|
|
789
821
|
answer();
|
|
790
822
|
return true;
|
|
791
823
|
}
|
|
792
824
|
|
|
793
|
-
const lastvisitdate = DateUtils.toJSONString(new Date());
|
|
794
825
|
const random = CryptoUtils.randomNumberString(8);
|
|
795
|
-
await db.updateObject('$__s_user', { activation: random
|
|
826
|
+
await db.updateObject('$__s_user', { activation: `${random}.${Date.now()}` }, { username: userEmail });
|
|
796
827
|
|
|
797
828
|
const siteUrl = (await apiStorage.getWeb('siteUrl')) || 'https://your-site.com';
|
|
798
829
|
const emailTitle = 'Authentication code';
|
|
@@ -824,12 +855,9 @@ export const userResetPw = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
824
855
|
const result = await db.selectObject('$__s_user', ['id', 'activation', 'pwretry', 'lastvisitdate'], {
|
|
825
856
|
username: userEmail,
|
|
826
857
|
});
|
|
858
|
+
// the answer of a wrong code: nobody learns here who has an account
|
|
827
859
|
if (!result || result.length !== 1) {
|
|
828
|
-
|
|
829
|
-
status: 'error',
|
|
830
|
-
message: langHelper.getLang('shared:user_not_found'),
|
|
831
|
-
};
|
|
832
|
-
ApiHelper.sendJson(req, res, response);
|
|
860
|
+
ApiHelper.sendJson(req, res, { status: 'error', message: langHelper.getLang('shared:wrong_activation') });
|
|
833
861
|
return true;
|
|
834
862
|
}
|
|
835
863
|
|
|
@@ -847,10 +875,7 @@ export const userResetPw = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
847
875
|
}
|
|
848
876
|
}
|
|
849
877
|
|
|
850
|
-
|
|
851
|
-
const codeIssuedAt = DateUtils.fromJSONString(result[0].lastvisitdate);
|
|
852
|
-
const isCodeExpired = !codeIssuedAt || Date.now() - codeIssuedAt.getTime() > 30 * 60 * 1000;
|
|
853
|
-
if (storedCode.length < 6 || isCodeExpired || !CryptoUtils.timingSafeEqual(storedCode, String(activation))) {
|
|
878
|
+
if (!codeMatches(result[0].activation, activation)) {
|
|
854
879
|
await db.updateObject(
|
|
855
880
|
'$__s_user',
|
|
856
881
|
{ pwretry: (Number(result[0].pwretry) || 0) + 1, lastvisitdate: DateUtils.toJSONString(new Date()) },
|
|
@@ -865,7 +890,7 @@ export const userResetPw = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
865
890
|
}
|
|
866
891
|
await db.updateObject(
|
|
867
892
|
'$__s_user',
|
|
868
|
-
{ activation: '', pwretry: 0, password: CryptoUtils.
|
|
893
|
+
{ activation: '', activated: '1', pwretry: 0, password: await CryptoUtils.hashPasswordAsync(pass) },
|
|
869
894
|
{ username: userEmail }
|
|
870
895
|
);
|
|
871
896
|
const response = {
|
|
@@ -903,7 +928,7 @@ export const updateUser = async (req: ServerRequest, res: ServerResponse) => {
|
|
|
903
928
|
|
|
904
929
|
const updateObj: any = { usertype: usertype };
|
|
905
930
|
if (password) {
|
|
906
|
-
updateObj['password'] = CryptoUtils.
|
|
931
|
+
updateObj['password'] = await CryptoUtils.hashPasswordAsync(password);
|
|
907
932
|
}
|
|
908
933
|
// clear activation, only admin can update
|
|
909
934
|
updateObj['activation'] = '';
|
|
@@ -962,7 +987,7 @@ export const updateProfile = async (req: ServerRequest, res: ServerResponse) =>
|
|
|
962
987
|
ApiHelper.sendJson(req, res, response);
|
|
963
988
|
return true;
|
|
964
989
|
}
|
|
965
|
-
updateObj['password'] = CryptoUtils.
|
|
990
|
+
updateObj['password'] = await CryptoUtils.hashPasswordAsync(password);
|
|
966
991
|
}
|
|
967
992
|
const result = await db.updateObject('$__s_user', updateObj, {
|
|
968
993
|
id: loginJson.id,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lupine-template-fullstack-starter-app",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "The app of the full-stack starter: stories, sign-in, the user's pages, settings. One code base for iOS, Android, macOS, Windows and the web.",
|
|
6
|
+
"lupineNative": {
|
|
7
|
+
"name": "LupineFullstack",
|
|
8
|
+
"title": "Lupine Full-stack",
|
|
9
|
+
"id": "com.uuware.lupine.fullstack",
|
|
10
|
+
"entry": {
|
|
11
|
+
"native": "src/index.native.tsx",
|
|
12
|
+
"test": "src/index.test.tsx",
|
|
13
|
+
"web": "src/index.web.tsx"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"lupine.native.components": "^1.1.0",
|
|
18
|
+
"lupine.native.core": "^1.1.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import './shell/texts';
|
|
2
|
+
import { createEffect, onBack, onMount, Text, untrack, View } from 'lupine.native.core';
|
|
3
|
+
import { col, Icon, NavBar, NavItem, OverlayHost, Pages, router, syncAppearance, t, Toast, tr, val } from 'lupine.native.components';
|
|
4
|
+
import * as icons from 'lupine.core/icons';
|
|
5
|
+
import { api } from './shell/api';
|
|
6
|
+
import { About, NotFound } from './pages/about';
|
|
7
|
+
import { Contact } from './pages/contact';
|
|
8
|
+
import { Favorite } from './pages/favorite';
|
|
9
|
+
import { Home } from './pages/home';
|
|
10
|
+
import { Login } from './pages/login';
|
|
11
|
+
import { Mine } from './pages/mine';
|
|
12
|
+
import { Profile } from './pages/profile';
|
|
13
|
+
import { Register } from './pages/register';
|
|
14
|
+
import { ResetPassword } from './pages/reset-password';
|
|
15
|
+
import { Settings } from './pages/settings';
|
|
16
|
+
import { StoryPage } from './pages/story';
|
|
17
|
+
|
|
18
|
+
const items: NavItem[] = [
|
|
19
|
+
{ key: '/', label: tr('nav.home', 'Stories'), icon: icons.home, testID: 'tab-home' },
|
|
20
|
+
{ key: '/favorite', label: tr('nav.favorite', 'Favorites'), icon: icons.heart, testID: 'tab-favorite' },
|
|
21
|
+
{ key: '/mine', label: tr('nav.mine', 'Mine'), icon: icons.user, testID: 'tab-mine' },
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
// the title of the browser's tab (the window on desktops) while a tab is shown; pages over the tabs: the name of the app
|
|
25
|
+
const appName = () => t('app.name', 'Lupine Full-stack');
|
|
26
|
+
const tabTitle = (key: string) => () => (key === '/' ? appName() : `${val(items.find((i) => i.key === key)?.label ?? '')} | ${appName()}`);
|
|
27
|
+
|
|
28
|
+
/** Phones: a tab bar at the bottom, pushed pages cover it. Wide windows: the menu stays on the left. */
|
|
29
|
+
export const App = () => {
|
|
30
|
+
untrack(syncAppearance); // before the first control is created
|
|
31
|
+
createEffect(syncAppearance);
|
|
32
|
+
// who is signed in; not while a server renders the page
|
|
33
|
+
onMount(() => void api.refresh());
|
|
34
|
+
let last = 0;
|
|
35
|
+
onBack(() => {
|
|
36
|
+
if (Date.now() - last < 2000) return false;
|
|
37
|
+
last = Date.now();
|
|
38
|
+
Toast.info(t('ln.pressAgainToExit', 'Press back again to exit'));
|
|
39
|
+
});
|
|
40
|
+
return (
|
|
41
|
+
<View style={{ flex: 1, backgroundColor: col('bg') }}>
|
|
42
|
+
<Pages
|
|
43
|
+
side={240}
|
|
44
|
+
title={appName}
|
|
45
|
+
tabs={[
|
|
46
|
+
{ path: '/', page: Home, title: tabTitle('/') },
|
|
47
|
+
{ path: '/favorite', page: Favorite, title: tabTitle('/favorite') },
|
|
48
|
+
{ path: '/mine', page: Mine, title: tabTitle('/mine') },
|
|
49
|
+
]}
|
|
50
|
+
routes={[
|
|
51
|
+
{ path: '/story/:id', page: ({ id }) => <StoryPage id={id} /> },
|
|
52
|
+
{ path: '/login', page: ({ email, mode }) => <Login email={email} mode={mode} /> },
|
|
53
|
+
{ path: '/register', page: () => <Register /> },
|
|
54
|
+
{ path: '/reset-password', page: ({ email }) => <ResetPassword email={email} /> },
|
|
55
|
+
{ path: '/profile', page: () => <Profile /> },
|
|
56
|
+
{ path: '/contact', page: () => <Contact /> },
|
|
57
|
+
{ path: '/settings', page: () => <Settings /> },
|
|
58
|
+
{ path: '/about', page: () => <About /> },
|
|
59
|
+
]}
|
|
60
|
+
notFound={() => <NotFound />}
|
|
61
|
+
>
|
|
62
|
+
{/* one menu: a tab bar at the bottom on phones, a column on the left on wide windows (css, also on the server) */}
|
|
63
|
+
<NavBar
|
|
64
|
+
items={items} active={router.tab} onPress={router.navigate} width={240}
|
|
65
|
+
header={
|
|
66
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 10, padding: 18 }}>
|
|
67
|
+
<Icon name={icons.logo} size={26} color={col('primary')} />
|
|
68
|
+
<Text style={{ fontSize: 17, fontWeight: '700', color: col('text') }}>{tr('app.name', 'Lupine Full-stack')}</Text>
|
|
69
|
+
</View>
|
|
70
|
+
}
|
|
71
|
+
/>
|
|
72
|
+
</Pages>
|
|
73
|
+
<OverlayHost />
|
|
74
|
+
</View>
|
|
75
|
+
);
|
|
76
|
+
};
|