From a89fbd4fd750756f0cf0d887f16bcab50d7d7a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B3=E5=85=83=E7=9A=93?= Date: Sat, 17 May 2025 20:50:23 +0800 Subject: [PATCH] Add a login wall on a few windows, but still no auth / login logic yet... --- LICENSE | 21 +++++ components/DraggableWindow.vue | 2 +- components/app/windows/chatbot.vue | 132 ++++++++++++++++------------- components/app/windows/fav.vue | 9 ++ components/blurPageBeforeLogin.vue | 39 +++++++++ i18n/locales/en.json | 2 + i18n/locales/zh-tw.json | 2 + pages/app/desktop/index.vue | 11 ++- server/api/user/logout.ts | 3 + 9 files changed, 157 insertions(+), 64 deletions(-) create mode 100644 LICENSE create mode 100644 components/app/windows/fav.vue create mode 100644 components/blurPageBeforeLogin.vue create mode 100644 server/api/user/logout.ts diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ab7d0e6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 hpware + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/components/DraggableWindow.vue b/components/DraggableWindow.vue index f080c2a..ccf886b 100644 --- a/components/DraggableWindow.vue +++ b/components/DraggableWindow.vue @@ -76,7 +76,7 @@ const stopDrag = () => { >

{{ title }}

diff --git a/components/app/windows/chatbot.vue b/components/app/windows/chatbot.vue index dbe4936..4d6a4f9 100644 --- a/components/app/windows/chatbot.vue +++ b/components/app/windows/chatbot.vue @@ -15,6 +15,7 @@ import { BotMessageSquare, } from "lucide-vue-next"; import { Input } from "~/components/ui/input"; +import blurPageBeforeLogin from "~/components/blurPageBeforeLogin.vue"; import { v4 as uuidv4 } from "uuid"; const { t } = useI18n(); const cookie = useCookie("lastChatId"); @@ -53,6 +54,12 @@ onMounted(async () => { } else { const { data: checkUserChatId } = await useFetch( "/api/ai/chat/actions/findUserChatId", + { + method: "POST", + body: { + userid: "393393", + }, + }, ); cookieChatId.value = checkUserChatId.value; } @@ -66,75 +73,80 @@ onMounted(async () => { }); diff --git a/components/app/windows/fav.vue b/components/app/windows/fav.vue new file mode 100644 index 0000000..69ad887 --- /dev/null +++ b/components/app/windows/fav.vue @@ -0,0 +1,9 @@ + + diff --git a/components/blurPageBeforeLogin.vue b/components/blurPageBeforeLogin.vue new file mode 100644 index 0000000..9a0ddb1 --- /dev/null +++ b/components/blurPageBeforeLogin.vue @@ -0,0 +1,39 @@ + + diff --git a/i18n/locales/en.json b/i18n/locales/en.json index 5616f15..90dadc5 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -51,6 +51,8 @@ "dailybriefing": "Daily Briefing", "Welcome": "Welcome", "loading": "Loading...", + "error": "Oops! You can not use this resoure before logging in.", + "systemerror": "Oh cool, you found an error, please contact [at]hwtw on Discord, and I can **try** to fix it", "app": { "changelangmessage": "Switching the language...", "launchtext": "Cooking up the desktop...", diff --git a/i18n/locales/zh-tw.json b/i18n/locales/zh-tw.json index 80db6e5..9143045 100644 --- a/i18n/locales/zh-tw.json +++ b/i18n/locales/zh-tw.json @@ -51,6 +51,8 @@ "dailybriefing": "今日報導", "Welcome": "歡迎", "loading": "載入中...", + "error": "你還沒登入ㄟ,這個功能要登入才可以用", + "systemerror": "ㄚ 你撞上了一個錯誤,可以傳給我嗎?我在DC的帳號是[at]hwtw ", "app": { "changelangmessage": "正在切換語言中...", "launchtext": "系統開機中...", diff --git a/pages/app/desktop/index.vue b/pages/app/desktop/index.vue index 35507fe..e3e68f2 100644 --- a/pages/app/desktop/index.vue +++ b/pages/app/desktop/index.vue @@ -39,6 +39,7 @@ import AboutWindow from "~/components/app/windows/about.vue"; import ChatbotWindow from "~/components/app/windows/chatbot.vue"; import AboutNewsOrgWindow from "~/components/app/windows/aboutNewsOrg.vue"; import TTYWindow from "~/components/app/windows/tty.vue"; +import FavStaredWindow from "~/components/app/windows/fav.vue"; import Error404Window from "~/components/app/windows/error404.vue"; // Icons @@ -137,7 +138,7 @@ const associAppWindow = [ name: "starred", id: "7", title: t("app.starred"), - component: Error404Window, + component: FavStaredWindow, }, { name: "chatbot", @@ -384,6 +385,10 @@ const maxWindow = (windowUUId: string) => { console.log(windowIndex); }; +const toggleMinWindow = (windowUUId: string) => { + const windowIndex = ""; +}; + // Title useSeoMeta({ title: "Desktop", @@ -459,7 +464,7 @@ watchEffect((cleanupFn) => { v-else > -
+