create-lupine 1.0.31 → 1.3.0
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 +31 -0
- package/index.js +238 -112
- package/package.json +1 -1
- package/templates/common/.agents/skills/lupine-framework/SKILL.md +63 -0
- package/templates/common/.agents/skills/lupine-framework/references/backend-api.md +113 -0
- package/templates/common/.agents/skills/lupine-framework/references/icon-handling.md +71 -0
- package/templates/common/.agents/skills/lupine-framework/references/mobile-interactions.md +29 -0
- package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +190 -0
- package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +55 -0
- package/templates/common/.agents/skills/lupine-framework/references/reactivity-and-state.md +108 -0
- package/templates/common/.agents/skills/lupine-framework/references/styling-and-themes.md +121 -0
- package/templates/common/.env.mobile +4 -3
- package/templates/common/_env +10 -4
- 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 +37 -0
- 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 -23
- 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 -29
- package/templates/lupine-template-doc-starter/README.md +37 -0
- 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 -23
- 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 -29
- package/templates/lupine-template-fullstack-note/README.md +83 -0
- package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/api/package.json +1 -1
- 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-hello-world → lupine-template-fullstack-note}/lupine.json +4 -2
- package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/web/package.json +1 -1
- package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/web/src/index.html +10 -3
- package/templates/lupine-template-fullstack-note/web/src/index.tsx +15 -0
- package/templates/lupine-template-fullstack-starter/README.md +70 -0
- package/templates/lupine-template-fullstack-starter/api/package.json +10 -0
- package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +107 -0
- package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +75 -0
- package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-en.ts +39 -0
- package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-zh-cn.ts +37 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/admin-api.ts +139 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/api.ts +111 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +50 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/file-api-base.ts +30 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/root-api.ts +28 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/send-email.ts +47 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/setting-api.ts +60 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +1046 -0
- package/templates/lupine-template-fullstack-starter/app/assets/sample.png +0 -0
- 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 +31 -0
- package/templates/lupine-template-fullstack-starter/web/assets/android-chrome-192x192.png +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/apple-touch-icon.png +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/favicon-16x16.png +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/favicon-32x32.png +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/favicon.ico +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-carbon-icons.txt +71 -0
- package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-material-design.txt +20 -0
- package/templates/lupine-template-fullstack-starter/web/assets/icons-font/i-font.woff2 +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/icons-font/sample.html +124 -0
- package/templates/lupine-template-fullstack-starter/web/assets/icons-font/style.css +103 -0
- package/templates/lupine-template-fullstack-starter/web/assets/lupine-flower.png +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/lupine.svg +71 -0
- package/templates/lupine-template-fullstack-starter/web/assets/site.webmanifest +14 -0
- package/templates/lupine-template-fullstack-starter/web/icons-font.config.js +129 -0
- package/templates/{lupine-template-responsive-starter/api → lupine-template-fullstack-starter/web}/package.json +1 -1
- package/templates/lupine-template-fullstack-starter/web/src/admin/admin-patch.tsx +34 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/components/home-search-component.tsx +125 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/components/story-card.tsx +105 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/components/story-list.tsx +105 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/components/story-props.ts +34 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/index.html +23 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/index.tsx +49 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-cfg.tsx +144 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-item-edit.tsx +20 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-item-list.tsx +23 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-user.tsx +145 -0
- package/templates/lupine-template-fullstack-starter/web/src/index.html +28 -0
- package/templates/lupine-template-fullstack-starter/web/src/index.tsx +16 -0
- package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +37 -0
- package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +14 -0
- package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/global.css +10 -57
- package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/theme.ts +2 -1
- package/templates/lupine-template-responsive-starter/README.md +51 -0
- 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 -34
- 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 -31
- package/templates/common/AI_CONTEXT.md +0 -1002
- package/templates/common/apps/server/src/app-loader.ts +0 -4
- package/templates/lupine-template-cv-starter/api/package.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/styles/base-css.ts +0 -15
- package/templates/lupine-template-doc-starter/api/package.json +0 -6
- 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-hello-world/api/resources/config_default.json +0 -6
- package/templates/lupine-template-hello-world/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-hello-world/api/src/service/root-api.ts +0 -18
- package/templates/lupine-template-hello-world/web/src/index.tsx +0 -73
- package/templates/lupine-template-hello-world/web/src/styles/app.css +0 -0
- package/templates/lupine-template-hello-world/web/src/styles/base-css.ts +0 -1
- 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 -86
- package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +0 -80
- package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +0 -220
- package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +0 -119
- package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +0 -116
- package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +0 -154
- package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +0 -193
- 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 -182
- package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +0 -52
- package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +0 -43
- package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +0 -46
- package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +0 -452
- package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +0 -325
- package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +0 -46
- 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 -16
- /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-hello-world → lupine-template-fullstack-note}/api/src/index.ts +0 -0
- /package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/web/assets/favicon.ico +0 -0
- /package/templates/{lupine-template-cv-starter → lupine-template-fullstack-starter}/api/resources/config_default.json +0 -0
- /package/templates/{lupine-template-responsive-starter → lupine-template-fullstack-starter}/api/src/index.ts +0 -0
- /package/templates/{lupine-template-cv-starter/web/src → lupine-template-fullstack-starter/web/src/models}/client-env-keys.ts +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { createSignal, Platform, storage, webEnv } from 'lupine.native.core';
|
|
2
|
+
import { lang, t } from 'lupine.native.components';
|
|
3
|
+
|
|
4
|
+
// The API of this template (api/src/service/api.ts, routes under /api), with fetch on every platform.
|
|
5
|
+
//
|
|
6
|
+
// The server: in the browser the page comes from it, so it is the same address (''), whatever the env file says. A
|
|
7
|
+
// native app needs its address: WEB.API_BASE_URL of the env file (lupine-native --env; .env.mobile for the apps of the
|
|
8
|
+
// stores; the key is public, it goes into the bundle), otherwise `npm run dev` on this computer (from the Android
|
|
9
|
+
// emulator 10.0.2.2).
|
|
10
|
+
//
|
|
11
|
+
// The session: the API answers a sign-in with the cookie _token (httpOnly). The browser keeps it and sends it, and
|
|
12
|
+
// scripts never see it. A native app has no cookie jar: it keeps the token of the answer with storage and sends it as
|
|
13
|
+
// the cookie of each request itself.
|
|
14
|
+
//
|
|
15
|
+
// The answers: { status: 'ok' | 'error', code, message }. The app shows its own text for the code (messageOf), in the
|
|
16
|
+
// language of the user; the message of the API is English.
|
|
17
|
+
|
|
18
|
+
export interface User {
|
|
19
|
+
id: number;
|
|
20
|
+
username: string;
|
|
21
|
+
}
|
|
22
|
+
export interface Note {
|
|
23
|
+
id: number;
|
|
24
|
+
text: string;
|
|
25
|
+
created_at: string;
|
|
26
|
+
updated_at: string;
|
|
27
|
+
}
|
|
28
|
+
/** what the API answers; code 'offline': the server wasn't reached, 'bad_answer': not an answer of the API */
|
|
29
|
+
export interface Answer {
|
|
30
|
+
status: 'ok' | 'error';
|
|
31
|
+
code: string;
|
|
32
|
+
message?: string;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const native = Platform.OS !== 'web';
|
|
37
|
+
const port = webEnv('API_PORT', 11080);
|
|
38
|
+
const local = `http://${Platform.OS === 'android' ? '10.0.2.2' : 'lupine-template-fullstack-note.app.localhost'}:${port}`;
|
|
39
|
+
let base = native ? (webEnv('API_BASE_URL', '') || local).replace(/\/+$/, '') : '';
|
|
40
|
+
|
|
41
|
+
/** 'http://host:port'; '' in the browser (the server of the page) */
|
|
42
|
+
export const serverAddress = () => base;
|
|
43
|
+
/** another server, such as one that isn't there (the tests) */
|
|
44
|
+
export const setServerAddress = (address: string) => {
|
|
45
|
+
base = address.replace(/\/+$/, '');
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** The text of an answer for the user, by its code. A code the app doesn't know: the message of the API. */
|
|
49
|
+
export const messageOf = (a: Answer): string => {
|
|
50
|
+
switch (a.code) {
|
|
51
|
+
case 'offline': return t('api.offline', 'The server cannot be reached');
|
|
52
|
+
case 'bad_answer': return t('api.bad_answer', 'Unexpected answer of the server ({status})', { status: a.httpStatus ?? '?' });
|
|
53
|
+
case 'bad_request': return t('api.bad_request', 'The server did not understand the request');
|
|
54
|
+
case 'bad_username': return t('api.bad_username', 'User name: 3 to 50 characters (letters, digits, _ . @ -)');
|
|
55
|
+
case 'bad_password': return t('api.bad_password', 'Password: 6 to 256 characters');
|
|
56
|
+
case 'username_taken': return t('api.username_taken', 'This user name is taken');
|
|
57
|
+
case 'login_failed': return t('api.login_failed', 'Wrong user name or password');
|
|
58
|
+
case 'too_many_attempts': return t('api.too_many_attempts', 'Too many failed sign-ins. Try again in {minutes} minutes', { minutes: a.minutes ?? 15 });
|
|
59
|
+
case 'not_signed_in': return t('api.not_signed_in', 'Please sign in again');
|
|
60
|
+
case 'bad_note': return t('api.bad_note', 'A note has 1 to 2000 characters');
|
|
61
|
+
case 'too_many_notes': return t('api.too_many_notes', 'At most {max} notes: delete some first', { max: a.max ?? 500 });
|
|
62
|
+
case 'note_not_found': return t('api.note_not_found', 'This note is gone');
|
|
63
|
+
case 'no_crypto_key': return t('api.no_crypto_key', 'The server has no CRYPTO_KEY in its .env');
|
|
64
|
+
case 'forbidden_origin': return t('api.forbidden_origin', 'The server refused a request from this page');
|
|
65
|
+
case 'server_error': return t('api.server_error', 'Something went wrong on the server');
|
|
66
|
+
default: return a.message || t('api.failed', 'Something went wrong');
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// a native app only: the token of the session, and the user, so that the app knows it at once and offline
|
|
71
|
+
const TOKEN = 'session';
|
|
72
|
+
const USER = 'user';
|
|
73
|
+
const cached = (): User | null => {
|
|
74
|
+
if (!native) return null;
|
|
75
|
+
try {
|
|
76
|
+
const u = JSON.parse(storage.get(USER) || 'null');
|
|
77
|
+
return u && typeof u.username === 'string' ? u : null;
|
|
78
|
+
} catch {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
// On the web this stays null while the server renders a page (the modules are shared by all requests): the browser asks
|
|
83
|
+
// who is signed in (api.refresh in onMount of the app).
|
|
84
|
+
const [user, setUser] = createSignal<User | null>(cached());
|
|
85
|
+
const keep = (u: User | null | undefined) => {
|
|
86
|
+
const value = u ? { id: Number(u.id), username: String(u.username) } : null;
|
|
87
|
+
setUser(value);
|
|
88
|
+
if (native) storage.set(USER, value ? JSON.stringify(value) : null);
|
|
89
|
+
};
|
|
90
|
+
const forget = () => {
|
|
91
|
+
keep(null);
|
|
92
|
+
if (native) storage.set(TOKEN, null);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const call = async (path: string, body?: object): Promise<Answer> => {
|
|
96
|
+
const headers: { [name: string]: string } = { Accept: 'application/json' };
|
|
97
|
+
if (body) headers['Content-Type'] = 'application/json';
|
|
98
|
+
if (native) {
|
|
99
|
+
// what a browser sends by itself
|
|
100
|
+
const token = storage.get(TOKEN);
|
|
101
|
+
headers.Cookie = `lang=${encodeURIComponent(lang())}` + (token ? `; _token=${encodeURIComponent(token)}` : '');
|
|
102
|
+
}
|
|
103
|
+
const abort = new AbortController();
|
|
104
|
+
const timer = setTimeout(() => abort.abort(), 20000);
|
|
105
|
+
let answer: Answer;
|
|
106
|
+
try {
|
|
107
|
+
const response = await fetch(base + path, { method: body ? 'POST' : 'GET', headers, body: body ? JSON.stringify(body) : undefined, signal: abort.signal });
|
|
108
|
+
const text = await response.text();
|
|
109
|
+
try {
|
|
110
|
+
const json = JSON.parse(text);
|
|
111
|
+
answer = json && typeof json === 'object' && typeof json.status === 'string' ? { code: json.status === 'ok' ? 'ok' : 'failed', ...json } : { status: 'error', code: 'bad_answer', httpStatus: response.status };
|
|
112
|
+
} catch {
|
|
113
|
+
answer = { status: 'error', code: 'bad_answer', httpStatus: response.status };
|
|
114
|
+
}
|
|
115
|
+
} catch {
|
|
116
|
+
answer = { status: 'error', code: 'offline' };
|
|
117
|
+
} finally {
|
|
118
|
+
clearTimeout(timer);
|
|
119
|
+
}
|
|
120
|
+
// the session is over (a new password, too old): signed out here as well
|
|
121
|
+
if (answer.code === 'not_signed_in' && user()) forget();
|
|
122
|
+
return answer;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/** after a sign-in or a new account: an app keeps the token */
|
|
126
|
+
const signedIn = (answer: Answer) => {
|
|
127
|
+
if (answer.status !== 'ok') return answer;
|
|
128
|
+
if (native) storage.set(TOKEN, String(answer.token || ''));
|
|
129
|
+
keep(answer.user);
|
|
130
|
+
return answer;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const api = {
|
|
134
|
+
user,
|
|
135
|
+
/** who is signed in: the browser by its cookie, an app by its token. Offline an app keeps the user it knows. */
|
|
136
|
+
refresh: async () => {
|
|
137
|
+
if (native && !storage.get(TOKEN)) return forget();
|
|
138
|
+
const answer = await call('/api/me');
|
|
139
|
+
if (answer.status === 'ok') keep(answer.user);
|
|
140
|
+
else if (answer.code === 'not_signed_in') forget();
|
|
141
|
+
},
|
|
142
|
+
login: async (username: string, password: string) => signedIn(await call('/api/login', { username, password })),
|
|
143
|
+
/** a new account, signed in at once */
|
|
144
|
+
register: async (username: string, password: string) => signedIn(await call('/api/register', { username, password })),
|
|
145
|
+
logout: async () => {
|
|
146
|
+
// the request has the token already: signed out here at once, also offline
|
|
147
|
+
const told = call('/api/logout', {});
|
|
148
|
+
forget();
|
|
149
|
+
await told;
|
|
150
|
+
},
|
|
151
|
+
/** sign out on this device only */
|
|
152
|
+
forget,
|
|
153
|
+
|
|
154
|
+
/** the newest notes (before: the id of the last one shown, for the next page); more: there are older ones */
|
|
155
|
+
notes: (before?: number) => call(`/api/notes${before ? `?before=${before}` : ''}`) as Promise<Answer & { notes?: Note[]; more?: boolean }>,
|
|
156
|
+
addNote: (text: string) => call('/api/notes/add', { text }) as Promise<Answer & { note?: Note }>,
|
|
157
|
+
updateNote: (id: number, text: string) => call('/api/notes/update', { id, text }) as Promise<Answer & { note?: Note }>,
|
|
158
|
+
deleteNote: (id: number) => call('/api/notes/delete', { id }),
|
|
159
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as icons from 'lupine.core/icons';
|
|
2
|
+
/** sample content for the template pages (replace with API data) */
|
|
3
|
+
export const FEATURED = [
|
|
4
|
+
{ id: '1', title: 'Getting started', subtitle: 'Pages live in src/pages', color: '#1677ff' },
|
|
5
|
+
{ id: '2', title: 'Themes', subtitle: 'Light, dark and derived themes', color: '#7a5af8' },
|
|
6
|
+
{ id: '3', title: 'Everywhere', subtitle: 'iOS · Android · Web · Desktop', color: '#12b886' },
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
export const RECENT = [
|
|
10
|
+
{ id: '11', title: 'Quarterly report', when: '2 hours ago', icon: icons.file },
|
|
11
|
+
{ id: '12', title: 'Team photos', when: 'Yesterday', icon: icons.image },
|
|
12
|
+
{ id: '13', title: 'Release checklist', when: 'Monday', icon: icons.list },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export const MESSAGES = [
|
|
16
|
+
{ id: 'm1', from: 'Lupine', text: 'Welcome to Lupine Notes!', unread: true, when: '09:12' },
|
|
17
|
+
{ id: 'm2', from: 'Build bot', text: 'Web build finished in 18 s', unread: true, when: '08:40' },
|
|
18
|
+
{ id: 'm3', from: 'Ada', text: 'Can you review the new settings page?', unread: true, when: 'Yesterday' },
|
|
19
|
+
{ id: 'm4', from: 'Grace', text: 'Desktop app runs on Windows too.', unread: false, when: 'Monday' },
|
|
20
|
+
];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export const ja = {
|
|
2
|
+
app: { name: 'Lupine ノート', tagline: 'iOS・Android・Web・デスクトップを一つのコードで' },
|
|
3
|
+
nav: { home: 'ホーム', components: 'コンポーネント', discover: '作成', inbox: '受信箱', me: 'マイページ', settings: '設定', about: 'このアプリについて', menu: 'メニュー' },
|
|
4
|
+
home: {
|
|
5
|
+
welcome: 'おかえりなさい',
|
|
6
|
+
featured: 'おすすめ',
|
|
7
|
+
shortcuts: 'ショートカット',
|
|
8
|
+
recent: '最近の項目',
|
|
9
|
+
openPanel: 'スライドウィンドウを開く',
|
|
10
|
+
panelText: 'このウィンドウは現在のページの上にスライドして表示されます。URL が不要な詳細やフォームに使います。',
|
|
11
|
+
seeAll: 'すべて',
|
|
12
|
+
},
|
|
13
|
+
discover: { title: '新規作成', note: 'ノート', photo: '写真を撮る', task: 'タスク', created: '作成しました:{what}' },
|
|
14
|
+
inbox: { empty: '新しいメッセージはありません', markRead: 'すべて既読にする', unread: '未読 {n} 件' },
|
|
15
|
+
me: { guest: 'ゲスト', signIn: 'ログイン', profile: 'プロフィール', favourites: 'お気に入り', history: '履歴', help: 'ヘルプとフィードバック' },
|
|
16
|
+
settings: {
|
|
17
|
+
appearance: '外観',
|
|
18
|
+
theme: 'テーマ',
|
|
19
|
+
language: '言語',
|
|
20
|
+
textSize: '文字サイズ',
|
|
21
|
+
notifications: '通知',
|
|
22
|
+
pushEnabled: 'プッシュ通知',
|
|
23
|
+
sound: 'サウンド',
|
|
24
|
+
storage: 'ストレージ',
|
|
25
|
+
clearCache: 'キャッシュを消去',
|
|
26
|
+
cacheCleared: 'キャッシュを消去しました',
|
|
27
|
+
app: 'アプリ',
|
|
28
|
+
server: 'サーバー',
|
|
29
|
+
thisSite: 'このサイト',
|
|
30
|
+
version: 'バージョン',
|
|
31
|
+
},
|
|
32
|
+
item: { title: '項目 {id}', body: '詳細ページは通常のルート(/item/[id])です。ディープリンクとブラウザの戻るが使え、Web サーバーで描画することもできます。' },
|
|
33
|
+
auth: {
|
|
34
|
+
signIn: 'ログイン',
|
|
35
|
+
register: 'アカウント作成',
|
|
36
|
+
username: 'ユーザー名',
|
|
37
|
+
usernameRule: '3〜50 文字:英字、数字、_ . @ -',
|
|
38
|
+
password: 'パスワード',
|
|
39
|
+
password2: 'パスワード(確認)',
|
|
40
|
+
passwordsDiffer: 'パスワードが一致しません',
|
|
41
|
+
haveAccount: 'アカウントをお持ちの方',
|
|
42
|
+
noAccount: '新しいアカウントを作成',
|
|
43
|
+
signOut: 'ログアウト',
|
|
44
|
+
welcome: '{name} としてログイン中',
|
|
45
|
+
registered: 'ようこそ、{name} さん:アカウントを作成しました',
|
|
46
|
+
server: 'サーバー',
|
|
47
|
+
thisSite: 'このサイト',
|
|
48
|
+
},
|
|
49
|
+
notes: {
|
|
50
|
+
title: 'マイノート',
|
|
51
|
+
placeholder: 'メモを書く…',
|
|
52
|
+
add: '追加',
|
|
53
|
+
empty: 'ノートはまだありません',
|
|
54
|
+
signInFirst: 'ログインするとサーバーに保存できます',
|
|
55
|
+
signInText: 'ノートはアカウントに保存され、どの端末でも Web でも見られます。',
|
|
56
|
+
deleted: '削除しました',
|
|
57
|
+
retry: '再試行',
|
|
58
|
+
more: '以前のノート',
|
|
59
|
+
},
|
|
60
|
+
// the texts of the codes of the API (shell/api.ts: messageOf)
|
|
61
|
+
api: {
|
|
62
|
+
offline: 'サーバーに接続できません',
|
|
63
|
+
bad_answer: 'サーバーから予期しない応答がありました({status})',
|
|
64
|
+
bad_request: 'サーバーがリクエストを理解できませんでした',
|
|
65
|
+
bad_username: 'ユーザー名:3〜50 文字(英字、数字、_ . @ -)',
|
|
66
|
+
bad_password: 'パスワード:6〜256 文字',
|
|
67
|
+
username_taken: 'このユーザー名は使われています',
|
|
68
|
+
login_failed: 'ユーザー名またはパスワードが違います',
|
|
69
|
+
too_many_attempts: 'ログインの失敗が多すぎます。{minutes} 分後にもう一度お試しください',
|
|
70
|
+
not_signed_in: 'もう一度ログインしてください',
|
|
71
|
+
bad_note: 'ノートは 1〜2000 文字です',
|
|
72
|
+
too_many_notes: 'ノートは最大 {max} 件です:いくつか削除してください',
|
|
73
|
+
note_not_found: 'このノートはもうありません',
|
|
74
|
+
no_crypto_key: 'サーバーの .env に CRYPTO_KEY がありません',
|
|
75
|
+
forbidden_origin: 'このページからのリクエストはサーバーに拒否されました',
|
|
76
|
+
server_error: 'サーバーでエラーが発生しました',
|
|
77
|
+
failed: 'エラーが発生しました',
|
|
78
|
+
},
|
|
79
|
+
about: { text: 'lupine.native で作られています。ページは src/pages、フレームは src/shell を編集します。' },
|
|
80
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export const zhCN = {
|
|
2
|
+
app: { name: 'Lupine 笔记', tagline: '一套代码:iOS、Android、网页和桌面' },
|
|
3
|
+
nav: { home: '首页', components: '组件', discover: '创建', inbox: '消息', me: '我的', settings: '设置', about: '关于', menu: '菜单' },
|
|
4
|
+
home: {
|
|
5
|
+
welcome: '欢迎回来',
|
|
6
|
+
featured: '推荐',
|
|
7
|
+
shortcuts: '快捷入口',
|
|
8
|
+
recent: '最近项目',
|
|
9
|
+
openPanel: '打开滑动窗口',
|
|
10
|
+
panelText: '这个窗口从右侧滑入,覆盖当前页面——适合不需要独立网址的详情和表单。',
|
|
11
|
+
seeAll: '全部',
|
|
12
|
+
},
|
|
13
|
+
discover: { title: '新建', note: '新建笔记', photo: '拍照', task: '新建任务', created: '已创建:{what}' },
|
|
14
|
+
inbox: { empty: '没有新消息', markRead: '全部标为已读', unread: '{n} 条未读' },
|
|
15
|
+
me: { guest: '游客', signIn: '登录', profile: '个人资料', favourites: '我的收藏', history: '浏览历史', help: '帮助与反馈' },
|
|
16
|
+
settings: {
|
|
17
|
+
appearance: '外观',
|
|
18
|
+
theme: '主题',
|
|
19
|
+
language: '语言',
|
|
20
|
+
textSize: '字体大小',
|
|
21
|
+
notifications: '通知',
|
|
22
|
+
pushEnabled: '推送通知',
|
|
23
|
+
sound: '声音',
|
|
24
|
+
storage: '存储',
|
|
25
|
+
clearCache: '清除缓存',
|
|
26
|
+
cacheCleared: '缓存已清除',
|
|
27
|
+
app: '应用',
|
|
28
|
+
server: '服务器',
|
|
29
|
+
thisSite: '本网站',
|
|
30
|
+
version: '版本',
|
|
31
|
+
},
|
|
32
|
+
item: { title: '项目 {id}', body: '详情页是普通路由(/item/[id]):支持深度链接和浏览器后退,网页服务器也可以直接渲染它。' },
|
|
33
|
+
auth: {
|
|
34
|
+
signIn: '登录',
|
|
35
|
+
register: '注册账号',
|
|
36
|
+
username: '用户名',
|
|
37
|
+
usernameRule: '3 到 50 个字符:字母、数字、_ . @ -',
|
|
38
|
+
password: '密码',
|
|
39
|
+
password2: '再次输入密码',
|
|
40
|
+
passwordsDiffer: '两次输入的密码不一致',
|
|
41
|
+
haveAccount: '已有账号,去登录',
|
|
42
|
+
noAccount: '没有账号?注册',
|
|
43
|
+
signOut: '退出登录',
|
|
44
|
+
welcome: '已登录:{name}',
|
|
45
|
+
registered: '欢迎,{name}:账号已创建',
|
|
46
|
+
server: '服务器',
|
|
47
|
+
thisSite: '本网站',
|
|
48
|
+
},
|
|
49
|
+
notes: {
|
|
50
|
+
title: '我的笔记',
|
|
51
|
+
placeholder: '写点什么…',
|
|
52
|
+
add: '添加',
|
|
53
|
+
empty: '还没有笔记',
|
|
54
|
+
signInFirst: '登录后可以把笔记保存到服务器',
|
|
55
|
+
signInText: '笔记跟随账号保存,在每台设备和网页上都能看到。',
|
|
56
|
+
deleted: '已删除',
|
|
57
|
+
retry: '重试',
|
|
58
|
+
more: '更早的笔记',
|
|
59
|
+
},
|
|
60
|
+
// the texts of the codes of the API (shell/api.ts: messageOf)
|
|
61
|
+
api: {
|
|
62
|
+
offline: '无法连接服务器',
|
|
63
|
+
bad_answer: '服务器返回了意外的结果({status})',
|
|
64
|
+
bad_request: '服务器无法理解该请求',
|
|
65
|
+
bad_username: '用户名:3 到 50 个字符(字母、数字、_ . @ -)',
|
|
66
|
+
bad_password: '密码:6 到 256 个字符',
|
|
67
|
+
username_taken: '该用户名已被使用',
|
|
68
|
+
login_failed: '用户名或密码错误',
|
|
69
|
+
too_many_attempts: '登录失败次数过多,请 {minutes} 分钟后再试',
|
|
70
|
+
not_signed_in: '请重新登录',
|
|
71
|
+
bad_note: '笔记需要 1 到 2000 个字符',
|
|
72
|
+
too_many_notes: '最多 {max} 条笔记:请先删除一些',
|
|
73
|
+
note_not_found: '这条笔记已不存在',
|
|
74
|
+
no_crypto_key: '服务器的 .env 中没有设置 CRYPTO_KEY',
|
|
75
|
+
forbidden_origin: '服务器拒绝了来自此页面的请求',
|
|
76
|
+
server_error: '服务器出错了',
|
|
77
|
+
failed: '出错了',
|
|
78
|
+
},
|
|
79
|
+
about: { text: '基于 lupine.native。修改 src/pages 中的页面,src/shell 中的框架。' },
|
|
80
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { addLnTexts, addTexts, lnJa, lnZhHans, setLanguages } from 'lupine.native.components';
|
|
2
|
+
import { ja } from './locales/ja';
|
|
3
|
+
import { zhCN } from './locales/zh-CN';
|
|
4
|
+
|
|
5
|
+
// English is in the code: t('home.welcome', 'Welcome back'); here the other languages
|
|
6
|
+
addTexts('zh-CN', zhCN);
|
|
7
|
+
addTexts('ja', ja);
|
|
8
|
+
// and those of the controls
|
|
9
|
+
addLnTexts({ 'zh-Hans': lnZhHans, ja: lnJa });
|
|
10
|
+
setLanguages([
|
|
11
|
+
{ code: 'en', name: 'English' },
|
|
12
|
+
{ code: 'zh-CN', name: '简体中文' },
|
|
13
|
+
{ code: 'ja', name: '日本語' },
|
|
14
|
+
]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2020",
|
|
4
|
+
"lib": ["es2020"],
|
|
5
|
+
"types": [],
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"jsxImportSource": "lupine.native.core",
|
|
8
|
+
"module": "esnext",
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"skipLibCheck": true
|
|
13
|
+
},
|
|
14
|
+
// the web entry is the only file that may use the DOM, so it isn't checked with these settings
|
|
15
|
+
"include": ["src"],
|
|
16
|
+
"exclude": ["src/index.web.tsx"]
|
|
17
|
+
}
|
package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/lupine.json
RENAMED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "lupine-template-
|
|
2
|
+
"name": "lupine-template-fullstack-note",
|
|
3
|
+
"nativeOut": "dist/native",
|
|
4
|
+
"nativeApp": "app",
|
|
3
5
|
"webEntryPoints": [
|
|
4
6
|
{
|
|
5
7
|
"index": "web/src/index.tsx",
|
|
@@ -20,4 +22,4 @@
|
|
|
20
22
|
"to": "data/resources"
|
|
21
23
|
}
|
|
22
24
|
]
|
|
23
|
-
}
|
|
25
|
+
}
|
package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/web/src/index.html
RENAMED
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<title><!--META-TITLE--></title>
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
7
7
|
<!--META-ENV-START-->
|
|
8
8
|
<!--META-ENV-END-->
|
|
9
|
-
<link rel="shortcut icon" href="
|
|
10
|
-
<
|
|
9
|
+
<link rel="shortcut icon" href="/assets/favicon.ico?t={hash}" type="image/x-icon" />
|
|
10
|
+
<style>
|
|
11
|
+
html,
|
|
12
|
+
body,
|
|
13
|
+
.lupine-root {
|
|
14
|
+
height: 100%;
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
11
18
|
<script defer src="{SUBDIR}/index.js?t={hash}"></script>
|
|
12
19
|
</head>
|
|
13
20
|
<body>
|
|
@@ -0,0 +1,15 @@
|
|
|
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';
|
|
5
|
+
|
|
6
|
+
// The page of the site is the app (apps/lupine-template-fullstack-note/app), in the same bundle. Pages of the site itself
|
|
7
|
+
// go into pageRouter before it, such as pageRouter.use('/note/:id', NotePage). keep: the app is made once and stays; when
|
|
8
|
+
// the address changes (its own pages, the back button) it follows the address itself.
|
|
9
|
+
// The app calls the API of this site (/api, api/src/service) with the cookie of the session.
|
|
10
|
+
|
|
11
|
+
setDefaultPageTitle('Lupine Notes');
|
|
12
|
+
|
|
13
|
+
const pageRouter = new PageRouter();
|
|
14
|
+
pageRouter.use('*', AppPage, { keep: true });
|
|
15
|
+
bindRouter(pageRouter);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Full-stack Starter
|
|
2
|
+
|
|
3
|
+
One app for iOS, Android, macOS, Windows and the web (lupine.native), a web site that serves the web version of it with admin pages (lupine.web), and an API with a database (lupine.api).
|
|
4
|
+
|
|
5
|
+
<!-- screenshots macos=1 windows=13 web=/ ios=1,11 android=11,13 -->
|
|
6
|
+
<table>
|
|
7
|
+
<tr><th>macOS</th><th>Windows</th><th>Web</th></tr>
|
|
8
|
+
<tr><td><a href="docs/macos-1-home.png"><img src="docs/macos-1-home.png" width="253" alt="macOS"></a></td><td><a href="docs/windows-13-signed-in.png"><img src="docs/windows-13-signed-in.png" width="253" alt="Windows"></a></td><td><a href="docs/web-1.png"><img src="docs/web-1.png" width="253" alt="Web"></a></td></tr>
|
|
9
|
+
</table>
|
|
10
|
+
<table>
|
|
11
|
+
<tr><th colspan="2">iOS</th><th colspan="2">Android</th></tr>
|
|
12
|
+
<tr><td><a href="docs/ios-1-home.png"><img src="docs/ios-1-home.png" width="183" alt="iOS"></a></td><td><a href="docs/ios-11-dark.png"><img src="docs/ios-11-dark.png" width="183" alt="iOS"></a></td><td><a href="docs/android-11-dark.png"><img src="docs/android-11-dark.png" width="183" alt="Android"></a></td><td><a href="docs/android-13-signed-in.png"><img src="docs/android-13-signed-in.png" width="183" alt="Android"></a></td></tr>
|
|
13
|
+
</table>
|
|
14
|
+
<!-- /screenshots -->
|
|
15
|
+
|
|
16
|
+
| Part | |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `app/` | the app: stories (list, search, story page), sign-in with a password or a code by e-mail, registration, new password, the user's pages (mine, favorites, profile, contact), settings (theme, English / Chinese), about. Its settings: `lupineNative` in `app/package.json`; the Chinese texts: `app/src/shell/texts.ts` |
|
|
19
|
+
| `web/` | the site: every address is the web version of the app, rendered on the server (`web/src/index.tsx`) |
|
|
20
|
+
| `/admin` | the admin pages, an entry of their own in `lupine.json` (`web/src/admin`): an admin of the app sees Site (stories, users, the website); the developer (`DEV_ADMIN_USER` / `DEV_ADMIN_PASS`) sees the tools too (database, logs, settings) |
|
|
21
|
+
| `api/` | the API: routes in `api/src/service/api.ts`; sign-in, codes and profile in `user-api.ts`; `admin-api.ts`, `contact-api.ts` |
|
|
22
|
+
| `lupine.json` | what `npm run dev` builds; `"nativeApp": "app"` and `"nativeOut": "dist/native"` for `lupine-native` |
|
|
23
|
+
|
|
24
|
+
The stories are sample data (`app/src/shell/stories.ts`), and the favorites are kept on the device for each user; a real app gets both from its API.
|
|
25
|
+
|
|
26
|
+
## First start
|
|
27
|
+
|
|
28
|
+
1. In `.env`: `CRYPTO_KEY`, `ADMIN_USER` / `ADMIN_PASS`, `DEV_ADMIN_USER` / `DEV_ADMIN_PASS`, and for mail `SEND_EMAIL_USER` / `SEND_EMAIL_PASS`. The two passwords are hashes: create-lupine fills in hashes of random passwords that nobody knows, so make hashes of yours with the command in the comment above them.
|
|
29
|
+
2. `npm run dev` with `lupine-template-fullstack-starter` in `APPS` and a `DOMAINS:lupine-template-fullstack-starter=...` line, then open `/admin`, sign in as `DEV_ADMIN_USER` and create the tables from `api/resources/install.sqlite.sql` (or `install.mysql.sql`).
|
|
30
|
+
3. Sign in at `/login` as `ADMIN_USER`: Mine then shows "Admin pages" (`/admin`). The contact form sends to `siteEmail` of the settings (`/admin`, Site > Website).
|
|
31
|
+
|
|
32
|
+
## The apps
|
|
33
|
+
|
|
34
|
+
In a project of create-lupine (and in the repository of this template) the same is in the scripts: `npm run run-mac`, `run-ios`, `run-android`, `run-exe`; `build-android` (the apk for the store), `bump` (the next version), `icons` (the icons of the site from the icon of the app), `release` (a folder for the server).
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run native -- macos --app=apps/lupine-template-fullstack-starter --run
|
|
38
|
+
npm run native -- ios --app=apps/lupine-template-fullstack-starter --run
|
|
39
|
+
npm run native -- android --app=apps/lupine-template-fullstack-starter --run
|
|
40
|
+
npm run native -- windows --app=apps/lupine-template-fullstack-starter --run
|
|
41
|
+
npm run native -- web --app=apps/lupine-template-fullstack-starter --watch # the app alone, as a static page
|
|
42
|
+
npm run native -- test macos --app=apps/lupine-template-fullstack-starter # app/src/index.test.tsx
|
|
43
|
+
# the apps for the stores, which call your server (WEB.API_BASE_URL of .env.mobile)
|
|
44
|
+
npm run native -- android --app=apps/lupine-template-fullstack-starter --release --env=.env.mobile
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The builds are in `dist/native/lupine-template-fullstack-starter-app/<platform>`.
|
|
48
|
+
|
|
49
|
+
## The address of the API
|
|
50
|
+
|
|
51
|
+
The native apps call `WEB.API_BASE_URL` of the env file they are built with (`--env=`; `.env.development` by default, `.env.production` with `--release`), or `lupine-template-fullstack-starter.WEB.API_BASE_URL` for this app alone. Put the address of your server (`https://example.com/`) into `.env.mobile` and build the apps for the stores with `--release --env=.env.mobile`: it imports `.env`, and the site, built with `.env.production`, doesn't get the address. The key goes into the bundle, so it is public.
|
|
52
|
+
|
|
53
|
+
Without it the app calls `http://lupine-template-fullstack-starter.app.localhost:<WEB.API_PORT>`: the server of `npm run dev` on the same computer. The Android emulator uses `http://10.0.2.2:<WEB.API_PORT>` instead. The server finds the app by the host name, so add `lupine-template-fullstack-starter.app.localhost` and `10.0.2.2` to its `DOMAINS:` line, unless that line is empty (as in a new project: the app gets every host) or `*`. A phone needs an address of the computer in the network. Settings shows the address the app uses. Release builds for Android refuse plain `http://`.
|
|
54
|
+
|
|
55
|
+
In the browser the app always calls the site it comes from, and `WEB.API_BASE_URL` is not used.
|
|
56
|
+
|
|
57
|
+
## Sessions and security
|
|
58
|
+
|
|
59
|
+
- In the browser the API sets the httpOnly cookie `_token` when you sign in, so the scripts of the page never hold the token.
|
|
60
|
+
- A native app has no cookie store. It keeps the token from the sign-in answer in `storage` and sends it as `Cookie: _token=...`. The API puts the token in the answer only for requests without `Origin`, which browsers always send with a POST, so a script in a page can't get it from there either. Signing out removes it and calls `/api/logout`.
|
|
61
|
+
- The admin pages are web only. On a phone "Admin pages" opens the site in the browser, where you sign in again.
|
|
62
|
+
- Writing routes are POST only and check the session. Uploads check the type and the size. A code by e-mail can be asked for once a minute, and the answer doesn't tell whether the address has an account. The contact form takes five messages an hour from an address (per worker process, so limit it in front of the server too).
|
|
63
|
+
- Requests from native apps have no `Origin` header, so the CSRF check of the API lets them through. It still checks browsers.
|
|
64
|
+
|
|
65
|
+
## Dropped from the web-only version
|
|
66
|
+
|
|
67
|
+
- `/demo`: the demos of lupine.web.components are still at `/admin/demo`.
|
|
68
|
+
- The demo pages of nested frames (`/frame1`, `/frame2`, `/page1`, `/page2`, `/user1`).
|
|
69
|
+
- The lupine.web user pages (`/user/...`, `/login-code`, `/reset-pw`) and the copies in Chinese (`login-zh.tsx` and the others). The app has these pages now, with the Chinese texts in `app/src/shell/texts.ts`.
|
|
70
|
+
- The icon font in the site's own pages: they use `lupine.core/icons` (`<Icon name={icons.x} />`). The font (`web/icons-font.config.js`, `web/assets/icons-font`) stays for the pages of lupine.api in `/admin`.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#-- Auto Created for MySQL / MariaDB
|
|
2
|
+
#-- Never name a table with plural (such as "users")
|
|
3
|
+
#-- Never name a table using a reserved keyword (such as "user")
|
|
4
|
+
#-- Never prefix your table name with "tbl" or some other object type prefix
|
|
5
|
+
|
|
6
|
+
CREATE TABLE IF NOT EXISTS $__s_page (
|
|
7
|
+
pageid VARCHAR(50) NOT NULL,
|
|
8
|
+
name VARCHAR(100) NOT NULL DEFAULT '',
|
|
9
|
+
is_component INTEGER NOT NULL DEFAULT 0,
|
|
10
|
+
remark VARCHAR(250) NOT NULL DEFAULT '',
|
|
11
|
+
package VARCHAR(20) NOT NULL DEFAULT '',
|
|
12
|
+
accesslevel CHAR(1) NOT NULL DEFAULT '0',
|
|
13
|
+
json TEXT NOT NULL,
|
|
14
|
+
updateduserid INTEGER,
|
|
15
|
+
updatetime BIGINT NOT NULL DEFAULT 0,
|
|
16
|
+
PRIMARY KEY (pageid)
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
CREATE TABLE IF NOT EXISTS $__s_menu (
|
|
20
|
+
menuid VARCHAR(50) NOT NULL,
|
|
21
|
+
name VARCHAR(100) NOT NULL DEFAULT '',
|
|
22
|
+
remark VARCHAR(250) NOT NULL DEFAULT '',
|
|
23
|
+
package VARCHAR(20) NOT NULL DEFAULT '',
|
|
24
|
+
accesslevel CHAR(1) NOT NULL DEFAULT '0',
|
|
25
|
+
json TEXT NOT NULL,
|
|
26
|
+
updateduserid INTEGER,
|
|
27
|
+
updatetime BIGINT NOT NULL DEFAULT 0,
|
|
28
|
+
PRIMARY KEY (menuid)
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
CREATE TABLE IF NOT EXISTS $__s_process (
|
|
32
|
+
processid VARCHAR(50) NOT NULL,
|
|
33
|
+
name VARCHAR(100) NOT NULL DEFAULT '',
|
|
34
|
+
accesslevel CHAR(1) NOT NULL DEFAULT '0',
|
|
35
|
+
json TEXT NOT NULL,
|
|
36
|
+
package VARCHAR(20) NOT NULL DEFAULT '',
|
|
37
|
+
remark VARCHAR(250) NOT NULL DEFAULT '',
|
|
38
|
+
updatetime BIGINT NOT NULL DEFAULT 0,
|
|
39
|
+
PRIMARY KEY (processid)
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
CREATE TABLE IF NOT EXISTS $__s_user (
|
|
43
|
+
id INTEGER NOT NULL AUTO_INCREMENT,
|
|
44
|
+
gid INTEGER NOT NULL DEFAULT 1,
|
|
45
|
+
level INTEGER NOT NULL DEFAULT 0,
|
|
46
|
+
nickname VARCHAR(200) NOT NULL DEFAULT '',
|
|
47
|
+
username VARCHAR(150) NOT NULL DEFAULT '',
|
|
48
|
+
email VARCHAR(100) NOT NULL DEFAULT '',
|
|
49
|
+
password VARCHAR(100) NOT NULL DEFAULT '',
|
|
50
|
+
usertype VARCHAR(25) NOT NULL DEFAULT '',
|
|
51
|
+
block CHAR(1) NOT NULL DEFAULT '0',
|
|
52
|
+
sendemail CHAR(1) DEFAULT '0',
|
|
53
|
+
gender VARCHAR(10) DEFAULT '0',
|
|
54
|
+
age INTEGER NOT NULL DEFAULT 0,
|
|
55
|
+
training INTEGER NOT NULL DEFAULT 0,
|
|
56
|
+
preference VARCHAR(100) NOT NULL DEFAULT '',
|
|
57
|
+
registerdate VARCHAR(20) NOT NULL DEFAULT '',
|
|
58
|
+
lastvisitdate VARCHAR(20) NOT NULL DEFAULT '',
|
|
59
|
+
activated CHAR(1) NOT NULL DEFAULT '0',
|
|
60
|
+
activation VARCHAR(10) NOT NULL DEFAULT '',
|
|
61
|
+
points INTEGER NOT NULL DEFAULT 0,
|
|
62
|
+
pwtips VARCHAR(100) DEFAULT '',
|
|
63
|
+
pwretry INTEGER NOT NULL DEFAULT 0,
|
|
64
|
+
pwquestion VARCHAR(100) DEFAULT '',
|
|
65
|
+
pwanswer VARCHAR(100) DEFAULT '',
|
|
66
|
+
PRIMARY KEY (id)
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
#-- TABLE:$__st_calendar
|
|
70
|
+
CREATE TABLE IF NOT EXISTS $__s_calendar (
|
|
71
|
+
calendarid VARCHAR(50) NOT NULL,
|
|
72
|
+
title VARCHAR(250) NOT NULL DEFAULT '',
|
|
73
|
+
published CHAR(1) NOT NULL DEFAULT '0',
|
|
74
|
+
remark VARCHAR(250),
|
|
75
|
+
monthfrom VARCHAR(6),
|
|
76
|
+
monthto VARCHAR(6),
|
|
77
|
+
bkcolor VARCHAR(7),
|
|
78
|
+
cidstring VARCHAR(50) NOT NULL DEFAULT '',
|
|
79
|
+
PRIMARY KEY (calendarid)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
CREATE TABLE IF NOT EXISTS $__s_user_right (
|
|
83
|
+
username VARCHAR(150) NOT NULL,
|
|
84
|
+
rightsid VARCHAR(50) NOT NULL,
|
|
85
|
+
rightsgroup VARCHAR(10) NOT NULL DEFAULT '',
|
|
86
|
+
value TEXT NOT NULL,
|
|
87
|
+
PRIMARY KEY (username, rightsid)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
CREATE TABLE IF NOT EXISTS $__image_folder (
|
|
91
|
+
id INTEGER NOT NULL AUTO_INCREMENT,
|
|
92
|
+
folder_id VARCHAR(10) NOT NULL DEFAULT '',
|
|
93
|
+
display_name VARCHAR(50) NOT NULL DEFAULT '',
|
|
94
|
+
parent_full_path VARCHAR(255) NOT NULL DEFAULT '',
|
|
95
|
+
full_path VARCHAR(255) NOT NULL DEFAULT '',
|
|
96
|
+
PRIMARY KEY (id)
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
CREATE TABLE IF NOT EXISTS $__image (
|
|
100
|
+
id INTEGER NOT NULL AUTO_INCREMENT,
|
|
101
|
+
file_id VARCHAR(20) NOT NULL DEFAULT '',
|
|
102
|
+
display_name VARCHAR(50) NOT NULL DEFAULT '',
|
|
103
|
+
parent_full_path VARCHAR(255) NOT NULL DEFAULT '',
|
|
104
|
+
version INTEGER NOT NULL DEFAULT 0,
|
|
105
|
+
updatetime BIGINT NOT NULL DEFAULT 0,
|
|
106
|
+
PRIMARY KEY (id)
|
|
107
|
+
);
|