From f0e33905b8224942d3c119fb7eaeeda65a8cf125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B3=E5=85=83=E7=9A=93?= Date: Tue, 3 Jun 2025 16:40:25 +0800 Subject: [PATCH] Change to axios as there is no way to get the profile pic via the raw html & remove the legacy hot news by google rss window, (it is still accessable via the tty interface) and update i18n with the aboutNewsOrg thingy added articles (that currently does not work) & also added the privacy policy & tos page, both only accessbile via the tty interface for now. It will be avaible via the settings interface. --- .gitignore | 1 + bun.lock | 1 + components/app/windows/aboutNewsOrg.vue | 11 +++++++- components/app/windows/privacypolicy.vue | 9 +++++++ components/app/windows/tos.vue | 6 +++++ i18n/locales/en.json | 10 ++++++++ i18n/locales/zh-tw.json | 10 ++++++++ package.json | 1 + pages/desktop.vue | 32 ++++++++++++++++-------- server/api/publishers/lt/[slug].ts | 7 ++++-- 10 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 components/app/windows/privacypolicy.vue create mode 100644 components/app/windows/tos.vue diff --git a/.gitignore b/.gitignore index 3f53968..f9c0eb2 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ _dt_*.py # Testing files test.vue +100106_lt_test.html diff --git a/bun.lock b/bun.lock index c79afba..a9ef13e 100644 --- a/bun.lock +++ b/bun.lock @@ -17,6 +17,7 @@ "@vueuse/core": "^13.2.0", "animate.css": "^4.1.1", "argon2": "^0.43.0", + "axios": "^1.9.0", "cheerio": "^1.0.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", diff --git a/components/app/windows/aboutNewsOrg.vue b/components/app/windows/aboutNewsOrg.vue index 6366f83..7346706 100644 --- a/components/app/windows/aboutNewsOrg.vue +++ b/components/app/windows/aboutNewsOrg.vue @@ -16,11 +16,13 @@ const props = defineProps({ }, }); +const staticProps = props; + const { data: fetchNewsOrgInfo, pending, error, -} = useFetch(`/api/cached/getData/fetchNewsOrgInfo/${props.values}`, { +} = useFetch(`/api/publishers/lt/${staticProps.values}`, { method: "POST", headers: { "Content-Type": "application/json", @@ -73,18 +75,25 @@ watch( 網站 Facebook +
+
+ {{ item.title }} +
+
diff --git a/components/app/windows/privacypolicy.vue b/components/app/windows/privacypolicy.vue new file mode 100644 index 0000000..9bd1c5e --- /dev/null +++ b/components/app/windows/privacypolicy.vue @@ -0,0 +1,9 @@ + + diff --git a/components/app/windows/tos.vue b/components/app/windows/tos.vue new file mode 100644 index 0000000..c05d3dd --- /dev/null +++ b/components/app/windows/tos.vue @@ -0,0 +1,6 @@ + + diff --git a/i18n/locales/en.json b/i18n/locales/en.json index c650e72..5a44d88 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -104,5 +104,15 @@ "checkweirdkeywords": "This tool check if the news title has weird 18+ content.", "noadlinetoday": "Provides free, no ads Line today." } + }, + "pages": { + "privacypolicy": { + "title": "Privacy Policy", + "content": "Ummmm" + }, + "tos": { + "title": "Terms of service", + "content": "N/A" + } } } diff --git a/i18n/locales/zh-tw.json b/i18n/locales/zh-tw.json index fb16b0c..d5f1e78 100644 --- a/i18n/locales/zh-tw.json +++ b/i18n/locales/zh-tw.json @@ -104,5 +104,15 @@ "checkweirdkeywords": "這個工具檢查新聞記者是不是使用偏色情的標體 (台灣的很愛用)", "noadlinetoday": "提供無廣告的LINE Today 新聞" } + }, + "pages": { + "privacypolicy": { + "title": "Privacy Policy", + "content": "Ummmm" + }, + "tos": { + "title": "Terms of service", + "content": "N/A" + } } } diff --git a/package.json b/package.json index 9084e2b..5999776 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@vueuse/core": "^13.2.0", "animate.css": "^4.1.1", "argon2": "^0.43.0", + "axios": "^1.9.0", "cheerio": "^1.0.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", diff --git a/pages/desktop.vue b/pages/desktop.vue index 686f402..a588974 100644 --- a/pages/desktop.vue +++ b/pages/desktop.vue @@ -41,8 +41,6 @@ interface minAppWindowInterface { // Import plugins import { v4 as uuidv4 } from "uuid"; import { gsap } from "gsap"; -import { TextPlugin } from "gsap/TextPlugin"; -gsap.registerPlugin(TextPlugin); // Import Windows import UserWindow from "~/components/app/windows/user.vue"; @@ -56,6 +54,8 @@ import FavStaredWindow from "~/components/app/windows/fav.vue"; import NewsWindow from "~/components/app/windows/news.vue"; import NewsViewWindow from "~/components/app/windows/newsView.vue"; import SettingsWindow from "~/components/app/windows/settings.vue"; +import PrivacyPolicyWindow from "~/components/app/windows/privacypolicy.vue"; +import TOSWindow from "~/components/app/windows/tos.vue"; // Import Icons import { @@ -75,9 +75,7 @@ const route = useRoute(); // values const popMessage = ref(null); const menuOpen = ref(false); -const langMenuOpen = ref(false); -const lang = ref(locale.value); -const alertOpen = ref(false); +2; const currentNavBar = ref([]); const bootingAnimation = ref(true); const activeWindows = ref([]); @@ -92,13 +90,10 @@ const openingAppViaAnApp = ref(false); const passedValues = ref(); const globalWindowVal = ref(new Map()); const changeLangAnimation = ref(false); -const openArticlesArray = ref([]); -const openArticlesId = ref(0); -const storeStaticArticleId = ref(0); // Key Data const menuItems = [ - { name: t("app.hotnews"), windowName: "hotnews" }, + // { name: t("app.hotnews"), windowName: "hotnews" }, { name: t("app.news"), windowName: "news" }, { name: t("app.sources"), windowName: "sources" }, { name: t("app.starred"), windowName: "starred" }, @@ -112,7 +107,7 @@ const menuItems = [ const associAppWindow = [ { - name: "hotnews", + name: "googlenews", id: "1", title: t("app.hotnews"), component: HotNewsWindow, @@ -186,6 +181,18 @@ const associAppWindow = [ title: t("app.newsview"), component: NewsViewWindow, }, + { + name: "privacypolicy", + id: "12", + title: t("app.privacypolicy"), + component: PrivacyPolicyWindow, + }, + { + name: "tos", + id: "13", + title: t("app.tos"), + component: TOSWindow, + }, ]; // Date @@ -488,7 +495,8 @@ const openNewsSourcePage = async (slug: string, title: string) => { v-model="progress" class="w-3/5 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2" /> -
+ +
{{ t("app.launchtext") }} @@ -591,6 +599,8 @@ const openNewsSourcePage = async (slug: string, title: string) => { @openArticles="openArticles" @openNewsSourcePage="openNewsSourcePage" :values="passedValues" + :windows="activeWindows" + @closeWindow="closeWindow" /> diff --git a/server/api/publishers/lt/[slug].ts b/server/api/publishers/lt/[slug].ts index 1341b91..0d85246 100644 --- a/server/api/publishers/lt/[slug].ts +++ b/server/api/publishers/lt/[slug].ts @@ -1,3 +1,4 @@ +// TODO Add caching import * as cheerio from "cheerio"; export default defineEventHandler(async (event) => { @@ -24,8 +25,9 @@ export default defineEventHandler(async (event) => { .text() .replace(/.css-.*\}/, ""); const description = html("p.description").text(); + const logoClue = html("div.editor").contents(); const logo = - html("div.editor div figure img").attr("srcset") || + logoClue.find("img").attr("srcset") || html("div.editor div figure img").attr("src") || ""; const bgImage = html("figure.keyVisual img").attr("srcset") || ""; @@ -49,10 +51,11 @@ export default defineEventHandler(async (event) => { } }); return { - name: newsOrgName, + title: newsOrgName, description: description, logo: logo, articles: otherArticles, + logoClue: String(logoClue), }; } catch (e) { console.log(e);