diff --git a/README.md b/README.md index 1b4d074..05552aa 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ App Design: [Freeform](https://www.icloud.com/freeform/026AxB798cViZ9jJ2DkNsXUCQ - juice website - MacOS - Windows XP style X - UI +- Ghostty ## Stack: diff --git a/components/app/windows/aboutNewsOrg.vue b/components/app/windows/aboutNewsOrg.vue new file mode 100644 index 0000000..f53022b --- /dev/null +++ b/components/app/windows/aboutNewsOrg.vue @@ -0,0 +1,73 @@ + + + + + + + + + {{ fetchNewsOrgInfo?.title }} + + {{ + fetchNewsOrgInfo?.description + }} + + + + + 網站 + + + + \ No newline at end of file diff --git a/components/app/windows/tty.vue b/components/app/windows/tty.vue new file mode 100644 index 0000000..27e0f69 --- /dev/null +++ b/components/app/windows/tty.vue @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/i18n/locales/en.json b/i18n/locales/en.json index 9154d97..7b57673 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -59,6 +59,7 @@ "license": "License", "search": "Search", "chatbot": "Chatbot", - "starred": "Starred" + "starred": "Starred", + "terminal": "Terminal" } } diff --git a/i18n/locales/zh-tw.json b/i18n/locales/zh-tw.json index 0b2bbe6..54b87ac 100644 --- a/i18n/locales/zh-tw.json +++ b/i18n/locales/zh-tw.json @@ -59,6 +59,7 @@ "license": "授權", "search": "搜尋", "chatbot": "聊天機器人", - "starred": "收藏" + "starred": "收藏", + "terminal": "終端機" } } diff --git a/pages/app/desktop/index.vue b/pages/app/desktop/index.vue index 0e1c5c8..2cbceef 100644 --- a/pages/app/desktop/index.vue +++ b/pages/app/desktop/index.vue @@ -23,7 +23,6 @@ interface associAppWindowInterface { // Import plugins import { gsap } from "gsap"; import { TextPlugin } from "gsap/TextPlugin"; -import { createApp } from "vue"; gsap.registerPlugin(TextPlugin); // Import Windows @@ -32,6 +31,7 @@ import HotNewsWindow from "~/components/app/windows/hotnews.vue"; import SourcesWindow from "~/components/app/windows/sources.vue"; 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 Error404Window from "~/components/app/windows/error404.vue"; // Icons @@ -59,7 +59,7 @@ const lang = ref(locale.value); const alertOpen = ref(false); const currentNavBar = ref([]); const bootingAnimation = ref(true); -const activeWindows = ref([]); +const activeWindows = ref([]); const openApp = ref(); const openAppId = ref(); const openAppNameQuery = ref(); @@ -67,6 +67,7 @@ const currentOpenAppId = ref(0); const progress = ref(0); const titleAppName = ref("Desktop"); const openingAppViaAnApp = ref(false); +const passedValues = ref(); // Key Data const menuItems = [ @@ -76,6 +77,7 @@ const menuItems = [ { name: t("app.starred"), windowName: "starred" }, { name: t("app.chatbot"), windowName: "chatbot" }, { name: t("app.about"), windowName: "about" }, + { name: t("app.terminal"), windowName: "tty" }, { name: t("app.settings"), windowName: "settings" }, { name: t("app.login"), windowName: "login" }, { name: t("app.leave"), windowName: "leave" }, @@ -142,8 +144,67 @@ const associAppWindow = [ title: t("app.error404"), component: Error404Window, }, + { + name: "aboutNewsOrg", + id: "10", + title: t("app.aboutNewsOrg"), + component: AboutNewsOrgWindow, + }, + { + name: "tty", + id: "11", + title: t("app.terminal"), + component: Error404Window, + } ]; +/* +const keyboardShortcuts = { + 'Meta+k': { + action: () => toggleMenu(), + description: 'Toggle menu' + }, + 'Meta+q': { + action: () => router.push(localePath("/home")), + description: 'Quit to home' + }, + 'Meta+w': { + action: () => closeWindow(activeWindows.value[activeWindows.value.length - 1]?.id), + description: 'Close current window' + }, + 'Meta+t': { + action: () => findAndOpenWindow('tty'), + description: 'Open terminal' + }, +} + + +// Keyboard shortcuts +const handleKeyboardActions = (e: KeyboardEvent) => { + const key = [ + e.metaKey ? "Meta": "", + e.ctrlKey ? "Ctrl": "", + e.shiftKey ? "Shift": "", + e.altKey ? "Alt": "", + e.key.toLowerCase() + ].filter(Boolean).join('+') + + const shortcut = keyboardShortcuts[key]; + if (shortcut) { + console.log(`Shortcut triggered: ${key}`); + e.preventDefault() + shortcut.action() + } +} + +onMounted(() => { + window.addEventListener('keydown', handleKeyboardActions) +}); + +onUnmounted(() => { + window.removeEventListener('keydown', handleKeyboardActions) +}); +*/ // Date const currentDate = ref( new Date().toLocaleDateString("zh-TW", { @@ -430,6 +491,7 @@ watchEffect((cleanupFn) => { :is="window.component" @error="console.error('Error:', $event)" @windowopener="openNewWindowViaApp($event)" + :values="passedValues" /> diff --git a/pages/sources.vue b/pages/sources.vue deleted file mode 100644 index eb8e7f4..0000000 --- a/pages/sources.vue +++ /dev/null @@ -1 +0,0 @@ -1. Yahoo RSS Api 2. Google News Search diff --git a/scraping/hot_articles.py b/scraping/hot_articles.py index 0c3c411..831cc85 100644 --- a/scraping/hot_articles.py +++ b/scraping/hot_articles.py @@ -12,12 +12,12 @@ dotenv.load_dotenv() # Connect to PostgresDB -#conn = psycopg2.connect(database=os.getenv("POSTGRES_DB"), -# user=os.getenv("POSTGRES_USER"), -# password=os.getenv("POSTGRES_PASSWORD"), -# host=os.getenv("POSTGRES_HOST"), -# port=os.getenv("POSTGRES_PORT") -#) +conn = psycopg2.connect(database=os.getenv("POSTGRES_DB"), + user=os.getenv("POSTGRES_USER"), + password=os.getenv("POSTGRES_PASSWORD"), + host=os.getenv("POSTGRES_HOST"), + port=os.getenv("POSTGRES_PORT") + ) headers = { 'User-Agent': 'NewsSceraperBot/1.0 (https://github.com/hpware/news-analyze)'