diff --git a/JWT.py b/JWT.py index b10db97..f0e57da 100644 --- a/JWT.py +++ b/JWT.py @@ -3,6 +3,8 @@ from model import database import asyncio oauth2_scheme = OAuth2PasswordBearer( + scheme_name='获取 JWT Bearer 令牌', + description='用于获取 JWT Bearer 令牌,需要以表单的形式提交', tokenUrl="/api/token" ) diff --git a/README.md b/README.md index 26dbe70..b8aa88d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ * @Author: 于小丘 海枫 * @Date: 2024-11-29 20:06:02 * @LastEditors: Yuerchu admin@yuxiaoqiu.cn - * @LastEditTime: 2024-11-29 20:28:54 * @FilePath: /Findreve/README.md * @Description: Findreve * @@ -28,7 +27,10 @@
## 介绍 Introduction -Findreve 是一款强大且直观的解决方案,旨在帮助您管理个人物品,并确保丢失后能够安全找回。每个物品都会被分配一个 `唯一 ID` ,并生成一个 `安全链接` ,可轻松嵌入到 `二维码` 或 `NFC 标签` 中。当扫描该代码时,会将拾得者引导至一个专门的网页,上面显示物品详情和您的联系信息,既保障隐私又便于沟通。无论您是在管理个人物品还是专业资产,Findreve 都能以高效、简便的方式弥合丢失与找回之间的距离。 +Findreve 是一款强大且直观的解决方案,旨在帮助您管理个人物品,并确保丢失后能够安全找回。 +每个物品都会被分配一个 `唯一 ID` ,并生成一个 `安全链接` ,可轻松嵌入到 `二维码` 或 `NFC 标签` 中。 +当扫描该代码时,会将拾得者引导至一个专门的网页,上面显示物品详情和您的联系信息,既保障隐私又便于沟通。 +无论您是在管理个人物品还是专业资产,Findreve 都能以高效、简便的方式弥合丢失与找回之间的距离。 Findreve is a powerful and intuitive solution, an enhanced version of Findreve, designed to help you manage your personal items and ensure their safe recovery in case of loss. Each @@ -69,4 +71,6 @@ Open Source Free Version: Licensed under the `GPLv3`. 基于赞助的专业版:基于您的赞助,您可获得附加功能和源代码的版本,允许进一步开发用于个人或内部使用。 然而,不允许重新分发修改后的或原始的源代码。 -Donation-Based Premium Version: By making a donation, you can access a version with additional features and source code, which allows further development for personal or internal use. However, redistribution of the modified or original source code is not permitted. \ No newline at end of file +Donation-Based Premium Version: By making a donation, you can access a version with additional features +and source code, which allows further development for personal or internal use. However, redistribution +of the modified or original source code is not permitted. \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..c18b262 --- /dev/null +++ b/app.py @@ -0,0 +1,29 @@ +from fastapi import FastAPI +from contextlib import asynccontextmanager +import model.database + +# 定义程序参数 +APP_NAME: str = 'Findreve' +VERSION: str = '2.0.0' +summary='标记、追踪与找回 —— 就这么简单。' +description='Findreve 是一款强大且直观的解决方案,旨在帮助您管理个人物品,'\ + '并确保丢失后能够安全找回。每个物品都会被分配一个 唯一 ID ,'\ + '并生成一个 安全链接 ,可轻松嵌入到 二维码 或 NFC 标签 中。'\ + '当扫描该代码时,会将拾得者引导至一个专门的网页,上面显示物品详情和您的联系信息,'\ + '既保障隐私又便于沟通。无论您是在管理个人物品还是专业资产,'\ + 'Findreve 都能以高效、简便的方式弥合丢失与找回之间的距离。' + +# Findreve 的生命周期 +@asynccontextmanager +async def lifespan(app: FastAPI): + await model.database.Database().init_db() + yield + +# 定义 Findreve 服务器 +app = FastAPI( + title=APP_NAME, + version=VERSION, + summary=summary, + description=description, + lifespan=lifespan +) \ No newline at end of file diff --git a/frontend/.browserslistrc b/frontend/.browserslistrc new file mode 100644 index 0000000..dc3bc09 --- /dev/null +++ b/frontend/.browserslistrc @@ -0,0 +1,4 @@ +> 1% +last 2 versions +not dead +not ie 11 diff --git a/frontend/.editorconfig b/frontend/.editorconfig new file mode 100644 index 0000000..7053c49 --- /dev/null +++ b/frontend/.editorconfig @@ -0,0 +1,5 @@ +[*.{js,jsx,ts,tsx,vue}] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/frontend/.github/copilot-instructions.md b/frontend/.github/copilot-instructions.md new file mode 100644 index 0000000..4147695 --- /dev/null +++ b/frontend/.github/copilot-instructions.md @@ -0,0 +1,41 @@ +# Findreve Frontend 项目指南 - GitHub Copilot 指令 + +## 项目概述 +Findreve 是一款强大且直观的解决方案,旨在帮助您管理个人物品,并确保丢失后能够安全找回。每个物品都会被分配一个 `唯一 ID` ,并生成一个 `安全链接` ,可轻松嵌入到 `二维码` 或 `NFC 标签` 中。当扫描该代码时,会将拾得者引导至一个专门的网页,上面显示物品详情和您的联系信息,既保障隐私又便于沟通。无论您是在管理个人物品还是专业资产,Findreve 都能以高效、简便的方式弥合丢失与找回之间的距离。 +而 Findreve Frontend 作为 Findreve 的前端,采用 Vue + Vuetify 3 开发。 + +## 项目规划 +[ ] 追平 Findreve 早期基于 NiceGUI 开发的前端 + +## 代码规范 +- 使用类型提示增强代码可读性 +- 所有函数和类都应有reST风格的文档字符串(docstring) +- 项目的日志模块使用英语输出 +- 使用异步编程模式处理并发 +- 尽可能写出弹性可扩展、可维护的代码 + +## 项目结构 +- `.github/` : Github 相关 +- `public/` : 纯静态文件 +- `src/` +- `.browserslistrc` +- `.editorconfig` +- `.gitignore` +- `README.md` +- `index.html` +- `jsconfig.json` +- `package.json` +- `vite.config.mjs` +- `yarn.lock` + +## 回复用户规则 +- 当用户提出了产品的问题或者解决问题的思路时,应当在适时且随机的时候回答前肯定用户的想法 +- 如 `你的理解非常到位,抓住了问题的核心`、`这个想法非常不错` 等等 +- 每次鼓励尽可能用不同的词语和语法,但也不要次次都鼓励 + +## 命名约定 +- 类名: className +- 函数和变量: getInfo +- 常量: UPPER_SNAKE_CASE +- 文件名: snake_case.vue +- 模块名: snake_case \ No newline at end of file diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 0000000..11f5d71 --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,22 @@ +.DS_Store +node_modules +/dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/frontend/README.md b/frontend/README.md new file mode 100644 index 0000000..f58f676 --- /dev/null +++ b/frontend/README.md @@ -0,0 +1,79 @@ +# Vuetify (Default) + +This is the official scaffolding tool for Vuetify, designed to give you a head start in building your new Vuetify application. It sets up a base template with all the necessary configurations and standard directory structure, enabling you to begin development without the hassle of setting up the project from scratch. + +## ❗️ Important Links + +- 📄 [Docs](https://vuetifyjs.com/) +- 🚨 [Issues](https://issues.vuetifyjs.com/) +- 🏬 [Store](https://store.vuetifyjs.com/) +- 🎮 [Playground](https://play.vuetifyjs.com/) +- 💬 [Discord](https://community.vuetifyjs.com) + +## 💿 Install + +Set up your project using your preferred package manager. Use the corresponding command to install the dependencies: + +| Package Manager | Command | +|---------------------------------------------------------------|----------------| +| [yarn](https://yarnpkg.com/getting-started) | `yarn install` | +| [npm](https://docs.npmjs.com/cli/v7/commands/npm-install) | `npm install` | +| [pnpm](https://pnpm.io/installation) | `pnpm install` | +| [bun](https://bun.sh/#getting-started) | `bun install` | + +After completing the installation, your environment is ready for Vuetify development. + +## ✨ Features + +- 🖼️ **Optimized Front-End Stack**: Leverage the latest Vue 3 and Vuetify 3 for a modern, reactive UI development experience. [Vue 3](https://v3.vuejs.org/) | [Vuetify 3](https://vuetifyjs.com/en/) +- 🗃️ **State Management**: Integrated with [Pinia](https://pinia.vuejs.org/), the intuitive, modular state management solution for Vue. +- 🚦 **Routing and Layouts**: Utilizes Vue Router for SPA navigation and vite-plugin-vue-layouts for organizing Vue file layouts. [Vue Router](https://router.vuejs.org/) | [vite-plugin-vue-layouts](https://github.com/JohnCampionJr/vite-plugin-vue-layouts) +- ⚡ **Next-Gen Tooling**: Powered by Vite, experience fast cold starts and instant HMR (Hot Module Replacement). [Vite](https://vitejs.dev/) +- 🧩 **Automated Component Importing**: Streamline your workflow with unplugin-vue-components, automatically importing components as you use them. [unplugin-vue-components](https://github.com/antfu/unplugin-vue-components) + +These features are curated to provide a seamless development experience from setup to deployment, ensuring that your Vuetify application is both powerful and maintainable. + +## 💡 Usage + +This section covers how to start the development server and build your project for production. + +### Starting the Development Server + +To start the development server with hot-reload, run the following command. The server will be accessible at [http://localhost:3000](http://localhost:3000): + +```bash +yarn dev +``` + +(Repeat for npm, pnpm, and bun with respective commands.) + +> Add NODE_OPTIONS='--no-warnings' to suppress the JSON import warnings that happen as part of the Vuetify import mapping. If you are on Node [v21.3.0](https://nodejs.org/en/blog/release/v21.3.0) or higher, you can change this to NODE_OPTIONS='--disable-warning=5401'. If you don't mind the warning, you can remove this from your package.json dev script. + +### Building for Production + +To build your project for production, use: + +```bash +yarn build +``` + +(Repeat for npm, pnpm, and bun with respective commands.) + +Once the build process is completed, your application will be ready for deployment in a production environment. + +## 💪 Support Vuetify Development + +This project is built with [Vuetify](https://vuetifyjs.com/en/), a UI Library with a comprehensive collection of Vue components. Vuetify is an MIT licensed Open Source project that has been made possible due to the generous contributions by our [sponsors and backers](https://vuetifyjs.com/introduction/sponsors-and-backers/). If you are interested in supporting this project, please consider: + +- [Requesting Enterprise Support](https://support.vuetifyjs.com/) +- [Sponsoring John on Github](https://github.com/users/johnleider/sponsorship) +- [Sponsoring Kael on Github](https://github.com/users/kaelwd/sponsorship) +- [Supporting the team on Open Collective](https://opencollective.com/vuetify) +- [Becoming a sponsor on Patreon](https://www.patreon.com/vuetify) +- [Becoming a subscriber on Tidelift](https://tidelift.com/subscription/npm/vuetify) +- [Making a one-time donation with Paypal](https://paypal.me/vuetify) + +## 📑 License +[MIT](http://opensource.org/licenses/MIT) + +Copyright (c) 2016-present Vuetify, LLC diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..0a84a1c --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,13 @@ + + + + + + +